AppManager icon indicating copy to clipboard operation
AppManager copied to clipboard

Restore backup of apps doesn't work

Open abdo2048 opened this issue 1 year ago • 15 comments

Please check before submitting an issue

  • [X] I know what my device, OS and App Manager versions are
  • [X] I know how to take logs
  • [x] I know how to reproduce the issue which may not be specific to my device

Describe the bug

I wanted to try App Manager Backup/Restore function on Non-Rooted Samsung A54. So I tried with Molly app (which is fork of Signal).

To Reproduce

  1. I backed up Molly using App Manager and checked all options (APK file + External data + OBB and Media + Cache + Back up multiple).
  2. Cleared data of Molly and uninstalled it.
  3. Went to App Manager to restore, but nothing happens when I try to restore OR gives me a notification telling me failed to load the backup.

Expected behavior

restoring the backup should work.

Screenshots

No response

Logs

====> op=BACKUP_RESTORE, mode=2 pkg=(im.molly.app, 0)
io.github.muntashirakon.AppManager.backup.BackupException: Unknown error occurred
at io.github.muntashirakon.AppManager.backup.RestoreOp.runRestore(RestoreOp.java:212)
at io.github.muntashirakon.AppManager.backup.BackupManager.restore(BackupManager.java:176)
at io.github.muntashirakon.AppManager.batchops.BatchOpsManager.lambda$opBackupRestore$0$io-github-muntashirakon-AppManager-batchops-BatchOpsManager(BatchOpsManager.java:337)
at io.github.muntashirakon.AppManager.batchops.BatchOpsManager$$ExternalSyntheticLambda0.run(Unknown Source:12)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.SecurityException: Package com.google.android.packageinstaller does not belong to 10053
at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
at android.os.Parcel.createException(Parcel.java:3053)
at android.os.Parcel.readException(Parcel.java:3036)
at android.os.Parcel.readException(Parcel.java:2978)
at android.content.pm.IPackageInstaller$Stub$Proxy.createSession(IPackageInstaller.java:543)
at io.github.muntashirakon.AppManager.apk.installer.PackageInstallerCompat.openSession(PackageInstallerCompat.java:723)
at io.github.muntashirakon.AppManager.apk.installer.PackageInstallerCompat.install(PackageInstallerCompat.java:617)
at io.github.muntashirakon.AppManager.backup.RestoreOp.restoreApkFiles(RestoreOp.java:349)
at io.github.muntashirakon.AppManager.backup.RestoreOp.runRestore(RestoreOp.java:197)
... 8 more
Caused by: android.os.RemoteException: Remote stack trace:
at android.app.AppOpsManager.checkPackage(AppOpsManager.java:8796)
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:779)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:702)
at android.content.pm.IPackageInstaller$Stub.onTransact(IPackageInstaller.java:254)
at android.os.Binder.execTransactInternal(Binder.java:1380)

02-02 21:25:11.043 W/Path (29213): Could not get privileged access to path /storage/emulated/0/Android/obb/com.google.android.apps.restore due to "Binder not running."

Device info

  • Device: Samsung A54 5G
  • OS Version: Android 14
  • App Manager Version: 3.1.4 (427)
  • Mode: NonRoot

Additional context

Tried to backup/restore another app but same log error

abdo2048 avatar Feb 02 '24 19:02 abdo2048

This appears to be an issue with the installer function. Can you install any APK files using the App Manager's installer?

MuntashirAkon avatar Feb 03 '24 12:02 MuntashirAkon

  1. I tried to install a clock app with App Managers' installer and it worker.
  2. Then I opened the clock app and enabled notification permission for it and added an alarm.
  3. Then I backed up the clock app with App Manager with (all options checked).
  4. Deleted the clock app with clearing data.
  5. Tried to restore the backup using App Manager and it worked. However, the app is just restored with no data (so it's the same as fresh install).

After that, I made the same above steps but with Android Package Installer, in the step 5, App Manager failed to restore the backup with the same error in the log.

There are two points here:

  1. Looks like App Manager can't restore backup of an app that is installed with Android Package Installer and I must installed the apps previously with App Manager's installer?
  2. I have no root, is it even possible to backup data or anything beyond the base apk of the apps in this situation?

abdo2048 avatar Feb 03 '24 21:02 abdo2048

@MuntashirAkon can you please clarify which of the below backup/restore operations are supported by AppManager without root? I can get neither to work, so before I spend more time, maybe you can clarify what's possible?

  1. Can AM back up and restore APK + External Data + OBB/Media on the same unrooted device?
  2. Can it restore these 3 things on a different (unrooted) device?

The error messages I see are BackupException: Failed to restore ownership info for index 0. (I think when the External Data is restored) or something like "BackupException: Unknown error occurred [...] Caused by: SecurityException: Package com.aurora.store does not belong to <NUMERIC_UID> (I think when the APK is restored ... the package I'm trying to restore was originally installed via Aurora Store).

xanoni avatar Apr 30 '24 04:04 xanoni

Also, if AM does not support these restore operations on unrooted devices, is this a technical limitation, or are tools that support this? My goal is to migrate specific applications + their data from unrooted phone A to unrooted phone B.

xanoni avatar Apr 30 '24 05:04 xanoni

Also, if AM does not support these restore operations on unrooted devices, is this a technical limitation, or are tools that support this? My goal is to migrate specific applications + their data from unrooted phone A to unrooted phone B.

App Manager can restore apk, external data, media and obb directories across multiple devices. If you need to backup internal data, you can try adb backup instead. ADB backup framework has already been added to AM, but it hasn't been integrated with the backup/restore feature yet.

MuntashirAkon avatar Jul 06 '24 18:07 MuntashirAkon

1. Looks like App Manager can't restore backup of an app that is installed with Android Package Installer and I must installed the apps previously with App Manager's installer?

That's not true. The logs suggest something else entirely.

2. I have no root, is it even possible to backup data or anything beyond the base apk of the apps in this situation?

In Android 14, you can only back up APK and media/OBB files in no-root mode. Access to external storage data has been made limited. You can still back them up in ADB mode.

MuntashirAkon avatar Jul 06 '24 18:07 MuntashirAkon

@abdo2048: Can you try using v3.1.6?

MuntashirAkon avatar Jul 06 '24 18:07 MuntashirAkon

@abdo2048: Can you try using v3.1.6?

I have the same problem about this. my device is a mi pad 5 with a non-rooted device. i have tried v3.1.6 but not success. the problem still occurs.

do4Mother avatar Jul 16 '24 10:07 do4Mother