Java Code Examples for android.app.ActivityManager#PROCESS_STATE_SERVICE

The following examples show how to use android.app.ActivityManager#PROCESS_STATE_SERVICE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessList.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public static String makeProcStateString(int curProcState) {
    String procState;
    switch (curProcState) {
        case ActivityManager.PROCESS_STATE_PERSISTENT:
            procState = "PER ";
            break;
        case ActivityManager.PROCESS_STATE_PERSISTENT_UI:
            procState = "PERU";
            break;
        case ActivityManager.PROCESS_STATE_TOP:
            procState = "TOP ";
            break;
        case ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE:
            procState = "FGS ";
            break;
        case ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE:
            procState = "BFGS";
            break;
        case ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND:
            procState = "IMPF";
            break;
        case ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND:
            procState = "IMPB";
            break;
        case ActivityManager.PROCESS_STATE_TRANSIENT_BACKGROUND:
            procState = "TRNB";
            break;
        case ActivityManager.PROCESS_STATE_BACKUP:
            procState = "BKUP";
            break;
        case ActivityManager.PROCESS_STATE_SERVICE:
            procState = "SVC ";
            break;
        case ActivityManager.PROCESS_STATE_RECEIVER:
            procState = "RCVR";
            break;
        case ActivityManager.PROCESS_STATE_TOP_SLEEPING:
            procState = "TPSL";
            break;
        case ActivityManager.PROCESS_STATE_HEAVY_WEIGHT:
            procState = "HVY ";
            break;
        case ActivityManager.PROCESS_STATE_HOME:
            procState = "HOME";
            break;
        case ActivityManager.PROCESS_STATE_LAST_ACTIVITY:
            procState = "LAST";
            break;
        case ActivityManager.PROCESS_STATE_CACHED_ACTIVITY:
            procState = "CAC ";
            break;
        case ActivityManager.PROCESS_STATE_CACHED_ACTIVITY_CLIENT:
            procState = "CACC";
            break;
        case ActivityManager.PROCESS_STATE_CACHED_RECENT:
            procState = "CRE ";
            break;
        case ActivityManager.PROCESS_STATE_CACHED_EMPTY:
            procState = "CEM ";
            break;
        case ActivityManager.PROCESS_STATE_NONEXISTENT:
            procState = "NONE";
            break;
        default:
            procState = "??";
            break;
    }
    return procState;
}
 
Example 2
Source File: ProcessList.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public static int makeProcStateProtoEnum(int curProcState) {
    switch (curProcState) {
        case ActivityManager.PROCESS_STATE_PERSISTENT:
            return AppProtoEnums.PROCESS_STATE_PERSISTENT;
        case ActivityManager.PROCESS_STATE_PERSISTENT_UI:
            return AppProtoEnums.PROCESS_STATE_PERSISTENT_UI;
        case ActivityManager.PROCESS_STATE_TOP:
            return AppProtoEnums.PROCESS_STATE_TOP;
        case ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE:
            return AppProtoEnums.PROCESS_STATE_BOUND_FOREGROUND_SERVICE;
        case ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE:
            return AppProtoEnums.PROCESS_STATE_FOREGROUND_SERVICE;
        case ActivityManager.PROCESS_STATE_TOP_SLEEPING:
            return AppProtoEnums.PROCESS_STATE_TOP_SLEEPING;
        case ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND:
            return AppProtoEnums.PROCESS_STATE_IMPORTANT_FOREGROUND;
        case ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND:
            return AppProtoEnums.PROCESS_STATE_IMPORTANT_BACKGROUND;
        case ActivityManager.PROCESS_STATE_TRANSIENT_BACKGROUND:
            return AppProtoEnums.PROCESS_STATE_TRANSIENT_BACKGROUND;
        case ActivityManager.PROCESS_STATE_BACKUP:
            return AppProtoEnums.PROCESS_STATE_BACKUP;
        case ActivityManager.PROCESS_STATE_HEAVY_WEIGHT:
            return AppProtoEnums.PROCESS_STATE_HEAVY_WEIGHT;
        case ActivityManager.PROCESS_STATE_SERVICE:
            return AppProtoEnums.PROCESS_STATE_SERVICE;
        case ActivityManager.PROCESS_STATE_RECEIVER:
            return AppProtoEnums.PROCESS_STATE_RECEIVER;
        case ActivityManager.PROCESS_STATE_HOME:
            return AppProtoEnums.PROCESS_STATE_HOME;
        case ActivityManager.PROCESS_STATE_LAST_ACTIVITY:
            return AppProtoEnums.PROCESS_STATE_LAST_ACTIVITY;
        case ActivityManager.PROCESS_STATE_CACHED_ACTIVITY:
            return AppProtoEnums.PROCESS_STATE_CACHED_ACTIVITY;
        case ActivityManager.PROCESS_STATE_CACHED_ACTIVITY_CLIENT:
            return AppProtoEnums.PROCESS_STATE_CACHED_ACTIVITY_CLIENT;
        case ActivityManager.PROCESS_STATE_CACHED_RECENT:
            return AppProtoEnums.PROCESS_STATE_CACHED_RECENT;
        case ActivityManager.PROCESS_STATE_CACHED_EMPTY:
            return AppProtoEnums.PROCESS_STATE_CACHED_EMPTY;
        case ActivityManager.PROCESS_STATE_NONEXISTENT:
            return AppProtoEnums.PROCESS_STATE_NONEXISTENT;
        case ActivityManager.PROCESS_STATE_UNKNOWN:
            return AppProtoEnums.PROCESS_STATE_UNKNOWN;
        default:
            return AppProtoEnums.PROCESS_STATE_UNKNOWN_TO_PROTO;
    }
}