microg / microg/GmsCore

Unable to reimport the same xml profile

Open
#1,915 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
14.6k
Forks
3.2k
Avg merge
12d 11h
Merged PRs (30d)
4

Description

Describe the bug
Unable to reimport the same xml profile.

To Reproduce
Steps to reproduce the behavior:

  1. Go to microG settings => Google device registration => Import custom profile and then import a profile from the xml
  2. Manually edit the xml file of the profile
  3. Reimport the edited xml
  4. See error:
D/ProfileManager( 1062): Importing user profile 'My profile'
W/ProfileManager( 1062): kotlin.io.FileAlreadyExistsException: /data/data/com.google.android.gms/cache/profile_-519229140.xml -> /data/data/com.google.android.gms/files/device_profile.xml: The destination file already exists.
W/ProfileManager( 1062): 	at kotlin.io.FilesKt__UtilsKt.copyTo(Utils.kt:224)
W/ProfileManager( 1062): 	at kotlin.io.FilesKt__UtilsKt.copyTo$default(Utils.kt:217)
W/ProfileManager( 1062): 	at org.microg.gms.profile.ProfileManager.importUserProfile(ProfileManager.kt:307)
W/ProfileManager( 1062): 	at org.microg.gms.ui.DeviceRegistrationPreferencesFragment.onFileSelected(DeviceRegistrationPreferencesFragment.kt:56)
W/ProfileManager( 1062): 	at org.microg.gms.ui.DeviceRegistrationPreferencesFragment.$r8$lambda$wnSSaN6Ik4Od66fpD_2eikm17F8(DeviceRegistrationPreferencesFragment.kt)
W/ProfileManager( 1062): 	at org.microg.gms.ui.DeviceRegistrationPreferencesFragment$$ExternalSyntheticLambda0.onActivityResult(D8$$SyntheticClass)
W/ProfileManager( 1062): 	at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:418)
W/ProfileManager( 1062): 	at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:375)
W/ProfileManager( 1062): 	at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:777)
W/ProfileManager( 1062): 	at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:152)
W/ProfileManager( 1062): 	at android.app.Activity.dispatchActivityResult(Activity.java:5438)
W/ProfileManager( 1062): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:3347)
W/ProfileManager( 1062): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:3394)
W/ProfileManager( 1062): 	at android.app.ActivityThread.access$1300(ActivityThread.java:135)
W/ProfileManager( 1062): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
W/ProfileManager( 1062): 	at android.os.Handler.dispatchMessage(Handler.java:102)
W/ProfileManager( 1062): 	at android.os.Looper.loop(Looper.java:136)
W/ProfileManager( 1062): 	at android.app.ActivityThread.main(ActivityThread.java:5001)
W/ProfileManager( 1062): 	at java.lang.reflect.Method.invokeNative(Native Method)
W/ProfileManager( 1062): 	at java.lang.reflect.Method.invoke(Method.java:515)
W/ProfileManager( 1062): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
W/ProfileManager( 1062): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
W/ProfileManager( 1062): 	at dalvik.system.NativeStart.main(Native Method)

Expected behavior
Successfully re-import it.

System
Android Version: 4.4.4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ProfileManager.kt at importUserProfile, around line 307, where the stack trace shows the existing destination causes the reimport to fail. Reproduce the import flow on Android 4.4.4 with an edited XML profile, then verify that importing over the existing device profile succeeds without the FileAlreadyExistsException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.