hoisie

hoisie

Working on Android testing tools at Google.

Member Since 12 years ago

Google, Inc, Palo Alto, CA

Experience Points
588
follower
Lessons Completed
39
follow
Lessons Completed
116
stars
Best Reply Awards
50
repos

826 contributions in the last year

Pinned
⚡ The easiest way to create web applications with Go
⚡ The mustache template language in Go
⚡ A simple, powerful Redis client for Go
⚡ A client for Twitter's streaming API in Go
⚡ A minimal wrapper for LevelDB in Objective C
⚡ A simple, low-level http library for Go
Activity
Nov
28
3 hours ago
Activity icon
delete

hoisie in robolectric/robolectric delete branch piper_399115715

deleted time in 24 minutes ago
push

hoisie push robolectric/robolectric

hoisie
hoisie

Check Window flags when selecting root view in LocalUiController. #6741

PiperOrigin-RevId: 399115715

hoisie
hoisie

Merge pull request #6745 from robolectric/piper_399115715

Check Window flags when selecting root view in LocalUiController. #6741

commit sha: 71ca9ac16a40dcd3e109d8e080836918d685041d

push time in 24 minutes ago
pull request

hoisie pull request robolectric/robolectric

hoisie
hoisie

Check Window flags when selecting root view in LocalUiController. #6741

Check Window flags when selecting root view in LocalUiController. #6741

Activity icon
delete

hoisie in robolectric/robolectric delete branch piper_411665881

deleted time in 26 minutes ago
pull request

hoisie pull request robolectric/robolectric

hoisie
hoisie

Adding VcnManagementService to ShadowSystemServices for VCN-related tests.

Adding VcnManagementService to ShadowSystemServices for VCN-related tests.

Activity icon
delete

hoisie in robolectric/robolectric delete branch piper_409253263

deleted time in 27 minutes ago
push

hoisie push robolectric/robolectric

hoisie
hoisie

Adding VcnManagementService to ShadowSystemServices for VCN-related tests.

PiperOrigin-RevId: 409253263

hoisie
hoisie

Merge pull request #6881 from robolectric/piper_409253263

Adding VcnManagementService to ShadowSystemServices for VCN-related tests.

commit sha: 9d5fc129eba278dfbfe803532159d299391c827d

push time in 27 minutes ago
pull request

hoisie pull request robolectric/robolectric

hoisie
hoisie

Adding VcnManagementService to ShadowSystemServices for VCN-related tests.

Adding VcnManagementService to ShadowSystemServices for VCN-related tests.

Activity icon
delete

hoisie in robolectric/robolectric delete branch piper_411153919

deleted time in 28 minutes ago
push

hoisie push robolectric/robolectric

hoisie
hoisie

Clear InputMethodManager.sInstance for SDK > P

This fixes a minor case of test pollution when a test interacts with a TextView.

InputMethodManager.sInstance still gets populated in SDK > P, and it may contain a reference to a ViewRootImpl (mCurRootView), which causes an Activity to leak across tests.

PiperOrigin-RevId: 411153919

hoisie
hoisie

Merge pull request #6880 from robolectric/piper_411153919

Clear InputMethodManager.sInstance for SDK > P

commit sha: ce6256e6b0388f2465b085e10e747c737dc93e8d

push time in 28 minutes ago
pull request

hoisie pull request robolectric/robolectric

hoisie
hoisie

Clear InputMethodManager.sInstance for SDK > P

Clear InputMethodManager.sInstance for SDK > P

This fixes a minor case of test pollution when a test interacts with a TextView.

InputMethodManager.sInstance still gets populated in SDK > P, and it may contain a reference to a ViewRootImpl (mCurRootView), which causes an Activity to leak across tests.

push

hoisie push robolectric/robolectric

hoisie
hoisie

Check Window flags when selecting root view in LocalUiController. #6741

PiperOrigin-RevId: 399115715

commit sha: 9f99c089e41b0c9f025137092e61c03d8eb56a75

push time in 29 minutes ago
push

hoisie push robolectric/robolectric

hoisie
hoisie

