Commit Graph

6549 Commits

Author SHA1 Message Date
TreeHugger Robot
1c73370df4 Merge "Sending MY_PACKAGE_SUSPENDED to suspended apps" into pi-dev 2018-03-28 00:45:23 +00:00
TreeHugger Robot
c6d9f7ce1d Merge "More flexible API enforcement policy." into pi-dev 2018-03-27 10:34:38 +00:00
Mathew Inwood
e3299533b5 More flexible API enforcement policy.
This CL adds the basics to set black, dark gray or light gray list
enforcement, rather than just black as before. It's not possible to
actually set the policy per-package yet.

PackageDexOptimizer still uses a single bit, for API checks on/off, rather
than the new enum. It assumes blacklist enforcement internally. This can
be improved in a follow up CL.

(cherry-picked from commit e52130ae4c)

Test: m
Test: Boot device

BUG: 73337509
Change-Id: Ieb4bd9cc439c6a5b8fb9424d8902d8b46aec309f
Merged-In: Idd73c9938592c5c4d67cfb9efefdffed0dd5f262
2018-03-27 09:28:33 +01:00
Suprabh Shukla
2fd43ba63e Sending MY_PACKAGE_SUSPENDED to suspended apps
Added new broadcast actions MY_PACKAGE_SUSPENDED and
MY_PACKAGE_UNSUSPENDED, which are sent to the package that is affected
by the suspend state change. A suspended package also receives a bundle
of app extras to pass more information. This makes it easier for
packages to deal with being suspended/unsuspended.

Also updated some existing documentation to make it clearer.

Test: atest com.android.server.pm.SuspendPackagesTest

Bug: 75036698
Change-Id: I772cf0c023669bc946e07ced4ebccfa74f6835b2
2018-03-26 18:01:13 -07:00
TreeHugger Robot
9360a31f5f Merge "Make PackageManager#getNamesForUids testable." into pi-dev 2018-03-26 22:36:45 +00:00
Chris Craik
d52c532df7 Merge "Remove incorrect @NonNull annotations on getDrawable() and variants." into pi-dev 2018-03-26 20:21:04 +00:00
Philip P. Moltmann
abeb04ed55 Make PackageManager#getNamesForUids testable.
Fixes: 76161011
Test: atest android.content.pm.cts.PackageManagerTest
Change-Id: I857d489ec9981839d63a5b934b4aaa0d2709be85
2018-03-26 10:22:10 -07:00
Benjamin Franz
3ff20e2257 Merge "Expose hidden API to check whether a given package is state protected" into pi-dev 2018-03-26 09:15:41 +00:00
Nathan Harold
775e291c2e Merge changes from topic "data-service-grant-policy" into pi-dev
* changes:
  Add Permissions Grant for TelephonyDataService
  Add a Method to Revoke DefaultGrant Permissions
2018-03-24 05:00:42 +00:00
Chris Craik
1194b0bdfe Remove incorrect @NonNull annotations on getDrawable() and variants.
For compatibility, had to continue returning null when drawables could
not be decoded. Fix annotation to match pre-P behavior (the behavior
was reverted separately).

Fixes: 69543526
Test: make

Partial revert of Ib01eca970c5c9969998ce5b265b120aa7048b41a

Change-Id: I5f612f47793c3f04cf9874e13efdc13397ddd4e8
2018-03-23 13:38:01 -07:00
Nathan Harold
76ad1a3c21 Add Permissions Grant for TelephonyDataService
The Telephony Data Service is a privileged service
that provides Data capabilities *to* Telephony. A
data service that provides IWLAN may also use WiFi
as an underlying connection that tunnels Telephony
data services over WiFi using IPsec. The carrier-
config-driven permissions model causes the
framework to bind to an appropriate Telephony Data
Service, for a given carrier, and that Data Service
is responsible for providing Cellular data. Thus,
The TelephonyDataService needs sufficient
permissions to access cellular info necessary for
performing signalling for IWLAN. This includes
Phone state information and location information
such as the current Wifi access points and the
current cell towers. In addition, a Telephony
Data Service may require access to IPsec if the
data service uses the Android API to establish
IPsec, which is optional today.

