Specifically, mentioning that the alarm count can only be included with
the alarm if the supplied pending intent is mutable.
Test: make offline-sdk-docs
Fixes: 178413211
Change-Id: I2914bceebeed8b52b0de11d70960aa33e6837b13
They can already use a lot of APIs to perform work in the background
and it simplifies the logic handling permission state changes and the
return value of canScheduleExactAlarms.
The major changes in behavior are:
1. Allowlisted apps can schedule unlimited alarm-clock alarms. This
should be the same as pre-S behavior.
2. If they happen to get the permission revoked, due to whatever reason:
user revocation, deny list, or app update, their alarm-clock alarms will
stay safe like their other exact alarms.
3. The API canScheduleExactAlarms is now true to its name: It returns
true even if the app is allowlisted.
Test: atest CtsAlarmManagerTestCases:ExactAlarmsTest
atest FrameworksMockingServicesTests:AlarmManagerServiceTest
BYPASS_INCLUSIVE_LANGUAGE_REASON=Existing APIs
Bug: 191716678
Bug: 190625528
Change-Id: I420694455f50aac10cf49cd43ff3b98575d86e9f
This reverts commit 6cf25139a0c4625a753f84183c641e83e89ec8fb.
Reason for revert: It results in thrashing the system in some cases
Bug: 192082833
Bug: 152573287
Test: atest FrameworksMockingServicesTests
Test: atest FrameworksServicesTests
Change-Id: I0ca09655b7911857cded5da74169b0c3bd332bda
Callers that don't target S can schedule exact alarms so should get a
return value of true when they call canScheduleExactAlarm.
Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest
Bug: 191328951
Change-Id: I1cd1d0fb3d3d922360494552e653ed540bfe5227
When we're charging and on an unmetered network, run jobs that we
calcluate won't complete within the max execution time due to the
network speed, just so they have a chance of running.
Also update documentation to guide to only providing size of
non-interruptible transfers.
Bug: 188429037
Test: Run `m offline-sdk-docs` and check site at out/target/common/docs/offline-sdk/reference/android/app/job/JobInfo.html
Test: atest FrameworksMockingServicesTests:ConnectivityControllerTest
Change-Id: Ic69e85a7e0eae51b3dd3ea89bd00255a734c1472
Minimum allowed window is now a function of the futurity of the alarm.
So for alarms in the near future, it is smaller and it increases as time
to alarm increases maxing out at 10 minutes.
Test: atest AlarmManagerServiceTest
Bug: 185199076
Change-Id: I57f275adab7f9bcc7f0f7535bb810aa9b359287b
Bug: 187429663
Test: Checked ApplicationInfo.hasRequestForegroundServiceExemption()
of a test app, with and without the new attribute set.
Change-Id: I98342a35a82e44327db896c9820806eb3eda5b4c
Bug: 187206399
Test: atest AlarmManagerServiceTest
Test: Manual test with a test app.
- Grant the permission to test app and make sure it can start FGS.
Log:
```
05-07 10:12:08.671 1000 1579 9475 I ActivityManager: Background started FGS: Allowed [callingPackage: com.google.omakoto.testapp; callingUid: 10294; uidState: RCVR; intent: Intent { act=fgs cmp=com.google.omakoto.testapp/.MyFgs }; code:(unknown:207); tempAllowListReason:<broadcast:1000:android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED,reason:,reasonCode:(unknown:207),duration:10000,callingUid:1000>; targetSdkVersion:30; callerTargetSdkVersion:30; startForegroundCount:0]
```
- Grant the permission to a different app and make sure the test app
won't receive the broadcast.
Test: CTS -- Incoming
Change-Id: Iefe3e12dcf51318d8433532ba3048caa69b1edcd
This behavior could be turned OFF via the flag kill_fas_cached_idle
in device_config.
Bug: 152573287
Test: atest FrameworksServicesTests:ActivityManagerTest
Test: atest FrameworksMockingServicesTests:AppStateTrackerTest
Change-Id: Ifa6950582fbf6a24595b36163810f3c7e9345394
1. Only downgrade an EJ that doesn't have the IGNORE_BACKOFF extra when
we are actually attempting to back off the job.
2. Allow EJs to have the FLAG_EXEMPT_FROM_APP_STANDBY flag since that
can only be set by the system and won't cause issues.
Also propagate the scheduleEjAsRegularJob bit through the job extras to
help with debugging.
Bug: 178852366
Test: atest ContentResolverTest (all)
Test: atest CtsJobSchedulerTestCases:JobInfoTest
Test: atest CtsSyncManagerTest
Test: atest SyncOperationTest
Test: atest SyncManagerTest
Test: atest SyncRequestTest
Change-Id: I133d089a4d770a3cc37df72f8b38d234b24077df
If temp allowlist reasonCode is REASON_PUSH_MESSAGING_OVER_QUOTA, check
DeviceConfig key "push_messaging_over_quota_behavior" to decide if
temp allowlist and FGS start are allowed. Three options:
1. -1, temp allowlist not allowed, FGS start not allowed.
2. 0, temp allowlist allowed, FGS start allowed.
3. 1, temp allowlist allowed, FGS start not allowed. This is default.
The device config command to change the behavior:
adb shell device_config set activity_manager push_messaging_over_quota_behavior <-1|0|1>
If temp allowlist reasonCode is REASON_DENIED, do not allow temp allowlist
at all.
Also, in DeviceIdleController.addPowerSaveTempAllowlistAppInternal(),
there used to be a check if the callingUid is on the mPowerSaveWhitelistSystemAppIds list,
this is unnecessary because upstream callers already checked if callingUid has
permission CHANGE_DEVICE_IDLE_TEMP_WHITELIST, and this permission is a privileged permission,
so removing the check of mPowerSaveWhitelistSystemAppIds should be safe.
Bug: 182796372
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java#testPushMessagingOverQuota
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java#testTempAllowListReasonCode
Change-Id: Id34b1c26c819dc4fe07838eb2e3a8f0138cbcf8f
1. Make it clear that "minimum latency" != "run ASAP after latency"
2. Note that deadline constraints are dropped from rescheduled jobs
3. Clarify that jobFinished does not need to be called if onStopJob is called
Bug: 19536175
Test: Run `m offline-sdk-docs` and check site at out/target/common/docs/offline-sdk/reference/android/app/job/JobInfo.html
Change-Id: I051feb0ebfcb0a24c452a38b91a751bbeef581f8
Make sure developers are aware that user interaction will replenish EJ
quota so they are less concerned about running out of quota for valid
use cases.
Bug: 171305774
Test: N/A
Change-Id: Iec231522dbc7fe83c65956b59ca3e4fbda072b97
This was supposed to be removed at the same we removed the related APIs
in JobInfo.Builder. It's not being used by anyone.
Bug: 186475837
Test: Android builds
Change-Id: Ib57029b7ba7e0c7b3f5bd36ba29a96e89eefb270
Add explicit reasons for when a job is stopped because the real-time
clock was updated and for when a job called jobFinished() on its own
(...why did we not have this to begin with???).
Bug: 141645789
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest ContentResolverTest (all)
Test: atest CtsJobSchedulerTestCases
Test: atest CtsSyncManagerTest
Test: atest SyncManagerTest
Test: atest SyncOperationTest
Test: atest SyncRequestTest
Change-Id: I61392c55355d2526a32ea9597a0010b04f3875ac
There are some uses for the "legacy" stop reasons that the public API
stop reasons can't cover well. Since we'll be keeping the "legacy"
reasons around, renaming them to "internal" to help explain the
differentiation.
Bug: 141645789
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest ContentResolverTest (all)
Test: atest CtsJobSchedulerTestCases
Test: atest CtsSyncManagerTest
Test: atest SyncManagerTest
Test: atest SyncOperationTest
Test: atest SyncRequestTest
Change-Id: I97e40d35b79dbd012216bc22e90d649639614854
Add an overloaded version of Context.sendBroadcastMultiplePermissions() that can
specify BroadcastOptions, it is called by com.android.bluetooth package.
Bug: 182816627
Test: atest AdapterServiceTest
Test: atest AvrcpControllerStateMachineTest
Test: atest BondStateMachineTest
Test: atest MapClientStateMachineTest
Test: atest RemoteDevicesTest
Change-Id: I8bb2d2ed98ece70ebbe9d3a1b549b966d690de4f
Inexact alarms will have a minimum length window enforced starting with
API S, so we need a clearer separate system API for apps that set alarms
on behalf of others.
Test: atest CtsAlarmManagerTestCases:BasicApiTests
Bug: 185530825
Change-Id: Ica8399b21421572e30a554f9897a352ce5fff557
permissions.
1. Create a generic FgsTempAllowList class, mFgsStartTempAllowList and
mFgsWhileInUseTempAllowList are instantiated from FgsTempAllowList.
2. For mFgsWhileInUseTempAllowList, the uid on this list is allowed to
have while-in-use permission when the FGS is started from background for
a duration of time.
3. When media button is pressed, the targetUid is added to
mFgsWhileInUseTempAllowList, for the duration of 10 seconds, this way the
targetUid can start FGS from background and have while-in-use permission.
4. When checking for ProcessRecord.
mAllowBackgroundActivityStartsTokens, it is the caller app's
ProcessRecord should be checked instead of the service's ProcessRecord.
Bug: 182481312
Test: use b/167998084 reproduce steps, make a voip call, the
receiver side screen is unlocked, the receiver side uses bluetooth
headset button to pick up the call, "dumpsys activity -a" shows the FGS
has "allowWhileInUsePermissionInFgs=true" and "isForeground=true".
Change-Id: Ic80aefe4202fe2210881bb8eea24b6e34cb1e7d0
LocationProviders can be defined outside the system server, and still
need access to this API.
Bug: 185505208
Test: presubmits
Change-Id: If50a200f8cb4c30fb3fff741b1751278aa4eb293
Any non-exact alarms with window > 0, should have a specific minimum
window length. Otherwise, very small windows, say 1ms, are pratically
indistinguishable from exact alarms.
Test: atest FrameworksMockingServicesTests:com.android.server.alarm
Bug: 185199076
Bug: 185199018
Change-Id: Idf933b70a66f2a749cdb2689ab68a80204d212b1
Adding a deny list option, which changes the default grant state of the
permission to denied. This means now alarm manager is the source of
truth of the permission state and exposes an API that clients like
Settings should call.
Also using the same API to cap the minimum standby-bucket
for apps with this permission to WORKING_SET.
Adding an app to the deny list may mean revocation of its permission, in
which case its exact alarms will be removed.
Meanwhile, performed some long needed refactoring on the remove methods,
so they re-use common code and are easier to maintain.
Also, changing strings for the Settings UI to be clearer.
Test: atest FrameworksMockingServicesTests:com.android.server.alarm
atest CtsAlarmManagerTestCases
Bug: 171306433
Bug: 130444055
Bug: 181894091
Bug: 181152252
Change-Id: I9410f988343800b7322963fecf3eafac9561b093
Adding a command to get the config version number which is incremented
everytime onPropertiesChanged is called. This is useful in waiting till
a change has been propagated to the service before proceeding with
tests.
Test: adb shell dumpsys alarm
adb shell cmd alarm get-config-version
Bug: 182835530
Change-Id: I171578255d4b69e75f535fd44ab0f5f462ea8d0b
1. Processes may not have been fully terminated by the time
PackageManager broadcasts PACKAGE_FULLY_REMOVED (see b/165012101
and b/162757029), so note that in the comments.
2. Use ACTION_PACKAGE_FULLY_REMOVED instead of ACTION_PACKAGE_REMOVED to
avoid processing update broadcasts.
3. Make sure we don't attempt to reschedule or reprocess jobs of
uninstalled apps.
Bug: 184098842
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest CtsJobSchedulerTestCases
Change-Id: I355786885fcc8eccd31c5557b35de3e5243615d8
Also replace all usages of TempAllowListType defined in
PowerWhitelistManager with the newly added reference in
PowerExemptionManager.
Fixes: 183053095
Test: atest ActivityManagerFgsBgStartTest#testTempAllowListType
Test: atest PowerExemptionTest
Test: atest BroadcastOptionsTest
Change-Id: I2f47ca99d4dfa8f267bb029d2934f0f765b0c594