Adding VcnManagementService to ShadowSystemServices for VCN-related tests.

PiperOrigin-RevId: 409253263

commit sha: cd51b608a77a4312c5e821f400d4a7c5fb6fd8e0

push time in 29 minutes ago
push

hoisie push robolectric/robolectric

hoisie
hoisie

Clear InputMethodManager.sInstance for SDK > P

This fixes a minor case of test pollution when a test interacts with a TextView.

InputMethodManager.sInstance still gets populated in SDK > P, and it may contain a reference to a ViewRootImpl (mCurRootView), which causes an Activity to leak across tests.

PiperOrigin-RevId: 411153919

commit sha: 5a1f02aaf37f425f8938ae41df5d7aa1b72bba9c

push time in 29 minutes ago
Nov
27
1 day ago
push

hoisie push robolectric/robolectric

hoisie
hoisie

Bump AGP to 7.1.0-beta04

Signed-off-by: utzcoz [email protected]

hoisie
hoisie

Only using AttributionSource for compile SDK 31 and above

We have tried to use Object to replace AttributionSource as type of second input parameter for noteProxyOpNoThrow(int, AttributeSource, String, bool) to make sure ShadowAppOpsManager can be loaded and used when compile SDK is less than 31. But changed method's siganture doesn't match origin method signature, and it will be used as shadow method. To fix this problem, this CL uses looseSignatures for ShadowAppOpsManager, and chagnes all input parameters' type to Object to meet looseSignatures' requirement.

Signed-off-by: utzcoz [email protected]

hoisie
hoisie

Simply looseSignatures checking

Signed-off-by: utzcoz [email protected]

hoisie
hoisie

Merge pull request #6884 from utzcoz/only-using-AttributionSource-for-compile-SDK-31-and-above

Only using AttributionSource for compile sdk 31 and above

commit sha: 2ca5469262f7c44406dc0bef73b1b0c11982b976

push time in 12 hours ago
Activity icon
issue

hoisie issue robolectric/robolectric

hoisie
hoisie

NoClassDefFoundError with Robolectric 4.7.2, sdk 30 and ContentProvider tests

Description

When running a test that uses Robolectric.setupContentProvider or Robolectric.buildContentProvider with Robolectric 4.7.x and compileSdk = 30 I get a java.lang.NoClassDefFoundError on class android/content/AttributionSource no matter which sdk I set in the @Config annotation.

The same does not happen with:

  • Robolectric < 4.7.x
  • compileSdk > 30

Steps to Reproduce

  • Set compileSdk = 30
  • Add Robolectric.setupContentProvider in a test
  • Use Robolectric 4.7.x
  • Run tests

Robolectric & Android Version

Robolectric: 4.7.2 Android compile SDK: 30

Link to a public git repo demonstrating the problem:

https://github.com/ninniuz/robolectric-content-provider-fail

Running tests with ./gradlew :app:testDebugUnitTest will fail with the following stacktrace

