Snap for 9058783 from 025c77a1e7 to tm-qpr1-release

Change-Id: Ifc984754c1987824c2e6f6b703127784a7d84053
This commit is contained in:
Android Build Coastguard Worker
2022-09-13 23:26:13 +00:00
6 changed files with 89 additions and 12 deletions

View File

@@ -3098,7 +3098,9 @@
<!-- SmartAutoRotatePreferenceFragment settings screen, face-based rotation switch label [CHAR LIMIT=30] -->
<string name="auto_rotate_switch_face_based">Face Detection</string>
<!-- Preference summary to enable auto rotate[CHAR_LIMIT=NONE]-->
<string name="auto_rotate_screen_summary">Automatically adjust the screen orientation when you move your phone between portrait and landscape</string>
<string name="auto_rotate_screen_summary" product="default">Automatically adjust the screen orientation when you move your phone between portrait and landscape</string>
<!-- Preference summary to enable auto rotate[CHAR_LIMIT=NONE]-->
<string name="auto_rotate_screen_summary" product="tablet">Automatically adjust the screen orientation when you move your tablet between portrait and landscape</string>
<!-- Accessibility description for auto rotate learn more link [CHAR LIMIT=NONE] -->
<string name="auto_rotate_link_a11y">Learn more about auto-rotate</string>
<!-- Accessibility summary text for auto rotate [CHAR LIMIT=60] -->

View File

