Merge "Add ways to dismiss check enroll fingerprint dialog" into main
This commit is contained in:
@@ -1654,7 +1654,10 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
|
|
||||||
private static final String KEY_USER_ID = "user_id";
|
private static final String KEY_USER_ID = "user_id";
|
||||||
private static final String KEY_SENSOR_PROPERTIES = "sensor_properties";
|
private static final String KEY_SENSOR_PROPERTIES = "sensor_properties";
|
||||||
|
private static final String EXTRA_FAILURE_COUNT = "failure_count";
|
||||||
|
private static final int MAX_FAILURE_COUNT = 3;
|
||||||
private int mUserId;
|
private int mUserId;
|
||||||
|
private int mFailureCount;
|
||||||
private @Nullable CancellationSignal mCancellationSignal;
|
private @Nullable CancellationSignal mCancellationSignal;
|
||||||
private @Nullable FingerprintSensorPropertiesInternal mSensorPropertiesInternal;
|
private @Nullable FingerprintSensorPropertiesInternal mSensorPropertiesInternal;
|
||||||
|
|
||||||
@@ -1663,6 +1666,9 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
@NonNull LayoutInflater inflater,
|
@NonNull LayoutInflater inflater,
|
||||||
@Nullable ViewGroup container,
|
@Nullable ViewGroup container,
|
||||||
@Nullable Bundle savedInstanceState) {
|
@Nullable Bundle savedInstanceState) {
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
mFailureCount = savedInstanceState.getInt(EXTRA_FAILURE_COUNT, 0);
|
||||||
|
}
|
||||||
return inflater.inflate(
|
return inflater.inflate(
|
||||||
R.layout.fingerprint_check_enrolled_dialog, container, false);
|
R.layout.fingerprint_check_enrolled_dialog, container, false);
|
||||||
}
|
}
|
||||||
@@ -1682,12 +1688,22 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
final UdfpsCheckEnrolledView v =
|
final UdfpsCheckEnrolledView v =
|
||||||
dialog.findViewById(R.id.udfps_check_enrolled_view);
|
dialog.findViewById(R.id.udfps_check_enrolled_view);
|
||||||
v.setSensorProperties(mSensorPropertiesInternal);
|
v.setSensorProperties(mSensorPropertiesInternal);
|
||||||
|
v.setOnTouchListener((view, event) -> {
|
||||||
|
Log.d(TAG, "CheckEnrollDialog dismissed: touch outside");
|
||||||
|
dialog.dismiss();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putInt(EXTRA_FAILURE_COUNT, mFailureCount);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
@@ -1752,6 +1768,11 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
message.postDelayed(() -> {
|
message.postDelayed(() -> {
|
||||||
message.setText(R.string.fingerprint_check_enroll_touch_sensor);
|
message.setText(R.string.fingerprint_check_enroll_touch_sensor);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
mFailureCount++;
|
||||||
|
if (mFailureCount >= MAX_FAILURE_COUNT) {
|
||||||
|
Log.d(TAG, "CheckEnrollDialog dismissed: failed 3 times");
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
null /* handler */,
|
null /* handler */,
|
||||||
|
@@ -24,6 +24,7 @@ import android.util.AttributeSet;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.RotationUtils;
|
import android.util.RotationUtils;
|
||||||
import android.view.DisplayInfo;
|
import android.view.DisplayInfo;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
@@ -61,6 +62,13 @@ public class UdfpsCheckEnrolledView extends RelativeLayout {
|
|||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
mFingerprintView = findViewById(R.id.udfps_fingerprint_sensor_view);
|
mFingerprintView = findViewById(R.id.udfps_fingerprint_sensor_view);
|
||||||
mFingerprintView.setImageDrawable(mFingerprintDrawable);
|
mFingerprintView.setImageDrawable(mFingerprintDrawable);
|
||||||
|
mFingerprintView.setOnTouchListener((v, event) -> {
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
Log.d(TAG, "Fingerprint view touched!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user