OSDN Git Service

Merge tag 'android-8.1.0_r74' into oreo-x86
[android-x86/frameworks-base.git] / services / core / java / com / android / server / am / ActivityManagerService.java
index 0f35e32..b4c18b1 100644 (file)
@@ -8029,6 +8029,14 @@ public class ActivityManagerService extends IActivityManager.Stub
 
     @Override
     public boolean isAppForeground(int uid) throws RemoteException {
+        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) {