gsid: Make enableGsi() idempotent

Right now doing this leads to an error:

  $ gsi_tool disable  # success
  $ gsi_tool enable   # success
  $ gsi_tool enable   # failure!

because enableGsi() fails if the DSU/GSI installation is already
enabled. This makes switching boot modes rather inconvenient:

  $ gsi_tool enable
  $ gsi_tool disable  # else "enable -s" would fail
  $ gsi_tool enable -s

And cause the following workflow a catastrophic failure:

  $ Install DSU/GSI with DynamicSystemInstallationService
  $ gsi_tool enable
  $ Click DynamicSystemInstallationService "Restart"
  $ => "Restart" would call gsid::enableGsi() which would fail,
       causing the entire DSU installation to be discarded.

This CL makes the above two cases work without error, by making
enableGsi() idempotent, so that successive calls of enableGsi() wouldn't
fail.

Bug: 220978519
Bug: 225310919
Test: Install DSU with DynamicSystemInstallationService
  gsi_tool enable
  Click DynamicSystemInstallationService "Restart"
  => no failure and boots into GSI with one-shot mode
Change-Id: I8c37d9577dc0da7c13c1a260fa6ace0990c071b1
3 files changed