Camera: Avoid possible NPE after extension session configuration
Camera extension clients are able to close and release camera and all associated extension resources while an advanced extension session configuration is in progress. In case, the extension initializer callback gets executed after all resources are released it may try to access the already released binder interface triggering NPE. Bug: 268437036 Test: atest -c -d cts/tests/camera/src/android/hardware/camera2/cts/CameraExtensionSessionTest.java Change-Id: Ib6fdc9d08e973616dc7d83264dc3f320e496cbd3
This commit is contained in:
@@ -528,8 +528,15 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
|
||||
boolean status = true;
|
||||
synchronized (mInterfaceLock) {
|
||||
try {
|
||||
mSessionProcessor.onCaptureSessionStart(mRequestProcessor);
|
||||
mInitialized = true;
|
||||
if (mSessionProcessor != null) {
|
||||
mSessionProcessor.onCaptureSessionStart(mRequestProcessor);
|
||||
mInitialized = true;
|
||||
} else {
|
||||
Log.v(TAG, "Failed to start capture session, session released before " +
|
||||
"extension start!");
|
||||
status = false;
|
||||
mCaptureSession.close();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Failed to start capture session,"
|
||||
+ " extension service does not respond!");
|
||||
|
||||
Reference in New Issue
Block a user