@Implements(value=android.app.KeyguardManager.class) public class ShadowKeyguardManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ShadowKeyguardManager.ShadowKeyguardLock
An implementation of
KeyguardManager#KeyguardLock , for use in tests. |
Constructor and Description |
---|
ShadowKeyguardManager() |
Modifier and Type | Method and Description |
---|---|
protected Intent |
createConfirmFactoryResetCredentialIntent(CharSequence title,
CharSequence description,
CharSequence alternateButtonLabel)
Returns the intent set via
setConfirmFactoryResetCredentialIntent(Intent) , otherwise null. |
protected boolean |
inKeyguardRestrictedInputMode()
For tests, returns the value set via
setinRestrictedInputMode(boolean) , or false by default. |
protected boolean |
isDeviceLocked() |
protected boolean |
isDeviceLocked(int userId) |
protected boolean |
isDeviceSecure()
For tests on Android >=M, returns the value set by
setIsDeviceSecure(boolean) , or false by default. |
protected boolean |
isDeviceSecure(int userId)
For tests on Android >=M, returns the value set by
setIsDeviceSecure(int, boolean) , or false by default. |
protected boolean |
isKeyguardLocked()
For tests, returns the value set via
setKeyguardLocked(boolean) , or false by default. |
protected boolean |
isKeyguardSecure()
For tests, returns the value set by
setIsKeyguardSecure(boolean) , or false by default. |
protected KeyguardManager.KeyguardLock |
newKeyguardLock(String tag)
For tests, returns a
ShadowKeyguardManager.ShadowKeyguardLock . |
protected void |
requestDismissKeyguard(Activity activity,
KeyguardManager.KeyguardDismissCallback callback) |
static void |
reset() |
void |
setConfirmFactoryResetCredentialIntent(Intent intent)
For tests on Android >= O MR1, sets the value to be returned by
createConfirmFactoryResetCredentialIntent(CharSequence,CharSequence,CharSequence) . |
void |
setinRestrictedInputMode(boolean restricted)
Deprecated.
use
setInRestrictedInputMode(boolean) instead |
void |
setInRestrictedInputMode(boolean restricted)
Sets the value to be returned by
KeyguardManager.inKeyguardRestrictedInputMode() . |
void |
setIsDeviceLocked(boolean isDeviceLocked)
For tests on Android >=L MR1, sets the value to be returned by
isDeviceLocked() . |
void |
setIsDeviceLocked(int userId,
boolean isLocked)
For tests on Android >= L MR1, sets the value to be returned by
isDeviceLocked(int) . |
void |
setIsDeviceSecure(boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned by
isDeviceSecure() . |
void |
setIsDeviceSecure(int userId,
boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned by
isDeviceSecure(int) . |
void |
setIsKeyguardSecure(boolean secure)
Sets the value to be returned by
isKeyguardSecure() . |
void |
setKeyguardLocked(boolean isKeyguardLocked)
Sets whether the device keyguard is locked or not.
|
@Implementation protected boolean inKeyguardRestrictedInputMode()
For tests, returns the value set via setinRestrictedInputMode(boolean)
, or false
by default.
setInRestrictedInputMode(boolean)
@Implementation(minSdk=26) protected void requestDismissKeyguard(Activity activity, KeyguardManager.KeyguardDismissCallback callback)
@Implementation protected boolean isKeyguardLocked()
For tests, returns the value set via setKeyguardLocked(boolean)
, or false
by default.
setKeyguardLocked(boolean)
public void setKeyguardLocked(boolean isKeyguardLocked)
Sets whether the device keyguard is locked or not. This affects the value to be returned by isKeyguardLocked()
and also invokes callbacks set in KeyguardManager#requestDismissKeyguard()
.
isKeyguardLocked
- true to lock the keyguard. If a KeyguardDismissCallback is set will fire KeyguardManager.KeyguardDismissCallback.onDismissCancelled()
or false to unlock and dismiss the keyguard firing KeyguardManager.KeyguardDismissCallback.onDismissSucceeded()
if a KeyguardDismissCallback is set.@Implementation protected KeyguardManager.KeyguardLock newKeyguardLock(String tag)
For tests, returns a ShadowKeyguardManager.ShadowKeyguardLock
.
ShadowKeyguardManager.ShadowKeyguardLock
@Deprecated public void setinRestrictedInputMode(boolean restricted)
setInRestrictedInputMode(boolean)
insteadSets the value to be returned by KeyguardManager.inKeyguardRestrictedInputMode()
.
public void setInRestrictedInputMode(boolean restricted)
Sets the value to be returned by KeyguardManager.inKeyguardRestrictedInputMode()
.
@Implementation protected boolean isKeyguardSecure()
For tests, returns the value set by setIsKeyguardSecure(boolean)
, or false
by default.
setIsKeyguardSecure(boolean)
public void setIsKeyguardSecure(boolean secure)
Sets the value to be returned by isKeyguardSecure()
.
isKeyguardSecure()
@Implementation(minSdk=23) protected boolean isDeviceSecure()
For tests on Android >=M, returns the value set by setIsDeviceSecure(boolean)
, or false
by default.
setIsDeviceSecure(boolean)
public void setIsDeviceSecure(boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned by isDeviceSecure()
.
isDeviceSecure()
@Implementation(minSdk=23) protected boolean isDeviceSecure(int userId)
For tests on Android >=M, returns the value set by setIsDeviceSecure(int, boolean)
, or false
by default.
setIsDeviceSecure(int, boolean)
public void setIsDeviceSecure(int userId, boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned by isDeviceSecure(int)
.
isDeviceSecure(int)
public void setIsDeviceLocked(boolean isDeviceLocked)
For tests on Android >=L MR1, sets the value to be returned by isDeviceLocked()
.
isDeviceLocked()
@Implementation(minSdk=22) protected boolean isDeviceLocked()
false
by default, or the value passed to setIsDeviceLocked(boolean)
.isDeviceLocked()
public void setIsDeviceLocked(int userId, boolean isLocked)
For tests on Android >= L MR1, sets the value to be returned by isDeviceLocked(int)
.
isDeviceLocked(int)
@Implementation(minSdk=22) protected boolean isDeviceLocked(int userId)
public void setConfirmFactoryResetCredentialIntent(Intent intent)
For tests on Android >= O MR1, sets the value to be returned by createConfirmFactoryResetCredentialIntent(CharSequence,CharSequence,CharSequence)
.
@Implementation(minSdk=27) protected Intent createConfirmFactoryResetCredentialIntent(CharSequence title, CharSequence description, CharSequence alternateButtonLabel)
Returns the intent set via setConfirmFactoryResetCredentialIntent(Intent)
, otherwise null.
@Resetter public static void reset()