Merge "Adjust ConfirmDeviceCredentialActivity system bars" into rvc-dev am: ef28e9b75f

Change-Id: Ib1da534f9cdd0e1f9a1739b9be9d7669f1ec3ca6
This commit is contained in:
Kevin Chyn
2020-03-28 00:12:30 +00:00
committed by Automerger Merge Worker
3 changed files with 24 additions and 37 deletions

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2018 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="top">
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:interpolator="@android:interpolator/linear_out_slow_in"
android:duration="350"/>
</set>

View File

@@ -77,6 +77,13 @@ public class BiometricFragment extends InstrumentedFragment {
mClientCallback.onAuthenticationFailed();
});
}
@Override
public void onSystemEvent(int event) {
mClientExecutor.execute(() -> {
mClientCallback.onSystemEvent(event);
});
}
};
private final DialogInterface.OnClickListener mNegativeButtonListener =
@@ -121,10 +128,6 @@ public class BiometricFragment extends InstrumentedFragment {
}
}
boolean isAuthenticating() {
return mAuthenticating;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -144,7 +147,8 @@ public class BiometricFragment extends InstrumentedFragment {
.setConfirmationRequired(mBundle.getBoolean(
BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true))
.setDisallowBiometricsIfPolicyExists(mBundle.getBoolean(
BiometricPrompt.EXTRA_DISALLOW_BIOMETRICS_IF_POLICY_EXISTS, false));
BiometricPrompt.EXTRA_DISALLOW_BIOMETRICS_IF_POLICY_EXISTS, false))
.setReceiveSystemEvents(true);
mBiometricPrompt = builder.build();
mCancellationSignal = new CancellationSignal();

View File

@@ -25,6 +25,7 @@ import android.app.admin.DevicePolicyManager;
import android.app.trust.TrustManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricManager;
import android.hardware.biometrics.BiometricPrompt;
@@ -35,6 +36,7 @@ import android.os.Looper;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
@@ -142,6 +144,16 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
public void onAuthenticationFailed() {
mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
}
@Override
public void onSystemEvent(int event) {
Log.d(TAG, "SystemEvent: " + event);
switch (event) {
case BiometricConstants.BIOMETRIC_SYSTEM_EVENT_EARLY_USER_CANCEL:
finish();
break;
}
}
};
private String getStringForError(int errorCode) {
@@ -159,6 +171,9 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().setStatusBarColor(Color.TRANSPARENT);
mBiometricManager = getSystemService(BiometricManager.class);
mDevicePolicyManager = getSystemService(DevicePolicyManager.class);
mUserManager = UserManager.get(this);
@@ -379,14 +394,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
finish();
}
@Override
public void finish() {
super.finish();
// Finish without animation since the activity is just there so we can launch
// BiometricPrompt.
overridePendingTransition(R.anim.confirm_credential_biometric_transition_enter, 0);
}
private boolean isInternalActivity() {
return this instanceof ConfirmDeviceCredentialActivity.InternalActivity;
}