Open doodla opened 5 years ago
Although I'm not sure why.
public ViewRootImpl(Context context, Display display) {
mContext = context;
mWindowSession = WindowManagerGlobal.getWindowSession();
mDisplay = display;
mBasePackageName = context.getBasePackageName();
mThread = Thread.currentThread();
mLocation = new WindowLeaked(null);
mLocation.fillInStackTrace();
....
The constructor seems to exist.
What API level?
28
Successfully repro'd, looking. Thanks!
This is due to the non sdk interface restrictions that came with Android 9+
To get around this for testing, you need to run
adb shell settings put global hidden_api_policy_p_apps 1
adb shell settings put global hidden_api_policy_pre_p_apps 1
adb shell settings put global hidden_api_policy 1 // this is for Q+
And it will work. It seems like we can likely put this in the framework, but we also need to evaluate if we still need all of the reflection hackery...
adb settings above did not help. However it's different crash now:
04:23:33 V/InstrumentationResultParser: Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.WindowAttachment.generateAttachInfo(WindowAttachment.java:230)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.WindowAttachment.dispatchAttach(WindowAttachment.java:89)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.internal.ScreenshotImpl.storeBitmap(ScreenshotImpl.java:182)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.internal.ScreenshotImpl.access$000(ScreenshotImpl.java:50)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.internal.ScreenshotImpl$2.call(ScreenshotImpl.java:170)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.internal.ScreenshotImpl$2.call(ScreenshotImpl.java:167)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.internal.ScreenshotImpl$3.run(ScreenshotImpl.java:327)
04:23:33 V/InstrumentationResultParser: at android.os.Handler.handleCallback(Handler.java:873)
04:23:33 V/InstrumentationResultParser: at android.os.Handler.dispatchMessage(Handler.java:99)
04:23:33 V/InstrumentationResultParser: at android.os.Looper.loop(Looper.java:214)
04:23:33 V/InstrumentationResultParser: at android.app.ActivityThread.main(ActivityThread.java:7045)
04:23:33 V/InstrumentationResultParser: at java.lang.reflect.Method.invoke(Native Method)
04:23:33 V/InstrumentationResultParser: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
04:23:33 V/InstrumentationResultParser: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
04:23:33 V/InstrumentationResultParser: Caused by: java.lang.reflect.InvocationTargetException
04:23:33 V/InstrumentationResultParser: at java.lang.reflect.Constructor.newInstance0(Native Method)
04:23:33 V/InstrumentationResultParser: at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.WindowAttachment.invokeConstructor(WindowAttachment.java:238)
04:23:33 V/InstrumentationResultParser: at com.facebook.testing.screenshot.WindowAttachment.generateAttachInfo(WindowAttachment.java:219)
04:23:33 V/InstrumentationResultParser: ... 13 more
04:23:33 V/InstrumentationResultParser: Caused by: java.lang.NullPointerException: Expected to unbox a 'boolean' primitive type but was returned null
04:23:33 V/InstrumentationResultParser: at $Proxy8.isCoverOpen(Unknown Source)
04:23:33 V/InstrumentationResultParser: at android.view.View$AttachInfo.
Thats a separate issue with running the tests on Samsung Devices. Samsung has extra methods that are non standard they expect on their AttachInfo class, a fix similar to https://github.com/facebook/screenshot-tests-for-android/commit/0b9e8e90679f5c4b21368d33a81a6f5bc630d265 is needed for that.
Any suggestions on how to handle this when using firebase?
Any suggestions on how to handle this when using firebase?
@xiphirx This is a valid concern. We don't have access to the command line there to modify these policies. I'm still on 0.9.0 because of this.
Can you try executing them as part of your test? Similarly to https://github.com/facebook/screenshot-tests-for-android/blob/master/core/src/main/java/com/facebook/testing/screenshot/internal/ScreenshotDirectories.java#L80
I'm also not familiar with firebase's interface. You dont have any adb connection to the device/emulator? I wonder how the plugin even works then...
I'm sure they have an adb
connection. But we don't have access to the terminal to run these commands. I'll try executing them as part of the test itself and see if that works.
but we also need to evaluate if we still need all of the reflection hackery...
any progress on this?
What I mean is that the plugin portion of this library just calls adb
directly, so if it can you should be able to too.
I haven't been able to spend much time at all on this project, so I haven't evaluated all of the reflection hackery yet.
What I mean is that the plugin portion of this library just calls adb directly, so if it can you should be able to too.
We just use the core
library. :)
It seems to fail on
in
WindowAttachment.java
.