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

Commit 7cfce946 authored by Kenny Guy's avatar Kenny Guy Committed by Android (Google) Code Review
Browse files

Merge "Reset profile ids when backing up / restoring favorites." into ub-now-nova

parents 97dd8c21 f8b1dfd2
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -819,9 +819,15 @@ public class LauncherBackupHelper implements BackupHelper {
        if (!TextUtils.isEmpty(title)) {
            favorite.title = title;
        }
        String intent = c.getString(INTENT_INDEX);
        if (!TextUtils.isEmpty(intent)) {
            favorite.intent = intent;
        String intentDescription = c.getString(INTENT_INDEX);
        if (!TextUtils.isEmpty(intentDescription)) {
            try {
                Intent intent = Intent.parseUri(intentDescription, 0);
                intent.removeExtra(ItemInfo.EXTRA_PROFILE);
                favorite.intent = intent.toUri(0);
            } catch (URISyntaxException e) {
                Log.e(TAG, "Invalid intent", e);
           }
        }
        favorite.itemType = c.getInt(ITEM_TYPE_INDEX);
        if (favorite.itemType == Favorites.ITEM_TYPE_APPWIDGET) {
@@ -874,6 +880,11 @@ public class LauncherBackupHelper implements BackupHelper {
            values.put(Favorites.APPWIDGET_ID, favorite.appWidgetId);
        }

        UserHandleCompat myUserHandle = UserHandleCompat.myUserHandle();
        long userSerialNumber =
                UserManagerCompat.getInstance(mContext).getSerialNumberForUser(myUserHandle);
        values.put(LauncherSettings.Favorites.PROFILE_ID, userSerialNumber);

        // Let LauncherModel know we've been here.
        values.put(LauncherSettings.Favorites.RESTORED, 1);