Snap for 9257771 from bc38bacaf2 to tm-qpr2-release

Change-Id: Ie592c9b64452a233a37a8876c54fbe00aba22482
This commit is contained in:
Android Build Coastguard Worker
2022-11-05 01:25:56 +00:00
12 changed files with 95 additions and 55 deletions

View File

@@ -88,6 +88,7 @@ android_library {
"WifiTrackerLib",
"SettingsLibActivityEmbedding",
"Settings-change-ids",
"SystemUIUnfoldLib",
],
libs: [

View File

@@ -2976,6 +2976,7 @@
android:taskAffinity="com.android.settings.FallbackHome"
android:exported="true"
android:theme="@style/FallbackHome"
android:permission="android.permission.DEVICE_POWER"
android:configChanges="keyboardHidden">
<intent-filter android:priority="-1000">
<action android:name="android.intent.action.MAIN" />

View File

@@ -30,12 +30,14 @@
android:clipToPadding="false"
android:clipChildren="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<com.android.settings.biometrics.fingerprint.FingerprintRequireScreenOnToAuthToggle
style="@style/SudSwitchStyle"
android:id="@+id/require_screen_on_to_auth_toggle"
android:layout_gravity="start"
android:paddingLeft="0dp"
android:paddingStart="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.setupdesign.view.FillContentLayout
android:layout_width="@dimen/sfps_enrollment_finished_icon_max_size"
@@ -54,21 +56,6 @@
android:importantForAccessibility="no"
android:src="@drawable/sfps_enroll_finish" />
</com.google.android.setupdesign.view.FillContentLayout>
<Space
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<com.android.settings.biometrics.fingerprint.FingerprintRequireScreenOnToAuthToggle
style="@style/SudSwitchStyle"
android:id="@+id/require_screen_on_to_auth_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom" />
</LinearLayout>
</LinearLayout>
</com.google.android.setupdesign.GlifLayout>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -19,24 +19,16 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
style="?attr/fingerprint_layout_theme">
<!-- Top divider -->
<View
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />
<!-- Title -->
<com.google.android.setupdesign.view.RichTextView
android:id="@+id/title"
android:paddingHorizontal="8dp"
android:paddingTop="8dp"
android:paddingBottom="4dp"
android:gravity="start"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/toggle"
android:textAlignment="viewStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/security_settings_require_screen_on_to_auth_title"
@@ -47,9 +39,9 @@
<!-- Subtitle -->
<TextView
android:id="@+id/subtitle"
android:paddingHorizontal="8dp"
android:paddingBottom="8dp"
android:layout_alignParentStart="true"
android:textAlignment="viewStart"
android:layout_toStartOf="@+id/toggle"
android:layout_below="@+id/title"
android:layout_width="wrap_content"
@@ -57,16 +49,6 @@
android:text="@string/security_settings_require_screen_on_to_auth_description"
android:textColor="?android:attr/textColorSecondary"/>
<!-- Vertical divider -->
<View
android:layout_centerVertical="true"
android:layout_alignTop="@+id/toggle"
android:layout_alignBottom="@+id/toggle"
android:layout_toStartOf="@+id/toggle"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="?android:attr/listDivider" />
<!-- Toggle -->
<Switch
android:layout_alignParentEnd="true"
@@ -74,6 +56,7 @@
android:layout_height="wrap_content"
android:id="@+id/toggle"
android:layout_centerVertical="true"
android:checked="false"/>
android:checked="false"
style="@style/SudSwitchStyle"/>
</RelativeLayout>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -18,6 +18,7 @@ package com.android.settings.biometrics.fingerprint;
import android.app.settings.SettingsEnums;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
@@ -29,6 +30,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.accessibility.AccessibilityManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.settings.R;
@@ -38,6 +40,8 @@ import com.android.settings.biometrics.BiometricEnrollSidecar;
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settingslib.widget.LottieColorUtils;
import com.android.systemui.unfold.compat.ScreenSizeFoldProvider;
import com.android.systemui.unfold.updates.FoldProvider;
import com.airbnb.lottie.LottieAnimationView;
import com.google.android.setupcompat.template.FooterBarMixin;
@@ -49,7 +53,7 @@ import java.util.List;
* Activity explaining the fingerprint sensor location for fingerprint enrollment.
*/
public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
BiometricEnrollSidecar.Listener {
BiometricEnrollSidecar.Listener, FoldProvider.FoldCallback {
private static final String TAG = "FingerprintEnrollFindSensor";
private static final String SAVED_STATE_IS_NEXT_CLICKED = "is_next_clicked";
@@ -67,6 +71,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
private OrientationEventListener mOrientationEventListener;
private int mPreviousRotation = 0;
private ScreenSizeFoldProvider mScreenSizeFoldProvider;
private boolean mIsFolded;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -78,6 +84,10 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
mCanAssumeUdfps = props != null && props.size() == 1 && props.get(0).isAnyUdfpsType();
mCanAssumeSfps = props != null && props.size() == 1 && props.get(0).isAnySidefpsType();
setContentView(getContentView());
mScreenSizeFoldProvider = new ScreenSizeFoldProvider(getApplicationContext());
mScreenSizeFoldProvider.registerCallback(this, getApplicationContext().getMainExecutor());
mScreenSizeFoldProvider
.onConfigurationChange(getApplicationContext().getResources().getConfiguration());
mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class);
mFooterBarMixin.setSecondaryButton(
new FooterButton.Builder(this)
@@ -166,25 +176,47 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
}
private void updateSfpsFindSensorAnimationAsset() {
mScreenSizeFoldProvider
.onConfigurationChange(getApplicationContext().getResources().getConfiguration());
mIllustrationLottie = findViewById(R.id.illustration_lottie);
final int rotation = getApplicationContext().getDisplay().getRotation();
switch (rotation) {
case Surface.ROTATION_90:
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_portrait_top_left);
if (mIsFolded) {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_folded_top_left);
} else {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_portrait_top_left);
}
break;
case Surface.ROTATION_180:
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_landscape_bottom_left);
if (mIsFolded) {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_folded_bottom_left);
} else {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_landscape_bottom_left);
}
break;
case Surface.ROTATION_270:
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_portrait_bottom_right);
if (mIsFolded) {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_folded_bottom_right);
} else {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_portrait_bottom_right);
}
break;
default:
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_landscape_top_right);
if (mIsFolded) {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_folded_top_right);
} else {
mIllustrationLottie.setAnimation(
R.raw.fingerprint_edu_lottie_landscape_top_right);
}
break;
}
@@ -193,6 +225,12 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
mIllustrationLottie.playAnimation();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mScreenSizeFoldProvider.onConfigurationChange(newConfig);
}
@Override
protected void onResume() {
super.onResume();
@@ -286,6 +324,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
@Override
protected void onStop() {
super.onStop();
mScreenSizeFoldProvider.unregisterCallback(this);
if (mAnimation != null) {
mAnimation.pauseAnimation();
}
@@ -423,4 +462,10 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
}
mOrientationEventListener = null;
}
@Override
public void onFoldUpdated(boolean isFolded) {
Log.d(TAG, "onFoldUpdated= " + isFolded);
mIsFolded = isFolded;
}
}

