Commit Graph

6651 Commits

Author SHA1 Message Date
Suprabh Shukla
040bf34479 Merge "setPackagesSuspended now overwrites all the state" into pi-dev am: e901d69ea6
am: f283b41a63

Change-Id: I39ec00edf07095ae63d28dfd2fb69cd6a11f89c9
2018-04-10 13:46:14 -07:00
TreeHugger Robot
e901d69ea6 Merge "setPackagesSuspended now overwrites all the state" into pi-dev 2018-04-10 20:15:24 +00:00
Dan Sandler
28bad11b8d Merge "Fix javadoc xrefs." into pi-dev am: 64c8e13b2a
am: 73615ba5d1

Change-Id: I5ade8bee9b767497872066a9fcccce2eba01f93e
2018-04-10 09:22:38 -07:00
TreeHugger Robot
64c8e13b2a Merge "Fix javadoc xrefs." into pi-dev 2018-04-10 15:56:28 +00:00
Mathew Inwood
8e913755d5 Merge "Different hidden API enforcement policy for P & pre-P." into pi-dev am: 9139bbfa9b
am: 9c5d1784b9

Change-Id: I13ee422263c141cf3c18b46da59acf26d24e6042
2018-04-10 06:33:23 -07:00
Mathew Inwood
1ab3025cc7 Different hidden API enforcement policy for P & pre-P.
Also make these configurable so we have the flexibility to change it if
necessary.

Setting the policy inside ActivityManagerService is not ideal, as that
means that AMS is the only place where the policy in ApplicationInfo is
correct. It should really be set inside PackageManagerService. However,
if it's set there, it would get out of date when the settings change, and
we'd have to update inside AMS anyway. So putting it only here seems ok
for now.

Test: $ adb shell settings put global hidden_api_policy_pre_p_apps 2
Test: $ adb shell settings put global hidden_api_policy_p_apps 2
Bug: 64382372
Change-Id: Ic4cbbb1e6464623e90c17ae08c0b6cbbe0dfa125
2018-04-10 10:13:07 +01:00
Patrick Baumann
37b676aa32 Merge "Check permissions only against packagesettings" into pi-dev am: 3f345a99f7
am: b13f71a16c

Change-Id: I3d8e92ddca70f93160af55627c95c15793dad28c
2018-04-09 20:46:35 -07:00
TreeHugger Robot
3f345a99f7 Merge "Check permissions only against packagesettings" into pi-dev 2018-04-10 01:38:48 +00:00
Suprabh Shukla
45b9e40a4f setPackagesSuspended now overwrites all the state
Earlier setPackagesSuspended ignored the rest of the paramters when
suspend state did not change. This was a problem because then there was
no good way to update the other parameters without unsuspending the app,
which is not desirable.
Removed setSuspendedPackageAppExtras as now they can be update with this
api.
Also sending broadcasts when packages get unsuspended due to suspending
package removed.

Test: Existing tests pass:
atest com.android.server.pm.PackageUserStateTest
atest com.android.server.pm.SuspendPackagesTest
atest com.android.server.pm.PackageManagerSettingsTests

Bug: 77522553
Change-Id: I72a3c228d3d65c430e242da97b2bc6997ec6a135
2018-04-09 17:49:54 -07:00
Daniel Cashman
c7ff90679f Merge "Clarify PackageManager.hasSigningCertificate docs." into pi-dev am: a5bdeabf15
am: 9b1bd200b2

Change-Id: I08166aa315459aa4228588f392f80963bbc059e8
2018-04-09 17:08:30 -07:00
TreeHugger Robot
a5bdeabf15 Merge "Clarify PackageManager.hasSigningCertificate docs." into pi-dev 2018-04-09 22:56:23 +00:00
Patrick Baumann
b00eb64591 Check permissions only against packagesettings
Prior to this change there was a chance that an updating app would not
exist in mPackages and cause a permission check for that app to fail.
This change moves all permission checks to use mSettings and the cached
package it contains to do the checks.

Change-Id: I0717bddbb08b1d0dbab3ea79fa0d2067aa858753
Fixes: 76228188
Test: Manual - system starts, permission checks work before / after update
2018-04-09 13:31:39 -07:00
Jeff Sharkey
b033508085 Merge "ContentResolver should handle dead system_server." into pi-dev am: b35baa53f7
am: 04a3a098df

Change-Id: I5b6c0a5fbd61b0f1565b717d564ceb3c73b70024
2018-04-09 12:52:55 -07:00
Jeff Sharkey
b35baa53f7 Merge "ContentResolver should handle dead system_server." into pi-dev 2018-04-09 19:07:43 +00:00
Daniel Cashman
bd8ce384dc Clarify PackageManager.hasSigningCertificate docs.
Address API review by describing relationship between the
PackageManager.hasSigningCertificate() methods and the PackageInfo
GET_SIGNING_CERTIFICATES method, as well as differentiating the
UID documentation from the package-name based one.

