The logic in MediaProvider is technically correct, but it's sometimes
inefficient in calling into the OS multiple times with the same
questions, such as validating getCallingPackage().
To mitigate this overhead, and start paving the way for more dynamic
delegation of permission checks, collect these details into a
LocalCallingIdentity object. We carefully perform all permissions
checking against this new object, and avoid using any other
thread-local values from ContentProvider or Binder.
Local tests show this CL improves performance of a test app that
takes 100 rapid shots by 37%.
This change is a no-op refactoring.
Bug: 130758409, 115619667
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: If250a7675f2246cd10881acf615619d6d6061f3d
The code allows to also whitelist only a select set of permissions, but
this is not yet exposed in the API.
Also: Fix up shell commands for restricted permissions
Fixes: 132368462
Test: - Enabled app via device admin in secondary profile
-> verified that permissions were whitelisted
- Installed existing and new app using --restrictpermissions and
not
-> verified that permissions were whitelisted or not
atest AppRestrictionsHelperTest
RestrictedPermissionsTest
Change-Id: I9cd76c555b40663f2e25ad86e8a54991baae346c
Merged-In: I9787e63d8beb8f6b1ba2d15532d4c0f69dbdf863
Adding a new intent acttion for the permission controller to ask an
app to show its permission usage to help the user understand what
and why is being used. We are adding a permission to protect this
action to prevent apps trampolining into other apps when asked to
show their permission usge.
Test: compiles
bug:131760942
Change-Id: I5217d6319fd98d40c8879bdd7af5fe466bf9143e
Explain under what conditions #query and #insert may return null.
Bug: 31043947
Test: n/a (docs update only)
Change-Id: I8880f80bfa2efff296a0a07c0bf28e9606d6db65
The hidden flags should use higher values so as to not
interleave with public flags.
Bug: 132438913
Test: CtsAppTestCases
Change-Id: Ic1dad21c2da5e5e60dc0401ee163f2188cc0f5dc
The ACCESS_MEDIA_LOCATION and WRITE_OBB permissions will always be
available.
Bug: 112545973
Fixes: 132226317
Test: presubmit
Change-Id: Ie61eba427b48f347438522bc11cfa748ad5ba1f1
Make PackageManager send a ACTION_CANCEL_ENABLE_ROLLBACK intent to
RollbackManager. RollbackManager marks the relevant rollback as invalid.
Allow enable rollback to continue as usual, before making the rollback
available, RollbackManager checks whether it's valid. If it's not, the
rollback data is deleted.
Add a test case for expired rollback enabling attempt in RollbackTest.
Test: atest RollbackTest#testEnableRollbackTimeoutFailsRollback
Test: manual -
* Set ENABLE_ROLLBACK_TIMEOUT_MILLIS to 1 ms using DeviceConfig
* Install a mainline module with rollback enabled
* adb shell dumpsys rollback
* observe that no rollback was made available
Fixes: 131679409
Change-Id: Iaa4dbff002b820aff1fc3e1b985f129cf5ebe2e6
This change removes the permission granting for non-system dialer and
SMS apps in DefaultPermissionGrantPolicy. Permission granting to
system apps is left unchanged. Package manager is also made to query
role manager for the current default dialer instead of maintaining its
own storage.
Bug: 124452117
Bug: 129211673
Test: presubmit
Change-Id: I3c5c122802c3ecf15984a24c24c69a9e2f310bb7
To ensure existing installers would work without a change the
default state of installing a package is now that all restricted
permissions are whitelisted. If the installer specifies another
whitelist at install time, it determines the install state. In
addition to this we now enable the restricted permission checks
as a prebuilt installer is no longer required.
Test: atest CtsPermission2TestCases
Test: atest CtsPermissionTestCases
Test: atest CtsAppSecurityTestCases:android.appsecurity.cts.PermissionsHostTest
bug:132160728
Change-Id: I705e341faebe62fc2d88fd37ad8870b98e1b71b1
Currently only for the ContextImpl.enforcePermission code paths and only
when 'secure debug_package_permission_check' is set.
This feature is disabled on user-builds.
Test: Enabled permission checking for my app and
- checked runtime permision denial
- permission denial because app is instant
Bug: 111075456
Change-Id: Ib85777db69ee490608e9dac32a3b97971c0ba215