[DO NOT MERGE] Catch RuntimeException from DisplayManager
Bug: 171714761 Test: build Change-Id: I5bad08dcf49472af16df18418102407be56e67e7
This commit is contained in:
@@ -361,7 +361,12 @@ public class MediaRouter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Display[] getAllPresentationDisplays() {
|
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) {
|
private void updatePresentationDisplays(int changedDisplayId) {
|
||||||
@@ -2075,6 +2080,9 @@ public class MediaRouter {
|
|||||||
private Display choosePresentationDisplay() {
|
private Display choosePresentationDisplay() {
|
||||||
if ((mSupportedTypes & ROUTE_TYPE_LIVE_VIDEO) != 0) {
|
if ((mSupportedTypes & ROUTE_TYPE_LIVE_VIDEO) != 0) {
|
||||||
Display[] displays = sStatic.getAllPresentationDisplays();
|
Display[] displays = sStatic.getAllPresentationDisplays();
|
||||||
|
if (displays == null || displays.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that the specified display is valid for presentations.
|
// Ensure that the specified display is valid for presentations.
|
||||||
// This check will normally disallow the default display unless it was
|
// This check will normally disallow the default display unless it was
|
||||||
|
|||||||
Reference in New Issue
Block a user