Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bc09207 authored by Prabir Pradhan's avatar Prabir Pradhan Committed by Android (Google) Code Review
Browse files

Merge "Stylus: Introduce Show Stylus Hover Pointer Setting (1/2)" into main

parents d7f318bb 71c58ea0
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -76,6 +76,12 @@ public class InputSettings {
     */
    public static final int MAX_ACCESSIBILITY_SLOW_KEYS_THRESHOLD_MILLIS = 5000;

    /**
     * Default value for {@link Settings.Secure#STYLUS_POINTER_ICON_ENABLED}.
     * @hide
     */
    public static final int DEFAULT_STYLUS_POINTER_ICON_ENABLED = 1;

    private InputSettings() {
    }

@@ -383,14 +389,19 @@ public class InputSettings {
    }

    /**
     * Whether a pointer icon will be shown over the location of a
     * stylus pointer.
     * Whether a pointer icon will be shown over the location of a stylus pointer.
     *
     * @hide
     */
    public static boolean isStylusPointerIconEnabled(@NonNull Context context) {
        if (InputProperties.force_enable_stylus_pointer_icon().orElse(false)) {
            return true;
        }
        return context.getResources()
                        .getBoolean(com.android.internal.R.bool.config_enableStylusPointerIcon)
               || InputProperties.force_enable_stylus_pointer_icon().orElse(false);
                && Settings.Secure.getIntForUser(context.getContentResolver(),
                        Settings.Secure.STYLUS_POINTER_ICON_ENABLED,
                        DEFAULT_STYLUS_POINTER_ICON_ENABLED, UserHandle.USER_CURRENT_OR_SELF) != 0;
    }

    /**
+10 −0
Original line number Diff line number Diff line
@@ -12311,6 +12311,16 @@ public final class Settings {
         */
        public static final String PRIVATE_SPACE_AUTO_LOCK = "private_space_auto_lock";
        /**
         * Toggle for enabling stylus pointer icon. Pointer icons for styluses will only be be shown
         * when this is enabled. Enabling this alone won't enable the stylus pointer;
         * config_enableStylusPointerIcon needs to be true as well.
         *
         * @hide
         */
        @Readable
        public static final String STYLUS_POINTER_ICON_ENABLED = "stylus_pointer_icon_enabled";
        /**
         * These entries are considered common between the personal and the managed profile,
         * since the managed profile doesn't get to change them.
+2 −1
Original line number Diff line number Diff line
@@ -612,6 +612,7 @@ message SecureSettingsProto {
    }
    optional Sounds sounds = 72;

    optional SettingProto stylus_pointer_icon_enabled = 99 [ (android.privacy).dest = DEST_AUTOMATIC ];
    optional SettingProto swipe_bottom_to_notification_enabled = 82 [ (android.privacy).dest = DEST_AUTOMATIC ];
    // Defines whether managed profile ringtones should be synced from its
    // parent profile.
@@ -720,5 +721,5 @@ message SecureSettingsProto {

    // Please insert fields in alphabetical order and group them into messages
    // if possible (to avoid reaching the method limit).
    // Next tag = 99;
    // Next tag = 100;
}
+2 −1
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ public class SecureSettings {
        Settings.Secure.CREDENTIAL_SERVICE,
        Settings.Secure.CREDENTIAL_SERVICE_PRIMARY,
        Settings.Secure.EVEN_DIMMER_ACTIVATED,
        Settings.Secure.EVEN_DIMMER_MIN_NITS
        Settings.Secure.EVEN_DIMMER_MIN_NITS,
        Settings.Secure.STYLUS_POINTER_ICON_ENABLED,
    };
}
+1 −0
Original line number Diff line number Diff line
@@ -416,5 +416,6 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.CREDENTIAL_SERVICE, CREDENTIAL_SERVICE_VALIDATOR);
        VALIDATORS.put(Secure.CREDENTIAL_SERVICE_PRIMARY, NULLABLE_COMPONENT_NAME_VALIDATOR);
        VALIDATORS.put(Secure.AUTOFILL_SERVICE, AUTOFILL_SERVICE_VALIDATOR);
        VALIDATORS.put(Secure.STYLUS_POINTER_ICON_ENABLED, BOOLEAN_VALIDATOR);
    }
}
Loading