OSDN Git Service
(root)
/
android-x86
/
frameworks-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add missing isShellUser check
[android-x86/frameworks-base.git]
/
services
/
core
/
java
/
com
/
android
/
server
/
am
/
ActivityManagerService.java
diff --git
a/services/core/java/com/android/server/am/ActivityManagerService.java
b/services/core/java/com/android/server/am/ActivityManagerService.java
index
cf48dd6
..
2a1e3e6
100644
(file)
--- a/
services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/
services/core/java/com/android/server/am/ActivityManagerService.java
@@
-4260,9
+4260,18
@@
public class ActivityManagerService extends IActivityManager.Stub
return procState;
}
return procState;
}
+ private boolean isCallerShell() {
+ final int callingUid = Binder.getCallingUid();
+ return callingUid == SHELL_UID || callingUid == ROOT_UID;
+ }
+
@Override
public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
throws RemoteException {
@Override
public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
throws RemoteException {
+ if (!isCallerShell()) {
+ EventLog.writeEvent(0x534e4554, 160390416, Binder.getCallingUid(), "");
+ throw new SecurityException("Only shell can call it");
+ }
synchronized (this) {
final ProcessRecord app = findProcessLocked(process, userId, "setProcessMemoryTrimLevel");
if (app == null) {
synchronized (this) {
final ProcessRecord app = findProcessLocked(process, userId, "setProcessMemoryTrimLevel");
if (app == null) {