Loading core/java/android/os/BatteryStats.java +2 −2 Original line number Diff line number Diff line Loading @@ -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(); Loading core/java/android/os/PowerManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -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 Loading core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -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 Loading core/res/res/values/symbols.xml +4 −0 Original line number Diff line number Diff line Loading @@ -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> services/core/java/com/android/server/attention/AttentionManagerService.java +5 −4 Original line number Diff line number Diff line Loading @@ -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 Loading
core/java/android/os/BatteryStats.java +2 −2 Original line number Diff line number Diff line Loading @@ -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(); Loading
core/java/android/os/PowerManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
core/res/res/values/symbols.xml +4 −0 Original line number Diff line number Diff line Loading @@ -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>
services/core/java/com/android/server/attention/AttentionManagerService.java +5 −4 Original line number Diff line number Diff line Loading @@ -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