From 77f3973d975251ec10b81954e39e6b8ce675957c Mon Sep 17 00:00:00 2001 From: Beverly Date: Fri, 18 May 2018 17:09:07 -0400 Subject: [PATCH 01/13] Update DND strings Test: manual Bug: 79525632 Change-Id: Ia6106d03499fa546df51dc80f086c7cd684acad4 --- res/values/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index f617df17217..ed2b341f5e9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7253,15 +7253,15 @@ Notifications - Show notifications silently + No sound from notifications - Notifications will be muted + You will see notifications on your screen When notifications arrive, your phone won\u2019t make a sound or vibrate. - Hide notifications + No visuals or sound from notifications - You won\u2019t see new or existing notifications + You won\u2019t see or hear notifications Your phone won\u2019t show new or existing notifications, and won\u2019t make a sound or vibrate. Notifications won\u2019t appear when you swipe down from the top of your screen.\n\nKeep in mind, critical notifications for phone activity and status will still appear. @@ -7271,11 +7271,11 @@ Remove custom setting - Will appear + No sound from notifications Partially hidden - - Hidden + + No visuals or sound from notifications Custom restrictions @@ -7418,7 +7418,7 @@ Settings - No visuals or sounds from notifications + No visuals or sound from notifications No sound from notifications @@ -9919,7 +9919,7 @@ Update Do Not Disturb - Hide notifications to stay focused + Pause notifications to stay focused What\'s new and exciting? From f6d54bc6c52d88270d599544f15f716f492e7ca2 Mon Sep 17 00:00:00 2001 From: Beverly Date: Fri, 18 May 2018 18:02:14 -0400 Subject: [PATCH 02/13] Don't give onboarding dialog a fixed width Test: visual inspection (display and font largest) Change-Id: Ia81cfa41c125d088d95db2e29f83248dc6819396 Fixes: 79960996 --- res/layout/zen_onboarding.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/layout/zen_onboarding.xml b/res/layout/zen_onboarding.xml index 82951bd264d..33cdbdd35fd 100644 --- a/res/layout/zen_onboarding.xml +++ b/res/layout/zen_onboarding.xml @@ -16,8 +16,8 @@ --> + android:layout_width="match_parent" + android:layout_height="wrap_content"> Date: Wed, 9 May 2018 14:33:52 +0800 Subject: [PATCH 03/13] Using static method to get summary resource id * Using getConnectedDevicesSummaryResourceId() to get the resource id to shown the summary. Bug: 79299421 Test: make -j50 RunSettingsRoboTests Change-Id: I268de4d989fe01eff463a5ec1c0a174e094e56c0 --- .../ConnectedDeviceDashboardFragment.java | 12 ++---------- .../ConnectedDeviceDashboardFragmentTest.java | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java index 26ff930558a..c57c0b595f7 100644 --- a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java +++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java @@ -72,25 +72,17 @@ public class ConnectedDeviceDashboardFragment extends DashboardFragment { private final Context mContext; private final SummaryLoader mSummaryLoader; - private final NfcPreferenceController mNfcPreferenceController; public SummaryProvider(Context context, SummaryLoader summaryLoader) { mContext = context; mSummaryLoader = summaryLoader; - mNfcPreferenceController = new NfcPreferenceController(context); } - @Override public void setListening(boolean listening) { if (listening) { - if (mNfcPreferenceController.isAvailable()) { - mSummaryLoader.setSummary(this, - mContext.getString(R.string.connected_devices_dashboard_summary)); - } else { - mSummaryLoader.setSummary(this, mContext.getString( - R.string.connected_devices_dashboard_no_nfc_summary)); - } + mSummaryLoader.setSummary(this, mContext.getText(AdvancedConnectedDeviceController. + getConnectedDevicesSummaryResourceId(mContext))); } } } diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java index 90641792639..cea258d67ce 100644 --- a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java +++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java @@ -30,7 +30,6 @@ import android.content.pm.PackageManager; import android.provider.SearchIndexableResource; import com.android.settings.R; -import com.android.settings.nfc.NfcPreferenceController; import com.android.settings.testutils.SettingsRobolectricTestRunner; import com.android.settings.testutils.shadow.ShadowBluetoothPan; import com.android.settings.testutils.shadow.ShadowConnectivityManager; From 988dc9fbe6728196a6a47c159308db7f2a97034d Mon Sep 17 00:00:00 2001 From: ryanywlin Date: Sat, 19 May 2018 07:34:52 +0800 Subject: [PATCH 04/13] Move getLocalBtManager into FutureTask Utils.getLocalBtManager in constructor violate StrictMode ThreadPolicy, move it into FutureTask. Bug: 79985175 Test: make RunSettingsRoboTests ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j28 Test: make RunSettingsRoboTests ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j28 Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j28 Change-Id: I0a14be18e4766245e7d165239d47ab54fa5e4acb --- .../AudioSwitchPreferenceController.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/sound/AudioSwitchPreferenceController.java b/src/com/android/settings/sound/AudioSwitchPreferenceController.java index 62f345370a7..b0ee649b1ae 100644 --- a/src/com/android/settings/sound/AudioSwitchPreferenceController.java +++ b/src/com/android/settings/sound/AudioSwitchPreferenceController.java @@ -41,6 +41,7 @@ import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceScreen; import android.text.TextUtils; import android.util.FeatureFlagUtils; +import android.util.Log; import com.android.settings.R; import com.android.settings.bluetooth.Utils; @@ -59,6 +60,8 @@ import com.android.settingslib.core.lifecycle.events.OnStop; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.FutureTask; /** * Abstract class for audio switcher controller to notify subclass @@ -70,21 +73,22 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont implements Preference.OnPreferenceChangeListener, BluetoothCallback, LifecycleObserver, OnStart, OnStop { + private static final String TAG = "AudioSwitchPreferenceController"; private static final int INVALID_INDEX = -1; protected final List mConnectedDevices; protected final AudioManager mAudioManager; protected final MediaRouter mMediaRouter; - protected final LocalBluetoothProfileManager mProfileManager; protected int mSelectedIndex; protected Preference mPreference; + protected LocalBluetoothProfileManager mProfileManager; protected AudioSwitchCallback mAudioSwitchPreferenceCallback; private final AudioManagerAudioDeviceCallback mAudioManagerAudioDeviceCallback; - private final LocalBluetoothManager mLocalBluetoothManager; private final MediaRouterCallback mMediaRouterCallback; private final WiredHeadsetBroadcastReceiver mReceiver; private final Handler mHandler; + private LocalBluetoothManager mLocalBluetoothManager; public interface AudioSwitchCallback { void onPreferenceDataChanged(ListPreference preference); @@ -94,14 +98,23 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont super(context, preferenceKey); mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); mMediaRouter = (MediaRouter) context.getSystemService(Context.MEDIA_ROUTER_SERVICE); - mLocalBluetoothManager = Utils.getLocalBtManager(mContext); - mLocalBluetoothManager.setForegroundActivity(context); - mProfileManager = mLocalBluetoothManager.getProfileManager(); mHandler = new Handler(Looper.getMainLooper()); mAudioManagerAudioDeviceCallback = new AudioManagerAudioDeviceCallback(); mReceiver = new WiredHeadsetBroadcastReceiver(); mMediaRouterCallback = new MediaRouterCallback(); mConnectedDevices = new ArrayList<>(); + final FutureTask localBtManagerFutureTask = new FutureTask<>( + // Avoid StrictMode ThreadPolicy violation + () -> Utils.getLocalBtManager(mContext)); + try { + localBtManagerFutureTask.run(); + mLocalBluetoothManager = localBtManagerFutureTask.get(); + } catch (InterruptedException | ExecutionException e) { + Log.w(TAG, "Error getting LocalBluetoothManager.", e); + return; + } + mLocalBluetoothManager.setForegroundActivity(mContext); + mProfileManager = mLocalBluetoothManager.getProfileManager(); } /** From 77b59860322be8a7afb3015003de84b6ec6855fa Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 21 May 2018 13:27:09 -0400 Subject: [PATCH 05/13] DO NOT MERGE styleActionBar when updating header If the activity has started, style the actionBar when the header is being updated Test: manual Change-Id: Ide69fc0f6e8e5046105bd290d22d9f9a3df5c1ae Bug: 79983080 --- .../notification/HeaderPreferenceController.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/notification/HeaderPreferenceController.java b/src/com/android/settings/notification/HeaderPreferenceController.java index c6f6a80621f..0a4cca1934f 100644 --- a/src/com/android/settings/notification/HeaderPreferenceController.java +++ b/src/com/android/settings/notification/HeaderPreferenceController.java @@ -18,6 +18,7 @@ package com.android.settings.notification; import static com.android.settings.widget.EntityHeaderController.PREF_KEY_APP_HEADER; +import android.app.Activity; import android.arch.lifecycle.LifecycleObserver; import android.arch.lifecycle.OnLifecycleEvent; import android.content.Context; @@ -26,6 +27,7 @@ import android.support.v7.preference.Preference; import android.text.BidiFormatter; import android.text.SpannableStringBuilder; import android.text.TextUtils; +import android.util.Slog; import android.view.View; import com.android.settings.R; @@ -33,15 +35,13 @@ import com.android.settings.applications.LayoutPreference; import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.widget.EntityHeaderController; import com.android.settingslib.core.lifecycle.Lifecycle; -import com.android.settingslib.core.lifecycle.events.OnStart; - -import java.util.Objects; public class HeaderPreferenceController extends NotificationPreferenceController implements PreferenceControllerMixin, LifecycleObserver { private final PreferenceFragment mFragment; private EntityHeaderController mHeaderController; + private boolean mStarted = false; public HeaderPreferenceController(Context context, PreferenceFragment fragment) { super(context, null); @@ -61,6 +61,13 @@ public class HeaderPreferenceController extends NotificationPreferenceController @Override public void updateState(Preference preference) { if (mAppRow != null && mFragment != null) { + + Activity activity = null; + if (mStarted) { + // don't call done on an activity if it hasn't started yet + activity = mFragment.getActivity(); + } + LayoutPreference pref = (LayoutPreference) preference; mHeaderController = EntityHeaderController.newInstance( mFragment.getActivity(), mFragment, pref.findViewById(R.id.entity_header)); @@ -72,7 +79,7 @@ public class HeaderPreferenceController extends NotificationPreferenceController .setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE, EntityHeaderController.ActionType.ACTION_NONE) .setHasAppInfoLink(true) - .done(null, mContext); + .done(activity, mContext); pref.findViewById(R.id.entity_header).setVisibility(View.VISIBLE); } } @@ -108,6 +115,7 @@ public class HeaderPreferenceController extends NotificationPreferenceController @OnLifecycleEvent(Lifecycle.Event.ON_START) public void onStart() { + mStarted = true; if (mHeaderController != null) { mHeaderController.styleActionBar(mFragment.getActivity()); } From 6394a1425cf05901a7cc2fddc5431c5c4f542316 Mon Sep 17 00:00:00 2001 From: Matthew Fritze Date: Mon, 21 May 2018 13:36:45 -0700 Subject: [PATCH 06/13] Change Night Display slice title to "NightDisplay" Fixes: 80093098 Test: Slice browser for UI change Change-Id: I4999d375f76d914095d4af234aaeb31e32fe798f --- res/xml/night_display_settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/xml/night_display_settings.xml b/res/xml/night_display_settings.xml index 7b00ea02567..d83fcc6d3cb 100644 --- a/res/xml/night_display_settings.xml +++ b/res/xml/night_display_settings.xml @@ -45,7 +45,7 @@ Date: Mon, 21 May 2018 12:07:28 -0700 Subject: [PATCH 07/13] Misc GAR fixes - Use colorPrimary for EntityHeader background. - Update data usage header text to be 87% black. Change-Id: Ic361155d7cd36a2f1cca96e918af0e3855fb8ced Merged-In: Ic361155d7cd36a2f1cca96e918af0e3855fb8ced Fixes: 79773433 Test: robotests Test: visual --- res/drawable/selectable_card_grey.xml | 22 ------------------- res/layout/battery_header.xml | 1 - res/layout/data_usage_summary_preference.xml | 3 +-- res/values/styles.xml | 2 +- .../widget/EntityHeaderController.java | 2 +- .../shadow/SettingsShadowResources.java | 3 --- .../shadow/SettingsShadowResourcesImpl.java | 2 -- 7 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 res/drawable/selectable_card_grey.xml diff --git a/res/drawable/selectable_card_grey.xml b/res/drawable/selectable_card_grey.xml deleted file mode 100644 index 225e72fcff1..00000000000 --- a/res/drawable/selectable_card_grey.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/res/layout/battery_header.xml b/res/layout/battery_header.xml index db90e2e0fc8..df45d15fd6d 100644 --- a/res/layout/battery_header.xml +++ b/res/layout/battery_header.xml @@ -24,7 +24,6 @@ android:orientation="horizontal" android:paddingTop="24dp" android:paddingBottom="24dp" - android:background="@drawable/selectable_card_grey" style="@style/EntityHeader"> @@ -31,7 +30,7 @@ android:id="@+id/usage_title" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textColor="?android:attr/colorAccent" + android:textColor="?android:attr/textColorPrimary" android:text="@string/data_usage_title" />