* commit 'be2c7449b9679f357d368805a1a24e05de4f53a0': Fix fingerprint for multiuser
This commit is contained in:
@@ -686,7 +686,7 @@ public class FingerprintManager {
|
|||||||
|
|
||||||
private void sendAuthenticatedResult(Fingerprint fp) {
|
private void sendAuthenticatedResult(Fingerprint fp) {
|
||||||
if (mAuthenticationCallback != null) {
|
if (mAuthenticationCallback != null) {
|
||||||
if (fp.getFingerId() == 0 && fp.getGroupId() == 0) {
|
if (fp.getFingerId() == 0) {
|
||||||
// Fingerprint template valid but doesn't match one in database
|
// Fingerprint template valid but doesn't match one in database
|
||||||
mAuthenticationCallback.onAuthenticationFailed();
|
mAuthenticationCallback.onAuthenticationFailed();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private static final int MSG_SIM_STATE_CHANGE = 304;
|
private static final int MSG_SIM_STATE_CHANGE = 304;
|
||||||
private static final int MSG_RINGER_MODE_CHANGED = 305;
|
private static final int MSG_RINGER_MODE_CHANGED = 305;
|
||||||
private static final int MSG_PHONE_STATE_CHANGED = 306;
|
private static final int MSG_PHONE_STATE_CHANGED = 306;
|
||||||
private static final int MSG_CLOCK_VISIBILITY_CHANGED = 307;
|
|
||||||
private static final int MSG_DEVICE_PROVISIONED = 308;
|
private static final int MSG_DEVICE_PROVISIONED = 308;
|
||||||
private static final int MSG_DPM_STATE_CHANGED = 309;
|
private static final int MSG_DPM_STATE_CHANGED = 309;
|
||||||
private static final int MSG_USER_SWITCHING = 310;
|
private static final int MSG_USER_SWITCHING = 310;
|
||||||
@@ -172,9 +171,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
case MSG_PHONE_STATE_CHANGED:
|
case MSG_PHONE_STATE_CHANGED:
|
||||||
handlePhoneStateChanged((String) msg.obj);
|
handlePhoneStateChanged((String) msg.obj);
|
||||||
break;
|
break;
|
||||||
case MSG_CLOCK_VISIBILITY_CHANGED:
|
|
||||||
handleClockVisibilityChanged();
|
|
||||||
break;
|
|
||||||
case MSG_DEVICE_PROVISIONED:
|
case MSG_DEVICE_PROVISIONED:
|
||||||
handleDeviceProvisioned();
|
handleDeviceProvisioned();
|
||||||
break;
|
break;
|
||||||
@@ -756,15 +752,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
|
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHING,
|
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCHING,
|
||||||
newUserId, 0, reply));
|
newUserId, 0, reply));
|
||||||
mSwitchingUser = true;
|
|
||||||
updateFingerprintListeningState();
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onUserSwitchComplete(int newUserId) throws RemoteException {
|
public void onUserSwitchComplete(int newUserId) throws RemoteException {
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCH_COMPLETE,
|
mHandler.sendMessage(mHandler.obtainMessage(MSG_USER_SWITCH_COMPLETE,
|
||||||
newUserId, 0));
|
newUserId, 0));
|
||||||
mSwitchingUser = false;
|
|
||||||
updateFingerprintListeningState();
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onForegroundProfileSwitch(int newProfileId) {
|
public void onForegroundProfileSwitch(int newProfileId) {
|
||||||
@@ -869,6 +861,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
* Handle {@link #MSG_USER_SWITCHING}
|
* Handle {@link #MSG_USER_SWITCHING}
|
||||||
*/
|
*/
|
||||||
protected void handleUserSwitching(int userId, IRemoteCallback reply) {
|
protected void handleUserSwitching(int userId, IRemoteCallback reply) {
|
||||||
|
mSwitchingUser = true;
|
||||||
|
updateFingerprintListeningState();
|
||||||
|
|
||||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||||
if (cb != null) {
|
if (cb != null) {
|
||||||
@@ -885,6 +880,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
* Handle {@link #MSG_USER_SWITCH_COMPLETE}
|
* Handle {@link #MSG_USER_SWITCH_COMPLETE}
|
||||||
*/
|
*/
|
||||||
protected void handleUserSwitchComplete(int userId) {
|
protected void handleUserSwitchComplete(int userId) {
|
||||||
|
mSwitchingUser = false;
|
||||||
|
updateFingerprintListeningState();
|
||||||
|
|
||||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||||
if (cb != null) {
|
if (cb != null) {
|
||||||
@@ -1043,19 +1041,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle {@link #MSG_CLOCK_VISIBILITY_CHANGED}
|
|
||||||
*/
|
|
||||||
private void handleClockVisibilityChanged() {
|
|
||||||
if (DEBUG) Log.d(TAG, "handleClockVisibilityChanged()");
|
|
||||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
|
||||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
|
||||||
if (cb != null) {
|
|
||||||
cb.onClockVisibilityChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle {@link #MSG_KEYGUARD_VISIBILITY_CHANGED}
|
* Handle {@link #MSG_KEYGUARD_VISIBILITY_CHANGED}
|
||||||
*/
|
*/
|
||||||
@@ -1100,21 +1085,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isKeyguardVisible() {
|
|
||||||
return mKeyguardIsVisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return if the keyguard is currently in bouncer mode.
|
|
||||||
*/
|
|
||||||
public boolean isKeyguardBouncer() {
|
|
||||||
return mBouncer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSwitchingUser() {
|
|
||||||
return mSwitchingUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isBatteryUpdateInteresting(BatteryStatus old, BatteryStatus current) {
|
private static boolean isBatteryUpdateInteresting(BatteryStatus old, BatteryStatus current) {
|
||||||
final boolean nowPluggedIn = current.isPluggedIn();
|
final boolean nowPluggedIn = current.isPluggedIn();
|
||||||
final boolean wasPluggedIn = old.isPluggedIn();
|
final boolean wasPluggedIn = old.isPluggedIn();
|
||||||
@@ -1139,13 +1109,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The default plmn (no service)
|
|
||||||
*/
|
|
||||||
private CharSequence getDefaultPlmn() {
|
|
||||||
return mContext.getResources().getText(R.string.keyguard_carrier_default);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the given observer's callback.
|
* Remove the given observer's callback.
|
||||||
*
|
*
|
||||||
@@ -1211,11 +1174,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reportClockVisible(boolean visible) {
|
|
||||||
mClockVisible = visible;
|
|
||||||
mHandler.obtainMessage(MSG_CLOCK_VISIBILITY_CHANGED).sendToTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report that the user successfully entered the SIM PIN or PUK/SIM PIN so we
|
* Report that the user successfully entered the SIM PIN or PUK/SIM PIN so we
|
||||||
* have the information earlier than waiting for the intent
|
* have the information earlier than waiting for the intent
|
||||||
|
|||||||
@@ -17,13 +17,16 @@
|
|||||||
package com.android.server.fingerprint;
|
package com.android.server.fingerprint;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
import android.app.ActivityManagerNative;
|
||||||
import android.app.AppOpsManager;
|
import android.app.AppOpsManager;
|
||||||
|
import android.app.IUserSwitchObserver;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
import android.os.IRemoteCallback;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.MessageQueue;
|
import android.os.MessageQueue;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
@@ -62,6 +65,7 @@ public class FingerprintService extends SystemService {
|
|||||||
private final AppOpsManager mAppOps;
|
private final AppOpsManager mAppOps;
|
||||||
|
|
||||||
private static final int MSG_NOTIFY = 10;
|
private static final int MSG_NOTIFY = 10;
|
||||||
|
private static final int MSG_USER_SWITCHING = 11;
|
||||||
|
|
||||||
private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute
|
private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute
|
||||||
|
|
||||||
@@ -84,6 +88,10 @@ public class FingerprintService extends SystemService {
|
|||||||
handleNotify(m.type, m.arg1, m.arg2, m.arg3);
|
handleNotify(m.type, m.arg1, m.arg2, m.arg3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSG_USER_SWITCHING:
|
||||||
|
handleUserSwitching(msg.arg1);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Slog.w(TAG, "Unknown message:" + msg.what);
|
Slog.w(TAG, "Unknown message:" + msg.what);
|
||||||
}
|
}
|
||||||
@@ -144,7 +152,7 @@ public class FingerprintService extends SystemService {
|
|||||||
|
|
||||||
void handleNotify(int type, int arg1, int arg2, int arg3) {
|
void handleNotify(int type, int arg1, int arg2, int arg3) {
|
||||||
Slog.v(TAG, "handleNotify(type=" + type + ", arg1=" + arg1 + ", arg2=" + arg2 + ")"
|
Slog.v(TAG, "handleNotify(type=" + type + ", arg1=" + arg1 + ", arg2=" + arg2 + ")"
|
||||||
+ ", mAuthClients = " + mAuthClient + ", mEnrollClient = " + mEnrollClient);
|
+ ", mAuthClients = " + mAuthClient + ", mEnrollClient = " + mEnrollClient);
|
||||||
if (mEnrollClient != null) {
|
if (mEnrollClient != null) {
|
||||||
final IBinder token = mEnrollClient.token;
|
final IBinder token = mEnrollClient.token;
|
||||||
if (dispatchNotify(mEnrollClient, type, arg1, arg2, arg3)) {
|
if (dispatchNotify(mEnrollClient, type, arg1, arg2, arg3)) {
|
||||||
@@ -166,6 +174,10 @@ public class FingerprintService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handleUserSwitching(int userId) {
|
||||||
|
updateActiveGroup(userId);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch notify events to clients.
|
* Dispatch notify events to clients.
|
||||||
*
|
*
|
||||||
@@ -615,11 +627,37 @@ public class FingerprintService extends SystemService {
|
|||||||
publishBinderService(Context.FINGERPRINT_SERVICE, new FingerprintServiceWrapper());
|
publishBinderService(Context.FINGERPRINT_SERVICE, new FingerprintServiceWrapper());
|
||||||
mHalDeviceId = nativeOpenHal();
|
mHalDeviceId = nativeOpenHal();
|
||||||
if (mHalDeviceId != 0) {
|
if (mHalDeviceId != 0) {
|
||||||
int userId = ActivityManager.getCurrentUser();
|
updateActiveGroup(ActivityManager.getCurrentUser());
|
||||||
File path = Environment.getUserSystemDirectory(userId);
|
|
||||||
nativeSetActiveGroup(0, path.getAbsolutePath().getBytes());
|
|
||||||
}
|
}
|
||||||
if (DEBUG) Slog.v(TAG, "Fingerprint HAL id: " + mHalDeviceId);
|
if (DEBUG) Slog.v(TAG, "Fingerprint HAL id: " + mHalDeviceId);
|
||||||
|
listenForUserSwitches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateActiveGroup(int userId) {
|
||||||
|
File path = Environment.getUserSystemDirectory(userId);
|
||||||
|
nativeSetActiveGroup(userId, path.getAbsolutePath().getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void listenForUserSwitches() {
|
||||||
|
try {
|
||||||
|
ActivityManagerNative.getDefault().registerUserSwitchObserver(
|
||||||
|
new IUserSwitchObserver.Stub() {
|
||||||
|
@Override
|
||||||
|
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
|
||||||
|
mHandler.obtainMessage(MSG_USER_SWITCHING, newUserId, 0 /* unused */)
|
||||||
|
.sendToTarget();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onUserSwitchComplete(int newUserId) throws RemoteException {
|
||||||
|
// Ignore.
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onForegroundProfileSwitch(int newProfileId) {
|
||||||
|
// Ignore.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.w(TAG, "Failed to listen for user switching event" ,e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user