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 classShadowKeyguardManager.ShadowKeyguardLockAn 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 IntentcreateConfirmFactoryResetCredentialIntent(CharSequence title, CharSequence description, CharSequence alternateButtonLabel)Returns the intent set viasetConfirmFactoryResetCredentialIntent(Intent), otherwise null.protected booleaninKeyguardRestrictedInputMode()For tests, returns the value set viasetinRestrictedInputMode(boolean), or false by default.protected booleanisDeviceLocked()protected booleanisDeviceLocked(int userId)protected booleanisDeviceSecure()For tests on Android >=M, returns the value set bysetIsDeviceSecure(boolean), or false by default.protected booleanisDeviceSecure(int userId)For tests on Android >=M, returns the value set bysetIsDeviceSecure(int, boolean), or false by default.protected booleanisKeyguardLocked()For tests, returns the value set viasetKeyguardLocked(boolean), or false by default.protected booleanisKeyguardSecure()For tests, returns the value set bysetIsKeyguardSecure(boolean), or false by default.protected voidrequestDismissKeyguard(Activity activity, KeyguardManager.KeyguardDismissCallback callback)static voidreset()voidsetConfirmFactoryResetCredentialIntent(Intent intent)For tests on Android >= O MR1, sets the value to be returned bycreateConfirmFactoryResetCredentialIntent(CharSequence,CharSequence,CharSequence).voidsetinRestrictedInputMode(boolean restricted)Deprecated.usesetInRestrictedInputMode(boolean)insteadvoidsetInRestrictedInputMode(boolean restricted)Sets the value to be returned byKeyguardManager.inKeyguardRestrictedInputMode().voidsetIsDeviceLocked(boolean isDeviceLocked)For tests on Android >=L MR1, sets the value to be returned byisDeviceLocked().voidsetIsDeviceLocked(int userId, boolean isLocked)For tests on Android >= L MR1, sets the value to be returned byisDeviceLocked(int).voidsetIsDeviceSecure(boolean isDeviceSecure)For tests on Android >=M, sets the value to be returned byisDeviceSecure().voidsetIsDeviceSecure(int userId, boolean isDeviceSecure)For tests on Android >=M, sets the value to be returned byisDeviceSecure(int).voidsetIsKeyguardSecure(boolean secure)Sets the value to be returned byisKeyguardSecure().voidsetKeyguardLocked(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()
-
-