2866 Commits

Author SHA1 Message Date
TreeHugger Robot
916a356f71 Merge "Exempt some callers from min-window restrictions" into sc-dev 2021-06-16 20:30:44 +00:00
Nikita Ioffe
a2d7f96154 Merge "Explicitly set generate_hashtree: false" into sc-dev 2021-06-16 10:30:35 +00:00
Terry Wang
c5d1afa418 Clear the uninstalled package data in AppSearch.
Since we cannot access locked user's data and clear it when a package
got removed. When a user is unlocking, we should prune their data and
remove all data that doesn't belong to any of installed packages.

This will also help in handling the case where device gets
rebooted before the data is cleared for an uninstalled package.

Bug: 186151459
Test: atest --rebuild-module-info CtsAppSearchHostTestCases
Change-Id: Ic6d151621a88df7806901781d3edfec65700c35d
2021-06-16 01:52:26 -07:00
Suprabh Shukla
980954b86c Exempt some callers from min-window restrictions
Callers that have power exemption should be allowed to set smaller
windows for their alarms.

Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest

Bug: 185199076
Change-Id: I5f6515a917da7f87891f79fb637d48a3d7862a1b
2021-06-15 17:50:04 -07:00
Alexander Dorokhine
66e09afd54 Switch to a non-hidden way to compute data path and switch to subdir.
We need to store other things in the appsearch data dir other than what
Icing stores, such as the storage info cache.

Bug: 177685938
Bug: 181787682
Test: Presubmit
Change-Id: I903c34a2c891d617217d44f5126d0d31c8c6bf39
2021-06-15 16:43:28 -07:00
Alexander Dorokhine
ad37babc9f Merge "Update framework from jetpack." into sc-dev 2021-06-15 23:20:43 +00:00
Jin Seok Park
6d62a4711f Check nullity of ResultReceiver
Bug: 182164496
Test: N/A
Change-Id: I96bdef1c79f8f91d33d6a6a734bc94e162a5ea33
(cherry picked from commit 2d12628ecc78fdbd5c04bf40d2110c5cc91a9e58)
2021-06-15 06:36:38 +00:00
Terry Wang
aca6fae8b2 Merge "Close AppSearchImpl in handling user removed broadcast." into sc-dev 2021-06-15 00:42:21 +00:00
TreeHugger Robot
f797f40bcc Merge "Update AlarmManager javadoc for S Beta 3" into sc-dev 2021-06-15 00:31:25 +00:00
Makoto Onuki
44fba3a53f Update AlarmManager javadoc for S Beta 3
Sample partial output: https://screenshot.googleplex.com/4wey3a3y3jsoGcP

Bug: 190625528
Test: build
Test: m offline-sdk-docs && \
  cd /android/sc-dev/out/target/common/docs/offline-sdk/ && \
  python3 -m http.server 8000 && \
  google-chrome http://localhost:8000/reference/android/app/AlarmManager.html#setExactAndAllowWhileIdle(int,%20long,%20android.app.PendingIntent)
Change-Id: Ie106b03a1c20fa62b0023f82d2c3997b4e425d95
2021-06-14 15:44:04 -07:00
TreeHugger Robot
cd140900ed Merge "Handle exact alarm permission state changes" into sc-dev 2021-06-14 21:43:49 +00:00
Nikita Ioffe
c452ed3df1 Explicitly set generate_hashtree: false
Non-updatable APEXes are going to be only present on a dm-verity
protected read-only partition. For such APEXes there is no need in
embedding a hashtree.

This is a no-op change in preparation of switching default value of
generate_hashtree to true.

Bug: 190621617
Test: m
Change-Id: I0283fb03908a87490e5e29b803553977b8b6729f
2021-06-14 22:05:39 +01:00
Sudheer Shanka
3f1e0c9d5a Merge "Propagate the temp allowlist reason to NPMS." into sc-dev 2021-06-14 17:50:08 +00:00
Suprabh Shukla
c3f067c103 Handle exact alarm permission state changes
The permission SCHEDULE_EXACT_ALARM state changes at the following
boundaries:
 1. App-op: This gets toggled by the user via Settings.
 2. Deny-list: Packages can be added to the deny list via DeviceConfig
 APIs.
 3. Package changes: A package's manifest may changes when it gets
 updated.

