summaryrefslogtreecommitdiff
path: root/gsi_service.h
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2019-01-14 19:09:27 -0800
committerDavid Anderson <dvander@google.com>2019-01-16 09:17:56 +0000
commita141ba8b1e18e9ad65f923cf1eb0f6976c51354e (patch)
tree786c151914c7fe4f1c5118665507462a70626dd2 /gsi_service.h
parentb3aff184cac0cbea6a587c4bf290fe2ae83b85b1 (diff)
downloadgsid-a141ba8b1e18e9ad65f923cf1eb0f6976c51354e.tar.gz
Allow disabling and re-enabling GSI.
This change introduces two new commands to gsi_tool: enable and disable. Disable is similar to "wipe", in that it allows reboot back into the normal system image. However unlike "wipe" the GSI images will not be deleted on startup. The GSI install can then be re-enabled with the "enable" command. Unfortunately, this currently has a high probability of hitting a bug in F2FS where the file cannot be repinned. This can happen if the device has been used or rebooted extensively in between disabling and re-enabling the GSI. In addition, the semantics of the "install" command have changed. It will now attempt to re-use an existing userdata if one exists. To force a clean userdata, the --wipe parameter can be specified. To disable a GSI install: gsi_tool disable adb reboot To re-enable a GSI install: gsi_tool enable adb reboot To install a GSI and preserve userdata: gsi_tool install --gsi-size=SIZE < image To install a GSI and create a userdata if none exists: gsi_tool install --gsi-size=SIZE --userdata-size=SIZE < image To install a GSI and wipe userdata: gsi_tool install --gsi-size=SIZE --userdata-size=SIZE --wipe < image Bug: 122556707 Test: manual test Change-Id: Ia55ca930b0b7f6b2b97a6390568555b4166e2605
Diffstat (limited to 'gsi_service.h')
-rw-r--r--gsi_service.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/gsi_service.h b/gsi_service.h
index 7f5d49b..367467c 100644
--- a/gsi_service.h
+++ b/gsi_service.h
@@ -36,15 +36,20 @@ class GsiService : public BinderService<GsiService>, public BnGsiService {
~GsiService() override;
- binder::Status startGsiInstall(int64_t gsiSize, int64_t userdataSize,
+ binder::Status startGsiInstall(int64_t gsiSize, int64_t userdataSize, bool wipeUserdata,
bool* _aidl_return) override;
binder::Status commitGsiChunkFromStream(const ::android::os::ParcelFileDescriptor& stream,
int64_t bytes, bool* _aidl_return) override;
binder::Status commitGsiChunkFromMemory(const ::std::vector<uint8_t>& bytes,
bool* _aidl_return) override;
+ binder::Status cancelGsiInstall(bool* _aidl_return) override;
binder::Status setGsiBootable(bool* _aidl_return) override;
binder::Status removeGsiInstall(bool* _aidl_return) override;
+ binder::Status disableGsiInstall(bool* _aidl_return) override;
binder::Status isGsiRunning(bool* _aidl_return) override;
+ binder::Status isGsiInstalled(bool* _aidl_return) override;
+ binder::Status isGsiInstallInProgress(bool* _aidl_return) override;
+ binder::Status getUserdataImageSize(int64_t* _aidl_return) override;
static char const* getServiceName() { return kGsiServiceName; }
@@ -54,30 +59,36 @@ class GsiService : public BinderService<GsiService>, public BnGsiService {
using LpMetadata = android::fs_mgr::LpMetadata;
using MetadataBuilder = android::fs_mgr::MetadataBuilder;
- bool StartInstall(int64_t gsi_size, int64_t userdata_size);
+ bool StartInstall(int64_t gsi_size, int64_t userdata_size, bool wipe_userdata);
bool PerformSanityChecks();
bool PreallocateFiles();
bool FormatUserdata();
bool CommitGsiChunk(int stream_fd, int64_t bytes);
bool CommitGsiChunk(const void* data, size_t bytes);
bool SetGsiBootable();
- bool RemoveGsiInstall();
+ bool ReenableGsi();
+ bool DisableGsiInstall();
bool EnsureFolderExists(const std::string& path);
bool AddPartitionFiemap(android::fs_mgr::MetadataBuilder* builder,
android::fs_mgr::Partition* partition,
android::fiemap_writer::FiemapWriter* writer);
- std::unique_ptr<MetadataBuilder> CreateMetadataBuilder();
+ std::unique_ptr<LpMetadata> CreateMetadata(android::fiemap_writer::FiemapWriter* userdata,
+ android::fiemap_writer::FiemapWriter* system);
fiemap_writer::FiemapUniquePtr CreateFiemapWriter(const std::string& path, uint64_t size);
bool CreateInstallStatusFile();
- bool CreateMetadataFile();
+ bool CreateMetadataFile(const android::fs_mgr::LpMetadata& metadata);
void PostInstallCleanup();
+ static bool RemoveGsiFiles(bool wipeUserdata);
+
std::mutex main_lock_;
bool installing_ = false;
uint64_t userdata_block_size_;
uint64_t system_block_size_;
uint64_t gsi_size_;
uint64_t userdata_size_;
+ bool wipe_userdata_;
+ bool wipe_userdata_on_failure_;
// Remaining data we're waiting to receive for the GSI image.
uint64_t gsi_bytes_written_;