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
This commit is contained in:
Chris Li
2020-03-17 10:12:24 -07:00
parent 2279fd5f46
commit bfe1b70fcd
5 changed files with 57 additions and 8 deletions

View File

@@ -928,4 +928,10 @@ public class MockContext extends Context {
public Handler getMainThreadHandler() {
throw new UnsupportedOperationException();
}
/** {@hide} */
@Override
public boolean isUiContext() {
throw new UnsupportedOperationException();
}
}