diff options
| -rw-r--r-- | core/java/com/android/internal/widget/PointerLocationView.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/DisplayPolicy.java | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java index 09ff4e0aa076..9ee9b8249493 100644 --- a/core/java/com/android/internal/widget/PointerLocationView.java +++ b/core/java/com/android/internal/widget/PointerLocationView.java @@ -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); } } diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 7aa05412ec88..7b4189b3291d 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -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 |