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

Do not use isFileEncryptedNativeOrEmulated() on Android 14 and later #8616

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

ebiggers
Copy link
Contributor

Starting in Android 14 (U), the hidden static method StorageManager#isFileEncryptedNativeOrEmulated() is deprecated and has no callers other than robolectric. Therefore, stop depending on it. This unblocks the removal of this obsolete code.

@utzcoz utzcoz requested a review from hoisie November 17, 2023 04:32
@utzcoz
Copy link
Member

utzcoz commented Nov 17, 2023

@ebiggers Thanks for your contribution. LGTM. I only have some nits questions that we can discuss:

  1. Can set maxSdk to SDK 34 as I found this API is still in AOSP main branch, and I think it was contained by Android 14. Is there any special reasons that you want to set maxSdk to SDK 33?
  2. Could you add some necessary comments in this shadow method to describe the reason?

@hoisie Could you want to test it with internal code base?

@ebiggers
Copy link
Contributor Author

Can set maxSdk to SDK 34 as I found this API is still in AOSP main branch, and I think it was contained by Android 14. Is there any special reasons that you want to set maxSdk to SDK 33?

It's as the commit message says: the Android framework stopped calling this method in Android 14 (API level 34). It was kept around only because of robolectric. If I understand correctly, that means that it was already unnecessary for robolectric to use it in API level 34. Hence, maxSdk = 33. Does that make sense, or do we need to wait another API level (which I'm worried would delay the removal of this obsolete code even further)?

@utzcoz
Copy link
Member

utzcoz commented Nov 17, 2023

@ebiggers I got it. sdk33 makes sense to me now. Sorry, I don't know the context of removing obsolete APIs, so I need @hoisie to approve this PR as I think he has more context of it.

Starting in Android 14 (U), the hidden static method
StorageManager#isFileEncryptedNativeOrEmulated() is deprecated and has
no callers other than robolectric.  Therefore, stop depending on it.
This unblocks the removal of this obsolete code.
@ebiggers
Copy link
Contributor Author

  1. Could you add some necessary comments in this shadow method to describe the reason?

Done now.

@hoisie
Copy link
Contributor

hoisie commented Nov 17, 2023

Sorry for the trouble, we will ensure this API does not get called

@utzcoz utzcoz merged commit b21c5fd into robolectric:master Nov 17, 2023
18 checks passed
@ebiggers ebiggers deleted the emulated-fbe-cleanup branch November 17, 2023 19:21
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

3 participants