From 3aa9c793413dc2e615e86fef29dfcc9c64dd5acf Mon Sep 17 00:00:00 2001 From: zoey chen Date: Fri, 31 May 2019 11:02:25 +0800 Subject: [PATCH 01/10] UE showed wrong title and message when enabling data roaming. It set wrong string when building the roaming dialog. BUG: 133731388 Test: Manual test Change-Id: Ib46b2b2ba1d62f84da7cd82bbbc03fe4f3069afc --- .../settings/network/telephony/RoamingDialogFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/network/telephony/RoamingDialogFragment.java b/src/com/android/settings/network/telephony/RoamingDialogFragment.java index c527d3c0021..1298445c874 100644 --- a/src/com/android/settings/network/telephony/RoamingDialogFragment.java +++ b/src/com/android/settings/network/telephony/RoamingDialogFragment.java @@ -61,12 +61,13 @@ public class RoamingDialogFragment extends InstrumentedDialogFragment implements public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); int title = R.string.roaming_alert_title; + int message = R.string.roaming_warning; PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId); if (carrierConfig != null && carrierConfig.getBoolean( CarrierConfigManager.KEY_CHECK_PRICING_WITH_CARRIER_FOR_DATA_ROAMING_BOOL)) { - title = R.string.roaming_check_price_warning; + message = R.string.roaming_check_price_warning; } - builder.setMessage(getResources().getString(R.string.roaming_warning)) + builder.setMessage(getResources().getString(message)) .setTitle(title) .setIconAttribute(android.R.attr.alertDialogIcon) .setPositiveButton(android.R.string.yes, this) From 3631ed9dee194ee76270528480dadbaf4ba18956 Mon Sep 17 00:00:00 2001 From: Antony Sargent Date: Wed, 5 Jun 2019 14:16:48 -0700 Subject: [PATCH 02/10] Strings for pSIM on/off toggle removal We need to remove the on/off toggle for pSIMs because of unexpected problems in the telephony stack with being able to disable a pSIM. These new strings are used in the updated UX we're adding to deal with this. Bug: 132921553 Test: n/a Change-Id: I60816289e0ef65bbf882a8dca6f08c46742bb1c9 --- res/values/strings.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index 8d53e414fd5..161f8163e59 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -10983,6 +10983,20 @@ Off + + + To disable this SIM, remove the SIM card + + + + + Tap to activate %1$s + 2-button navigation - To switch apps, swipe up on the Home button. Swipe up again to see all apps. Works from any screen. You’ll no longer have an Overview button on the bottom right of your screen. + To switch apps, swipe up on the Home button. To see all apps, swipe up again. To go back, tap the back button. Try the new Home button @@ -10210,12 +10210,12 @@ Gesture navigation - To go Home, swipe up from the bottom of the screen. To go Back, swipe from either the left or right edge of the screen. To switch apps, start swiping up from the bottom of the screen and hold before releasing. + To go Home, swipe up from the bottom of the screen. To switch apps, swipe up from the bottom, hold, then release. To go back, swipe from either the left or right edge. 3-button navigation - Classic Android navigation mode where going Home, switching apps, and going Back are accessible via buttons. + Go back, Home, and switch apps with buttons at the bottom of your screen. system navigation, 2 button navigation, 3 button navigation, gesture navigation From 10576db7650cce79961b80552fa11b6b36a69abf Mon Sep 17 00:00:00 2001 From: joshmccloskey Date: Thu, 6 Jun 2019 16:13:59 -0700 Subject: [PATCH 06/10] Updating colors for dark theme Bug: 133277663 Test: Verified colors are correct for dark & light themes. Change-Id: If1aa5f22286d15918cfec3cd4a6436760bf304b2 --- color-check-baseline.xml | 32 +++++++++++++++++++++++ res/drawable/face_enroll_introduction.xml | 2 +- res/values-night/colors.xml | 1 + res/values/colors.xml | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/color-check-baseline.xml b/color-check-baseline.xml index 41cb12d03b5..3cb964fefd8 100644 --- a/color-check-baseline.xml +++ b/color-check-baseline.xml @@ -3037,4 +3037,36 @@ column="5"/> + + + + + + + + diff --git a/res/drawable/face_enroll_introduction.xml b/res/drawable/face_enroll_introduction.xml index 576ac58d981..217b13c2ff2 100644 --- a/res/drawable/face_enroll_introduction.xml +++ b/res/drawable/face_enroll_introduction.xml @@ -22,7 +22,7 @@ android:viewportHeight="300"> @*android:color/material_grey_800 #AECBFA #5F6368 + ?android:attr/colorAccent diff --git a/res/values/colors.xml b/res/values/colors.xml index 4a4c896a770..7114bb15152 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -147,4 +147,5 @@ @*android:color/background_device_default_light + #ffdadce0 \ No newline at end of file From e4c2e427a1534a219c0a635a3c9cf46fe65786a9 Mon Sep 17 00:00:00 2001 From: George Chang Date: Thu, 30 May 2019 18:23:18 +0800 Subject: [PATCH 07/10] Fix NFC state switched off every time user entered connection preferences page NfcAirplaneModeObserver added a scenario that switched NFC off every time a user entered connection preferences page if airplane mode was on. Even when a user manually switched on NFC, the observer would still turn NFC off when re-entering connection preferences page. GSAM TS.27 certification requires NFC state to be consistent under AirplaneMode before and after reboot the device. NfcAirplaneModeObserver breaks the requirement because it would always switch NFC off under airplane mode when a user checked the NFC state in settings page. Fix it by removing NfcAirplaneModeObserver. Keep the NFC state consistent. Bug:128384879 Test: make RunSettingsRoboTests / Check Nfc on/off Status Merged-In: If4c8e47c2509b09e8bc1a464e1ab329b945e3d20 Change-Id: If4c8e47c2509b09e8bc1a464e1ab329b945e3d20 --- .../settings/nfc/NfcAirplaneModeObserver.java | 83 ------------- .../settings/nfc/NfcPreferenceController.java | 13 -- .../nfc/NfcAirplaneModeObserverTest.java | 117 ------------------ .../nfc/NfcPreferenceControllerTest.java | 32 ----- 4 files changed, 245 deletions(-) delete mode 100644 src/com/android/settings/nfc/NfcAirplaneModeObserver.java delete mode 100644 tests/robotests/src/com/android/settings/nfc/NfcAirplaneModeObserverTest.java diff --git a/src/com/android/settings/nfc/NfcAirplaneModeObserver.java b/src/com/android/settings/nfc/NfcAirplaneModeObserver.java deleted file mode 100644 index afb5616a4fa..00000000000 --- a/src/com/android/settings/nfc/NfcAirplaneModeObserver.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2018 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.nfc; - -import android.content.Context; -import android.database.ContentObserver; -import android.net.Uri; -import android.nfc.NfcAdapter; -import android.os.Handler; -import android.os.Looper; -import android.provider.Settings; - -import androidx.annotation.VisibleForTesting; -import androidx.preference.Preference; - -/** - * NfcAirplaneModeObserver is a helper to manage the Nfc on/off when airplane mode status - * is changed. - */ -public class NfcAirplaneModeObserver extends ContentObserver { - - private final Context mContext; - private final NfcAdapter mNfcAdapter; - private final Preference mPreference; - private int mAirplaneMode; - - @VisibleForTesting - final static Uri AIRPLANE_MODE_URI = - Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON); - - public NfcAirplaneModeObserver(Context context, NfcAdapter nfcAdapter, Preference preference) { - super(new Handler(Looper.getMainLooper())); - mContext = context; - mNfcAdapter = nfcAdapter; - mPreference = preference; - updateNfcPreference(); - } - - public void register() { - mContext.getContentResolver().registerContentObserver(AIRPLANE_MODE_URI, false, this); - } - - public void unregister() { - mContext.getContentResolver().unregisterContentObserver(this); - } - - @Override - public void onChange(boolean selfChange, Uri uri) { - super.onChange(selfChange, uri); - updateNfcPreference(); - } - - private void updateNfcPreference() { - final int airplaneMode = Settings.Global.getInt( - mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, mAirplaneMode); - if (airplaneMode == mAirplaneMode) { - return; - } - - mAirplaneMode = airplaneMode; - if (mAirplaneMode == 1) { - // airplane mode is on, need to turn off NFC, and check if user can toggle it - mNfcAdapter.disable(); - mPreference.setEnabled(NfcPreferenceController.isToggleableInAirplaneMode(mContext)); - } else { - // airplane mode is off, no restriction - mPreference.setEnabled(true); - } - } -} diff --git a/src/com/android/settings/nfc/NfcPreferenceController.java b/src/com/android/settings/nfc/NfcPreferenceController.java index 2ca3b23daea..34e7e24efd6 100644 --- a/src/com/android/settings/nfc/NfcPreferenceController.java +++ b/src/com/android/settings/nfc/NfcPreferenceController.java @@ -41,8 +41,6 @@ public class NfcPreferenceController extends TogglePreferenceController public static final String KEY_TOGGLE_NFC = "toggle_nfc"; private final NfcAdapter mNfcAdapter; private NfcEnabler mNfcEnabler; - @VisibleForTesting - NfcAirplaneModeObserver mAirplaneModeObserver; public NfcPreferenceController(Context context, String key) { super(context, key); @@ -61,11 +59,6 @@ public class NfcPreferenceController extends TogglePreferenceController mNfcEnabler = new NfcEnabler(mContext, switchPreference); - // Listen to airplane mode updates if NFC should be turned off when airplane mode is on - if (shouldTurnOffNFCInAirplaneMode(mContext) || isToggleableInAirplaneMode(mContext)) { - mAirplaneModeObserver = - new NfcAirplaneModeObserver(mContext, mNfcAdapter, switchPreference); - } } @Override @@ -108,9 +101,6 @@ public class NfcPreferenceController extends TogglePreferenceController @Override public void onResume() { - if (mAirplaneModeObserver != null) { - mAirplaneModeObserver.register(); - } if (mNfcEnabler != null) { mNfcEnabler.resume(); } @@ -118,9 +108,6 @@ public class NfcPreferenceController extends TogglePreferenceController @Override public void onPause() { - if (mAirplaneModeObserver != null) { - mAirplaneModeObserver.unregister(); - } if (mNfcEnabler != null) { mNfcEnabler.pause(); } diff --git a/tests/robotests/src/com/android/settings/nfc/NfcAirplaneModeObserverTest.java b/tests/robotests/src/com/android/settings/nfc/NfcAirplaneModeObserverTest.java deleted file mode 100644 index 06d9773deb7..00000000000 --- a/tests/robotests/src/com/android/settings/nfc/NfcAirplaneModeObserverTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2018 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.nfc; - -import static com.google.common.truth.Truth.assertThat; - -import android.content.ContentResolver; -import android.content.Context; -import android.nfc.NfcAdapter; -import android.provider.Settings; -import android.provider.Settings.Global; - -import androidx.preference.SwitchPreference; - -import com.android.settings.testutils.shadow.ShadowNfcAdapter; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.robolectric.RobolectricTestRunner; -import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; -import org.robolectric.util.ReflectionHelpers; - -@RunWith(RobolectricTestRunner.class) -@Config(shadows = {ShadowNfcAdapter.class}) -public class NfcAirplaneModeObserverTest { - - private Context mContext; - private NfcAdapter mNfcAdapter; - private SwitchPreference mNfcPreference; - private NfcAirplaneModeObserver mNfcAirplaneModeObserver; - - @Before - public void setUp() { - mContext = RuntimeEnvironment.application; - mNfcAdapter = NfcAdapter.getDefaultAdapter(mContext); - - mNfcPreference = new SwitchPreference(mContext); - - mNfcAirplaneModeObserver = - new NfcAirplaneModeObserver(mContext, mNfcAdapter, mNfcPreference); - } - - @Test - public void NfcAirplaneModeObserver_airplaneOn_shouldDisableNfc() { - ReflectionHelpers.setField(mNfcAirplaneModeObserver, - "mAirplaneMode", 0); - Settings.Global.putInt(mContext.getContentResolver(), - Settings.Global.AIRPLANE_MODE_ON, 1); - - mNfcAirplaneModeObserver.onChange(false, - NfcAirplaneModeObserver.AIRPLANE_MODE_URI); - - assertThat(mNfcAdapter.isEnabled()).isFalse(); - } - - @Test - public void NfcAirplaneModeObserver_airplaneModeOnNfcToggleable_shouldEnablePreference() { - ReflectionHelpers.setField(mNfcAirplaneModeObserver, "mAirplaneMode", 0); - final ContentResolver contentResolver = mContext.getContentResolver(); - Settings.Global.putInt(contentResolver, Settings.Global.AIRPLANE_MODE_ON, 1); - Settings.Global.putString(contentResolver, - Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS, Settings.Global.RADIO_NFC); - - mNfcAirplaneModeObserver.onChange(false, NfcAirplaneModeObserver.AIRPLANE_MODE_URI); - - assertThat(mNfcPreference.isEnabled()).isTrue(); - } - - @Test - public void NfcAirplaneModeObserver_airplaneModeOnNfcNotToggleable_shouldDisablePreference() { - ReflectionHelpers.setField(mNfcAirplaneModeObserver, "mAirplaneMode", 0); - final ContentResolver contentResolver = mContext.getContentResolver(); - Settings.Global.putInt(contentResolver, Settings.Global.AIRPLANE_MODE_ON, 1); - Settings.Global.putString(contentResolver, - Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS, Global.RADIO_WIFI); - - mNfcAirplaneModeObserver.onChange(false, NfcAirplaneModeObserver.AIRPLANE_MODE_URI); - - assertThat(mNfcPreference.isEnabled()).isFalse(); - } - - @Test - public void NfcAirplaneModeObserver_airplaneModeOff_shouldEnablePreference() { - ReflectionHelpers.setField(mNfcAirplaneModeObserver, "mAirplaneMode", 1); - Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0); - - mNfcAirplaneModeObserver.onChange(false, NfcAirplaneModeObserver.AIRPLANE_MODE_URI); - - assertThat(mNfcPreference.isEnabled()).isTrue(); - } - - @Test - public void NfcAirplaneModeObserver_airplaneModeOff_shouldNotEnableNfcAutomatically() { - ReflectionHelpers.setField(mNfcAirplaneModeObserver, "mAirplaneMode", 1); - Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0); - - mNfcAirplaneModeObserver.onChange(false, NfcAirplaneModeObserver.AIRPLANE_MODE_URI); - - assertThat(mNfcAdapter.isEnabled()).isFalse(); - } -} diff --git a/tests/robotests/src/com/android/settings/nfc/NfcPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/nfc/NfcPreferenceControllerTest.java index e3672c92dc9..b7efc22c83a 100644 --- a/tests/robotests/src/com/android/settings/nfc/NfcPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/nfc/NfcPreferenceControllerTest.java @@ -222,38 +222,6 @@ public class NfcPreferenceControllerTest { assertThat(NfcPreferenceController.shouldTurnOffNFCInAirplaneMode(mContext)).isFalse(); } - @Test - public void displayPreference_airplaneModeRadiosContainsNfc_shouldCreateAirplaneModeObserver() { - Settings.Global.putString(mContext.getContentResolver(), - Settings.Global.AIRPLANE_MODE_RADIOS, Settings.Global.RADIO_NFC); - - mNfcController.displayPreference(mScreen); - - assertThat(mNfcController.mAirplaneModeObserver).isNotNull(); - } - - @Test - public void displayPreference_nfcToggleableInAirplaneMode_shouldCreateAirplaneModeObserver() { - Settings.Global.putString(mContext.getContentResolver(), - Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS, Settings.Global.RADIO_NFC); - - mNfcController.displayPreference(mScreen); - - assertThat(mNfcController.mAirplaneModeObserver).isNotNull(); - } - - @Test - public void displayPreference_nfcNotAffectByAirplaneMode_shouldNotCreateAirplaneModeObserver() { - Settings.Global.putString(mContext.getContentResolver(), - Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS, ""); - Settings.Global.putString(mContext.getContentResolver(), - Settings.Global.AIRPLANE_MODE_RADIOS, ""); - - mNfcController.displayPreference(mScreen); - - assertThat(mNfcController.mAirplaneModeObserver).isNull(); - } - @Test public void ncfSliceWorker_nfcBroadcast_noExtra_sliceDoesntUpdate() { final NfcSliceWorker worker = spy(new NfcSliceWorker(mContext, getDummyUri())); From 5456b596a259e1657e6987a9cf17e9b552b336d6 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Fri, 7 Jun 2019 15:18:21 +0900 Subject: [PATCH 08/10] Disconnect if the user cancels the no/partial connectivity dialog If the user exits the no Internet or partial connectivity dialog without taking any action, there is no longer any way to use the network. So, disconnect the network. Bug: 130766237 Test: clicking outside dialog disconnects network Test: orientation changes do not disconnect network Change-Id: I80c2c98c994dc01e53b32f40332b3f1bd03b6012 --- .../settings/wifi/WifiNoInternetDialog.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/com/android/settings/wifi/WifiNoInternetDialog.java b/src/com/android/settings/wifi/WifiNoInternetDialog.java index e33cab6de29..eb42097fa16 100644 --- a/src/com/android/settings/wifi/WifiNoInternetDialog.java +++ b/src/com/android/settings/wifi/WifiNoInternetDialog.java @@ -52,6 +52,7 @@ public final class WifiNoInternetDialog extends AlertActivity implements private ConnectivityManager.NetworkCallback mNetworkCallback; private CheckBox mAlwaysAllow; private String mAction; + private boolean mButtonClicked; private boolean isKnownAction(Intent intent) { return intent.getAction().equals(ACTION_PROMPT_UNVALIDATED) @@ -169,14 +170,31 @@ public final class WifiNoInternetDialog extends AlertActivity implements mCM.unregisterNetworkCallback(mNetworkCallback); mNetworkCallback = null; } + + // If the user exits the no Internet or partial connectivity dialog without taking any + // action, disconnect the network, because once the dialog has been dismissed there is no + // way to use the network. + // + // Unfortunately, AlertDialog does not seem to offer any good way to get an onCancel or + // onDismiss callback. So we implement this ourselves. + if (isFinishing() && !mButtonClicked) { + if (ACTION_PROMPT_PARTIAL_CONNECTIVITY.equals(mAction)) { + mCM.setAcceptPartialConnectivity(mNetwork, false /* accept */, false /* always */); + } else if (ACTION_PROMPT_UNVALIDATED.equals(mAction)) { + mCM.setAcceptUnvalidated(mNetwork, false /* accept */, false /* always */); + } + } super.onDestroy(); } + @Override public void onClick(DialogInterface dialog, int which) { if (which != BUTTON_NEGATIVE && which != BUTTON_POSITIVE) return; final boolean always = mAlwaysAllow.isChecked(); final String what, action; + mButtonClicked = true; + if (ACTION_PROMPT_UNVALIDATED.equals(mAction)) { what = "NO_INTERNET"; final boolean accept = (which == BUTTON_POSITIVE); From c976efa3e681b1ff113d8385bc200c3d088c6131 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Fri, 7 Jun 2019 12:41:05 -0700 Subject: [PATCH 09/10] Do not stay on education page if user has enrolled max templates Fixes: 134769754 Test: Enroll max templates, go back, intro screen is seen instead Change-Id: I4a5f8d71abff88688f7c77860bb44caa95d17d61 --- .../settings/biometrics/face/FaceEnrollEducation.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java index 429d93bd5ce..4add43ac205 100644 --- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java +++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java @@ -169,6 +169,15 @@ public class FaceEnrollEducation extends BiometricEnrollBase { super.onResume(); mSwitchDiversityListener.onCheckedChanged(mSwitchDiversity.getSwitch(), mSwitchDiversity.isChecked()); + + // If the user goes back after enrollment, we should send them back to the intro page + // if they've met the max limit. + final int max = getResources().getInteger( + com.android.internal.R.integer.config_faceMaxTemplatesPerUser); + final int numEnrolledFaces = mFaceManager.getEnrolledFaces(mUserId).size(); + if (numEnrolledFaces >= max) { + finish(); + } } @Override From eeecb3e24d53b28e5a780a84e6784b426e64fbfb Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Fri, 7 Jun 2019 15:13:29 -0700 Subject: [PATCH 10/10] Only launch fingerprint settings after enrollment if it's from the summary controller Fixes: 133822544 Test: No more multiple instances of fingerprint settings after enrolling from within the settings page Test: adb shell am start -a android.settings.BIOMETRIC_ENROLL does not send the user to fingerprint settings after completing enrollment Change-Id: I003dc142b01ed6ffae83299ab4b69f4896eb93e3 --- .../android/settings/biometrics/BiometricEnrollBase.java | 8 +++++++- .../settings/biometrics/BiometricEnrollIntroduction.java | 1 + .../biometrics/BiometricStatusPreferenceController.java | 2 ++ .../settings/biometrics/BiometricsEnrollEnrolling.java | 1 + .../biometrics/fingerprint/FingerprintEnrollFinish.java | 5 +++-- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/biometrics/BiometricEnrollBase.java b/src/com/android/settings/biometrics/BiometricEnrollBase.java index 52eaa175fb0..c3f794f6905 100644 --- a/src/com/android/settings/biometrics/BiometricEnrollBase.java +++ b/src/com/android/settings/biometrics/BiometricEnrollBase.java @@ -21,7 +21,6 @@ import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME; import android.annotation.Nullable; import android.content.Intent; import android.content.res.Resources; -import android.content.res.Resources.Theme; import android.graphics.Color; import android.os.Bundle; import android.os.UserHandle; @@ -44,6 +43,7 @@ import com.google.android.setupdesign.GlifLayout; */ public abstract class BiometricEnrollBase extends InstrumentedActivity { + public static final String EXTRA_FROM_SETTINGS_SUMMARY = "from_settings_summary"; public static final String EXTRA_KEY_LAUNCHED_CONFIRM = "launched_confirm_lock"; public static final String EXTRA_KEY_REQUIRE_VISION = "accessibility_vision"; public static final String EXTRA_KEY_REQUIRE_DIVERSITY = "accessibility_diversity"; @@ -81,16 +81,20 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { protected boolean mLaunchedConfirmLock; protected byte[] mToken; protected int mUserId; + protected boolean mFromSettingsSummary; protected FooterBarMixin mFooterBarMixin; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mToken = getIntent().getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); + mFromSettingsSummary = getIntent().getBooleanExtra(EXTRA_FROM_SETTINGS_SUMMARY, false); if (savedInstanceState != null && mToken == null) { mLaunchedConfirmLock = savedInstanceState.getBoolean(EXTRA_KEY_LAUNCHED_CONFIRM); mToken = savedInstanceState.getByteArray( ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); + mFromSettingsSummary = + savedInstanceState.getBoolean(EXTRA_FROM_SETTINGS_SUMMARY, false); } mUserId = getIntent().getIntExtra(Intent.EXTRA_USER_ID, UserHandle.myUserId()); } @@ -107,6 +111,7 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { super.onSaveInstanceState(outState); outState.putBoolean(EXTRA_KEY_LAUNCHED_CONFIRM, mLaunchedConfirmLock); outState.putByteArray(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken); + outState.putBoolean(EXTRA_FROM_SETTINGS_SUMMARY, mFromSettingsSummary); } @Override @@ -154,6 +159,7 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { Intent intent = new Intent(); intent.setClassName(SETTINGS_PACKAGE_NAME, FingerprintEnrollEnrolling.class.getName()); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken); + intent.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, mFromSettingsSummary); if (mUserId != UserHandle.USER_NULL) { intent.putExtra(Intent.EXTRA_USER_ID, mUserId); } diff --git a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java index 85e4acd13d9..d5414c9664d 100644 --- a/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java +++ b/src/com/android/settings/biometrics/BiometricEnrollIntroduction.java @@ -214,6 +214,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase if (mUserId != UserHandle.USER_NULL) { intent.putExtra(Intent.EXTRA_USER_ID, mUserId); } + intent.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, mFromSettingsSummary); startActivityForResult(intent, BIOMETRIC_FIND_SENSOR_REQUEST); } diff --git a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java index 156d663dfff..62dc1cf1fae 100644 --- a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java +++ b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java @@ -17,6 +17,7 @@ package com.android.settings.biometrics; import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME; +import static com.android.settings.biometrics.BiometricEnrollBase.EXTRA_FROM_SETTINGS_SUMMARY; import android.content.Context; import android.content.Intent; @@ -118,6 +119,7 @@ public abstract class BiometricStatusPreferenceController extends BasePreference Intent intent = new Intent(); intent.setClassName(SETTINGS_PACKAGE_NAME, clazz); intent.putExtra(Intent.EXTRA_USER_ID, userId); + intent.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, true); context.startActivity(intent); return true; }); diff --git a/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java b/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java index 12ffc6ba0ad..a2460553e26 100644 --- a/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java +++ b/src/com/android/settings/biometrics/BiometricsEnrollEnrolling.java @@ -107,6 +107,7 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token); + intent.putExtra(EXTRA_FROM_SETTINGS_SUMMARY, mFromSettingsSummary); if (mUserId != UserHandle.USER_NULL) { intent.putExtra(Intent.EXTRA_USER_ID, mUserId); } diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java index 02b07236ab3..5f4501580ed 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java @@ -110,7 +110,8 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase { setResult(RESULT_FINISHED); if (WizardManagerHelper.isAnySetupWizard(getIntent())) { postEnroll(); - } else { + } else if (mFromSettingsSummary) { + // Only launch fingerprint settings if enrollment was triggered through settings summary launchFingerprintSettings(); } finish(); @@ -150,7 +151,7 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase { final Intent intent = new Intent(ACTION_FINGERPRINT_SETTINGS); intent.setPackage(Utils.SETTINGS_PACKAGE_NAME); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken); - intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); startActivity(intent); }