summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Sungsoo Lim <sungsoo@google.com> 2021-02-15 15:53:07 +0900
committer Sungsoo Lim <sungsoo@google.com> 2021-02-18 09:16:25 +0000
commit39745d829c696256e8021d545ed9d4ed9bcc4e37 (patch)
treeba0d4c8aa62dfdf740c9a4f20a3bc3aa82488182
parent087715166a3ff1ce5a21fd926395ff42b47e4322 (diff)
[DO NOT MERGE] Catch RuntimeException from DisplayManager
Bug: 171714761 Test: build Change-Id: I5bad08dcf49472af16df18418102407be56e67e7
-rw-r--r--media/java/android/media/MediaRouter.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java
index 6fa378724240..cd68a1d8eb1a 100644
--- a/media/java/android/media/MediaRouter.java
+++ b/media/java/android/media/MediaRouter.java
@@ -361,7 +361,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) {
@@ -2075,6 +2080,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