Skip to content

Releases: robolectric/robolectric

Robolectric 4.7.2

20 Nov 20:43
Compare
Choose a tag to compare

This is a minor release that fixes a memory leak of Theme objects in binary resources for Android S (#6872). Thanks @calvarez-ov for the report and helping debug.

Robolectric 4.7.1

18 Nov 03:51
Compare
Choose a tag to compare

This is a minor release that fixes #6858. In that issue, certain Android classes could not be mocked by Mockito due to some changes to Robolectric instrumentation performed on interfaces.

Robolectric 4.7

12 Nov 04:11
Compare
Choose a tag to compare

Robolectric 4.7 adds support for Android S (API level 31).

Another big feature is support for Apple Silicon (Mac M1). Robolectric 4.7 now contains its own native implementation of the android.database.sqlite package. For Mac M1 machines, this SQLite mode is the default. For other OS's and architecture, use @SQLiteMode(NATIVE) to enable it. This new mode is currently only available for Mac and Linux. Native SQLite should be significantly faster, around 50-90% faster for SQLite operations, than the LEGACY SQLite mode. There were also several other performance improvements made for SQLite operations -- #6687, #6690, and #6711 (thanks @al-broco!).

The support v4 shadows are also deprecated at this release, and they will be removed at Robolectric 4.8.

Robolectric 4.7 also supports JDK 17.

What's Changed

  • Clear cookies after test finished for CookieManagerTest by @utzcoz in #6581
  • Only using ApplicationExitInfo for compile sdk 30 and above by @utzcoz in #6590
  • Rebase PR 4064 - Fix NPE during saving state of WebView by @utzcoz in #6597
  • Converting the String version of directlyOn(...) to @direct with reflector(...). by @hoisie in #6598
  • Add ITelephonyRegistry to ShadowServiceManager #6605
  • Implement new #startActivity methods for ShadowCrossProfileApps. #6601
  • Add ShadowMediaExtractor. #6592
  • Converting onVsync calls from ReflectionHelpers to use @direct with reflector(...) instead. #6602
  • Update ShadowDisplayEventReceiver to support S #6609
  • Converting the proxy version of directlyOn(...) to @direct with reflector(...). by @hoisie in #6610
  • Fix Robolectric camera shadows to work with newer SDK versions. #6611
  • Converting recycleUnchecked calls to use @direct with reflector(...) in place of ReflectionHelpers. #6603
  • Cleaning up unnecessary @direct annotations in DirectActivityReflector. #6616
  • Fixing the incorrect method signature in AssetManagerReflector that breaks GitHub CI. #6612
  • No longer automatically log everything in ShadowLog if stream is specified #6617
  • Support IntBuffer with copyPixelsFromBuffer #6613
  • Suppress missing /system/etc/fonts.xml log noise for SDK 27 #6618
  • Add perf stats for reflector class definition #6624
  • Use Object to replace GnssAntennaInfo.Listener at ShadowLocationManager by @utzcoz in #6623
  • Trimming the localrepository string. by @Squadella in #6653
  • Merging the the separate Reflector interfaces for Message into one main interface. #6619
  • Remove OldClassInstrumentor #6621
  • Remove unnecessary ShadowLegacyMessage.isInUse #6626
  • Converting directlyOn(...) to @direct with reflector(...) in ShadowWindow and ShadowPhoneWindow. #6625
  • Intercept calls to methods in {@link Socket} not present in the OpenJDK. #6622
  • Use bulk operations in copyPixels{to,from}Buffer #6628
  • Improve reflector caching using a regular HashMap #6629
  • Add shadow method ShadowLauncherApps#getShortcutConfigActivityList. #6631
  • Add OnPermissionChangedListener implementation to ShadowPackageManager. #6627
  • Update minSdkVersion to 14 in some integration_test manifests #6630
  • Merge InvokeDynamicClassInstrumentor into ClassInstrumentor #6632
  • Add a shadow method for PackageManager#getText which gets a String associated with package name and resource id. #6634
  • Pass through openInputStream calls for SCHEME_ANDROID_RESOURCE #6636
  • Names thread used by ShadowFileObserver to match behavior of FileObserver. #6640
  • Migrate from AnnotationValue#toString to auto-common's AnnotationValues.toString. #6638
  • Fix fidelity issue with Cursor.getBlob on a String column #6641
  • Remove InvokeDynamic perf stats #6644
  • Fix SQLiteDatabaseTest foreign key test to match Android behavior #6643
  • Add cardId support for ShadowEuiccManager. #6642
  • Add OnUidImportanceListener implementation to ShadowActivityManager and SCREEN_ON/SCREEN_OFF broadcasts to ShadowPowerManager. #6639
  • Instrument default interface methods #6645
  • Support Object array and Iterable as return type for single parameter by @utzcoz in #6696
  • Rebase PR 6265: Bounds check the correct variable. by @utzcoz in #6706
  • Remove allocation in ShadowCursorWindow.Data init by @al-broco in #6711
  • internal #6654
  • Add perfstats for ShadowSQLiteConnection #6659
  • Add support for startWatchingMode() with flags. #6661
  • Make isOpActive() public, so it can be used in tests below Android R. #6662
  • Add a sqlite test using LIKE ? ESCAPE ? #6666
  • Throw an exception if a query is performed using SQLiteDatabase.execSQL #6672
  • Add isAutoRevokeWhitelisted implementation to ShadowPackageManager. #6673
  • Add support for setting smart replies on ShadowRanking object, so getSmartRanking method can be used in tests. #6667
  • Use full class name in the SQLiteConnection shadow #6679
  • Improve NFC testability: #6587
  • Add experimental sqlite shadows derived from AOSP SQLite #6670
  • Exclude built-in config from being reloaded in Configuration registry #6680
  • Make legacy ShadowSQLiteConnection implementation methods protected #6681
  • Newly added shadow class for MediaStore is exposed to open source rebolectric library #6665
  • Update ShadowAppWidgetManager to better handle RemoteViews with multiple layouts #6677
  • Add shadow functionality for removing bonds(systemAPi) #6682
  • Add support for NetworkInfo.extraInfo to ShadowNetworkInfo #6683
  • Update default SQLite synchronous and journal modes #6687
  • Add a null check to ShadowCursorWindow.put{Blob,String} #6675
  • Add parameterized test name method to the test runner #6686
  • Add ability to uninstall app widgets to ShadowAppWidgetManager.java #6693
  • Add ShadowInetAddressUtil class #6694
  • Add @InlineMe to deprecated ShadowLooper APIs. #6689
  • Add @InlineMe to deprecated, inlineable APIs. #6455
  • Add setAnchor to ShadowAccessibilityWindowInfo #6699
  • Fix an ArrayIndexOutOfBoundsException in ByteBucketArray #6700
  • Add missing implementation for __android_log_assert #6701
  • Remove mocking from FragmentControllerTest #6703
  • Add API to retrieve Intent used to start SpeechRecognizer #6692
  • Update default SQLite synchronous mode when WAL is enabled #6690
  • Fix formatting in ShadowSQLiteConnectionsTest #6712
  • Add a SQLite mode that enables the new native Android SQLite shadows #6709
  • Use offset from BufferInfo instead of ByteBuffer for ShadowMediaMuxer#writeSampleData by @utzcoz in https://github.com/robolectric...
Read more

Robolectric 4.7 Alpha 2

08 Nov 05:50
Compare
Choose a tag to compare
Pre-release

*NOTE: Robolectric 4.7-alpha-2 is a outdated preview release; please use 4.7 or later instead.

Robolectric 4.7 Alpha 1

05 Nov 01:20
Compare
Choose a tag to compare
Pre-release

NOTE: Robolectric 4.7-alpha-1 is a outdated preview release; please use 4.7 or later instead.

Robolectric 4.6.1

04 Jul 21:07
Compare
Choose a tag to compare

This is a minor release that fixes #6589, in which ShadowActivityManager contained a reference to android.app.ApplicationExitInfo, introduced in SDK 30, in public method. This caused shadowOf to fail if the target SDK was < 30. Thanks to @utzcoz for the fix and @jankowskib for reporting the issue.

Robolectric 4.6

02 Jul 06:28
Compare
Choose a tag to compare

Robolectric 4.6

The highlights of this release are:

  • Uses preinstrumented jars by default, significantly decreasing startup time.
  • Massive fidelity improvements for Bitmap and BitmapFactory.
  • Tons of bug fixes and fidelity improvements.

What's Changed

  • Add ShadowMagnificationController for N+ in #6140
  • Add ShadowSoftKeyboardController for N+ in #6138
  • Move debug class dump logic from ClassInstrumentor to SandboxClassLoader in #6162
  • Tweak ShadowTextToSpeech OnInitListener API in #6165
  • Lay the groundwork to use preinstrumented android-all jars in Robolectric. in #6163
  • Platform compatibility enhancements in #6166
  • Upgrade google-java-format to 1.9 by @utzcoz in #6172
  • Added gradle dependency version checker to the build by @alsutton in #6173
  • Update android support libraries to v28.0.0 by @alsutton in #6174
  • Synchronize Truth version being used to be v1.1.2 by @alsutton in #6175
  • ShadowInCallService and ShadowPhone offer a method addCall() which adds a call in #6160
  • Deprecate RoboExecutorService. in #6170
  • Revert some recently added native method logic in ClassInstrumentor in #6168
  • Remove debug print statements from AndroidInterceptors in #6177
  • Consistently use reflection for accessing the "DURATIONS" array. in #6180
  • Deprecate TextLayoutMode. in #6181
  • Remove use of deprecated and redundant TextLayoutMode.REALISTIC,as its now the default behavior. in #6182
  • Fix deleting temp directories in #6187
  • Call ShadowBackupManager's getAvailableRestoreToken instead of framework's one as we already have implementation of that method in the shadow under the method: getPackageRestoreToken() in #6190
  • Add Support for startAsyncSection and endAsyncSection to ShadowTrace in #6184
  • Move AndroidConfigurer and AndroidInterceptors to sandbox project in #6183
  • Add visibility to ShadowTrace.AsyncTraceSection in #6192
  • Disable instrumenting AndroidX classes by default in #6188
  • Migrate CI checks from CircleCI to GitHub actions by @LitterSun in #6178
  • Fix typo and run tests on SDK 30 by @hoisie in #6196
  • Remove publish_test_results job by @hoisie in #6198
  • Fix some errorprone warnings by @utzcoz in #6204
  • Create a new ShadowFileObserver that implements (some of) FileObserver functionality for Robolectric in #6200
  • Make ShadowPackageManager.getPackageArchiveInfo extendable in #6202
  • Add a method to StreamConfigurationMapBuilder shadow class to support cameraX testing. in #6199
  • platform support in #6206
  • Shadow tone generator that implements a static state tracking mechanism for all played tones in #6208
  • update robolectric build.gradles to use latest androidx.test artifacts in #6207
  • Update ShadowBugreportManager with additional functionality: in #6213
  • Move overriding PolicyManager.makeNewWindow to ShadowPolicyManager in #6218
  • Add opt-in lazy loading of application+instrumentation in Robolectric in #6191
  • [LazyLoad] Explicitly make method config default to class config, and class config default to package config in #6214
  • Check framework jar path before calling AssetManager from ShadowResources in #6216
  • Add check to AndroidTestEnvironment.installAndCreateApplication to ensure that it is only called from the main thread in #6217
  • Fix syntax warning of build.gradle by @utzcoz in #6220
  • Restore JarInstrumentor in #6212
  • Clean up test code under shadows by @utzcoz in #6223
  • make ShadowContentResolver lazy load friendly in #6222
  • Make ShadowApplication.getInstance call RE.getApplication. in #6221
  • Switch to using preinstrumented android-all jars by default in #6227
  • Fix MavenDependencyResolverTest in restricted test environments in #6228
  • Move wakelock and dialog recording storage from ShadowApplication to their respective shadows. in #6229
  • Add setCounter functionality to ShadowTrace in #6226
  • Remove maxSdk=R config from test code in #6219
  • Ensure Bitmap.Config is set on the output after Bitmap.createBitmap in #6231
  • Robolectric ShadowCall: Adds hasSentRttRequest and hasRespondedToRttRequest functionality to the shadow. in #6232
  • Ensure Bitmap.Config is set on the output after Bitmap.createScaledBitmap in #6233
  • Slightly improve the fidelity of comparing scaled bitmaps in #6239
  • Add implementation for packageManager.getPermissionFlags and packageManager.updatePermissionFlags in #6235
  • Always return the result of BitmapFactory.finishDecode for SDK < 19 in #6241
  • Make RuntimeEnvironment.getActivityThread and ShadowDisplayManagerGlobal lazy load friendly in #6236
  • Move call to getApplicationContext() outside the runnable so that we don't try to load the application from a separate thread when lazy loading in #6244
  • Explicitly instantiate the application for the stub tests where we will assert on app state in #6243
  • Add support for setting-getting RatingType in ShadowMediaController in #6245
  • Create a shadow implementation of NotificationListenerService. in #6250
  • Add showSession to ShadowVoiceInteractionService in #6247
  • Init color array when decode for bitmap by @utzcoz in #6147
  • Init color array for decode file descriptor by @utzcoz in #6272
  • Migrate to preferred BugCheckerRefactoringTestHelper.newInstance overload in #6253
  • Propagate Bitmap.Options.isMutable to bitmap in #6249
  • Make dataChangeCount part of BackupManagerServiceState. in #6266
  • Upgrade ErrorProne and fix ErrorProne related build errors in #6267
  • Update FrameMetricsBuilder to explicitly set TOTAL_DURATION in #6257
  • Execute google-java-format-diff.py directly on CI machines in #6268
  • Clear ShadowBitmap description when eraseColor is called in #6254
  • Make Activity.getCallingPackage() and Activity.getCallingActivity() consistent. in #6256
  • Add basic implementation of Canvas.drawRect(Rect, Paint) in #6263
  • Improve the fidelity Canvas.drawBitmap(Bitmap, float, float, Paint) in #6261
  • Improve fidelity of ImageView.draw(Canvas) in #6264
  • Fix ShadowBitmapFactoryTest in non-Gradle environments by @hoisie in #6276
  • Keep ubuntu to ubuntu-18.04 on CI by @utzcoz in #6279
  • add test around ShadowDisplayManagerGlobal.getInstance in #6270
  • Use bulk api to set pixels by @utzcoz in #6299
  • Set lastAbandonedAudioFocusListener for AudioManager.abandonAudioFocusRequest and set OnAudioFocusChangeListener in AudioFocusR...
Read more

Robolectric 4.6 Alpha 2

11 Jun 04:23
Compare
Choose a tag to compare
Pre-release

NOTE: Robolectric 4.6-alpha-2 is a outdated preview release; please use 4.6 or later instead.

Robolectric 4.6 Alpha 1

09 May 00:09
Compare
Choose a tag to compare
Pre-release

NOTE: Robolectric 4.6-alpha-1 is a outdated preview release; please use 4.6 or later instead.

Robolectric 4.5.1

02 Feb 00:42
Compare
Choose a tag to compare

This is a minor release that fixes a regression in 4.5 and removes some superfluous print statements. See #6187 and #6177 respectively for more details.