Loading core/java/android/os/IDeviceIdleController.aidl +0 −2 Original line number Original line Diff line number Diff line Loading @@ -38,8 +38,6 @@ interface IDeviceIdleController { long addPowerSaveTempWhitelistAppForMms(String name, int userId, String reason); long addPowerSaveTempWhitelistAppForMms(String name, int userId, String reason); long addPowerSaveTempWhitelistAppForSms(String name, int userId, String reason); long addPowerSaveTempWhitelistAppForSms(String name, int userId, String reason); void exitIdle(String reason); void exitIdle(String reason); void downloadServiceActive(IBinder token); void downloadServiceInactive(); boolean registerMaintenanceActivityListener(IMaintenanceActivityListener listener); boolean registerMaintenanceActivityListener(IMaintenanceActivityListener listener); void unregisterMaintenanceActivityListener(IMaintenanceActivityListener listener); void unregisterMaintenanceActivityListener(IMaintenanceActivityListener listener); } } services/core/java/com/android/server/DeviceIdleController.java +4 −55 Original line number Original line Diff line number Diff line Loading @@ -212,7 +212,6 @@ public class DeviceIdleController extends SystemService private int mActiveIdleOpCount; private int mActiveIdleOpCount; private PowerManager.WakeLock mActiveIdleWakeLock; private PowerManager.WakeLock mActiveIdleWakeLock; private IBinder mDownloadServiceActive; private boolean mJobsActive; private boolean mJobsActive; private boolean mAlarmsActive; private boolean mAlarmsActive; private boolean mReportedMaintenanceActivity; private boolean mReportedMaintenanceActivity; Loading Loading @@ -607,7 +606,7 @@ public class DeviceIdleController extends SystemService * This is the minimum amount of time that we will stay in maintenance mode after * This is the minimum amount of time that we will stay in maintenance mode after * a light doze. We have this minimum to allow various things to respond to switching * a light doze. We have this minimum to allow various things to respond to switching * in to maintenance mode and scheduling their work -- otherwise we may * in to maintenance mode and scheduling their work -- otherwise we may * see there is nothing to do (no jobs or downloads pending) and go out of maintenance * see there is nothing to do (no jobs pending) and go out of maintenance * mode immediately. * mode immediately. * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see #KEY_MIN_LIGHT_MAINTENANCE_TIME * @see #KEY_MIN_LIGHT_MAINTENANCE_TIME Loading @@ -618,7 +617,7 @@ public class DeviceIdleController extends SystemService * This is the minimum amount of time that we will stay in maintenance mode after * This is the minimum amount of time that we will stay in maintenance mode after * a full doze. We have this minimum to allow various things to respond to switching * a full doze. We have this minimum to allow various things to respond to switching * in to maintenance mode and scheduling their work -- otherwise we may * in to maintenance mode and scheduling their work -- otherwise we may * see there is nothing to do (no jobs or downloads pending) and go out of maintenance * see there is nothing to do (no jobs pending) and go out of maintenance * mode immediately. * mode immediately. * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see #KEY_MIN_DEEP_MAINTENANCE_TIME * @see #KEY_MIN_DEEP_MAINTENANCE_TIME Loading Loading @@ -1220,28 +1219,6 @@ public class DeviceIdleController extends SystemService } } } } @Override public void downloadServiceActive(IBinder token) { getContext().enforceCallingOrSelfPermission( "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS", null); long ident = Binder.clearCallingIdentity(); try { DeviceIdleController.this.downloadServiceActive(token); } finally { Binder.restoreCallingIdentity(ident); } } @Override public void downloadServiceInactive() { getContext().enforceCallingOrSelfPermission( "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS", null); long ident = Binder.clearCallingIdentity(); try { DeviceIdleController.this.downloadServiceInactive(); } finally { Binder.restoreCallingIdentity(ident); } } @Override public boolean registerMaintenanceActivityListener( @Override public boolean registerMaintenanceActivityListener( IMaintenanceActivityListener listener) { IMaintenanceActivityListener listener) { return DeviceIdleController.this.registerMaintenanceActivityListener(listener); return DeviceIdleController.this.registerMaintenanceActivityListener(listener); Loading Loading @@ -2086,30 +2063,6 @@ public class DeviceIdleController extends SystemService } } } } void downloadServiceActive(IBinder token) { synchronized (this) { mDownloadServiceActive = token; reportMaintenanceActivityIfNeededLocked(); try { token.linkToDeath(new IBinder.DeathRecipient() { @Override public void binderDied() { downloadServiceInactive(); } }, 0); } catch (RemoteException e) { mDownloadServiceActive = null; } } } void downloadServiceInactive() { synchronized (this) { mDownloadServiceActive = null; reportMaintenanceActivityIfNeededLocked(); exitMaintenanceEarlyIfNeededLocked(); } } void setJobsActive(boolean active) { void setJobsActive(boolean active) { synchronized (this) { synchronized (this) { mJobsActive = active; mJobsActive = active; Loading Loading @@ -2143,7 +2096,7 @@ public class DeviceIdleController extends SystemService } } void reportMaintenanceActivityIfNeededLocked() { void reportMaintenanceActivityIfNeededLocked() { boolean active = mJobsActive | (mDownloadServiceActive != null); boolean active = mJobsActive; if (active == mReportedMaintenanceActivity) { if (active == mReportedMaintenanceActivity) { return; return; } } Loading @@ -2154,8 +2107,7 @@ public class DeviceIdleController extends SystemService } } boolean isOpsInactiveLocked() { boolean isOpsInactiveLocked() { return mActiveIdleOpCount <= 0 && mDownloadServiceActive == null return mActiveIdleOpCount <= 0 && !mJobsActive && !mAlarmsActive; && !mJobsActive && !mAlarmsActive; } } void exitMaintenanceEarlyIfNeededLocked() { void exitMaintenanceEarlyIfNeededLocked() { Loading Loading @@ -3053,9 +3005,6 @@ public class DeviceIdleController extends SystemService if (mAlarmsActive) { if (mAlarmsActive) { pw.print(" mAlarmsActive="); pw.println(mAlarmsActive); pw.print(" mAlarmsActive="); pw.println(mAlarmsActive); } } if (mDownloadServiceActive != null) { pw.print(" mDownloadServiceActive="); pw.println(mDownloadServiceActive); } } } } } Loading services/core/java/com/android/server/job/JobSchedulerService.java +7 −2 Original line number Original line Diff line number Diff line Loading @@ -692,8 +692,13 @@ public final class JobSchedulerService extends com.android.server.SystemService boolean active = mPendingJobs.size() > 0; boolean active = mPendingJobs.size() > 0; if (mPendingJobs.size() <= 0) { if (mPendingJobs.size() <= 0) { for (int i=0; i<mActiveServices.size(); i++) { for (int i=0; i<mActiveServices.size(); i++) { JobServiceContext jsc = mActiveServices.get(i); final JobServiceContext jsc = mActiveServices.get(i); if (jsc.getRunningJob() != null) { final JobStatus job = jsc.getRunningJob(); if (job != null && (job.getJob().getFlags() & JobInfo.FLAG_WILL_BE_FOREGROUND) == 0 && !job.dozeWhitelisted) { // We will report active if we have a job running and it is not an exception // due to being in the foreground or whitelisted. active = true; active = true; break; break; } } Loading services/core/java/com/android/server/job/controllers/AppIdleController.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -142,8 +142,11 @@ public class AppIdleController extends StateController { UserHandle.formatUid(pw, jobStatus.getSourceUid()); UserHandle.formatUid(pw, jobStatus.getSourceUid()); pw.print(": "); pw.print(": "); pw.print(jobStatus.getSourcePackageName()); pw.print(jobStatus.getSourcePackageName()); pw.print(", runnable="); if ((jobStatus.satisfiedConstraints&JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0) { pw.println((jobStatus.satisfiedConstraints&JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0); pw.println(" RUNNABLE"); } else { pw.println(" WAITING"); } } } }); }); } } Loading services/core/java/com/android/server/job/controllers/DeviceIdleJobsController.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -157,8 +157,9 @@ public class DeviceIdleJobsController extends StateController { } } private void updateTaskStateLocked(JobStatus task) { private void updateTaskStateLocked(JobStatus task) { boolean enableTask = !mDeviceIdleMode || isWhitelistedLocked(task); final boolean whitelisted = isWhitelistedLocked(task); task.setDeviceNotDozingConstraintSatisfied(enableTask); final boolean enableTask = !mDeviceIdleMode || whitelisted; task.setDeviceNotDozingConstraintSatisfied(enableTask, whitelisted); } } @Override @Override Loading Loading @@ -186,9 +187,13 @@ public class DeviceIdleJobsController extends StateController { UserHandle.formatUid(pw, jobStatus.getSourceUid()); UserHandle.formatUid(pw, jobStatus.getSourceUid()); pw.print(": "); pw.print(": "); pw.print(jobStatus.getSourcePackageName()); pw.print(jobStatus.getSourcePackageName()); pw.print(", runnable="); pw.print((jobStatus.satisfiedConstraints pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_DEVICE_NOT_DOZING) != 0 & JobStatus.CONSTRAINT_DEVICE_NOT_DOZING) != 0); ? " RUNNABLE" : " WAITING"); if (jobStatus.dozeWhitelisted) { pw.print(" WHITELISTED"); } pw.println(); } } }); }); } } Loading Loading
core/java/android/os/IDeviceIdleController.aidl +0 −2 Original line number Original line Diff line number Diff line Loading @@ -38,8 +38,6 @@ interface IDeviceIdleController { long addPowerSaveTempWhitelistAppForMms(String name, int userId, String reason); long addPowerSaveTempWhitelistAppForMms(String name, int userId, String reason); long addPowerSaveTempWhitelistAppForSms(String name, int userId, String reason); long addPowerSaveTempWhitelistAppForSms(String name, int userId, String reason); void exitIdle(String reason); void exitIdle(String reason); void downloadServiceActive(IBinder token); void downloadServiceInactive(); boolean registerMaintenanceActivityListener(IMaintenanceActivityListener listener); boolean registerMaintenanceActivityListener(IMaintenanceActivityListener listener); void unregisterMaintenanceActivityListener(IMaintenanceActivityListener listener); void unregisterMaintenanceActivityListener(IMaintenanceActivityListener listener); } }
services/core/java/com/android/server/DeviceIdleController.java +4 −55 Original line number Original line Diff line number Diff line Loading @@ -212,7 +212,6 @@ public class DeviceIdleController extends SystemService private int mActiveIdleOpCount; private int mActiveIdleOpCount; private PowerManager.WakeLock mActiveIdleWakeLock; private PowerManager.WakeLock mActiveIdleWakeLock; private IBinder mDownloadServiceActive; private boolean mJobsActive; private boolean mJobsActive; private boolean mAlarmsActive; private boolean mAlarmsActive; private boolean mReportedMaintenanceActivity; private boolean mReportedMaintenanceActivity; Loading Loading @@ -607,7 +606,7 @@ public class DeviceIdleController extends SystemService * This is the minimum amount of time that we will stay in maintenance mode after * This is the minimum amount of time that we will stay in maintenance mode after * a light doze. We have this minimum to allow various things to respond to switching * a light doze. We have this minimum to allow various things to respond to switching * in to maintenance mode and scheduling their work -- otherwise we may * in to maintenance mode and scheduling their work -- otherwise we may * see there is nothing to do (no jobs or downloads pending) and go out of maintenance * see there is nothing to do (no jobs pending) and go out of maintenance * mode immediately. * mode immediately. * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see #KEY_MIN_LIGHT_MAINTENANCE_TIME * @see #KEY_MIN_LIGHT_MAINTENANCE_TIME Loading @@ -618,7 +617,7 @@ public class DeviceIdleController extends SystemService * This is the minimum amount of time that we will stay in maintenance mode after * This is the minimum amount of time that we will stay in maintenance mode after * a full doze. We have this minimum to allow various things to respond to switching * a full doze. We have this minimum to allow various things to respond to switching * in to maintenance mode and scheduling their work -- otherwise we may * in to maintenance mode and scheduling their work -- otherwise we may * see there is nothing to do (no jobs or downloads pending) and go out of maintenance * see there is nothing to do (no jobs pending) and go out of maintenance * mode immediately. * mode immediately. * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see Settings.Global#DEVICE_IDLE_CONSTANTS * @see #KEY_MIN_DEEP_MAINTENANCE_TIME * @see #KEY_MIN_DEEP_MAINTENANCE_TIME Loading Loading @@ -1220,28 +1219,6 @@ public class DeviceIdleController extends SystemService } } } } @Override public void downloadServiceActive(IBinder token) { getContext().enforceCallingOrSelfPermission( "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS", null); long ident = Binder.clearCallingIdentity(); try { DeviceIdleController.this.downloadServiceActive(token); } finally { Binder.restoreCallingIdentity(ident); } } @Override public void downloadServiceInactive() { getContext().enforceCallingOrSelfPermission( "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS", null); long ident = Binder.clearCallingIdentity(); try { DeviceIdleController.this.downloadServiceInactive(); } finally { Binder.restoreCallingIdentity(ident); } } @Override public boolean registerMaintenanceActivityListener( @Override public boolean registerMaintenanceActivityListener( IMaintenanceActivityListener listener) { IMaintenanceActivityListener listener) { return DeviceIdleController.this.registerMaintenanceActivityListener(listener); return DeviceIdleController.this.registerMaintenanceActivityListener(listener); Loading Loading @@ -2086,30 +2063,6 @@ public class DeviceIdleController extends SystemService } } } } void downloadServiceActive(IBinder token) { synchronized (this) { mDownloadServiceActive = token; reportMaintenanceActivityIfNeededLocked(); try { token.linkToDeath(new IBinder.DeathRecipient() { @Override public void binderDied() { downloadServiceInactive(); } }, 0); } catch (RemoteException e) { mDownloadServiceActive = null; } } } void downloadServiceInactive() { synchronized (this) { mDownloadServiceActive = null; reportMaintenanceActivityIfNeededLocked(); exitMaintenanceEarlyIfNeededLocked(); } } void setJobsActive(boolean active) { void setJobsActive(boolean active) { synchronized (this) { synchronized (this) { mJobsActive = active; mJobsActive = active; Loading Loading @@ -2143,7 +2096,7 @@ public class DeviceIdleController extends SystemService } } void reportMaintenanceActivityIfNeededLocked() { void reportMaintenanceActivityIfNeededLocked() { boolean active = mJobsActive | (mDownloadServiceActive != null); boolean active = mJobsActive; if (active == mReportedMaintenanceActivity) { if (active == mReportedMaintenanceActivity) { return; return; } } Loading @@ -2154,8 +2107,7 @@ public class DeviceIdleController extends SystemService } } boolean isOpsInactiveLocked() { boolean isOpsInactiveLocked() { return mActiveIdleOpCount <= 0 && mDownloadServiceActive == null return mActiveIdleOpCount <= 0 && !mJobsActive && !mAlarmsActive; && !mJobsActive && !mAlarmsActive; } } void exitMaintenanceEarlyIfNeededLocked() { void exitMaintenanceEarlyIfNeededLocked() { Loading Loading @@ -3053,9 +3005,6 @@ public class DeviceIdleController extends SystemService if (mAlarmsActive) { if (mAlarmsActive) { pw.print(" mAlarmsActive="); pw.println(mAlarmsActive); pw.print(" mAlarmsActive="); pw.println(mAlarmsActive); } } if (mDownloadServiceActive != null) { pw.print(" mDownloadServiceActive="); pw.println(mDownloadServiceActive); } } } } } Loading
services/core/java/com/android/server/job/JobSchedulerService.java +7 −2 Original line number Original line Diff line number Diff line Loading @@ -692,8 +692,13 @@ public final class JobSchedulerService extends com.android.server.SystemService boolean active = mPendingJobs.size() > 0; boolean active = mPendingJobs.size() > 0; if (mPendingJobs.size() <= 0) { if (mPendingJobs.size() <= 0) { for (int i=0; i<mActiveServices.size(); i++) { for (int i=0; i<mActiveServices.size(); i++) { JobServiceContext jsc = mActiveServices.get(i); final JobServiceContext jsc = mActiveServices.get(i); if (jsc.getRunningJob() != null) { final JobStatus job = jsc.getRunningJob(); if (job != null && (job.getJob().getFlags() & JobInfo.FLAG_WILL_BE_FOREGROUND) == 0 && !job.dozeWhitelisted) { // We will report active if we have a job running and it is not an exception // due to being in the foreground or whitelisted. active = true; active = true; break; break; } } Loading
services/core/java/com/android/server/job/controllers/AppIdleController.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -142,8 +142,11 @@ public class AppIdleController extends StateController { UserHandle.formatUid(pw, jobStatus.getSourceUid()); UserHandle.formatUid(pw, jobStatus.getSourceUid()); pw.print(": "); pw.print(": "); pw.print(jobStatus.getSourcePackageName()); pw.print(jobStatus.getSourcePackageName()); pw.print(", runnable="); if ((jobStatus.satisfiedConstraints&JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0) { pw.println((jobStatus.satisfiedConstraints&JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0); pw.println(" RUNNABLE"); } else { pw.println(" WAITING"); } } } }); }); } } Loading
services/core/java/com/android/server/job/controllers/DeviceIdleJobsController.java +10 −5 Original line number Original line Diff line number Diff line Loading @@ -157,8 +157,9 @@ public class DeviceIdleJobsController extends StateController { } } private void updateTaskStateLocked(JobStatus task) { private void updateTaskStateLocked(JobStatus task) { boolean enableTask = !mDeviceIdleMode || isWhitelistedLocked(task); final boolean whitelisted = isWhitelistedLocked(task); task.setDeviceNotDozingConstraintSatisfied(enableTask); final boolean enableTask = !mDeviceIdleMode || whitelisted; task.setDeviceNotDozingConstraintSatisfied(enableTask, whitelisted); } } @Override @Override Loading Loading @@ -186,9 +187,13 @@ public class DeviceIdleJobsController extends StateController { UserHandle.formatUid(pw, jobStatus.getSourceUid()); UserHandle.formatUid(pw, jobStatus.getSourceUid()); pw.print(": "); pw.print(": "); pw.print(jobStatus.getSourcePackageName()); pw.print(jobStatus.getSourcePackageName()); pw.print(", runnable="); pw.print((jobStatus.satisfiedConstraints pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_DEVICE_NOT_DOZING) != 0 & JobStatus.CONSTRAINT_DEVICE_NOT_DOZING) != 0); ? " RUNNABLE" : " WAITING"); if (jobStatus.dozeWhitelisted) { pw.print(" WHITELISTED"); } pw.println(); } } }); }); } } Loading