Example usage for android.app Activity stopLockTask

List of usage examples for android.app Activity stopLockTask

Introduction

In this page you can find the example usage for android.app Activity stopLockTask.

Prototype

public void stopLockTask() 

Source Link

Document

Stop the current task from being locked.

Usage

From source file:org.wso2.iot.agent.services.kiosk.KioskAlarmReceiver.java

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override//from  w w w .  j a v a2 s. c o  m
public void onReceive(Context context, Intent intent) {
    Intent service;
    Activity currentlyLockedActivity;
    if (intent.getBooleanExtra(Constants.Operation.ENABLE_LOCK, false)) {
        Log.d(TAG, "OnReceive EnableLock false.");
        currentlyLockedActivity = new KioskActivity();
        currentlyLockedActivity.stopLockTask();
        service = new Intent(context, KioskLockDownService.class);
        buildAlarm(context, false, false);
        startWakefulService(context, service);
    } else if (!intent.getBooleanExtra(Constants.Operation.ENABLE_LOCK, true)) {
        Log.d(TAG, "OnReceive enableLock true");
        currentlyLockedActivity = new KioskRestrictionActivity();
        currentlyLockedActivity.stopLockTask();
        service = new Intent(context, KioskUnlockService.class);
        buildAlarm(context, true, false);
        startWakefulService(context, service);
    }
}