We want to eventually migrate some of these APIs to be @SystemApi for mainline modules.
The #dumpDebug name is more appropriate than #writeToProto.
Bug: 142279786
Test: Manual
Change-Id: I60793e91cedf6b720d4ecef6a8484f4fed4ff30f
This will be used by mainline system services.
TODO: Maybe add more APIs to register subcommands
Bug: 142751512
Test: adb shell cmd jobscheduler help
Change-Id: Ie6d4b9aa4df426d64270d114d694f042b2600cce
Name them framework-* and service-* instead of *-(framework|service).
This matches the proposal in go/android-apex-for-framework.
Test: treehugger
Change-Id: I16754a5f08e002a8bc8862b11281f12cc6c8739f
This structure can be useful in other parts of the system, so extracting
it and making it more generic makes sense.
Bug: 135764360
Bug: 141645789
Test: atest QuotaControllerTest
Test: atest SparseArrayMapTest
Change-Id: I2aeb3ea53e3dc2ec00667a0a2ccdb112cf562377
handleShellCommand() would be a system API, so we should use PFD instead,
per the API guidelines.
Bug: 142751512
Test: "adb shell cmd jobschduler help" -> show help
Test: "$ cmd jobscheduler run abc 123" -> shows "Package not found: abc / user 0"
Test: "adb shell cmd activity help" -> show help
Change-Id: I64b1e4c540db836cc4a46fed24a038b7077ecb63
Add new attribute capability to ProcessRecord, it represents what this
process is allowed to do. Capability is a separate dimension for
process state (ProcState).
In OomAdjuster.java, capabilities can be passed from client to service.
Add PROCESS_CAPABILITY_FOREGROUND_LOCATION to represent the capability
that can access location while-in-use.
For permission such as foreground location access, AppOpsService
checks for FOREGROUND_LOCATION capability, also checks if the process
is in one of the foreground process states, if both conditions meet,
the locaton operation is allowed.
Remove PROCESS_STATE_FOREGROUND_SERVICE_LOCATION.
Bug: 136274596
Test: atest CtsAppTestCases:ActivityManagerProcessStateTest
atest CtsAppTestCases:ActivityManagerApi29Test
atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/appop/AppOpsServiceTest.java
Change-Id: Ie1c8e670fb0789208b753eb49b7e2fce6a2f211f
AppIdleHistory will fail to persist to disk if a null package name makes
it into the map. This change avoids the failure and adds more detail to
the log in the event of a failure.
Test: atest AppIdleHistoryTests
Bug: 122609407
Change-Id: Ifec5a14f488fdb425bdcfee6ffe1f48f9fa9d1e8
UsageStatsManagerInternal is also no longer an API surface for
registration of app idle state change listeners. AppStandbyInternal has
become a proper LocalService and interested clients can just use that
directly.
Bug: 140833849
Test: boot & run normally
Test: verify system package backup
Change-Id: Ie63f438f129cd8f41169778a3045d131ca7322fb
The periodic parole window is the 10 minute window that occurs every
24 hours to let RARE apps run. Now that we have the quota system in
place, there's no need to have the periodic parole window. Alarms and
jobs will still be allowed to run when charging. Network will continue
to be restricted for RARE apps even when charging. JobScheduler requests
an exception for RARE jobs in quota, so they will still be able to run.
Bug: 136184981
Test: atest AppStandbyControllerTests
Test: atest CtsAlarmManagerTestCases
Test: atest NetworkPolicyManagerServiceTest
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Test: atest com.android.server.AlarmManagerServiceTest
Test: atest com.android.server.AppStateTrackerTest
Test: atest com.android.server.job.controllers.QuotaControllerTest
Test: atest com.android.server.net.ConnOnActivityStartTest
Change-Id: Ide382ad7fb9c7441f0a5232833ad39bf8c3a1e94
GPS is normally disabled when the device is Dozing. This means that GPS
is turned off in Battery Saver when quick doze is enabled. This
interferes with navigation and possibly other use cases. This changes
the behavior so that GPS is only disabled during Dozing if the device is
stationary. This will not interfere with regular Doze since the device
has to be stationary before it will enter regular Doze, and also allows
GPS to continue to work when Quick Doze activates while the user is
still carrying the device around.
Bug: 140162457
Bug: 119261320
Test: atest BatterySaverLocationTest
Test: atest com.android.server.DeviceIdleControllerTest
Test: [manual] Shorten motion timeout, step into idle, check gps
provider dump after short timeout to check mDisableGpsForPowerManager=true
Change-Id: I7bc68c8a5e6744aac3a160ac14fc3375f9374d82
This adds an API to be able to add multiple apps to the power save
whitelist at the same time while only sending out the
POWER_WHITELIST_CHAGNED broadcast once.
Bug: 140141678
Test: atest com.android.server.DeviceIdleControllerTest
Test: atest android.alarmmanager.cts.AppStandbyTests
Change-Id: I66cfd5410b85368647faea704ada1bc1ac563510
If a job with pending work had new work enqueued but with a changed set
of constraints (including temporal constraints), the system was
accidentally discarding the new work item, leaving only the
previously-pending ones. Now that's fixed: changing constraints works as
expected, changing the execution criteria for the job, retaining all
pending work, and adding the new work to the end of the queue.
Bug: 141707520
Test: atest CtsJobSchedulerSharedUidTestCases:EnqueueJobWorkTest#testEnqueuedWorkNewConstraints
Change-Id: I92e42049937847922f1fa9a10432ec87676408d0
mUnexempted... was using the value of the EXEMPTED_... flag. The default
values were the same, but this would have caused a problem if we tried
to update the value via a flag.
Also removing deprecated flags.
Bug: 141645789
Test: N/A
Change-Id: I2ace1b510b2d7f5d6f92c16dd6302ae4e5525456
JobStore.removeAll() iterates through an ArraySet and removes jobs that
satisfy a predicate. The repeated removals will cause ArraySet to do
many System.arraycopy calls and could cause the ArraySet to resize its
internal array several times during the iteration. ArraySet has a
removeIf(Predicate) method which does this exact task without repeatedly
resizing the array or doing many System.arraycopy calls. Switching to
ArraySet.removeIf will reduce the amount of code and improve performance
in some cases.
Bug: 141645789
Test: atest com.android.server.job.JobStoreTest
Change-Id: Icbdcda219c115288d13a3508e8b4762783301eb0
Introducing a JobRestriction class - an abstraction for imposing
additional restrictions regarding whether JobSchedulerService jobs
should schedule a particlular job based on the state of the
system/device.
Bug: 133217178
Change-Id: I497ada3708ca1bb20d1acf4ec674cc5e0e0f201c
The delay alarm does not need to go off exactly when the time has
passed, so a non-wakeup alarm is suitable for the delay constraint.
A job is expected to go off as soon as its deadline constraint is
satisfied, so we leave the deadline alarm as a wakeup alarm.
Bug: 138465403
Test: atest com.android.server.job.controllers.TimeControllerTest
Test: atest CtsJobSchedulerTestCases
Change-Id: I5756bd805c68dea51b3a5aa74419b195407e1a30