57 Commits

Author SHA1 Message Date
Makoto Onuki
63dbf254b5 Merge "Add SystemApi to handle "adb shell cmd"" 2019-12-06 23:07:56 +00:00
kwekua
f64e827087 Merge "[BugFix]Fix enter deep doze when moving" am: 525d252ec1 am: bc68555ae5
am: f1cd6ab39f

Change-Id: I0dc8b6f5cb73ac5dd8e1eaeff46f079e12b7db90
2019-12-06 11:18:44 -08:00
Jeffrey Huang
77db950964 Merge "Rename writeToProto to be dumpDebug" 2019-12-06 18:53:15 +00:00
Jeffrey Huang
cb78285b81 Rename writeToProto to be dumpDebug
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
2019-12-05 11:28:11 -08:00
Shuo Qian
6f27c5769d Make getPackagesWithPriviligesForAllActiveSubscriptions system API
Test: build
Bug: 145550382
Change-Id: Ia7efb9e4b22b24f3c87c7cd631548c7254b28926
2019-12-05 02:49:14 +00:00
Makoto Onuki
f8f55027b3 Add SystemApi to handle "adb shell cmd"
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
2019-12-03 15:53:19 -08:00
Kweku Adams
835283f000 Adding temp whitelist methods to PowerWhitelistManager interface.
Migrating temp whitelist APIs to PowerWhitelistManager to allow
telephony to add apps to the temp whitelist.

Bug: 138239060
Bug: 140141678
Bug: 141155196
Bug: 142420609
Bug: 144864180
Test: atest PowerWhitelistTest
Change-Id: Iefd6ecf89aad46de042ef3a1ec0c20d6c35da5a6
2019-11-26 11:07:29 -08:00
Anton Hansson
97369f8daf Rename framework and service jars
Name them framework-* and service-* instead of *-(framework|service).
This matches the proposal in go/android-apex-for-framework.

Test: treehugger
Change-Id: I16754a5f08e002a8bc8862b11281f12cc6c8739f
2019-11-22 20:20:12 +00:00
TreeHugger Robot
6b8f486bd5 Merge "Extract SparseArrayMap from QuotaController." 2019-11-19 18:31:06 +00:00
Kweku Adams
a26ae90b4d Extract SparseArrayMap from QuotaController.
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
2019-11-18 17:58:00 -08:00
TreeHugger Robot
aa177e1841 Merge "DeviceIdleControl: spy handle message for idle factortest case" 2019-11-18 03:37:42 +00:00
Makoto Onuki
b84721844b Change FileDescriptor to PFD, per API guidelines.
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
2019-11-13 14:59:46 -08:00
Makoto Onuki
c10395b8e3 Merge "Revert "Change argument types from FD to PFD"" 2019-11-13 00:09:01 +00:00
TreeHugger Robot
930dfb0bff Merge "Ignore null package names on AppIdleHistory writes" 2019-11-12 23:03:39 +00:00
Makoto Onuki
6dbd2d62a7 Revert "Change argument types from FD to PFD"
This reverts commit 933bf11cc3de00c3a5718922548e5148043ed41d.

Reason for revert: Broke shell commands.

Change-Id: Icbe1e4089d2607d9bfa839ceb2e1ffad4f08e892
Fixes: 144317147
2019-11-12 21:54:17 +00:00
Makoto Onuki
933bf11cc3 Change argument types from FD to PFD
Bug: 142751512
Test: "adb shell cmd jobschduler help"
Test: "adb shell cmd activity help"
Change-Id: Ic35588f7c9fcaa06e3cf4feeedf54b3a0835ad44
2019-11-05 14:38:18 -08:00
Makoto Onuki
4c7073b017 Bidner shell command API proposal
Bug: 142751512
Test: "adb shell cmd jobschduler help"
Test: "adb shell cmd activity help"

