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

Commit 993e82ee authored by Robert Horvath's avatar Robert Horvath Committed by Android (Google) Code Review
Browse files

Merge "Add setting to go to sleep after long user inactivity"

parents 76939b7e 5560f386
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -426,9 +426,15 @@ public final class PowerManager {
    public static final int GO_TO_SLEEP_REASON_FORCE_SUSPEND = 8;

    /**
     * Go to sleep reason code: Going to sleep due to user inattentiveness.
     * @hide
     */
    public static final int GO_TO_SLEEP_REASON_MAX = GO_TO_SLEEP_REASON_FORCE_SUSPEND;
    public static final int GO_TO_SLEEP_REASON_INATTENTIVE = 9;

    /**
     * @hide
     */
    public static final int GO_TO_SLEEP_REASON_MAX = GO_TO_SLEEP_REASON_INATTENTIVE;

    /**
     * @hide
@@ -444,6 +450,7 @@ public final class PowerManager {
            case GO_TO_SLEEP_REASON_SLEEP_BUTTON: return "sleep_button";
            case GO_TO_SLEEP_REASON_ACCESSIBILITY: return "accessibility";
            case GO_TO_SLEEP_REASON_FORCE_SUSPEND: return "force_suspend";
            case GO_TO_SLEEP_REASON_INATTENTIVE: return "inattentive";
            default: return Integer.toString(sleepReason);
        }
    }
+14 −0
Original line number Diff line number Diff line
@@ -7706,6 +7706,20 @@ public final class Settings {
         */
        public static final String SLEEP_TIMEOUT = "sleep_timeout";
        /**
         * The timeout in milliseconds before the device goes to sleep due to user inattentiveness,
         * even if the system is holding wakelocks. It should generally be longer than {@code
         * config_attentiveWarningDuration}, as otherwise the device will show the attentive
         * warning constantly. Small timeouts are discouraged, as they will cause the device to
         * go to sleep quickly after waking up.
         * <p>
         * Use -1 to disable this timeout.
         * </p>
         *
         * @hide
         */
        public static final String ATTENTIVE_TIMEOUT = "attentive_timeout";
        /**
         * Controls whether double tap to wake is enabled.
         * @hide
+10 −0
Original line number Diff line number Diff line
@@ -188,4 +188,14 @@ oneway interface IStatusBar
     * @param types the internal insets types of the bars are about to abort the transient state.
     */
    void abortTransient(int displayId, in int[] types);

    /**
     * Show a warning that the device is about to go to sleep due to user inactivity.
     */
    void showInattentiveSleepWarning();

    /**
     * Dismiss the warning that the device is about to go to sleep due to user inactivity.
     */
    void dismissInattentiveSleepWarning();
}
+10 −0
Original line number Diff line number Diff line
@@ -113,4 +113,14 @@ interface IStatusBarService
    void onBiometricError(int modality, int error, int vendorCode);
    // Used to hide the authentication dialog, e.g. when the application cancels authentication
    void hideAuthenticationDialog();

    /**
     * Show a warning that the device is about to go to sleep due to user inactivity.
     */
    void showInattentiveSleepWarning();

    /**
     * Dismiss the warning that the device is about to go to sleep due to user inactivity.
     */
    void dismissInattentiveSleepWarning();
}
+8 −0
Original line number Diff line number Diff line
@@ -172,6 +172,8 @@ message PowerManagerServiceDumpProto {
    repeated SuspendBlockerProto suspend_blockers = 48;
    optional WirelessChargerDetectorProto wireless_charger_detector = 49;
    optional BatterySaverStateMachineProto battery_saver_state_machine = 50;
    // Attentive timeout in ms. The timeout is disabled if it is set to -1.
    optional sint32 attentive_timeout_ms = 51;
}

// A com.android.server.power.PowerManagerService.SuspendBlockerImpl object.
@@ -310,6 +312,12 @@ message PowerServiceSettingsAndConfigurationDumpProto {
    optional bool is_vr_mode_enabled = 35;
    // True if Sidekick is controlling the display and we shouldn't change its power mode.
    optional bool draw_wake_lock_override_from_sidekick = 36;
    // The attentive timeout setting value in milliseconds. Default value is -1.
    optional sint32 attentive_timeout_setting_ms = 37;
    // The attentive timeout config value in milliseconds.
    optional sint32 attentive_timeout_config_ms = 38;
    // The attentive warning duration config value in milliseconds.
    optional sint32 attentive_warning_duration_config_ms = 39;
}

message BatterySaverStateMachineProto {
Loading