Merge "Add corresponding code for the new NR condition" into rvc-dev
diff --git a/src/com/android/settings/media/MediaDeviceUpdateWorker.java b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
index a976811..bce9c34 100644
--- a/src/com/android/settings/media/MediaDeviceUpdateWorker.java
+++ b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
@@ -128,10 +128,11 @@
public void connectDevice(MediaDevice device) {
ThreadUtils.postOnBackgroundThread(() -> {
- mLocalMediaManager.connectDevice(device);
- ThreadUtils.postOnMainThread(() -> {
- notifySliceChange();
- });
+ if (mLocalMediaManager.connectDevice(device)) {
+ ThreadUtils.postOnMainThread(() -> {
+ notifySliceChange();
+ });
+ }
});
}
diff --git a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
index b4c1815..aaa96bcc 100644
--- a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
+++ b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
@@ -31,6 +31,7 @@
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 @@
List<NotifyingApp> 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;
diff --git a/src/com/android/settings/notification/app/ConversationPriorityPreference.java b/src/com/android/settings/notification/app/ConversationPriorityPreference.java
index ff1dc6c..307abec 100644
--- a/src/com/android/settings/notification/app/ConversationPriorityPreference.java
+++ b/src/com/android/settings/notification/app/ConversationPriorityPreference.java
@@ -179,7 +179,11 @@
// 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 @@
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 @@
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);
+ });
}
}
}
diff --git a/src/com/android/settings/notification/history/NotificationHistoryAdapter.java b/src/com/android/settings/notification/history/NotificationHistoryAdapter.java
index afe36ef..4a5c627 100644
--- a/src/com/android/settings/notification/history/NotificationHistoryAdapter.java
+++ b/src/com/android/settings/notification/history/NotificationHistoryAdapter.java
@@ -98,7 +98,8 @@
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 @@
@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 {