diff options
author | Stanley Wang <stanleytfwang@google.com> | 2020-09-14 16:50:15 +0800 |
---|---|---|
committer | Stanley Wang <stanleytfwang@google.com> | 2020-09-14 17:22:23 +0800 |
commit | d7ef3416139f9277cd603eb2d3d6c616b647c197 (patch) | |
tree | 51684f438836d9c0bfa854ba63fb51cd3218ddde /shadows | |
parent | 29e959a885f9756628cab4ca3cb85df647be76e2 (diff) | |
download | robolectric-shadows-d7ef3416139f9277cd603eb2d3d6c616b647c197.tar.gz |
Fix the Settings robolectric test fail
Update the shadow object for the framework api of ViewRootImpl changed.
Fixes: b/168283894
Test: run Settings robo test
Change-Id: I99e861be60fd34785a4a094d3783a6c013c2afa2
Diffstat (limited to 'shadows')
-rw-r--r-- | shadows/framework/src/main/java/org/robolectric/shadows/ShadowViewRootImpl.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowViewRootImpl.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowViewRootImpl.java index 8ae93402b..c42e50710 100644 --- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowViewRootImpl.java +++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowViewRootImpl.java @@ -13,6 +13,7 @@ import android.view.Display; import android.view.IWindowSession; import android.view.ViewRootImpl; import android.view.WindowManager; +import android.window.ClientWindowFrames; import java.util.ArrayList; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Implementation; @@ -41,6 +42,7 @@ public class ShadowViewRootImpl { Rect frame = new Rect(); display.getRectSize(frame); Rect zeroSizedRect = new Rect(0, 0, 0, 0); + ClientWindowFrames clientWindowFrame = new ClientWindowFrames(); int apiLevel = RuntimeEnvironment.getApiLevel(); ViewRootImpl component = realObject; @@ -132,7 +134,7 @@ public class ShadowViewRootImpl { ClassParameter.from(int.class, 0), ClassParameter.from(android.view.DisplayCutout.ParcelableWrapper.class, new android.view.DisplayCutout.ParcelableWrapper())); - } else if (apiLevel >= Build.VERSION_CODES.R) { + } else if (apiLevel <= Build.VERSION_CODES.R) { // BEGIN-INTERNAL ReflectionHelpers.callInstanceMethod(ViewRootImpl.class, component, "dispatchResized", ClassParameter.from(Rect.class, frame), @@ -148,6 +150,16 @@ public class ShadowViewRootImpl { ClassParameter.from(android.view.DisplayCutout.ParcelableWrapper.class, new android.view.DisplayCutout.ParcelableWrapper())); // END-INTERNAL + } else if (apiLevel >= Build.VERSION_CODES.S) { + // BEGIN-INTERNAL + ReflectionHelpers.callInstanceMethod(ViewRootImpl.class, component, "dispatchResized", + ClassParameter.from(ClientWindowFrames.class, clientWindowFrame), + ClassParameter.from(boolean.class, true), + ClassParameter.from(MergedConfiguration.class, new MergedConfiguration()), + ClassParameter.from(boolean.class, false), + ClassParameter.from(boolean.class, false), + ClassParameter.from(int.class, 0)); + // END-INTERNAL } else { throw new RuntimeException("Could not find AndroidRuntimeAdapter for API level: " + apiLevel); } |