Snap for 9305793 from 1d04eb6eb7 to tm-qpr2-release

Change-Id: I9bd9976b4d7cefc9c4cc26988e40fdd5f604f393
This commit is contained in:
Android Build Coastguard Worker
2022-11-18 00:30:39 +00:00
7 changed files with 42 additions and 43 deletions

View File

@@ -634,9 +634,6 @@
<item>android.uid.system:1000</item>
</string-array>
<!-- The default value for RedactionInterstitial in SUW -->
<bool name="default_allow_sensitive_lockscreen_content">true</bool>
<!-- Whether to enable the app battery usage list page feature. -->
<bool name="config_app_battery_usage_list_enabled">false</bool>

View File

@@ -103,10 +103,9 @@ public class MultiBiometricEnrollHelper {
0 /* requestCode */, faceIntent,
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
intent.putExtra(EXTRA_ENROLL_AFTER_FINGERPRINT, faceAfterFp);
BiometricUtils.launchEnrollForResult(mActivity, intent, REQUEST_FINGERPRINT_ENROLL,
hardwareAuthToken, mGkPwHandle, mUserId);
}
BiometricUtils.launchEnrollForResult(mActivity, intent, REQUEST_FINGERPRINT_ENROLL,
hardwareAuthToken, mGkPwHandle, mUserId);
}));
}
}

View File

