These numbers are useful in adjusting JS policy, so we should persist
them so we can use them after the device reboots.
Bug: 258701271
Test: atest FrameworksServicesTests:JobStoreTest
Change-Id: Iee8fb699ea5b4c01446ce8fd8f806203effbe4ce
Add new APIs to support the data transfer job project. These APIs allow
the app to update JobScheduler on estimated transfer sizes and the
progress of the transfer.
Bug: 255371817
Test: Android builds
Change-Id: I70c1020d8a8b0956aaff5e2a843cc338bdbe6bf5
Make it possible to persist jobs in a separate file for each calling
UID. This makes it easier to persist changes to jobs of individual apps
instead of having to write the entire set of jobs every time something
changes.
Read times decrease by 2-5% when there are many jobs for each app but
increase by 33-35% when there are only a few jobs per app.
Write times increase by 5% (for many jobs) to 64% (for few jobs) for a
full write but decrease by 1% (for few jobs) to 38% (for many jobs) when
there are partial writes.
JobScheduler is read-once, write-many system, and apart from migration
from between monolithic and split file architectures, should mostly be
in the partial write scenario.
The code is disabled for now and will be turned on separately.
Performance Test Results:
(With monolithic file):
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_badRTC
testPersistedJobReading_fewJobs_badRTC_mean (ns): 4632075
testPersistedJobReading_fewJobs_badRTC_median (ns): 4568177
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_manyJobs
testPersistedJobWriting_manyJobs_mean (ns): 38133928
testPersistedJobWriting_manyJobs_median (ns): 37794691
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_goodRTC
testPersistedJobReading_manyJobs_goodRTC_mean (ns): 46015412
testPersistedJobReading_manyJobs_goodRTC_median (ns): 45553494
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_fewJobs
testPersistedJobWriting_fewJobs_mean (ns): 4903462
testPersistedJobWriting_fewJobs_median (ns): 4914740
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_goodRTC
testPersistedJobReading_fewJobs_goodRTC_mean (ns): 4432127
testPersistedJobReading_fewJobs_goodRTC_median (ns): 4395469
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_manyJobs
testPersistedJobWriting_delta_manyJobs_mean (ns): 42629601
testPersistedJobWriting_delta_manyJobs_median (ns): 42282061
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_fewJobs
testPersistedJobWriting_delta_fewJobs_mean (ns): 5070691
testPersistedJobWriting_delta_fewJobs_median (ns): 4914688
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_badRTC
testPersistedJobReading_manyJobs_badRTC_mean (ns): 45184576
testPersistedJobReading_manyJobs_badRTC_median (ns): 44922660
(With split files):
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_badRTC
testPersistedJobReading_fewJobs_badRTC_mean (ns): 6350549
testPersistedJobReading_fewJobs_badRTC_median (ns): 6232605
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_manyJobs
testPersistedJobWriting_manyJobs_mean (ns): 39963524
testPersistedJobWriting_manyJobs_median (ns): 39628389
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_goodRTC
testPersistedJobReading_manyJobs_goodRTC_mean (ns): 43956702
testPersistedJobReading_manyJobs_goodRTC_median (ns): 43569874
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_fewJobs
testPersistedJobWriting_fewJobs_mean (ns): 8250152
testPersistedJobWriting_fewJobs_median (ns): 8090939
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_fewJobs_goodRTC
testPersistedJobReading_fewJobs_goodRTC_mean (ns): 6006753
testPersistedJobReading_fewJobs_goodRTC_median (ns): 5869193
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_manyJobs
testPersistedJobWriting_delta_manyJobs_mean (ns): 26459508
testPersistedJobWriting_delta_manyJobs_median (ns): 26147607
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobWriting_delta_fewJobs
testPersistedJobWriting_delta_fewJobs_mean (ns): 4958038
testPersistedJobWriting_delta_fewJobs_median (ns): 4881588
com.android.frameworks.perftests.job.JobStorePerfTests#testPersistedJobReading_manyJobs_badRTC
testPersistedJobReading_manyJobs_badRTC_mean (ns): 44476839
testPersistedJobReading_manyJobs_badRTC_median (ns): 43993285
Bug: 255352252
Test: atest JobSchedulerPerfTests:JobStorePerfTests
Test: atest FrameworksServicesTests:JobStoreTest
Change-Id: Ib7bfa2c974f7663dea79d707c9e1b2bd53ef89b3
Remove jobs whose timing constraints have been deemed as satisfied
outside of the normal alarm checking flow from the tracked job list.
They would have eventually be removed, but there's no reason to keep
them in the list longer than necessary.
Bug: 141645789
Test: Android builds
Change-Id: I9d5a78f747a9195621205e62279f92c6c9bba8cc
UserPackage is designed to reduce object creation and memory
duplication for the userId+packageName pair use case.
Bug: 247127880
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/devicepolicy
Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest
Change-Id: Iab0e1169a7f81c12054995836a07b3fa960ee8e6
They are currently being sent as ordered in order to receive
the finish callback. Since the modern broadcast queue supports
a finish callback with the need for the broadcasts to be ordered,
don't send these broadcasts as ordered anymore.
Bug: 256597397
Bug: 256597171
Bug: 253226131
Test: treehugger
Change-Id: I00a0dec0df99892b2d0f4a023efcc965a2061379
BlobStore APIs are restricted to be only consumed by the admin user's
app with system uid. Right now there is only one admin user
which is user 0 and for user 0 both the appId and callingUid are same.
So even with callingUid, the existing check works well.
With the new headless mode, there can be several Admin users,
and any Admin user's app with a system uid can call BlobStoreManager APIs. But the appId and callingUid have different values on other(except user 0) amdin users' apps.
callingUid = userId + "0" + appId
Refactored the restriction to use appId instead of callingUid to match with SYSTEM_UID and added an additional check to ensure that the calling user is an admin user.
Removed unused callingUid param in internal method.
Bug: 256119753
Test: atest --test-mapping apex/blobstore
Change-Id: I6717cb8ebeb263c911e3caae924b7c3935e58778
If getBatteryScreenOffDischargeMah() returns zero that will lead to
a division by zero when computing estimatedLifeHours that will
bring down the entire system server. Guard against this by returning
from the function early if it returns zero.
Change-Id: I4905d7184e5185a07e4185fa0e263559d85cff49
1. Remove the forUpdate boolean since no controller was using it.
2. Stop returning a boolean from JobStore.add(). It was always returning
false because the remove() method would remove the added JobStatus
object, not anything similar to the object. Thankfully, we were
removing old JobStatus objects via another codepath, so the bug never
surfaced as an issue.
Bug: 141645789
Test: Android builds
Change-Id: I17c7a4a629f033c574e4fbd625211c0fc476fcc9
https://xkcd.com/927/
Many different components have created their own classes to represent a
userID+packageName combination. This means 1) duplicate code, 2)
duplicate objects in memory representing the same thing. Creating a
common class that limits itself to one object per userID+packageName
combo addresses those two concerns.
There are still others with similar classes. They're not included in
this CL because they have slight differences and would require a little
bit more work to consolidate.
Bug: 141645789
Bug: 247127880
Test: atest CtsAccountManagerTestCases
Test: atest CtsContentTestCases:OverlayManagerTest
Test: atest CtsShortcutManagerTestCases
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/tare
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/om
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/pm
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/tare
Test: atest FrameworksMockingServicesTests:PrefetchControllerTest
Test: atest FrameworksMockingServicesTests:QuotaControllerTest
Change-Id: I63d5bc946cc7b24a0536e8b2051da07a801b3a8a
With the incoming long-running job feature comes the possibility that
all usable slots are occupied for long periods of time (eg. for hours),
so if we detect that other jobs would be stuck waiting in the queue for
too long then we'll create at most 2 extra slots (one for EJs, one for
regular jobs) so that we can make forward progress with the other jobs.
Bug: 248386641
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest CtsJobSchedulerTestCases
Change-Id: I7a41a5c8371714a0285bb2dcfe115c762c0d8ed7
Create separate fields for minimum and initial consumption limits so
that they can be modified independently.
Bug: 255321890
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/tare
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/tare
Test: manually change in Developer Options UI
Change-Id: I2d3e17be2fd6d6913782fcfdbbe4452cfd484c2c
To aid future debugging of the modern stack, include a "reason"
behind each state transition.
Register Loopers that are well-known to be used for broadcast
dispatch so that we fully drain them before "wait-for-broadcast".
Remove outdated TODOs that are either finished or tracked elsewhere,
add misc annotations.
Bug: 254521331
Test: atest FrameworksMockingServicesTests:BroadcastRecordTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueTest
Test: atest FrameworksMockingServicesTests:BroadcastQueueModernImplTest
Change-Id: I7fe33cd173919f98c062c488598f81ac732c52a3
Use "overtime job" instead of "long running" to refer to jobs that
have been running longer than their minimum execution timeout and
are thus running in overtime to avoid naming collision with new long
running job features.
Bug: 141645789
Test: Android builds
Change-Id: I7298f69aa16a422c9887b07a51d1f53314635978
Don't penalize jobs in the backoff calculation when they were stopped
for reasons that were likely outside of the app's control (eg. the
device entering Doze or battery saver or constraints no longer being
satisfied). Jobs calling jobFinished() on their own or timing out are
both deemed as being within the app's control.
Bug: 209979687
Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Change-Id: I3cffd676c81cb461df39e68999b1a97cf4d5521a
Ignore invalid negative values in the network payload estimate
calculations and use known/available values to get a best effort
estimate of the total payload size.
Bug: 253665015
Bug: 255828754
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Change-Id: Ie986ac8a4b46a920c6d57b6925e72f8d62e1ce68
A subsequent change will actually move the files to the other git
project.
Bug: 243194720
Test: presubmit
Change-Id: If126bb68f74852528c4da8df79831b49b5129983
Reject scheduling of JobWorkItems that imply network usage but are
scheduled using a JobInfo that doesn't have a network constraint.
Bug: 241104082
Test: atest CtsJobSchedulerTestCases:JobWorkItemTest
Change-Id: I0c74eae37d9cb60f0e671dda252a0d4f15c83070
For user removed case, need to remove all data
which is related with theremoved userId.
Bug: N/A
Test: N/A
Change-Id: Icad92b86d37154134117a0c6035d95617df352d1
Merged-In: I400e2d9d3ec8b76a293856c44375bb1d302c530f
JS policy is primarily based on the source UID, not the calling UID.
Update the code and tests to evaluate the source UID state.
Bug: 253815639
Bug: 253820921
Test: atest FrameworksMockingServicesTests:FlexibilityControllerTest
Change-Id: I193b69e0809f10f38e11fe956f8dbb9c325d993b
Add a limit to the number of dropped constraints and stop modifying the
number of required and dropped constraints independently to prevent the
code from creating invalid indices at random times. Also fix some of the
tests and make them more robust.
Bug: 253237201
Test: atest --rerun-until-failure 25 CtsJobSchedulerTestCases:FlexibilityConstraintTest
Test: atest --rerun-until-failure 25 FrameworksMockingServicesTests:FlexibilityControllerTest
Change-Id: I072da5c6271eecc3e8a7e3983f414c752d40cba8