Add unlock to use NFC message in lock screen
Bug: 177041874 Test: manual Change-Id: I51adbc568594b55db67b98ddd6f87f46a4779dc2
This commit is contained in:
@@ -1039,6 +1039,9 @@
|
||||
<!-- Message shown when face authentication fails and the pin pad is visible. [CHAR LIMIT=60] -->
|
||||
<string name="keyguard_retry">Swipe up to try again</string>
|
||||
|
||||
<!-- Message shown when notifying user to unlock in order to use NFC. [CHAR LIMIT=60] -->
|
||||
<string name="require_unlock_for_nfc">Unlock to use NFC</string>
|
||||
|
||||
<!-- Text on keyguard screen and in Quick Settings footer indicating that the user's device belongs to their organization. [CHAR LIMIT=60] -->
|
||||
<string name="do_disclosure_generic">This device belongs to your organization</string>
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ import android.hardware.face.FaceSensorPropertiesInternal;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
|
||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.os.Build;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.Handler;
|
||||
@@ -183,6 +184,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
private static final int MSG_KEYGUARD_GOING_AWAY = 342;
|
||||
private static final int MSG_LOCK_SCREEN_MODE = 343;
|
||||
private static final int MSG_TIME_FORMAT_UPDATE = 344;
|
||||
private static final int MSG_REQUIRE_NFC_UNLOCK = 345;
|
||||
|
||||
public static final int LOCK_SCREEN_MODE_NORMAL = 0;
|
||||
public static final int LOCK_SCREEN_MODE_LAYOUT_1 = 1;
|
||||
@@ -1259,6 +1261,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
} else if (ACTION_USER_REMOVED.equals(action)) {
|
||||
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_REMOVED,
|
||||
intent.getIntExtra(Intent.EXTRA_USER_HANDLE, -1), 0));
|
||||
} else if (NfcAdapter.ACTION_REQUIRE_UNLOCK_FOR_NFC.equals(action)) {
|
||||
mHandler.sendEmptyMessage(MSG_REQUIRE_NFC_UNLOCK);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1725,6 +1729,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
break;
|
||||
case MSG_TIME_FORMAT_UPDATE:
|
||||
handleTimeFormatUpdate((String) msg.obj);
|
||||
case MSG_REQUIRE_NFC_UNLOCK:
|
||||
handleRequireUnlockForNfc();
|
||||
break;
|
||||
default:
|
||||
super.handleMessage(msg);
|
||||
@@ -1787,6 +1793,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
allUserFilter.addAction(ACTION_USER_UNLOCKED);
|
||||
allUserFilter.addAction(ACTION_USER_STOPPED);
|
||||
allUserFilter.addAction(ACTION_USER_REMOVED);
|
||||
allUserFilter.addAction(NfcAdapter.ACTION_REQUIRE_UNLOCK_FOR_NFC);
|
||||
mBroadcastDispatcher.registerReceiverWithHandler(mBroadcastAllReceiver, allUserFilter,
|
||||
mHandler, UserHandle.ALL);
|
||||
|
||||
@@ -2689,6 +2696,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
updateBiometricListeningState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle {@link #MSG_REQUIRE_NFC_UNLOCK}
|
||||
*/
|
||||
private void handleRequireUnlockForNfc() {
|
||||
Assert.isMainThread();
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||
if (cb != null) {
|
||||
cb.onRequireUnlockForNfc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle {@link #MSG_REPORT_EMERGENCY_CALL_ACTION}
|
||||
*/
|
||||
|
||||
@@ -328,4 +328,9 @@ public class KeyguardUpdateMonitorCallback {
|
||||
*/
|
||||
public void onLockScreenModeChanged(int mode) { }
|
||||
|
||||
/**
|
||||
* Called when notifying user to unlock in order to use NFC.
|
||||
*/
|
||||
public void onRequireUnlockForNfc() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -855,5 +855,13 @@ public class KeyguardIndicationController implements StateListener,
|
||||
updateIndication(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequireUnlockForNfc() {
|
||||
showTransientIndication(mContext.getString(R.string.require_unlock_for_nfc),
|
||||
false /* isError */, false /* hideOnScreenOff */);
|
||||
hideTransientIndicationDelayed(HIDE_DELAY_MS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user