Commit Graph

14 Commits

Author SHA1 Message Date
Marissa Wall
9b98e89d02 Merge changes from topic "b143889121"
* changes:
  Revert "Add a job to prune UsageStats data on package removals."
  Revert "Prune obsolete UsageStats data on upgrade."
2019-11-22 22:10:38 +00:00
TreeHugger Robot
d5cc921535 Merge "Avoids deadlock when applying preferred activities" 2019-11-22 21:11:42 +00:00
Marissa Wall
1a1c61b23e Revert "Add a job to prune UsageStats data on package removals."
This reverts commit ece1fa0ba1.

Reason for revert: b/144982898

Change-Id: I95834b3e6b28d569a28088357ab6bfb4d3a0c7ff
2019-11-22 12:49:35 -08:00
Patrick Baumann
182ea1cd99 Avoids deadlock when applying preferred activities
Prior to this change, we were resolving the mime type of a given intent
while holding the package lock. With this change, we instead rely on the
preferred-activity declaration to define the mime type if it's
important, removing need for an activity manager service call and the
potential for deadlock.

Bug: 143105100
Test: Manual; sideload to /system/etc/preferred-apps/ and reset app preferences
Change-Id: Ie0b124216b49a1147bd5c2e82cf8c7cadb3f08ac
2019-11-22 11:55:10 -08:00
Varun Shah
eb63ed0841 Merge changes from topic "b143889121"
* changes:
  Prune obsolete UsageStats data on upgrade.
  Add a job to prune UsageStats data on package removals.
2019-11-22 00:10:24 +00:00
Varun Shah
ece1fa0ba1 Add a job to prune UsageStats data on package removals.
Add a job to prune any usage stats data that exists on disk belonging
to uninstalled packages. This job will be scheduled every time there
is a package removal, appending to the work of any previous pending
jobs. Jobs for each user will be executed when the device is idle.

Bug: 143889121
Test: atest UsageStatsDatabaseTest#testPackageDataIsRemoved
Change-Id: Iee00917a940930271ca40367ca24992cde018616
2019-11-20 14:41:04 -08:00
Adam Bookatz
b9a57da94c Merge "Introduce user types" 2019-11-15 19:15:37 +00:00
Bookatz
029832a951 Introduce user types
Introduces the notion of 'user types' to UserManager.
Previously, users only had properties, set by UserInfo flags. We now
solidify some of these as formal user types. Each user must be of
precisely one user type. The configuration of each type is defined
in a UserTypeDetails object.

Prior 'types' - namely Guest, Restricted, ManagedProfiles, Demo, and
'normal' - that were set via UserInfo flags are now controlled via
UserType. Previous UserInfo flag methods for categorizing these are
still supported as long as no user of of more than one type.

If a user was (e.g.) previously both Guest and Demo, it is now
invalid and will be prevented from upgrading. This should not be a
problem in AOSP, where these 'types' were assumed mutually exclusive.

UserTypeDetails is sufficiently general to support future non-managed
profiles. To this end, the logic for specifying badges and their
colors/labels is contained by UserTypeDetails, and therefore
UserManager is responsible for delivering the corresponding badge
information.

Bug: 142151520

Test: added new test class UserManagerServiceUserTypeTest
Test: added additional tests in UserManagerServiceUserInfoTest
Test: added additional tests in UserManagerTest
Test: added additional tests in UserManagerServiceCreateProfileTest
Test: created UserTests to run the various pm.User*Test's

Test: atest \
  com.android.server.pm.UserTests \
  UserLifecycleTests \
  ManagedUserContentResolverTest \
  CtsDevicePolicyManagerTestCases \
  CtsMultiUserHostTestCases \
  com.android.server.devicepolicy.DevicePolicyManagerTest \
  com.android.server.am.UserControllerTest \
  CreateManagedProfileTaskTest

Test: atest com.android.server.pm.UserManagerServiceCreateProfileTest
   using adb shell getprop persist.sys.max_profiles # for 5 and -1

Change-Id: Id1183a76055e9a7610965cf40b256d1392afe6f8
2019-11-14 10:00:50 -08:00
Christopher Tate
ca4e621306 Move BatteryStatsInternal to services.jar
Bug: 140833849
Test: boot & run normally
Test: m checkbuild
Change-Id: Ifb3e4a69073380e09348572fdd7b0e5386e00525
2019-10-31 16:53:48 -07:00
Christopher Tate
b909c4d55a Move UsageStatsManagerInternal to services.jar
UsageStatsManagerInternal is also no longer an API surface for
registration of app idle state change listeners.  AppStandbyInternal has
become a proper LocalService and interested clients can just use that
directly.

Bug: 140833849
Test: boot & run normally
Test: verify system package backup
Change-Id: Ie63f438f129cd8f41169778a3045d131ca7322fb
2019-10-24 18:28:52 +00:00
Christopher Tate
65fb2e4e40 Move UserManagerInternal into services.jar
Because SettingsProvider needs to call through the IUserManager
interface there is now a method to provide restricted-access information
via that route.  It has the same protection as the implicit local
service call surface that was previously used:  only system-uid callers
can invoke it.

Bug: 140833849
Test: system boots & runs normally
Change-Id: I05823ca57240ab10feb382c45590541212e406c1
2019-10-17 15:23:23 -07:00
Roshan Pius
73266f2f64 Add a new wifi protection level
Wifi mainline module needs some permissions which are currently only
granted to signature components. Since mainline modules are not going to
be signed with OEM's signature, we need a new protection level to grant
some of these permissions to the wifi mainline APK.

Bug: 142234604
Test: Verified that wifi can get INTERACT_ACROSS_USERS_FULL permission
Change-Id: I26b0edff62497b5e08c2f2f504b0cd5f950682ad
2019-10-12 20:23:10 +00:00
Chen Xu
45c183d201 add a new telephony protection level
for oems which take telephony mainline module, all telephony related
apks will be signed with non-platform certificate. that said apks won't
be able to grant platform signature permission. Solution is to add a new
telephony protection level.

Bug: 141479803
Test: cts & manual
Change-Id: Ib3be016080d42fd76e7c131f4e44d815ce431e6e
2019-10-11 13:46:01 -07:00
Christopher Tate
e4f5f2d3f5 Move PackageManagerInternal to services.jar
The one messy internal caller is the settings provider, so a new @hide
API on PackageManager was introduced to decouple the provider from
LocalServices.  That new entry point is only callable by uid 1000,
paralleling the previous system-caller-only availability.

Bug: 140833849
Test: system boots & runs normally
Change-Id: I93ae38b8f55db7864893a97795aea63014bf5e12
2019-10-08 15:49:43 -07:00