Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f4ce51b authored by Charles Chen's avatar Charles Chen
Browse files

Remove WindowManager usage in ViewConfiguration

[1] made context created via #createConfigurationContext
access ViewConfiguration without StrictModeViolation.
However, we may obtain WindowManager in ViewConfiguration and
still breaks the violation.
This CL gets rid of WindowManager usage to prevent the violation.

Test: atest StrictModeTest
Bug: 197282789
Bug: 191683535

Change-Id: Ifed3f318601ad2214db137ed3d75efdf2157799e
parent a6a85a9b
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -433,9 +433,8 @@ public class ViewConfiguration {
        mAmbiguousGestureMultiplier = Math.max(1.0f, multiplierValue.getFloat());

        // Size of the screen in bytes, in ARGB_8888 format
        final WindowManager windowManager = context.getSystemService(WindowManager.class);
        final Rect maxWindowBounds = windowManager.getMaximumWindowMetrics().getBounds();
        mMaximumDrawingCacheSize = 4 * maxWindowBounds.width() * maxWindowBounds.height();
        final Rect maxBounds = config.windowConfiguration.getMaxBounds();
        mMaximumDrawingCacheSize = 4 * maxBounds.width() * maxBounds.height();

        mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
        mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);