Bug: 66955045
Test: wip
Merged-In: Ibe4f7806a47e2a50999376ff0a5a07dc5b332953
Change-Id: Ibe4f7806a47e2a50999376ff0a5a07dc5b332953
2018-03-22 15:25:31 -07:00
TreeHugger Robot
6affc07065 Merge "APIs to suspend packages with SUSPEND_APPS permission" into pi-dev 2018-03-22 22:15:31 +00:00
Suprabh Shukla
021b57ab8d APIs to suspend packages with SUSPEND_APPS permission
Changed the existing hidden api setPackagesSuspendedAsUser to a system
api setPackagesSuspended that can be called by apps with either
MANAGE_USERS or SUSPEND_APPS permission. Additionally, the suspending
app can now specify optional extra information meant to be used by the
suspended apps and the launcher to deal with this state.

The following other APIs are added:
 - isPackageSuspended(): Apps can query whether they are in a suspended
 state
 - @SystemApi getPackageSuspendedAppExtras(String): Apps with permission
 SUSPEND_APPS can get the appExtras passed to PM when suspending the
 app.
 - @SystemApi setPackageSuspendedAppExtras(String, PersistableBundle):
 Apps with permission SUSPEND_APPS can update app extras for a
 suspended package.
 - getPackageSuspendedAppExtras(): Apps can call to get the appExtras
 passed in to PM when they were suspended.

Test: Can be run via:
atest com.android.server.pm.PackageManagerSettingsTests
atest com.android.server.pm.PackageUserStateTest
atest com.android.server.pm.SuspendPackagesTest

Bug: 74336673
Change-Id: I3b9ed2c8478b34ee2e8986f5f5fddb2839d102e3
2018-03-22 12:59:57 -07:00
Benjamin Franz
7cc9a817d4 Expose hidden API to check whether a given package is state protected
Bug: 75997475
Test: manual
Change-Id: I5e0da781af6d148aed2247175e8ee5d9f244ebe1
2018-03-22 18:10:06 +00:00
Liefu Liu
5c0d7b3a7f Updated the javadoc of ContentResolver.addPeriodicSync to correct the minimum interval of periodic sync.
Bug: 76033438
Change-Id: I1ccb7ae174f8f13dae24296a3fb7e9dfcd77c7fa
Fixes: 76033438
Test: javadoc only. presubmit only.
2018-03-21 21:28:43 +00:00
Philip P. Moltmann
18e3eb8168 Add SoundTriggerDetectionService
The service is meant to replace the PendingIntent based API. Once all
users of the PendingIntent based API switched the PendingIntent based API
will be removed.

To have as little as possible impact on the whole SoundTrigger framework
the RemoteSoundTriggerDetectionService class implements the same
interface as the PendingIntent based class. Hence the exising code has
very little change. Further once the old code can be removed the amount
of changed (and added) code is limited.

The RemoteSoundTriggerDetectionService -> SoundTriggerDetectionService
is a vanilla as possible service implementation. The special behaviors
are:
- The system holds a wakelock while service operations are in progress
and the service is bound as foreground. Hence the service can e.g.
listen to the microphone.
- Service operations have a certain amount of time they are allowed to
run. Once every operation is either finished or the the operation
exceeded the allotted time, the system calls onStopOperation for each
still pending operation. This is a similar model as for the commonly
used JobService.
  Please note that if the time allowed for an operation is 15s and
op1 was run as 0si, and op1 was run at 5s, the service is allowed to run
until 20s. Hence _both_ onStopOperations will happen at 20s. This is
done for ease of implementation but should not give the service more
power than calling onStopOperation exactly 15s after each operation is
triggered.
- If an operation is done before the allotted time is reached, the
service can declare the operation as finished manually by calling
onOperationFinished. This is a call back into the system, hence a
'client' binder is sent to the service. If the operation is finished
by calling this method onStopOperation will not be called.
- As the service instance might be killed and restored between
operations we add a opaque bundle 'params' to each operations. The users
of the API can use this to send data from the start command to the
operations. It can also just be set to null. The params are not meant to
store changing state in between operations. Such state needs to be
persisted using the regular methods (e.g. write it to disk)
- A service can be used for multiple recognition sessions. Each
recognition is uniquelity defined by its sound model UUID. Hence each
operation gets at least tree arguments: Operation ID, sound mode UUID, params
- As a small optimization the params are cached inside of the service
instance.

