Search in sources :

Example 1 with OnDismissAction

use of com.android.internal.policy.impl.keyguard.KeyguardHostView.OnDismissAction in project android_frameworks_base by ParanoidAndroid.

the class KeyguardActivityLauncher method launchActivityWithAnimation.

public void launchActivityWithAnimation(final Intent intent, boolean showsWhileLocked, final Bundle animation, final Handler worker, final Runnable onStarted) {
    LockPatternUtils lockPatternUtils = getLockPatternUtils();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    boolean isSecure = lockPatternUtils.isSecure();
    if (!isSecure || showsWhileLocked) {
        if (!isSecure) {
            dismissKeyguardOnNextActivity();
        }
        try {
            if (DEBUG)
                Log.d(TAG, String.format("Starting activity for intent %s at %s", intent, SystemClock.uptimeMillis()));
            startActivityForCurrentUser(intent, animation, worker, onStarted);
        } catch (ActivityNotFoundException e) {
            Log.w(TAG, "Activity not found for intent + " + intent.getAction());
        }
    } else {
        // Create a runnable to start the activity and ask the user to enter their
        // credentials.
        KeyguardSecurityCallback callback = getCallback();
        callback.setOnDismissAction(new OnDismissAction() {

            @Override
            public boolean onDismiss() {
                dismissKeyguardOnNextActivity();
                startActivityForCurrentUser(intent, animation, worker, onStarted);
                return true;
            }
        });
        callback.dismiss(false);
    }
}
Also used : ActivityNotFoundException(android.content.ActivityNotFoundException) LockPatternUtils(com.android.internal.widget.LockPatternUtils) OnDismissAction(com.android.internal.policy.impl.keyguard.KeyguardHostView.OnDismissAction)

Aggregations

ActivityNotFoundException (android.content.ActivityNotFoundException)1 OnDismissAction (com.android.internal.policy.impl.keyguard.KeyguardHostView.OnDismissAction)1 LockPatternUtils (com.android.internal.widget.LockPatternUtils)1