Fix leakage of pointer location
When display is removing, we should explicitly remove the pointer
location view to ensure the client object would be released.
Bug: 239078899
Test: Enabled pointer location, add/remove virtual display, check if
the surface would be released.
Change-Id: I89ef3dc8e5b4aa8c3b7d5c1393d6543a9d3d67db
This commit is contained in:
@@ -828,6 +828,8 @@ public class PointerLocationView extends View implements InputDeviceListener,
|
||||
mSystemGestureExclusionListener, mContext.getDisplayId());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(TAG, "Failed to unregister window manager callbacks", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2907,7 +2907,10 @@ public class DisplayPolicy {
|
||||
return;
|
||||
}
|
||||
|
||||
mDisplayContent.unregisterPointerEventListener(mPointerLocationView);
|
||||
if (!mDisplayContent.isRemoved()) {
|
||||
mDisplayContent.unregisterPointerEventListener(mPointerLocationView);
|
||||
}
|
||||
|
||||
final WindowManager wm = mContext.getSystemService(WindowManager.class);
|
||||
wm.removeView(mPointerLocationView);
|
||||
mPointerLocationView = null;
|
||||
@@ -2932,6 +2935,9 @@ public class DisplayPolicy {
|
||||
mHandler.post(mGestureNavigationSettingsObserver::unregister);
|
||||
mHandler.post(mForceShowNavBarSettingsObserver::unregister);
|
||||
mImmersiveModeConfirmation.release();
|
||||
if (mService.mPointerLocationEnabled) {
|
||||
setPointerLocationEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
Reference in New Issue
Block a user