Bug: 74831566
Test: None, doc change.
Change-Id: I11c556325f9b2efbc2e5e1cf896b9c58db092ae8
2018-04-09 18:23:45 +00:00
Philip P. Moltmann
325f7284d9 Merge "Expose TestAPIs needed by GtsOsTestCases" into pi-dev am: d565f04957
am: e2e7dd4eda

Change-Id: I57cbfacd181876b65447e5fe7497c83802a55b60
2018-04-09 09:17:38 -07:00
TreeHugger Robot
d565f04957 Merge "Expose TestAPIs needed by GtsOsTestCases" into pi-dev 2018-04-09 15:57:42 +00:00
Jeff Sharkey
c907d2137b ContentResolver should handle dead system_server.
Use the common rethrowFromSystemServer() pattern.  Carefully only
throws for calls going to system_server; leaves existing behavior
intact when calling a ContentProvider.

Bug: 77671218
Test: builds, boots
Change-Id: Ie5e0763fb5e62b832f2b6a03c8f9d72dab3bf89a
2018-04-09 09:56:45 -06:00
Patrick Baumann
58f94be3e5 Merge "Adds a start flag to set FLAG_ACTIVITY_MATCH_EXTERNAL" into pi-dev am: 1a249607f9
am: 30cb5926ac

Change-Id: I261e35dc7cc59988575fdfd095c3d75a18bc2e04
2018-04-06 16:25:44 -07:00
Philip P. Moltmann
f80809ffd7 Expose TestAPIs needed by GtsOsTestCases
Test: atest GtsOsTestCases on pi-dev:taimen and oc-mr1:sailfish
Bug: 77497338
Change-Id: I5de976991a857bfbed2faa943822af542601fa8b
2018-04-06 14:59:07 -07:00
Patrick Baumann
229141f082 Adds a start flag to set FLAG_ACTIVITY_MATCH_EXTERNAL
Test: manual - launch installed instant app from command line
Change-Id: I0e8532a683e3a68d2c81df222aab673d09c286ed
Fixes: 75967669
2018-04-06 14:16:16 -07:00
Mathew Inwood
5d52e3f5ea Merge "Fix typo in comments." into pi-dev am: 6c73779442
am: 9dd68c73ee

Change-Id: I28237550fb37a7c0680c763fa84cc6129755fb02
2018-04-06 07:43:05 -07:00
Mathew Inwood
703063a52a Merge "Replace ALL_LISTS policy with JUST_WARN." into pi-dev am: 1f8757d35f
am: fa631b1247

Change-Id: I5dfd8a8002e23ba012af0e642af7eeb336e3eb80
2018-04-06 05:56:32 -07:00
Mathew Inwood
5e986dccfd Fix typo in comments.
Keep the nitpickers happy.

Test: m
Bug: 77517571
Change-Id: I70374c05df3e366b5a0ce3bbb103dce28f48d4b8
2018-04-06 13:55:44 +01:00
Mathew Inwood
1f8757d35f Merge "Replace ALL_LISTS policy with JUST_WARN." into pi-dev 2018-04-06 12:32:42 +00:00
Suprabh Shukla
acdfc1df62 Merge "Activity interceptor dialog for suspended apps" into pi-dev am: 822ce4f3aa
am: fce7bf015e

Change-Id: I20ef2001636ee1a75bcf5d9d7b097848bb15c710
2018-04-05 14:41:00 -07:00
TreeHugger Robot
822ce4f3aa Merge "Activity interceptor dialog for suspended apps" into pi-dev 2018-04-05 21:15:19 +00:00
Patrick Baumann
988440729a Merge "Fixes non-web AIA internal launch" into pi-dev am: cb331c32db
am: cf180c376d

Change-Id: I61205d6cd0b514e4c9140c53b7022ed862eac178
2018-04-05 11:15:14 -07:00
Patrick Baumann
1b33e25e8d Merge "Copy ApplicationInfo#versionCode field" into pi-dev am: a4d6570b2f
am: d5160491ef

Change-Id: Id8349ebdd4790b4fac61403155c4c55d40a0247b
2018-04-05 10:27:26 -07:00
TreeHugger Robot
cb331c32db Merge "Fixes non-web AIA internal launch" into pi-dev 2018-04-05 17:07:14 +00:00
TreeHugger Robot
a4d6570b2f Merge "Copy ApplicationInfo#versionCode field" into pi-dev 2018-04-05 16:20:25 +00:00
Mathew Inwood
a6d02fb104 Replace ALL_LISTS policy with JUST_WARN.
It seems pretty unlikely that we'd ever want to disallow access to the
light greylist in P, since doing do would break do many apps. We don't need
this policy here as an opt-in for apps now, since the StrictMode work will
achieve the same thing.

Instead, make a "just warn" policy which allows access to all APIs, but
leaves the detection and logging logic in place. This gives us the option
of disabling enforcement, but still gathering logs to find out which apps
use which APIs.

