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

Commit 2fb90954 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Allow tests to query processes frozen state."

parents affecc1d 16bae885
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -5345,6 +5345,20 @@ public class ActivityManager {
        }
    }

    /**
     * Checks if the process represented by the given {@code pid} is frozen.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.DUMP)
    public boolean isProcessFrozen(int pid) {
        try {
            return getService().isProcessFrozen(pid);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * @return The reason code of whether or not the given UID should be exempted from background
     * restrictions here.
+4 −0
Original line number Diff line number Diff line
@@ -779,6 +779,10 @@ interface IActivityManager {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.DUMP)")
    boolean isModernBroadcastQueueEnabled();

    /** Checks if the process represented by the given pid is frozen. */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.DUMP)")
    boolean isProcessFrozen(int pid);

    /**
     * @return The reason code of whether or not the given UID should be exempted from background
     * restrictions here.
+6 −0
Original line number Diff line number Diff line
@@ -18497,6 +18497,12 @@ public class ActivityManagerService extends IActivityManager.Stub
        return mEnableModernQueue;
    }
    @Override
    public boolean isProcessFrozen(int pid) {
        enforceCallingPermission(permission.DUMP, "isProcessFrozen()");
        return mOomAdjuster.mCachedAppOptimizer.isProcessFrozen(pid);
    }
    @Override
    @ReasonCode
    public int getBackgroundRestrictionExemptionReason(int uid) {
+1 −0
Original line number Diff line number Diff line
@@ -1113,6 +1113,7 @@ class BroadcastProcessQueue {
        pw.print(" because ");
        pw.print(reasonToString(mRunnableAtReason));
        pw.println();
        pw.print("mProcessCached="); pw.println(mProcessCached);
        pw.increaseIndent();
        if (mActive != null) {
            dumpRecord("ACTIVE", now, pw, mActive, mActiveIndex);
+6 −0
Original line number Diff line number Diff line
@@ -1509,6 +1509,12 @@ public final class CachedAppOptimizer {
        return profile;
    }

    boolean isProcessFrozen(int pid) {
        synchronized (mProcLock) {
            return mFrozenProcesses.contains(pid);
        }
    }

    @VisibleForTesting
    static final class SingleCompactionStats {
        private static final float STATSD_SAMPLE_RATE = 0.1f;