Java Code Examples for android.app.ActivityManager#LOCK_TASK_MODE_NONE

The following examples show how to use android.app.ActivityManager#LOCK_TASK_MODE_NONE . 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: KioskModeActivity.java    From android-testdpc with Apache License 2.0 6 votes vote down vote up
@Override
protected void onStart() {
    super.onStart();

    // start lock task mode if it's not already active
    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    // ActivityManager.getLockTaskModeState api is not available in pre-M.
    if (Util.SDK_INT < VERSION_CODES.M) {
        if (!am.isInLockTaskMode()) {
            startLockTask();
        }
    } else {
        if (am.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_NONE) {
            startLockTask();
        }
    }
}
 
Example 2
Source File: LockedActivity.java    From cosu with Apache License 2.0 5 votes vote down vote up
@Override
protected void onStart() {
    super.onStart();

    // start lock task mode if its not already active
    if(mDevicePolicyManager.isLockTaskPermitted(this.getPackageName())){
        ActivityManager am = (ActivityManager) getSystemService(
                Context.ACTIVITY_SERVICE);
        if(am.getLockTaskModeState() ==
                ActivityManager.LOCK_TASK_MODE_NONE) {
            startLockTask();
        }
    }
}
 
Example 3
Source File: LockedActivity.java    From cosu with Apache License 2.0 5 votes vote down vote up
@Override
protected void onStart() {
    super.onStart();

    // Start lock task mode if its not already active
    if(mDevicePolicyManager.isLockTaskPermitted(this.getPackageName())){
        ActivityManager am = (ActivityManager) getSystemService(
                Context.ACTIVITY_SERVICE);
        if (am.getLockTaskModeState() ==
                ActivityManager.LOCK_TASK_MODE_NONE) {
            startLockTask();
        }
    }
}
 
Example 4
Source File: ModHwKeys.java    From GravityBox with Apache License 2.0 4 votes vote down vote up
private static boolean isTaskLocked() {
    return getActivityManager().getLockTaskModeState() !=
            ActivityManager.LOCK_TASK_MODE_NONE;
}