From d9bdee7fa00e02cd887c084d365adaf754ffd492 Mon Sep 17 00:00:00 2001 From: Charles Chen Date: Tue, 16 Aug 2022 10:09:48 +0800 Subject: Fix violation in DecorContext The issue happens when activity is launched on the secondary display. It's because the base context of DecorContext is a DisplayContext, but we should check #isConfigurationContext in associatd window's Context instead, like DecorContext#isUiContext fixes: 242571036 Test: manual - launch activity on the secondary display Merged-In: Ie2659fb31248ad64099018bfebb6a6b43c72f466 Change-Id: Ie2659fb31248ad64099018bfebb6a6b43c72f466 --- core/java/com/android/internal/policy/DecorContext.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/java/com/android/internal/policy/DecorContext.java b/core/java/com/android/internal/policy/DecorContext.java index 5e34c15c42e2..134a91710c0b 100644 --- a/core/java/com/android/internal/policy/DecorContext.java +++ b/core/java/com/android/internal/policy/DecorContext.java @@ -137,4 +137,13 @@ public class DecorContext extends ContextThemeWrapper { } return false; } + + @Override + public boolean isConfigurationContext() { + Context context = mContext.get(); + if (context != null) { + return context.isConfigurationContext(); + } + return false; + } } -- cgit v1.2.3-59-g8ed1b