java.lang.NoClassDefFoundError: android/content/AttributionSource
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
	at java.base/java.lang.Class.getDeclaredMethod(Class.java:2473)
	at org.robolectric.internal.bytecode.ShadowWrangler.findShadowMethodDeclaredOnClass(ShadowWrangler.java:319)
	at org.robolectric.internal.bytecode.ShadowWrangler.findShadowMethod(ShadowWrangler.java:288)
	at org.robolectric.internal.bytecode.ShadowWrangler.pickShadowMethod(ShadowWrangler.java:265)
	at org.robolectric.internal.bytecode.ShadowWrangler.classInitializing(ShadowWrangler.java:160)
	at org.robolectric.internal.bytecode.RobolectricInternals.classInitializing(RobolectricInternals.java:21)
	at android.app.AppOpsManager.<clinit>(AppOpsManager.java)
	at android.app.SystemServiceRegistry$62.createService(SystemServiceRegistry.java:795)
	at android.app.SystemServiceRegistry$62.createService(SystemServiceRegistry.java:790)
	at android.app.SystemServiceRegistry$CachedServiceFetcher.getService(SystemServiceRegistry.java:1702)
	at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java:1382)
	at android.app.ContextImpl.getSystemService(ContextImpl.java:1918)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.robolectric.shadows.ShadowContextImpl$_ContextImpl_$$Reflector4.getSystemService(Unknown Source)
	at org.robolectric.shadows.ShadowContextImpl.getSystemService(ShadowContextImpl.java:81)
	at android.app.ContextImpl.getSystemService(ContextImpl.java)
	at android.content.ContentProvider.attachInfo(ContentProvider.java:2372)
	at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
	at org.robolectric.android.controller.ContentProviderController.create(ContentProviderController.java:79)
	at org.robolectric.android.controller.ContentProviderController.create(ContentProviderController.java:44)
	at org.robolectric.Robolectric.setupContentProvider(Robolectric.java:61)
	at it.ninniuz.android.robocontentprovider.FailingContentProviderTest.setUp(FailingContentProviderTest.kt:14)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:591)
	at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:274)
	at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:88)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassNotFoundException: android.content.AttributionSource
	at org.robolectric.internal.bytecode.SandboxClassLoader.getByteCode(SandboxClassLoader.java:189)
	at org.robolectric.internal.bytecode.SandboxClassLoader.maybeInstrumentClass(SandboxClassLoader.java:147)
	at org.robolectric.internal.bytecode.SandboxClassLoader.lambda$loadClass$0(SandboxClassLoader.java:133)
	at org.robolectric.util.PerfStatsCollector.measure(PerfStatsCollector.java:53)
	at org.robolectric.internal.bytecode.SandboxClassLoader.loadClass(SandboxClassLoader.java:133)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
	at java.base/java.lang.Class.getDeclaredMethod(Class.java:2473)
	at org.robolectric.internal.bytecode.ShadowWrangler.findShadowMethodDeclaredOnClass(ShadowWrangler.java:319)
	at org.robolectric.internal.bytecode.ShadowWrangler.findShadowMethod(ShadowWrangler.java:288)
	at org.robolectric.internal.bytecode.ShadowWrangler.pickShadowMethod(ShadowWrangler.java:265)
	at org.robolectric.internal.bytecode.ShadowWrangler.classInitializing(ShadowWrangler.java:160)
	at org.robolectric.internal.bytecode.RobolectricInternals.classInitializing(RobolectricInternals.java:21)
	at android.app.AppOpsManager.<clinit>(AppOpsManager.java)
	at android.app.SystemServiceRegistry$62.$$robo$$android_app_SystemServiceRegistry_62$createService(SystemServiceRegistry.java:795)
	at android.app.SystemServiceRegistry$62.createService(SystemServiceRegistry.java)
	at android.app.SystemServiceRegistry$62.createService(SystemServiceRegistry.java:790)
	at android.app.SystemServiceRegistry$CachedServiceFetcher.$$robo$$android_app_SystemServiceRegistry_CachedServiceFetcher$getService(SystemServiceRegistry.java:1702)
	at android.app.SystemServiceRegistry$CachedServiceFetcher.getService(SystemServiceRegistry.java)
	at android.app.SystemServiceRegistry.$$robo$$android_app_SystemServiceRegistry$getSystemService(SystemServiceRegistry.java:1382)
	at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java)
	at android.app.ContextImpl.$$robo$$android_app_ContextImpl$getSystemService(ContextImpl.java:1918)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.robolectric.shadows.ShadowContextImpl$_ContextImpl_$$Reflector4.getSystemService(Unknown Source)
	at org.robolectric.shadows.ShadowContextImpl.getSystemService(ShadowContextImpl.java:81)
	at android.app.ContextImpl.getSystemService(ContextImpl.java)
	at android.content.ContentProvider.$$robo$$android_content_ContentProvider$attachInfo(ContentProvider.java:2372)
	at android.content.ContentProvider.attachInfo(ContentProvider.java)
	at android.content.ContentProvider.$$robo$$android_content_ContentProvider$attachInfo(ContentProvider.java:2358)
	at android.content.ContentProvider.attachInfo(ContentProvider.java)
	at org.robolectric.android.controller.ContentProviderController.create(ContentProviderController.java:79)
	at org.robolectric.android.controller.ContentProviderController.create(ContentProviderController.java:44)
	at org.robolectric.Robolectric.setupContentProvider(Robolectric.java:61)
	at it.ninniuz.android.robocontentprovider.FailingContentProviderTest.setUp(FailingContentProviderTest.kt:14)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	... 11 more