View File

@@ -243,7 +243,9 @@ public class FingerprintSettings extends SubSettings {
}
private void updateDialog() {
setRequireScreenOnToAuthVisibility();
if (isSfps()) {
setRequireScreenOnToAuthVisibility();
}
RenameDialog renameDialog = (RenameDialog) getFragmentManager().
findFragmentByTag(RenameDialog.class.getName());
if (renameDialog != null) {
@@ -455,6 +457,15 @@ public class FingerprintSettings extends SubSettings {
return false;
}
private boolean isSfps() {
for (FingerprintSensorPropertiesInternal prop : mSensorProperties) {
if (prop.isAnySidefpsType()) {
return true;
}
}
return false;
}
protected void removeFingerprintPreference(int fingerprintId) {
String name = genKey(fingerprintId);
Preference prefToRemove = findPreference(name);
@@ -493,6 +504,10 @@ public class FingerprintSettings extends SubSettings {
mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked);
return true;
});
mRequireScreenOnToAuthPreference.setVisible(false);
if (isSfps()) {
setRequireScreenOnToAuthVisibility();
}
setPreferenceScreen(root);
return root;
}

View File

@@ -1681,7 +1681,10 @@ public class UserSettings extends SettingsPreferenceFragment
}
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
Bitmap icon = BitmapFactory.decodeStream(avatarDataStream);
Bitmap decodedIcon = BitmapFactory.decodeStream(avatarDataStream);
CircleFramedDrawable drawable = CircleFramedDrawable.getInstance(context, decodedIcon);
Bitmap icon = UserIcons.convertToBitmapAtUserIconSize(context.getResources(), drawable);
um.setUserIcon(userId, icon);
try {
avatarDataStream.close();