Loading cmds/installd/Android.bp +10 −0 Original line number Original line Diff line number Diff line Loading @@ -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 Loading Loading @@ -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" } cmds/installd/InstalldNativeService.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -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 cmds/installd/InstalldNativeService.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading cmds/installd/binder/android/os/IInstalld.aidl +2 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading cmds/installd/migrate_legacy_obb_data.sh 0 → 100644 +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." Loading
cmds/installd/Android.bp +10 −0 Original line number Original line Diff line number Diff line Loading @@ -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 Loading Loading @@ -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" }
cmds/installd/InstalldNativeService.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -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
cmds/installd/InstalldNativeService.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading
cmds/installd/binder/android/os/IInstalld.aidl +2 −0 Original line number Original line Diff line number Diff line Loading @@ -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; Loading
cmds/installd/migrate_legacy_obb_data.sh 0 → 100644 +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."