Remove IOperation and beginOp.

The way I planned for this to work doesn't work.  We'll revisit in
Keymaster5.  For now, removing IOperation and beginOp.

Bug: 152536287
Test: Build & boot
Change-Id: I017d17079380cc3bacc6f05b2486e1b6e6c3f675
diff --git a/current.txt b/current.txt
index f9c64bf..dbe23cc 100644
--- a/current.txt
+++ b/current.txt
@@ -704,8 +704,7 @@
 ce8dbe76eb9ee94b46ef98f725be992e760a5751073d4f4912484026541371f3 android.hardware.health@2.1::IHealth
 26f04510a0b57aba5167c5c0a7c2f077c2acbb98b81902a072517829fd9fd67f android.hardware.health@2.1::IHealthInfoCallback
 e2f8bc1868fd4a3fd587c172773ea5a8c2f5a3deaf7958394102ca455252b255 android.hardware.health@2.1::types
-27ae3724053940462114228872b3ffaf0b8e6177d5ba97f5a76339d12b8a99dd android.hardware.keymaster@4.1::IKeymasterDevice
-adb0efdf1462e9b2e742c0dcadd598666aac551f178be06e755bfcdf5797abd0 android.hardware.keymaster@4.1::IOperation
+c5da8636c14cd30f1ae9f10c2219e35b4e29a64443103a5842352dd070afe514 android.hardware.keymaster@4.1::IKeymasterDevice
 ddcf89cd8ee2df0d32aee55050826446fb64f7aafde0a7cd946c64f61b1a364c android.hardware.keymaster@4.1::types
 df9c79c4fdde2821550c6d5c3d07f5ec0adfb1b702561ce543c906ddef698703 android.hardware.media.c2@1.1::IComponent
 a3eddd9bbdc87e8c22764070037dd1154f1cf006e6fba93364c4f85d4c134a19 android.hardware.media.c2@1.1::IComponentStore
diff --git a/keymaster/4.1/Android.bp b/keymaster/4.1/Android.bp
index 3b505d8..f6ac6f8 100644
--- a/keymaster/4.1/Android.bp
+++ b/keymaster/4.1/Android.bp
@@ -9,7 +9,6 @@
     srcs: [
         "types.hal",
         "IKeymasterDevice.hal",
-        "IOperation.hal",
     ],
     interfaces: [
         "android.hardware.keymaster@3.0",
diff --git a/keymaster/4.1/IKeymasterDevice.hal b/keymaster/4.1/IKeymasterDevice.hal
index 1456abe..bbeccaa 100644
--- a/keymaster/4.1/IKeymasterDevice.hal
+++ b/keymaster/4.1/IKeymasterDevice.hal
@@ -24,8 +24,6 @@
 import @4.0::OperationHandle;
 import @4.0::VerificationToken;
 
-import IOperation;
-
 /**
  * @4.1::IKeymasterDevice is a minor extension to @4.0::IKeymasterDevice.  It adds support for
  *
@@ -78,18 +76,4 @@
      * an EARLY_BOOT_ONLY key after this method is called must fail with Error::INVALID_KEY_BLOB.
      */
     earlyBootEnded() generates (ErrorCode error);
-
-    /**
-     * Begins a cryptographic operation.  beginOp() is a variation on begin().  beginOp() has
-     * identical functionality to begin, but instead of an OperationHandle it returns an IOperation
-     * object.  An IKeymasterDevice HAL service must call linkToDeath() on the Operation before
-     * returning it, and the provided hidl_death_recipient, if called, must abort() the operation.
-     * This is to ensure that in the event a client crashes while an operation is in progress, the
-     * operation slot is freed and available for use by other clients.
-     *
-     * @4.1::IKeymasterDevices must implement both beginOp() and begin().
-     */
-    beginOp(KeyPurpose purpose, vec<uint8_t> keyBlob, vec<KeyParameter> inParams,
-        HardwareAuthToken authToken)
-        generates (ErrorCode error, vec<KeyParameter> outParam, IOperation operation);
 };
