Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for KITKAT SDK and associated dead code cleanup. #9020

Closed
wants to merge 0 commits into from

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Apr 22, 2024

Drop support for KITKAT SDK and associated dead code cleanup.

The android ecosystem is moving to support a minimum of minSdkVersion L,
and thus Robolectric is following suit and dropping support for running on
SDKs < L (21).

This change does the following:

  • removes SDK 19/Kitkat from the list of default SDKs. Tests that attempt to
    run explicitly on KitKat (e.g Config(sdk = 19) will now fail with
    'unsupported sdk' errors.
  • Remove now redundant methods and logic that was only relevant to SDKs < L,
    such as removing @implementation or unit tests with a maxSdk of < L.
  • Remove redundant minSdk = LOLLIPOP declarations from @implementation and
    @config references.

@brettchabot
Copy link
Contributor

sorry for distraction this isn't ready for review yet

@copybara-service copybara-service bot changed the title Drop support for KITKAT SDK. Drop support for KITKAT SDK and associated dead code cleanup. Apr 23, 2024
Copy link
Contributor

@MGaetan89 MGaetan89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple more comments related to your changes, then it looks good to me.

I've checkout the branch locally, and I noticed that there are still some declarations that may be removed?

  • many @Implementation(maxSdk = JELLY_BEAN
  • many places are still checking for API level >= LOLLIPOP
  • ShadowPackageParser.callParsePackage(Path) checks for RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.LOLLIPOP
  • ShadowLocaleData.setEnUsLocaleData(LocaleData) checks for getApiLevel() >= LOLLIPOP
  • ShadowLocationManager.getLegacyLocationRequests(String)'s comment still reference KitKat
  • ShadowLocationManager.RoboLocationRequest's comment still reference KitKat

Not sure if it's the scope of this PR, but AndroidManifest.getMinSdkVersion() and AndroidManifest.getTargetSdkVersion() still return 19 by default.
Since Robolectric min SDK version is still 19, this may be expected for now.

@@ -403,90 +339,48 @@ private static void throwsIfOutOfBounds(int len, int offset, int count) {
}

// nativeWriteBlob was introduced in lollipop, thus no need for a int nativePtr variant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still needed?

}

@Implementation(minSdk = LOLLIPOP)
@Implementation
protected static byte[] nativeCreateByteArray(long nativePtr) {
return NATIVE_BYTE_BUFFER_REGISTRY.getNativeObject(nativePtr).createByteArray();
}

// nativeReadBlob was introduced in lollipop, thus no need for a int nativePtr variant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@brettchabot
Copy link
Contributor

oops sorry auto submittal of this PR was in progress already. Good comments, will address in a followup

MGaetan89 added a commit to MGaetan89/robolectric that referenced this pull request May 1, 2024
MGaetan89 added a commit to MGaetan89/robolectric that referenced this pull request May 1, 2024
MGaetan89 added a commit to MGaetan89/robolectric that referenced this pull request May 3, 2024
MGaetan89 added a commit to MGaetan89/robolectric that referenced this pull request May 6, 2024
MGaetan89 added a commit to MGaetan89/robolectric that referenced this pull request May 19, 2024
MGaetan89 added a commit to MGaetan89/robolectric that referenced this pull request May 23, 2024
MGaetan89 added a commit to MGaetan89/robolectric that referenced this pull request May 24, 2024
utzcoz pushed a commit that referenced this pull request May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants