Add a wipe-data command to gsi_tool and IGsiService.

Bug: 134185850
Test: gsi_tool install
      reboot; skip setup wizard
      reboot
      gsi_tool wipe-data
      gsi_tool enable
      reboot; expect setup wizard

Change-Id: I44b676f9e08a890b14f056c7ab095c42158d9eb4
diff --git a/gsi_service.cpp b/gsi_service.cpp
index 4dc703f..5f51cd8 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -349,6 +349,21 @@
     return binder::Status::ok();
 }
 
+binder::Status GsiService::wipeGsiUserdata(int* _aidl_return) {
+    ENFORCE_SYSTEM_OR_SHELL;
+    std::lock_guard<std::mutex> guard(main_lock_);
+
+    if (IsGsiRunning() || !IsGsiInstalled()) {
+        *_aidl_return = IGsiService::INSTALL_ERROR_GENERIC;
+        return binder::Status::ok();
+    }
+
+    auto installer = std::make_unique<GsiInstaller>(this, GetInstalledImageDir());
+    *_aidl_return = installer->WipeUserdata();
+
+    return binder::Status::ok();
+}
+
 binder::Status GsiService::CheckUid(AccessLevel level) {
     std::vector<uid_t> allowed_uids{AID_ROOT, AID_SYSTEM};
     if (level == AccessLevel::SystemOrShell) {