Loading core/java/android/app/usage/UsageStats.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,13 @@ public final class UsageStats implements Parcelable { */ */ public long mLastTimeUsed; public long mLastTimeUsed; /** * Last time the package was used and the beginning of the idle countdown. * This uses a different timebase that is about how much the device has been in use in general. * {@hide} */ public long mBeginIdleTime; /** /** * {@hide} * {@hide} */ */ Loading Loading @@ -74,6 +81,7 @@ public final class UsageStats implements Parcelable { mTotalTimeInForeground = stats.mTotalTimeInForeground; mTotalTimeInForeground = stats.mTotalTimeInForeground; mLaunchCount = stats.mLaunchCount; mLaunchCount = stats.mLaunchCount; mLastEvent = stats.mLastEvent; mLastEvent = stats.mLastEvent; mBeginIdleTime = stats.mBeginIdleTime; } } public String getPackageName() { public String getPackageName() { Loading Loading @@ -109,6 +117,15 @@ public final class UsageStats implements Parcelable { return mLastTimeUsed; return mLastTimeUsed; } } /** * @hide * Get the last time this package was active, measured in milliseconds. This timestamp * uses a timebase that represents how much the device was used and not wallclock time. */ public long getBeginIdleTime() { return mBeginIdleTime; } /** /** * Get the total time this package spent in the foreground, measured in milliseconds. * Get the total time this package spent in the foreground, measured in milliseconds. */ */ Loading @@ -133,6 +150,7 @@ public final class UsageStats implements Parcelable { mLastEvent = right.mLastEvent; mLastEvent = right.mLastEvent; mEndTimeStamp = right.mEndTimeStamp; mEndTimeStamp = right.mEndTimeStamp; mLastTimeUsed = right.mLastTimeUsed; mLastTimeUsed = right.mLastTimeUsed; mBeginIdleTime = right.mBeginIdleTime; } } mBeginTimeStamp = Math.min(mBeginTimeStamp, right.mBeginTimeStamp); mBeginTimeStamp = Math.min(mBeginTimeStamp, right.mBeginTimeStamp); mTotalTimeInForeground += right.mTotalTimeInForeground; mTotalTimeInForeground += right.mTotalTimeInForeground; Loading @@ -153,6 +171,7 @@ public final class UsageStats implements Parcelable { dest.writeLong(mTotalTimeInForeground); dest.writeLong(mTotalTimeInForeground); dest.writeInt(mLaunchCount); dest.writeInt(mLaunchCount); dest.writeInt(mLastEvent); dest.writeInt(mLastEvent); dest.writeLong(mBeginIdleTime); } } public static final Creator<UsageStats> CREATOR = new Creator<UsageStats>() { public static final Creator<UsageStats> CREATOR = new Creator<UsageStats>() { Loading @@ -166,6 +185,7 @@ public final class UsageStats implements Parcelable { stats.mTotalTimeInForeground = in.readLong(); stats.mTotalTimeInForeground = in.readLong(); stats.mLaunchCount = in.readInt(); stats.mLaunchCount = in.readInt(); stats.mLastEvent = in.readInt(); stats.mLastEvent = in.readInt(); stats.mBeginIdleTime = in.readLong(); return stats; return stats; } } Loading core/java/android/app/usage/UsageStatsManagerInternal.java +0 −8 Original line number Original line Diff line number Diff line Loading @@ -68,14 +68,6 @@ public abstract class UsageStatsManagerInternal { */ */ public abstract boolean isAppIdle(String packageName, int userId); public abstract boolean isAppIdle(String packageName, int userId); /** * Returns the most recent time that the specified package was active for the given user. * @param packageName The package to search. * @param userId The user id of the user of interest. * @return The timestamp of when the package was last used, or -1 if it hasn't been used. */ public abstract long getLastPackageAccessTime(String packageName, int userId); /** /** * Sets up a listener for changes to packages being accessed. * Sets up a listener for changes to packages being accessed. * @param listener A listener within the system process. * @param listener A listener within the system process. Loading core/java/android/os/IDeviceIdleController.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -23,4 +23,5 @@ interface IDeviceIdleController { String[] getSystemPowerWhitelist(); String[] getSystemPowerWhitelist(); String[] getFullPowerWhitelist(); String[] getFullPowerWhitelist(); int[] getAppIdWhitelist(); int[] getAppIdWhitelist(); boolean isPowerSaveWhitelistApp(String name); } } services/core/java/com/android/server/DeviceIdleController.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -313,6 +313,10 @@ public class DeviceIdleController extends SystemService { return getAppIdWhitelistInternal(); return getAppIdWhitelistInternal(); } } @Override public boolean isPowerSaveWhitelistApp(String name) { return isPowerSaveWhitelistAppInternal(name); } @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { DeviceIdleController.this.dump(fd, pw, args); DeviceIdleController.this.dump(fd, pw, args); } } Loading Loading @@ -452,6 +456,13 @@ public class DeviceIdleController extends SystemService { } } } } public boolean isPowerSaveWhitelistAppInternal(String packageName) { synchronized (this) { return mPowerSaveWhitelistApps.containsKey(packageName) || mPowerSaveWhitelistUserApps.containsKey(packageName); } } public int[] getAppIdWhitelistInternal() { public int[] getAppIdWhitelistInternal() { synchronized (this) { synchronized (this) { return mPowerSaveWhitelistAppIdArray; return mPowerSaveWhitelistAppIdArray; Loading services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -19490,7 +19490,7 @@ public final class ActivityManagerService extends ActivityManagerNative mStackSupervisor.resumeTopActivitiesLocked(); mStackSupervisor.resumeTopActivitiesLocked(); } } EventLogTags.writeAmSwitchUser(newUserId); EventLogTags.writeAmSwitchUser(newUserId); getUserManagerLocked().userForeground(newUserId); getUserManagerLocked().onUserForeground(newUserId); sendUserSwitchBroadcastsLocked(oldUserId, newUserId); sendUserSwitchBroadcastsLocked(oldUserId, newUserId); } } Loading
core/java/android/app/usage/UsageStats.java +20 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,13 @@ public final class UsageStats implements Parcelable { */ */ public long mLastTimeUsed; public long mLastTimeUsed; /** * Last time the package was used and the beginning of the idle countdown. * This uses a different timebase that is about how much the device has been in use in general. * {@hide} */ public long mBeginIdleTime; /** /** * {@hide} * {@hide} */ */ Loading Loading @@ -74,6 +81,7 @@ public final class UsageStats implements Parcelable { mTotalTimeInForeground = stats.mTotalTimeInForeground; mTotalTimeInForeground = stats.mTotalTimeInForeground; mLaunchCount = stats.mLaunchCount; mLaunchCount = stats.mLaunchCount; mLastEvent = stats.mLastEvent; mLastEvent = stats.mLastEvent; mBeginIdleTime = stats.mBeginIdleTime; } } public String getPackageName() { public String getPackageName() { Loading Loading @@ -109,6 +117,15 @@ public final class UsageStats implements Parcelable { return mLastTimeUsed; return mLastTimeUsed; } } /** * @hide * Get the last time this package was active, measured in milliseconds. This timestamp * uses a timebase that represents how much the device was used and not wallclock time. */ public long getBeginIdleTime() { return mBeginIdleTime; } /** /** * Get the total time this package spent in the foreground, measured in milliseconds. * Get the total time this package spent in the foreground, measured in milliseconds. */ */ Loading @@ -133,6 +150,7 @@ public final class UsageStats implements Parcelable { mLastEvent = right.mLastEvent; mLastEvent = right.mLastEvent; mEndTimeStamp = right.mEndTimeStamp; mEndTimeStamp = right.mEndTimeStamp; mLastTimeUsed = right.mLastTimeUsed; mLastTimeUsed = right.mLastTimeUsed; mBeginIdleTime = right.mBeginIdleTime; } } mBeginTimeStamp = Math.min(mBeginTimeStamp, right.mBeginTimeStamp); mBeginTimeStamp = Math.min(mBeginTimeStamp, right.mBeginTimeStamp); mTotalTimeInForeground += right.mTotalTimeInForeground; mTotalTimeInForeground += right.mTotalTimeInForeground; Loading @@ -153,6 +171,7 @@ public final class UsageStats implements Parcelable { dest.writeLong(mTotalTimeInForeground); dest.writeLong(mTotalTimeInForeground); dest.writeInt(mLaunchCount); dest.writeInt(mLaunchCount); dest.writeInt(mLastEvent); dest.writeInt(mLastEvent); dest.writeLong(mBeginIdleTime); } } public static final Creator<UsageStats> CREATOR = new Creator<UsageStats>() { public static final Creator<UsageStats> CREATOR = new Creator<UsageStats>() { Loading @@ -166,6 +185,7 @@ public final class UsageStats implements Parcelable { stats.mTotalTimeInForeground = in.readLong(); stats.mTotalTimeInForeground = in.readLong(); stats.mLaunchCount = in.readInt(); stats.mLaunchCount = in.readInt(); stats.mLastEvent = in.readInt(); stats.mLastEvent = in.readInt(); stats.mBeginIdleTime = in.readLong(); return stats; return stats; } } Loading
core/java/android/app/usage/UsageStatsManagerInternal.java +0 −8 Original line number Original line Diff line number Diff line Loading @@ -68,14 +68,6 @@ public abstract class UsageStatsManagerInternal { */ */ public abstract boolean isAppIdle(String packageName, int userId); public abstract boolean isAppIdle(String packageName, int userId); /** * Returns the most recent time that the specified package was active for the given user. * @param packageName The package to search. * @param userId The user id of the user of interest. * @return The timestamp of when the package was last used, or -1 if it hasn't been used. */ public abstract long getLastPackageAccessTime(String packageName, int userId); /** /** * Sets up a listener for changes to packages being accessed. * Sets up a listener for changes to packages being accessed. * @param listener A listener within the system process. * @param listener A listener within the system process. Loading
core/java/android/os/IDeviceIdleController.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -23,4 +23,5 @@ interface IDeviceIdleController { String[] getSystemPowerWhitelist(); String[] getSystemPowerWhitelist(); String[] getFullPowerWhitelist(); String[] getFullPowerWhitelist(); int[] getAppIdWhitelist(); int[] getAppIdWhitelist(); boolean isPowerSaveWhitelistApp(String name); } }
services/core/java/com/android/server/DeviceIdleController.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -313,6 +313,10 @@ public class DeviceIdleController extends SystemService { return getAppIdWhitelistInternal(); return getAppIdWhitelistInternal(); } } @Override public boolean isPowerSaveWhitelistApp(String name) { return isPowerSaveWhitelistAppInternal(name); } @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { DeviceIdleController.this.dump(fd, pw, args); DeviceIdleController.this.dump(fd, pw, args); } } Loading Loading @@ -452,6 +456,13 @@ public class DeviceIdleController extends SystemService { } } } } public boolean isPowerSaveWhitelistAppInternal(String packageName) { synchronized (this) { return mPowerSaveWhitelistApps.containsKey(packageName) || mPowerSaveWhitelistUserApps.containsKey(packageName); } } public int[] getAppIdWhitelistInternal() { public int[] getAppIdWhitelistInternal() { synchronized (this) { synchronized (this) { return mPowerSaveWhitelistAppIdArray; return mPowerSaveWhitelistAppIdArray; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -19490,7 +19490,7 @@ public final class ActivityManagerService extends ActivityManagerNative mStackSupervisor.resumeTopActivitiesLocked(); mStackSupervisor.resumeTopActivitiesLocked(); } } EventLogTags.writeAmSwitchUser(newUserId); EventLogTags.writeAmSwitchUser(newUserId); getUserManagerLocked().userForeground(newUserId); getUserManagerLocked().onUserForeground(newUserId); sendUserSwitchBroadcastsLocked(oldUserId, newUserId); sendUserSwitchBroadcastsLocked(oldUserId, newUserId); } }