Commit Graph

150 Commits

Author SHA1 Message Date
Patrick Baumann
8255f5f4c0 Consolidating PM owner definition and adding new owners.
Change-Id: If4b080755701452c53d55f26380e887dc3944dbf
2021-10-19 21:06:56 +00:00
Kweku Adams
ddca60058e Prevent app check via content provider.
Pass in the calling UID when asking PackageManager to resolve the
content provider. This makes sure PM is resolving the provider based on
the calling UID's permissions and not the system server's permissions.

Bug: 189122544
Bug: 189122545
Test: atest CtsContentTestCases
Test: atest CtsJobSchedulerTestCases
Test: atest FrameworksServicesTests:UriGrantsManagerServiceTest
Change-Id: Iaa421e982fca1e29828eda43f0762893199b5ce1
2021-07-01 10:20:44 -07:00
Zhen Zhang
5e0446a263 Log storage savings info with the GlobalHibernatedApps atom
Retrieve the number of freed bytes from PM and store it in
GlobalLevelState when a package is globally hibernated. Reset the value
when it gets unhibernated and write it to disk to persist across device
reboot.

Bug: 188819665
Test: atest AppHibernationServiceTest
Change-Id: I187ec803776cc76c77a660e1ba2f72c2e77765f9
2021-06-21 17:56:32 -07:00
Salud Lemus
46a1dcefb0 Extend set user protected packages for multi-user
The current implementation does not work when the multi-user feature is
enabled because it clears the "globally" protected packages set by the
device owner whenever a new user is created.

Bug: 178500150
Test: atest FrameworksServicesTests:com.android.server.devicepolicy.OwnersTest
Test: atest FrameworksServicesTests:com.android.server.devicepolicy.DevicePolicyManagerTest
Test: Ran the CTS tests that were added

Change-Id: Id04cb9b5b2357b0a0b5090442a39d97405287dbe
2021-05-13 12:02:22 -07:00
Alex Buynytskyy
1e5cf8f1ff Customer API feedback.
Use two separate interfaces for flags and single value. This produces
correct API documentation.

Bug: 160605420
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest
Change-Id: I9a7eaf86af558d8dcfd1636a4baf6a28e2ee79b1
2021-05-04 15:24:02 +00:00
Winson
a74c1f3c69 Move withPackageSettingsSnapshot methods into PackageManagerInternal
For consumers who don't care about blocking package data updates and
only need data at a specific snapshot in time, these methods would
avoid locking PMS during the iteration process.

Bug: 183643808

Test: atest com.android.server.pm.test.verify.domain

Change-Id: Ia951381798d75f77c4ad5fc010a469b69992f074
2021-04-30 10:46:32 -07:00
TreeHugger Robot
18ecd98109 Merge "[pm] remove incremental startable/unstartable code" into sc-dev 2021-04-20 22:03:22 +00:00
Songchun Fan
5ada1508c2 [pm] remove incremental startable/unstartable code
Also remove streaming health status reporting which could cause
startable state change because it is also not needed any more.

BUG: 171920377
Test: builds
Change-Id: I7284e7a63df79da7dbf3d16ff64302b3d1ce1348
2021-04-16 02:29:24 +00:00
Rhed Jao
9ac5f83a72 Apply package visibility to the LauncherApps#isActivityEnabled
Bug: 180417374
Test: atest AppEnumerationTests
Change-Id: I23ad6515ca7a8235290809c390f2527bd0b3c987
2021-04-14 15:40:08 +08:00
Kevin Han
71edf551d3 Delete vdex/odex when package is globally hibernating
Delete vdex/odex files when a package is marked globally hibernating. We
expose the delete OAT artifacts API in PackageManagerInternal for app
hibernation service to call.

Bug: 183140824
Test: atest AppHibernationServiceTest
Test: atest PackageManagerServiceHibernationTests
Test: manual test

Change-Id: I2ca9f561f79992e37e0bad2d4bb7dda4cd21b4ed
2021-03-22 23:46:23 -07:00
Jeff Sharkey
a57db58f24 Surface "neverForLocation" through public API.
Since developers can declare the "neverForLocation" flag in their
manifest as public API, we should also offer a way to inspect the
value that we parsed from the manifest.  We do this by surfacing it
through the existing PackageInfo.requestedPermissionsFlags field.

