Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66093a90 authored by Jim Miller's avatar Jim Miller
Browse files

API review - move confirm credential constants from Intent

Moves constants from Intent to KeyguardManager.

Fixes bug 17006280

Change-Id: I77f49fe85850a501e1531d39aad7446c9bca5801
parent 4d64746d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4490,6 +4490,7 @@ package android.app {
  public class KeyguardManager {
    method public deprecated void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult);
    method public android.content.Intent getConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence);
    method public boolean inKeyguardRestrictedInputMode();
    method public boolean isKeyguardLocked();
    method public boolean isKeyguardSecure();
+43 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.app;

import android.content.Intent;
import android.os.Binder;
import android.os.RemoteException;
import android.os.IBinder;
@@ -33,6 +34,45 @@ import android.view.WindowManagerGlobal;
public class KeyguardManager {
    private IWindowManager mWM;

    /**
     * Intent used to prompt user for device credentials.
     * @hide
     */
    public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL =
            "android.app.action.CONFIRM_DEVICE_CREDENTIAL";

    /**
     * A CharSequence dialog title to show to the user when used with a
     * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}.
     * @hide
     */
    public static final String EXTRA_TITLE = "android.app.extra.TITLE";

    /**
     * A CharSequence description to show to the user when used with
     * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}.
     * @hide
     */
    public static final String EXTRA_DESCRIPTION = "android.app.extra.DESCRIPTION";

    /**
     * Get an intent to prompt the user to confirm credentials (pin, pattern or password)
     * for the current user of the device. The caller is expected to launch this activity using
     * {@link android.app.Activity#startActivityForResult(Intent, int)} and check for
     * {@link android.app.Activity#RESULT_OK} if the user successfully completes the challenge.
     *
     * @return the intent for launching the activity or null if no password is required.
     **/
    public Intent getConfirmDeviceCredentialIntent(CharSequence title, CharSequence description) {
        if (!isKeyguardSecure()) return null;
        Intent intent = new Intent(ACTION_CONFIRM_DEVICE_CREDENTIAL);
        intent.putExtra(EXTRA_TITLE, title);
        intent.putExtra(EXTRA_DESCRIPTION, description);
        // For security reasons, only allow this to come from system settings.
        intent.setPackage("com.android.settings");
        return intent;
    }

    /**
     * @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD}
     * and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED}