From 41ced13ca47e2ea35c0993fb3ee793854d3d30c4 Mon Sep 17 00:00:00 2001 From: Tsung-Mao Fang Date: Tue, 8 Nov 2022 17:14:35 +0800 Subject: [PATCH 01/11] Update owner for Settings project Test: N/A Change-Id: I34245a8cb17f5d2dff635d6c8a7c089330f1a8a5 --- OWNERS | 1 - src/com/android/settings/tts/OWNERS | 3 --- 2 files changed, 4 deletions(-) diff --git a/OWNERS b/OWNERS index cc683ce7f77..80138fffcee 100644 --- a/OWNERS +++ b/OWNERS @@ -9,7 +9,6 @@ emilychuang@google.com millchen@google.com stanleytfwang@google.com sunnyshao@google.com -tmfang@google.com yantingyang@google.com # Exempt resource files (because they are in a flat directory and too hard to manage via OWNERS) diff --git a/src/com/android/settings/tts/OWNERS b/src/com/android/settings/tts/OWNERS index 8d9c2c660e8..7ba7dc13d92 100644 --- a/src/com/android/settings/tts/OWNERS +++ b/src/com/android/settings/tts/OWNERS @@ -1,5 +1,2 @@ # Default reviewers for this and subdirectories. rni@google.com - -# Emergency approvers in case the above are not available -tmfang@google.com \ No newline at end of file From 632fd43924856f097d702c8fc6098f53e1688518 Mon Sep 17 00:00:00 2001 From: Wilson Wu Date: Thu, 10 Nov 2022 15:16:33 +0800 Subject: [PATCH 02/11] Fix show/hide virtual keyboard delay The default observer delay is 10s for background service. When a device connected to a hardware keyboard, the delay makes soft keyboard visibility is unsync after user switch the configuration. Notify the SHOW_IME_WITH_HARD_KEYBOARD change without delay. Bug: 240210005 Test: Manual with bug steps Change-Id: I7f8cb0df514fdea4ed0e092cd4466931ec200969 --- .../settings/inputmethod/PhysicalKeyboardFragment.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java index 808129fb690..d7a208c17f9 100644 --- a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java +++ b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Activity; import android.app.settings.SettingsEnums; +import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.database.ContentObserver; @@ -211,8 +212,10 @@ public final class PhysicalKeyboardFragment extends SettingsPreferenceFragment private final OnPreferenceChangeListener mShowVirtualKeyboardSwitchPreferenceChangeListener = (preference, newValue) -> { - Secure.putInt(getContentResolver(), Secure.SHOW_IME_WITH_HARD_KEYBOARD, - ((Boolean) newValue) ? 1 : 0); + final ContentResolver cr = getContentResolver(); + Secure.putInt(cr, Secure.SHOW_IME_WITH_HARD_KEYBOARD, ((Boolean) newValue) ? 1 : 0); + cr.notifyChange(Secure.getUriFor(Secure.SHOW_IME_WITH_HARD_KEYBOARD), + null /* observer */, ContentResolver.NOTIFY_NO_DELAY); return true; }; From 566a7a3031c80dd1ddf492fbba00702b5cf4203c Mon Sep 17 00:00:00 2001 From: Joshua McCloskey Date: Fri, 11 Nov 2022 00:03:34 +0000 Subject: [PATCH 03/11] Centered fingerprint icon Test: Verified icon was centered in the fingerprint enrollment finish page. Fixes: 258604191 Change-Id: I33f19731921ef39829a6bbbaa1d1b097b95d64d4 --- res/layout/sfps_enroll_finish_base.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/layout/sfps_enroll_finish_base.xml b/res/layout/sfps_enroll_finish_base.xml index 17733374550..f58b86cd012 100644 --- a/res/layout/sfps_enroll_finish_base.xml +++ b/res/layout/sfps_enroll_finish_base.xml @@ -45,7 +45,7 @@ android:layout_marginTop="24dp" android:paddingTop="0dp" android:paddingBottom="0dp" - android:gravity="center"> + android:layout_gravity="center"> Date: Fri, 11 Nov 2022 15:36:23 +0000 Subject: [PATCH 04/11] Update fingerprint enrollment finished string Updates string displayed at completion of fingerprint enrollment Test: Observe updated string after enrolling a fingerprint Fixes: 257898484 Change-Id: I40ab1b67030f164c96c8abca0837bacc1560d1b5 --- res/values/strings.xml | 8 +++----- .../biometrics/fingerprint/FingerprintEnrollFinish.java | 6 +----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 96ffb8d3480..504c896cf33 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1287,14 +1287,12 @@ Enrolling fingerprint %d percent Fingerprint added - - Now you can use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps or approve a purchase - Now you can use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps + Now you can use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps or approve a purchase - Now you can use your fingerprint to unlock your device or verify it\u2019s you, like when you sign in to apps + Now you can use your fingerprint to unlock your device or verify it\u2019s you, like when you sign in to apps or approve a purchase - Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps + Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps or approve a purchase Unlock only when screen is on diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java index 45063104134..04a997cf68c 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java @@ -81,11 +81,7 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase { setContentView(R.layout.fingerprint_enroll_finish); } setHeaderText(R.string.security_settings_fingerprint_enroll_finish_title); - if (mCanAssumeSfps) { - setDescriptionText(R.string.security_settings_sfps_enroll_finish); - } else { - setDescriptionText(R.string.security_settings_fingerprint_enroll_finish_v2_message); - } + setDescriptionText(R.string.security_settings_fingerprint_enroll_finish_v2_message); mFooterBarMixin = getLayout().getMixin(FooterBarMixin.class); mFooterBarMixin.setSecondaryButton( From 3ca9965a9693894e913d4b97819b27aa0b644e21 Mon Sep 17 00:00:00 2001 From: Hao Dong Date: Wed, 2 Nov 2022 17:30:21 +0000 Subject: [PATCH 05/11] Fix the flicker of FingerprintSettings before FingerprintEnrollIntro. Change to launch FingerprintEnrollIntroductionInternal directly when no fingerprint enrolled and fingerprint is the only biometrics. This avoids the flicker of FingerPrintSettings before showing the enroll introduction. This partially reverts the change in ag/19732076. Bug: 256334588 Test: manual test following cases on fp-only devices, and enable don't keep activity and test them again. 1. fp enrollment on SUW 2. fp add another on SUW 3. add first fp on Security Settings 4. add another fp on Security Settings Test: atest FingerprintStatusUtilsTest BiometricsSafetySourceTest Change-Id: I057b00fbca6660012887ebedf4d65c2c3d35792b Merged-In: I057b00fbca6660012887ebedf4d65c2c3d35792b (cherry picked from commit 6bed01f3159115d158eaf264661721641ac33f7c) --- .../fingerprint/FingerprintStatusUtils.java | 4 +++- .../fingerprint/FingerprintStatusUtilsTest.java | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java index 71cdcf73b84..18db774214c 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java @@ -78,7 +78,9 @@ public class FingerprintStatusUtils { * Returns the class name of the Settings page corresponding to fingerprint settings. */ public String getSettingsClassName() { - return FingerprintSettings.class.getName(); + return !hasEnrolled() && isAvailable() + ? FingerprintEnrollIntroductionInternal.class.getName() + : FingerprintSettings.class.getName(); } /** diff --git a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java index 69e5e2f485b..a5d74a03500 100644 --- a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java +++ b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java @@ -179,8 +179,20 @@ public class FingerprintStatusUtilsTest { } @Test - public void getSettingsClassName_whenNotEnrolled_returnsFingerprintSettings() { + public void getSettingsClassName_whenNotEnrolled_fingerprintOnly_returnsFingerprintEnrollInduction() { when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(false); + when(mFingerprintManager.isHardwareDetected()).thenReturn(true); + when(mFaceManager.isHardwareDetected()).thenReturn(false); + + assertThat(mFingerprintStatusUtils.getSettingsClassName()) + .isEqualTo(FingerprintEnrollIntroductionInternal.class.getName()); + } + + @Test + public void getSettingsClassName_whenNotEnrolled_fingerprintNotOnly_returnsFingerprintSettings() { + when(mFingerprintManager.hasEnrolledFingerprints(anyInt())).thenReturn(false); + when(mFingerprintManager.isHardwareDetected()).thenReturn(true); + when(mFaceManager.isHardwareDetected()).thenReturn(true); assertThat(mFingerprintStatusUtils.getSettingsClassName()) .isEqualTo(FingerprintSettings.class.getName()); From 81aaba00e7f17563c90ed605aa1f8e2889d076c8 Mon Sep 17 00:00:00 2001 From: Edgar Wang Date: Tue, 13 Sep 2022 03:37:03 +0000 Subject: [PATCH 06/11] Change preference value changed metrics log format - Pass metric category into SharedPreferenceLogger - Update MainSwitchBar metric log format Bug: 246483846 Test: Robotest Change-Id: I91c7b89ee35ae4922aea0d8c998f7d0e33365da2 --- .../android/settings/SettingsActivity.java | 36 ++++++++++++++----- .../SettingsEventLogWriter.java | 16 +++++++++ .../SettingsIntelligenceLogWriter.java | 4 +++ .../core/instrumentation/StatsLogWriter.java | 10 ++++++ .../widget/SettingsMainSwitchBar.java | 21 +++-------- 5 files changed, 63 insertions(+), 24 deletions(-) diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 1553a548c68..076d0e1de7c 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -24,6 +24,7 @@ import static com.android.settings.applications.appinfo.AppButtonsPreferenceCont import android.app.ActionBar; import android.app.ActivityManager; +import android.app.settings.SettingsEnums; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -230,11 +231,32 @@ public class SettingsActivity extends SettingsBaseActivity @Override public SharedPreferences getSharedPreferences(String name, int mode) { - if (name.equals(getPackageName() + "_preferences")) { - return new SharedPreferencesLogger(this, getMetricsTag(), - FeatureFactory.getFactory(this).getMetricsFeatureProvider()); + if (!TextUtils.equals(name, getPackageName() + "_preferences")) { + return super.getSharedPreferences(name, mode); } - return super.getSharedPreferences(name, mode); + + String tag = getMetricsTag(); + + return new SharedPreferencesLogger(this, tag, + FeatureFactory.getFactory(this).getMetricsFeatureProvider(), + lookupMetricsCategory()); + } + + private int lookupMetricsCategory() { + int category = SettingsEnums.PAGE_UNKNOWN; + Bundle args = null; + if (getIntent() != null) { + args = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS); + } + + Fragment fragment = Utils.getTargetFragment(this, getMetricsTag(), args); + + if (fragment instanceof Instrumentable) { + category = ((Instrumentable) fragment).getMetricsCategory(); + } + Log.d(LOG_TAG, "MetricsCategory is " + category); + + return category; } private String getMetricsTag() { @@ -242,13 +264,11 @@ public class SettingsActivity extends SettingsBaseActivity if (getIntent() != null && getIntent().hasExtra(EXTRA_SHOW_FRAGMENT)) { tag = getInitialFragmentName(getIntent()); } + if (TextUtils.isEmpty(tag)) { Log.w(LOG_TAG, "MetricsTag is invalid " + tag); tag = getClass().getName(); } - if (tag.startsWith("com.android.settings.")) { - tag = tag.replace("com.android.settings.", ""); - } return tag; } @@ -320,7 +340,7 @@ public class SettingsActivity extends SettingsBaseActivity } mMainSwitch = findViewById(R.id.switch_bar); if (mMainSwitch != null) { - mMainSwitch.setMetricsTag(getMetricsTag()); + mMainSwitch.setMetricsCategory(lookupMetricsCategory()); mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1); } diff --git a/src/com/android/settings/core/instrumentation/SettingsEventLogWriter.java b/src/com/android/settings/core/instrumentation/SettingsEventLogWriter.java index f1658976c4d..e85576b5420 100644 --- a/src/com/android/settings/core/instrumentation/SettingsEventLogWriter.java +++ b/src/com/android/settings/core/instrumentation/SettingsEventLogWriter.java @@ -40,6 +40,22 @@ public class SettingsEventLogWriter extends EventLogWriter { super.hidden(context, category, visibleTime); } + @Override + public void clicked(int sourceCategory, String key) { + if (shouldDisableGenericEventLogging()) { + return; + } + super.clicked(sourceCategory, key); + } + + @Override + public void changed(int category, String key, int value) { + if (shouldDisableGenericEventLogging()) { + return; + } + super.changed(category, key, value); + } + @Override public void action(Context context, int category, String pkg) { if (shouldDisableGenericEventLogging()) { diff --git a/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java b/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java index 8dfa095eefd..86ee3d669e6 100644 --- a/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java +++ b/src/com/android/settings/core/instrumentation/SettingsIntelligenceLogWriter.java @@ -84,6 +84,10 @@ public class SettingsIntelligenceLogWriter implements LogWriter { public void clicked(int sourceCategory, String key) { } + @Override + public void changed(int category, String key, int value) { + } + @Override public void action(Context context, int action, Pair... taggedData) { action(SettingsEnums.PAGE_UNKNOWN /* attribution */, diff --git a/src/com/android/settings/core/instrumentation/StatsLogWriter.java b/src/com/android/settings/core/instrumentation/StatsLogWriter.java index 15b589fafb2..7b5915afd62 100644 --- a/src/com/android/settings/core/instrumentation/StatsLogWriter.java +++ b/src/com/android/settings/core/instrumentation/StatsLogWriter.java @@ -54,6 +54,16 @@ public class StatsLogWriter implements LogWriter { 0 /* changedPreferenceIntValue */); } + @Override + public void changed(int sourceCategory, String key, int value) { + SettingsStatsLog.write(SettingsStatsLog.SETTINGS_UI_CHANGED /* Atom name */, + sourceCategory /* attribution */, + SettingsEnums.ACTION_SETTINGS_PREFERENCE_CHANGE /* action */, + SettingsEnums.PAGE_UNKNOWN /* pageId */, + key /* changedPreferenceKey */, + value /* changedPreferenceIntValue */); + } + @Override public void action(Context context, int action, Pair... taggedData) { action(SettingsEnums.PAGE_UNKNOWN /* attribution */, diff --git a/src/com/android/settings/widget/SettingsMainSwitchBar.java b/src/com/android/settings/widget/SettingsMainSwitchBar.java index 5f752f9f7d5..5ad16d79f99 100644 --- a/src/com/android/settings/widget/SettingsMainSwitchBar.java +++ b/src/com/android/settings/widget/SettingsMainSwitchBar.java @@ -18,7 +18,6 @@ package com.android.settings.widget; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; -import android.app.settings.SettingsEnums; import android.content.Context; import android.util.AttributeSet; import android.view.View; @@ -55,7 +54,7 @@ public class SettingsMainSwitchBar extends MainSwitchBar { private final MetricsFeatureProvider mMetricsFeatureProvider; private OnBeforeCheckedChangeListener mOnBeforeListener; - private String mMetricsTag; + private int mMetricsCategory; public SettingsMainSwitchBar(Context context) { this(context, null); @@ -125,12 +124,7 @@ public class SettingsMainSwitchBar extends MainSwitchBar { } protected void onRestrictedIconClick() { - mMetricsFeatureProvider.action( - SettingsEnums.PAGE_UNKNOWN, - SettingsEnums.ACTION_SETTINGS_PREFERENCE_CHANGE, - SettingsEnums.PAGE_UNKNOWN, - mMetricsTag + "/switch_bar|restricted", - 1); + mMetricsFeatureProvider.clicked(mMetricsCategory, "switch_bar|restricted"); } @Override @@ -159,8 +153,8 @@ public class SettingsMainSwitchBar extends MainSwitchBar { /** * Set the metrics tag. */ - public void setMetricsTag(String tag) { - mMetricsTag = tag; + public void setMetricsCategory(int category) { + mMetricsCategory = category; } private View getDelegatingView() { @@ -168,11 +162,6 @@ public class SettingsMainSwitchBar extends MainSwitchBar { } private void logMetrics(boolean isChecked) { - mMetricsFeatureProvider.action( - SettingsEnums.PAGE_UNKNOWN, - SettingsEnums.ACTION_SETTINGS_PREFERENCE_CHANGE, - SettingsEnums.PAGE_UNKNOWN, - mMetricsTag + "/switch_bar", - isChecked ? 1 : 0); + mMetricsFeatureProvider.changed(mMetricsCategory, "switch_bar", isChecked ? 1 : 0); } } From c10d8ca0458322f0e1066b6e33bff9eb38ad4196 Mon Sep 17 00:00:00 2001 From: Joshua McCloskey Date: Thu, 10 Nov 2022 18:47:01 +0000 Subject: [PATCH 07/11] Remove sidefps toggle from SUW. Test: Verified manully that the toggle is no longer present when enrolling sidefps. Fixes: 258687688 Change-Id: I0ea63a61908b45399ba09ff31fd8fe6a4aacfb41 Merged-In: I0ea63a61908b45399ba09ff31fd8fe6a4aacfb41 --- res/layout/sfps_enroll_finish_base.xml | 9 --- .../sfps_require_screen_on_to_auth_toggle.xml | 62 --------------- .../fingerprint/FingerprintEnrollFinish.java | 33 -------- ...ingerprintRequireScreenOnToAuthToggle.java | 77 ------------------- 4 files changed, 181 deletions(-) delete mode 100644 res/layout/sfps_require_screen_on_to_auth_toggle.xml delete mode 100644 src/com/android/settings/biometrics/fingerprint/FingerprintRequireScreenOnToAuthToggle.java diff --git a/res/layout/sfps_enroll_finish_base.xml b/res/layout/sfps_enroll_finish_base.xml index 17733374550..e7dbaba337a 100644 --- a/res/layout/sfps_enroll_finish_base.xml +++ b/res/layout/sfps_enroll_finish_base.xml @@ -30,15 +30,6 @@ android:clipToPadding="false" android:clipChildren="false"> - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java index 45063104134..d4b1eb0ba6b 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java @@ -25,7 +25,6 @@ import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.os.Bundle; import android.util.Log; import android.view.View; -import android.widget.CompoundButton; import androidx.annotation.VisibleForTesting; @@ -45,7 +44,6 @@ import java.util.List; public class FingerprintEnrollFinish extends BiometricEnrollBase { private static final String TAG = "FingerprintEnrollFinish"; - private static final String KEY_REQUIRE_SCREEN_ON_TO_AUTH = "require_screen_on_to_auth_toggle"; private static final String ACTION_FINGERPRINT_SETTINGS = "android.settings.FINGERPRINT_SETTINGS"; @VisibleForTesting @@ -54,15 +52,10 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase { private FingerprintManager mFingerprintManager; - private FingerprintSettingsRequireScreenOnToAuthPreferenceController - mRequireScreenOnToAuthPreferenceController; - private FingerprintRequireScreenOnToAuthToggle mRequireScreenOnToAuthToggle; private boolean mCanAssumeSfps; private boolean mIsAddAnotherOrFinish; - private CompoundButton.OnCheckedChangeListener mRequireScreenOnToAuthToggleListener; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -72,11 +65,6 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase { mCanAssumeSfps = props != null && props.size() == 1 && props.get(0).isAnySidefpsType(); if (mCanAssumeSfps) { setContentView(R.layout.sfps_enroll_finish); - mRequireScreenOnToAuthPreferenceController = - new FingerprintSettingsRequireScreenOnToAuthPreferenceController( - getApplicationContext(), - KEY_REQUIRE_SCREEN_ON_TO_AUTH - ); } else { setContentView(R.layout.fingerprint_enroll_finish); } @@ -104,20 +92,6 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase { .setTheme(R.style.SudGlifButton_Primary) .build() ); - - if (mCanAssumeSfps) { - mRequireScreenOnToAuthToggleListener = - (buttonView, isChecked) -> { - mRequireScreenOnToAuthPreferenceController.setChecked(isChecked); - }; - mRequireScreenOnToAuthToggle = findViewById(R.id.require_screen_on_to_auth_toggle); - mRequireScreenOnToAuthToggle.setChecked( - mRequireScreenOnToAuthPreferenceController.isChecked()); - mRequireScreenOnToAuthToggle.setListener(mRequireScreenOnToAuthToggleListener); - mRequireScreenOnToAuthToggle.setOnClickListener(v -> { - mRequireScreenOnToAuthToggle.getSwitch().toggle(); - }); - } } @Override @@ -131,13 +105,6 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase { @Override protected void onResume() { super.onResume(); - if (mCanAssumeSfps) { - mRequireScreenOnToAuthToggleListener.onCheckedChanged( - mRequireScreenOnToAuthToggle.getSwitch(), - mRequireScreenOnToAuthToggle.isChecked() - ); - } - FooterButton addButton = mFooterBarMixin.getSecondaryButton(); final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(this); diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintRequireScreenOnToAuthToggle.java b/src/com/android/settings/biometrics/fingerprint/FingerprintRequireScreenOnToAuthToggle.java deleted file mode 100644 index f88c9aaec54..00000000000 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintRequireScreenOnToAuthToggle.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2022 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. - */ - -package com.android.settings.biometrics.fingerprint; - -import android.content.Context; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.widget.CompoundButton; -import android.widget.LinearLayout; -import android.widget.Switch; - -import com.android.settings.R; - -/** - * A layout that contains a start-justified title, and an end-justified switch. - */ -public class FingerprintRequireScreenOnToAuthToggle extends LinearLayout { - private Switch mSwitch; - - public FingerprintRequireScreenOnToAuthToggle(Context context) { - this(context, null /* attrs */); - } - - public FingerprintRequireScreenOnToAuthToggle(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public FingerprintRequireScreenOnToAuthToggle( - Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - - LayoutInflater.from(context).inflate(R.layout.sfps_require_screen_on_to_auth_toggle, - this, true /* attachToRoot */); - - mSwitch = findViewById(R.id.toggle); - mSwitch.setClickable(true); - mSwitch.setFocusable(false); - } - - public boolean isChecked() { - return mSwitch.isChecked(); - } - - /** - * - * @param checked - */ - public void setChecked(boolean checked) { - mSwitch.setChecked(checked); - } - - /** - * - * @param listener - */ - public void setListener(CompoundButton.OnCheckedChangeListener listener) { - mSwitch.setOnCheckedChangeListener(listener); - } - - public Switch getSwitch() { - return mSwitch; - } -} From a5dfab3fc03264d3f0e5161e471537f91ab84406 Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Tue, 15 Nov 2022 13:11:45 +0800 Subject: [PATCH 08/11] Move security_settings_sfps_enroll_finish to res-product Bug: 253772249 Test: Make Settings Change-Id: Id57c327573814cc99e11fede56f9a60a215fb494 --- res-product/values/strings.xml | 6 +++--- res/values/strings.xml | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/res-product/values/strings.xml b/res-product/values/strings.xml index 18f81acf9bb..93c2a1f306e 100644 --- a/res-product/values/strings.xml +++ b/res-product/values/strings.xml @@ -240,11 +240,11 @@ The fingerprint sensor is on the power button. It’s the flat button next to the raised volume button on the edge of the phone.\n\nPressing the power button turns off the screen. - Now you can use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps + Now you can use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps or approve a purchase - Now you can use your fingerprint to unlock your device or verify it\u2019s you, like when you sign in to apps + Now you can use your fingerprint to unlock your device or verify it\u2019s you, like when you sign in to apps or approve a purchase - Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps + Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps or approve a purchase A PIN protects the tablet if it\u2019s lost or stolen diff --git a/res/values/strings.xml b/res/values/strings.xml index 783b0beb395..70f765463d4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -797,12 +797,6 @@ Enrolling fingerprint %d percent Fingerprint added - - Now you can use your fingerprint to unlock your tablet or verify it\u2019s you, like when you sign in to apps or approve a purchase - - Now you can use your fingerprint to unlock your device or verify it\u2019s you, like when you sign in to apps or approve a purchase - - Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps or approve a purchase Unlock only when screen is on From ecdfe28bd2bd7a3b2eeb02cd2c2b0e32fac9267b Mon Sep 17 00:00:00 2001 From: sandeepjs Date: Mon, 7 Nov 2022 07:05:24 +0000 Subject: [PATCH 09/11] [Android U][eSIM] Modify esim and sim card strings as part of esim primary As part of esim primary, esim and sim card related strings are changed for AndroidSettings project with reference from https://docs.google.com/spreadsheets/d/1RPVnNvmcjd-NSvPGg1jOi0mdC-sbCHvt9HVU4glV8fs/edit#gid=1716745126 Test: build Bug: 257380320 Change-Id: I984d56e724dbd906e48358a31c6a7cb1e5db4fdf --- res/values/strings.xml | 78 +++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 1f0cce117fa..80817467422 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2269,19 +2269,19 @@ Make text bigger or smaller - SIM card lock settings - - SIM card lock - - Lock SIM card + SIM lock settings + + SIM lock + + Lock SIM Change SIM PIN SIM PIN - - Lock SIM card - - Unlock SIM card + + Lock SIM + + Unlock SIM Old SIM PIN @@ -2321,7 +2321,7 @@ Use %1$s - Update preferred SIM card? + Update preferred SIM? %1$s is the only SIM in your device. Do you want to use this SIM for mobile data, calls, and SMS messages? @@ -2690,7 +2690,7 @@ Erase - Erase downloaded SIMs + Erase eSIMs This won’t cancel any mobile service plans. To download replacement SIMs, contact your carrier. @@ -2699,7 +2699,7 @@ Reset all network settings? You can\u2019t undo this action. - Reset all network settings and erase downloaded SIMs? You can\u2019t undo this action. + Reset all network settings and erase eSIMs? You can\u2019t undo this action. Reset settings @@ -2711,7 +2711,7 @@ Can\u2019t erase SIMs - Downloaded SIMs can\u2019t be erased due to an error.\n\nRestart your device and try again. + eSIMs can\u2019t be erased due to an error.\n\nRestart your device and try again. @@ -6278,7 +6278,7 @@ - SIM cards + SIMs Mobile data is unavailable @@ -6313,8 +6313,8 @@ SIM status (sim slot %1$d) %1$d dBm %2$d asu - - SIM cards changed. + + SIMs changed. Tap to set up @@ -8013,7 +8013,7 @@ Confirm SIM deletion - Verify it\u0027s you before erasing a downloaded SIM + Verify it\u0027s you before erasing a eSIM @@ -10085,7 +10085,7 @@ - No SIM card available + No SIM available @@ -10139,10 +10139,10 @@ Inactive / SIM - Active / Downloaded SIM + Active / eSIM - Inactive / Downloaded SIM + Inactive / eSIM Only one SIM can be active at a time.\n\nSwitching to %1$s won\u2019t cancel your %2$s service. - - Only one downloaded SIM can be active at a time.\n\nSwitching to %1$s won\u2019t cancel your %2$s service. + + Only 1 eSIM can be active at a time.\n\nSwitching to %1$s won\u2019t cancel your %2$s service. Only one SIM can be active at a time.\n\nSwitching won\u2019t cancel your %1$s service. @@ -10337,12 +10337,12 @@ To use mobile data, call features, and SMS at a later time, go to your network settings - - SIM card + + SIM - - Erase this downloaded SIM? + + Erase this eSIM? Erasing this SIM removes %1$s service from this device.\n\nService for %1$s won\'t be canceled. @@ -10716,10 +10716,10 @@ W+ network SIM - - DOWNLOADED SIM - - DOWNLOADED SIMS + + eSIM + + eSIMs Active @@ -10849,7 +10849,7 @@ Call Settings error - Network or SIM card error. + Network or SIM error. Sim is not activated. @@ -10910,14 +10910,14 @@ Color preview - - SIM card access request - - A device wants to access your SIM card. Tap for details. - - Allow access to SIM card? - - A Bluetooth device, %1$s, wants to access data on your SIM card. This includes your contacts.\n\nWhile connected, %2$s will receive all calls made to %3$s. + + SIM access request + + A device wants to access your SIM. Tap for details. + + Allow access to SIM? + + A Bluetooth device, %1$s, wants to access data from your SIM. This includes your contacts.\n\nWhile connected, %2$s will receive all calls made to %3$s. Bluetooth device available From 93049776741f7d5ea9d52c842a365dc73468a929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAnkita?= Date: Tue, 15 Nov 2022 05:47:08 +0000 Subject: [PATCH 10/11] Do not show Choose Profile dialog for clone user. Bug: 249194639 Test: make RunSettingsRoboTests -j64 Test: make RunSettingsRoboTests ROBOTEST_FILTER=ProfileSelectDialogTest Change-Id: I35279f643f8c562df7b407fdf2cbfd2ae5ee9890 --- .../profileselector/ProfileSelectDialog.java | 4 +++- .../ProfileSelectDialogTest.java | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java index f82694c5841..ef6ad832477 100644 --- a/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java +++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java @@ -23,6 +23,7 @@ import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnDismissListener; import android.content.DialogInterface.OnShowListener; import android.content.Intent; +import android.content.pm.UserInfo; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; @@ -168,7 +169,8 @@ public class ProfileSelectDialog extends DialogFragment implements UserAdapter.O } final UserManager userManager = UserManager.get(context); for (int i = userHandles.size() - 1; i >= 0; i--) { - if (userManager.getUserInfo(userHandles.get(i).getIdentifier()) == null) { + UserInfo userInfo = userManager.getUserInfo(userHandles.get(i).getIdentifier()); + if (userInfo == null || userInfo.isCloneProfile()) { if (DEBUG) { Log.d(TAG, "Delete the user: " + userHandles.get(i).getIdentifier()); } diff --git a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java index e1cf52b995b..4e81ceeb437 100644 --- a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java +++ b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java @@ -53,6 +53,7 @@ public class ProfileSelectDialogTest { private static final UserHandle NORMAL_USER = new UserHandle(1111); private static final UserHandle REMOVED_USER = new UserHandle(2222); + private static final UserHandle CLONE_USER = new UserHandle(3333); @Spy private Context mContext = ApplicationProvider.getApplicationContext(); @@ -101,6 +102,22 @@ public class ProfileSelectDialogTest { verify(mUserManager, times(2)).getUserInfo(REMOVED_USER.getIdentifier()); } + @Test + public void updateUserHandlesIfNeeded_removesCloneProfile() { + final UserInfo userInfo = new UserInfo(CLONE_USER.getIdentifier(), "clone_user", null, + UserInfo.FLAG_PROFILE, UserManager.USER_TYPE_PROFILE_CLONE); + when(mUserManager.getUserInfo(CLONE_USER.getIdentifier())).thenReturn(userInfo); + final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE); + tile.userHandle.add(CLONE_USER); + tile.userHandle.add(NORMAL_USER); + + ProfileSelectDialog.updateUserHandlesIfNeeded(mContext, tile); + + assertThat(tile.userHandle).hasSize(1); + assertThat(tile.userHandle.get(0).getIdentifier()).isEqualTo(NORMAL_USER.getIdentifier()); + verify(mUserManager, times(1)).getUserInfo(CLONE_USER.getIdentifier()); + } + @Test public void createDialog_showsCorrectTitle() { mContext.setTheme(R.style.Theme_AppCompat); From 3cf14b682e312f7ca8f161a8749a33f1a6604048 Mon Sep 17 00:00:00 2001 From: ykhung Date: Tue, 15 Nov 2022 15:06:18 +0800 Subject: [PATCH 11/11] Clean up the KEY_ROUTINE from the Settings Fix: 258603978 Test: make RunSettingsRoboTests Change-Id: I65033ca18953b57317af64418bb0b18d48eaacd8 --- ...rySaverScheduleRadioButtonsController.java | 22 ++++++------------ ...verScheduleRadioButtonsControllerTest.java | 23 +------------------ 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java index 7b17dcb7d39..c584b9b67fb 100644 --- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java +++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsController.java @@ -22,6 +22,7 @@ import android.os.PowerManager; import android.provider.Settings; import android.provider.Settings.Global; import android.text.TextUtils; +import android.util.Log; import com.android.settingslib.fuelgauge.BatterySaverUtils; @@ -36,9 +37,9 @@ import com.android.settingslib.fuelgauge.BatterySaverUtils; * See {@link Settings.Global#AUTOMATIC_POWER_SAVE_MODE} for more details. */ public class BatterySaverScheduleRadioButtonsController { + private static final String TAG = "BatterySaverScheduleRadioButtonsController"; public static final String KEY_NO_SCHEDULE = "key_battery_saver_no_schedule"; - public static final String KEY_ROUTINE = "key_battery_saver_routine"; public static final String KEY_PERCENTAGE = "key_battery_saver_percentage"; public static final int TRIGGER_LEVEL_MIN = 10; @@ -53,20 +54,17 @@ public class BatterySaverScheduleRadioButtonsController { public String getDefaultKey() { final ContentResolver resolver = mContext.getContentResolver(); - // Note: this can also be obtained via PowerManager.getPowerSaveModeTrigger() final int mode = Settings.Global.getInt(resolver, Global.AUTOMATIC_POWER_SAVE_MODE, PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE); - // if mode is "dynamic" we are in routine mode, percentage with non-zero threshold is - // percentage mode, otherwise it is no schedule mode if (mode == PowerManager.POWER_SAVE_MODE_TRIGGER_PERCENTAGE) { final int threshold = Settings.Global.getInt(resolver, Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0); - if (threshold <= 0) { - return KEY_NO_SCHEDULE; - } - return KEY_PERCENTAGE; + return threshold <= 0 ? KEY_NO_SCHEDULE : KEY_PERCENTAGE; } - return KEY_ROUTINE; + // Convert the legacy routine mode into none. + BatterySaverUtils.revertScheduleToNoneIfNeeded(mContext); + Log.w(TAG, "Found the legacy routine mode and set into none"); + return KEY_NO_SCHEDULE; } public boolean setDefaultKey(String key) { @@ -89,12 +87,6 @@ public class BatterySaverScheduleRadioButtonsController { confirmationExtras.putInt(BatterySaverUtils.EXTRA_POWER_SAVE_MODE_TRIGGER_LEVEL, triggerLevel); break; - case KEY_ROUTINE: - mode = PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC; - confirmationExtras.putBoolean(BatterySaverUtils.EXTRA_CONFIRM_TEXT_ONLY, true); - confirmationExtras.putInt(BatterySaverUtils.EXTRA_POWER_SAVE_MODE_TRIGGER, - PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC); - break; default: throw new IllegalStateException( "Not a valid key for " + this.getClass().getSimpleName()); diff --git a/tests/unit/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsControllerTest.java b/tests/unit/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsControllerTest.java index b807114f412..f708f6c843b 100644 --- a/tests/unit/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsControllerTest.java +++ b/tests/unit/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleRadioButtonsControllerTest.java @@ -52,7 +52,7 @@ public class BatterySaverScheduleRadioButtonsControllerTest { Settings.Global.putInt(mResolver, Global.AUTOMATIC_POWER_SAVE_MODE, PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC); assertThat(mController.getDefaultKey()) - .isEqualTo(BatterySaverScheduleRadioButtonsController.KEY_ROUTINE); + .isEqualTo(BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE); } @Test @@ -73,14 +73,6 @@ public class BatterySaverScheduleRadioButtonsControllerTest { .isEqualTo(BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE); } - @Test - public void setDefaultKey_any_defaultsToNoScheduleIfWarningNotSeen() { - Secure.putString( - mContext.getContentResolver(), Secure.LOW_POWER_WARNING_ACKNOWLEDGED, "null"); - mController.setDefaultKey(BatterySaverScheduleRadioButtonsController.KEY_ROUTINE); - assertThat(mController.getDefaultKey()) - .isEqualTo(BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE); - } @Test public void setDefaultKey_percentage_shouldSuppressNotification() { @@ -95,17 +87,4 @@ public class BatterySaverScheduleRadioButtonsControllerTest { Secure.SUPPRESS_AUTO_BATTERY_SAVER_SUGGESTION, 0); assertThat(result).isEqualTo(1); } - - @Test - public void setDefaultKey_routine_shouldSuppressNotification() { - Secure.putInt( - mContext.getContentResolver(), Secure.LOW_POWER_WARNING_ACKNOWLEDGED, 1); - Settings.Global.putInt(mResolver, Global.AUTOMATIC_POWER_SAVE_MODE, - PowerManager.POWER_SAVE_MODE_TRIGGER_DYNAMIC); - mController.setDefaultKey(BatterySaverScheduleRadioButtonsController.KEY_ROUTINE); - - final int result = Settings.Secure.getInt(mResolver, - Secure.SUPPRESS_AUTO_BATTERY_SAVER_SUGGESTION, 0); - assertThat(result).isEqualTo(1); - } }