Merge "Allow tests to query processes frozen state."
This commit is contained in:
committed by
Android (Google) Code Review
commit
2fb90954b5
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user