2849 Commits

Author SHA1 Message Date
Sudheer Shanka
055cbb2089 Add documentation for BlobStore service.
Bug: 191168800
Test: n/a
Change-Id: Id55d593856d6194cd620211cc3bca981e572d15a
Merged-In: Id55d593856d6194cd620211cc3bca981e572d15a
2021-11-03 23:05:18 +00:00
Kweku Adams
14841f18ff Partial revert "Wait for unlock to start jobs."
This reverts commit e61cf5125e83b119701228e742f7b2cb3a433cb6
but changes onUserUnlocking to onUserUnlocked.

Reason for revert: Direct-boot-aware jobs should be allowed to run when the user is locked

Bug: 200174299
Bug: 201307089
Test: N/A
Change-Id: Ic5a67a42590e171f0bfed8da0c138096031469d5
(cherry picked from commit 171bf04113154a7e3668e07677701869dfae9eda)
2021-10-12 13:07:14 -07:00
Jiakai Zhang
2af8741f14 Add the systemserver_fragment to media SDK.
Note: This needs to be exported from the APEX (ag/15937385) when a new
prebuilt is dropped.

The systemserver_fragment is needed for dexpreopting when the media APEX
is built from a prebuilt.

Bug: 194150908
Test: m nothing
Merged-In: I2cca8b206451858e636c6bd04617cf3933f702c6
Change-Id: I2cca8b206451858e636c6bd04617cf3933f702c6
(cherry picked from commit 381fb640c6e25dbd211d12c791a473c4611e70a7)
2021-10-11 04:47:38 +00:00
Xin Li
c03b0fa033 Merge "Merge Android 12" 2021-10-07 23:50:15 +00:00
Ray Essick
55fbfbc887 Update media's mainline OWNERS
Bug: 201770269
Test: repo upload
Change-Id: I3b6cb7da5fe68c7f7cf9756c7df94e1a9a9f8295
2021-10-04 18:54:12 +00:00
Baligh Uddin
d4f12c6ea6 Remove frameworks/base/apex/appsearch and associated tests
BUG: 192108282
Test: TH
Merged-In: I38469ad5df100e90aba81bbdc82078b568301f09
Change-Id: Ib7e97c6ee7dff1c5d0aad2c21635e74510d523a6
2021-09-29 23:40:11 +00:00
Xin Li
8891d70334 Merge SP1A.210812.016
Merged-In: I8b62b9b9d7ae271bc623764d545db1320b4dc64f
Change-Id: I458ed7f2eb8603f5e89c1d73bc0f0d52b826973e
2021-09-28 19:26:36 +00:00
Santiago Seifert
afc4d064cc Merge "Clean up ownership in frameworks/base/" am: c875fc5613
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1804116

Change-Id: I14566099250b2630a4146abd47862585e5e52fa1
2021-08-20 16:44:26 +00:00
Santiago Seifert
432e98eb50 Clean up ownership in frameworks/base/
Bug: 197217250
Change-Id: I04bee764bf50734523ff2210d30ed052dcb036bd
Test: No code changes done.
2021-08-20 13:59:15 +00:00
Ray Essick
4cfe431f14 Rename android.media.MediaTranscodeManager -> MediaTranscodingManager
renamed to avoid conflict with existing copy in the R framework.jar.
The framework.jar copy was removed during S development

Bug: 195608856
Test: build
Test: cts-tradefed run cts -m CtsMediaTranscodingTestCases
Change-Id: I40ab066cd61be8d278f21cc788016f2edd6bb86e
(cherry picked from commit 1168d9d014cfc0e007c311db92ff2d69cc30df18)
2021-08-17 01:09:58 +00:00
Chris Tate
e833132601 Merge "Consistent reporting of failure conditions" into sc-dev 2021-07-28 21:19:45 +00:00
Kweku Adams
0687577f87 Address sorting edge case.
There are times when the enqueue time of two different jobs are exactly
the same. In those cases, if an EJ skipped over one regular job with an
enqueue time X, then it should skip all other regular jobs with enqueue
time X.

Bug: 194324016
Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
Test: atest CtsJobSchedulerTestCases
Change-Id: I77e106676238dd3ae198fab619af430e48d433a2
2021-07-27 10:38:28 -07:00
TreeHugger Robot
776fea73bb Merge "Don't crash apps due to race condition." into sc-dev 2021-07-23 04:04:35 +00:00
TreeHugger Robot
fd94d33a17 Merge "Logging the caller uid state with AlarmScheduled atom" into sc-dev 2021-07-23 01:11:41 +00:00
Kweku Adams
ec7103c614 Don't crash apps due to race condition.
When apps are stopped unnaturally (ie. because something stopped the job
and the job itself didn't call jobFinished or dequeueWork with no
remaining work) then we have the chance of small race conditions where
the job may try to complete its work. Since the race condition isn't
really the app's fault, we shouldn't punish the app for it.

