am c499a5fe
: Merge "Fix crash in fingerprint settings." into mnc-dev
* commit 'c499a5fe9d6632fa73104dcc88a9e2c2cd390dde': Fix crash in fingerprint settings.
This commit is contained in:
@@ -127,7 +127,6 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
|
|
||||||
private FingerprintManager mFingerprintManager;
|
private FingerprintManager mFingerprintManager;
|
||||||
private EditText mDialogTextField;
|
private EditText mDialogTextField;
|
||||||
private PreferenceGroup mManageCategory;
|
|
||||||
private CancellationSignal mFingerprintCancel;
|
private CancellationSignal mFingerprintCancel;
|
||||||
private int mMaxFingerprintAttempts;
|
private int mMaxFingerprintAttempts;
|
||||||
private byte[] mToken;
|
private byte[] mToken;
|
||||||
@@ -148,7 +147,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
@Override
|
@Override
|
||||||
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
||||||
// get activity will be null on a screen rotation
|
// get activity will be null on a screen rotation
|
||||||
Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
|
Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
|
||||||
}
|
}
|
||||||
@@ -159,7 +158,10 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
|
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
|
||||||
Toast.makeText(getActivity(), helpString, Toast.LENGTH_SHORT);
|
final Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
Toast.makeText(activity, helpString, Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private RemovalCallback mRemoveCallback = new RemovalCallback() {
|
private RemovalCallback mRemoveCallback = new RemovalCallback() {
|
||||||
@@ -172,7 +174,10 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemovalError(Fingerprint fp, int errMsgId, CharSequence errString) {
|
public void onRemovalError(Fingerprint fp, int errMsgId, CharSequence errString) {
|
||||||
Toast.makeText(getActivity(), errString, Toast.LENGTH_SHORT);
|
final Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final Handler mHandler = new Handler() {
|
private final Handler mHandler = new Handler() {
|
||||||
@@ -186,7 +191,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
retryFingerprint(true);
|
retryFingerprint(true);
|
||||||
break;
|
break;
|
||||||
case MSG_FINGER_AUTH_FAIL:
|
case MSG_FINGER_AUTH_FAIL:
|
||||||
retryFingerprint(false);
|
retryFingerprint(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -440,29 +445,33 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
|
|
||||||
private Drawable getHighlightDrawable() {
|
private Drawable getHighlightDrawable() {
|
||||||
if (mHighlightDrawable == null) {
|
if (mHighlightDrawable == null) {
|
||||||
mHighlightDrawable = getActivity().getDrawable(R.drawable.preference_highlight);
|
final Activity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
mHighlightDrawable = activity.getDrawable(R.drawable.preference_highlight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return mHighlightDrawable;
|
return mHighlightDrawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void highlightFingerprintItem(int fpId) {
|
private void highlightFingerprintItem(int fpId) {
|
||||||
String prefName = genKey(fpId);
|
String prefName = genKey(fpId);
|
||||||
FingerprintPreference fpref =
|
FingerprintPreference fpref = (FingerprintPreference) findPreference(prefName);
|
||||||
(FingerprintPreference) mManageCategory.findPreference(prefName);
|
|
||||||
final Drawable highlight = getHighlightDrawable();
|
final Drawable highlight = getHighlightDrawable();
|
||||||
final View view = fpref.getView();
|
if (highlight != null) {
|
||||||
final int centerX = view.getWidth() / 2;
|
final View view = fpref.getView();
|
||||||
final int centerY = view.getHeight() / 2;
|
final int centerX = view.getWidth() / 2;
|
||||||
highlight.setHotspot(centerX, centerY);
|
final int centerY = view.getHeight() / 2;
|
||||||
view.setBackground(highlight);
|
highlight.setHotspot(centerX, centerY);
|
||||||
view.setPressed(true);
|
view.setBackground(highlight);
|
||||||
mHandler.postDelayed(new Runnable() {
|
view.setPressed(true);
|
||||||
@Override
|
mHandler.postDelayed(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
view.setPressed(false);
|
public void run() {
|
||||||
view.setBackground(null);
|
view.setPressed(false);
|
||||||
}
|
view.setBackground(null);
|
||||||
}, RESET_HIGHLIGHT_DELAY_MS);
|
}
|
||||||
|
}, RESET_HIGHLIGHT_DELAY_MS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchChooseOrConfirmLock() {
|
private void launchChooseOrConfirmLock() {
|
||||||
|
Reference in New Issue
Block a user