summaryrefslogtreecommitdiff
path: root/gsi_service.cpp
diff options
context:
space:
mode:
authorHoward Chen <howardsoc@google.com>2019-08-02 11:21:58 +0800
committerHoward Chen <howardsoc@google.com>2019-09-18 15:51:20 +0800
commit25b18cc44a5fbe7e1578dc96ac200849ffa70183 (patch)
tree5416480781296d8359f3ac7a28812cd25bb687b9 /gsi_service.cpp
parent2d210a8d93e1c7bff5b094d03badec87f089bdc2 (diff)
downloadgsid-25b18cc44a5fbe7e1578dc96ac200849ffa70183.tar.gz
Clean up legacy methods and naming
remove: startGsiInstall framework does not use the old prototype any more. remove: getGsiStatus framework does not use it any more. rename: setGsiBootable -> enableGsi make it consistent with its reverse action: disableGsi rename: removeGsiInstall -> removeGsi rename: disableGsiInstall -> disableGsi the word install now refers to the installation session. rename for consistency. Bug: 138544413 Test: gsi_tool install/enable/disable adb shell am start-activity \ -n com.android.dynsystem/com.android.dynsystem.VerificationActivity \ -a android.os.image.action.START_INSTALL \ -d file:///storage/emulated/0/Download/system.raw.gz \ --el KEY_SYSTEM_SIZE $(du -b system.raw|cut -f1) \ --el KEY_USERDATA_SIZE 8589934592 Change-Id: I974d781d1eca82cecd813ad7bf557c5aec6f8f45 Merged-In: I974d781d1eca82cecd813ad7bf557c5aec6f8f45
Diffstat (limited to 'gsi_service.cpp')
-rw-r--r--gsi_service.cpp87
1 files changed, 3 insertions, 84 deletions
diff --git a/gsi_service.cpp b/gsi_service.cpp
index 4caf353..f9805c4 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -102,15 +102,6 @@ android::sp<IGsiService> GsiService::Get(Gsid* parent) {
if (!status.isOk()) return status; \
} while (0)
-binder::Status GsiService::startGsiInstall(int64_t gsiSize, int64_t userdataSize, bool wipeUserdata,
- int* _aidl_return) {
- GsiInstallParams params;
- params.gsiSize = gsiSize;
- params.userdataSize = userdataSize;
- params.wipeUserdata = wipeUserdata;
- return beginGsiInstall(params, _aidl_return);
-}
-
binder::Status GsiService::beginGsiInstall(const GsiInstallParams& given_params,
int* _aidl_return) {
ENFORCE_SYSTEM;
@@ -192,7 +183,7 @@ binder::Status GsiService::commitGsiChunkFromMemory(const std::vector<uint8_t>&
return binder::Status::ok();
}
-binder::Status GsiService::setGsiBootable(bool one_shot, int* _aidl_return) {
+binder::Status GsiService::enableGsi(bool one_shot, int* _aidl_return) {
std::lock_guard<std::mutex> guard(parent_->lock());
if (installer_) {
@@ -223,7 +214,7 @@ binder::Status GsiService::isGsiEnabled(bool* _aidl_return) {
return binder::Status::ok();
}
-binder::Status GsiService::removeGsiInstall(bool* _aidl_return) {
+binder::Status GsiService::removeGsi(bool* _aidl_return) {
ENFORCE_SYSTEM_OR_SHELL;
std::lock_guard<std::mutex> guard(parent_->lock());
@@ -244,7 +235,7 @@ binder::Status GsiService::removeGsiInstall(bool* _aidl_return) {
return binder::Status::ok();
}
-binder::Status GsiService::disableGsiInstall(bool* _aidl_return) {
+binder::Status GsiService::disableGsi(bool* _aidl_return) {
ENFORCE_SYSTEM_OR_SHELL;
std::lock_guard<std::mutex> guard(parent_->lock());
@@ -288,78 +279,6 @@ binder::Status GsiService::cancelGsiInstall(bool* _aidl_return) {
return binder::Status::ok();
}
-binder::Status GsiService::getGsiBootStatus(int* _aidl_return) {
- ENFORCE_SYSTEM_OR_SHELL;
- std::lock_guard<std::mutex> guard(parent_->lock());
-
- if (!IsGsiInstalled()) {
- *_aidl_return = BOOT_STATUS_NOT_INSTALLED;
- return binder::Status::ok();
- }
-
- std::string boot_key;
- if (!GetInstallStatus(&boot_key)) {
- PLOG(ERROR) << "read " << kDsuInstallStatusFile;
- *_aidl_return = BOOT_STATUS_NOT_INSTALLED;
- return binder::Status::ok();
- }
-
- bool single_boot = !access(kDsuOneShotBootFile, F_OK);
-
- if (boot_key == kInstallStatusWipe) {
- // This overrides all other statuses.
- *_aidl_return = BOOT_STATUS_WILL_WIPE;
- } else if (boot_key == kInstallStatusDisabled) {
- // A single-boot GSI will have a "disabled" status, because it's
- // disabled immediately upon reading the one_shot_boot file. However,
- // we still want to return SINGLE_BOOT, because it makes the
- // transition clearer to the user.
- if (single_boot) {
- *_aidl_return = BOOT_STATUS_SINGLE_BOOT;
- } else {
- *_aidl_return = BOOT_STATUS_DISABLED;
- }
- } else if (single_boot) {
- *_aidl_return = BOOT_STATUS_SINGLE_BOOT;
- } else {
- *_aidl_return = BOOT_STATUS_ENABLED;
- }
- return binder::Status::ok();
-}
-
-binder::Status GsiService::getUserdataImageSize(int64_t* _aidl_return) {
- ENFORCE_SYSTEM;
- std::lock_guard<std::mutex> guard(parent_->lock());
-
- *_aidl_return = -1;
-
- if (installer_) {
- // Size has already been computed.
- *_aidl_return = installer_->userdata_size();
- } else if (IsGsiRunning()) {
- // :TODO: libdm
- unique_fd fd(open(kUserdataDevice, O_RDONLY | O_NOFOLLOW | O_CLOEXEC));
- if (fd < 0) {
- PLOG(ERROR) << "open " << kUserdataDevice;
- return binder::Status::ok();
- }
-
- int64_t size;
- if (ioctl(fd, BLKGETSIZE64, &size)) {
- PLOG(ERROR) << "BLKGETSIZE64 " << kUserdataDevice;
- return binder::Status::ok();
- }
- *_aidl_return = size;
- } else {
- if (auto manager = ImageManager::Open(kDsuMetadataDir, GetInstalledImageDir())) {
- if (auto device = MappedDevice::Open(manager.get(), 10s, "userdata_gsi")) {
- *_aidl_return = get_block_device_size(device->fd());
- }
- }
- }
- return binder::Status::ok();
-}
-
binder::Status GsiService::getInstalledGsiImageDir(std::string* _aidl_return) {
ENFORCE_SYSTEM;
std::lock_guard<std::mutex> guard(parent_->lock());