Merge "[pm] prevent non-debuggable app downgrades via shell"
This commit is contained in:
committed by
Android (Google) Code Review
commit
b654014439
@@ -706,7 +706,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
||||
}
|
||||
}
|
||||
|
||||
if (Build.IS_DEBUGGABLE || isCalledBySystemOrShell(callingUid)) {
|
||||
if (Build.IS_DEBUGGABLE || isCalledBySystem(callingUid)) {
|
||||
params.installFlags |= PackageManager.INSTALL_ALLOW_DOWNGRADE;
|
||||
} else {
|
||||
params.installFlags &= ~PackageManager.INSTALL_ALLOW_DOWNGRADE;
|
||||
@@ -916,6 +916,10 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
private static boolean isCalledBySystem(int callingUid) {
|
||||
return callingUid == Process.SYSTEM_UID || callingUid == Process.ROOT_UID;
|
||||
}
|
||||
|
||||
private boolean isCalledBySystemOrShell(int callingUid) {
|
||||
return callingUid == Process.SYSTEM_UID || callingUid == Process.ROOT_UID
|
||||
|| callingUid == Process.SHELL_UID;
|
||||
|
||||
Reference in New Issue
Block a user