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

RNMT-4515 Refactor the fix for Android 11 #8

Closed
wants to merge 2 commits into from

Conversation

luissilvaos
Copy link

Description

This PR refactors the hotfix for Android 11 that was introduced in #7

These new changes will ensure that the hotfix is not applied for every device running Android 11, but only to the specific devices that are facing the reported issue (eg.: Pixel 4 XL).

Context

Fixes: https://outsystemsrd.atlassian.net/browse/RNMT-4515

After being able to validate that the issue with the `sqlite3_open_v2` native primitive is
only affecting some specific devices (eg: Pixel 4 XL), we should only apply the hotfix
as a fallback and not as a workaround for every device running Android 11.

References https://outsystemsrd.atlassian.net/browse/RNMT-4515
@@ -216,7 +216,20 @@ private SQLiteAndroidDatabase openDatabase(String dbname, CallbackContext cbc, b
Log.v("info", "Open sqlite db: " + dbfile.getAbsolutePath());

SQLiteAndroidDatabase mydb = old_impl ? new SQLiteAndroidDatabase() : new SQLiteConnectorDatabase();
mydb.open(dbfile);
try {
mydb.open(dbfile);

Choose a reason for hiding this comment

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

If mydb fails to open, then no cleanup code such as close or similar needs to be executed, right?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, that's right!

mydb = new SQLiteAndroidDatabase();
mydb.open(dbfile);
}
else{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing space between else and { 💅

@luissilvaos
Copy link
Author

I will close this PR since we now have a fix for the root cause.

@farfromrefug
Copy link

@luissilvaos i was wondering if you could help us
We are facing issues in Carto Mobile SDK when trying to access sqlite database on android 11.
I would like to ask you if with your fixes you manage to read sqlite files from c++ when the file is for eaxample on the sdcard?
I am not clear on what you actually fixed here in cordova
Here CartoDB/mobile-sdk#469 is te issue we are facing: we cant seem to be able to open sqlite database using c++ api from sdcard even if we gave persistent permission to access the file from android apis. Is it something your lib can do ? Thanks

@EiyuuZack EiyuuZack deleted the fix/RNMT-4515/open-db-android11 branch September 29, 2023 16:03
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.

4 participants