Loading core/java/android/hardware/input/InputManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.app.ActivityThread; import android.compat.annotation.ChangeId; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.pm.PackageManager; import android.hardware.BatteryState; import android.hardware.SensorManager; import android.hardware.lights.Light; Loading Loading @@ -1893,6 +1894,31 @@ public final class InputManager { } } /** * Whether stylus has ever been used on device (false by default). * @hide */ public boolean isStylusEverUsed(@NonNull Context context) { return Settings.Global.getInt(context.getContentResolver(), Settings.Global.STYLUS_EVER_USED, 0) == 1; } /** * Set whether stylus has ever been used on device. * Should only ever be set to true once after stylus first usage. * @hide */ @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) public void setStylusEverUsed(@NonNull Context context, boolean stylusEverUsed) { if (context.checkCallingPermission(Manifest.permission.WRITE_SECURE_SETTINGS) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("You need WRITE_SECURE_SETTINGS permission " + "to set stylus ever used."); } Settings.Global.putInt(context.getContentResolver(), Settings.Global.STYLUS_EVER_USED, stylusEverUsed ? 1 : 0); } /** * A callback used to be notified about battery state changes for an input device. The * {@link #onBatteryStateChanged(int, long, BatteryState)} method will be called once after the Loading core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -15787,6 +15787,15 @@ public final class Settings { @SuppressLint("NoSettingsProvider") public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled"; /** * Indicates whether a stylus has ever been used on the device. * * @hide */ @Readable @SuppressLint("NoSettingsProvider") public static final String STYLUS_EVER_USED = "stylus_ever_used"; /** * Exemptions to the hidden API blacklist. * packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,7 @@ public class GlobalSettingsValidators { VALIDATORS.put(Global.ADVANCED_BATTERY_USAGE_AMOUNT, PERCENTAGE_INTEGER_VALIDATOR); VALIDATORS.put(Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Global.POWER_BUTTON_LONG_PRESS_DURATION_MS, NONE_NEGATIVE_LONG_VALIDATOR); VALIDATORS.put(Global.STYLUS_EVER_USED, BOOLEAN_VALIDATOR); VALIDATORS.put(Global.Wearable.HAS_PAY_TOKENS, BOOLEAN_VALIDATOR); VALIDATORS.put(Global.Wearable.GMS_CHECKIN_TIMEOUT_MIN, ANY_INTEGER_VALIDATOR); Loading packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ public class SettingsBackupTest { Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS, Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS, Settings.Global.STYLUS_HANDWRITING_ENABLED, Settings.Global.STYLUS_EVER_USED, Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT, Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS, Settings.Global.ENHANCED_4G_MODE_ENABLED, Loading packages/SystemUI/src/com/android/systemui/dagger/FrameworkServicesModule.java +7 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.hardware.display.ColorDisplayManager; import android.hardware.display.DisplayManager; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; import android.hardware.input.InputManager; import android.media.AudioManager; import android.media.IAudioService; import android.media.MediaRouter2Manager; Loading Loading @@ -282,6 +283,12 @@ public class FrameworkServicesModule { return InteractionJankMonitor.getInstance(); } @Provides @Singleton static InputManager provideInputManager(Context context) { return context.getSystemService(InputManager.class); } @Provides @Singleton static InputMethodManager provideInputMethodManager(Context context) { Loading Loading
core/java/android/hardware/input/InputManager.java +26 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.app.ActivityThread; import android.compat.annotation.ChangeId; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.content.pm.PackageManager; import android.hardware.BatteryState; import android.hardware.SensorManager; import android.hardware.lights.Light; Loading Loading @@ -1893,6 +1894,31 @@ public final class InputManager { } } /** * Whether stylus has ever been used on device (false by default). * @hide */ public boolean isStylusEverUsed(@NonNull Context context) { return Settings.Global.getInt(context.getContentResolver(), Settings.Global.STYLUS_EVER_USED, 0) == 1; } /** * Set whether stylus has ever been used on device. * Should only ever be set to true once after stylus first usage. * @hide */ @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS) public void setStylusEverUsed(@NonNull Context context, boolean stylusEverUsed) { if (context.checkCallingPermission(Manifest.permission.WRITE_SECURE_SETTINGS) != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("You need WRITE_SECURE_SETTINGS permission " + "to set stylus ever used."); } Settings.Global.putInt(context.getContentResolver(), Settings.Global.STYLUS_EVER_USED, stylusEverUsed ? 1 : 0); } /** * A callback used to be notified about battery state changes for an input device. The * {@link #onBatteryStateChanged(int, long, BatteryState)} method will be called once after the Loading
core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -15787,6 +15787,15 @@ public final class Settings { @SuppressLint("NoSettingsProvider") public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled"; /** * Indicates whether a stylus has ever been used on the device. * * @hide */ @Readable @SuppressLint("NoSettingsProvider") public static final String STYLUS_EVER_USED = "stylus_ever_used"; /** * Exemptions to the hidden API blacklist. *
packages/SettingsProvider/src/android/provider/settings/validators/GlobalSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,7 @@ public class GlobalSettingsValidators { VALIDATORS.put(Global.ADVANCED_BATTERY_USAGE_AMOUNT, PERCENTAGE_INTEGER_VALIDATOR); VALIDATORS.put(Global.ADAPTIVE_BATTERY_MANAGEMENT_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Global.POWER_BUTTON_LONG_PRESS_DURATION_MS, NONE_NEGATIVE_LONG_VALIDATOR); VALIDATORS.put(Global.STYLUS_EVER_USED, BOOLEAN_VALIDATOR); VALIDATORS.put(Global.Wearable.HAS_PAY_TOKENS, BOOLEAN_VALIDATOR); VALIDATORS.put(Global.Wearable.GMS_CHECKIN_TIMEOUT_MIN, ANY_INTEGER_VALIDATOR); Loading
packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ public class SettingsBackupTest { Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS, Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS, Settings.Global.STYLUS_HANDWRITING_ENABLED, Settings.Global.STYLUS_EVER_USED, Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT, Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS, Settings.Global.ENHANCED_4G_MODE_ENABLED, Loading
packages/SystemUI/src/com/android/systemui/dagger/FrameworkServicesModule.java +7 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ import android.hardware.display.ColorDisplayManager; import android.hardware.display.DisplayManager; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; import android.hardware.input.InputManager; import android.media.AudioManager; import android.media.IAudioService; import android.media.MediaRouter2Manager; Loading Loading @@ -282,6 +283,12 @@ public class FrameworkServicesModule { return InteractionJankMonitor.getInstance(); } @Provides @Singleton static InputManager provideInputManager(Context context) { return context.getSystemService(InputManager.class); } @Provides @Singleton static InputMethodManager provideInputMethodManager(Context context) { Loading