Loading Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,6 @@ java_library { static_libs: [ "app-compat-annotations", "framework-minus-apex", "framework-connectivity.impl", // TODO(b/182859030): should be removed "framework-appsearch.impl", // TODO(b/146218515): should be removed "framework-updatable-stubs-module_libs_api", ], Loading TEST_MAPPING +16 −14 Original line number Diff line number Diff line { "presubmit": [ "presubmit-large": [ { "name": "FrameworksUiServicesTests", "name": "FrameworksServicesTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" } ] }, } ], "presubmit": [ { "name": "ExtServicesUnitTests", "name": "FrameworksUiServicesTests", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" Loading @@ -17,7 +25,7 @@ ] }, { "name": "TestablesTests", "name": "ExtServicesUnitTests", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" Loading @@ -25,21 +33,15 @@ ] }, { "name": "FrameworksCoreTests", "name": "TestablesTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" } ] }, { "name": "FrameworkPermissionTests", "name": "FrameworksCoreTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" Loading @@ -53,7 +55,7 @@ ] }, { "name": "FrameworksServicesTests", "name": "FrameworkPermissionTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" Loading apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ public class PowerExemptionManager { public static final int REASON_OP_ACTIVATE_VPN = 68; /** @hide */ public static final int REASON_OP_ACTIVATE_PLATFORM_VPN = 69; /** * Temporarily allowed to have FGS while-in-use permissions. * @hide */ public static final int REASON_TEMP_ALLOWED_WHILE_IN_USE = 70; /* BG-FGS-launch is allowed by temp-allow-list or system-allow-list. Reason code for temp and system allow list starts here. Loading Loading @@ -348,6 +353,7 @@ public class PowerExemptionManager { REASON_ACTIVITY_VISIBILITY_GRACE_PERIOD, REASON_OP_ACTIVATE_VPN, REASON_OP_ACTIVATE_PLATFORM_VPN, REASON_TEMP_ALLOWED_WHILE_IN_USE, // temp and system allow list reasons. REASON_GEOFENCING, REASON_PUSH_MESSAGING, Loading Loading @@ -609,6 +615,8 @@ public class PowerExemptionManager { return "OP_ACTIVATE_VPN"; case REASON_OP_ACTIVATE_PLATFORM_VPN: return "OP_ACTIVATE_PLATFORM_VPN"; case REASON_TEMP_ALLOWED_WHILE_IN_USE: return "TEMP_ALLOWED_WHILE_IN_USE"; case REASON_GEOFENCING: return "GEOFENCING"; case REASON_PUSH_MESSAGING: Loading apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java +13 −8 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ class JobConcurrencyManager { new WorkConfigLimitsPerMemoryTrimLevel( new WorkTypeConfig("screen_on_normal", 11, // defaultMin List.of(Pair.create(WORK_TYPE_TOP, 2), Pair.create(WORK_TYPE_FGS, 1), List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 1), Pair.create(WORK_TYPE_EJ, 3), Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1)), // defaultMax Loading @@ -202,7 +202,7 @@ class JobConcurrencyManager { List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 1), Pair.create(WORK_TYPE_EJ, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 1), List.of(Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1), Pair.create(WORK_TYPE_BGUSER, 1)) ), Loading @@ -218,23 +218,23 @@ class JobConcurrencyManager { ); private static final WorkConfigLimitsPerMemoryTrimLevel CONFIG_LIMITS_SCREEN_OFF = new WorkConfigLimitsPerMemoryTrimLevel( new WorkTypeConfig("screen_off_normal", 15, new WorkTypeConfig("screen_off_normal", 16, // defaultMin List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 2), Pair.create(WORK_TYPE_EJ, 3), Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 6), List.of(Pair.create(WORK_TYPE_BG, 10), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 2), Pair.create(WORK_TYPE_BGUSER, 3)) ), new WorkTypeConfig("screen_off_moderate", 15, new WorkTypeConfig("screen_off_moderate", 14, // defaultMin List.of(Pair.create(WORK_TYPE_TOP, 6), Pair.create(WORK_TYPE_FGS, 2), List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 2), Pair.create(WORK_TYPE_EJ, 3), Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 4), List.of(Pair.create(WORK_TYPE_BG, 7), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1), Pair.create(WORK_TYPE_BGUSER, 1)) ), Loading @@ -243,7 +243,7 @@ class JobConcurrencyManager { List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 1), Pair.create(WORK_TYPE_EJ, 2), Pair.create(WORK_TYPE_BG, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 1), List.of(Pair.create(WORK_TYPE_BG, 3), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1), Pair.create(WORK_TYPE_BGUSER, 1)) ), Loading Loading @@ -470,6 +470,11 @@ class JobConcurrencyManager { } } @GuardedBy("mLock") boolean isJobRunningLocked(JobStatus job) { return mRunningJobs.contains(job); } /** Return {@code true} if the state was updated. */ @GuardedBy("mLock") private boolean refreshSystemStateLocked() { Loading apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +7 −23 Original line number Diff line number Diff line Loading @@ -336,8 +336,6 @@ public class JobSchedulerService extends com.android.server.SystemService // (ScheduledJobStateChanged and JobStatusDumpProto). public static final int RESTRICTED_INDEX = 5; // -- Pre-allocated temporaries only for use in assignJobsToContextsLocked -- private class ConstantsObserver implements DeviceConfig.OnPropertiesChangedListener { public void start() { DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_JOB_SCHEDULER, Loading Loading @@ -1632,22 +1630,6 @@ public class JobSchedulerService extends com.android.server.SystemService return false; } /** * @param job JobStatus we are querying against. * @return Whether or not the job represented by the status object is currently being run or * is pending. */ private boolean isCurrentlyActiveLocked(JobStatus job) { for (int i=0; i<mActiveServices.size(); i++) { JobServiceContext serviceContext = mActiveServices.get(i); final JobStatus running = serviceContext.getRunningJobLocked(); if (running != null && running.matches(job.getUid(), job.getJobId())) { return true; } } return false; } void noteJobsPending(List<JobStatus> jobs) { for (int i = jobs.size() - 1; i >= 0; i--) { JobStatus job = jobs.get(i); Loading Loading @@ -2253,10 +2235,12 @@ public class JobSchedulerService extends com.android.server.SystemService * - The component is enabled and runnable. */ @VisibleForTesting @GuardedBy("mLock") boolean isReadyToBeExecutedLocked(JobStatus job) { return isReadyToBeExecutedLocked(job, true); } @GuardedBy("mLock") boolean isReadyToBeExecutedLocked(JobStatus job, boolean rejectActive) { final boolean jobReady = job.isReady(); Loading Loading @@ -2296,7 +2280,7 @@ public class JobSchedulerService extends com.android.server.SystemService } final boolean jobPending = mPendingJobs.contains(job); final boolean jobActive = rejectActive && isCurrentlyActiveLocked(job); final boolean jobActive = rejectActive && mConcurrencyManager.isJobRunningLocked(job); if (DEBUG) { Slog.v(TAG, "isReadyToBeExecutedLocked: " + job.toShortString() Loading Loading @@ -2452,7 +2436,7 @@ public class JobSchedulerService extends com.android.server.SystemService synchronized (mLock) { final List<JobInfo> pendingJobs = new ArrayList<JobInfo>(); mJobs.forEachJob(Process.SYSTEM_UID, (job) -> { if (job.getJob().isPeriodic() || !isCurrentlyActiveLocked(job)) { if (job.getJob().isPeriodic() || !mConcurrencyManager.isJobRunningLocked(job)) { pendingJobs.add(job.getJob()); } }); Loading Loading @@ -3101,7 +3085,7 @@ public class JobSchedulerService extends com.android.server.SystemService pw.print("pending"); printed = true; } if (isCurrentlyActiveLocked(js)) { if (mConcurrencyManager.isJobRunningLocked(js)) { if (printed) { pw.print(" "); } Loading Loading @@ -3284,7 +3268,7 @@ public class JobSchedulerService extends com.android.server.SystemService pw.print(" !pending="); pw.print(!mPendingJobs.contains(job)); pw.print(" !active="); pw.print(!isCurrentlyActiveLocked(job)); pw.print(!mConcurrencyManager.isJobRunningLocked(job)); pw.print(" !backingup="); pw.print(!(mBackingUpUids.indexOfKey(job.getSourceUid()) >= 0)); pw.print(" comp="); Loading Loading @@ -3540,7 +3524,7 @@ public class JobSchedulerService extends com.android.server.SystemService proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_JOB_PENDING, mPendingJobs.contains(job)); proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_JOB_CURRENTLY_ACTIVE, isCurrentlyActiveLocked(job)); mConcurrencyManager.isJobRunningLocked(job)); proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_UID_BACKING_UP, mBackingUpUids.indexOfKey(job.getSourceUid()) >= 0); proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_COMPONENT_USABLE, Loading Loading
Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,6 @@ java_library { static_libs: [ "app-compat-annotations", "framework-minus-apex", "framework-connectivity.impl", // TODO(b/182859030): should be removed "framework-appsearch.impl", // TODO(b/146218515): should be removed "framework-updatable-stubs-module_libs_api", ], Loading
TEST_MAPPING +16 −14 Original line number Diff line number Diff line { "presubmit": [ "presubmit-large": [ { "name": "FrameworksUiServicesTests", "name": "FrameworksServicesTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" } ] }, } ], "presubmit": [ { "name": "ExtServicesUnitTests", "name": "FrameworksUiServicesTests", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" Loading @@ -17,7 +25,7 @@ ] }, { "name": "TestablesTests", "name": "ExtServicesUnitTests", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" Loading @@ -25,21 +33,15 @@ ] }, { "name": "FrameworksCoreTests", "name": "TestablesTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" }, { "exclude-annotation": "androidx.test.filters.FlakyTest" }, { "exclude-annotation": "org.junit.Ignore" } ] }, { "name": "FrameworkPermissionTests", "name": "FrameworksCoreTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" Loading @@ -53,7 +55,7 @@ ] }, { "name": "FrameworksServicesTests", "name": "FrameworkPermissionTests", "options": [ { "include-annotation": "android.platform.test.annotations.Presubmit" Loading
apex/jobscheduler/framework/java/android/os/PowerExemptionManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,11 @@ public class PowerExemptionManager { public static final int REASON_OP_ACTIVATE_VPN = 68; /** @hide */ public static final int REASON_OP_ACTIVATE_PLATFORM_VPN = 69; /** * Temporarily allowed to have FGS while-in-use permissions. * @hide */ public static final int REASON_TEMP_ALLOWED_WHILE_IN_USE = 70; /* BG-FGS-launch is allowed by temp-allow-list or system-allow-list. Reason code for temp and system allow list starts here. Loading Loading @@ -348,6 +353,7 @@ public class PowerExemptionManager { REASON_ACTIVITY_VISIBILITY_GRACE_PERIOD, REASON_OP_ACTIVATE_VPN, REASON_OP_ACTIVATE_PLATFORM_VPN, REASON_TEMP_ALLOWED_WHILE_IN_USE, // temp and system allow list reasons. REASON_GEOFENCING, REASON_PUSH_MESSAGING, Loading Loading @@ -609,6 +615,8 @@ public class PowerExemptionManager { return "OP_ACTIVATE_VPN"; case REASON_OP_ACTIVATE_PLATFORM_VPN: return "OP_ACTIVATE_PLATFORM_VPN"; case REASON_TEMP_ALLOWED_WHILE_IN_USE: return "TEMP_ALLOWED_WHILE_IN_USE"; case REASON_GEOFENCING: return "GEOFENCING"; case REASON_PUSH_MESSAGING: Loading
apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java +13 −8 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ class JobConcurrencyManager { new WorkConfigLimitsPerMemoryTrimLevel( new WorkTypeConfig("screen_on_normal", 11, // defaultMin List.of(Pair.create(WORK_TYPE_TOP, 2), Pair.create(WORK_TYPE_FGS, 1), List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 1), Pair.create(WORK_TYPE_EJ, 3), Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1)), // defaultMax Loading @@ -202,7 +202,7 @@ class JobConcurrencyManager { List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 1), Pair.create(WORK_TYPE_EJ, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 1), List.of(Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1), Pair.create(WORK_TYPE_BGUSER, 1)) ), Loading @@ -218,23 +218,23 @@ class JobConcurrencyManager { ); private static final WorkConfigLimitsPerMemoryTrimLevel CONFIG_LIMITS_SCREEN_OFF = new WorkConfigLimitsPerMemoryTrimLevel( new WorkTypeConfig("screen_off_normal", 15, new WorkTypeConfig("screen_off_normal", 16, // defaultMin List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 2), Pair.create(WORK_TYPE_EJ, 3), Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 6), List.of(Pair.create(WORK_TYPE_BG, 10), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 2), Pair.create(WORK_TYPE_BGUSER, 3)) ), new WorkTypeConfig("screen_off_moderate", 15, new WorkTypeConfig("screen_off_moderate", 14, // defaultMin List.of(Pair.create(WORK_TYPE_TOP, 6), Pair.create(WORK_TYPE_FGS, 2), List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 2), Pair.create(WORK_TYPE_EJ, 3), Pair.create(WORK_TYPE_BG, 2), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 4), List.of(Pair.create(WORK_TYPE_BG, 7), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1), Pair.create(WORK_TYPE_BGUSER, 1)) ), Loading @@ -243,7 +243,7 @@ class JobConcurrencyManager { List.of(Pair.create(WORK_TYPE_TOP, 4), Pair.create(WORK_TYPE_FGS, 1), Pair.create(WORK_TYPE_EJ, 2), Pair.create(WORK_TYPE_BG, 1)), // defaultMax List.of(Pair.create(WORK_TYPE_BG, 1), List.of(Pair.create(WORK_TYPE_BG, 3), Pair.create(WORK_TYPE_BGUSER_IMPORTANT, 1), Pair.create(WORK_TYPE_BGUSER, 1)) ), Loading Loading @@ -470,6 +470,11 @@ class JobConcurrencyManager { } } @GuardedBy("mLock") boolean isJobRunningLocked(JobStatus job) { return mRunningJobs.contains(job); } /** Return {@code true} if the state was updated. */ @GuardedBy("mLock") private boolean refreshSystemStateLocked() { Loading
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +7 −23 Original line number Diff line number Diff line Loading @@ -336,8 +336,6 @@ public class JobSchedulerService extends com.android.server.SystemService // (ScheduledJobStateChanged and JobStatusDumpProto). public static final int RESTRICTED_INDEX = 5; // -- Pre-allocated temporaries only for use in assignJobsToContextsLocked -- private class ConstantsObserver implements DeviceConfig.OnPropertiesChangedListener { public void start() { DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_JOB_SCHEDULER, Loading Loading @@ -1632,22 +1630,6 @@ public class JobSchedulerService extends com.android.server.SystemService return false; } /** * @param job JobStatus we are querying against. * @return Whether or not the job represented by the status object is currently being run or * is pending. */ private boolean isCurrentlyActiveLocked(JobStatus job) { for (int i=0; i<mActiveServices.size(); i++) { JobServiceContext serviceContext = mActiveServices.get(i); final JobStatus running = serviceContext.getRunningJobLocked(); if (running != null && running.matches(job.getUid(), job.getJobId())) { return true; } } return false; } void noteJobsPending(List<JobStatus> jobs) { for (int i = jobs.size() - 1; i >= 0; i--) { JobStatus job = jobs.get(i); Loading Loading @@ -2253,10 +2235,12 @@ public class JobSchedulerService extends com.android.server.SystemService * - The component is enabled and runnable. */ @VisibleForTesting @GuardedBy("mLock") boolean isReadyToBeExecutedLocked(JobStatus job) { return isReadyToBeExecutedLocked(job, true); } @GuardedBy("mLock") boolean isReadyToBeExecutedLocked(JobStatus job, boolean rejectActive) { final boolean jobReady = job.isReady(); Loading Loading @@ -2296,7 +2280,7 @@ public class JobSchedulerService extends com.android.server.SystemService } final boolean jobPending = mPendingJobs.contains(job); final boolean jobActive = rejectActive && isCurrentlyActiveLocked(job); final boolean jobActive = rejectActive && mConcurrencyManager.isJobRunningLocked(job); if (DEBUG) { Slog.v(TAG, "isReadyToBeExecutedLocked: " + job.toShortString() Loading Loading @@ -2452,7 +2436,7 @@ public class JobSchedulerService extends com.android.server.SystemService synchronized (mLock) { final List<JobInfo> pendingJobs = new ArrayList<JobInfo>(); mJobs.forEachJob(Process.SYSTEM_UID, (job) -> { if (job.getJob().isPeriodic() || !isCurrentlyActiveLocked(job)) { if (job.getJob().isPeriodic() || !mConcurrencyManager.isJobRunningLocked(job)) { pendingJobs.add(job.getJob()); } }); Loading Loading @@ -3101,7 +3085,7 @@ public class JobSchedulerService extends com.android.server.SystemService pw.print("pending"); printed = true; } if (isCurrentlyActiveLocked(js)) { if (mConcurrencyManager.isJobRunningLocked(js)) { if (printed) { pw.print(" "); } Loading Loading @@ -3284,7 +3268,7 @@ public class JobSchedulerService extends com.android.server.SystemService pw.print(" !pending="); pw.print(!mPendingJobs.contains(job)); pw.print(" !active="); pw.print(!isCurrentlyActiveLocked(job)); pw.print(!mConcurrencyManager.isJobRunningLocked(job)); pw.print(" !backingup="); pw.print(!(mBackingUpUids.indexOfKey(job.getSourceUid()) >= 0)); pw.print(" comp="); Loading Loading @@ -3540,7 +3524,7 @@ public class JobSchedulerService extends com.android.server.SystemService proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_JOB_PENDING, mPendingJobs.contains(job)); proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_JOB_CURRENTLY_ACTIVE, isCurrentlyActiveLocked(job)); mConcurrencyManager.isJobRunningLocked(job)); proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_UID_BACKING_UP, mBackingUpUids.indexOfKey(job.getSourceUid()) >= 0); proto.write(JobSchedulerServiceDumpProto.RegisteredJob.IS_COMPONENT_USABLE, Loading