From 7ca868bfdac6159009a49145f165df54c6c4f5f3 Mon Sep 17 00:00:00 2001 From: yuemingw Date: Wed, 2 May 2018 13:36:06 +0100 Subject: [PATCH 1/5] Revert policy transparency dialog title to "Action not allowed". Bug: 78443458 Test: manually by TestDpc. Change-Id: Ie4a4b6cacb61d7d1a328d67bcf780040efc23ccd --- res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 7bdb06972eb..d15220eebfa 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -8826,7 +8826,7 @@ Update available - Can’t change this setting + Action not allowed Can’t change volume From ccabf4ed717fa2aa5d7fa6fc448846826f8b9d0d Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 1 May 2018 14:53:25 -0600 Subject: [PATCH 2/5] Storage wizard UI tweaks. Updated assets from UX, and shift to "GlifV3" to get the latest theme styles. Verified visually. Bug: 77469852 Test: atest com.android.settings.ui.StorageWizardTest Change-Id: I5bf84e6649577b0c5c874f129fbd1d71c53356e2 --- AndroidManifest.xml | 16 +++--- res/drawable/ic_storage_wizard_external.xml | 54 +++++++++++---------- res/drawable/ic_storage_wizard_internal.xml | 42 ++++++++-------- 3 files changed, 58 insertions(+), 54 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index aae9b83791f..c5287291f13 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1862,39 +1862,39 @@ diff --git a/res/drawable/ic_storage_wizard_external.xml b/res/drawable/ic_storage_wizard_external.xml index c11334d5893..99e2698633d 100644 --- a/res/drawable/ic_storage_wizard_external.xml +++ b/res/drawable/ic_storage_wizard_external.xml @@ -19,71 +19,75 @@ android:viewportWidth="144.0" android:viewportHeight="144.0"> + + android:pathData="M74,89L74,95L119.11,95L121.99,89L74,89ZM73,87L122.59,87C122.26,87.73 120.83,90.87 118.29,96.42C118.13,96.77 117.77,97 117.38,97L73,97C72.45,97 72,96.55 72,96L72,88C72,87.45 72.45,87 73,87Z" + android:strokeColor="#00000000" + android:fillType="nonZero" + android:fillColor="#DADCE0" + android:strokeWidth="1"/> + android:pathData="M89,87L122.96,87C126.83,74.93 128.26,64.56 127.26,55.89C126.26,47.22 122.76,38.26 116.78,29L89,29L89,87ZM89,27L115.53,27C116.63,27 128.29,48.2 127.36,60.95C125.65,84.63 123.1,89 122,89L87,89L87,29C87,27.9 87.9,27 89,27Z" + android:strokeColor="#00000000" + android:fillType="nonZero" + android:fillColor="#DADCE0" + android:strokeWidth="1"/> + android:pathData="M64,126.08C98.29,126.08 126.08,98.29 126.08,64C126.08,29.71 98.29,1.92 64,1.92C29.71,1.92 1.92,29.71 1.92,64C1.92,98.29 29.71,126.08 64,126.08ZM64,128C28.65,128 0,99.35 0,64C0,28.65 28.65,0 64,0C99.35,0 128,28.65 128,64C128,99.35 99.35,128 64,128Z" + android:strokeColor="#00000000" + android:fillType="nonZero" + android:fillColor="#DADCE0" + android:strokeWidth="1"/> diff --git a/res/drawable/ic_storage_wizard_internal.xml b/res/drawable/ic_storage_wizard_internal.xml index f6c660b1efd..41768f7727d 100644 --- a/res/drawable/ic_storage_wizard_internal.xml +++ b/res/drawable/ic_storage_wizard_internal.xml @@ -14,60 +14,60 @@ limitations under the License. --> + android:width="144dp" + android:height="144dp" + android:viewportWidth="144.0" + android:viewportHeight="144.0"> + + android:strokeWidth="1"/> + android:strokeWidth="1"/> + android:strokeWidth="1"/> Date: Wed, 2 May 2018 16:12:05 -0600 Subject: [PATCH 3/5] Metrics for user choices in storage wizard. These metrics help us understand more about how users in the field are interacting with adoptable storage. Bug: 37284068 Test: atest com.android.settings.ui.StorageWizardTest Change-Id: I2bb9b5b3683c6ed080233aa595c2626685384923 --- .../deviceinfo/StorageWizardFormatSlow.java | 15 +++++++++++++++ .../settings/deviceinfo/StorageWizardInit.java | 14 ++++++++++++++ .../deviceinfo/StorageWizardMigrateConfirm.java | 8 ++++++++ 3 files changed, 37 insertions(+) diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatSlow.java b/src/com/android/settings/deviceinfo/StorageWizardFormatSlow.java index 37df21709e2..f1ac1c24997 100644 --- a/src/com/android/settings/deviceinfo/StorageWizardFormatSlow.java +++ b/src/com/android/settings/deviceinfo/StorageWizardFormatSlow.java @@ -23,7 +23,9 @@ import android.os.storage.VolumeInfo; import android.text.TextUtils; import android.view.View; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settings.R; +import com.android.settings.overlay.FeatureFactory; public class StorageWizardFormatSlow extends StorageWizardBase { private boolean mFormatPrivate; @@ -55,6 +57,9 @@ public class StorageWizardFormatSlow extends StorageWizardBase { @Override public void onNavigateBack(View view) { + FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, + MetricsEvent.ACTION_STORAGE_BENCHMARK_SLOW_ABORT); + final Intent intent = new Intent(this, StorageWizardInit.class); startActivity(intent); finishAffinity(); @@ -62,6 +67,16 @@ public class StorageWizardFormatSlow extends StorageWizardBase { @Override public void onNavigateNext(View view) { + if (view != null) { + // User made an explicit choice to continue when slow + FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, + MetricsEvent.ACTION_STORAGE_BENCHMARK_SLOW_CONTINUE); + } else { + // User made an implicit choice to continue when fast + FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, + MetricsEvent.ACTION_STORAGE_BENCHMARK_FAST_CONTINUE); + } + final String forgetUuid = getIntent().getStringExtra(EXTRA_FORMAT_FORGET_UUID); if (!TextUtils.isEmpty(forgetUuid)) { mStorage.forgetVolume(forgetUuid); diff --git a/src/com/android/settings/deviceinfo/StorageWizardInit.java b/src/com/android/settings/deviceinfo/StorageWizardInit.java index b271d024e76..076e606cb31 100644 --- a/src/com/android/settings/deviceinfo/StorageWizardInit.java +++ b/src/com/android/settings/deviceinfo/StorageWizardInit.java @@ -25,7 +25,9 @@ import android.os.storage.VolumeInfo; import android.view.View; import android.widget.Button; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settings.R; +import com.android.settings.overlay.FeatureFactory; public class StorageWizardInit extends StorageWizardBase { private Button mExternal; @@ -68,6 +70,12 @@ public class StorageWizardInit extends StorageWizardBase { } public void onNavigateExternal(View view) { + if (view != null) { + // User made an explicit choice for external + FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, + MetricsEvent.ACTION_STORAGE_INIT_EXTERNAL); + } + if (mVolume != null && mVolume.getType() == VolumeInfo.TYPE_PUBLIC && mVolume.getState() != VolumeInfo.STATE_UNMOUNTABLE) { // Remember that user made decision @@ -85,6 +93,12 @@ public class StorageWizardInit extends StorageWizardBase { } public void onNavigateInternal(View view) { + if (view != null) { + // User made an explicit choice for internal + FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, + MetricsEvent.ACTION_STORAGE_INIT_INTERNAL); + } + StorageWizardFormatConfirm.showPrivate(this, mDisk.getId()); } } diff --git a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java index 969a50ab634..b17defd0fc1 100644 --- a/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java +++ b/src/com/android/settings/deviceinfo/StorageWizardMigrateConfirm.java @@ -31,7 +31,9 @@ import android.util.Log; import android.view.View; import android.widget.Toast; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settings.R; +import com.android.settings.overlay.FeatureFactory; import com.android.settings.password.ChooseLockSettingsHelper; import java.util.Objects; @@ -80,6 +82,9 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase { @Override public void onNavigateBack(View view) { + FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, + MetricsEvent.ACTION_STORAGE_MIGRATE_LATER); + final Intent intent = new Intent(this, StorageWizardReady.class); intent.putExtra(EXTRA_MIGRATE_SKIP, true); startActivity(intent); @@ -127,6 +132,9 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase { return; } + FeatureFactory.getFactory(this).getMetricsFeatureProvider().action(this, + MetricsEvent.ACTION_STORAGE_MIGRATE_NOW); + final Intent intent = new Intent(this, StorageWizardMigrateProgress.class); intent.putExtra(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId()); intent.putExtra(PackageManager.EXTRA_MOVE_ID, moveId); From a7c14d474a9113b4fb88138b551be0e81a4c001b Mon Sep 17 00:00:00 2001 From: Chuck Liao Date: Fri, 30 Mar 2018 18:41:18 +0800 Subject: [PATCH 4/5] Refactor badging notification preference controller. - Convert inheritance from AbstractPreferenceController to TogglePreferenceController. - Register BadgingNotificationPreferenceController in XML. - Add RoboTests test cases for BadgingNotificationPreferenceController. Fixes: 67997784 Test: RunSettingsRoboTests Change-Id: If10744c067f065e7c2465ca1fff66895d7dc1c56 Merged-In: If10744c067f065e7c2465ca1fff66895d7dc1c56 --- res/xml/configure_notification_settings.xml | 3 +- ...dgingNotificationPreferenceController.java | 37 ++++++----- .../ConfigureNotificationSettings.java | 3 - ...gNotificationPreferenceControllerTest.java | 61 ++++++++++++++++--- 4 files changed, 73 insertions(+), 31 deletions(-) diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml index 612f5e7623b..291d9a8da6d 100644 --- a/res/xml/configure_notification_settings.xml +++ b/res/xml/configure_notification_settings.xml @@ -28,7 +28,8 @@ + android:title="@string/notification_badging_title" + settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/> buildPreferenceControllers(Context context, Lifecycle lifecycle, Application app, Fragment host) { final List controllers = new ArrayList<>(); - final BadgingNotificationPreferenceController badgeController = - new BadgingNotificationPreferenceController(context); final PulseNotificationPreferenceController pulseController = new PulseNotificationPreferenceController(context); final LockScreenNotificationPreferenceController lockScreenNotificationController = @@ -106,7 +104,6 @@ public class ConfigureNotificationSettings extends DashboardFragment { } controllers.add(new RecentNotifyingAppsPreferenceController( context, new NotificationBackend(), app, host)); - controllers.add(badgeController); controllers.add(pulseController); controllers.add(lockScreenNotificationController); controllers.add(new NotificationRingtonePreferenceController(context) { diff --git a/tests/robotests/src/com/android/settings/notification/BadgingNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BadgingNotificationPreferenceControllerTest.java index d852aaa5b3e..f9991949e47 100644 --- a/tests/robotests/src/com/android/settings/notification/BadgingNotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/BadgingNotificationPreferenceControllerTest.java @@ -17,6 +17,12 @@ package com.android.settings.notification; import static android.provider.Settings.Secure.NOTIFICATION_BADGING; + +import static com.android.settings.core.BasePreferenceController.AVAILABLE; +import static com.android.settings.core.BasePreferenceController.DISABLED_UNSUPPORTED; +import static com.android.settings.notification.BadgingNotificationPreferenceController.OFF; +import static com.android.settings.notification.BadgingNotificationPreferenceController.ON; + import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -54,10 +60,13 @@ public class BadgingNotificationPreferenceControllerTest { private BadgingNotificationPreferenceController mController; private Preference mPreference; + private static final String KEY_NOTIFICATION_BADGING = "notification_badging"; + @Before public void setUp() { MockitoAnnotations.initMocks(this); - mController = new BadgingNotificationPreferenceController(mContext); + mController = new BadgingNotificationPreferenceController(mContext, + KEY_NOTIFICATION_BADGING); mPreference = new Preference(RuntimeEnvironment.application); mPreference.setKey(mController.getPreferenceKey()); when(mScreen.findPreference(mPreference.getKey())).thenReturn(mPreference); @@ -88,9 +97,10 @@ public class BadgingNotificationPreferenceControllerTest { public void updateState_preferenceSetCheckedWhenSettingIsOn() { final TwoStatePreference preference = mock(TwoStatePreference.class); final Context context = RuntimeEnvironment.application; - Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BADGING, 1); + Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BADGING, ON); - mController = new BadgingNotificationPreferenceController(context); + mController = new BadgingNotificationPreferenceController(context, + KEY_NOTIFICATION_BADGING); mController.updateState(preference); verify(preference).setChecked(true); @@ -100,9 +110,10 @@ public class BadgingNotificationPreferenceControllerTest { public void updateState_preferenceSetUncheckedWhenSettingIsOff() { final TwoStatePreference preference = mock(TwoStatePreference.class); final Context context = RuntimeEnvironment.application; - Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BADGING, 0); + Settings.Secure.putInt(context.getContentResolver(), NOTIFICATION_BADGING, OFF); - mController = new BadgingNotificationPreferenceController(context); + mController = new BadgingNotificationPreferenceController(context, + KEY_NOTIFICATION_BADGING); mController.updateState(preference); verify(preference).setChecked(false); @@ -118,11 +129,11 @@ public class BadgingNotificationPreferenceControllerTest { public void testSetValue_updatesCorrectly() { final int newValue = 0; ContentResolver resolver = mContext.getContentResolver(); - Settings.Secure.putInt(resolver, Settings.Secure.NOTIFICATION_BADGING, 1); + Settings.Secure.putInt(resolver, Settings.Secure.NOTIFICATION_BADGING, ON); ((InlinePayload) mController.getResultPayload()).setValue(mContext, newValue); final int updatedValue = - Settings.Secure.getInt(resolver, Settings.Secure.NOTIFICATION_BADGING, 1); + Settings.Secure.getInt(resolver, Settings.Secure.NOTIFICATION_BADGING, ON); assertThat(updatedValue).isEqualTo(newValue); } @@ -138,4 +149,40 @@ public class BadgingNotificationPreferenceControllerTest { assertThat(newValue).isEqualTo(currentValue); } + + @Test + public void isChecked_settingIsOff_shouldReturnFalse() { + Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BADGING, OFF); + + assertThat(mController.isChecked()).isFalse(); + } + + @Test + public void isChecked_settingIsOn_shouldReturnTrue() { + Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BADGING, ON); + + assertThat(mController.isChecked()).isTrue(); + } + + @Test + public void setChecked_setFalse_disablesSetting() { + Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BADGING, ON); + + mController.setChecked(false); + int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(), + NOTIFICATION_BADGING, -1); + + assertThat(updatedValue).isEqualTo(OFF); + } + + @Test + public void setChecked_setTrue_enablesSetting() { + Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BADGING, OFF); + + mController.setChecked(true); + int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(), + NOTIFICATION_BADGING, -1); + + assertThat(updatedValue).isEqualTo(ON); + } } From 99902e1faf559844f43150700b7066effa515ed2 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 4 May 2018 15:04:55 -0400 Subject: [PATCH 5/5] Hide uneccessary dividers Test: manual Change-Id: I159732e35b88815458786b180438380b280410ff Fixes: 79256291 --- .../settings/notification/ZenCustomRadioButtonPreference.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/settings/notification/ZenCustomRadioButtonPreference.java b/src/com/android/settings/notification/ZenCustomRadioButtonPreference.java index 6035b49859a..91472f95244 100644 --- a/src/com/android/settings/notification/ZenCustomRadioButtonPreference.java +++ b/src/com/android/settings/notification/ZenCustomRadioButtonPreference.java @@ -86,10 +86,13 @@ public class ZenCustomRadioButtonPreference extends TwoTargetPreference } final View gear = holder.findViewById(android.R.id.widget_frame); + final View divider = holder.findViewById(R.id.two_target_divider); if (mOnGearClickListener != null) { + divider.setVisibility(View.VISIBLE); gear.setVisibility(View.VISIBLE); gear.setOnClickListener(this); } else { + divider.setVisibility(View.GONE); gear.setVisibility(View.GONE); gear.setOnClickListener(null); }