Merge "Clean up ImageReader when VrMode is disabled." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5d1c65971f
@@ -107,7 +107,6 @@ class CompatibilityDisplay {
|
|||||||
// TODO: STOPSHIP Remove createVirtualDisplay conditional before launching.
|
// TODO: STOPSHIP Remove createVirtualDisplay conditional before launching.
|
||||||
if (createVirtualDisplay) {
|
if (createVirtualDisplay) {
|
||||||
startVirtualDisplay();
|
startVirtualDisplay();
|
||||||
startImageReader();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Stop virtual display to test exit condition
|
// Stop virtual display to test exit condition
|
||||||
@@ -208,6 +207,8 @@ class CompatibilityDisplay {
|
|||||||
if (mVirtualDisplay != null) {
|
if (mVirtualDisplay != null) {
|
||||||
mActivityManagerInternal.setVrCompatibilityDisplayId(
|
mActivityManagerInternal.setVrCompatibilityDisplayId(
|
||||||
mVirtualDisplay.getDisplay().getDisplayId());
|
mVirtualDisplay.getDisplay().getDisplayId());
|
||||||
|
// Now create the ImageReader to supply a Surface to the new virtual display.
|
||||||
|
startImageReader();
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Virtual display id is null after createVirtualDisplay");
|
Log.w(TAG, "Virtual display id is null after createVirtualDisplay");
|
||||||
mActivityManagerInternal.setVrCompatibilityDisplayId(INVALID_DISPLAY);
|
mActivityManagerInternal.setVrCompatibilityDisplayId(INVALID_DISPLAY);
|
||||||
@@ -241,6 +242,7 @@ class CompatibilityDisplay {
|
|||||||
mVirtualDisplay.release();
|
mVirtualDisplay.release();
|
||||||
mVirtualDisplay = null;
|
mVirtualDisplay = null;
|
||||||
}
|
}
|
||||||
|
stopImageReader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,4 +288,14 @@ class CompatibilityDisplay {
|
|||||||
setSurfaceLocked(mImageReader.getSurface());
|
setSurfaceLocked(mImageReader.getSurface());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleans up the ImageReader.
|
||||||
|
*/
|
||||||
|
private void stopImageReader() {
|
||||||
|
if (mImageReader != null) {
|
||||||
|
mImageReader.close();
|
||||||
|
mImageReader = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user