In both cases 1 and 2, if alarm manager detects a permission change
from revoked to granted, it sends the
ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED broadcast to the
app.
If it detects a permission change from granted to revoked, it kills
all the processes within the hosting uid.
In all three cases, when the permssion changes from granted to revoked,
all the exact alarms scheduled by the relevant package are removed.
Package updates are treated differently as they require processes to
restart anyway. The broadcast is not needed in this case as there
are no alarms expected to have been lost by a previous revocation, and
apps can always use ACTION_MY_PACKAGE_REPLACED for post-update setup as
usual.

All this only applies to packages that have the change
REQUIRE_EXACT_ALARM_PERMISSION enabled.

Also changed canScheduleExactAlarms to return false if the change is not
enabled for the calling package.

Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest
atest CtsAlarmManagerTestCases

Bug: 179541791
Bug: 187206399
Change-Id: Icd68275701f2804be65b3a10a7dd81bbf6e2a0bb
2021-06-13 16:55:21 -07:00
Alexander Dorokhine
625d330a48 Merge "Fix some incorrect annotations in AppSearch." into sc-dev 2021-06-12 22:47:17 +00:00
Anton Hansson
1ca6fa3b38 Add framework-media to sdk
This was removed in Iff38291b964de4116bcdefe4fd74136c4878c543 in favor
of using the bootclasspath fragment. However the bootclasspath fragment
for media does not contain the API tracking files, so it back for now
to make sure we can finalize the media API files.

This CL may be revertable in the future if we can get the
java_sdk_library into the bootclasspath_fragment somehow.

Bug: 190807367
Bug: 188427719
Test: m media-module-sdk and inspect the zip for api tracking files
Change-Id: Ia01c32d4c6c6bad734df053da0024a139a808a54
2021-06-11 13:16:39 +01:00
Alexander Dorokhine
c85a2775c8 Fix some incorrect annotations in AppSearch.
Bug: 180763772
Test: Builds
Change-Id: I9f5dd9af8e3f3715be58004bb70bee5c5692b721
2021-06-10 09:00:45 -07:00
Terry Wang
a3d8ce430c Close AppSearchImpl in handling user removed broadcast.
Flushing takes a few ms, it seems like a pretty good trade off compared
to keeping an icing instance in memory forever.

Bug: 179390369
Test: presubmit
Change-Id: Ic0493137dc8c33d44bd074bbd9ca4ae442049513
2021-06-09 18:51:54 -07:00
Alexander Dorokhine
7cdd56994f Update framework from jetpack.
Changes included:
* 9b55e76: Remove GeneralStats
* b467803: Upstream fixes for UserHandle and VisibilityStore.
* 47d8dca: Allow FrameworkOptimizeStrategy to be export to Framework.

Bug: 173532925
Bug: 181787682
Bug: 175255572
Test: Presubmit
Change-Id: I1aec9cb824f8ef64df98f252ed5a6338abc9e152
2021-06-09 16:35:22 -07:00
Xiaoyu Jin
e298f682ca Merge "Use AppSearchConfig in PlatformLogger" into sc-dev 2021-06-09 20:26:47 +00:00
Sudheer Shanka
724c2aa056 Propagate the temp allowlist reason to NPMS.
Bug: 189291729
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
BYPASS_INCLUSIVE_LANGUAGE_REASON=Existing public API
Change-Id: I7e26eaef4fe9d7d7b4b3a1740608e0fe821537d2
2021-06-09 18:03:57 +00:00
Xiaoyu Jin
0c5d987407 Use AppSearchConfig in PlatformLogger
bug: 173532925
Test: atest CtsAppSearchTestCases FrameworksCoreTests:android.app.appsearch
FrameworksServicesTests:AppSearchImplTest
FrameworksServicesTests:com.android.server.appsearch.stats.PlatformLoggerTest
FrameworksMockingServicesTests:com.android.server.appsearch.AppSearchConfigTest

