diff options
| author | Charles Chen <charlesccchen@google.com> | 2020-08-24 09:56:57 +0800 |
|---|---|---|
| committer | Charles Chen <charlesccchen@google.com> | 2020-08-26 11:47:08 +0800 |
| commit | b2444cbef5236845a26e15bdfc95efac17b299f8 (patch) | |
| tree | e9319daa4ce3992d2ad2d8eb3eacc0eaf5a5f875 /core/java/android | |
| parent | a4f73d7f1f73ca45b99bd35dac5ae5726289060f (diff) | |
[RESTRICT AUTOMERGE] Make a context dervied from an UI context as an UI context
fixes: 165833103
Test: atest StrictModeTest ContextAccessTest
Test: atest InputMethodServiceTest InputMethodServiceStrictModeTest
Merged-In: Ia97e1a0cc290be516d2618148600238b3273c54c
Change-Id: Ia97e1a0cc290be516d2618148600238b3273c54c
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/ContextImpl.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 3a18b870d7f6..c51a84649a07 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -2389,7 +2389,6 @@ class ContextImpl extends Context { context.setResources(createResources(mToken, mPackageInfo, mSplitName, displayId, overrideConfiguration, getDisplayAdjustments(displayId).getCompatibilityInfo(), mResources.getLoaders())); - context.mIsUiContext = isSelfOrOuterUiContext(); return context; } @@ -2409,6 +2408,11 @@ class ContextImpl extends Context { mResources.getLoaders())); context.mDisplay = display; context.mIsAssociatedWithDisplay = true; + // Note that even if a display context is derived from an UI context, it should not be + // treated as UI context because it does not handle configuration changes from the server + // side. If the context does need to handle configuration changes, please use + // Context#createWindowContext(int, Bundle). + context.mIsUiContext = false; return context; } @@ -2770,6 +2774,7 @@ class ContextImpl extends Context { mDisplay = container.mDisplay; mIsAssociatedWithDisplay = container.mIsAssociatedWithDisplay; mIsSystemOrSystemUiContext = container.mIsSystemOrSystemUiContext; + mIsUiContext = container.isSelfOrOuterUiContext(); } else { mBasePackageName = packageInfo.mPackageName; ApplicationInfo ainfo = packageInfo.getApplicationInfo(); |
