From 121eaa7d3e7497c3595ecce651085eee9bb4be1f Mon Sep 17 00:00:00 2001 From: Alan Stokes Date: Tue, 21 May 2019 15:12:16 +0100 Subject: [PATCH 1/5] Cleanup background activity starts for release. This removes the parts of the feature that were only needed in beta releases: - Develper setting to force feature on or off. Not to be submitted until after beta 5 is cut. Bug: 131747138 Test: Still builds, developer settings still works. Change-Id: I573761174317797aeb4df97cf1a2b1ce005c0715 --- res/values/strings.xml | 5 - res/xml/development_settings.xml | 5 - ...undActivityStartsPreferenceController.java | 91 ---------- .../DevelopmentSettingsDashboardFragment.java | 1 - ...ctivityStartsPreferenceControllerTest.java | 159 ------------------ 5 files changed, 261 deletions(-) delete mode 100644 src/com/android/settings/development/AllowBackgroundActivityStartsPreferenceController.java delete mode 100644 tests/robotests/src/com/android/settings/development/AllowBackgroundActivityStartsPreferenceControllerTest.java diff --git a/res/values/strings.xml b/res/values/strings.xml index 171fe42d2cd..805a1d2d726 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -10594,11 +10594,6 @@ Track all GNSS constellations and frequencies with no duty cycling - - Allow background activity starts - - Allows all background activity starts - Always show crash dialog diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml index c537f3fa26b..33dba2fe437 100644 --- a/res/xml/development_settings.xml +++ b/res/xml/development_settings.xml @@ -502,11 +502,6 @@ android:fragment="com.android.settings.applications.appops.BackgroundCheckSummary" android:title="@string/background_check_pref" /> - - Date: Wed, 29 May 2019 18:21:28 +0800 Subject: [PATCH 2/5] Update the string of both magnification settings and gesture navigation tutorial dialog Referenced link for the details: https://docs.google.com/document/d/1eB2wukextG5UFECTwde5zcmXXTQCvgnqJJjnd1Chu9Q https://docs.google.com/document/d/14iwCag7FBD4e9bR03HjbC0D2s_u-Fpr3K8vl_XMjkD0 Bug: 133336814 Bug: 133650388 Test: Visual Change-Id: I4893183b55f609bfee3d1dfe80aa02cce624e857 --- res/values/strings.xml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 2e505ab4dd2..461ec7d101c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4835,9 +4835,9 @@ Magnify with triple-tap - Magnify with button + Magnify with shortcut - Magnify with button & triple-tap + Magnify with shortcut & triple-tap Zoom in on screen @@ -4847,7 +4847,25 @@ To zoom, quickly tap the screen 3 times.\n
  • Drag 2 or more fingers to scroll
  • \n
  • Pinch 2 or more fingers to adjust zoom
\n\nTo zoom temporarily, quickly tap the screen 3 times and hold down your finger on the third tap.\n
  • Drag to move around the screen
  • \n
  • Lift finger to zoom out
\n\nYou can\'t zoom in on the keyboard and navigation bar.
- When magnification is turned on, use the Accessibility button at the bottom of the screen to quickly magnify.\n\nTo zoom, tap the Accessibility button, then tap anywhere on the screen.\n
  • Drag 2 or more fingers to scroll
  • \n
  • Pinch 2 or more fingers to adjust zoom
\n\nTo zoom temporarily, tap the Accessibility button, then touch & hold anywhere on the screen.\n
  • Drag to move around the screen
  • \n
  • Lift finger to zoom out
\n\nYou can’t zoom in on the keyboard or navigation bar.
+ When magnification is turned on, you can zoom in on your screen.\n\nTo zoom, start magnification, then tap anywhere on the screen.\n
  • • Drag 2 or more fingers to scroll
  • \n
  • • Pinch 2 or more fingers to adjust zoom
\n\nTo zoom temporarily, start magnification, then touch & hold anywhere on the screen.\n
  • • Drag to move around the screen
  • \n
  • • Lift finger to zoom out
