From 0902b44744bf557b90e6880b8fb4c0b0ab625d1e Mon Sep 17 00:00:00 2001 From: Joshua Mccloskey Date: Thu, 9 Dec 2021 17:47:11 -0800 Subject: [PATCH 01/20] Added lottie animations for udfps side/tip Bug: 209807883 Test: Verified animations show for multiple devices. Change-Id: Ic63a0eca226309b92aa64cb4f80791ef179b8154 --- res/layout/udfps_enroll_enrolling.xml | 49 +++++++++-- res/raw/udfps_edge_hint_lottie.json | 0 res/raw/udfps_tip_hint_lottie.json | 0 res/values/dimens.xml | 1 + res/values/strings.xml | 4 + .../settings/biometrics/BiometricUtils.java | 10 +++ .../FingerprintEnrollEnrolling.java | 87 +++++++++++++++++-- 7 files changed, 134 insertions(+), 17 deletions(-) create mode 100644 res/raw/udfps_edge_hint_lottie.json create mode 100644 res/raw/udfps_tip_hint_lottie.json diff --git a/res/layout/udfps_enroll_enrolling.xml b/res/layout/udfps_enroll_enrolling.xml index 67c127b34bc..e9337538629 100644 --- a/res/layout/udfps_enroll_enrolling.xml +++ b/res/layout/udfps_enroll_enrolling.xml @@ -17,6 +17,7 @@ - + + + + + + + + + + diff --git a/res/raw/udfps_edge_hint_lottie.json b/res/raw/udfps_edge_hint_lottie.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/res/raw/udfps_tip_hint_lottie.json b/res/raw/udfps_tip_hint_lottie.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 00372cbee74..0a31c61808c 100755 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -212,6 +212,7 @@ fingerprint_finish_max_size = fingerprint_progress_bar_max_size + (fingerprint_enrolling_content_margin_vertical x 2) --> 288dp + 0dp 0 diff --git a/res/values/strings.xml b/res/values/strings.xml index 73a0de88bd2..5ca4555ff22 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1113,6 +1113,10 @@ Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps Do it later + + Lift, then touch again + + Place the side of your fingerprint on the sensor and hold, then switch to the other side Skip fingerprint setup? diff --git a/src/com/android/settings/biometrics/BiometricUtils.java b/src/com/android/settings/biometrics/BiometricUtils.java index 5ee788095b4..febe3c6a93e 100644 --- a/src/com/android/settings/biometrics/BiometricUtils.java +++ b/src/com/android/settings/biometrics/BiometricUtils.java @@ -289,4 +289,14 @@ public class BiometricUtils { } return false; } + + /** + * Returns {@code true} if the screen is going into a landscape mode and the angle is equal to + * 90. + * @param context Context that we use to get the display this context is associated with + * @return True if the angle of the rotation is equal to 90. + */ + public static boolean isLandscape(@NonNull Context context) { + return context.getDisplay().getRotation() == Surface.ROTATION_90; + } } diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java index c2bcee33428..d42e8f1c3aa 100644 --- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java +++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java @@ -19,11 +19,13 @@ package com.android.settings.biometrics.fingerprint; import android.animation.Animator; import android.animation.ObjectAnimator; import android.annotation.IntDef; +import android.annotation.NonNull; import android.annotation.Nullable; import android.app.Dialog; import android.app.settings.SettingsEnums; import android.content.DialogInterface; import android.content.Intent; +import android.content.res.Configuration; import android.graphics.drawable.Animatable2; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; @@ -54,7 +56,9 @@ import com.android.settings.biometrics.BiometricEnrollSidecar; import com.android.settings.biometrics.BiometricUtils; import com.android.settings.biometrics.BiometricsEnrollEnrolling; import com.android.settings.core.instrumentation.InstrumentedDialogFragment; +import com.android.settingslib.display.DisplayDensityUtils; +import com.airbnb.lottie.LottieAnimationView; import com.google.android.setupcompat.template.FooterBarMixin; import com.google.android.setupcompat.template.FooterButton; import com.google.android.setupcompat.util.WizardManagerHelper; @@ -126,6 +130,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { private boolean mIsSetupWizard; private AccessibilityManager mAccessibilityManager; private boolean mIsAccessibilityEnabled; + private LottieAnimationView mIllustrationLottie; + private boolean mHaveShownUdfpsTipLottie; + private boolean mHaveShownUdfpsSideLottie; + private boolean mShouldShowLottie; private OrientationEventListener mOrientationEventListener; private int mPreviousRotation = 0; @@ -163,6 +171,20 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title); } + DisplayDensityUtils displayDensity = + new DisplayDensityUtils(getApplicationContext()); + int currentDensityIndex = displayDensity.getCurrentIndex(); + final int currentDensity = displayDensity.getValues()[currentDensityIndex]; + final int defaultDensity = displayDensity.getDefaultDensity(); + mShouldShowLottie = defaultDensity == currentDensity; + // Only show the lottie if the current display density is the default density. + // Otherwise, the lottie will overlap with the settings header text. + boolean isLandscape = BiometricUtils.isReverseLandscape(getApplicationContext()) + || BiometricUtils.isLandscape(getApplicationContext()); + + updateOrientation((isLandscape + ? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT)); + mErrorText = findViewById(R.id.error_text); mProgressBar = findViewById(R.id.fingerprint_progress_bar); mVibrator = getSystemService(Vibrator.class); @@ -339,20 +361,34 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { case STAGE_FINGERTIP: setHeaderText(R.string.security_settings_udfps_enroll_fingertip_title); - if (isStageHalfCompleted()) { - setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_title); - } else { + if (!mHaveShownUdfpsTipLottie && mIllustrationLottie != null) { + mHaveShownUdfpsTipLottie = true; setDescriptionText(""); + mIllustrationLottie.setAnimation(R.raw.udfps_tip_hint_lottie); + mIllustrationLottie.setVisibility(View.VISIBLE); + mIllustrationLottie.playAnimation(); + mIllustrationLottie.setContentDescription( + getString(R.string.security_settings_udfps_tip_fingerprint_help)); } break; case STAGE_EDGES: setHeaderText(R.string.security_settings_udfps_enroll_edge_title); - if (isStageHalfCompleted()) { - setDescriptionText( - R.string.security_settings_fingerprint_enroll_repeat_message); - } else { - setDescriptionText(R.string.security_settings_udfps_enroll_edge_message); + if (!mHaveShownUdfpsSideLottie && mIllustrationLottie != null) { + mHaveShownUdfpsSideLottie = true; + setDescriptionText(""); + mIllustrationLottie.setAnimation(R.raw.udfps_edge_hint_lottie); + mIllustrationLottie.setVisibility(View.VISIBLE); + mIllustrationLottie.playAnimation(); + mIllustrationLottie.setContentDescription( + getString(R.string.security_settings_udfps_side_fingerprint_help)); + } else if (mIllustrationLottie == null) { + if (isStageHalfCompleted()) { + setDescriptionText( + R.string.security_settings_fingerprint_enroll_repeat_message); + } else { + setDescriptionText(R.string.security_settings_udfps_enroll_edge_message); + } } break; @@ -634,6 +670,41 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling { return SettingsEnums.FINGERPRINT_ENROLLING; } + private void updateOrientation(int orientation) { + switch(orientation) { + case Configuration.ORIENTATION_LANDSCAPE: { + mIllustrationLottie = null; + break; + } + case Configuration.ORIENTATION_PORTRAIT: { + if (mShouldShowLottie) { + mIllustrationLottie = findViewById(R.id.illustration_lottie); + } + break; + } + default: + Log.e(TAG, "Error unhandled configuration change"); + break; + } + } + + @Override + public void onConfigurationChanged(@NonNull Configuration newConfig) { + switch(newConfig.orientation) { + case Configuration.ORIENTATION_LANDSCAPE: { + updateOrientation(Configuration.ORIENTATION_LANDSCAPE); + break; + } + case Configuration.ORIENTATION_PORTRAIT: { + updateOrientation(Configuration.ORIENTATION_PORTRAIT); + break; + } + default: + Log.e(TAG, "Error unhandled configuration change"); + break; + } + } + public static class IconTouchDialog extends InstrumentedDialogFragment { @Override From c50f9d5528ba596efb667c668d30649e22f8ac1a Mon Sep 17 00:00:00 2001 From: Lais Andrade Date: Fri, 14 Jan 2022 23:49:07 +0000 Subject: [PATCH 02/20] Remove setTactileFeedbackEnabled from LockPatternView This property was copying the HAPTIC_FEEDBACK_ENABLED deprecated user setting. Starting from Android T this setting will be applied by the Vibrator service for vibration with USAGE_TOUCH. Bug: 185351540 Test: manual Change-Id: Ifeee5a56b80a04bcf605defe9a310374dce68146 --- src/com/android/settings/password/ChooseLockPattern.java | 2 -- src/com/android/settings/password/ConfirmLockPattern.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java index 3e7622c6b66..60b8c6cd37d 100644 --- a/src/com/android/settings/password/ChooseLockPattern.java +++ b/src/com/android/settings/password/ChooseLockPattern.java @@ -541,8 +541,6 @@ public class ChooseLockPattern extends SettingsActivity { mDefaultHeaderColorList = mHeaderText.getTextColors(); mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern); mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener); - mLockPatternView.setTactileFeedbackEnabled( - mLockPatternUtils.isTactileFeedbackEnabled()); mLockPatternView.setFadePattern(false); mFooterText = (TextView) view.findViewById(R.id.footerText); diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java index ec5efcfbc4e..6b9140acef3 100644 --- a/src/com/android/settings/password/ConfirmLockPattern.java +++ b/src/com/android/settings/password/ConfirmLockPattern.java @@ -144,8 +144,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity { mHeaderText = mDevicePolicyManager.getOrganizationNameForUser(mUserId); } - mLockPatternView.setTactileFeedbackEnabled( - mLockPatternUtils.isTactileFeedbackEnabled()); mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled( mEffectiveUserId)); mLockPatternView.setOnPatternListener(mConfirmExistingLockPatternListener); From d228248738cb88d7e7c4d798f070980afca153b8 Mon Sep 17 00:00:00 2001 From: Mayank Garg Date: Fri, 14 Jan 2022 16:03:56 -0800 Subject: [PATCH 03/20] Replaced removeUserOrSetEphemeral by removeUserWhenPossible Bug: 199446770 Test: m Settings Change-Id: I1c8cfdbf395a7be59946cf0dad510ec1aee320d9 --- src/com/android/settings/users/UserSettings.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java index 255b85fe0bf..dc4bca35b1c 100644 --- a/src/com/android/settings/users/UserSettings.java +++ b/src/com/android/settings/users/UserSettings.java @@ -814,8 +814,8 @@ public class UserSettings extends SettingsPreferenceFragment } try { getContext().getSystemService(UserManager.class) - .removeUserOrSetEphemeral(UserHandle.myUserId(), - /* evenWhenDisallowed= */ false); + .removeUserWhenPossible(UserHandle.of(UserHandle.myUserId()), + /* overrideDevicePolicy= */ false); ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM); } catch (RemoteException re) { Log.e(TAG, "Unable to remove self user"); From 9d56033f5f16c06c49ed8c9c1ba804db9488f730 Mon Sep 17 00:00:00 2001 From: Bonian Chen Date: Tue, 18 Jan 2022 05:11:42 +0000 Subject: [PATCH 04/20] [Settings] Adjust code for performance Reorder code flow to reduce redundent work. Bug: 213836977 Change-Id: Ieb1a15e867dcc5c65e8092d9f5c5eb38245138c9 Test: Junit VpnPreferenceControllerTest --- .../network/VpnPreferenceController.java | 48 +++++++------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/src/com/android/settings/network/VpnPreferenceController.java b/src/com/android/settings/network/VpnPreferenceController.java index a1e72b0eaad..be0780948df 100644 --- a/src/com/android/settings/network/VpnPreferenceController.java +++ b/src/com/android/settings/network/VpnPreferenceController.java @@ -30,7 +30,6 @@ import android.provider.SettingsSlicesContract; import android.security.Credentials; import android.security.LegacyVpnProfileStore; import android.util.Log; -import android.util.SparseArray; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; @@ -140,6 +139,7 @@ public class VpnPreferenceController extends AbstractPreferenceController } VpnConfig vpn = vpnManager.getVpnConfig(uid); if ((vpn != null) && vpn.legacy) { + // Copied from SystemUI::SecurityControllerImpl // Legacy VPNs should do nothing if the network is disconnected. Third-party // VPN warnings need to continue as traffic can still go to the app. final LegacyVpnInfo legacyVpn = vpnManager.getLegacyVpnInfo(uid); @@ -158,34 +158,19 @@ public class VpnPreferenceController extends AbstractPreferenceController } protected int getNumberOfNonLegacyVpn(UserManager userManager, VpnManager vpnManager) { - // Copied from SystemUI::SecurityControllerImpl - SparseArray vpns = new SparseArray<>(); - final List users = userManager.getUsers(); - int connectedLegacyVpnCount = 0; - for (UserInfo user : users) { - VpnConfig cfg = vpnManager.getVpnConfig(user.id); - if (cfg == null) { - continue; - } else if (cfg.legacy) { - // Legacy VPNs should do nothing if the network is disconnected. Third-party - // VPN warnings need to continue as traffic can still go to the app. - final LegacyVpnInfo legacyVpn = vpnManager.getLegacyVpnInfo(user.id); - if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) { - continue; - } else { - connectedLegacyVpnCount++; - } - } - vpns.put(user.id, cfg); - } - return vpns.size() - connectedLegacyVpnCount; + // Converted from SystemUI::SecurityControllerImpl + return (int) userManager.getUsers().stream() + .map(user -> vpnManager.getVpnConfig(user.id)) + .filter(cfg -> (cfg != null) && (!cfg.legacy)) + .count(); } protected String getInsecureVpnSummaryOverride(UserManager userManager, VpnManager vpnManager) { // Optionally add warning icon if an insecure VPN is present. if (mPreference instanceof VpnInfoPreference) { - final int insecureVpnCount = getInsecureVpnCount(); + String [] legacyVpnProfileKeys = LegacyVpnProfileStore.list(Credentials.VPN); + final int insecureVpnCount = getInsecureVpnCount(legacyVpnProfileKeys); boolean isInsecureVPN = insecureVpnCount > 0; ((VpnInfoPreference) mPreference).setInsecureVpn(isInsecureVPN); @@ -193,11 +178,14 @@ public class VpnPreferenceController extends AbstractPreferenceController if (isInsecureVPN) { // Add the users and the number of legacy vpns to determine if there is more than // one vpn, since there can be more than one VPN per user. - final int vpnCount = getNumberOfNonLegacyVpn(userManager, vpnManager) - + LegacyVpnProfileStore.list(Credentials.VPN).length; - if (vpnCount == 1) { - return mContext.getString(R.string.vpn_settings_insecure_single); - } else if (insecureVpnCount == 1) { + int vpnCount = legacyVpnProfileKeys.length; + if (vpnCount <= 1) { + vpnCount += getNumberOfNonLegacyVpn(userManager, vpnManager); + if (vpnCount == 1) { + return mContext.getString(R.string.vpn_settings_insecure_single); + } + } + if (insecureVpnCount == 1) { return mContext.getString( R.string.vpn_settings_single_insecure_multiple_total, insecureVpnCount); @@ -229,10 +217,10 @@ public class VpnPreferenceController extends AbstractPreferenceController } @VisibleForTesting - protected int getInsecureVpnCount() { + protected int getInsecureVpnCount(String [] legacyVpnProfileKeys) { final Function keyToProfile = key -> VpnProfile.decode(key, LegacyVpnProfileStore.get(Credentials.VPN + key)); - return (int) Arrays.stream(LegacyVpnProfileStore.list(Credentials.VPN)) + return (int) Arrays.stream(legacyVpnProfileKeys) .map(keyToProfile) // Return whether any profile is an insecure type. .filter(profile -> VpnProfile.isLegacyType(profile.type)) From 1779bd43e427969386df0a44767852b285f65220 Mon Sep 17 00:00:00 2001 From: Weng Su Date: Tue, 18 Jan 2022 14:19:14 +0000 Subject: [PATCH 05/20] Fix the Robolectric Tests Failures - The ShadowWifiManager class is not working as expected - The getSystemService(WifiManager.class) return null when testing - Use Mockito class instead of Shadow class Bug: 214906101 Bug: 214938188 Test: manual test make RunSettingsRoboTests ROBOTEST_FILTER=AllInOneTetherSettingsTest make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest Change-Id: Ic54af8524fbff1b6ac916ca8e1bcac52f413663a --- .../android/settings/AllInOneTetherSettingsTest.java | 9 ++++----- .../settings/wifi/tether/WifiTetherSettingsTest.java | 10 ++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java index 7dc4613c449..aec31fc7790 100644 --- a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java +++ b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java @@ -35,6 +35,7 @@ import android.content.Context; import android.net.ConnectivityManager; import android.net.TetheringManager; import android.net.wifi.SoftApConfiguration; +import android.net.wifi.WifiManager; import android.os.UserHandle; import android.os.UserManager; import android.util.FeatureFlagUtils; @@ -43,27 +44,23 @@ import androidx.preference.PreferenceGroup; import androidx.preference.PreferenceScreen; import com.android.settings.core.FeatureFlags; -import com.android.settings.testutils.shadow.ShadowWifiManager; import com.android.settings.wifi.tether.WifiTetherAutoOffPreferenceController; import com.android.settings.wifi.tether.WifiTetherSecurityPreferenceController; import com.android.settingslib.core.lifecycle.Lifecycle; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.annotation.Config; import org.robolectric.util.ReflectionHelpers; import java.util.ArrayList; import java.util.List; @RunWith(RobolectricTestRunner.class) -@Config(shadows = {ShadowWifiManager.class}) public class AllInOneTetherSettingsTest { private static final String[] WIFI_REGEXS = {"wifi_regexs"}; private static final String[] USB_REGEXS = {"usb_regexs"}; @@ -73,6 +70,8 @@ public class AllInOneTetherSettingsTest { private Context mContext; private AllInOneTetherSettings mAllInOneTetherSettings; + @Mock + private WifiManager mWifiManager; @Mock private ConnectivityManager mConnectivityManager; @Mock @@ -91,6 +90,7 @@ public class AllInOneTetherSettingsTest { mContext = spy(RuntimeEnvironment.application); MockitoAnnotations.initMocks(this); + doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class); doReturn(mConnectivityManager) .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE); doReturn(mTetheringManager) @@ -178,7 +178,6 @@ public class AllInOneTetherSettingsTest { } @Test - @Ignore public void createPreferenceControllers_hasAutoOffPreference() { assertThat(mAllInOneTetherSettings.createPreferenceControllers(mContext) .stream() diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java index e5d39dd7336..e0cd780950d 100644 --- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java +++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java @@ -31,6 +31,7 @@ import android.content.Context; import android.content.res.Resources; import android.net.ConnectivityManager; import android.net.TetheringManager; +import android.net.wifi.WifiManager; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; @@ -43,10 +44,8 @@ import androidx.preference.PreferenceScreen; import com.android.settings.core.FeatureFlags; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.shadow.ShadowFragment; -import com.android.settings.testutils.shadow.ShadowWifiManager; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -60,13 +59,14 @@ import java.util.ArrayList; import java.util.List; @RunWith(RobolectricTestRunner.class) -@Config(shadows = {ShadowWifiManager.class}) public class WifiTetherSettingsTest { private static final String[] WIFI_REGEXS = {"wifi_regexs"}; private Context mContext; private WifiTetherSettings mWifiTetherSettings; + @Mock + private WifiManager mWifiManager; @Mock private ConnectivityManager mConnectivityManager; @Mock @@ -79,6 +79,7 @@ public class WifiTetherSettingsTest { mContext = spy(RuntimeEnvironment.application); MockitoAnnotations.initMocks(this); + doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class); doReturn(mConnectivityManager) .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE); doReturn(mTetheringManager).when(mContext).getSystemService(Context.TETHERING_SERVICE); @@ -89,7 +90,6 @@ public class WifiTetherSettingsTest { } @Test - @Ignore public void wifiTetherNonIndexableKeys_tetherAvailable_keysNotReturned() { FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false); // To let TetherUtil.isTetherAvailable return true, select one of the combinations @@ -119,7 +119,6 @@ public class WifiTetherSettingsTest { } @Test - @Ignore public void createPreferenceControllers_notEmpty() { assertThat(WifiTetherSettings.SEARCH_INDEX_DATA_PROVIDER.getPreferenceControllers(mContext)) .isNotEmpty(); @@ -152,7 +151,6 @@ public class WifiTetherSettingsTest { } @Test - @Ignore public void createPreferenceControllers_hasAutoOffPreference() { assertThat(mWifiTetherSettings.createPreferenceControllers(mContext) .stream() From 38d0a7ca91bd33427447873357b8256cca0daccd Mon Sep 17 00:00:00 2001 From: Lucas Silva Date: Wed, 22 Dec 2021 15:52:00 +0000 Subject: [PATCH 06/20] Rewrite dream settings. The available dreams will now be shown in a grid, with a preview button at the bottom. Screenshot (white placeholder image used): http://screen/6pe6EoACPoQN8TZ.png http://screen/4nR6Wg5pN7pL6Wb.png Phone (single column layout): http://screen/4WFqzZR8Yf9H3VZ.png Colors and margins will be finalized once final mocks are done. Bug: 207681076 Bug: 214250590 Test: locally on device Change-Id: Ie68bdc60e74e72dc3c3cee3f1ffd40f5613109b9 --- res/color/dream_card_color_state_list.xml | 22 +++ res/layout/dream_picker_layout.xml | 42 ++++++ res/layout/dream_preference_layout.xml | 104 +++++++++++++ res/layout/dream_start_button.xml | 36 ----- res/values/dimens.xml | 7 + res/values/strings.xml | 6 +- res/values/styles.xml | 10 ++ res/xml/dream_fragment_overview.xml | 20 +-- .../settings/dream/CurrentDreamPicker.java | 125 ---------------- .../CurrentDreamPreferenceController.java | 93 ------------ .../settings/dream/DreamPickerAdapter.java | 129 ++++++++++++++++ .../settings/dream/DreamPickerController.java | 138 ++++++++++++++++++ .../dream/StartNowPreferenceController.java | 72 --------- .../dream/CurrentDreamPickerTest.java | 92 ------------ ...st.java => DreamPickerControllerTest.java} | 78 +++++----- .../StartNowPreferenceControllerTest.java | 87 ----------- 16 files changed, 500 insertions(+), 561 deletions(-) create mode 100644 res/color/dream_card_color_state_list.xml create mode 100644 res/layout/dream_picker_layout.xml create mode 100644 res/layout/dream_preference_layout.xml delete mode 100644 res/layout/dream_start_button.xml delete mode 100644 src/com/android/settings/dream/CurrentDreamPicker.java delete mode 100644 src/com/android/settings/dream/CurrentDreamPreferenceController.java create mode 100644 src/com/android/settings/dream/DreamPickerAdapter.java create mode 100644 src/com/android/settings/dream/DreamPickerController.java delete mode 100644 src/com/android/settings/dream/StartNowPreferenceController.java delete mode 100644 tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.java rename tests/robotests/src/com/android/settings/dream/{CurrentDreamPreferenceControllerTest.java => DreamPickerControllerTest.java} (51%) delete mode 100644 tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java diff --git a/res/color/dream_card_color_state_list.xml b/res/color/dream_card_color_state_list.xml new file mode 100644 index 00000000000..31821ddc216 --- /dev/null +++ b/res/color/dream_card_color_state_list.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/res/layout/dream_picker_layout.xml b/res/layout/dream_picker_layout.xml new file mode 100644 index 00000000000..c5210dd45f6 --- /dev/null +++ b/res/layout/dream_picker_layout.xml @@ -0,0 +1,42 @@ + + + + + + + +