Bug: 194358301
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: I3b0edd4f2241172fe97875eb8070cb5188027afb
2021-07-22 14:41:36 -07:00
Terry Wang
f4b8e82790 Merge "Fix validation crash for nextPageToken." into sc-dev 2021-07-22 19:32:18 +00:00
Xiaoyu Jin
f5bfc7527c Merge "Log stats for Optimize" into sc-dev 2021-07-22 19:16:15 +00:00
TreeHugger Robot
c630f87976 Merge "Remove deprecated, hidden versions of changed public APIs." into sc-dev 2021-07-22 07:44:54 +00:00
Terry Wang
d0ffb446cf Fix validation crash for nextPageToken.
We are caching nextPageToken in query(), and validate it in
getNextPage(). But when it reach to the end, the token will be changed
to 0. And it will crash if user is trying to fetch next page since 0
is not cached and won't passed the validation.

This change fix the issue. Without it, users maybe crashed if they
are trying to retrieve all documents in all result pages.

Bug: 187972715
Test: AppSearchSessionUnitTest
Change-Id: Ia95feb52f2a37348e11afdf0b320c61bfce22d40
2021-07-21 03:50:54 -07:00
Suprabh Shukla
ef2636a43a Logging the caller uid state with AlarmScheduled atom
Test: statsd_testdrive 368
Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest
Test: atest CtsAlarmManagerTestCases
Test: atest CtsStatsdAtomHostTestCases:AlarmStatsTests

Bug: 194249875
Change-Id: Ia55306b3a4839aadc4bc2fdd873878b1a4e591fb
2021-07-20 23:05:22 -07:00
TreeHugger Robot
2873eb7d83 Merge "Allow GenericDocument accept a String property longer than 20_000." into sc-dev 2021-07-21 03:26:06 +00:00
Cassie Wang
34a952cf94 Merge "Ensure calling user is the same as requested user." into sc-dev 2021-07-21 01:03:03 +00:00
TreeHugger Robot
5b6a2aff21 Merge "Stop removing all APP_STANDBY_BUCKET_CHANGED messages." into sc-dev 2021-07-20 23:34:59 +00:00
Kweku Adams
c2f4752a71 Merge "Fix parameter order." into sc-dev 2021-07-20 11:37:09 +00:00
Kweku Adams
63f5d4b699 Stop removing all APP_STANDBY_BUCKET_CHANGED messages.
APP_STANDBY_BUCKET_CHANGED messages are for single apps, so it doesn't
make sense to remove all messages whenever any app's standby bucket
changes.

Bug: 193918191
Test: N/A
Change-Id: I981cd3be3cd381c6d00f06e3da9f8e67f157a26b
Merged-In: I981cd3be3cd381c6d00f06e3da9f8e67f157a26b
2021-07-20 00:14:27 +00:00
Kweku Adams
dbf042c666 Fix parameter order.
AlarmManager.setWindow's parameter order is type -> window start ->
window length. Actually put the values in the correct order.

Bug: 193866265
Test: atest DeviceIdleTest
Test: atest FrameworksMockingServicesTests:DeviceIdleControllerTest
Change-Id: I5c87dad3015859d68aacb6781166432b615327b9
2021-07-19 16:26:54 -07:00
Cassie Wang
3ce6aba403 Ensure calling user is the same as requested user.
This prevents any cross-user requests. Cross-user requests are already
not allowed, but due to a bug elsewhere in the code. This intentionally
handles the case and also throws a SecurityException.

Bug: 193903221
Test: presubmit
Test: manually checked cross-user requests get an exception.
Change-Id: I5bd867b86b972452daa2d8253f3c19f059a8a4b3
2021-07-19 16:17:29 -07:00
Treehugger Robot
5a750a5aa1 Merge "Restrict all jobs when the device is too hot." 2021-07-16 21:25:54 +00:00
Terry Wang
830c6797cd Allow GenericDocument accept a String property longer than 20_000.
This limit was removed from the AppSearch Jetpack API meaning that
a client could construct a GenericDocument successfully, but then
have a PutDocuments call fail when converting from
androidx.appsearch.GenericDocument
to android.appsearch.GenericDocument.

Icing still has a total document size limit which is 16 MiB.
The put call will fail if it trying to write such document.


