Skip to content

[Bug Report] App Customization Restore Doesn't Work - Race Condition on Restart #255

@mathe00

Description

@mathe00

Checklist

  • I will make sure to have the issue written in English with an English title.
  • I made sure that there are no existing issues - open or closed - which I could contribute my information to.
  • I've verified that this issue hasn't been addressed in the changelogs.
  • I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise.
  • This issue contains only one bug.
  • I optionally donated to support the EasyLauncher mission.

Phone Make & model

Whatever

App version

Latest

Android version

Android 15

How did you download the software?

F-Droid

Bug description

The app restoration feature (introduced in v0.3.2 following issue #125 which I requested myself) doesn't work correctly. When importing a backup file containing app customizations (custom names, app ordering, hidden status), these data are not restored after the app restarts.

Important note: I requested this feature last year (#125) and it was implemented in v0.3.2. However, the current implementation contains a critical synchronization bug.

Technical Root Cause

The issue is in MainActivity.kt (around line 430). The current code calls AppReloader.restartApp() immediately after launching the asynchronous restore operation, without waiting for it to complete:

Constants.BACKUP_READ_APPS -> {
    data?.data?.also { uri ->
        lifecycleScope.launch {
            appHelper.restoreAppInfo(applicationContext, appDao, uri) // async operation
        }
    }
    AppReloader.restartApp(applicationContext) // ❌ immediate restart!
}

This creates a race condition: the app restarts while the restore is still in progress, before the data is written to the Room database. Result: all customizations are lost.

Steps to reproduce the bug

  1. Have apps with customizations (custom names, modified order, hidden apps)
  2. Go to SettingsAdvanced SettingsBackup & Restore
  3. Choose Backup Apps to create a backup file
  4. Modify or reset app customizations
  5. Return to Backup & Restore and choose Restore Apps
  6. Select the previously created backup file
  7. The app restarts automatically
  8. Result: Customizations are not restored

Expected behavior

After restoration and restart, all customizations should be restored:

  • Custom app names
  • App ordering in the launcher
  • Hidden status of apps
  • Favorite apps

The app should wait for the restore operation to be completely finished before restarting.

Screenshots/Screen recordings

No response

Logs

No response

Additional information

No response

Terms and Conditions

  • I have read all the rules above and filled in the requiered fields to the best of my ability.
  • I accept that if I fail to follow the rules listed above that i will be blocked from interactions with this project.

Donation Name

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions