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

Commit 7cd641eb authored by Anton Hansson's avatar Anton Hansson Committed by android-build-merger
Browse files

Merge "installd: Add support for migrating legacy obb data." into qt-dev am:...

Merge "installd: Add support for migrating legacy obb data." into qt-dev am: 41ef39ce am: 8231d8d4
am: 5d808041

Change-Id: Iaeee64515891538da0f339387973a4c499a1a5d8
parents 3822dfa3 5d808041
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -128,6 +128,10 @@ cc_binary {
            ],
            ],
        },
        },
    },
    },

    // Needs to be wherever installd is as it's execed by
    // installd.
    required: [ "migrate_legacy_obb_data.sh" ],
}
}


// OTA chroot tool
// OTA chroot tool
@@ -254,3 +258,9 @@ sh_binary {
        "otapreopt_slot",
        "otapreopt_slot",
    ],
    ],
}
}

// Script to migrate legacy obb data.
sh_binary {
    name: "migrate_legacy_obb_data.sh",
    src: "migrate_legacy_obb_data.sh"
}
+11 −0
Original line number Original line Diff line number Diff line
@@ -2816,5 +2816,16 @@ binder::Status InstalldNativeService::prepareAppProfile(const std::string& packa
    return ok();
    return ok();
}
}


binder::Status InstalldNativeService::migrateLegacyObbData() {
    ENFORCE_UID(AID_SYSTEM);
    // NOTE: The lint warning doesn't apply to the use of system(3) with
    // absolute parse and no command line arguments.
    if (system("/system/bin/migrate_legacy_obb_data.sh") != 0) { // NOLINT(cert-env33-c)
        LOG(ERROR) << "Unable to migrate legacy obb data";
    }

    return ok();
}

}  // namespace installd
}  // namespace installd
}  // namespace android
}  // namespace android
+2 −0
Original line number Original line Diff line number Diff line
@@ -155,6 +155,8 @@ public:
            const std::string& codePath, const std::unique_ptr<std::string>& dexMetadata,
            const std::string& codePath, const std::unique_ptr<std::string>& dexMetadata,
            bool* _aidl_return);
            bool* _aidl_return);


    binder::Status migrateLegacyObbData();

private:
private:
    std::recursive_mutex mLock;
    std::recursive_mutex mLock;


+2 −0
Original line number Original line Diff line number Diff line
@@ -112,6 +112,8 @@ interface IInstalld {
    void destroyAppDataSnapshot(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
    void destroyAppDataSnapshot(@nullable @utf8InCpp String uuid, @utf8InCpp String packageName,
            int userId, long ceSnapshotInode, int snapshotId, int storageFlags);
            int userId, long ceSnapshotInode, int snapshotId, int storageFlags);


    void migrateLegacyObbData();

    const int FLAG_STORAGE_DE = 0x1;
    const int FLAG_STORAGE_DE = 0x1;
    const int FLAG_STORAGE_CE = 0x2;
    const int FLAG_STORAGE_CE = 0x2;
    const int FLAG_STORAGE_EXTERNAL = 0x4;
    const int FLAG_STORAGE_EXTERNAL = 0x4;
+27 −0
Original line number Original line Diff line number Diff line
#!/system/bin/sh

#
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if ! test -d /data/media/obb ; then
  log -p i -t migrate_legacy_obb_data "No legacy obb data to migrate."
  exit 0
fi

log -p i -t migrate_legacy_obb_data "Migrating legacy obb data."
rm -rf /data/media/0/Android/obb
cp -F -p -R -P -d /data/media/obb /data/media/0/Android
rm -rf /data/media/obb
log -p i -t migrate_legacy_obb_data "Done."