diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index ac2e342b3c34a..785f8d00deb73 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1039,6 +1039,9 @@
Swipe up to try again
+
+ Unlock to use NFC
+
This device belongs to your organization
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
index b43496cb55dc1..45f171b11d8e4 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -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}
*/
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index 36617c2393529..e561a5a84f244 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -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() { }
+
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 5259aa968825c..c816784a22f23 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -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);
+ }
+
}
}