Bug: 192909904
Test: GenericDocumentTest
Change-Id: I86f97acc3a8e0f1c25fadf597aed9f42a2c493eb
2021-07-16 12:20:26 -07:00
Alexander Dorokhine
410618472f Log stats for Optimize
OptimizeStats is crucial for us to tune our configuration for
optimization, which might affect the health of AppSearch and system
overall. Details can be found in Ib7ae475cc035d1b69969df1e22ac409895e0e3fa.

Also add sampling parameters in AppSearchConfig for:
1) initializeStats
2) searchStats
3) globalSearchStats
4) optimizeStats

Bug: 173532925
Bug: 175255572
Test: AppSearchStatsTest, FrameworksMockingServicesTests:AppSearchConfigTest, CtsAppSearchTestCases
Ignore-AOSP-First: AppSearch is not available on AOSP yet
Change-Id: Id61704407bdb40707cb8fa46b556024aea9f9083
2021-07-15 11:22:37 -07:00
Cassie Wang
46db5f1018 Merge "Cache nextPageTokens that a package can use." into sc-dev 2021-07-15 04:14:46 +00:00
TreeHugger Robot
977e2adc14 Merge "Separating alarm history for lower quota" into sc-dev 2021-07-14 20:09:15 +00:00
Kweku Adams
a93387f91d Restrict all jobs when the device is too hot.
Restrict all jobs (and not just connectivity jobs) when the thermal
status is SEVERE+.

Bug: 193269111
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
Merged-In: Id8eed849dfeb26aca1c0743af974c9efadf7fb78
Change-Id: Id9391a524cabe221b054d6d832ca07668d4312e5
2021-07-14 10:17:39 -07:00
Kweku Adams
ab7b0e8991 Merge "Restrict all jobs when the device is too hot." into sc-dev 2021-07-14 15:38:19 +00:00
lifr
d44ddbdfad Cleanup the public API getActiveNetworkForUid on AOSP
Use reflection method to replace the use of public api
getActiveNetworkForUid.

Android 12 version, the public API getActiveNetworkForUid and all
(outside the module) callers of the API have been removed and replaced.

Unfortunately, the related delete/replace code cannot be synced to AOSP
,so in order to keep the public api consistent in Android 12 & AOSP,
The commit uses reflection method to replace the caller of this public
api, Then we can delete this public API in another commit in AOSP.

Bug: 183465229
Test: atest ConnectivityControllerTest
      atest CtsJobSchedulerTestCases:ConnectivityConstraintTest
Merged-In: Ie93cd22b11cc28135a385c0cf6ad6b577b61d1b7
Change-Id: Ia636480b12a9b4a9e2c5dd2ec9259af3167df909
2021-07-14 10:40:29 +08:00
Kweku Adams
b70c941f60 Restrict all jobs when the device is too hot.
Restrict all jobs (and not just connectivity jobs) when the thermal
status is SEVERE+.

Bug: 193269111
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: Id8eed849dfeb26aca1c0743af974c9efadf7fb78
2021-07-13 16:50:54 -07:00
Suprabh Shukla
4e05326a55 Separating alarm history for lower quota
Using a separate container for lower allow-while-idle quota to avoid out
of quota issues. Using the same container means that the lower quota is
out whenever higher quota is used for alarms from the same app.
Lower quota - currently once per 9 minutes - is used in the
following cases:
 - Inexact allow-while-idle alarms. This means the same app can use
 alarms using high quota and low quota simultaneously.
 - When the caller is targeting < S.
 - When the caller is in the power save allowlist, but does not have the
 permission - for exact alarms.

Test: atest CtsAlarmManagerTestCases
Test: atest FrameworkMockingServicesTests:com.android.server.alarm

Bug: 190788800
Change-Id: Iba46fdd36dc04843e9256827b0754d21cfff89c9
2021-07-13 16:19:23 -07:00
Christopher Tate
35f567467e Consistent reporting of failure conditions
Querying for the state of the exact-alarm permission produced
inconsistent results depending on circumstances.  This is now fixed so
the failure reporting is invariant.

Bug: 193032972
Test: manual
Test: atest CtsAlarmManagerTestCases
Change-Id: Ie1cc126cec568b6f53ebe6049e57ed13abdfd5bb
2021-07-13 13:08:54 -07:00
Alexander Dorokhine
63aae95733 Remove deprecated, hidden versions of changed public APIs.
These versions were kept around to facilitate dogfooder transition
during the API council review process. Our dogfooders' apps have updated
to versions that use the finalized sdk, so these are no longer required.

