Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

exception in lineagesettings during Q->R userdata transition

  • /e/ version: 0.18-R
  • Device model(s): FP3
  • Device rooted: no

Summary

Can't downgrade database from version 15 to 14

it is currently not planned(?), but to make the migration with an intact userdata between Q and R possible, an exception would need to be fixed in lineagesettings by accounting for /e/s custom db version. It looks like an easy fix.

A freshly resetted Q userdata can boot into R if the workaround is used.

If all firmware partitions are up to date, the reason to flash stockrom between a Q->R migration is obsolete.

You'll need a A/B slot device to have an easier time testing this.

The problem

Steps to reproduce

precondition is, having done the adb sideload of R already

  1. have Q on one slot, R on the other, in the example I'll use Q=A, R=B
  2. set or already have Q, the A-slot active
  3. userdata factory reset / fastboot -w
  4. boot successfully into Q
  5. enable usb debug with root option (for convenience later), this also enables to see adb logcat on the failing R boot
  6. reboot to bootloader, fastboot --set-active=b
  7. boot into R

What is the current behavior?

  1. boot will be stuck on the /e/-bootlogo, sometimes flicker, will be dark

What is the expected correct behavior?

  1. the lock screen will be shown, successful boot

Technical informations

08-29 05:05:40.172  2300  2300 E AndroidRuntime: Caused by: android.database.sqlite.SQLiteException: Can't downgrade database from version 15 to 14
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:540)

(from the "dark" R boot, adb logcat was available because usb debug was enabled in the Q install)

08-29 05:05:40.172  2300  2300 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
08-29 05:05:40.172  2300  2300 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider org.lineageos.lineagesettings.LineageSettingsProvider: android.database.sqlite.SQLiteException: Can't downgrade database from version 15 to 14
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.app.ActivityThread.installProvider(ActivityThread.java:7251)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6787)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.app.ActivityThread.installSystemProviders(ActivityThread.java:7439)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at com.android.server.am.ActivityManagerService.installSystemProviders(ActivityManagerService.java:7910)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at com.android.server.SystemServer.startOtherServices(SystemServer.java:1128)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at com.android.server.SystemServer.run(SystemServer.java:601)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at com.android.server.SystemServer.main(SystemServer.java:417)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
08-29 05:05:40.172  2300  2300 E AndroidRuntime: Caused by: android.database.sqlite.SQLiteException: Can't downgrade database from version 15 to 14
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:540)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:414)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:316)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at org.lineageos.lineagesettings.LineageSettingsProvider.establishDbTracking(LineageSettingsProvider.java:767)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at org.lineageos.lineagesettings.LineageSettingsProvider.onCreate(LineageSettingsProvider.java:115)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    at android.app.ActivityThread.installProvider(ActivityThread.java:7246)
08-29 05:05:40.172  2300  2300 E AndroidRuntime:    ... 9 more

Relevant screenshots

Solutions

Workaround

have an adb root shell, delete the path of the lineagesettings sqlite db while being in Q, before rebooting to R

adb root
adb shell
rm /data/user_de/0/org.lineageos.lineagesettings/databases/lineagesettings.db

another workaround would be to lower the lineagesettings.db user_version from 15->14

sqlite3 path/to/lineagesettings.db "pragma user_version = 14;"

Possible fixes

lineage max version is on 14 in 18.1, see https://github.com/LineageOS/android_lineage-sdk/blob/141638388832c20058d1fd3b5425bb5f831986a0/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java#L450

but /e/ upgraded in v1-q to a 15 version:

https://gitlab.e.foundation/e/os/android_lineage-sdk/-/blob/3c885716/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java#L494

so the current v1-r branch hiccups on those versions, as it cannot downgrade. The version currently forked is without modification from lineage, but it would need to account for the custom /e/ db of v1-q - the section handling eUpgradeVersion is missing within onUpgrade() in the v1-r branch.

Edited by tcecyk