Java Code Examples for android.app.activitymanager#PROCESS_STATE_BOUND_FOREGROUND_SERVICE

The following examples show how to use android.app.activitymanager#PROCESS_STATE_BOUND_FOREGROUND_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: JobSchedulerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
void updateUidState(int uid, int procState) {
    synchronized (mLock) {
        if (procState == ActivityManager.PROCESS_STATE_TOP) {
            // Only use this if we are exactly the top app.  All others can live
            // with just the foreground priority.  This means that persistent processes
            // can never be the top app priority...  that is fine.
            mUidPriorityOverride.put(uid, JobInfo.PRIORITY_TOP_APP);
        } else if (procState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) {
            mUidPriorityOverride.put(uid, JobInfo.PRIORITY_FOREGROUND_APP);
        } else {
            mUidPriorityOverride.delete(uid);
        }
    }
}
 
Example 2
Source File: PowerManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private boolean setWakeLockDisabledStateLocked(WakeLock wakeLock) {
    if ((wakeLock.mFlags & PowerManager.WAKE_LOCK_LEVEL_MASK)
            == PowerManager.PARTIAL_WAKE_LOCK) {
        boolean disabled = false;
        final int appid = UserHandle.getAppId(wakeLock.mOwnerUid);
        if (appid >= Process.FIRST_APPLICATION_UID) {
            // Cached inactive processes are never allowed to hold wake locks.
            if (mConstants.NO_CACHED_WAKE_LOCKS) {
                disabled = !wakeLock.mUidState.mActive &&
                        wakeLock.mUidState.mProcState
                                != ActivityManager.PROCESS_STATE_NONEXISTENT &&
                        wakeLock.mUidState.mProcState > ActivityManager.PROCESS_STATE_RECEIVER;
            }
            if (mDeviceIdleMode) {
                // If we are in idle mode, we will also ignore all partial wake locks that are
                // for application uids that are not whitelisted.
                final UidState state = wakeLock.mUidState;
                if (Arrays.binarySearch(mDeviceIdleWhitelist, appid) < 0 &&
                        Arrays.binarySearch(mDeviceIdleTempWhitelist, appid) < 0 &&
                        state.mProcState != ActivityManager.PROCESS_STATE_NONEXISTENT &&
                        state.mProcState >
                                ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) {
                    disabled = true;
                }
            }
        }
        if (wakeLock.mDisabled != disabled) {
            wakeLock.mDisabled = disabled;
            return true;
        }
    }
    return false;
}
 
Example 3
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 4
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;
    }
}