diff options
author | Andrii Kulian <akulian@google.com> | 2020-03-05 19:34:43 -0800 |
---|---|---|
committer | Charles Chen <charlesccchen@google.com> | 2020-03-24 17:05:50 +0800 |
commit | 0be1d67b681982e20f87359a810ba6c94e438378 (patch) | |
tree | 2bbe898836e47012ec269d2f5309f3741ccfe36a /packages/FakeOemFeatures | |
parent | 8f36aba1fbd92561475487a81bea71dc1c85e2f6 (diff) |
Report bounds instead of size in WindowMetrics
Use case: Jetpack WM will use them to get the location of windows on
screen and compute the display feature positions in window coordinate
space.
Bug: 150908045
Test: atest FrameworksCoreTests:WindowMetricsTest
Test: atest CtsWindowManagerDeviceTestCases:WindowMetricsTests
Change-Id: Ia08950cd5df35971408e8b17bb27d97d29d0ab9b
Exempt-From-Owner-Approval: API change
Diffstat (limited to 'packages/FakeOemFeatures')
-rw-r--r-- | packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeApp.java | 6 | ||||
-rw-r--r-- | packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeBackgroundService.java | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeApp.java b/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeApp.java index d4eb2a9c75d0..a2da23e918d2 100644 --- a/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeApp.java +++ b/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeApp.java @@ -28,11 +28,11 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.graphics.Rect; import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.IBinder; import android.os.Message; -import android.util.Size; import android.util.Slog; import android.view.Display; import android.view.ViewGroup; @@ -134,8 +134,8 @@ public class FakeApp extends Application { } lp.width = ViewGroup.LayoutParams.MATCH_PARENT; lp.height = ViewGroup.LayoutParams.MATCH_PARENT; - Size maxWindowSize = wm.getMaximumWindowMetrics().getSize(); - int maxSize = Math.max(maxWindowSize.getWidth(), maxWindowSize.getHeight()); + Rect maxWindowBounds = wm.getMaximumWindowMetrics().getBounds(); + int maxSize = Math.max(maxWindowBounds.width(), maxWindowBounds.height()); maxSize *= 2; lp.x = maxSize; lp.y = maxSize; diff --git a/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeBackgroundService.java b/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeBackgroundService.java index df00eee63b50..e2120f80f1c9 100644 --- a/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeBackgroundService.java +++ b/packages/FakeOemFeatures/src/com/android/fakeoemfeatures/FakeBackgroundService.java @@ -19,22 +19,22 @@ package com.android.fakeoemfeatures; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; -import java.util.ArrayList; -import java.util.Random; - import android.app.Dialog; import android.app.Service; import android.content.Context; import android.content.Intent; +import android.graphics.Rect; import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.IBinder; import android.os.Message; -import android.util.Size; import android.view.Display; import android.view.ViewGroup; import android.view.WindowManager; +import java.util.ArrayList; +import java.util.Random; + public class FakeBackgroundService extends Service { final ArrayList<int[]> mAllocs = new ArrayList<int[]>(); @@ -99,8 +99,8 @@ public class FakeBackgroundService extends Service { // Create an instance of WindowManager that is adjusted to the area of the display dedicated // for windows with type TYPE_APPLICATION_OVERLAY. final WindowManager wm = windowContext.getSystemService(WindowManager.class); - Size maxWindowSize = wm.getMaximumWindowMetrics().getSize(); - int maxSize = Math.max(maxWindowSize.getWidth(), maxWindowSize.getHeight()); + Rect maxWindowBounds = wm.getMaximumWindowMetrics().getBounds(); + int maxSize = Math.max(maxWindowBounds.width(), maxWindowBounds.height()); maxSize *= 2; lp.x = maxSize; lp.y = maxSize; |