This also means we can remove the PackageManagerInternal API, since
interested parties can now check PackageInfo directly.

Fix a potential security issue by only accepting flags from manifest
when the application is targeting a modern enough SDK.

Bug: 181812281
Test: atest CtsContentTestCases:PackageManagerTest
Test: atest FrameworksServicesTests:PackageParserTest
Test: atest com.android.server.pm.parsing
Change-Id: I877768c06ee15281f3334794034f4af563e74569
2021-03-19 17:51:16 -06:00
Jeff Sharkey
ea48e8e8b0 Add flags to <uses-permission> manifest tags.
As part of an upcoming feature, developers will need the ability to
clearly communicate that they'll never use a permission derive the
physical location of the device, regardless of ACCESS_FINE_LOCATION
and/or ACCESS_COARSE_LOCATION being granted.  The first use of this
is the BLUETOOTH permission, but developers may need to communicate
this for other permissions such as READ_PHONE_STATE, etc.

This change begins parsing this developer declaration as one of
multiple "usesPermissionFlags", which are then stored in a new
ParsedUsesPermission object.  To minimize refactoring, we continue
to offer this data through the older String-based APIs.

Bug: 181812281
Test: atest FrameworksServicesTests:PackageParserTest
Test: atest com.android.server.pm.parsing
Test: atest -p core/java/android/content/pm \
            core/java/com/android/internal/content \
            services/core/java/com/android/server/pm \
            services/tests/servicestests/src/com/android/server/pm
Change-Id: I2ccda05cf416653d311151591f91ae55a729e05b
2021-03-16 14:29:59 -06:00
Güliz Seray Tuncay
05bb876929 Migrate wellbeing to use role
Migrate wellbeing to use the role infrastructure. Based on ag/13357357.

Bug: 158878560

Test: atest com.google.android.wellbeing.gts.WellbeingTest
Test: atest CtsPermission2TestCases:PermissionPolicyTest
Test: atest FrameworksServicesTests:AppStandbyControllerTests
Change-Id: I0a6c986fe9a53be52013f300ba7795dfdd0887e6
2021-03-06 19:52:01 +00:00
Benjamin Schwartz
ba87437a7d powerstats: Clients of PowerStatsInternal must nullcheck
Added comments and annotations to the PowerStatsInternal and
PowerStatsHALWrapper classes. Also fixed the native code to return
partial results if available.

Bug: 179684579
Test: On battery I no longer see crash
Change-Id: Ic97fb56af6559a3fa65f857c527b10303238ac42
2021-02-18 14:29:30 -08:00
Songchun Fan
58e343079e Merge "[pm/launcher] add back progress listening in PackageManagerInternal" into sc-dev 2021-02-10 16:36:20 +00:00
Rafal Slawik
4661d6aa6d Read CPU usage for system server thread groups
Add a statsd puller to record CPU usage of system server threads: all
and binder.

Bug: 173227907
Test: cmd stats pull-source 10098
Test: atest CpuStatsTests
Change-Id: I0d5c6e1e8d772bae6efdcbe62767932cc2fefe02
2021-02-10 11:21:00 +00:00
Songchun Fan
3971d145c9 [pm/launcher] add back progress listening in PackageManagerInternal
(This partially reverts ag/13481636)

Turns out Launcher still uses
LauncherApps.onPackageLoadingProgressChanged(), which relies on the
internal listener exposed via PackageManagerInternal. Adding it back.
We don't need the unregister method, because all the progress listeners
will be automatically removed when the app is fully loaded.

BUG: 175135603
Test: manual with incremental install via Phonesky
Change-Id: Ief09d3c7775080f35568b6ec51d6351a9373f04e
2021-02-09 02:11:38 +00:00
Ryan Mitchell
da9ee1406e Add overlayPaths to ApplicationInfo
RROs have historically been APK packages. We now have the ability to
generate RROs on-the-fly. These "fabricated" RROs are not APKs.
ApplicationInfo#resourceDirs documentation states that it only contains
paths to packages. To prevent changing the behavior of resourceDirs
until we can deprecate and remove it, a new overlayPaths field has been
added to ApplicationInfo. This new field contains APK overlay paths as
well as non-APK overlay paths.

