Merge "New api in LockSettingsService to get StrongAuth synchronously" into nyc-dev am: d86ac8116b

am: 1e93177121

* commit '1e93177121848f337c512b7ce0d06265abb02356':
  New api in LockSettingsService to get StrongAuth synchronously

Change-Id: If568c19a9fb67eb847b776981a42049cececfe45
This commit is contained in:
Victor Chang
2016-05-23 12:03:40 +00:00
committed by android-build-merger
3 changed files with 63 additions and 3 deletions

View File

@@ -44,4 +44,5 @@ interface ILockSettings {
void requireStrongAuth(int strongAuthReason, int userId);
void systemReady();
void userPresent(int userId);
int getStrongAuthForUser(int userId);
}

View File

@@ -1451,6 +1451,32 @@ public class LockPatternUtils {
}
}
/**
* @see StrongAuthTracker#getStrongAuthForUser
*/
public int getStrongAuthForUser(int userId) {
try {
return getLockSettings().getStrongAuthForUser(userId);
} catch (RemoteException e) {
Log.e(TAG, "Could not get StrongAuth", e);
return StrongAuthTracker.getDefaultFlags(mContext);
}
}
/**
* @see StrongAuthTracker#isTrustAllowedForUser
*/
public boolean isTrustAllowedForUser(int userId) {
return getStrongAuthForUser(userId) == StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED;
}
/**
* @see StrongAuthTracker#isFingerprintAllowedForUser
*/
public boolean isFingerprintAllowedForUser(int userId) {
return (getStrongAuthForUser(userId) & ~StrongAuthTracker.ALLOWING_FINGERPRINT) == 0;
}
/**
* Tracks the global strong authentication state.
*/
@@ -1556,9 +1582,8 @@ public class LockPatternUtils {
public void onStrongAuthRequiredChanged(int userId) {
}
void handleStrongAuthRequiredChanged(@StrongAuthFlags int strongAuthFlags,
protected void handleStrongAuthRequiredChanged(@StrongAuthFlags int strongAuthFlags,
int userId) {
int oldValue = getStrongAuthForUser(userId);
if (strongAuthFlags != oldValue) {
if (strongAuthFlags == mDefaultStrongAuthFlags) {
@@ -1571,7 +1596,7 @@ public class LockPatternUtils {
}
final IStrongAuthTracker.Stub mStub = new IStrongAuthTracker.Stub() {
protected final IStrongAuthTracker.Stub mStub = new IStrongAuthTracker.Stub() {
@Override
public void onStrongAuthRequiredChanged(@StrongAuthFlags int strongAuthFlags,
int userId) {