Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56e3510b authored by Hui Yu's avatar Hui Yu Committed by Android (Google) Code Review
Browse files

Merge "Add isUidActiveOrForeground() for camera/audio to use." into rvc-dev

parents 8cb538c9 9b52815e
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -99,6 +99,7 @@ interface IActivityManager {
    void unregisterUidObserver(in IUidObserver observer);
    void unregisterUidObserver(in IUidObserver observer);
    boolean isUidActive(int uid, String callingPackage);
    boolean isUidActive(int uid, String callingPackage);
    int getUidProcessState(int uid, in String callingPackage);
    int getUidProcessState(int uid, in String callingPackage);
    boolean isUidActiveOrForeground(int uid, String callingPackage);
    // =============== End of transactions used on native side as well ============================
    // =============== End of transactions used on native side as well ============================


    // Special low-level communication with activity manager.
    // Special low-level communication with activity manager.
+21 −0
Original line number Original line Diff line number Diff line
@@ -8779,6 +8779,27 @@ public class ActivityManagerService extends IActivityManager.Stub
        return uidRecord != null && !uidRecord.setIdle;
        return uidRecord != null && !uidRecord.setIdle;
    }
    }
    @Override
    public boolean isUidActiveOrForeground(int uid, String callingPackage) {
        if (!hasUsageStatsPermission(callingPackage)) {
            enforceCallingPermission(android.Manifest.permission.PACKAGE_USAGE_STATS,
                    "isUidActiveOrForeground");
        }
        synchronized (this) {
            final boolean isActive = isUidActiveLocked(uid);
            if (isActive) {
                return true;
            }
        }
        final boolean isForeground = mAtmInternal.isUidForeground(uid);
        if (isForeground) {
            Slog.wtf(TAG, "isUidActiveOrForeground: isUidActive false but "
                    + " isUidForeground true, uid:" + uid
                    + " callingPackage:" + callingPackage);
        }
        return isForeground;
    }
    @Override
    @Override
    public void setPersistentVrThread(int tid) {
    public void setPersistentVrThread(int tid) {
        mActivityTaskManager.setPersistentVrThread(tid);
        mActivityTaskManager.setPersistentVrThread(tid);