Snap for 6512749 from 8bb7e7ccef to mainline-release

Change-Id: I96387d3b5709404f89501ea8ef92defa27582488
This commit is contained in:
android-build-team Robot
2020-05-20 07:06:05 +00:00
4 changed files with 41 additions and 17 deletions

View File

@@ -128,10 +128,11 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker
public void connectDevice(MediaDevice device) { public void connectDevice(MediaDevice device) {
ThreadUtils.postOnBackgroundThread(() -> { ThreadUtils.postOnBackgroundThread(() -> {
mLocalMediaManager.connectDevice(device); if (mLocalMediaManager.connectDevice(device)) {
ThreadUtils.postOnMainThread(() -> { ThreadUtils.postOnMainThread(() -> {
notifySliceChange(); notifySliceChange();
}); });
}
}); });
} }

View File

@@ -31,6 +31,7 @@ import android.text.TextUtils;
import android.util.ArrayMap; import android.util.ArrayMap;
import android.util.ArraySet; import android.util.ArraySet;
import android.util.IconDrawableFactory; import android.util.IconDrawableFactory;
import android.util.Slog;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.Utils; import com.android.settings.Utils;
@@ -294,15 +295,19 @@ public class RecentNotifyingAppsPreferenceController extends AbstractPreferenceC
List<NotifyingApp> displayableApps = new ArrayList<>(SHOW_RECENT_APP_COUNT); List<NotifyingApp> displayableApps = new ArrayList<>(SHOW_RECENT_APP_COUNT);
int count = 0; int count = 0;
for (NotifyingApp app : mApps) { for (NotifyingApp app : mApps) {
final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry( try {
app.getPackage(), app.getUserId()); final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry(
if (appEntry == null) { app.getPackage(), app.getUserId());
continue; if (appEntry == null) {
} continue;
displayableApps.add(app); }
count++; displayableApps.add(app);
if (count >= SHOW_RECENT_APP_COUNT) { count++;
break; if (count >= SHOW_RECENT_APP_COUNT) {
break;
}
} catch (Exception e) {
Slog.e(TAG, "Failed to find app " + app.getPackage() + "/" + app.getUserId(), e);
} }
} }
return displayableApps; return displayableApps;

View File

@@ -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 // 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 // selection happens too soon (readback happens on a different thread as layout). post
// the selection to make that conflict less likely // 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 { } else {
if (isPriority) { if (isPriority) {
alertSummary.setVisibility(GONE); alertSummary.setVisibility(GONE);
@@ -197,7 +201,11 @@ public class ConversationPriorityPreference extends Preference {
mAlertButton.setBackground(unselectedBackground); mAlertButton.setBackground(unselectedBackground);
mPriorityButton.setBackground(selectedBackground); mPriorityButton.setBackground(selectedBackground);
mSilenceButton.setBackground(unselectedBackground); mSilenceButton.setBackground(unselectedBackground);
parent.post(() -> mPriorityButton.setSelected(true)); parent.post(() -> {
mSilenceButton.setSelected(false);
mAlertButton.setSelected(false);
mPriorityButton.setSelected(true);
});
} else { } else {
alertSummary.setVisibility(VISIBLE); alertSummary.setVisibility(VISIBLE);
alertIcon.setImageTintList(colorAccent); alertIcon.setImageTintList(colorAccent);
@@ -214,7 +222,11 @@ public class ConversationPriorityPreference extends Preference {
mAlertButton.setBackground(selectedBackground); mAlertButton.setBackground(selectedBackground);
mPriorityButton.setBackground(unselectedBackground); mPriorityButton.setBackground(unselectedBackground);
mSilenceButton.setBackground(unselectedBackground); mSilenceButton.setBackground(unselectedBackground);
parent.post(() -> mAlertButton.setSelected(true)); parent.post(() -> {
mSilenceButton.setSelected(false);
mAlertButton.setSelected(true);
mPriorityButton.setSelected(false);
});
} }
} }
} }

View File

@@ -98,7 +98,8 @@ public class NotificationHistoryAdapter extends
public boolean performAccessibilityAction(View host, int action, Bundle args) { public boolean performAccessibilityAction(View host, int action, Bundle args) {
super.performAccessibilityAction(host, action, args); super.performAccessibilityAction(host, action, args);
if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS.getId()) { if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS.getId()) {
onItemSwipeDeleted(position); int currPosition = mValues.indexOf(hn);
onItemSwipeDeleted(currPosition);
return true; return true;
} }
return false; return false;
@@ -119,6 +120,11 @@ public class NotificationHistoryAdapter extends
@Override @Override
public void onItemSwipeDeleted(int position) { 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); HistoricalNotification hn = mValues.remove(position);
if (hn != null) { if (hn != null) {
try { try {