Merge "Fix leakage of pointer location" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-08-03 11:12:10 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -2933,7 +2933,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;
@@ -2958,6 +2961,9 @@ public class DisplayPolicy {
mHandler.post(mGestureNavigationSettingsObserver::unregister);
mHandler.post(mForceShowNavBarSettingsObserver::unregister);
mImmersiveModeConfirmation.release();
if (mService.mPointerLocationEnabled) {
setPointerLocationEnabled(false);
}
}
@VisibleForTesting