Merge "RESTRICT AUTOMERGE: Added an app id security check in isAppForeground." into pi-dev

This commit is contained in:
TreeHugger Robot
2018-11-19 22:50:20 +00:00
committed by Android (Google) Code Review

View File

@@ -8768,6 +8768,14 @@ public class ActivityManagerService extends IActivityManager.Stub
@Override
public boolean isAppForeground(int uid) {
int callerUid = Binder.getCallingUid();
if (UserHandle.isCore(callerUid) || callerUid == uid) {
return isAppForegroundInternal(uid);
}
return false;
}
private boolean isAppForegroundInternal(int uid) {
synchronized (this) {
UidRecord uidRec = mActiveUids.get(uid);
if (uidRec == null || uidRec.idle) {