diff options
author | Jim Miller <jaggies@google.com> | 2014-08-15 01:01:23 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-12 23:14:48 +0000 |
commit | 989b68e82d7512940a3c7c19c5919e47def8e556 (patch) | |
tree | bde435881898f839dadae5115d202e92bb579abc /core | |
parent | 27f116195c478e2364012fd6d391cf8c8bf39a88 (diff) | |
parent | 66093a9024a0ad88cb9c629457b9d8118071ae74 (diff) | |
download | frameworks_base-989b68e82d7512940a3c7c19c5919e47def8e556.zip frameworks_base-989b68e82d7512940a3c7c19c5919e47def8e556.tar.gz frameworks_base-989b68e82d7512940a3c7c19c5919e47def8e556.tar.bz2 |
Merge changes I77f49fe8,I305e927a into lmp-dev
* changes:
API review - move confirm credential constants from Intent
Revert "Add new intent to prompt user for their device credential."
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/KeyguardManager.java | 46 | ||||
-rw-r--r-- | core/java/android/content/Intent.java | 23 |
2 files changed, 44 insertions, 25 deletions
diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java index db91742a..50e3a10 100644 --- a/core/java/android/app/KeyguardManager.java +++ b/core/java/android/app/KeyguardManager.java @@ -16,6 +16,7 @@ package android.app; +import android.content.Intent; import android.os.Binder; import android.os.RemoteException; import android.os.IBinder; @@ -24,7 +25,7 @@ import android.view.IOnKeyguardExitResult; import android.view.WindowManagerGlobal; /** - * Class that can be used to lock and unlock the keyboard. Get an instance of this + * Class that can be used to lock and unlock the keyboard. Get an instance of this * class by calling {@link android.content.Context#getSystemService(java.lang.String)} * with argument {@link android.content.Context#KEYGUARD_SERVICE}. The * actual class to control the keyboard locking is @@ -34,6 +35,45 @@ 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} * instead; this allows you to seamlessly hide the keyguard as your application @@ -58,7 +98,7 @@ public class KeyguardManager { * * A good place to call this is from {@link android.app.Activity#onResume()} * - * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager} + * Note: This call has no effect while any {@link android.app.admin.DevicePolicyManager} * is enabled that requires a password. * * <p>This method requires the caller to hold the permission @@ -121,7 +161,7 @@ public class KeyguardManager { * permissions be requested. * * Enables you to lock or unlock the keyboard. Get an instance of this class by - * calling {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}. + * calling {@link android.content.Context#getSystemService(java.lang.String) Context.getSystemService()}. * This class is wrapped by {@link android.app.KeyguardManager KeyguardManager}. * @param tag A tag that informally identifies who you are (for debugging who * is disabling he keyguard). diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index abe4f0a..61e105b 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1419,21 +1419,6 @@ public class Intent implements Parcelable, Cloneable { public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"; /** - * Activity Action: Prompt the user to confirm credentials (pin, pattern or password) - * for the current user of the device. Launch this activity using - * {@link android.app.Activity#startActivityForResult(Intent, int)} and check if the - * result is {@link android.app.Activity#RESULT_OK} for a successful response to the - * challenge.<p/> - * This intent is handled by the system at a high priority and applications cannot intercept - * it.<p/> - * You can use {@link android.app.KeyguardManager#isKeyguardSecure()} to determine if the user will be - * prompted. - */ - @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) - public static final String ACTION_CONFIRM_DEVICE_CREDENTIAL = "android.intent.action.CONFIRM_DEVICE_CREDENTIAL"; - - - /** * Specify whether the package should be uninstalled for all users. * @hide because these should not be part of normal application flow. */ @@ -3192,17 +3177,11 @@ public class Intent implements Parcelable, Cloneable { /** * A CharSequence dialog title to provide to the user when used with a - * {@link #ACTION_CHOOSER} or {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}. + * {@link #ACTION_CHOOSER}. */ public static final String EXTRA_TITLE = "android.intent.extra.TITLE"; /** - * A CharSequence description to provide to the user when used with - * {@link #ACTION_CONFIRM_DEVICE_CREDENTIAL}. - */ - public static final String EXTRA_DETAILS = "android.intent.extra.DETAILS"; - - /** * A Parcelable[] of {@link Intent} or * {@link android.content.pm.LabeledIntent} objects as set with * {@link #putExtra(String, Parcelable[])} of additional activities to place |