Merge "Handle pointer location setting in InputSettingsObserver" into udc-qpr-dev am: 3830afc12d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23751947

Change-Id: I0e6c642522234767238d4853ea70c1bbae7ea89e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Josep del Río
2023-07-04 19:35:02 +00:00
committed by Automerger Merge Worker
4 changed files with 31 additions and 24 deletions

View File

@@ -2804,6 +2804,11 @@ public class InputManagerService extends IInputManager.Stub
*/
void notifyConfigurationChanged();
/**
* This callback is invoked when the pointer location changes.
*/
void notifyPointerLocationChanged(boolean pointerLocationEnabled);
/**
* This callback is invoked when the camera lens cover switch changes state.
* @param whenNanos the time when the change occurred
@@ -3386,6 +3391,10 @@ public class InputManagerService extends IInputManager.Stub
}
}
void updatePointerLocationEnabled(boolean enabled) {
mWindowManagerCallbacks.notifyPointerLocationChanged(enabled);
}
void updateFocusEventDebugViewEnabled(boolean enabled) {
FocusEventDebugView view;
synchronized (mFocusEventDebugViewLock) {

View File

@@ -67,6 +67,8 @@ class InputSettingsObserver extends ContentObserver {
(reason) -> updateTouchpadRightClickZoneEnabled()),
Map.entry(Settings.System.getUriFor(Settings.System.SHOW_TOUCHES),
(reason) -> updateShowTouches()),
Map.entry(Settings.System.getUriFor(Settings.System.POINTER_LOCATION),
(reason) -> updatePointerLocation()),
Map.entry(
Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON),
(reason) -> updateAccessibilityLargePointer()),
@@ -149,6 +151,11 @@ class InputSettingsObserver extends ContentObserver {
mNative.setShowTouches(getBoolean(Settings.System.SHOW_TOUCHES, false));
}
private void updatePointerLocation() {
mService.updatePointerLocationEnabled(
getBoolean(Settings.System.POINTER_LOCATION, false));
}
private void updateShowKeyPresses() {
mService.updateFocusEventDebugViewEnabled(
getBoolean(Settings.System.SHOW_KEY_PRESSES, false));

View File

@@ -128,6 +128,21 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal
}
}
/** Notifies that the pointer location configuration has changed. */
@Override
public void notifyPointerLocationChanged(boolean pointerLocationEnabled) {
if (mService.mPointerLocationEnabled == pointerLocationEnabled) {
return;
}
synchronized (mService.mGlobalLock) {
mService.mPointerLocationEnabled = pointerLocationEnabled;
mService.mRoot.forAllDisplayPolicies(
p -> p.setPointerLocationEnabled(mService.mPointerLocationEnabled)
);
}
}
/** Notifies that the lid switch changed state. */
@Override
public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) {

View File

@@ -763,8 +763,6 @@ public class WindowManagerService extends IWindowManager.Stub
Settings.Secure.getUriFor(Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS);
private final Uri mPolicyControlUri =
Settings.Global.getUriFor(Settings.Global.POLICY_CONTROL);
private final Uri mPointerLocationUri =
Settings.System.getUriFor(Settings.System.POINTER_LOCATION);
private final Uri mForceDesktopModeOnExternalDisplaysUri = Settings.Global.getUriFor(
Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS);
private final Uri mFreeformWindowUri = Settings.Global.getUriFor(
@@ -792,7 +790,6 @@ public class WindowManagerService extends IWindowManager.Stub
resolver.registerContentObserver(mImmersiveModeConfirmationsUri, false, this,
UserHandle.USER_ALL);
resolver.registerContentObserver(mPolicyControlUri, false, this, UserHandle.USER_ALL);
resolver.registerContentObserver(mPointerLocationUri, false, this, UserHandle.USER_ALL);
resolver.registerContentObserver(mForceDesktopModeOnExternalDisplaysUri, false, this,
UserHandle.USER_ALL);
resolver.registerContentObserver(mFreeformWindowUri, false, this, UserHandle.USER_ALL);
@@ -816,11 +813,6 @@ public class WindowManagerService extends IWindowManager.Stub
return;
}
if (mPointerLocationUri.equals(uri)) {
updatePointerLocation();
return;
}
if (mForceDesktopModeOnExternalDisplaysUri.equals(uri)) {
updateForceDesktopModeOnExternalDisplays();
return;
@@ -869,7 +861,6 @@ public class WindowManagerService extends IWindowManager.Stub
void loadSettings() {
updateSystemUiSettings(false /* handleChange */);
updatePointerLocation();
updateMaximumObscuringOpacityForTouch();
}
@@ -900,21 +891,6 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
void updatePointerLocation() {
ContentResolver resolver = mContext.getContentResolver();
final boolean enablePointerLocation = Settings.System.getIntForUser(resolver,
Settings.System.POINTER_LOCATION, 0, UserHandle.USER_CURRENT) != 0;
if (mPointerLocationEnabled == enablePointerLocation) {
return;
}
mPointerLocationEnabled = enablePointerLocation;
synchronized (mGlobalLock) {
mRoot.forAllDisplayPolicies(
p -> p.setPointerLocationEnabled(mPointerLocationEnabled));
}
}
void updateForceDesktopModeOnExternalDisplays() {
ContentResolver resolver = mContext.getContentResolver();
final boolean enableForceDesktopMode = Settings.Global.getInt(resolver,