Package org.robolectric.shadows
Class ShadowKeyguardManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowKeyguardManager
-
@Implements(android.app.KeyguardManager.class) public class ShadowKeyguardManager extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShadowKeyguardManager.ShadowKeyguardLock
An implementation ofKeyguardManager.KeyguardLock
, for use in tests.
-
Constructor Summary
Constructors Constructor Description ShadowKeyguardManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Intent
createConfirmFactoryResetCredentialIntent(CharSequence title, CharSequence description, CharSequence alternateButtonLabel)
Returns the intent set viasetConfirmFactoryResetCredentialIntent(Intent)
, otherwise null.protected boolean
inKeyguardRestrictedInputMode()
For tests, returns the value set viasetinRestrictedInputMode(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 bysetIsDeviceSecure(boolean)
, or false by default.protected boolean
isDeviceSecure(int userId)
For tests on Android >=M, returns the value set bysetIsDeviceSecure(int, boolean)
, or false by default.protected boolean
isKeyguardLocked()
For tests, returns the value set viasetKeyguardLocked(boolean)
, or false by default.protected boolean
isKeyguardSecure()
For tests, returns the value set bysetIsKeyguardSecure(boolean)
, or false by default.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 bycreateConfirmFactoryResetCredentialIntent(CharSequence,CharSequence,CharSequence)
.void
setinRestrictedInputMode(boolean restricted)
Deprecated.usesetInRestrictedInputMode(boolean)
insteadvoid
setInRestrictedInputMode(boolean restricted)
Sets the value to be returned byKeyguardManager.inKeyguardRestrictedInputMode()
.void
setIsDeviceLocked(boolean isDeviceLocked)
For tests on Android >=L MR1, sets the value to be returned byisDeviceLocked()
.void
setIsDeviceLocked(int userId, boolean isLocked)
For tests on Android >= L MR1, sets the value to be returned byisDeviceLocked(int)
.void
setIsDeviceSecure(boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned byisDeviceSecure()
.void
setIsDeviceSecure(int userId, boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned byisDeviceSecure(int)
.void
setIsKeyguardSecure(boolean secure)
Sets the value to be returned byisKeyguardSecure()
.void
setKeyguardLocked(boolean isKeyguardLocked)
Sets whether the device keyguard is locked or not.
-
-
-
Method Detail
-
inKeyguardRestrictedInputMode
@Implementation protected boolean inKeyguardRestrictedInputMode()
For tests, returns the value set viasetinRestrictedInputMode(boolean)
, or false by default.- See Also:
setInRestrictedInputMode(boolean)
-
requestDismissKeyguard
@Implementation(minSdk=26) protected void requestDismissKeyguard(Activity activity, KeyguardManager.KeyguardDismissCallback callback)
-
isKeyguardLocked
@Implementation protected boolean isKeyguardLocked()
For tests, returns the value set viasetKeyguardLocked(boolean)
, or false by default.- See Also:
setKeyguardLocked(boolean)
-
setKeyguardLocked
public void setKeyguardLocked(boolean isKeyguardLocked)
Sets whether the device keyguard is locked or not. This affects the value to be returned byisKeyguardLocked()
and also invokes callbacks set inKeyguardManager.requestDismissKeyguard(Activity, KeyguardDismissCallback)
()}.- Parameters:
isKeyguardLocked
- true to lock the keyguard. If a KeyguardDismissCallback is set will fireKeyguardManager.KeyguardDismissCallback.onDismissCancelled()
or false to unlock and dismiss the keyguard firingKeyguardManager.KeyguardDismissCallback.onDismissSucceeded()
if a KeyguardDismissCallback is set.
-
setinRestrictedInputMode
@Deprecated public void setinRestrictedInputMode(boolean restricted)
Deprecated.usesetInRestrictedInputMode(boolean)
insteadSets the value to be returned byKeyguardManager.inKeyguardRestrictedInputMode()
.
-
setInRestrictedInputMode
public void setInRestrictedInputMode(boolean restricted)
Sets the value to be returned byKeyguardManager.inKeyguardRestrictedInputMode()
.
-
isKeyguardSecure
@Implementation protected boolean isKeyguardSecure()
For tests, returns the value set bysetIsKeyguardSecure(boolean)
, or false by default.- See Also:
setIsKeyguardSecure(boolean)
-
setIsKeyguardSecure
public void setIsKeyguardSecure(boolean secure)
Sets the value to be returned byisKeyguardSecure()
.- See Also:
isKeyguardSecure()
-
isDeviceSecure
@Implementation(minSdk=23) protected boolean isDeviceSecure()
For tests on Android >=M, returns the value set bysetIsDeviceSecure(boolean)
, or false by default.- See Also:
setIsDeviceSecure(boolean)
-
setIsDeviceSecure
public void setIsDeviceSecure(boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned byisDeviceSecure()
.- See Also:
isDeviceSecure()
-
isDeviceSecure
@Implementation(minSdk=23) protected boolean isDeviceSecure(int userId)
For tests on Android >=M, returns the value set bysetIsDeviceSecure(int, boolean)
, or false by default.- See Also:
setIsDeviceSecure(int, boolean)
-
setIsDeviceSecure
public void setIsDeviceSecure(int userId, boolean isDeviceSecure)
For tests on Android >=M, sets the value to be returned byisDeviceSecure(int)
.- See Also:
isDeviceSecure(int)
-
setIsDeviceLocked
public void setIsDeviceLocked(boolean isDeviceLocked)
For tests on Android >=L MR1, sets the value to be returned byisDeviceLocked()
.- See Also:
isDeviceLocked()
-
isDeviceLocked
@Implementation(minSdk=22) protected boolean isDeviceLocked()
- Returns:
- false by default, or the value passed to
setIsDeviceLocked(boolean)
. - See Also:
isDeviceLocked()
-
setIsDeviceLocked
public void setIsDeviceLocked(int userId, boolean isLocked)
For tests on Android >= L MR1, sets the value to be returned byisDeviceLocked(int)
.- See Also:
isDeviceLocked(int)
-
isDeviceLocked
@Implementation(minSdk=22) protected boolean isDeviceLocked(int userId)
-
setConfirmFactoryResetCredentialIntent
public void setConfirmFactoryResetCredentialIntent(Intent intent)
For tests on Android >= O MR1, sets the value to be returned bycreateConfirmFactoryResetCredentialIntent(CharSequence,CharSequence,CharSequence)
.
-
createConfirmFactoryResetCredentialIntent
@Implementation(minSdk=27) protected Intent createConfirmFactoryResetCredentialIntent(CharSequence title, CharSequence description, CharSequence alternateButtonLabel)
Returns the intent set viasetConfirmFactoryResetCredentialIntent(Intent)
, otherwise null.
-
reset
@Resetter public static void reset()
-
-