-
Notifications
You must be signed in to change notification settings - Fork 59
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
Crash after launch fixed #3508
Crash after launch fixed #3508
Changes from 5 commits
213fec0
30817cd
d3e997c
badf137
acd9e0f
3530a33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,11 @@ | |
android:theme="@style/AppTheme.NoActionBar" | ||
android:usesCleartextTraffic="false" | ||
android:windowSoftInputMode="adjustResize" | ||
android:allowBackup="false" | ||
android:fullBackupContent="false" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
tools:ignore="UnusedAttribute,LockedOrientationActivity" | ||
tools:replace="android:theme"> | ||
tools:replace="android:allowBackup,android:theme"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We disallowed backup @Aleem92 for privacy & security reasons. This backup is stored in the Android logged-in user drive, compromising the confidentiality of the data collected via the app. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
1- allowBackup="false" and fullBackupContent="false" are disabling the backup system entirely. 2- dataExtractionRules="@xml/data_extraction_rules" is pointing to the XML file that would prevent any data from being backed up or transferred. This is now the recommended way to control backups for newer Android versions. 3-
|
||
<profileable | ||
android:shell="true" | ||
tools:targetApi="29" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<data-extraction-rules> | ||
<cloud-backup> | ||
<exclude domain="root" path="." /> | ||
<exclude domain="file" path="." /> | ||
<exclude domain="database" path="." /> | ||
<exclude domain="sharedpref" path="." /> | ||
<exclude domain="external" path="." /> | ||
</cloud-backup> | ||
<device-transfer> | ||
<exclude domain="root" path="." /> | ||
<exclude domain="file" path="." /> | ||
<exclude domain="database" path="." /> | ||
<exclude domain="sharedpref" path="." /> | ||
<exclude domain="external" path="." /> | ||
</device-transfer> | ||
</data-extraction-rules> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the implication for using this
DatabaseErrorStrategy
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DatabaseErrorStrategy.RECREATE_AT_OPEN was implemented to solve a critical issue where the app crashes on startup after restoring a backup. The application is unable to read from the restored database due to this error:
FATAL EXCEPTION: main Process: org.smartregister.opensrp.eusm, PID: 18215 java.lang.RuntimeException: Unable to create application org.smartregister.fhircore.quest.QuestApplication: android.database.sqlite.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master; at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7003) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) Caused by: android.database.sqlite.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master; at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method) at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:89) at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:62) at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:91) at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:50) at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:60) at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:2019) at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1905) at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2672) at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2602) at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1250) at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1325) at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:167) at com.google.android.fhir.db.impl.SQLCipherSupportHelper.getWritableDatabase(SQLCipherSupportHelper.kt:91) at com.google.android.fhir.db.impl.SQLCipherSupportHelper.<init>(SQLCipherSupportHelper.kt:122) at com.google.android.fhir.db.impl.SQLCipherSupportHelper.<init>(SQLCipherSupportHelper.kt:36) at com.google.android.fhir.db.impl.DatabaseImpl.lambda$2$lambda$1(DatabaseImpl.kt:97) at com.google.android.fhir.db.impl.DatabaseImpl$$ExternalSyntheticLambda0.create(D8$$SyntheticClass:0) at com.google.android.fhir.db.impl.ResourceDatabase_Impl.createOpenHelper(ResourceDatabase_Impl.java:378) at androidx.room.RoomDatabase.init(RoomDatabase.kt:186) at androidx.room.RoomDatabase$Builder.build(RoomDatabase.kt:1358) at com.google.android.fhir.db.impl.DatabaseImpl.<init>(DatabaseImpl.kt:116) at com.google.android.fhir.FhirServices$Builder.build(FhirServices.kt:83) at com.google.android.fhir.FhirEngineProvider.getOrCreateFhirService(FhirEngineProvider.kt:99) at com.google.android.fhir.FhirEngineProvider.getInstance(FhirEngineProvider.kt:63) at org.smartregister.fhircore.engine.di.FhirEngineModule.provideFhirEngine(FhirEngineModule.kt:82) at org.smartregister.fhircore.engine.di.FhirEngineModule_ProvideFhirEngineFactory.provideFhirEngine(FhirEngineModule_ProvideFhirEngineFactory.java:60) at org.smartregister.fhircore.quest.DaggerQuestApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get(DaggerQuestApplication_HiltComponents_SingletonC.java:1384) at dagger.internal.DoubleCheck.get(DoubleCheck.java:47) at org.smartregister.fhircore.quest.DaggerQuestApplication_HiltComponents_SingletonC$SingletonCImpl$SwitchingProvider.get(DaggerQuestApplication_HiltComponents_SingletonC.java:1517) at dagger.internal.DoubleCheck.get(DoubleCheck.java:47) 2024-09-18 14:47:49.475 18215-18215 AndroidRuntime pid-18215 E at org.smartregister.fhircore.quest.DaggerQuestApplication_HiltComponents_SingletonC$SingletonCImpl.injectQuestApplication2(DaggerQuestApplication_HiltComponents_SingletonC.java:1347) at org.smartregister.fhircore.quest.DaggerQuestApplication_HiltComponents_SingletonC$SingletonCImpl.injectQuestApplication(DaggerQuestApplication_HiltComponents_SingletonC.java:1336) at org.smartregister.fhircore.quest.Hilt_QuestApplication.hiltInternalInject(Hilt_QuestApplication.java:52) at org.smartregister.fhircore.quest.Hilt_QuestApplication.onCreate(Hilt_QuestApplication.java:43) at org.smartregister.fhircore.quest.QuestApplication.onCreate(QuestApplication.kt:59) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6998) ... 9 more
This strategy ensures the app remains functional by resetting the database if it can't be read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This strategy is NOT respected when opening a previously unencrypted database with an encrypted configuration or vice versa. An IllegalStateException is thrown instead.
Out of curiosity does the new version of the APK use the same encryption for the DB?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR fixes the problem at hanf. Good job on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes were made to the encryption strategy in this PR.