Bug: 172471315
Test: boot enable/disable overlays and examine overlays working as well
      as package manager dumpsys
Change-Id: I78c5eeef73b7d8bada61edc0f64a12a3cdc1ce16
2021-02-08 00:28:58 -08:00
TreeHugger Robot
2b94075386 Merge "[pm] cleanup unused PackageManagerInternal APIs for loading progress" into sc-dev 2021-02-06 01:59:54 +00:00
Jeff Sharkey
2bde0ac1d8 Merge "Add OWNERS" am: 072c9b4cc4 am: 2a2cd51595 am: 9d03b1d4e1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1578703

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8279b8e115bef41e76390519148ae8a583741149
2021-02-05 23:30:29 +00:00
Dmitri Plotnikov
34f667b5c7 Add OWNERS
Change-Id: Ia81dd386551db0a3c8bc73c03a6991b3c7c05770
2021-02-05 21:41:15 +00:00
Jeff Sharkey
3febc6891f Merge "add owners" am: 29ff8b410a am: 3cfb72b971 am: 4d03108a11
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1576506

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I51c715cd88de9957a056f8d2498dccf2d83695fb
2021-02-05 20:22:14 +00:00
Songchun Fan
2299382fe2 [pm] cleanup unused PackageManagerInternal APIs for loading progress
Launcher gets loading progress from LauncherActivityInfo directly and
does not need to use the listener. Removing unused methods, plus a bit
of code cleanup.

BUG: 175135603
Test: atest CtsInstalledLoadingProgressHostTests
Test: atest FrameworksServicesTests:com.android.server.pm.IncrementalStatesTest
Change-Id: Icf96f5ca23e567396cfc233725619ba91a953c97
2021-02-05 16:50:33 +00:00
Todd Kennedy
d71fe1dc5f add owners
Change-Id: I8f20ea8e65fba06e013a105e63912ea70d691864
2021-02-05 00:52:48 +00:00
Alex Buynytskyy
6f80c512a4 Changing IntentSender to become a listener.
Listener is more secure as nobody can send a broadcast with invalid
digests.

Bug: 160605420
Test: atest PackageManagerShellCommandTest PackageManagerShellCommandIncrementalTest IncrementalServiceTest PackageManagerServiceTest ChecksumsTest
Change-Id: I5f6ec3f0fa975d274d456d11d57be61d0b245e80
2021-02-05 00:16:51 +00:00
Benjamin Schwartz
3bdc838570 BatteryStats: Pull subsystem stats from Power Stats Service
Also remove redundant PlatformIdle stats section from history details

Bug: 173132005
Bug: 178315485
Test: Ran device to drain battery then checked dumpsys batterystats
Test: Verified that Historian could correctly parse the bugreport
Change-Id: I65c1824695dd026231f83664b00f72912dee2164
2021-02-03 12:49:14 -08:00
Michael Wachenschwanz
32d103d0db Update BatteryExternalStatsWorker to use the new EnergyConsumerType
EnergyConsumerId has been replaced with EnergyConsumerType and an ordinal int to determine an EnergyConsumer type

Bug: 178048034
Test: manual ("adb shell dumpsys batterystats --measured-energy" on
PowerStatshal2.0 enabled devices should report energy consumption data
while on battery)

Change-Id: Ie78b46fcb59d0327c00a20fbe2481dc537b910eb
2021-01-26 01:11:37 +00:00
Mat Bevilacqua
6058dc2190 Update to new version of PowerStats HAL 2.0
Bug: 178048034
Test: atest FrameworksServicesTests:PowerStatsServiceTest
Change-Id: I714d2037a3576a3f6f89211d64ccf88cefa51abf
2021-01-25 17:09:05 -08:00
Benjamin Schwartz
bded2c1344 Merge "Introduce PowerStatsInternal and replace PowerStatsHalWrapper usage" 2021-01-19 21:39:59 +00:00
Michael Wachenschwanz
605ac95a04 Introduce PowerStatsInternal and replace PowerStatsHalWrapper usage
PowerStatsService will handle PowerStatsHal queries, PowerStatsInternal
will provide the LocalService for querying PowerStatsHal derived data
from other System services.

