Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bc036e9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add unlock to use NFC message in lock screen"

parents 8197beb0 5bd12e2b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1044,6 +1044,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>

+20 −0
Original line number Diff line number Diff line
@@ -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);
            }
        }
    };
@@ -1735,6 +1739,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);
@@ -1797,6 +1803,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);

@@ -2699,6 +2706,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}
     */
+5 −0
Original line number Diff line number Diff line
@@ -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() { }

}
+8 −0
Original line number Diff line number Diff line
@@ -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);
        }

    }
}