Merge "Some improvements to process state dumpsys output." into rvc-dev am: 02ed46782e
Change-Id: I0b979b08628fbb511b18f37f5c605c3e89a44d10
This commit is contained in:
@@ -601,6 +601,20 @@ public class ActivityManager {
|
||||
@TestApi
|
||||
public static final int PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 1 << 2;
|
||||
|
||||
// TODO: remove this when development is done.
|
||||
// These are debug flags used between OomAdjuster and AppOpsService to detect and report absence
|
||||
// of the real flags.
|
||||
/** @hide */
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q = 1 << 27;
|
||||
/** @hide */
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q = 1 << 28;
|
||||
/** @hide */
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 1 << 29;
|
||||
/** @hide */
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA = 1 << 30;
|
||||
/** @hide */
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION = 1 << 31;
|
||||
|
||||
/** @hide all capabilities, the ORing of all flags in {@link ProcessCapability}*/
|
||||
@TestApi
|
||||
public static final int PROCESS_CAPABILITY_ALL = PROCESS_CAPABILITY_FOREGROUND_LOCATION
|
||||
@@ -623,6 +637,51 @@ public class ActivityManager {
|
||||
public static final int PROCESS_CAPABILITY_ALL_IMPLICIT = PROCESS_CAPABILITY_FOREGROUND_CAMERA
|
||||
| PROCESS_CAPABILITY_FOREGROUND_MICROPHONE;
|
||||
|
||||
/**
|
||||
* Print capability bits in human-readable form.
|
||||
* @hide
|
||||
*/
|
||||
public static void printCapabilitiesSummary(PrintWriter pw, @ProcessCapability int caps) {
|
||||
pw.print((caps & PROCESS_CAPABILITY_FOREGROUND_LOCATION) != 0 ? 'L' : '-');
|
||||
pw.print((caps & PROCESS_CAPABILITY_FOREGROUND_CAMERA) != 0 ? 'C' : '-');
|
||||
pw.print((caps & PROCESS_CAPABILITY_FOREGROUND_MICROPHONE) != 0 ? 'M' : '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* Print capability bits in human-readable form.
|
||||
* @hide
|
||||
*/
|
||||
public static void printCapabilitiesFull(PrintWriter pw, @ProcessCapability int caps) {
|
||||
printCapabilitiesSummary(pw, caps);
|
||||
if ((caps & DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION) != 0) {
|
||||
pw.print(" !L");
|
||||
}
|
||||
if ((caps & DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA) != 0) {
|
||||
pw.print(" !C");
|
||||
}
|
||||
if ((caps & DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q) != 0) {
|
||||
pw.print(" !Cq");
|
||||
}
|
||||
if ((caps & DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE) != 0) {
|
||||
pw.print(" !M");
|
||||
}
|
||||
if ((caps & DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q) != 0) {
|
||||
pw.print(" !Mq");
|
||||
}
|
||||
final int remain = caps & ~(PROCESS_CAPABILITY_FOREGROUND_LOCATION
|
||||
| PROCESS_CAPABILITY_FOREGROUND_CAMERA
|
||||
| PROCESS_CAPABILITY_FOREGROUND_MICROPHONE
|
||||
| DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION
|
||||
| DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA
|
||||
| DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q
|
||||
| DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE
|
||||
| DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q);
|
||||
if (remain != 0) {
|
||||
pw.print('+');
|
||||
pw.print(remain);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: If PROCESS_STATEs are added, then new fields must be added
|
||||
// to frameworks/base/core/proto/android/app/enums.proto and the following method must
|
||||
// be updated to correctly map between them.
|
||||
|
||||
@@ -11083,18 +11083,22 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
|
||||
void dumpLruEntryLocked(PrintWriter pw, int index, ProcessRecord proc, String prefix) {
|
||||
pw.print(prefix);
|
||||
pw.print("#");
|
||||
pw.print('#');
|
||||
if (index < 10) {
|
||||
pw.print(' ');
|
||||
}
|
||||
pw.print(index);
|
||||
pw.print(": ");
|
||||
pw.print(ProcessList.makeOomAdjString(proc.setAdj, false));
|
||||
pw.print(" ");
|
||||
pw.print(' ');
|
||||
pw.print(ProcessList.makeProcStateString(proc.getCurProcState()));
|
||||
pw.print(" ");
|
||||
pw.print(' ');
|
||||
ActivityManager.printCapabilitiesSummary(pw, proc.curCapability);
|
||||
pw.print(' ');
|
||||
pw.print(proc.toShortString());
|
||||
pw.print(" ");
|
||||
if (proc.hasActivitiesOrRecentTasks() || proc.hasClientActivities()
|
||||
|| proc.treatLikeActivity) {
|
||||
pw.print(" activity=");
|
||||
pw.print(" act:");
|
||||
boolean printed = false;
|
||||
if (proc.hasActivities()) {
|
||||
pw.print("activities");
|
||||
@@ -12559,7 +12563,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
char schedGroup;
|
||||
switch (r.setSchedGroup) {
|
||||
case ProcessList.SCHED_GROUP_BACKGROUND:
|
||||
schedGroup = 'B';
|
||||
schedGroup = 'b';
|
||||
break;
|
||||
case ProcessList.SCHED_GROUP_DEFAULT:
|
||||
schedGroup = 'F';
|
||||
@@ -12570,6 +12574,9 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
case ProcessList.SCHED_GROUP_RESTRICTED:
|
||||
schedGroup = 'R';
|
||||
break;
|
||||
case ProcessList.SCHED_GROUP_TOP_APP_BOUND:
|
||||
schedGroup = 'B';
|
||||
break;
|
||||
default:
|
||||
schedGroup = '?';
|
||||
break;
|
||||
@@ -12597,7 +12604,10 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
pw.print(foreground);
|
||||
pw.print('/');
|
||||
pw.print(procState);
|
||||
pw.print(" trm:");
|
||||
pw.print(' ');
|
||||
ActivityManager.printCapabilitiesSummary(pw, r.curCapability);
|
||||
pw.print(' ');
|
||||
pw.print(" t:");
|
||||
if (r.trimMemoryLevel < 10) pw.print(' ');
|
||||
pw.print(r.trimMemoryLevel);
|
||||
pw.print(' ');
|
||||
|
||||
@@ -151,15 +151,6 @@ public final class OomAdjuster {
|
||||
@EnabledAfter(targetSdkVersion=android.os.Build.VERSION_CODES.Q)
|
||||
static final long CAMERA_MICROPHONE_CAPABILITY_CHANGE_ID = 136219221L;
|
||||
|
||||
// TODO: remove this when development is done.
|
||||
// These are debug flags used between OomAdjuster and AppOpsService to detect and report absence
|
||||
// of the real flags.
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q = 1 << 27;
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q = 1 << 28;
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 1 << 29;
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA = 1 << 30;
|
||||
public static final int DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION = 1 << 31;
|
||||
|
||||
/**
|
||||
* For some direct access we need to power manager.
|
||||
*/
|
||||
@@ -1506,8 +1497,9 @@ public final class OomAdjuster {
|
||||
//lost the capability, use temp location capability to mark this case.
|
||||
//TODO: remove this block when development is done.
|
||||
capabilityFromFGS |=
|
||||
(fgsType & FOREGROUND_SERVICE_TYPE_LOCATION)
|
||||
!= 0 ? DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION : 0;
|
||||
(fgsType & FOREGROUND_SERVICE_TYPE_LOCATION) != 0
|
||||
? ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION
|
||||
: 0;
|
||||
}
|
||||
if (s.mAllowWhileInUsePermissionInFgs) {
|
||||
boolean enabled = false;
|
||||
@@ -1520,22 +1512,22 @@ public final class OomAdjuster {
|
||||
capabilityFromFGS |=
|
||||
(fgsType & FOREGROUND_SERVICE_TYPE_CAMERA)
|
||||
!= 0 ? PROCESS_CAPABILITY_FOREGROUND_CAMERA
|
||||
: DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA;
|
||||
: ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA;
|
||||
capabilityFromFGS |=
|
||||
(fgsType & FOREGROUND_SERVICE_TYPE_MICROPHONE)
|
||||
!= 0 ? PROCESS_CAPABILITY_FOREGROUND_MICROPHONE
|
||||
: DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE;
|
||||
: ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE;
|
||||
} else {
|
||||
// Remove fgsType check and assign PROCESS_CAPABILITY_FOREGROUND_CAMERA
|
||||
// and MICROPHONE when finish debugging.
|
||||
capabilityFromFGS |=
|
||||
(fgsType & FOREGROUND_SERVICE_TYPE_CAMERA)
|
||||
!= 0 ? PROCESS_CAPABILITY_FOREGROUND_CAMERA
|
||||
: DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q;
|
||||
: ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q;
|
||||
capabilityFromFGS |=
|
||||
(fgsType & FOREGROUND_SERVICE_TYPE_MICROPHONE)
|
||||
!= 0 ? PROCESS_CAPABILITY_FOREGROUND_MICROPHONE
|
||||
: DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q;
|
||||
: ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -980,7 +980,7 @@ public final class ProcessList {
|
||||
return buildOomTag("vis", "vis", " ", setAdj,
|
||||
ProcessList.VISIBLE_APP_ADJ, compact);
|
||||
} else if (setAdj >= ProcessList.FOREGROUND_APP_ADJ) {
|
||||
return buildOomTag("fore ", "fore", null, setAdj,
|
||||
return buildOomTag("fg ", "fg ", " ", setAdj,
|
||||
ProcessList.FOREGROUND_APP_ADJ, compact);
|
||||
} else if (setAdj >= ProcessList.PERSISTENT_SERVICE_ADJ) {
|
||||
return buildOomTag("psvc ", "psvc", null, setAdj,
|
||||
|
||||
@@ -431,16 +431,46 @@ class ProcessRecord implements WindowProcessListener {
|
||||
pw.print(" nextPssTime=");
|
||||
TimeUtils.formatDuration(nextPssTime, nowUptime, pw);
|
||||
pw.println();
|
||||
pw.print(prefix); pw.print("adjSeq="); pw.print(adjSeq);
|
||||
pw.print(" lruSeq="); pw.print(lruSeq);
|
||||
pw.print(" lastPss="); DebugUtils.printSizeValue(pw, lastPss*1024);
|
||||
pw.print(" lastSwapPss="); DebugUtils.printSizeValue(pw, lastSwapPss*1024);
|
||||
pw.print(" lastCachedPss="); DebugUtils.printSizeValue(pw, lastCachedPss*1024);
|
||||
pw.print(" lastCachedSwapPss="); DebugUtils.printSizeValue(pw, lastCachedSwapPss*1024);
|
||||
pw.print(" lastRss="); DebugUtils.printSizeValue(pw, mLastRss * 1024);
|
||||
pw.print(prefix); pw.print("lastPss="); DebugUtils.printSizeValue(pw, lastPss * 1024);
|
||||
pw.print(" lastSwapPss="); DebugUtils.printSizeValue(pw, lastSwapPss * 1024);
|
||||
pw.print(" lastCachedPss="); DebugUtils.printSizeValue(pw, lastCachedPss * 1024);
|
||||
pw.print(" lastCachedSwapPss="); DebugUtils.printSizeValue(pw,
|
||||
lastCachedSwapPss * 1024);
|
||||
pw.print(" lastRss="); DebugUtils.printSizeValue(pw, mLastRss * 1024);
|
||||
pw.println();
|
||||
pw.print(prefix); pw.print("procStateMemTracker: ");
|
||||
procStateMemTracker.dumpLine(pw);
|
||||
pw.print(prefix); pw.print("adjSeq="); pw.print(adjSeq);
|
||||
pw.print(" lruSeq="); pw.println(lruSeq);
|
||||
pw.print(prefix); pw.print("oom adj: max="); pw.print(maxAdj);
|
||||
pw.print(" curRaw="); pw.print(mCurRawAdj);
|
||||
pw.print(" setRaw="); pw.print(setRawAdj);
|
||||
pw.print(" cur="); pw.print(curAdj);
|
||||
pw.print(" set="); pw.println(setAdj);
|
||||
pw.print(prefix); pw.print("lastCompactTime="); pw.print(lastCompactTime);
|
||||
pw.print(" lastCompactAction="); pw.println(lastCompactAction);
|
||||
pw.print(prefix); pw.print("mCurSchedGroup="); pw.print(mCurSchedGroup);
|
||||
pw.print(" setSchedGroup="); pw.print(setSchedGroup);
|
||||
pw.print(" systemNoUi="); pw.print(systemNoUi);
|
||||
pw.print(" trimMemoryLevel="); pw.println(trimMemoryLevel);
|
||||
pw.print(prefix); pw.print("curProcState="); pw.print(getCurProcState());
|
||||
pw.print(" mRepProcState="); pw.print(mRepProcState);
|
||||
pw.print(" pssProcState="); pw.print(pssProcState);
|
||||
pw.print(" setProcState="); pw.print(setProcState);
|
||||
pw.print(" lastStateTime=");
|
||||
TimeUtils.formatDuration(lastStateTime, nowUptime, pw);
|
||||
pw.println();
|
||||
pw.print(prefix); pw.print("curCapability=");
|
||||
ActivityManager.printCapabilitiesFull(pw, curCapability);
|
||||
pw.print(" setCapability=");
|
||||
ActivityManager.printCapabilitiesFull(pw, setCapability);
|
||||
pw.println();
|
||||
if (hasShownUi || mPendingUiClean || hasAboveClient || treatLikeActivity) {
|
||||
pw.print(prefix); pw.print("hasShownUi="); pw.print(hasShownUi);
|
||||
pw.print(" pendingUiClean="); pw.print(mPendingUiClean);
|
||||
pw.print(" hasAboveClient="); pw.print(hasAboveClient);
|
||||
pw.print(" treatLikeActivity="); pw.println(treatLikeActivity);
|
||||
}
|
||||
pw.print(prefix); pw.print("cached="); pw.print(mCached);
|
||||
pw.print(" empty="); pw.println(empty);
|
||||
if (serviceb) {
|
||||
@@ -451,32 +481,6 @@ class ProcessRecord implements WindowProcessListener {
|
||||
pw.print(prefix); pw.print("notCachedSinceIdle="); pw.print(notCachedSinceIdle);
|
||||
pw.print(" initialIdlePss="); pw.println(initialIdlePss);
|
||||
}
|
||||
pw.print(prefix); pw.print("oom: max="); pw.print(maxAdj);
|
||||
pw.print(" curRaw="); pw.print(mCurRawAdj);
|
||||
pw.print(" setRaw="); pw.print(setRawAdj);
|
||||
pw.print(" cur="); pw.print(curAdj);
|
||||
pw.print(" set="); pw.println(setAdj);
|
||||
pw.print(prefix); pw.print("lastCompactTime="); pw.print(lastCompactTime);
|
||||
pw.print(" lastCompactAction="); pw.print(lastCompactAction);
|
||||
pw.print(prefix); pw.print("mCurSchedGroup="); pw.print(mCurSchedGroup);
|
||||
pw.print(" setSchedGroup="); pw.print(setSchedGroup);
|
||||
pw.print(" systemNoUi="); pw.print(systemNoUi);
|
||||
pw.print(" trimMemoryLevel="); pw.println(trimMemoryLevel);
|
||||
pw.print(prefix); pw.print("curProcState="); pw.print(getCurProcState());
|
||||
pw.print(" mRepProcState="); pw.print(mRepProcState);
|
||||
pw.print(" pssProcState="); pw.print(pssProcState);
|
||||
pw.print(" setProcState="); pw.print(setProcState);
|
||||
pw.print(" curCapability="); pw.print(curCapability);
|
||||
pw.print(" setCapability="); pw.print(setCapability);
|
||||
pw.print(" lastStateTime=");
|
||||
TimeUtils.formatDuration(lastStateTime, nowUptime, pw);
|
||||
pw.println();
|
||||
if (hasShownUi || mPendingUiClean || hasAboveClient || treatLikeActivity) {
|
||||
pw.print(prefix); pw.print("hasShownUi="); pw.print(hasShownUi);
|
||||
pw.print(" pendingUiClean="); pw.print(mPendingUiClean);
|
||||
pw.print(" hasAboveClient="); pw.print(hasAboveClient);
|
||||
pw.print(" treatLikeActivity="); pw.println(treatLikeActivity);
|
||||
}
|
||||
if (connectionService != null || connectionGroup != 0) {
|
||||
pw.print(prefix); pw.print("connectionGroup="); pw.print(connectionGroup);
|
||||
pw.print(" Importance="); pw.print(connectionImportance);
|
||||
|
||||
@@ -66,11 +66,11 @@ import static android.content.Intent.EXTRA_REPLACING;
|
||||
import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS;
|
||||
import static android.content.pm.PermissionInfo.PROTECTION_FLAG_APPOP;
|
||||
|
||||
import static com.android.server.am.OomAdjuster.DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA;
|
||||
import static com.android.server.am.OomAdjuster.DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q;
|
||||
import static com.android.server.am.OomAdjuster.DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION;
|
||||
import static com.android.server.am.OomAdjuster.DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE;
|
||||
import static com.android.server.am.OomAdjuster.DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q;
|
||||
import static android.app.ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA;
|
||||
import static android.app.ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_CAMERA_Q;
|
||||
import static android.app.ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_LOCATION;
|
||||
import static android.app.ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE;
|
||||
import static android.app.ActivityManager.DEBUG_PROCESS_CAPABILITY_FOREGROUND_MICROPHONE_Q;
|
||||
import static com.android.server.appop.AppOpsService.ModeCallback.ALL_OPS;
|
||||
|
||||
import static java.lang.Long.max;
|
||||
|
||||
Reference in New Issue
Block a user