Bug: 173077356
Test: atest FrameworksCoreTests:com.android.internal.power.MeasuredEnergyStatsTest
Test: atest com.android.server.powerstats.PowerStatsServiceTest

Change-Id: Ibc0165a44ffdbbcc9328c250f1dca3d29616c766
2021-01-19 10:21:58 -08:00
Jing Ji
1f6edbda3b Merge "Defer service starts/binding until its hosting package is unfrozen" 2021-01-13 17:57:22 +00:00
Jing Ji
326340eb8e Defer service starts/binding until its hosting package is unfrozen
When a package is frozen(install/update etc.), for the incoming request
to start/bind to the services in the package, delay the actual action
until the package is unfrozen.

Bug: 168292935
Test: see b/168292935#comment34
Change-Id: I80d928925a2ffe36deb19da37e11dbc66881f617
2021-01-12 16:19:38 -08:00
Michael Wachenschwanz
b301162211 Add OWNERS for new android/power
Test: n/a
Change-Id: I374251645f1a03698a19cae388f8986a5a057184
2021-01-07 15:58:41 -08:00
Hai Zhang
a23b25cd1a Remove obsolete is/setPermissionEnforced().
isPermissionEnforced() always returns true and is only exposed on AIDL
and there is actually no API, so it is directly removed.
setPermissionEnforced() currently doesn't affect anything so its
remaining implementation is removed as well, and we consider all
permissions enforced when needed for compatibility of dumping.

Bug: 158736025
Test: presubmit
Change-Id: I0584553ac0171147b6f131b5359ddb2964113a1d
2020-12-04 23:06:02 -08:00
Xin Li
d31ee38811 Merge rvc-qpr-dev-plus-aosp-without-vendor@6881855
Bug: 172690556
Merged-In: I78222391b83a4add8e964340ec08bb8a1306e1c6
Change-Id: I28bbf40820674675ccf765c912aa8140d3f74ab2
2020-12-02 00:38:58 -08:00
Kweku Adams
f177a8df86 Create a UsageEventListener.
Creating the UsageEventListener to generalize conveying new usage events
so that multiple components can be notified.

Bug: 142281756
Bug: 171305774
Test: atest AppIdleHostTest
Test: atest CtsUsageStatsTestCases:UsageStatsTest
Test: atest FrameworksMockingServicesTests:UsageStatsServiceTest
Test: atest FrameworksServicesTests:AppIdleHistoryTests
Test: atest FrameworksServicesTests:AppStandbyControllerTests
Change-Id: I176c476257600f0f4299a10f02b5c61332007b1c
2020-11-23 10:56:43 -08:00
Bernardo Rufino
9aee235f28 Merge "Create recents protectionLevel" 2020-11-23 09:30:38 +00:00
Bernardo Rufino
0dec6c042c Create recents protectionLevel
In preparation for permission BROADCAST_CLOSE_SYSTEM_DIALOGS
(go/close-system-dialogs), which will be signature|recents in order to
lock down Intent.ACTION_CLOSE_SYSTEM_DIALOGS. That intent is used by
recents when it's invoked.

Currently, recents is configured via existing config
config_recentsComponentName, so using that to determine the recents
package in PM.

It's my understanding that the package defined in such config will be
responsible for recents no matter which launcher is active. It's also my
understanding that the package being explicit in the system config means
that package has to come from the system image, hence it's fine to use
ensureSystemPackageName() in PM. Please advise if any of
this is wrong.

Test: Will work on CTS once we agree on the proposal here.
Bug: 159105552
Change-Id: I9f73e1f05d8df26666da156b672e370dce5030de
2020-11-19 14:39:51 +00:00
Adam Bookatz
961f737505 Merge "Move UserManagerInternal out of android.os" 2020-11-18 17:38:06 +00:00
Adam Bookatz
e5140cc83b Move UserManagerInternal out of android.os
Moving this class out of android.os will reportedly
greatly reduce ART overhead.

