From c1577580cdc1237b5cb81c4393832faeb40b35d7 Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Tue, 30 Mar 2021 22:01:57 +0800 Subject: Don't throw unsupported exception over binder call Otherwise, Parcel will fail to read the arguments and the exception won't be sent to the caller. Bug: 179771384 Bug: 184037368 Test: atest DisplayPolicyTests Change-Id: I820067f409e9b061d338967f036445b7dc10a59c --- services/core/java/com/android/server/wm/DisplayPolicy.java | 4 ++-- .../tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index d929d50919c6..8c5470578e80 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -905,8 +905,8 @@ public class DisplayPolicy { && win.mActivityRecord.fillsParent() && (win.mAttrs.privateFlags & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) != 0 && attrs.getFitInsetsTypes() != 0) { - throw new RuntimeException("Illegal attributes: Main activity window that isn't" - + " translucent trying to fit insets: " + throw new IllegalArgumentException("Illegal attributes: Main activity window" + + " that isn't translucent trying to fit insets: " + attrs.getFitInsetsTypes() + " attrs=" + attrs); } diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java index 47cf53b621d3..c163ef152af6 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java @@ -227,7 +227,7 @@ public class DisplayPolicyTests extends WindowTestsBase { assertEquals(mAppWindow, policy.getTopFullscreenOpaqueWindow()); } - @Test(expected = RuntimeException.class) + @Test(expected = IllegalArgumentException.class) public void testMainAppWindowDisallowFitSystemWindowTypes() { final DisplayPolicy policy = mDisplayContent.getDisplayPolicy(); final WindowState activity = createBaseApplicationWindow(); -- cgit v1.2.3-59-g8ed1b