Bug: 77517571

Test: Boot device
Test: Hardcode policy of HIDDEN_API_ENFORCEMENT_JUST_WARN and verify log

Change-Id: I588f347716a79ac5887b74763c8afc16b3be699b
2018-04-05 16:27:50 +01:00
Mathew Inwood
c89245f5e6 Merge "Exempt platform-cert signed apps from hidden API checks." into pi-dev am: 0e650c1c55
am: 85a2c917bd

Change-Id: I54a5fc64c5c1f1bfba3f4e90a6af811ddecd2689
2018-04-05 04:07:42 -07:00
Mathew Inwood
0e650c1c55 Merge "Exempt platform-cert signed apps from hidden API checks." into pi-dev 2018-04-05 10:43:12 +00:00
Rubin Xu
354cb645fa Merge "Device ID attestation: Add feature flag." into pi-dev am: 73961397e5
am: 1352861682

Change-Id: I564a99552bd1292dcc0dc85add1b836de028f85f
2018-04-05 03:13:25 -07:00
Rubin Xu
73961397e5 Merge "Device ID attestation: Add feature flag." into pi-dev 2018-04-05 09:38:28 +00:00
Suprabh Shukla
3c3af1406e Activity interceptor dialog for suspended apps
Added an AlertActivity to intercept the start for an activity belonging
to a suspended app. More details will be shown if the suspending app
also defines an activity to handle the API action
SHOW_SUSPENDED_APP_DETAILS.

Test: Added tests to existing classes. Can be run via:
atest com.android.server.pm.SuspendPackagesTest
atest com.android.server.pm.PackageManagerSettingsTests
atest com.android.server.pm.PackageUserStateTest

Bug: 75332201
Change-Id: I85dc4e9efd15eedba306ed5b856f651e3abd3e99
2018-04-04 18:40:19 -07:00
Suprabh Shukla
c84671aa24 Merge "Hiding windows for suspended packages" into pi-dev am: fe99686d8a
am: c027b065f4

Change-Id: I501b078bc6eb1b5fb89c2b1c8862c7e172e93b87
2018-04-04 16:59:05 -07:00
TreeHugger Robot
fe99686d8a Merge "Hiding windows for suspended packages" into pi-dev 2018-04-04 22:42:37 +00:00
Patrick Baumann
7838027fb0 Fixes non-web AIA internal launch
This change plumbs the original uid of a startActivity call through to
PackageManagerService#queryIntentActivitiesInternal so that we properly
filter.

Test: manual - launch previously failing instant app
Change-Id: I0a62195f67c2e08315ce2d87f1d8c516c2327ba6
Fixes: 77489209
2018-04-04 14:32:26 -07:00
Patrick Baumann
c2def58ec0 Copy ApplicationInfo#versionCode field
This compatibility change ensures that apps built for pre-P that rely
on reflection to access ApplicationInfo#versionCode don't crash. The
move to long version code introduces a new field and all modifications
of the field are wrapped in a method that ensures both the new and old
fields are set appropriately.

Test: manual - impacted app runs
Change-Id: I5fb37c65b0fb04042dda12479d1e1a76590daa3d
Fixes: 74393568
2018-04-04 12:18:16 -07:00
Mathew Inwood
9d89543d48 Exempt platform-cert signed apps from hidden API checks.
This means that APKs signed with the platform cert are allowed to use
hidden APIs, even if they are not on the package whitelist, and if they are
not in the system image. It will also allow a number of packages to be
removed from the package whitelist.

Also remove all platform cert signed apps from the package whitelist, as
there is no longer any need for them to be in there.

Bug: 64382372
Test: device boots
Change-Id: Id805419918de51f946c1f592581bab36ae79de83
2018-04-04 17:49:48 +01:00
Suprabh Shukla
69c71423ec Hiding windows for suspended packages
Suspended packages get their activities intercepted at start, but they
can still show system_alert or toast_windows from other components.
These need to be hidden when the app goes into suspend and unhidden when
it is unsuspended.

Test: atest com.android.server.wm.WindowStateTests

Bug: 77498821
Change-Id: I9ac446f20feb23e2090ba306b4435c46b9aeec95
2018-04-03 17:00:09 -07:00
Dan Sandler
6f13e973f7 Fix javadoc xrefs.
Change-Id: Iadde9e2ddf500b28373838cfe38ab7b677f80ce5
Fixes: 71866610
Test: make docs
2018-04-03 07:16:21 -04:00
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
96453af19b Merge "Add ROLLBACK past signing cert capability." 2018-04-02 19:47:39 +00:00
Daniel Cashman
a1d0cf74f9 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
2018-03-31 08:44:32 -07:00
Suprabh Shukla
1f9089af51 Merge "Adding LauncherApps apis for suspended packages" into pi-dev am: a6d6a5aa79
am: 733b8340a4

Change-Id: Id76853b6b65f128f193ce054491c5b0aaa672d05
2018-03-31 06:44:30 +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