Commit Graph

6559 Commits

Author SHA1 Message Date
Daniel Cashman
629a5f9705 Add ROLLBACK past signing cert capability.
Add a new capability that may be granted to past signing certificates
after changing to a new signing certificate that will allow applications
to go back to a previous signing certificate.  This capability is
intended to not be granted, but may be added later in the event that
a signing certificate change caused undesirable behavior.

Bug: 73927694
Test: PkgInstallSignatureVerificationTest
Change-Id: I7453a2da00e740a55de45e7b144f308a9bc33772
(cherry picked from commit a1d0cf74f9)
2018-04-02 20:12:14 +00:00
TreeHugger Robot
a6d6a5aa79 Merge "Adding LauncherApps apis for suspended packages" into pi-dev 2018-03-31 00:39:52 +00:00
Suprabh Shukla
19b41f34a5 Adding LauncherApps apis for suspended packages
The suspending app can provide a Bundle of information to be used by the
launcher for handling suspended packages. Added APIs:
 - getSuspendedPackageLauncherExtras(String, UserHandle): To retrieve
 the launcher extras for the given package and user.
 - Callback#onPackagesSuspended(String[], UserHandle, Bundle): A
 callback that will be invoked with the package names and the launcher
 extras whenever sent packages are suspended.

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

Bug: 76119578
Change-Id: I505d134809639a57c3314f994af34d576d905e74
2018-03-30 21:21:41 +00:00
Makoto Onuki
75ad2496eb AppStandby exemption: sync requested by FG apps
Bug: 72443754
Fix: 72443754

Test: atest ${ANDROID_BUILD_TOP}/frameworks/base/services/tests/servicestests/src/com/android/server/content/SyncOperationTest.java
Test: Manual test with contacts sync:

Precondition: Put the contacts sync in RARE bucket.

adb shell dumpsys deviceidle tempwhitelist -r com.google.android.syncadapters.contacts
adb shell am make-uid-idle com.google.android.syncadapters.contacts
adb shell am set-standby-bucket com.google.android.syncadapters.contacts 40

Test 1: Toggle contacts sync from the Settings -> Account

- Make sure a sync happens.

Test 2: Mutate a contact on the WEB

- Sync is scheduled, but won't run because it has no network access.
- am set-standby-bucket com.google.android.syncadapters.contacts 30
- Sync run runs.

Test 3. adb shell requestsync -n ACCOUNT -t com.google -a com.android.contacts

- Sync is scheduled but won't run.

Test 4. adb shell requestsync -n ACCOUNT -t com.google -a com.android.contacts -f

- Sync is scheduled but it still won't run.

Test 5. adb shell requestsync -n ACCOUNT -t com.google -a com.android.contacts -F

- Sync now runs

Change-Id: I1eb972ed321d2a1a782ae23ccb806671926d3e6b
2018-03-29 14:53:02 -07:00
Joshua Baxter
9a2d959eff Merge "docs: fixed a couple of typos" into oc-mr1-dev
am: 651ffd426c

Change-Id: Ie6fb97aae76637023657d751f6ad0ebbc74ff284
2018-03-28 22:06:24 +00:00
TreeHugger Robot
dedfd8fec7 Merge "Convert compilation reason and filter to int-enum before logging" into pi-dev 2018-03-28 20:35:37 +00:00
Jiuyu Sun
b1adae546c Merge "Add grant and revoke default permissions to active LUI app." into pi-dev 2018-03-28 17:44:35 +00:00
TreeHugger Robot
1c73370df4 Merge "Sending MY_PACKAGE_SUSPENDED to suspended apps" into pi-dev 2018-03-28 00:45:23 +00:00
Joshua Baxter
9a841a6519 docs: fixed a couple of typos
Test: make ds-docs

Bug: 36948822
Bug: 36946883

Change-Id: I4de699dc7d5a69e456b0656de890f76b9787aafa
2018-03-27 21:44:55 +00:00
Calin Juravle
a86783b87d Convert compilation reason and filter to int-enum before logging
Test: adb logcat -b events | grep sysui_multi_action
Bug: 73102540
Change-Id: I052df3d4e65ef16b43190c14a236421945c86e21
(cherry picked from commit c7a44be7b3)
2018-03-27 20:28:11 +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
Holly Jiuyu Sun
349e214dc2 Add grant and revoke default permissions to active LUI app.
Grant the camera permission to the active LUI app since LUI uses QR scanner
to download profile.
Before it, revoke the previously granted permissions first.

Bug: 35068517
Test: test on phone
Change-Id: I2db9597eed423835b9499ef6000579b5ee5b2cb6
2018-03-26 20:19:58 -07: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