Support delete local instance in acloud deleted function.

Bug: 117474343
Test: m acloud && atest acloud_test && acloud delete
Change-Id: I925308163e5d55a1dbce1a11f13802557bd840f5
diff --git a/public/device_driver.py b/public/device_driver.py
index 08f6bf3..b401410 100755
--- a/public/device_driver.py
+++ b/public/device_driver.py
@@ -272,8 +272,8 @@
         return self._devices
 
 
-def _AddDeletionResultToReport(report_obj, deleted, failed, error_msgs,
-                               resource_name):
+def AddDeletionResultToReport(report_obj, deleted, failed, error_msgs,
+                              resource_name):
     """Adds deletion result to a Report object.
 
     This function will add the following to report.data.
@@ -428,24 +428,25 @@
     return r
 
 
-def DeleteAndroidVirtualDevices(cfg, instance_names):
+def DeleteAndroidVirtualDevices(cfg, instance_names, default_report=None):
     """Deletes android devices.
 
     Args:
         cfg: An AcloudConfig instance.
         instance_names: A list of names of the instances to delete.
+        default_report: A initialized Report instance.
 
     Returns:
         A Report instance.
     """
-    r = report.Report(command="delete")
+    r = default_report if default_report else report.Report(command="delete")
     credentials = auth.CreateCredentials(cfg)
     compute_client = android_compute_client.AndroidComputeClient(cfg,
                                                                  credentials)
     try:
         deleted, failed, error_msgs = compute_client.DeleteInstances(
             instance_names, cfg.zone)
-        _AddDeletionResultToReport(
+        AddDeletionResultToReport(
             r, deleted,
             failed, error_msgs,
             resource_name="instance")
@@ -512,7 +513,7 @@
             result = compute_client.DeleteInstances(
                 instances=cleanup_list[i:i + MAX_BATCH_CLEANUP_COUNT],
                 zone=cfg.zone)
-            _AddDeletionResultToReport(r, *result, resource_name="instance")
+            AddDeletionResultToReport(r, *result, resource_name="instance")
 
         # Cleanup expired images
         items = compute_client.ListImages()
@@ -526,7 +527,7 @@
         for i in range(0, len(cleanup_list), MAX_BATCH_CLEANUP_COUNT):
             result = compute_client.DeleteImages(
                 image_names=cleanup_list[i:i + MAX_BATCH_CLEANUP_COUNT])
-            _AddDeletionResultToReport(r, *result, resource_name="image")
+            AddDeletionResultToReport(r, *result, resource_name="image")
 
         # Cleanup expired disks
         # Disks should have been attached to instances with autoDelete=True.
@@ -542,7 +543,7 @@
             result = compute_client.DeleteDisks(
                 disk_names=cleanup_list[i:i + MAX_BATCH_CLEANUP_COUNT],
                 zone=cfg.zone)
-            _AddDeletionResultToReport(r, *result, resource_name="disk")
+            AddDeletionResultToReport(r, *result, resource_name="disk")
 
         # Cleanup expired google storage
         items = storage_client.List(bucket_name=cfg.storage_bucket_name)
@@ -555,7 +556,7 @@
             result = storage_client.DeleteFiles(
                 bucket_name=cfg.storage_bucket_name,
                 object_names=cleanup_list[i:i + MAX_BATCH_CLEANUP_COUNT])
-            _AddDeletionResultToReport(
+            AddDeletionResultToReport(
                 r, *result, resource_name="cached_build_artifact")
 
         # Everything succeeded, write status to report.