[DO NOT MERGE] Catch RuntimeException from DisplayManager am: 39745d829c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13566539

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iddbaad3b57389deed966782c4e63422de42ab080
This commit is contained in:
Sungsoo Lim
2021-02-19 05:49:46 +00:00
committed by Automerger Merge Worker

View File

@@ -381,7 +381,12 @@ public class MediaRouter {
}
public Display[] getAllPresentationDisplays() {
return mDisplayService.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
try {
return mDisplayService.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
} catch (RuntimeException ex) {
Log.e(TAG, "Unable to get displays.", ex);
return null;
}
}
private void updatePresentationDisplays(int changedDisplayId) {
@@ -2085,6 +2090,9 @@ public class MediaRouter {
private Display choosePresentationDisplay() {
if ((mSupportedTypes & ROUTE_TYPE_LIVE_VIDEO) != 0) {
Display[] displays = sStatic.getAllPresentationDisplays();
if (displays == null || displays.length == 0) {
return null;
}
// Ensure that the specified display is valid for presentations.
// This check will normally disallow the default display unless it was