Camera: fix NPE in verifyFpsNotSlowDown
Bug: 30980572
Change-Id: Iae20835ca6e722dbe53a085f2f962aaa91f198d6
diff --git a/tests/camera/src/android/hardware/camera2/cts/CaptureRequestTest.java b/tests/camera/src/android/hardware/camera2/cts/CaptureRequestTest.java
index ebda3dd..ae5c2ea 100644
--- a/tests/camera/src/android/hardware/camera2/cts/CaptureRequestTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/CaptureRequestTest.java
@@ -2622,7 +2622,7 @@
}
}
- mSession.stopRepeating();
+ stopPreview();
}
/**
diff --git a/tests/camera/src/android/hardware/camera2/cts/testcases/Camera2SurfaceViewTestCase.java b/tests/camera/src/android/hardware/camera2/cts/testcases/Camera2SurfaceViewTestCase.java
index 8d141c4..a95f4f3 100644
--- a/tests/camera/src/android/hardware/camera2/cts/testcases/Camera2SurfaceViewTestCase.java
+++ b/tests/camera/src/android/hardware/camera2/cts/testcases/Camera2SurfaceViewTestCase.java
@@ -222,9 +222,11 @@
* Does _not_ wait for the device to go idle
*/
protected void stopPreview() throws Exception {
- if (VERBOSE) Log.v(TAG, "Stopping preview");
// Stop repeat, wait for captures to complete, and disconnect from surfaces
- mSession.close();
+ if (mSession != null) {
+ if (VERBOSE) Log.v(TAG, "Stopping preview");
+ mSession.close();
+ }
}
/**
@@ -232,11 +234,13 @@
* resulting in an idle device.
*/
protected void stopPreviewAndDrain() throws Exception {
- if (VERBOSE) Log.v(TAG, "Stopping preview and waiting for idle");
// Stop repeat, wait for captures to complete, and disconnect from surfaces
- mSession.close();
- mSessionListener.getStateWaiter().waitForState(BlockingSessionCallback.SESSION_CLOSED,
- /*timeoutMs*/WAIT_FOR_RESULT_TIMEOUT_MS);
+ if (mSession != null) {
+ if (VERBOSE) Log.v(TAG, "Stopping preview and waiting for idle");
+ mSession.close();
+ mSessionListener.getStateWaiter().waitForState(BlockingSessionCallback.SESSION_CLOSED,
+ /*timeoutMs*/WAIT_FOR_RESULT_TIMEOUT_MS);
+ }
}
/**