Set background of all face enroll status/footer bars

Moves the logic for setting an explicit background on the status and
footer bars shown during face and fingerprint enrollment from
BiometricEnrollIntroduction to BiometricEnrollBase. This ensures that
the status and footer bars on all biometric enroll screens will have
their backgrounds set, preventing the screen content from showing
through.

Test: Manual

Fixes: 190138494
Change-Id: If5050d07d277f51c784daecf80d5e3cdeae0ba49
This commit is contained in:
Curtis Belmonte
2021-06-07 15:44:58 -07:00
parent 466be8d6fe
commit f13d5d5344
2 changed files with 26 additions and 26 deletions

View File

@@ -19,16 +19,22 @@ package com.android.settings.biometrics;
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.os.UserHandle;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrolling;
import com.android.settings.core.InstrumentedActivity;
import com.android.settings.password.ChooseLockSettingsHelper;
@@ -138,6 +144,20 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
initViews();
@SuppressLint("VisibleForTests")
final LinearLayout buttonContainer = mFooterBarMixin != null
? mFooterBarMixin.getButtonContainer()
: null;
if (buttonContainer != null) {
buttonContainer.setBackgroundColor(getBackgroundColor());
}
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
getWindow().setStatusBarColor(getBackgroundColor());
}
@Override
@@ -242,4 +262,10 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
mLaunchedConfirmLock = true;
}
}
@ColorInt
private int getBackgroundColor() {
final ColorStateList stateList = Utils.getColorAttr(this, android.R.attr.windowBackground);
return stateList != null ? stateList.getDefaultColor() : Color.TRANSPARENT;
}
}

View File

@@ -18,8 +18,6 @@ package com.android.settings.biometrics;
import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.os.Bundle;
@@ -27,17 +25,14 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
import com.android.settings.password.ChooseLockGeneric;
import com.android.settings.password.ChooseLockSettingsHelper;
@@ -187,15 +182,6 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
}
}
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
final LinearLayout buttonContainer = mFooterBarMixin.getButtonContainer();
if (buttonContainer != null) {
buttonContainer.setBackgroundColor(getBackgroundColor());
}
}
@Override
protected void onResume() {
super.onResume();
@@ -213,12 +199,6 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
}
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
getWindow().setStatusBarColor(getBackgroundColor());
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
@@ -355,10 +335,4 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
}
return mIconColorFilter;
}
@ColorInt
private int getBackgroundColor() {
final ColorStateList stateList = Utils.getColorAttr(this, android.R.attr.windowBackground);
return stateList != null ? stateList.getDefaultColor() : Color.TRANSPARENT;
}
}