2762 Commits

Author SHA1 Message Date
Cassie Wang
f98a5efba1 Merge "Prevent instant apps from using AppSearch." into sc-dev 2021-06-24 02:36:40 +00:00
Cassie Wang
8417a0f253 Prevent instant apps from using AppSearch.
Bug: 181875256
Test: atest -m -c --rebuild-module-info CtsAppSearchHostTestCases
CtsAppSearchTestCases FrameworksCoreTests:android.app.appsearch
FrameworksServicesTests:com.android.server.appsearch

Change-Id: I50fa222f51a9d10395bd6b5815580170561d96d0
2021-06-23 14:15:27 -07:00
Alexander Dorokhine
9a8625df25 Sync framework from jetpack.
Changes included:
* 131d852: Remove usages of hidden APIs in the CTS tests.
* c984c24: Change AppSearchSchema and PropertyConfig #toString()

Bug: 146218515
Bug: 179680545
Test: Presubmit
Change-Id: Ibcef982cfea95ede2ae8e6075a052a83b44298c4
2021-06-23 13:14:01 -07:00
Alexander Dorokhine
4e229f4471 Merge "Update framework from jetpack." into sc-dev 2021-06-23 17:12:36 +00:00
TreeHugger Robot
41e40c69f2 Merge "Tighten up Doze alarm timing." into sc-dev 2021-06-22 22:53:03 +00:00
Alexander Dorokhine
bb978dfe38 Update framework from jetpack.
Changes included:
* 79f2ffe: Fixes required for export.
* e1ca63a: Implement empty schema shouldn't have a version number.
* 8b76be4: Refactor VisibilityStore from a no-op implementation into an interface.
* 47ba533: Remove the max repeatable length limit for GenericDocument
* 52ca287: Add GetSchemaResponse cts test.
* 56585f5: Change PutDocumentsRequestTest to be a cts test.

Bug: 183050495
Bug: 180058203
Bug: 191592792
Bug: 189161227
Bug: 183239766
Test: Presubmit
Change-Id: I30f51a18d697d3a5e43d2c63549ab19a36bbe99e
2021-06-22 12:32:15 -07:00
Alexander Dorokhine
27b63bb150 Merge "Update framework from jetpack." into sc-dev 2021-06-22 17:30:26 +00:00
Suprabh Shukla
a7807022fe canScheduleExactAlarms returns true for older apps
Callers that don't target S can schedule exact alarms so should get a
return value of true when they call canScheduleExactAlarm.

Test: atest FrameworksMockingServicesTests:AlarmManagerServiceTest

Bug: 191328951
Change-Id: I1cd1d0fb3d3d922360494552e653ed540bfe5227
2021-06-21 18:09:35 -07:00
Kweku Adams
aa8f6da7d4 Merge "Allow bucket elevation for timed-out restricted apps." into sc-dev 2021-06-21 20:20:17 +00:00
Alexander Dorokhine
f9d86a4aeb Update framework from jetpack.
Included changes:
* a8c984: Add more tests for logging
* 501a51: Remove some deprecated TODOs.
* 639f25: Add SchemaMigrationStats.
* 0b8885: Use consistent terminology for 3p and system access.
* 064c36: Add a CTS test for snippeting window sizes and max match counts.

Bug: 173532925
Bug: 187879464
Bug: 180058203
Test: Presubmit
Change-Id: I878fd6c7a42cccb237898392aac8c615830eb564
2021-06-18 14:28:34 -07:00
Alexander Dorokhine
9b26c3c9be Guard system usage reporting by checking the caller has system access.
Adding this check in a testable way requires refactoring VisibilityStore
to pull it out of management by the AppSearchImpl object. It is now
initialized as a sibling of AppSearchImpl, managed by
AppSearchUserInstanceManager.

This has several benefits:
* Breaks the complicated initialization inter-dependency between
  AppSearchImpl and VisibilityStore
* Reduces duplicative singleton managers
* Allows AppSearchImpl to be tested more easily by accepting a
  "hasSystemSurfaceable" boolean that can be set in tests
* Reduces the number of times we have to call into VisStore; we can
  determine whether the caller has system access in advance instead of
  repeating the check for every schema type

Bug: 180058203
Bug: 183031844
Test: GlobalSearchSessionCtsTest#testReportSystemUsage_ForbiddenFromNonSystem
Test: GlobalSearchSessionPlatformCtsTest#testReportSystemUsage
Test: VisibilityStoreTest

Change-Id: I84c84819f287628ccf8af369f5481a8e90255f62
2021-06-18 10:48:58 -07:00
Terry Wang
5c86c0c10e Merge "Clear the uninstalled package data in AppSearch." into sc-dev 2021-06-18 06:59:18 +00:00
Frank Li
2fcda2f9f4 Improve the net-capabilities scheme for backward compatibility
- Create a new XML tag for the new format. The new format should
  persist the arrays of values without assuming they necessarily
  have different bits.

- Upon reading, if the new tag is present, use that. If the new
  tag is not present but the old tag is present, then limit the
  contents to the capabilities/transports that existed in R.

- Catch all exceptions and ignore the requests if they can't be
  re-read from disk. This is a measure to avoid any mistake where
  the device couldn't boot when JS tries to restore state.

Bug: 183071974
Test: atest JobStoreTest
Original-Change: https://android-review.googlesource.com/1679762
Merged-In: I56cde50d2adab81134c8be4f6996d68018f4212a
Change-Id: I56cde50d2adab81134c8be4f6996d68018f4212a
2021-06-17 13:44:17 +00:00
Kweku Adams
bcea3814fd Tighten up Doze alarm timing.
Set explicit alarm window sizes so we can control the maximum alarm
delay for Doze alarms.

Bug: 187947479
Bug: 188468510
Test: atest DeviceIdleTest
Test: atest FrameworksMockingServicesTests:DeviceIdleControllerTest
Change-Id: I40c0e1a0fce18886ea817245d9a064a509eb6e08
2021-06-16 16:54:18 -07:00
Kweku Adams
183ec609e8 Allow bucket elevation for timed-out restricted apps.
Ensure SYSTEM_INTERACTION can bring an app out of the RESTRICTED bucket
(temporarily) if the app is only in the bucket due to timeout.

Bug: 191297958
Test: atest AppStandbyControllerTests
Change-Id: Ie76d224710228a8654d4d57ee0c73bb9441ef28f
2021-06-16 15:39:20 -07:00
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
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