The time allowed for each operation is in a @SystemAPI global setting,
so the service can make sure it finishes the operations before they are
stopped. It might take some time to deliver the operations via the
binder, hence it is not recommended to try to use every last ms of
allotted time.

Test: atest SoundTriggerDetectionServiceTest (added in separate CL)
      atest android.provider.SettingsBackupTest
Change-Id: I47f813b7a5138a6f24732197813a605d29f85a93
Fixes: 73829108
2018-03-20 13:57:14 -07:00
Sunny Goyal
dbb0a49f00 Merge "Updating java doc for requestPinAppWidget" into pi-dev 2018-03-20 02:07:48 +00:00
Makoto Onuki
6b71daa0c2 Merge "Fix SyncResutl.delayUntil javadoc" into pi-dev 2018-03-19 15:12:36 +00:00
Sunny Goyal
e7712ad4dd Updating java doc for requestPinAppWidget
Bug: 74435565
Test: N/A
Change-Id: Iae290e411929c817721f481301f8fb057ebe7b2c
2018-03-17 21:24:35 +00:00
Philip P. Moltmann
186e3b31fc onUnsyncableAccount: Better docs, main thread
Describe that AbstractThreadedSyncAdapter.onUnsyncableAccount should return
immediately and call it on main thread.

Test: atest android.content.cts.AccountAccessSameCertTest
            android.content.cts.DeferSyncTest
            android.content.cts.ContentResolverSyncTestCase
	    com.android.cts.content.CtsSyncAccountAccessOtherCertTestCases
Fixes: 73750859
Change-Id: Ie9e1aefafe3a4a1b3f0fe8a65803554f07a94c42
2018-03-15 16:59:50 -07:00
Makoto Onuki
acfb417cdc Fix SyncResutl.delayUntil javadoc
Fix: 17912666
Bug: 66950061
Test: presubmit
Change-Id: I47b3a9fd087e7d7519eb1bc4a6182929a75d873b
2018-03-15 11:31:55 -07:00
Michal Karpinski
d766e212c9 Merge "Allow restoring of apps that rotated key" into pi-dev 2018-03-15 10:13:34 +00:00
TreeHugger Robot
75a3173245 Merge "Fix cleartext default for the manifest value" into pi-dev 2018-03-15 02:50:20 +00:00
TreeHugger Robot
265b11ffb2 Merge "Also apply prefix when dumping isAllowedToUseHiddenApi" into pi-dev 2018-03-15 00:37:37 +00:00
Yohei Yukawa
f3ca7a73dc Also apply prefix when dumping isAllowedToUseHiddenApi
This is a follow up CL to a CL [1] that added one more state dump from
ApplicationInfo regarding whether the app is exampted from the API
restriction but forgot to take care of prefix handling.

 [1]: I01e837253d00c6ffa841a9e5c226204a3e11b827
      974290b032

Bug: 64382372
Test: Ran the following command to see "isAllowedToUseHiddenApi"
      is aligned with other outputs from ApplicationInfo.
         adb shell ime list -a
Change-Id: I9c77d9b557245b7f3b51631140bd564feef601ce
2018-03-14 13:43:47 -07:00
Todd Kennedy
662504f941 Enable local search for instant apps
When getting the set of searchable activities, fetch instant
applications. But, this means that the set needs a final
filter to prevent leaking application existence.

