Merge "Allow LockPatternUtils usage on non-looper threads" into nyc-mr1-dev
This commit is contained in:
@@ -149,7 +149,7 @@ public class LockPatternUtils {
|
|||||||
private DevicePolicyManager mDevicePolicyManager;
|
private DevicePolicyManager mDevicePolicyManager;
|
||||||
private ILockSettings mLockSettingsService;
|
private ILockSettings mLockSettingsService;
|
||||||
private UserManager mUserManager;
|
private UserManager mUserManager;
|
||||||
private final Handler mHandler = new Handler();
|
private final Handler mHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use {@link TrustManager#isTrustUsuallyManaged(int)}.
|
* Use {@link TrustManager#isTrustUsuallyManaged(int)}.
|
||||||
@@ -231,6 +231,9 @@ public class LockPatternUtils {
|
|||||||
public LockPatternUtils(Context context) {
|
public LockPatternUtils(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mContentResolver = context.getContentResolver();
|
mContentResolver = context.getContentResolver();
|
||||||
|
|
||||||
|
Looper looper = Looper.myLooper();
|
||||||
|
mHandler = looper != null ? new Handler(looper) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ILockSettings getLockSettings() {
|
private ILockSettings getLockSettings() {
|
||||||
@@ -1506,6 +1509,10 @@ public class LockPatternUtils {
|
|||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
if (mHandler == null) {
|
||||||
|
throw new IllegalStateException("Must construct LockPatternUtils on a looper thread"
|
||||||
|
+ " to use progress callbacks.");
|
||||||
|
}
|
||||||
return new ICheckCredentialProgressCallback.Stub() {
|
return new ICheckCredentialProgressCallback.Stub() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user