\n\nYou can’t zoom in on the keyboard or navigation bar.
+ + Use accessibility button to open + + Use gesture to open + + Use new accessibility gesture + + To turn this service on or off, tap the accessibility button%son the bottom of your screen.\n\nTo switch between services, touch & hold the accessibility button. + + To turn this service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold. + + To turn this service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold. + + To turn an accessibility service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold. + + To turn an accessibility service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold. + + Got it The Accessibility button is set to %1$s. To use magnification, touch & hold the Accessibility button, then select magnification. From aeb1da0db95276ca6244f0f1e53eb81bc80d342f Mon Sep 17 00:00:00 2001 From: Antony Sargent Date: Mon, 13 May 2019 16:44:13 -0700 Subject: [PATCH 3/5] Add a "data during calls" preference This adds a switch which appears on the SIM details page for any SIMs that aren't the default on for data. It lets the user opt-in to turning on data on this SIM only in the case where there is an active call - this is needed because in some cases the default data SIM may not be able to be used when a call is active on another SIM. Bug: 132114205 Test: make RunSettingsRoboTests Change-Id: Ie44c56e0f486fd93aff411a0ba0e47d3695a4941 --- res/xml/mobile_network_settings_v2.xml | 6 + .../DataDuringCallsPreferenceController.java | 104 ++++++++++++++ .../telephony/MobileNetworkSettings.java | 1 + .../grandfather_slice_controller_not_in_xml | 1 + ...taDuringCallsPreferenceControllerTest.java | 134 ++++++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/network/DataDuringCallsPreferenceControllerTest.java diff --git a/res/xml/mobile_network_settings_v2.xml b/res/xml/mobile_network_settings_v2.xml index 1ff886078c5..20ed1c75a22 100644 --- a/res/xml/mobile_network_settings_v2.xml +++ b/res/xml/mobile_network_settings_v2.xml @@ -85,6 +85,12 @@ android:summary="@string/mms_message_summary" settings:controller="com.android.settings.network.telephony.MmsMessagePreferenceController"/> + + Date: Tue, 4 Jun 2019 19:41:52 +0000 Subject: [PATCH 4/5] Revert "Add generateChallenge() in onResume()" This reverts commit d59150eca6d7c0d0ea8a3fcba2a1add4beb36f05. Bug: 133498264 Bug: 133440610 Reason for revert: Fixing in a different way Change-Id: Ie444278a9e8b8aac259c31d311757ab8a39567f4 --- .../biometrics/face/FaceSettings.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java index 05e37781c70..48370d9fb78 100644 --- a/src/com/android/settings/biometrics/face/FaceSettings.java +++ b/src/com/android/settings/biometrics/face/FaceSettings.java @@ -145,11 +145,7 @@ public class FaceSettings extends DashboardFragment { if (savedInstanceState != null) { mToken = savedInstanceState.getByteArray(KEY_TOKEN); } - } - @Override - public void onResume() { - super.onResume(); if (mToken == null) { final long challenge = mFaceManager.generateChallenge(); ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this); @@ -159,7 +155,13 @@ public class FaceSettings extends DashboardFragment { Log.e(TAG, "Password not set"); finish(); } - } else { + } + } + + @Override + public void onResume() { + super.onResume(); + if (mToken != null) { mAttentionController.setToken(mToken); mEnrollController.setToken(mToken); } @@ -194,12 +196,13 @@ public class FaceSettings extends DashboardFragment { } @Override - public void onStop() { - super.onStop(); - mToken = null; - final int result = mFaceManager.revokeChallenge(); - if (result < 0) { - Log.w(TAG, "revokeChallenge failed, result: " + result); + public void onDestroy() { + super.onDestroy(); + if (getActivity().isFinishing()) { + final int result = mFaceManager.revokeChallenge(); + if (result < 0) { + Log.w(TAG, "revokeChallenge failed, result: " + result); + } } } From f20bb1c635ebda997a785f4829e3791b4179a29e Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Tue, 4 Jun 2019 13:29:40 -0700 Subject: [PATCH 5/5] Resolve challenge lifecycle race conditions 1) FaceSettings now gets closed when it loses foreground. This prevents A) Keyguard/LockSettingsService's resetLockout's revokeChallenge from leaving FaceSettings with a stale HAT which prevents users from enrolling or toggling elements that require the HAT. B) generateChallenge has a timeout, which may already have been met C) User may have forgotten FaceSettings was open and lost context. Thus it makes no sense to show ConfirmLock* since the user may have no idea why it's showing anymore. 2) FaceSettings now generatesChallenge in onResume. onCreate is too early since again, FaceSettings can be launched via intent while on Keyguard. Similarly, we must ensure that Settings's challenge is generated late enough (e.g. when it actually gains foregroundness) Fixes: 133440610 Fixes: 133498264 Test: Open face settings, confirm password, lock screen. After unlocking, user needs to re-open face settings. Test: Modify HAL/framework to show re-enroll notification Tap re-enroll notificaton on keyguard Delete and re-enroll in settings, successful Test: FaceSettings enroll works accross orientation change Test: Tapping enroll button doesn't cause challenge to be revoked due to onStop() Change-Id: I60f606314c458a61e9c1b4f4b66bc27bc44287da --- .../biometrics/face/FaceSettings.java | 42 ++++++++++++------- ...tingsEnrollButtonPreferenceController.java | 9 ++++ 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java index 48370d9fb78..9766f34cdad 100644 --- a/src/com/android/settings/biometrics/face/FaceSettings.java +++ b/src/com/android/settings/biometrics/face/FaceSettings.java @@ -69,6 +69,8 @@ public class FaceSettings extends DashboardFragment { private Preference mRemoveButton; private Preference mEnrollButton; + private boolean mConfirmingPassword; + private final FaceSettingsRemoveButtonPreferenceController.Listener mRemovalListener = () -> { // Disable the toggles until the user re-enrolls @@ -145,23 +147,27 @@ public class FaceSettings extends DashboardFragment { if (savedInstanceState != null) { mToken = savedInstanceState.getByteArray(KEY_TOKEN); } + } - if (mToken == null) { + @Override + public void onResume() { + super.onResume(); + + if (mToken == null && !mConfirmingPassword) { + // Generate challenge in onResume instead of onCreate, since FaceSettings can be + // created while Keyguard is showing, in which case the resetLockout revokeChallenge + // will invalidate the too-early created challenge here. final long challenge = mFaceManager.generateChallenge(); ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this); + + mConfirmingPassword = true; if (!helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(R.string.security_settings_face_preference_title), null, null, challenge, mUserId)) { Log.e(TAG, "Password not set"); finish(); } - } - } - - @Override - public void onResume() { - super.onResume(); - if (mToken != null) { + } else { mAttentionController.setToken(mToken); mEnrollController.setToken(mToken); } @@ -175,6 +181,7 @@ public class FaceSettings extends DashboardFragment { public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CONFIRM_REQUEST) { + mConfirmingPassword = false; if (resultCode == RESULT_FINISHED || resultCode == RESULT_OK) { mFaceManager.setActiveUser(mUserId); // The pin/pattern/password was set. @@ -196,13 +203,20 @@ public class FaceSettings extends DashboardFragment { } @Override - public void onDestroy() { - super.onDestroy(); - if (getActivity().isFinishing()) { - final int result = mFaceManager.revokeChallenge(); - if (result < 0) { - Log.w(TAG, "revokeChallenge failed, result: " + result); + public void onStop() { + super.onStop(); + + if (!mEnrollController.isClicked() && !getActivity().isChangingConfigurations() + && !mConfirmingPassword) { + // Revoke challenge and finish + if (mToken != null) { + final int result = mFaceManager.revokeChallenge(); + if (result < 0) { + Log.w(TAG, "revokeChallenge failed, result: " + result); + } + mToken = null; } + getActivity().finish(); } } diff --git a/src/com/android/settings/biometrics/face/FaceSettingsEnrollButtonPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsEnrollButtonPreferenceController.java index ec7b1948fea..a087ccc78e4 100644 --- a/src/com/android/settings/biometrics/face/FaceSettingsEnrollButtonPreferenceController.java +++ b/src/com/android/settings/biometrics/face/FaceSettingsEnrollButtonPreferenceController.java @@ -42,6 +42,7 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference private byte[] mToken; private SettingsActivity mActivity; private Button mButton; + private boolean mIsClicked; public FaceSettingsEnrollButtonPreferenceController(Context context) { this(context, KEY); @@ -63,6 +64,7 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference @Override public void onClick(View v) { + mIsClicked = true; final Intent intent = new Intent(); intent.setClassName("com.android.settings", FaceEnrollIntroduction.class.getName()); intent.putExtra(Intent.EXTRA_USER_ID, mUserId); @@ -83,6 +85,13 @@ public class FaceSettingsEnrollButtonPreferenceController extends BasePreference mToken = token; } + // Return the click state, then clear its state. + public boolean isClicked() { + final boolean wasClicked = mIsClicked; + mIsClicked = false; + return wasClicked; + } + public void setActivity(SettingsActivity activity) { mActivity = activity; }