Test: compiles
Test: atest FrameworksServicesTests FrameworksCoreTests
Bug: 165817914
Exempt-From-Owner-Approval: no-op refactoring
Change-Id: I1f3e77120979e2f336e5f42e4ec6e459d6492083
2020-11-17 20:43:46 +00:00
Alex Buynytskyy
6ede83e600 Fix for security logging of missing packages.
Better error cases handling.
Using internal handler to process digests to not overcommit
PackageManager's.

Fixes: 170777013
Test: atest OrgOwnedProfileOwnerTest#testSecurityLogging
Change-Id: I741c10ef3ceeec01e5436f92caa6a52d0c6b6003
2020-11-15 05:34:38 +00:00
TreeHugger Robot
1086c93f77 Merge "Removing taking unrelated locks from holdLock" 2020-10-27 17:46:12 +00:00
vadimt
22676d6118 Removing taking unrelated locks from holdLock
Test: running tests with the lock contention stress mode
Bug: 168630376
Change-Id: I5665eb7100d2fcbb93c7ade6cc30b0d8519246bb
2020-10-26 18:44:08 -07:00
Songchun Fan
d9d9dbae1e Merge "[am/incremental] make package unstartable if it crashes/ANRs while loading" 2020-10-26 17:35:06 +00:00
Songchun Fan
8c7bfcd5ab Merge "Revert "Revert "[incremental/pm] LauncherApps APIs for loading state and progress""" 2020-10-23 17:44:53 +00:00
Songchun Fan
dfd4162711 [am/incremental] make package unstartable if it crashes/ANRs while loading
BUG: 171252552
Test: atest CtsWindowManagerDeviceTestCases:AnrTests
Test: atest FrameworksServicesTests:AnrHelperTest
Test: atest FrameworksServicesTests:ActivityManagerServiceTest
Test: atest IncrementalStatesTest
Change-Id: I30c9aafc52ef1b6939bb724c11794b5a60661740
2020-10-22 13:43:11 -07:00
Songchun Fan
56838fba12 Revert "Revert "[incremental/pm] LauncherApps APIs for loading state and progress""
This reverts commit 69475be847.
Also reverts commit Iaf8e2c075f188df95c68824b71362629c6adabfc.

Reason for revert: Trying again but will submit with new tests

BUG: 165841645
Test: atest NexusLauncherOutOfProcTests
Test: atest LauncherAppsSingleUserTest
Test: atest LauncherAppsMultiUserTest
Test: atest LauncherAppsProfileTest
Test: atest LimitAppIconHidingTest
Change-Id: I5ed5871ccddefbd922b3aa3ee4c1ad53cc0bfa9b
2020-10-21 14:20:20 -07:00
Jackal Guo
7e7c256b3d Compress the known package IDs
The numbers of KnownPackage should be continuous and the string
representation should not be unknown.

Fix: 170356374
Test: atest PackageManagerServiceTest
Change-Id: I2d96ca74a49b8f24ff87f8e21981d8cc0d43a469
2020-10-21 18:14:06 +08:00
Greg Kaiser
69475be847 Revert "[incremental/pm] LauncherApps APIs for loading state and progress"
This reverts commit 0173a44f3d.

Bug: 170959052
Test: Locally confirmed two reverts together fix app tray
Change-Id: I2f7b198f77b54be671c7f02bc2b67838bf99d28b
2020-10-16 07:34:43 -07:00
Zoran Jovanovic
0f942f99ca OMS: Add config_signature policy handling
Alongside SIGNATURE and ACTOR_SIGNATURE policies, add CONFIG_SIGNATURE
policy to overlayable that overlay fulfills if it is signed with the
same certificate as the reference package whose package name is
declared in 'config-signature' tag of SystemConfig and is vetted by
OMS that it's a system pre-installed package.

BUG: 158726924
TEST: regular aapt2, idmap2, OMS tests

Merged-In: I645ee72271496008742886274be0d63a2985201b
Change-Id: I645ee72271496008742886274be0d63a2985201b
2020-10-14 14:52:46 -07:00