Loading core/java/android/provider/Settings.java +3 −1 Original line number Diff line number Diff line Loading @@ -7281,10 +7281,12 @@ public final class Settings { * The following keys are supported: * * <pre> * idle_duration (long) * idle_duration2 (long) * wallclock_threshold (long) * parole_interval (long) * parole_duration (long) * * idle_duration (long) // This is deprecated and used to circumvent b/26355386. * </pre> * * <p> Loading services/usage/java/com/android/server/usage/UsageStatsService.java +12 −1 Original line number Diff line number Diff line Loading @@ -280,6 +280,11 @@ public class UsageStatsService extends SystemService implements mHandler.sendEmptyMessageDelayed(MSG_FLUSH_TO_DISK, FLUSH_INTERVAL); } @Override public long getAppIdleRollingWindowDurationMillis() { return mAppIdleWallclockThresholdMillis * 2; } private void cleanUpRemovedUsersLocked() { final List<UserInfo> users = mUserManager.getUsers(true); if (users == null || users.size() == 0) { Loading Loading @@ -1107,7 +1112,13 @@ public class UsageStatsService extends SystemService implements * Observe settings changes for {@link Settings.Global#APP_IDLE_CONSTANTS}. */ private class SettingsObserver extends ContentObserver { private static final String KEY_IDLE_DURATION = "idle_duration"; /** * This flag has been used to disable app idle on older builds with bug b/26355386. */ @Deprecated private static final String KEY_IDLE_DURATION_OLD = "idle_duration"; private static final String KEY_IDLE_DURATION = "idle_duration2"; private static final String KEY_WALLCLOCK_THRESHOLD = "wallclock_threshold"; private static final String KEY_PAROLE_INTERVAL = "parole_interval"; private static final String KEY_PAROLE_DURATION = "parole_duration"; Loading services/usage/java/com/android/server/usage/UserUsageStatsService.java +5 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ class UserUsageStatsService { interface StatsUpdatedListener { void onStatsUpdated(); long getAppIdleRollingWindowDurationMillis(); } UserUsageStatsService(Context context, int userId, File usageStatsDir, Loading Loading @@ -581,9 +582,11 @@ class UserUsageStatsService { */ void refreshAppIdleRollingWindow(final long currentTimeMillis, final long deviceUsageTime) { // Start the rolling window for AppIdle requests. final long startRangeMillis = currentTimeMillis - mListener.getAppIdleRollingWindowDurationMillis(); List<IntervalStats> stats = mDatabase.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, currentTimeMillis - (1000 * 60 * 60 * 24 * 2), currentTimeMillis, new StatCombiner<IntervalStats>() { startRangeMillis, currentTimeMillis, new StatCombiner<IntervalStats>() { @Override public void combine(IntervalStats stats, boolean mutable, List<IntervalStats> accumulatedResult) { Loading Loading
core/java/android/provider/Settings.java +3 −1 Original line number Diff line number Diff line Loading @@ -7281,10 +7281,12 @@ public final class Settings { * The following keys are supported: * * <pre> * idle_duration (long) * idle_duration2 (long) * wallclock_threshold (long) * parole_interval (long) * parole_duration (long) * * idle_duration (long) // This is deprecated and used to circumvent b/26355386. * </pre> * * <p> Loading
services/usage/java/com/android/server/usage/UsageStatsService.java +12 −1 Original line number Diff line number Diff line Loading @@ -280,6 +280,11 @@ public class UsageStatsService extends SystemService implements mHandler.sendEmptyMessageDelayed(MSG_FLUSH_TO_DISK, FLUSH_INTERVAL); } @Override public long getAppIdleRollingWindowDurationMillis() { return mAppIdleWallclockThresholdMillis * 2; } private void cleanUpRemovedUsersLocked() { final List<UserInfo> users = mUserManager.getUsers(true); if (users == null || users.size() == 0) { Loading Loading @@ -1107,7 +1112,13 @@ public class UsageStatsService extends SystemService implements * Observe settings changes for {@link Settings.Global#APP_IDLE_CONSTANTS}. */ private class SettingsObserver extends ContentObserver { private static final String KEY_IDLE_DURATION = "idle_duration"; /** * This flag has been used to disable app idle on older builds with bug b/26355386. */ @Deprecated private static final String KEY_IDLE_DURATION_OLD = "idle_duration"; private static final String KEY_IDLE_DURATION = "idle_duration2"; private static final String KEY_WALLCLOCK_THRESHOLD = "wallclock_threshold"; private static final String KEY_PAROLE_INTERVAL = "parole_interval"; private static final String KEY_PAROLE_DURATION = "parole_duration"; Loading
services/usage/java/com/android/server/usage/UserUsageStatsService.java +5 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ class UserUsageStatsService { interface StatsUpdatedListener { void onStatsUpdated(); long getAppIdleRollingWindowDurationMillis(); } UserUsageStatsService(Context context, int userId, File usageStatsDir, Loading Loading @@ -581,9 +582,11 @@ class UserUsageStatsService { */ void refreshAppIdleRollingWindow(final long currentTimeMillis, final long deviceUsageTime) { // Start the rolling window for AppIdle requests. final long startRangeMillis = currentTimeMillis - mListener.getAppIdleRollingWindowDurationMillis(); List<IntervalStats> stats = mDatabase.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, currentTimeMillis - (1000 * 60 * 60 * 24 * 2), currentTimeMillis, new StatCombiner<IntervalStats>() { startRangeMillis, currentTimeMillis, new StatCombiner<IntervalStats>() { @Override public void combine(IntervalStats stats, boolean mutable, List<IntervalStats> accumulatedResult) { Loading