Merge "Adds caller check to getAllPackages()" into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
835ab4eb82
@@ -6541,6 +6541,11 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getAllPackages() {
|
public List<String> getAllPackages() {
|
||||||
final int callingUid = Binder.getCallingUid();
|
final int callingUid = Binder.getCallingUid();
|
||||||
|
// enforceSystemOrRootOrShell:
|
||||||
|
if (callingUid != Process.SYSTEM_UID && callingUid != Process.ROOT_UID
|
||||||
|
&& callingUid != Process.SHELL_UID) {
|
||||||
|
throw new SecurityException("getAllPackages is limited to privileged callers");
|
||||||
|
}
|
||||||
final int callingUserId = UserHandle.getUserId(callingUid);
|
final int callingUserId = UserHandle.getUserId(callingUid);
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
if (canViewInstantApps(callingUid, callingUserId)) {
|
if (canViewInstantApps(callingUid, callingUserId)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user