From 17e2e158c47ce2c3d5ada3b3aa473bb420337422 Mon Sep 17 00:00:00 2001 From: Tim Peng Date: Tue, 19 May 2020 10:08:14 +0800 Subject: [PATCH 1/4] Talkback focus doesn't move in liner order after tapping selected option in switch device panel -Not to reflash UI to reset the focus order -Reflash UI only when connect() is valid Bug: 156336275 Test: make -j42 RunSettingsRoboTests Change-Id: Ibb20252167ba13309065e4672f92cdf645661a0e --- .../android/settings/media/MediaDeviceUpdateWorker.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/media/MediaDeviceUpdateWorker.java b/src/com/android/settings/media/MediaDeviceUpdateWorker.java index a97681165d4..bce9c340c76 100644 --- a/src/com/android/settings/media/MediaDeviceUpdateWorker.java +++ b/src/com/android/settings/media/MediaDeviceUpdateWorker.java @@ -128,10 +128,11 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker public void connectDevice(MediaDevice device) { ThreadUtils.postOnBackgroundThread(() -> { - mLocalMediaManager.connectDevice(device); - ThreadUtils.postOnMainThread(() -> { - notifySliceChange(); - }); + if (mLocalMediaManager.connectDevice(device)) { + ThreadUtils.postOnMainThread(() -> { + notifySliceChange(); + }); + } }); } From a1c02690270329ddf3fe8b777c2ad774c82a08b1 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Tue, 19 May 2020 10:26:03 -0400 Subject: [PATCH 2/4] Map local context menu to the correct item Since the position of the item might have changed if ohter items were deleted Test: manual: delete item 0/2, item 2/2, then 1/2 Fixes: 156716919 Change-Id: I989a064d3a3f89b5c2692d5a687d759c842e080c --- .../notification/history/NotificationHistoryAdapter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/notification/history/NotificationHistoryAdapter.java b/src/com/android/settings/notification/history/NotificationHistoryAdapter.java index afe36ef0589..4a5c627eb28 100644 --- a/src/com/android/settings/notification/history/NotificationHistoryAdapter.java +++ b/src/com/android/settings/notification/history/NotificationHistoryAdapter.java @@ -98,7 +98,8 @@ public class NotificationHistoryAdapter extends public boolean performAccessibilityAction(View host, int action, Bundle args) { super.performAccessibilityAction(host, action, args); if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS.getId()) { - onItemSwipeDeleted(position); + int currPosition = mValues.indexOf(hn); + onItemSwipeDeleted(currPosition); return true; } return false; @@ -119,6 +120,11 @@ public class NotificationHistoryAdapter extends @Override public void onItemSwipeDeleted(int position) { + if (position > (mValues.size() - 1)) { + Slog.d(TAG, "Tried to swipe element out of list: position: " + position + + " size? " + mValues.size()); + return; + } HistoricalNotification hn = mValues.remove(position); if (hn != null) { try { From 663cc934d993f7621d7fe46d9a85dd8553772612 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Tue, 19 May 2020 12:29:24 -0400 Subject: [PATCH 3/4] Guard against NPE Test: manual, launching screen from locked lock screen Fixes: 153569405 Change-Id: Idb546f58623792d94a43ca6659f7498de3beec94 --- ...centNotifyingAppsPreferenceController.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java index b4c1815daa7..aaa96bccc7f 100644 --- a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java +++ b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java @@ -31,6 +31,7 @@ import android.text.TextUtils; import android.util.ArrayMap; import android.util.ArraySet; import android.util.IconDrawableFactory; +import android.util.Slog; import com.android.settings.R; import com.android.settings.Utils; @@ -294,15 +295,19 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC List displayableApps = new ArrayList<>(SHOW_RECENT_APP_COUNT); int count = 0; for (NotifyingApp app : mApps) { - final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry( - app.getPackage(), app.getUserId()); - if (appEntry == null) { - continue; - } - displayableApps.add(app); - count++; - if (count >= SHOW_RECENT_APP_COUNT) { - break; + try { + final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry( + app.getPackage(), app.getUserId()); + if (appEntry == null) { + continue; + } + displayableApps.add(app); + count++; + if (count >= SHOW_RECENT_APP_COUNT) { + break; + } + } catch (Exception e) { + Slog.e(TAG, "Failed to find app " + app.getPackage() + "/" + app.getUserId(), e); } } return displayableApps; From d1d32e7d2295adf07b8662e0112a7c8ce68b72eb Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Tue, 19 May 2020 14:36:32 -0400 Subject: [PATCH 4/4] Fix button selected state Test: toggle between buttons with a11y service Fixes: 156990411 Change-Id: I421c6d2e9762794bdf8a090db8a808678ffd8a1c --- .../app/ConversationPriorityPreference.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/notification/app/ConversationPriorityPreference.java b/src/com/android/settings/notification/app/ConversationPriorityPreference.java index ff1dc6c5d91..307abec97b1 100644 --- a/src/com/android/settings/notification/app/ConversationPriorityPreference.java +++ b/src/com/android/settings/notification/app/ConversationPriorityPreference.java @@ -179,7 +179,11 @@ public class ConversationPriorityPreference extends Preference { // a11y service won't always read the newly appearing text in the right order if the // selection happens too soon (readback happens on a different thread as layout). post // the selection to make that conflict less likely - parent.post(() -> mSilenceButton.setSelected(true)); + parent.post(() -> { + mSilenceButton.setSelected(true); + mAlertButton.setSelected(false); + mPriorityButton.setSelected(false); + }); } else { if (isPriority) { alertSummary.setVisibility(GONE); @@ -197,7 +201,11 @@ public class ConversationPriorityPreference extends Preference { mAlertButton.setBackground(unselectedBackground); mPriorityButton.setBackground(selectedBackground); mSilenceButton.setBackground(unselectedBackground); - parent.post(() -> mPriorityButton.setSelected(true)); + parent.post(() -> { + mSilenceButton.setSelected(false); + mAlertButton.setSelected(false); + mPriorityButton.setSelected(true); + }); } else { alertSummary.setVisibility(VISIBLE); alertIcon.setImageTintList(colorAccent); @@ -214,7 +222,11 @@ public class ConversationPriorityPreference extends Preference { mAlertButton.setBackground(selectedBackground); mPriorityButton.setBackground(unselectedBackground); mSilenceButton.setBackground(unselectedBackground); - parent.post(() -> mAlertButton.setSelected(true)); + parent.post(() -> { + mSilenceButton.setSelected(false); + mAlertButton.setSelected(true); + mPriorityButton.setSelected(false); + }); } } }