Bug: 181887768
Test: Presubmit
Test: Flash device, run jetpack platform backend tests
Change-Id: I4852b1ecc25254ffb781926ca799d0c8128339ab
2021-07-12 20:02:24 -07:00
Xiaoyu Jin
d4ce296d90 Merge "Register callback to statsD for AppSearchStorageInfo" into sc-dev 2021-07-10 01:20:18 +00:00
Xiaoyu Jin
57bd208139 Register callback to statsD for AppSearchStorageInfo
Bug: b/173532925, b/193254235
Test: statsd_testdrive 10116
      atom {
        app_search_storage_info {
          user: 0
          total_storage_size_bytes: 3929088
          document_storage_info {
            num_alive_documents: 1116
            num_deleted_documents: 4933
            num_expired_documents: 0
            document_store_size_bytes: 3637760
            document_log_size_bytes: 2928640
            key_mapper_size_bytes: 49152
            document_id_mapper_size_bytes: 49152
            score_cache_size_bytes: 122880
            filter_cache_size_bytes: 73728
            corpus_mapper_size_bytes: 20480
            corpus_score_cache_size_bytes: 4096
            namespace_id_mapper_size_bytes: 20480
            num_namespaces: 21
          }
          schema_store_storage_info {
            schema_store_size_bytes: 39424
            num_schema_types: 4
            num_total_sections: 9
            num_schema_types_sections_exhausted: 0
          }
          index_storage_info {
            index_size_bytes: 248320
            lite_index_lexicon_size_bytes: 155648
            lite_index_hit_buffer_size_bytes: 262144
            main_index_lexicon_size_bytes: 0
            main_index_storage_size_bytes: 0
            main_index_block_size_bytes: 4096
            num_blocks: 1
            min_free_fraction: 0.99999905
          }
        }
      }
      appsearch cts tests

Change-Id: I009c0932e36afb467c93013215d1e67dfae5a28a
2021-07-09 17:05:23 -07:00
Terry Wang
878a0d7c8f Merge "Add check for optimize after each mutation operation." into sc-dev 2021-07-09 22:47:24 +00:00
Terry Wang
da0e9a9b37 Add check for optimize after each mutation operation.
Optimize is an important job for AppSearch to work properly.
It could collect garbage and release resources. Without it, the garbage
resource will last forever and the device's space will be fulled up by
zombie documents.

The algorithm to trigger optimize is:
1: Query garbage resource info after a batch of mutation operations.
2: Only trigger optimize if there are enough resource could be released.

The behavior exists in AppSearch Jetpack for a while and working properly
for our Jetpack dogfooders.

Bug: 175255572
Test: FrameworkOptimizeStrategyTest
Test: AppSearchConfigTest
Test: AppSearchImplTest
Change-Id: Ib7ae475cc035d1b69969df1e22ac409895e0e3fa
2021-07-09 12:09:10 -07:00
Tej Singh
7961d27429 Cleanup appsearch platform logger
Test: TH
Bug: 192684294
Change-Id: I8e6828b9cbcbd30d06370ad19f2d36290298da25
2021-07-08 14:45:36 -07:00
Tej Singh
6f5306d6e7 Merge "Cleanup AcitivityManagerConstants and AppSearch" into sc-dev 2021-07-07 17:04:41 +00:00
Tej Singh
77b3d5db92 Cleanup AcitivityManagerConstants and AppSearch
Test: TH
Bug: 192684294
Change-Id: Iaf4d7893214297408f609ce58573846f2b6adf5e
2021-07-02 15:01:11 -07:00
Alexander Dorokhine
e55cf2579c Cache nextPageTokens that a package can use.
A user-package can only manipulate their own nextPageTokens (i.e.
advance or invalidate it) otherwise some other package could affect the
search results of a package. Because we check at the user-package level,
this still allows a package to manipulate nextPageTokens that were
returned for different databases. This isn't recommended, but not a
security risk since it's the package's own data.

Note that manipulating nextPageTokens isn't available through
AppSearch's public API. This would be if someone were circumventing the
normal AppSearchSession.

Bug: 187972715
Test: AppSearchImplTest
Change-Id: I67a22f3ae171ea2886eb89dcf493286a8421408d
2021-07-02 14:50:05 -07:00
Alexander Dorokhine
733537f1a6 Merge "Add ability to enforce limits on docs per package and size of doc." into sc-dev 2021-07-02 01:46:27 +00:00
TreeHugger Robot
e1f4e0f0eb Merge "Change the logic to check car idleness" into sc-dev 2021-07-01 22:24:34 +00:00
Alexander Dorokhine
5a26c6b39c Merge "Move libicing.so out of /usr/lib, into the appsearch apex." into sc-dev 2021-07-01 21:29:56 +00:00