diff options
author | Jason Chiu <chiujason@google.com> | 2021-04-21 20:17:06 +0800 |
---|---|---|
committer | Jason Chiu <chiujason@google.com> | 2021-05-06 10:06:10 +0000 |
commit | a8d58e0bce7962c4526ca1d7b406f8f59d85bf05 (patch) | |
tree | 9421f45f9ce9e5ebecd7cbea85be39a609abb872 /shadows | |
parent | 90158a7b21fd245157e2ac35f823c653f610ff72 (diff) | |
download | robolectric-shadows-a8d58e0bce7962c4526ca1d7b406f8f59d85bf05.tar.gz |
Add a shadow for Compatibility
- Robolectric doesn't instrument interface default methods.
- To skip calling unintercepted System.logw in the default method of
Compatibility's interface.
Bug: 185743094
Test: make RunSettingsRoboTests -j
Change-Id: Ib6ebe33c859dc4370f6d951d847af003195cbb6d
Merged-In: Ib6ebe33c859dc4370f6d951d847af003195cbb6d
(cherry picked from commit c7fcad62fe12e2563ec1bc75be1598a181e37b60)
Diffstat (limited to 'shadows')
-rw-r--r-- | shadows/framework/src/main/java/org/robolectric/shadows/ShadowCompatibility.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowCompatibility.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowCompatibility.java new file mode 100644 index 000000000..00f218043 --- /dev/null +++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowCompatibility.java @@ -0,0 +1,17 @@ +package org.robolectric.shadows; + +import static android.os.Build.VERSION_CODES.S; + +import android.compat.Compatibility; + +import org.robolectric.annotation.Implementation; +import org.robolectric.annotation.Implements; + +@Implements(value = Compatibility.class, minSdk = S) +public class ShadowCompatibility { + // override to avoid calling to System.logW in the uninstrumented interface default method + @Implementation + public static boolean isChangeEnabled(long changeId) { + return true; + } +} |