Change-Id: I9174040cae72172e82d260d0ceb9ca5a69b72940
2019-11-05 09:13:07 -08:00
Hui Yu
2696932100 Add process capability as a new dimension.
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
2019-10-30 18:23:24 -07:00
Michael Wachenschwanz
16b2f2beb3 Ignore null package names on AppIdleHistory writes
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
2019-10-25 18:26:18 -07:00
Christopher Tate
b909c4d55a Move UsageStatsManagerInternal to services.jar
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
2019-10-24 18:28:52 +00:00
Denny cy Lee
990ca331d6 DeviceIdleControl: spy handle message for idle factortest case
Bug: 123045185
Test: atest com.android.server.DeviceIdleControllerTest
Change-Id: Id0a8b0c47c13d230509076149a74665b9f606136
2019-10-22 16:37:24 +08:00
Kweku Adams
df33ae1b0b Removing periodic parole window.
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
2019-10-16 13:04:06 -07:00
Wei Wang
aa87d8e55e jobscheduler: change to use thermal public API
Bug: 142394944
Test: adb shell cmd thermalservice override-status 0/5 and check jobscheduler status
Change-Id: I8fa2ca571657dbdd1dfd7970bfcabd432ce8f770
2019-10-11 18:11:21 +00:00
Kweku Adams
47718be3e6 Merge "Add API to whitelist multiple apps at once." 2019-10-11 17:27:41 +00:00
Kweku Adams
9e3402dcd7 Merge "Don't disable GPS in Doze until the device is stationary." 2019-10-11 01:26:04 +00:00
Chris Tate
98bfc27549 Merge "Fix job enqueue bug when changing constraints" 2019-10-10 22:10:06 +00:00
Kweku Adams
810c77d5a0 Don't disable GPS in Doze until the device is stationary.
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
2019-10-10 13:19:03 -07:00
Makoto Onuki
34f04d5c58 Merge "Stop using UserHandle' hidden constructor." 2019-10-10 18:52:42 +00:00
Kweku Adams
c2400c83d1 Add API to whitelist multiple apps at once.
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
2019-10-10 11:40:33 -07:00
Makoto Onuki
28b7235274 Stop using UserHandle' hidden constructor.
Bug: 142281756
Test: build
Change-Id: Icf16bdcad34dcc580fcc42d64c98a46d36bf19f7
2019-10-10 08:34:49 -07:00
Christopher Tate
b0da63c202 Fix job enqueue bug when changing constraints
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
2019-10-09 14:43:10 -07:00
Makoto Onuki
0e1ce97198 Remove trivial hidden API uses
Bug: 142281756
Test: boot
Test: dumpsys jobscheduler and check the relevant fields
Change-Id: Ibdd2b9f36d47de35128be22d1e1057b1b0f1f28b
2019-10-09 14:26:40 -07:00
TreeHugger Robot
fe708d72ec Merge "Fix AppStandbyController flag." 2019-10-09 04:51:42 +00:00
Kweku Adams
0140ff88f6 Fix AppStandbyController flag.
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
2019-10-08 17:04:28 -07:00
Makoto Onuki
fa98ee4463 Fix trivial hidden API uses
Bug: 142281756
Test: boot
Test: manual code inspection
Change-Id: I4abf477db7bd46d1daef6f723d4e49f6bfb9bbbe
2019-10-08 13:35:26 -07:00
Makoto Onuki
fa8b0ba2bf Fix trivial hidden API uses
Bug: 142281756
Test: boot
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/DeviceIdleControllerTest.java
Change-Id: I3438e62731118462a4cf8db954a5a95a5908d7a8
2019-10-07 16:52:29 -07:00
Makoto Onuki
a72e04fcd9 MoveAppStandbyController to the jobscheduler module
Bug: 137763703
Test: boot
Test: atest AppStandbyControllerTests
Change-Id: I03799c976f6c8b3e775a1a6321885a9cb069a0a0
2019-10-03 15:41:26 -07:00
TreeHugger Robot
d262c51aaa Merge "Simplifying removeAll method." 2019-09-27 22:44:18 +00:00
Kweku Adams
2c31b6756f Simplifying removeAll method.
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
2019-09-26 14:58:11 -07:00
Sergey Nikolaienkov
c88fcb41b4 Merge "Introduce JobRestrictions for JobSchedulerService" 2019-09-24 03:43:39 +00:00
Sergey Nikolaienkov
2ad8af146c Introduce JobRestrictions for JobSchedulerService
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
2019-09-15 11:09:34 +02:00
Kweku Adams
06f4a5a3ef Merge "Fix QuotaController constants." am: 4017f8be2f am: 29a7524bdd am: fe1bf5d3fb
am: 86b012117d

Change-Id: I50be8680e449bea54c2e3b8300812a00cf6567af
2019-09-13 11:21:22 -07:00
Makoto Onuki
7ed0cad783 Switch to the public AtomicFile
Not sure why we have two versions of AtomicFile.
Bug: 137763703
Test: presubmit

Change-Id: Ia05e1ca076772431808dc0129012f2e60d6235ef
2019-09-04 16:06:51 -07:00
Makoto Onuki
78ebcf5b11 Remove IMaintenanceActivityListener (which was unused)
Bug: 137763703
Test: treehugger
Change-Id: I0a1839eff52b69a8711b44350523b91cecfa3d8d
2019-08-27 12:01:10 -07:00
Makoto Onuki
52c24b377b Move DeviceIdle to the JS apex
Test: atest cts/tests/tests/batterysaving/src/android/os/cts/deviceidle/DeviceIdleTest.java
Bug: 137763703
Change-Id: I836350c09f45f95afbf90b562ab1ceed75526498
2019-08-23 16:03:30 -07:00
TreeHugger Robot
aa27745e42 Merge "Use non-wakeup alarm for delay constraint." 2019-08-20 01:51:27 +00:00
TreeHugger Robot
dc6026ee43 Merge "Remove now-unused access of IActivityManager for Uri grants" 2019-08-15 23:31:11 +00:00
Christopher Tate
1b1fca8c6d Remove now-unused access of IActivityManager for Uri grants
Test: atest CtsJobSchedulerTestCases
Change-Id: Iba1c678707cfbf2424ad43129f4279b4d29a470c
2019-08-14 16:59:33 -07:00
Makoto Onuki
eaf7eed5a2 Extract DeviceIdleInternal
Bug: 137763703
Test: presubmit
Change-Id: I9c935bfe6b1ba506968db159d8c0ffced3b3f1ff
2019-08-12 15:35:32 -07:00
Kweku Adams
ca7fb4bcc0 Use non-wakeup alarm for delay constraint.
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
2019-08-12 11:01:56 -07:00