Skip to content

Robolectric 4.8

Compare
Choose a tag to compare
@JuliaSullivanGoogle JuliaSullivanGoogle released this 28 Apr 17:37
· 1507 commits to master since this release

Robolectric 4.8 adds support for Android S V2 (API level 32). It also contains many bug fixes and API enhancements.

What's Changed

  • Turn off Gradle's fs watching during tests by @hoisie in #6849
  • Remove unused resources.arsc file by @hoisie in #6855
  • Fix name for macOS tasks to rename and upload binary files by @utzcoz in #6856
  • Shadow Build.VERSION#MEDIA_PERFORMANCE_CLASS in #6836
  • Support overriding Icon loading executor from Icon#loadDrawableAsync. in #6828
  • Update Android code search link to the public version in #6850
  • Remove unnecessary TimePickerDialog constructor shadow in #6838
  • Remove inaccessible Google issue tracker links in #6854
  • Use Activity's member Instrumentation in ActivityController in #6860
  • Fix UnsupportedOperationException if a leaked Activity.recreate is called in #6862
  • Add ActivityController.close that transitions Activity to destroyed state in #6864
  • Fix SDK version check for onPageFinished() call. It should be available for all SDK versions instead. See https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String) in #6865
  • Limit instrumentation on interfaces in #6866
  • Bump to version 3 of preinstrumented jars by @hoisie in #6867
  • Migrate ShadowAccessibilityNodeInfo to reflector in #6868
  • Add perf stat for applying styles in binary resources in #6869
  • Refine methods: getYear(), getMonthOfYear(), getDayOfMonth() and getOnDateSetListenerCallback(). in #6841
  • Add onConnectionEvent() to ShadowInCallService. in #6870
  • Fix theme native object collection in Android S in #6873
  • Use a self-hosted Mac M1 runner for the build_nativeruntime task by @hoisie in #6871
  • Use 'processResources' task instead of 'jar' task for nativeruntime by @hoisie in #6874
  • Remove unused Exception from test methods for dependency-on-stubs by @utzcoz in #6876
  • Add solution log for unhandled PNG file by @utzcoz in #6829
  • Remove instrumentedPackages workaround by @hoisie in #6875
  • Remove unused org.robolectric.annotation.Config imports by @hoisie in #6879
  • Only using AttributionSource for compile sdk 31 and above by @utzcoz in #6884
  • Clear InputMethodManager.sInstance for SDK > P in #6880
  • Adding VcnManagementService to ShadowSystemServices for VCN-related tests. in #6881
  • Check Window flags when selecting root view in LocalUiController. #6741 in #6745
  • Cleanup of AndroidManifest Activity references. in #6878
  • Fix broken GitHub CI when running tests by @hoisie in #6893
  • Fix some lint errors in Target29CompatibilityTest by @hoisie in #6891
  • Avoid re-running ICU ./configure if Makefile exists by @hoisie in #6889
  • Remove redundant SKIP_ICU_BUILD environment variable by @hoisie in #6890
  • Remove unnecessary DatePickerDialog constructor shadow in #6897
  • Add matrix computation support to ShadowRenderNode implementations in #6775
  • Add support for building Robolectric's nativeruntime with gcc/g++ in #6900
  • Switch to Ninja for building the native runtime in #6904
  • Close android.database.Cursor objects in tests in #6905
  • Fix remaining CloseGuard warnings in Robolectric tests in #6906
    1. Adds ShadowVibrator#addSupportedPrimitives to enable in #6907
  • Use real Android code for ContentProviderClient.release in #6908
  • Update platformStrError to work in Windows in #6910
  • Add setIsUniqueDeviceAttestationSupported and isUniqueDeviceAttestationSupported support to ShadowDevicePolicyManager in #6909
  • Add custom JNI_INCLUDE_DIRS for Windows only by @utzcoz in #6914
  • Use runner.arch when calculating ICU cache keys by @hoisie in #6894
  • Add test ShadowPackageManagerTest#packageInstallerAndGetPackageInfo by @utzcoz in #6898
  • fix for NPE when ShadowLegacyAssetManager is used by @kenyee in #6918
  • Remove specific clang/clang++ env for build_native_runtime.yml by @utzcoz in #6924
  • Support nativeruntime building for Windows by @utzcoz in #6801
  • Handle more values in ShadowSystemProperties.getBoolean in #6915
  • Update the windowConfiguration bounds when updating the display metrics in #6922
  • Add shadows for UwbManager and RangingSession. in #6926
  • Make two small improvements to ShadowMatrixTest in #6929
  • Remove ServiceFinder in #6931
  • Bump AGP to 7.1.0-beta05 by @utzcoz in #6927
  • Bump SDK to 31 for integration_tests if possible by @utzcoz in #6928
  • Remove explicit binary mode declaration for affected test modules by @utzcoz in #6943
  • Remove specific clang/clang++ env for tests.yml by @utzcoz in #6945
  • Creating ShadowVcnManager for vcn-related testing. in #6932
  • Add READ_PHONE_STATE permission check to ShadowTelephonyManager.getVoiceNetworkType in #6935
  • Update ShadowAppOpsManager to allow for multiple invocations of startWatching for a single listener. in #6936
  • Add shadows for ImageReader and SurfaceTexture. Invoke updates from Surface to linked clients. in #6937
  • Fix typo in #6938
  • Add CI job to build nativeruntime for Windows by @utzcoz in #6923
  • Intercept native Font states at Java level for Android S by @utzcoz in #6954
  • Add regression test for mockito spy by @utzcoz in #6942
  • Remove unused Exception from test methods for XmlResourceParserImplTest by @utzcoz in #6946
  • Merge defaultConfig for ctesque build.gradle by @utzcoz in #6949
  • Use guavaJREVersion from gradle.properties for some modules by @utzcoz in #6952
  • Use version from gradle.properties for shadows:playservices by @utzcoz in #6951
  • Call onSaveInstanceState after onStop from API P by @utzcoz in #6940
  • Add perf stats for loading plugins and loading the native runtime in #6947
  • Add two S-specific test cases for ShadowDevicePolicyManager in #6956
  • Fix class description. in #6957
  • Support NotificationManager.addAutomaticZenRule that could add AutomaticZenRule without owner,but has configurationActivity. in #6958
  • Add plumbing for source resource id getter in #6959
  • Add ShadowConnection that records the last event sent through Connection.sendConnectionEvent. in #6964
  • Bump AGP to 7.1.0-rc01 by @utzcoz in #6955
  • Remove unused exception from tests for SQLiteLibraryLoaderTest by @utzcoz in #6968
  • Clean up androidx_test by @utzcoz in #6969
  • set createdFromBytes also when using decodeByteArray with options by @edwinvanderham in #6972
  • Move ShadowWranglerIntegrationTest.ShadowFooParent to sandbox testing package in #6973
  • Use invokespecial when invoking shadow constructors in #6979
  • Add a ShadowCloseGuard and CloseGuardRule for verifying all CloseGuards have been closed in #6980
  • Trigger listeners for ServiceState in TelephonyManager.listen in #6981
  • Tweak precondition check in NotificationManager.updateAutomaticZenRule by @hoisie in #7003
  • Makes sparse array implement the set() method for all api levels by adding the byte code for it in the ClassInstrumentor. by @JuliaSullivanGoogle in #6963
  • Intercept the getInt$() and setInt$(int) functions on FileDescriptor by @hoisie in #7002
  • Simplify SparseArray.set instrumentation by @hoisie in #7004
  • Retain outer class assignment in the constructor in #6984
  • Add FileDescriptor transform to ShadowMediaMetadataRetriever. in #6985
  • Add shadow method for WifiManager.isStaApConcurrencySupported in #6986
  • Update ShadowVcnManager to support VcnConfig setting and subscription group (ParcelUuid) setting. in #6987
  • Fix signature for ShadowPausedMessageQueue 'enqueueMessage' reflector in #6988
  • Allows calling clearVcnConfig() when the vcnConfig being cleared is not set. in #6992
  • Enable realistic View matrix calculations by default in #6996
  • Add unregisterStats(path) method in ShadowStatsFs in #7001
  • Bump icu4j to 70.1 by @utzcoz in #6993
  • Bump apiCompatVersion to 4.7 by @utzcoz in #6994
  • Bump AGP to 7.1.0 by @utzcoz in #7007
  • Added JDK prerequisites in README, for contributors to build project. by @ZSmallX in #7009
  • Remove deprecated supportv4 shadows by @utzcoz in #7031
  • Change ShadowAppWidgetManager to use AppWidgetHostView instead of FrameLayout to support ListView / remote collections testing. in #7008
  • Reformat AndroidInterceptors in #7010
  • Add shadow for SurfaceControl#nativeCreate in #7012
  • Changes ShadowActivity to use reflector instead of using direct reflection to call certain methods by @JuliaSullivanGoogle in #7040
  • Add a test case for spying on a shadowed object in #7013
  • Trigger an asynchronous broadcast of scan results in WifiManager.startScan in #7015
    1. Stores VibrationAttributes in ShadowVibrator and exposes a getter getVibrationAttributesFromLastVibration to get VibrationAttributes for the last vibration. in #7018
  • Make loading the native runtime extensible in #7021
  • Return null for external files directory if external storage is unavailable in #7022
  • Fix touch event dispatch to not go to out of bounds non touch modal windows in #7025
  • Add getShareTitle() and getShareDescription() to ShadowBugreportManager, set in #7024
  • Add shadow for CompanionDeviceManager in #7030
  • Add support for new S ProviderProperties APIs. in #7029
  • Make deprecation comment in RuntimeEnvironment.application refer to RuntimeEnvironment.getApplication() instead of androidx.test.core.app.ApplicationProvider#getApplicationContext in #7033
  • Added register/unregister callback shadows for CameraManager. in #7035
  • Return Number from ShadowSurfaceControl#nativeCreate to support sdk 18/19 in #7027
  • Fix some lint warnings in #7016
  • Change ShadowBluetoothAdapter to cache getRemoteDevice instances. In android, the state for a given device (uniquely identified by its address) is global. When you have two instances of BluetoothDevice and mutate one, the other will reflect it, even though they are not the same java object. in #7038
  • Add support for touch mode in #7011
  • Return Number from ShadowSurfaceControl#nativeCreate to support sdk 18/19 by @JuliaSullivanGoogle in #7042
  • Added more prerequisites for robolectic building and testing in README by @ZSmallX in #7079
  • Added junit dependency in README. by @ZSmallX in #7085
  • Migrate AndroidJUnit4 to ext version for ctesque by @utzcoz in #7037
  • Add a task to fetch nativeruntime artifacts from a GitHub CI run by @hoisie in #6895
  • Add integration tests for mokito-kotlin's regression by @ZSmallX in #7086
  • Remove ShadowsPlugin from supportv4/build.gradle by @hoisie in #7092
  • Bump massive dependencies for androidx and androidx_test by @utzcoz in #7093
  • Optimizes getFd and close behaviors for ParcelFileDescriptor by @ZSmallX in #7101
  • Add support for Build.setSerial in ShadowBuild in #7043
  • Add DragEventBuilder helper in #7044
  • Flesh out support for GNSS APIs. in #7039
  • Reduce visibility of ShadowActivity.isFinishing in #7047
  • create ShadowActivity#simulateGetDirectActions for testing assistant requesting DirectAction from an Activity in #7045
  • Add shadow implementations for source resource id getters in #7046
  • Adds a Robolectric property to allow users to build Robolectric without the preinstrumented jars to allow for better testing of new features. in #7000
  • Adds shadow for DisplayHashManager. in #7050
  • Remove enableMatrix=true properties, default is now true in #7051
  • Add interceptor for Reference.refersTo. in #7052
  • Speed up ShadowRcsUceAdapterSTest. in #7056
  • Run google-java-format on ShadowMatrixTest in #7058
  • Make ShadowPackageManager generatePackageInfo extensible. in #7059
  • Removing the onStatusChanged() invoke when VcnStatusCallback is registered. in #7061
  • Sets github's test gradle usePreinstrumentedJars value to false by default. in #7062
  • Add ShadowWindowManagerGlobal#getLastDragClipData method in #7019
  • Update SQLiteConnection shadows to support Android T changes in #7063
  • Update ShadowActivityThread for T in #7064
  • Add T-specific logic for ActivityController.windowFocusChanged in #7065
  • Prepare to adjust for changed BluetoothAdapter.setScanMode signature. in #7066
  • Return the original method's test name in #7067
  • Support new API registerReceiver(BroadcastReceiver receiver, IntentFilter filter, int flags) after O in #7068
  • Add shadows for Settings.Secure.getIntForUser. in #7071
  • ShadowImageReaderTest: Move Config setting to class level since its common for all tests. in #7072
  • Pass through openInputStream calls if a provider for the authority is registered. in #7073
  • Fix for potential race condition in ShadowMediaCodec async mode. in #7074
  • Enable WebView.createWebMessageChannel shadow. in #7070
  • Bump the runtime SDK of shadows:httpclient tests to S in #7075
  • Add new VibrationAttributesBuilder in #7077
  • Add support for new constructor in StorageVolumeBuilder in #7078
  • Create new RangingSessionBuilder in #7076
  • Mimic actual MediaCodec creation logic. in #7082
  • Add unregisterSessionCallback implementation in the PackageInstaller. in #7084
  • Make the ShadowPausedSystemClock thread safe in #7083
  • Add support for new field in DisplayManager BrightnessConfiguration APIs in #7088
  • Make TestParcelable* classes public in #7087
  • Add getThermalStatusListeners() to return registered listener for shadow power manager. in #7091
  • Add USB signaling API override support to ShadowDevicePolicyManager in #7098
  • Remove robolectric.rendernode.enableMatrix flag in #7099
  • Update check_java_formatting action to use Google Java Format 1.15 by @hoisie in #7113
  • Open LocationRequest methods up down to Kitkat when they were first added. in #6761
  • Add getTotalSize, setTotalSize, getBytesSoFar and setBytesSoFar for DownloadManager.Request in ShadowDownloadManager. in #7104
  • Add nCreateTextureLayer to ShadowHardwareRenderer in #7106
  • Add some concurrency tests for ShadowPausedSystemClockTest in #7090
  • Add a test for ActivityNotFoundExceptions in Espresso intents by @hoisie in #7115
  • Add support for getInstallSourceInfo in ShadowPackageManager. The behaviour is independent of existing getInstallerPackage support. in #7103
  • Apply style/lint fixes to mockito-kotlin test code by @hoisie in #7116
  • Use ktfmt to format kotlin code by @utzcoz in #7125
  • Skip ShadowSQLiteConnection test on M1 by @utzcoz in #7054
  • Update minimum requirement toolchain version by @utzcoz in #7131
  • Add implementation for shadows of AccessibilityManagers StateChangeListener by @MichaelEvans in #7094
  • Fix format problem of ShadowAccessibilityManager by @utzcoz in #7137
  • Have ShadowApplicationPackageManager#getPackageArchiveInfo call super() when apiLevel >= T in #7118
  • Fix setTouchExplorationEnabled() not calling onTouchExplorationStateChanged() on the TouchExplorationStateChangeListeners in #7120
  • Adding an overload method to registerReceiver to include flags when registering a receiver with a broadcast permission in #7121
  • Fix bitmap mutable, premutliplied, and alpha properties. in #7122
  • Add @implementation where missing in Robolectric's shadows in #7119
  • Run google-java-format on ShadowTime in #7133
  • Add support for ColorSpace to ShadowBitmap in #7134
  • Add support for Android S V2 in Robolectric by @hoisie in #7132
  • Add a "default" list of system features to ShadowPackageManager in #7135
  • Update ShadowBluetoothDevice to throw an exception if the BLUETOOTH_CONNECT permission isn't granted. in #7117
  • Don't decode image bytes as utf-8 encoded string in #7139
  • Improve support for low-power idle modes in ShaddowAlarmManager in #7138
  • Add support for shadowing TaskInfo#isVisible. in #7142
  • Migrate from strongly discouraged @Test(expected = ...) to assertThrows(...). in #7143
  • Adding ShadowContentCaptureManager to Q+ in #7144
  • Add support for save/restore in ShadowCanvas in #7146
  • Fix TouchExplorationStateChangeListener trigger logic for SDK < O in #7147
  • Migrate ShadowTaskInfo to a builder in #7149
  • Bump preinstrumented jars to version 4 by @hoisie in #7156
  • Re-enable nativeruntime building for Windows by @hoisie in #7157
  • Disable shadowOf generation for DisplayHashManager by @hoisie in #7159
  • Enable integration_tests:sparsearray tests by @utzcoz in #7006
  • Enable CI when PRs are made to the 'google' branch by @hoisie in #7164
  • Add triggerOnReadyForSpeech() to ShadowSpeechRecognizer. in #7163
  • Bump gradle-versions-plugin to 0.42.0 by @utzcoz in #6970
  • Clean up tests.yml by @utzcoz in #7161
  • Block UiController#loopMainThreadUntilIdle on registered idling resources being idle. in #7148
  • Return non-zero pointer from nCreateTextureLayer in #7166
  • Correctly register all idling resources in #7167
  • Update README.md to declare Robolectric supports SDK 32 by @utzcoz in #7169
  • Indicate windows are visible by default (flag enabled) in #7179
  • Add documentation to run tests on Emulator by @utzcoz in #7162
  • Restore accidentally deleted link to building Robolectric in #7183
  • Ensure getNetworkCountryIso & getSimCountryIso return lowercase only, to match the actual APIs. in #7184
  • Update RoboLocationRequest equals() and toString(). in #7186
  • Centralize the Injector logic to load the native runtime in #7198
  • Fixed PFD testGetFd_canRead test failed on macOS. by @ZSmallX in #7202
  • Optimize CI a bit by @Goooler in #7195
  • Clean up ctesque by @utzcoz in #7145
  • Clean up ShadowDefaultRequestDirectorTest.java by @utzcoz in #7208
  • Bump Gradle to 7.4.2 by @utzcoz in #7207
  • Remove unused Exception from example in README.md by @utzcoz in #7206
  • Error prone and google format fix annotation module by @hellosagar in #7154
  • Update CI to use JDK 11.0.14 by @hoisie in #7213
  • Support Canvas#drawRect with RectF by @Akshay2131 in #7210
  • Remove maxSdk restrition for ShadowBiometricManager#canAuthenticate implementation by @utzcoz in #7211
  • Switch to run tests on Emulator with SDK 29,32 by @utzcoz in #7170
  • Support JDK 1.8 in ShadowWrangler invokespecial logic in #7219
  • build: bump errorprone plugin version from 1.3.0 to 2.0.2 by @hellosagar in #7218
  • Bring integration_tests to API 32 by @utzcoz in #7217
  • Add method expectLogMessagePatternWithThrowableMatcher to ExpectedLogMessagesRule so that users can check for a Throwable, as well as a log message pattern. in #7221
  • Add javadoc for DefaultShadowPicker by @hoisie in #7222
  • Add SdkSuppress to some tests in ThemeTest and MotionEventTest by @hoisie in #7227
  • Removed targetSdk from AndroidManifest.xml by @Umesh-01 in #7232
  • Add getCurrentSyncs() in ShadowContentResolver by @Akshay2131 in #7225
  • Make deep copy of mPointerProperties for NativeInput#copyFrom by @utzcoz in #7251
  • Remove empty ShadowTextPaint by @utzcoz in #7250
  • Migrate compileSdkVersion to compileSdk by @Akshay2131 in #7253
  • Ensure ShadowActivity can work with project targetSdk less than S by @utzcoz in #7254

New Contributors

Full Changelog: robolectric-4.7.3...robolectric-4.8

Use Robolectric:

testCompile "org.robolectric:robolectric:4.8"