lundi 18 juillet 2016

Language to have android phone reboot when there is a certain amount of failed password attempts

I am trying to have Android Phone (LP 5.1.1) reboot when there is a certain amount of failed screen passwords. Here is my language in Keyguard:

if (mLockPatternUtils.isSeparateEncryptionPasswordEnabled() && failedAttempts >= 5) {
        final PowerManager powerManager = mContext.getSystemService(PowerManager.class);
        powerManager.reboot(null);

I get a compile error:

frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java:409: 

error: method getSystemService in class Context cannot be applied to given types; final PowerManager powerManager = mContext.getSystemService(PowerManager.class); ^ required: String

found: Class

reason: actual argument Class cannot be converted to

String by method invocation conversion

Any ideas? Thanks in advance

Aucun commentaire:

Enregistrer un commentaire