Change-Id: I6b9daf031ce54061c4500d9edae1d738848158c4
Fixes: 68211791
Test: atest -it CtsAppSecurityHostTestCases:EphemeralTest#testGetSearchableInfo
(cherry picked from commit 8b9d664cae)
2018-03-14 20:31:11 +00:00
TreeHugger Robot
5741823729 Merge "Removed redundant method ContentResolver.releasePersistableUriPermission()" into pi-dev 2018-03-14 18:42:38 +00:00
Chad Brubaker
0d285d5117 Fix cleartext default for the manifest value
If no network security config is set the default value of
cleartextTrafficPermitted comes from the legacy
android:cleartextTrafficPermitted, default this to false for apps
targeting P to track the network security config behavior as was
intended.

Bug: 74587672
Test: atest CtsNetSecPolicyUsesCleartextTrafficUnspecifiedTestCases
Change-Id: I6367723befa1b947063554c9c061bdfc5be3d116
2018-03-14 09:45:52 -07:00
Michal Karpinski
528c3e572a Allow restoring of apps that rotated key
Restoring of apps that rotated key wouldn't be possible due to
explicit signature matching.
Amend signature matching strategies to take into account
apps that have rotated key.

Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/backup/utils/AppBackupUtilsTest.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/backup/BackupUtilsTest.java
Test: m -j RunFrameworksServicesRoboTests
Test: runtest -p com.android.server.backup frameworks-services
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest1.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest2.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest3.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest4.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest5.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest6.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest7.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest8.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest9.java
Test: atest frameworks/base/services/tests/servicestests/src/
      com/android/server/pm/ShortcutManagerTest10.java
Test: atest CtsShortcutManagerTestCases
Bug: 64686581
Bug: 34345052
Bug: 74208476
Bug: 74159113

Change-Id: Ica23bbfec89648d9348c65db4597188e8c18e1d8
2018-03-14 16:11:18 +00:00
Fyodor Kupolov
70e7543066 Added ACTION_BATTERY_LEVEL_CHANGED
Sent when the current battery level changes.

It has EXTRA_EVENTS that carries a list of Bundle instances representing
individual battery level changes with associated extras from
ACTION_BATTERY_CHANGED

Each event has EXTRA_EVENT_TIMESTAMP representing time when it occured.

Test: manual
Bug: 74020080
Change-Id: I993005950299c5298c9111ca51cc7717e1f029de
2018-03-08 10:09:01 -08:00
Jeff Vander Stoep
cab3639dcb Revert "Revert "pm: SharedUserId: Assign seinfo using actual targetSdkVersion""
Commit 042f4bb6 'pm: Modify getPackage() to only return non-null
packages' prevents the NullPointerException. b/
This reverts commit 00b4fa8b13.

Bug: 74214574
Bug: 72290969
Test: Same tests run on original commit.
Test: successfully flash and boot from bild 4504078 to ToT master.
Change-Id: Ia1e900ebe0eb8f9d10fd0eddbf658f52e1ea79b4
(cherry picked from commit 32ef1c2eb0)
2018-03-07 18:49:12 +00:00
Jeffrey Vander Stoep
85d1b5c414 Revert "pm: SharedUserId: Assign seinfo using actual targetSdkVersion"
This reverts commit 8196fd9380.

Reason for revert: b/74214574

Bug: 74214574
Change-Id: I9602872238ccc8a49d8b200e5389995d597f1c3a
(cherry picked from commit 00b4fa8b13)
2018-03-06 15:12:15 +00:00
TreeHugger Robot
3fbc54e609 Merge "Don't whitelist all system image apps." into pi-dev 2018-03-06 11:50:23 +00:00
Mathew Inwood
6827f4a2c8 Don't whitelist all system image apps.
Also include in system dump which packages are exempt from the api
restrictions.

This is a cherry-pick of 974290b032
from master.

Test: Verified that the device boots.
Bug: 64382372
Change-Id: Iaeca91478f53c8b4e9608246aab42bdb90f899bb
2018-03-06 09:54:55 +00:00
Felipe Leme
bb01e5e538 Removed redundant method ContentResolver.releasePersistableUriPermission()
Bug: 72055774

Test: manual verification
Test: atest CtsAppSecurityHostTestCases:ScopedDirectoryAccessTest#testResetGranted