@@ -77,6 +77,8 @@ import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupcompat.util.WizardManagerHelper;
import com.google.android.setupdesign.GlifLayout;
import com.google.android.setupdesign.template.DescriptionMixin;
import com.google.android.setupdesign.template.HeaderMixin;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -341,6 +343,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
return true;
});
}
final Configuration config = getApplicationContext().getResources().getConfiguration();
maybeHideSfpsText(config);
}
@Override
@@ -1040,6 +1045,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
maybeHideSfpsText(newConfig);
switch(newConfig.orientation) {
case Configuration.ORIENTATION_LANDSCAPE: {
updateOrientation(Configuration.ORIENTATION_LANDSCAPE);
@@ -1055,6 +1061,27 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
}
}
private void maybeHideSfpsText(@NonNull Configuration newConfig) {
final HeaderMixin headerMixin = getLayout().getMixin(HeaderMixin.class);
final DescriptionMixin descriptionMixin = getLayout().getMixin(DescriptionMixin.class);
final boolean isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
if (mCanAssumeSfps) {
if (isLandscape) {
headerMixin.setAutoTextSizeEnabled(true);
headerMixin.getTextView().setMinLines(0);
headerMixin.getTextView().setMaxLines(10);
descriptionMixin.getTextView().setMinLines(0);
descriptionMixin.getTextView().setMaxLines(10);
} else {
headerMixin.setAutoTextSizeEnabled(false);
headerMixin.getTextView().setLines(4);
// hide the description
descriptionMixin.getTextView().setLines(0);
}
}
}
public static class IconTouchDialog extends InstrumentedDialogFragment {
@Override

View File

@@ -53,6 +53,7 @@ import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceViewHolder;
@@ -158,6 +159,8 @@ public class FingerprintSettings extends SubSettings {
private static final String KEY_IS_ENROLLING = "is_enrolled";
private static final String KEY_REQUIRE_SCREEN_ON_TO_AUTH =
"security_settings_require_screen_on_to_auth";
private static final String KEY_FINGERPRINT_UNLOCK_CATEGORY =
"security_settings_fingerprint_unlock_category";
private static final int MSG_REFRESH_FINGERPRINT_TEMPLATES = 1000;
private static final int MSG_FINGER_AUTH_SUCCESS = 1001;
@@ -177,6 +180,7 @@ public class FingerprintSettings extends SubSettings {
private FingerprintSettingsRequireScreenOnToAuthPreferenceController
mRequireScreenOnToAuthPreferenceController;
private RestrictedSwitchPreference mRequireScreenOnToAuthPreference;
private PreferenceCategory mFingerprintUnlockCategory;
private FingerprintManager mFingerprintManager;
private FingerprintUpdater mFingerprintUpdater;
@@ -493,6 +497,7 @@ public class FingerprintSettings extends SubSettings {
addFingerprintItemPreferences(root);
addPreferencesFromResource(getPreferenceScreenResId());
mRequireScreenOnToAuthPreference = findPreference(KEY_REQUIRE_SCREEN_ON_TO_AUTH);
mFingerprintUnlockCategory = findPreference(KEY_FINGERPRINT_UNLOCK_CATEGORY);
for (AbstractPreferenceController controller : mControllers) {
((FingerprintSettingsPreferenceController) controller).setUserId(mUserId);
}
@@ -504,7 +509,7 @@ public class FingerprintSettings extends SubSettings {
mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked);
return true;
});
mRequireScreenOnToAuthPreference.setVisible(false);
mFingerprintUnlockCategory.setVisible(false);
if (isSfps()) {
setRequireScreenOnToAuthVisibility();
}
@@ -517,9 +522,9 @@ public class FingerprintSettings extends SubSettings {
final boolean removalInProgress = mRemovalSidecar.inProgress();
// Removing last remaining fingerprint
if (fingerprintsEnrolled == 0 && removalInProgress) {
mRequireScreenOnToAuthPreference.setVisible(false);
mFingerprintUnlockCategory.setVisible(false);
} else {
mRequireScreenOnToAuthPreference.setVisible(true);
mFingerprintUnlockCategory.setVisible(true);
}
}

View File

@@ -46,6 +46,7 @@ import com.android.settings.SetupWizardUtils;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
import com.google.android.setupdesign.GlifLayout;
import com.google.android.setupdesign.template.HeaderMixin;
import com.google.android.setupdesign.util.ThemeHelper;
import com.google.android.setupdesign.util.ThemeResolver;
@@ -167,7 +168,9 @@ public abstract class StorageWizardBase extends FragmentActivity {
protected void setHeaderText(int resId, CharSequence... args) {
final CharSequence headerText = TextUtils.expandTemplate(getText(resId), args);
getGlifLayout().setHeaderText(headerText);
final GlifLayout layout = getGlifLayout();
layout.setHeaderText(headerText);
layout.getMixin(HeaderMixin.class).setAutoTextSizeEnabled(false);
setTitle(headerText);
}

View File

@@ -189,16 +189,13 @@ public class RedactionInterstitial extends SettingsActivity {
}
private void loadFromSettings() {
final boolean showUnRedactedDefault = getContext().getResources().getBoolean(
R.bool.default_allow_sensitive_lockscreen_content);
final boolean managedProfile = UserManager.get(getContext()).isManagedProfile(mUserId);
// Hiding all notifications is device-wide setting, managed profiles can only set
// whether their notifications are show in full or redacted.
final boolean showNotifications = managedProfile || Settings.Secure.getIntForUser(
getContentResolver(), LOCK_SCREEN_SHOW_NOTIFICATIONS, 0, mUserId) != 0;
final boolean showUnredacted = Settings.Secure.getIntForUser(
getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
showUnRedactedDefault ? 1 : 0, mUserId) != 0;
getContentResolver(), LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, mUserId) != 0;
int checkedButtonId = R.id.hide_all;
if (showNotifications) {

View File

@@ -21,7 +21,6 @@ import android.widget.RadioButton;
import com.android.settings.R;
import com.android.settings.RestrictedRadioButton;
import com.android.settings.notification.RedactionInterstitial.RedactionInterstitialFragment;
import com.android.settings.testutils.shadow.SettingsShadowResources;
import com.android.settings.testutils.shadow.ShadowRestrictedLockUtilsInternal;
import com.android.settings.testutils.shadow.ShadowUtils;
@@ -39,7 +38,6 @@ import org.robolectric.shadows.ShadowUserManager;
@Config(shadows = {
ShadowUtils.class,
ShadowRestrictedLockUtilsInternal.class,
SettingsShadowResources.class,
})
public class RedactionInterstitialTest {
private RedactionInterstitial mActivity;
@@ -136,28 +134,6 @@ public class RedactionInterstitialTest {
assertSelectedButton(R.id.redact_sensitive);
}
@Test
public void defaultShowSensitiveContent_configDeny() {
final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver();
Settings.Secure.putIntForUser(resolver,
LOCK_SCREEN_SHOW_NOTIFICATIONS, 1, UserHandle.myUserId());
setupConfig(false);
setupActivity();
assertSelectedButton(R.id.redact_sensitive);
}
@Test
public void defaultShowSensitiveContent_configAllow() {
final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver();
Settings.Secure.putIntForUser(resolver,
LOCK_SCREEN_SHOW_NOTIFICATIONS, 1, UserHandle.myUserId());
setupConfig(true);
setupActivity();
assertSelectedButton(R.id.show_all);
}
private void setupActivity() {
mActivity = buildActivity(RedactionInterstitial.class, new Intent()).setup().get();
mFragment = (RedactionInterstitialFragment)
@@ -166,11 +142,6 @@ public class RedactionInterstitialTest {
assertThat(mFragment).isNotNull();
}
private void setupConfig(boolean allowSensitiveContent) {
SettingsShadowResources.overrideResource(
R.bool.default_allow_sensitive_lockscreen_content, allowSensitiveContent);
}
private void setupSettings(int show, int showUnredacted) {
final ContentResolver resolver = RuntimeEnvironment.application.getContentResolver();
Settings.Secure.putIntForUser(resolver,