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

Commit cea31af0 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Do not sleep if someone is paying attention"

parents 9669b214 0a5d7970
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -834,10 +834,10 @@ public abstract class BatteryStats implements Parcelable {
         * also be bumped.
         */
        static final String[] USER_ACTIVITY_TYPES = {
            "other", "button", "touch", "accessibility"
            "other", "button", "touch", "accessibility", "attention"
        };

        public static final int NUM_USER_ACTIVITY_TYPES = 4;
        public static final int NUM_USER_ACTIVITY_TYPES = USER_ACTIVITY_TYPES.length;

        public abstract void noteUserActivityLocked(int type);
        public abstract boolean hasUserActivity();
+7 −0
Original line number Diff line number Diff line
@@ -335,6 +335,13 @@ public final class PowerManager {
    @SystemApi
    public static final int USER_ACTIVITY_EVENT_ACCESSIBILITY = 3;

    /**
     * User activity event type: {@link android.service.attention.AttentionService} taking action
     * on behalf of user.
     * @hide
     */
    public static final int USER_ACTIVITY_EVENT_ATTENTION = 4;

    /**
     * User activity flag: If already dimmed, extend the dim timeout
     * but do not brighten.  This flag is useful for keeping the screen on
+4 −0
Original line number Diff line number Diff line
@@ -2211,6 +2211,10 @@
         has expired, then assume the device is receiving insufficient current to charge
         effectively and terminate the dream.  Use -1 to disable this safety feature.  -->
    <integer name="config_dreamsBatteryLevelDrainCutoff">5</integer>
    <!-- Limit of how long the device can remain unlocked due to attention checking.  -->
    <integer name="config_attentionMaximumExtension">240000</integer> <!-- 4 minutes -->
    <!-- How long we should wait until we give up on receiving an attention API callback.  -->
    <integer name="config_attentionApiTimeout">2000</integer> <!-- 2 seconds -->

    <!-- ComponentName of a dream to show whenever the system would otherwise have
         gone to sleep.  When the PowerManager is asked to go to sleep, it will instead
+4 −0
Original line number Diff line number Diff line
@@ -3554,4 +3554,8 @@
  <java-symbol type="bool" name="config_cbrs_supported" />

  <java-symbol type="bool" name="config_awareSettingAvailable" />

  <!-- For Attention Service -->
  <java-symbol type="integer" name="config_attentionMaximumExtension" />
  <java-symbol type="integer" name="config_attentionApiTimeout" />
</resources>
+5 −4
Original line number Diff line number Diff line
@@ -174,10 +174,11 @@ public class AttentionManagerService extends SystemService {
                        @Override
                        public void onSuccess(int requestCode, int result, long timestamp) {
                            callback.onSuccess(requestCode, result, timestamp);
                            synchronized (mLock) {
                                userState.mAttentionCheckCache = new AttentionCheckCache(
                                        SystemClock.uptimeMillis(), result,
                                        timestamp);

                            }
                            StatsLog.write(StatsLog.ATTENTION_MANAGER_SERVICE_RESULT_REPORTED,
                                    result);
                        }
Loading