Change-Id: I3589f0071d456e2167cd207e83acaf1d884f9992
2021-06-08 13:06:35 -07:00
Xiaoyu Jin
a1d4f99dbe Log two new fields for initializeStats
Test: it builds
bug: b/173532925

Change-Id: Ia31fc1fb54827efa140e16eb654e0ddfeeb28a07
2021-06-08 19:41:59 +00:00
Alexander Dorokhine
6756cce808 Merge "Move to non-hidden APIs for handleUser and broadcast registration." into sc-dev 2021-06-08 17:07:52 +00:00
Anton Hansson
ce6fc9a46c Add media bootclasspath fragment to its sdk
This subsumes the java_sdk_library in the sdk. Also add the service
java_sdk_library as it was missing.

Bug: 188427719
Test: build_mainline_modules.sh
Change-Id: Iff38291b964de4116bcdefe4fd74136c4878c543
2021-06-07 15:43:51 +01:00
Jeff Sharkey
feac43d47a Merge "Update OWNERS for AppSearch" 2021-06-07 13:11:45 +00:00
Alexander Dorokhine
8943b271ce Move to non-hidden APIs for handleUser and broadcast registration.
The implementation of handleIncomingUser is copied from
ag/13200660 (1d1547b).

Bug: 181787682
Test: Presubmit
Change-Id: I946199a8844e7fd6ea5574b873da56d8b8630f62
2021-06-04 09:05:00 -07:00
Sudheer Shanka
2c6a28a5ea Merge "Check only if the app is installed on the other user for blob access." into sc-dev 2021-06-03 22:31:50 +00:00
Sudheer Shanka
08ad40f2d9 Merge "Don't attribute a blob to a user if there are leasees from other users." into sc-dev 2021-06-03 22:30:22 +00:00
Cassie Wang
bf90bb447e Merge "Update VisibilityStore to handle role-based system visibility." into sc-dev 2021-06-03 22:16:06 +00:00
Alexander Dorokhine
98014567af Update VisibilityStore to handle role-based system visibility.
Bug: 187113133
Test: VisibilityStoreTest
Change-Id: Ic28110fba4a3639b087869d6b3af90e4f3f6c207
2021-06-03 11:29:05 -07:00
Xiaoyu Jin
b7d75ad788 Merge "Add AppSearchConfig in AppSearch" into sc-dev 2021-06-02 22:13:37 +00:00
Sudheer Shanka
0bfffa6b25 Don't attribute a blob to a user if there are leasees from other users.
Bug: 187460239
Test: atest --test-mapping apex/blobstore
Change-Id: I5e9c0473e4c058d430ed012a3ca3ee63f3595821
2021-06-02 00:23:09 -07:00
Sudheer Shanka
b395a4d498 Check only if the app is installed on the other user for blob access.
There isn't a need to require that the app has permission on other
user as well. With this change, we are checking the apps existence
on other users to limit access such that apps won't be able to
access any more data than they would've accessed by having
INTERACT_ACROSS_USERS permission and talking to their instances
on other users.

Bug: 175844032
Test: atest --test-mapping apex/blobstore
Change-Id: I6f13e3e7a240d55c02aecf31e10f750b9e4d5702
2021-06-01 09:42:55 -07:00
TreeHugger Robot
e952eaa29d Merge "Annotate AppSearchManager APIs with @UserHandleAware" into sc-dev 2021-05-27 21:44:08 +00:00
TreeHugger Robot
e487bd115f Merge "cmd deviceidle tempwhitelist -r should clear FGS tempallowlist too" into sc-dev 2021-05-26 22:28:50 +00:00
TreeHugger Robot
3d9400e2dc Merge "Turn off device-idle alarm history" into sc-dev 2021-05-26 21:03:42 +00:00
Suprabh Shukla
18cdcb663e Merge "Unlink listener death recipient on alarms" into sc-dev 2021-05-26 20:52:55 +00:00
TreeHugger Robot
a75009f504 Merge "Run "insane" network jobs when charging + unmetered." into sc-dev 2021-05-26 20:08:08 +00:00
Makoto Onuki
321f0bd44f cmd deviceidle tempwhitelist -r should clear FGS tempallowlist too
Also clean up FgsTempAllowList, since the key is always UID.

