Merge "Enforce the owner rights of dumpProfiles" into sc-dev
This commit is contained in:
@@ -12988,6 +12988,15 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dumpProfiles(String packageName) {
|
public void dumpProfiles(String packageName) {
|
||||||
|
/* Only the shell, root, or the app user should be able to dump profiles. */
|
||||||
|
final int callingUid = Binder.getCallingUid();
|
||||||
|
final String[] callerPackageNames = getPackagesForUid(callingUid);
|
||||||
|
if (callingUid != Process.SHELL_UID
|
||||||
|
&& callingUid != Process.ROOT_UID
|
||||||
|
&& !ArrayUtils.contains(callerPackageNames, packageName)) {
|
||||||
|
throw new SecurityException("dumpProfiles");
|
||||||
|
}
|
||||||
|
|
||||||
AndroidPackage pkg;
|
AndroidPackage pkg;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
pkg = mPackages.get(packageName);
|
pkg = mPackages.get(packageName);
|
||||||
@@ -12995,13 +13004,6 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
throw new IllegalArgumentException("Unknown package: " + packageName);
|
throw new IllegalArgumentException("Unknown package: " + packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Only the shell, root, or the app user should be able to dump profiles. */
|
|
||||||
int callingUid = Binder.getCallingUid();
|
|
||||||
if (callingUid != Process.SHELL_UID &&
|
|
||||||
callingUid != Process.ROOT_UID &&
|
|
||||||
callingUid != pkg.getUid()) {
|
|
||||||
throw new SecurityException("dumpProfiles");
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (mInstallLock) {
|
synchronized (mInstallLock) {
|
||||||
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dump profiles");
|
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dump profiles");
|
||||||
|
|||||||
Reference in New Issue
Block a user