Activity icon
issue

hoisie issue comment robolectric/robolectric

hoisie
hoisie

Only using AttributionSource for compile sdk 31 and above

Fixes https://github.com/robolectric/robolectric/issues/6883.

hoisie
hoisie

FWIW, I think there are better alternatives to looseSignatures . For instance, if shadows supported reflector's WithType, that method could be:

@Implementation(minSdk = Build.VERSION_CODES.S)
  protected int noteProxyOpNoThrow(
This conversation was marked as resolved by utzcoz
 Show conversation
      int op,
      @WithType("android.content.AttributionSource") Object attributionSource,
      String message,
      boolean ignoredSkipProxyOperation) { ... }
pull request

hoisie merge to robolectric/robolectric

hoisie
hoisie

Only using AttributionSource for compile sdk 31 and above

Fixes https://github.com/robolectric/robolectric/issues/6883.

hoisie
hoisie

Thanks for doing this! Only one minor thing -- squash the last 2 commits.

Activity icon
issue

hoisie issue comment robolectric/robolectric

hoisie
hoisie

Only using AttributionSource for compile sdk 31 and above

Fixes https://github.com/robolectric/robolectric/issues/6883.

hoisie
hoisie

Can you squash the last 2 commits so ShadowAppOpsManagerTest is not broken in a commit.

Nov
25
3 days ago
open pull request

hoisie wants to merge robolectric/robolectric

hoisie
hoisie

Only using AttributionSource for compile sdk 31 and above

Fixes https://github.com/robolectric/robolectric/issues/6883.

hoisie
hoisie

To do this it will need looseSignatures = true in the @Implements(...) annotation on top, and all of the args of this method need to be converted to Object.

Nov
24
4 days ago
open pull request

hoisie wants to merge robolectric/robolectric

hoisie
hoisie

Check Window flags when selecting root view in LocalUiController. #6741

Check Window flags when selecting root view in LocalUiController. #6741

hoisie
hoisie

Does that involve making integration_tests/androidx_test follow the sharedTest pattern? I think all of integration_tests/androidx_test should work as-is on emulators.

pull request

hoisie merge to robolectric/robolectric

hoisie
hoisie

Check Window flags when selecting root view in LocalUiController. #6741

Check Window flags when selecting root view in LocalUiController. #6741

open pull request

hoisie wants to merge robolectric/robolectric

hoisie
hoisie

Check Window flags when selecting root view in LocalUiController. #6741

Check Window flags when selecting root view in LocalUiController. #6741

hoisie
hoisie

Thanks for pointing this out, the tests are contained in the EspressoWithWindowLayersTest file in this PR.

pull request

hoisie merge to robolectric/robolectric

hoisie
hoisie

Check Window flags when selecting root view in LocalUiController. #6741

Check Window flags when selecting root view in LocalUiController. #6741

Nov
22
6 days ago
push

hoisie push robolectric/robolectric

hoisie
hoisie

Remove unused org.robolectric.annotation.Config imports

This should have been included in #6875

hoisie
hoisie

Merge pull request #6879 from hoisie/remove-unused-imports

Remove unused org.robolectric.annotation.Config imports

commit sha: bda68fdc374a10e01f5fdd7dc54f3d4c900b9c91

push time in 5 days ago
Activity icon
delete

hoisie in hoisie/robolectric delete branch remove-unused-imports

deleted time in 5 days ago
pull request

hoisie pull request robolectric/robolectric

hoisie
hoisie

Remove unused org.robolectric.annotation.Config imports

This should have been included in #6875

pull request

hoisie pull request robolectric/robolectric

hoisie
hoisie

Remove unused org.robolectric.annotation.Config imports

This should have been included in #6875

Previous