Loading apex/jobscheduler/framework/java/android/app/IAlarmManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -42,4 +42,5 @@ interface IAlarmManager { AlarmManager.AlarmClockInfo getNextAlarmClock(int userId); long currentNetworkTimeMillis(); boolean canScheduleExactAlarms(); int getConfigVersion(); } apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java +26 −0 Original line number Diff line number Diff line Loading @@ -538,6 +538,7 @@ public class AlarmManagerService extends SystemService { public long PRIORITY_ALARM_DELAY = DEFAULT_PRIORITY_ALARM_DELAY; private long mLastAllowWhileIdleWhitelistDuration = -1; private int mVersion = 0; Constants() { updateAllowWhileIdleWhitelistDurationLocked(); Loading @@ -546,6 +547,12 @@ public class AlarmManagerService extends SystemService { } } public int getVersion() { synchronized (mLock) { return mVersion; } } public void start() { mInjector.registerDeviceConfigListener(this); onPropertiesChanged(DeviceConfig.getProperties(DeviceConfig.NAMESPACE_ALARM_MANAGER)); Loading @@ -568,6 +575,7 @@ public class AlarmManagerService extends SystemService { public void onPropertiesChanged(@NonNull DeviceConfig.Properties properties) { boolean standbyQuotaUpdated = false; synchronized (mLock) { mVersion++; for (String name : properties.getKeyset()) { if (name == null) { continue; Loading Loading @@ -749,6 +757,9 @@ public class AlarmManagerService extends SystemService { pw.increaseIndent(); pw.print("version", mVersion); pw.println(); pw.print(KEY_MIN_FUTURITY); pw.print("="); TimeUtils.formatDuration(MIN_FUTURITY, pw); Loading Loading @@ -2218,6 +2229,13 @@ public class AlarmManagerService extends SystemService { } } @Override public int getConfigVersion() { getContext().enforceCallingOrSelfPermission(Manifest.permission.DUMP, "getConfigVersion"); return mConstants.getVersion(); } @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpAndUsageStatsPermission(getContext(), TAG, pw)) return; Loading Loading @@ -4698,6 +4716,10 @@ public class AlarmManagerService extends SystemService { final String tz = getNextArgRequired(); getBinderService().setTimeZone(tz); return 0; case "get-config-version": final int version = getBinderService().getConfigVersion(); pw.println(version); return 0; default: return handleDefaultCommands(cmd); } Loading @@ -4718,6 +4740,10 @@ public class AlarmManagerService extends SystemService { pw.println(" since the Epoch."); pw.println(" set-timezone TZ"); pw.println(" Set the system timezone to TZ where TZ is an Olson id."); pw.println(" get-config-version"); pw.println(" Returns an integer denoting the version of device_config keys the" + " service is sync'ed to. As long as this returns the same version, the values" + " of the config are guaranteed to remain the same."); } } } Loading
apex/jobscheduler/framework/java/android/app/IAlarmManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -42,4 +42,5 @@ interface IAlarmManager { AlarmManager.AlarmClockInfo getNextAlarmClock(int userId); long currentNetworkTimeMillis(); boolean canScheduleExactAlarms(); int getConfigVersion(); }
apex/jobscheduler/service/java/com/android/server/alarm/AlarmManagerService.java +26 −0 Original line number Diff line number Diff line Loading @@ -538,6 +538,7 @@ public class AlarmManagerService extends SystemService { public long PRIORITY_ALARM_DELAY = DEFAULT_PRIORITY_ALARM_DELAY; private long mLastAllowWhileIdleWhitelistDuration = -1; private int mVersion = 0; Constants() { updateAllowWhileIdleWhitelistDurationLocked(); Loading @@ -546,6 +547,12 @@ public class AlarmManagerService extends SystemService { } } public int getVersion() { synchronized (mLock) { return mVersion; } } public void start() { mInjector.registerDeviceConfigListener(this); onPropertiesChanged(DeviceConfig.getProperties(DeviceConfig.NAMESPACE_ALARM_MANAGER)); Loading @@ -568,6 +575,7 @@ public class AlarmManagerService extends SystemService { public void onPropertiesChanged(@NonNull DeviceConfig.Properties properties) { boolean standbyQuotaUpdated = false; synchronized (mLock) { mVersion++; for (String name : properties.getKeyset()) { if (name == null) { continue; Loading Loading @@ -749,6 +757,9 @@ public class AlarmManagerService extends SystemService { pw.increaseIndent(); pw.print("version", mVersion); pw.println(); pw.print(KEY_MIN_FUTURITY); pw.print("="); TimeUtils.formatDuration(MIN_FUTURITY, pw); Loading Loading @@ -2218,6 +2229,13 @@ public class AlarmManagerService extends SystemService { } } @Override public int getConfigVersion() { getContext().enforceCallingOrSelfPermission(Manifest.permission.DUMP, "getConfigVersion"); return mConstants.getVersion(); } @Override protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { if (!DumpUtils.checkDumpAndUsageStatsPermission(getContext(), TAG, pw)) return; Loading Loading @@ -4698,6 +4716,10 @@ public class AlarmManagerService extends SystemService { final String tz = getNextArgRequired(); getBinderService().setTimeZone(tz); return 0; case "get-config-version": final int version = getBinderService().getConfigVersion(); pw.println(version); return 0; default: return handleDefaultCommands(cmd); } Loading @@ -4718,6 +4740,10 @@ public class AlarmManagerService extends SystemService { pw.println(" since the Epoch."); pw.println(" set-timezone TZ"); pw.println(" Set the system timezone to TZ where TZ is an Olson id."); pw.println(" get-config-version"); pw.println(" Returns an integer denoting the version of device_config keys the" + " service is sync'ed to. As long as this returns the same version, the values" + " of the config are guaranteed to remain the same."); } } }