Exclude accessing settings from PointerIcon.

This code structure causes a crash as rerported, better to extract
access to the settings to InputManagerService, who actually cares
about it.

Bug: 26196092
Change-Id: I4e0dbcc24ccf5d11681738ca3576b64471aa8cc4
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index 8b37383..68b3817 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -320,12 +320,13 @@
             public void onReceive(Context context, Intent intent) {
                 updatePointerSpeedFromSettings();
                 updateShowTouchesFromSettings();
-                nativeReloadPointerIcons(mPtr);
+                updateAccessibilityLargePointerFromSettings();
             }
         }, new IntentFilter(Intent.ACTION_USER_SWITCHED), null, mHandler);
 
         updatePointerSpeedFromSettings();
         updateShowTouchesFromSettings();
+        updateAccessibilityLargePointerFromSettings();
     }
 
     // TODO(BT) Pass in paramter for bluetooth system
@@ -1366,13 +1367,21 @@
                 }, UserHandle.USER_ALL);
     }
 
+    public void updateAccessibilityLargePointerFromSettings() {
+        final int accessibilityConfig = Settings.Secure.getIntForUser(
+                mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON,
+                0, UserHandle.USER_CURRENT);
+        PointerIcon.sUseLargeIcons = (accessibilityConfig == 1);
+        nativeReloadPointerIcons(mPtr);
+    }
+
     private void registerAccessibilityLargePointerSettingObserver() {
         mContext.getContentResolver().registerContentObserver(
                 Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_LARGE_POINTER_ICON), true,
                 new ContentObserver(mHandler) {
                     @Override
                     public void onChange(boolean selfChange) {
-                        nativeReloadPointerIcons(mPtr);
+                        updateAccessibilityLargePointerFromSettings();
                     }
                 }, UserHandle.USER_ALL);
     }