diff options
| author | Chris Li <lihongyu@google.com> | 2020-03-17 10:12:24 -0700 |
|---|---|---|
| committer | Chris Li <lihongyu@google.com> | 2020-03-26 22:09:28 -0700 |
| commit | bfe1b70fcd3f3688bd27be317ee0830e80cc00fc (patch) | |
| tree | 5a62b351c6731fd8e3111693b73b42f218e9ff23 /core/java/android/app/ContextImpl.java | |
| parent | 2279fd5f469d16da8e458f3bec6a1a072fc296f3 (diff) | |
Report incorrect context usage in ViewConfiguration
Before, the documentation said that the passed context is an application context, which is incorrect to get the density, window metrics, and window manager. We should use visual context to get these instead.
Bug: 151474461
Test: StrictModeTest#testIncorrectContextUse_GetViewConfiguration
Change-Id: Iea28d727cafbb3ec8536742c6a0e594f73fe5a51
Diffstat (limited to 'core/java/android/app/ContextImpl.java')
| -rw-r--r-- | core/java/android/app/ContextImpl.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 17fd4efec9cc..d8757c36374a 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -1920,7 +1920,9 @@ class ContextImpl extends Context { return SystemServiceRegistry.getSystemServiceName(serviceClass); } - private boolean isUiContext() { + /** @hide */ + @Override + public boolean isUiContext() { return mIsSystemOrSystemUiContext || mIsUiContext || isSystemOrSystemUI(); } |