@@ -564,7 +564,13 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
Intent intent = BiometricUtils.getChooseLockIntent(this, getIntent());
intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.HIDE_INSECURE_OPTIONS, true);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, true);
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, true);
if (mHasFeatureFingerprint && mHasFeatureFace) {
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, true);
} else if (mHasFeatureFace) {
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, true);
} else if (mHasFeatureFingerprint) {
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, true);
}
if (mUserId != UserHandle.USER_NULL) {
intent.putExtra(Intent.EXTRA_USER_ID, mUserId);

View File

@@ -248,6 +248,11 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
return findViewById(R.id.error_text);
}
private boolean isFromSetupWizardSuggestAction(@Nullable Intent intent) {
return intent != null && intent.getBooleanExtra(
WizardManagerHelper.EXTRA_IS_SUW_SUGGESTED_ACTION_FLOW, false);
}
@Override
protected int checkMaxEnrolled() {
final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
@@ -255,6 +260,7 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
WizardManagerHelper.isDeferredSetupWizard(getIntent());
final boolean isPortalSetupWizard =
WizardManagerHelper.isPortalSetupWizard(getIntent());
final boolean isFromSetupWizardSuggestAction = isFromSetupWizardSuggestAction(getIntent());
if (mFingerprintManager != null) {
final List<FingerprintSensorPropertiesInternal> props =
mFingerprintManager.getSensorPropertiesInternal();
@@ -266,7 +272,8 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
getApplicationContext()
.getResources()
.getInteger(R.integer.suw_max_fingerprints_enrollable);
if (isSetupWizard && !isDeferredSetupWizard && !isPortalSetupWizard) {
if (isSetupWizard && !isDeferredSetupWizard && !isPortalSetupWizard
&& !isFromSetupWizardSuggestAction) {
if (numEnrolledFingerprints >= maxFingerprintsEnrollableIfSUW) {
return R.string.fingerprint_intro_error_max;
} else {

View File

@@ -24,6 +24,7 @@ import android.content.Intent;
import android.os.PowerManager;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
@@ -34,6 +35,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
* starts a notification in the status bar that can be clicked to bring up the same dialog.
*/
public final class BluetoothPairingRequest extends BroadcastReceiver {
private static final String TAG = "BluetoothPairingRequest";
@Override
public void onReceive(Context context, Intent intent) {
@@ -74,6 +76,7 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
}
} else if (TextUtils.equals(action,
BluetoothCsipSetCoordinator.ACTION_CSIS_SET_MEMBER_AVAILABLE)) {
Log.d(TAG, "Receive ACTION_CSIS_SET_MEMBER_AVAILABLE");
if (device == null) {
return;
}

View File

@@ -16,6 +16,8 @@
package com.android.settings.fuelgauge.batteryusage;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.res.Configuration;
@@ -68,9 +70,8 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
private static final int ENABLED_ICON_ALPHA = 255;
private static final int DISABLED_ICON_ALPHA = 255 / 3;
private static final long FADE_ANIMATION_DURATION = 350L;
private static final long VALID_USAGE_TIME_DURATION = DateUtils.HOUR_IN_MILLIS * 2;
private static final long VALID_DIFF_DURATION = DateUtils.MINUTE_IN_MILLIS * 3;
private static final long FADE_IN_ANIMATION_DURATION = 400L;
private static final long FADE_OUT_ANIMATION_DURATION = 200L;
// Keys for bundle instance to restore configurations.
private static final String KEY_EXPAND_SYSTEM_INFO = "expand_system_info";
@@ -121,6 +122,10 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
private final CharSequence[] mNotAllowShowSummaryPackages;
private final MetricsFeatureProvider mMetricsFeatureProvider;
private final Handler mHandler = new Handler(Looper.getMainLooper());
private final AnimatorListenerAdapter mHourlyChartFadeInAdapter =
createHourlyChartAnimatorListenerAdapter(/*isToShow=*/ true);
private final AnimatorListenerAdapter mHourlyChartFadeOutAdapter =
createHourlyChartAnimatorListenerAdapter(/*isToShow=*/ false);
// Preference cache to avoid create new instance each time.
@VisibleForTesting
@@ -382,9 +387,9 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
if (mDailyChartIndex == BatteryChartViewModel.SELECTED_INDEX_ALL) {
// Multiple days are selected, hide the hourly chart view.
mHourlyChartView.setVisibility(View.GONE);
animateBatteryHourlyChartView(/*isToShow=*/ false);
} else {
mHourlyChartView.setVisibility(View.VISIBLE);
animateBatteryHourlyChartView(/*isToShow=*/ true);
final BatteryChartViewModel hourlyViewModel = mHourlyViewModels.get(mDailyChartIndex);
hourlyViewModel.setSelectedIndex(mHourlyChartIndex);
mHourlyChartView.setViewModel(hourlyViewModel);
@@ -626,11 +631,55 @@ public class BatteryChartPreferenceController extends AbstractPreferenceControll
private void animateBatteryChartViewGroup() {
if (mBatteryChartViewGroup != null && mBatteryChartViewGroup.getAlpha() == 0) {
mBatteryChartViewGroup.animate().alpha(1f).setDuration(FADE_ANIMATION_DURATION)
mBatteryChartViewGroup.animate().alpha(1f).setDuration(FADE_IN_ANIMATION_DURATION)
.start();
}
}
private void animateBatteryHourlyChartView(final boolean isToShow) {
if (mHourlyChartView == null) {
return;
}
if (isToShow) {
mHourlyChartView.setAlpha(0f);
mHourlyChartView.setVisibility(View.VISIBLE);
mHourlyChartView.animate()
.alpha(1f)
.setDuration(FADE_IN_ANIMATION_DURATION)
.setListener(mHourlyChartFadeInAdapter)
.start();
} else {
mHourlyChartView.animate()
.alpha(0f)
.setDuration(FADE_OUT_ANIMATION_DURATION)
.setListener(mHourlyChartFadeOutAdapter)
.start();
}
}
private AnimatorListenerAdapter createHourlyChartAnimatorListenerAdapter(
final boolean isToShow) {
final int visibility = isToShow ? View.VISIBLE : View.GONE;
return new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
if (mHourlyChartView != null) {
mHourlyChartView.setVisibility(visibility);
}
}
@Override
public void onAnimationCancel(Animator animation) {
super.onAnimationCancel(animation);
if (mHourlyChartView != null) {
mHourlyChartView.setVisibility(visibility);
}
}
};
}
private void addFooterPreferenceIfNeeded(boolean containAppItems) {
if (mIsFooterPrefAdded || mFooterPreference == null) {
return;

View File

@@ -20,6 +20,11 @@ import static android.provider.Settings.ACTION_BIOMETRIC_ENROLL;
import static androidx.test.espresso.intent.Intents.intended;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT;
import static com.google.common.truth.Truth.assertThat;
@@ -83,6 +88,13 @@ public class BiometricEnrollActivityTest {
try (ActivityScenario<BiometricEnrollActivity> scenario =
ActivityScenario.launch(getIntent())) {
intended(hasComponent(ChooseLockGeneric.class.getName()));
if (mHasFace && mHasFingerprint) {
intended(hasExtra(EXTRA_KEY_FOR_BIOMETRICS, true));
} else if (mHasFace) {
intended(hasExtra(EXTRA_KEY_FOR_FACE, true));
} else if (mHasFingerprint) {
intended(hasExtra(EXTRA_KEY_FOR_FINGERPRINT, true));
}
}
}
@@ -109,11 +121,9 @@ public class BiometricEnrollActivityTest {
response.getGatekeeperPasswordHandle());
}).get();
try (ActivityScenario<BiometricEnrollActivity> scenario =
ActivityScenario.launch(intent)) {
intended(hasComponent(mHasFace
intended(hasComponent(mHasFace && !mHasFingerprint
? FaceEnrollIntroduction.class.getName()
: FingerprintEnrollIntroduction.class.getName()));
}