Bug: 188789296
Test: atest FgsTempAllowListTest
Test: Manual test with `cmd deviceidle tempwhitelist` with and without `-r`,
	while monitoring the AMS dumpsys with the following command.
	$ watch -n 1 "adb shell dumpsys activity processes | sed -n '/mFgsStartTempAllowList/,\$p'"
Change-Id: I0e113b1614653c85e57a37579921c3baa7dedc78
2021-05-26 12:13:07 -07:00
Kweku Adams
093a6dc517 Run "insane" network jobs when charging + unmetered.
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
2021-05-26 11:29:51 -07:00
Andrei-Valentin Onea
c97307a0ec Merge changes from topic "fix-module-visibility" into sc-dev
* changes:
  Fix media-s-sources visibility
  Remove services-all-sources
2021-05-26 14:28:09 +00:00
Suprabh Shukla
563c4b5739 Turn off device-idle alarm history
Test: adb shell dumpsys alarm
Should not show a section labelled "Allow while idle dispatches".

Fixes: 178484639
Change-Id: Idab67a7a3a78b89e80f60e24f3b0a6e3a0bcb68a
2021-05-25 22:27:10 -07:00
Suprabh Shukla
b4da4f362d Unlink listener death recipient on alarms
Stopped using BinderDeathDispatcher as deduping is no longer required.
If an app sets the same listener, it is first removed internally which
will result in a call to unlink before the subsequent call to set.

Test: Manually using a test app that cancels and sets an alarm with a
new listener instance in a loop.
atest CtsAlarmManagerTestCases:BasicApiTests

Bug: 189091551
Change-Id: I390d9bba37a4040b7e789e0ae04f9980fbed5c12
2021-05-25 20:53:46 -07:00
Xiaoyu Jin
951f75637f Add AppSearchConfig in AppSearch
It manages the P/H flags from DeviceConfig.

bug: 173532925
Test: atest FrameworksMockingServicesTests:AppSearchConfigManagerTest

Change-Id: I668ecd8190bbe7a21ab3a23b52d08f4dce400491
2021-05-26 01:08:50 +00:00
Andrei Onea
29a61984c8 Fix media-s-sources visibility
Prevent sources from being leaked elsewhere.

Test: m
Bug: 177640454
Change-Id: I5ff9e8542746b912b618af5b7756d975cdad13ea
2021-05-25 14:41:10 +00:00
Terry Wang
08c51052a5 Annotate AppSearchManager APIs with @UserHandleAware
This helps readers understand that the AppSearch APIs can operate
across users.

Bug: 179822197
Test: presubmit
Change-Id: I0be942f16d0211ea1ea68d72ac82c254b9dd6d02
2021-05-24 14:47:26 -07:00
Frank Li
327678ebd6 Merge "Improve the net-capabilities scheme for backward compatibility" 2021-05-21 01:28:35 +00:00
Alexander Dorokhine
0f7f36d29a Update framework from jetpack.
Included changes:
* d953a83b: Minor Migration update to apply API Review feedback
* b5b73db0: Expand Javadoc around Tokenization
* 45ac5ac2: Make GenericDocument.Builder reusable.
* 6d55d6d6: Logging stats for remove (2)

Bug: 187419874
Bug: 184174886
Bug: 184575874
Bug: 173532925
Test: Presubmit
Change-Id: Id6509e939e9038e5ec56bde610e4af902888b9d6
2021-05-20 14:24:50 -07:00
Alexander Dorokhine
c9233287e7 Stop depending on internal Preconditions.java from service-appsearch.
Bug: 181787682
Test: Presubmit
Change-Id: I2698daafca553ee2463e6f7dd1badda272287ba3
2021-05-20 13:45:05 -07:00