Change-Id: Iab6dde04b0dc43f97e1a66f665cf5f6f3e078381
2018-03-05 14:09:46 -08:00
Amith Yamasani
14c716c911 Revert "Allow restoring of apps that rotated key"
This reverts commit 313d225cd1.

Reason for revert: b/74159113

Change-Id: I483ecdd80d26fca8451cd270b4fcbe34379839cb
2018-03-05 20:40:23 +00:00
Adam Lesinski
40a32d9ff0 Merge "Refactor AssetManager" 2018-03-02 22:05:45 +00:00
TreeHugger Robot
15881d7c0c Merge "pm: SharedUserId: Assign seinfo using actual targetSdkVersion" 2018-03-02 21:56:30 +00:00
TreeHugger Robot
fddc22678c Merge "Copy PermissionChecker from support lib and use in RcognitionService" 2018-03-02 20:01:33 +00:00
TreeHugger Robot
6f5ed04ab7 Merge "Addresses API feedback for Intent Discovery change" 2018-03-02 15:52:32 +00:00
Jeff Sharkey
341c2366cc Merge "Force loading of safe labels in system_server." 2018-03-01 18:04:16 +00:00
Patrick Baumann
3abf547d1f Addresses API feedback for Intent Discovery change
* Clarifies purpose and effects of resolver methods
* Adds javadocs to non-obvious constructors and constants

Test: none - no functional changes
Bug: 73950163
Change-Id: Id668b890a8c97da74502698f71b16cc213eda6c6
2018-03-01 10:03:05 -08:00
TreeHugger Robot
15c3e602e9 Merge "Removed AMS.updatePersistableUriPermission()" 2018-03-01 17:30:33 +00:00
Adam Lesinski
bebfcc46a2 Refactor AssetManager
Bug: 64071469
Test: atest CtsContentTestCases
Change-Id: Ia6856157e8813856268fba003e1e591d690cb26e
2018-02-28 19:06:48 -08:00
TreeHugger Robot
50db5a45ac Merge "Make activity-alias inherit "enableVrMode" attribute from target activity." 2018-03-01 02:59:49 +00:00
Jeff Vander Stoep
8196fd9380 pm: SharedUserId: Assign seinfo using actual targetSdkVersion
Assign the targetSdkVersion component of SeInfo using the lowest
targetSdkVersion of all apps within a SharedUserId.

Bug: 72290969
Test: cts-tradefed run cts -m CtsAppSecurityHostTestCases
Test: cts-tradefed run cts -m CtsSelinuxTargetSdk{current,25,27}TestCases
Test: install sharedUserId app with targetSdkVersion=28, then install
    app with targetSdkVersion=26. Verify that they share the same domain
    and data is correctly labeled.
Change-Id: I9476d10bf3c6a769d63a45a4314aaa91203880b8
2018-02-28 16:59:34 -08:00
Joe Maples
6997ad6926 Merge "pm: Fix typo in error" am: a12e18bcd1 am: a79fef132b
am: 1ec4c3b3b1

Change-Id: I9d1b48c0852bc75108ab72cd4c58c08a43b62a8b
2018-03-01 00:09:25 +00:00
Joe Maples
1ec4c3b3b1 Merge "pm: Fix typo in error" am: a12e18bcd1
am: a79fef132b

Change-Id: I45fa701a8f9e727e1a072f4f6dd773bba0de01aa
2018-03-01 00:00:13 +00:00
TreeHugger Robot
19130fea91 Merge "More work on issue #73301635: Ability to extract device configuration" 2018-02-28 23:19:13 +00:00
Felipe Leme
988234a343 Removed AMS.updatePersistableUriPermission()
Bug: 72055774

Test: manual verification
Test: atest CtsAppSecurityHostTestCases:ScopedDirectoryAccessTest#testResetDoNotAskAgain,testResetGranted
Test: atest CtsAppSecurityHostTestCases:ScopedDirectoryAccessTest

Change-Id: I90cd9a79a1caa19989e00dbc1a656469bc3221f9
2018-02-28 15:15:37 -08:00