[Change]完成摄像头功能

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
(cherry picked from commit b215dec486)
This commit is contained in:
donghongyu
2022-02-10 20:12:09 +08:00
parent cdee266805
commit 69a0d6a3cc
4 changed files with 23 additions and 9 deletions

View File

@@ -108,7 +108,9 @@ public final class USBMonitor {
mOnDeviceConnectListener = listener;
mAsyncHandler = HandlerThreadHandler.createHandler(TAG);
destroyed = false;
if (DEBUG) Log.v(TAG, "USBMonitor:mUsbManager=" + mUsbManager);
if (DEBUG) {
Log.v(TAG, "USBMonitor:mUsbManager=" + mUsbManager);
}
}
/**
@@ -116,7 +118,9 @@ public final class USBMonitor {
* never reuse again
*/
public void destroy() {
if (DEBUG) Log.i(TAG, "destroy:");
if (DEBUG) {
Log.i(TAG, "destroy:");
}
unregister();
if (!destroyed) {
destroyed = true;
@@ -149,9 +153,13 @@ public final class USBMonitor {
* @throws IllegalStateException
*/
public synchronized void register() throws IllegalStateException {
if (destroyed) throw new IllegalStateException("already destroyed");
if (destroyed) {
throw new IllegalStateException("already destroyed");
}
if (mPermissionIntent == null) {
if (DEBUG) Log.i(TAG, "register:");
if (DEBUG) {
Log.i(TAG, "register:");
}
final Context context = mWeakContext.get();
if (context != null) {
mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), 0);

View File

@@ -480,6 +480,7 @@ public abstract class AbstractUVCCameraHandler extends Handler {
try {
mSync.wait();
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
}