diff --git a/keymaster/4.1/IOperation.hal b/keymaster/4.1/IOperation.hal
deleted file mode 100644
index 7103e9e..0000000
--- a/keymaster/4.1/IOperation.hal
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.keymaster@4.1;
-
-import @4.0::ErrorCode;
-import @4.0::OperationHandle;
-
-/**
- * IOperation represents an in-progress IKeymasterDevice operation.  It is returned by
- * IKeymasterDevice.beginOp().
- */
-interface IOperation {
-    /**
-     * Returns the operation handle to be used as an authentication challenge.
-     */
-    getOperationChallenge() generates (ErrorCode error, OperationHandle operation);
-};
diff --git a/keymaster/4.1/support/include/keymasterV4_1/Keymaster3.h b/keymaster/4.1/support/include/keymasterV4_1/Keymaster3.h
index c201e8c..a27f78f 100644
--- a/keymaster/4.1/support/include/keymasterV4_1/Keymaster3.h
+++ b/keymaster/4.1/support/include/keymasterV4_1/Keymaster3.h
@@ -19,7 +19,6 @@
 #include <android/hardware/keymaster/3.0/IKeymasterDevice.h>
 
 #include "Keymaster.h"
-#include "Operation.h"
 
 namespace android::hardware::keymaster::V4_1::support {
 
@@ -122,17 +121,6 @@
 
     Return<ErrorCode> earlyBootEnded() override { return ErrorCode::UNIMPLEMENTED; }
 
-    Return<void> beginOp(KeyPurpose purpose, const hidl_vec<uint8_t>& keyBlob,
-                         const hidl_vec<KeyParameter>& inParams, const HardwareAuthToken& authToken,
-                         beginOp_cb _hidl_cb) override {
-        return begin(purpose, keyBlob, inParams, authToken,
-                     [&_hidl_cb](V4_0::ErrorCode errorCode, const hidl_vec<KeyParameter>& outParams,
-                                 OperationHandle operationHandle) {
-                         _hidl_cb(static_cast<ErrorCode>(errorCode), outParams,
-                                  new Operation(operationHandle));
-                     });
-    }
-
   private:
     void getVersionIfNeeded();
 
diff --git a/keymaster/4.1/support/include/keymasterV4_1/Keymaster4.h b/keymaster/4.1/support/include/keymasterV4_1/Keymaster4.h
index 6d74d98..75d9139 100644
--- a/keymaster/4.1/support/include/keymasterV4_1/Keymaster4.h
+++ b/keymaster/4.1/support/include/keymasterV4_1/Keymaster4.h
@@ -17,7 +17,6 @@
 #pragma once
 
 #include "Keymaster.h"
-#include "Operation.h"
 
 namespace android::hardware::keymaster::V4_1::support {
 
@@ -171,20 +170,6 @@
         return ErrorCode::UNIMPLEMENTED;
     }
 
-    Return<void> beginOp(KeyPurpose purpose, const hidl_vec<uint8_t>& keyBlob,
-                         const hidl_vec<KeyParameter>& inParams, const HardwareAuthToken& authToken,
-                         beginOp_cb _hidl_cb) override {
-        if (km4_1_dev_) return km4_1_dev_->beginOp(purpose, keyBlob, inParams, authToken, _hidl_cb);
-
-        return km4_0_dev_->begin(
-                purpose, keyBlob, inParams, authToken,
-                [&_hidl_cb](V4_0::ErrorCode errorCode, const hidl_vec<KeyParameter>& outParams,
-                            OperationHandle operationHandle) {
-                    _hidl_cb(static_cast<ErrorCode>(errorCode), outParams,
-                             new Operation(operationHandle));
-                });
-    }
-
   private:
     void getVersionIfNeeded();
 
diff --git a/keymaster/4.1/support/include/keymasterV4_1/Operation.h b/keymaster/4.1/support/include/keymasterV4_1/Operation.h
deleted file mode 100644
index 902d49a..0000000
--- a/keymaster/4.1/support/include/keymasterV4_1/Operation.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- ** Copyright 2020, The Android Open Source Project
- **
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- **
- **     http://www.apache.org/licenses/LICENSE-2.0
- **
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
- */
-
-#pragma once
-
-#include <android/hardware/keymaster/4.1/IOperation.h>
-
-#include <keymasterV4_1/keymaster_tags.h>
-
-namespace android::hardware::keymaster::V4_1::support {
-
-class Operation : public IOperation {
-  public:
-    Operation(OperationHandle handle) : handle_(handle) {}
-
-    Return<void> getOperationChallenge(getOperationChallenge_cb _hidl_cb) override {
-        _hidl_cb(V4_1::ErrorCode::OK, handle_);
-        return Void();
-    }
-
-  private:
-    OperationHandle handle_;
-};
-
-}  // namespace android::hardware::keymaster::V4_1::support