Revert "Add Delegator support to NDK backend"

This reverts commit e21b57a6ceac65c5ad1632b80c68316f5943428a.

Reason for revert: Possible culprit of b/217556894

Change-Id: I0e2ae5a3ddb50aab283c29bc189d1101769243c1
diff --git a/Android.bp b/Android.bp
index 0fc4256..dbaf05e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -426,7 +426,6 @@
         "libbinder_ndk",
     ],
     srcs: [
-        "tests/aidl_test_client_ndk_delegate.cpp",
         "tests/aidl_test_client_ndk_loggable_interface.cpp",
         "tests/aidl_test_client_ndk_nested.cpp",
         "tests/aidl_test_client_ndk_nullables.cpp",
diff --git a/generate_ndk.cpp b/generate_ndk.cpp
index 8a44854..d7b6663 100644
--- a/generate_ndk.cpp
+++ b/generate_ndk.cpp
@@ -980,62 +980,6 @@
   LeaveNdkNamespace(out, defined_type);
 }
 
-void GenerateDelegatorClassDecl(CodeWriter& out, const AidlTypenames& types,
-                                const AidlInterface& defined_type, const Options& options) {
-  const std::string clazz = ClassName(defined_type, ClassNames::DELEGATOR_IMPL);
-  const std::string iface = ClassName(defined_type, ClassNames::INTERFACE);
-  const std::string bn_name = ClassName(defined_type, ClassNames::SERVER);
-  const std::string kDelegateImplVarName = "_impl";
-  const std::string kStatusType = "::ndk::ScopedAStatus";
-
-  out << "class";
-  cpp::GenerateDeprecated(out, defined_type);
-  out << " " << clazz << " : public " << bn_name << " {\n";
-  out << "public:\n";
-  out.Indent();
-  out << "explicit " << clazz << "(const std::shared_ptr<" << iface << "> &impl)"
-      << " : " << kDelegateImplVarName << "(impl) {}\n\n";
-  for (const auto& method : defined_type.GetMethods()) {
-    if (method->IsUserDefined()) {
-      out << kStatusType << " " << method->GetName() << "("
-          << NdkArgList(types, *method, FormatArgForDecl) << ") override";
-      cpp::GenerateDeprecated(out, *method);
-      out << " {\n"
-          << "  return " << kDelegateImplVarName << "->" << method->GetName() << "("
-          << NdkArgList(types, *method, FormatArgNameOnly) << ");\n";
-      out << "}\n";
-    } else {
-      if (method->GetName() == kGetInterfaceVersion && options.Version() > 0) {
-        out << kStatusType << " " << kGetInterfaceVersion << "(int32_t *aidl_return) override {\n"
-            << "  int32_t _delegator_ver  = " << iface << "::" << kVersion << ";\n"
-            << "  int32_t _impl_ver = 0;\n"
-            << "  " << kStatusType << " _ret = " << kDelegateImplVarName << "->"
-            << kGetInterfaceVersion << "(&_impl_ver);\n"
-            << "  if (!_ret.isOk()) return _ret;\n"
-            << "  *aidl_return = _delegator_ver < _impl_ver ? _delegator_ver : _impl_ver;\n"
-            << "  return _ret;\n"
-            << "}\n";
-      } else if (method->GetName() == kGetInterfaceHash && !options.Hash().empty()) {
-        out << kStatusType << " " << kGetInterfaceHash << "(std::string *aidl_return) override {\n"
-            << "  return " << kDelegateImplVarName << "->" << kGetInterfaceHash
-            << "(aidl_return);\n"
-            << "}\n";
-      } else {
-        AIDL_FATAL(defined_type) << "Meta method '" << method->GetName() << "' is unimplemented.";
-      }
-    }
-  }
-  out.Dedent();
-  out << "protected:\n";
-  out.Indent();
-  out.Dedent();
-  out << "private:\n";
-  out.Indent();
-  out << "std::shared_ptr<" << iface << "> " << kDelegateImplVarName << ";\n";
-  out.Dedent();
-  out << "};\n\n";
-}
-
 void GenerateServerClassDecl(CodeWriter& out, const AidlTypenames& types,
                              const AidlInterface& defined_type, const Options& options) {
   const std::string clazz = ClassName(defined_type, ClassNames::SERVER);
@@ -1055,9 +999,9 @@
       continue;
     }
     if (method->GetName() == kGetInterfaceVersion && options.Version() > 0) {
-      out << NdkMethodDecl(types, *method) << ";\n";
+      out << NdkMethodDecl(types, *method) << " final;\n";
     } else if (method->GetName() == kGetInterfaceHash && !options.Hash().empty()) {
-      out << NdkMethodDecl(types, *method) << ";\n";
+      out << NdkMethodDecl(types, *method) << " final;\n";
     } else {
       AIDL_FATAL(defined_type) << "Meta method '" << method->GetName() << "' is unimplemented.";
     }
@@ -1087,7 +1031,6 @@
   out << "\n";
   EnterNdkNamespace(out, defined_type);
   GenerateServerClassDecl(out, types, defined_type, options);
-  GenerateDelegatorClassDecl(out, types, defined_type, options);
   LeaveNdkNamespace(out, defined_type);
 }
 
diff --git a/tests/aidl_test_client_ndk_delegate.cpp b/tests/aidl_test_client_ndk_delegate.cpp
deleted file mode 100644
index 6bec01a..0000000
--- a/tests/aidl_test_client_ndk_delegate.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2022 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.
- */
-#include <android/binder_auto_utils.h>
-#include <android/binder_manager.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-#include <aidl/android/aidl/tests/BnTestService.h>
-#include <android-base/logging.h>
-
-using aidl::android::aidl::tests::BackendType;
-using aidl::android::aidl::tests::ITestService;
-using aidl::android::aidl::tests::ITestServiceDelegator;
-
-static constexpr int8_t kCustomByte = 8;
-
-struct CustomDelegator : public ITestServiceDelegator {
- public:
-  CustomDelegator(std::shared_ptr<ITestService>& impl) : ITestServiceDelegator(impl) {}
-
-  // Change RepeatByte to always return the same byte.
-  ndk::ScopedAStatus RepeatByte(int8_t /* token */, int8_t* _aidl_return) override {
-    *_aidl_return = kCustomByte;
-    return ndk::ScopedAStatus::ok();
-  }
-};
-
-struct AidlDelegatorTest : testing::Test {
-  template <typename T>
-  std::shared_ptr<T> getService() {
-    ndk::SpAIBinder binder = ndk::SpAIBinder(AServiceManager_getService(T::descriptor));
-    return T::fromBinder(binder);
-  }
-  void SetUp() override { service = getService<ITestService>(); }
-  std::shared_ptr<ITestService> service;
-};
-
-TEST_F(AidlDelegatorTest, SimpleDelegator) {
-  auto delegator = ndk::SharedRefBase::make<ITestServiceDelegator>(service);
-  int8_t returned_value;
-  auto status = delegator->RepeatByte(12, &returned_value);
-  ASSERT_TRUE(status.isOk()) << status.getMessage();
-  EXPECT_EQ(12, returned_value);
-}
-
-TEST_F(AidlDelegatorTest, CustomDelegator) {
-  auto delegator = ndk::SharedRefBase::make<CustomDelegator>(service);
-  int8_t returned_value;
-  auto status = delegator->RepeatByte(12, &returned_value);
-  ASSERT_TRUE(status.isOk()) << status.getMessage();
-  EXPECT_EQ(kCustomByte, returned_value);
-}
-
-TEST_F(AidlDelegatorTest, SendDelegator) {
-  auto delegator = ndk::SharedRefBase::make<ITestServiceDelegator>(service);
-  auto fromAsBinder = ITestServiceDelegator::fromBinder(delegator->asBinder());
-  // Make sure the delegator works after asBinder -> fromBinder conversions
-  int8_t returned_value = 0;
-  auto status = fromAsBinder->RepeatByte(12, &returned_value);
-  ASSERT_TRUE(status.isOk()) << status.getDescription();
-  EXPECT_EQ(12, returned_value);
-}
diff --git a/tests/aidl_test_client_ndk_versioned_interface.cpp b/tests/aidl_test_client_ndk_versioned_interface.cpp
index e21c8a0..97da834 100644
--- a/tests/aidl_test_client_ndk_versioned_interface.cpp
+++ b/tests/aidl_test_client_ndk_versioned_interface.cpp
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#include <aidl/android/aidl/versioned/tests/BnFooInterface.h>
 #include <aidl/android/aidl/versioned/tests/IFooInterface.h>
+
 #include <android/binder_auto_utils.h>
 #include <android/binder_manager.h>
 #include <gmock/gmock.h>
@@ -24,7 +24,6 @@
 using aidl::android::aidl::versioned::tests::BazUnion;
 using aidl::android::aidl::versioned::tests::Foo;
 using aidl::android::aidl::versioned::tests::IFooInterface;
-using aidl::android::aidl::versioned::tests::IFooInterfaceDelegator;
 using std::optional;
 using std::pair;
 using std::shared_ptr;
@@ -73,18 +72,4 @@
   EXPECT_EQ(43, ret);
   EXPECT_EQ(0, inoutFoo.intDefault42);
   EXPECT_EQ(0, outFoo.intDefault42);
-}
-
-TEST_F(VersionedInterfaceTest, newerDelegatorReturnsImplVersion) {
-  auto delegator = ndk::SharedRefBase::make<IFooInterfaceDelegator>(versioned);
-  int32_t version = 0;
-  EXPECT_TRUE(delegator->getInterfaceVersion(&version).isOk());
-  EXPECT_EQ(1, version);
-}
-
-TEST_F(VersionedInterfaceTest, newerDelegatorReturnsImplHash) {
-  auto delegator = ndk::SharedRefBase::make<IFooInterfaceDelegator>(versioned);
-  std::string hash;
-  EXPECT_TRUE(delegator->getInterfaceHash(&hash).isOk());
-  EXPECT_EQ("9e7be1859820c59d9d55dd133e71a3687b5d2e5b", hash);
-}
+}
\ No newline at end of file
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnDeprecated.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnDeprecated.h
index 48da333..0b6f042 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnDeprecated.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnDeprecated.h
@@ -16,15 +16,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class __attribute__((deprecated("test"))) IDeprecatedDelegator : public BnDeprecated {
-public:
-  explicit IDeprecatedDelegator(const std::shared_ptr<IDeprecated> &impl) : _impl(impl) {}
-
-protected:
-private:
-  std::shared_ptr<IDeprecated> _impl;
-};
-
 }  // namespace tests
 }  // namespace aidl
 }  // namespace android
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNamedCallback.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNamedCallback.h
index 310a837..6f38a28 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNamedCallback.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNamedCallback.h
@@ -16,18 +16,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class INamedCallbackDelegator : public BnNamedCallback {
-public:
-  explicit INamedCallbackDelegator(const std::shared_ptr<INamedCallback> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus GetName(std::string* _aidl_return) override {
-    return _impl->GetName(_aidl_return);
-  }
-protected:
-private:
-  std::shared_ptr<INamedCallback> _impl;
-};
-
 }  // namespace tests
 }  // namespace aidl
 }  // namespace android
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNewName.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNewName.h
index b7118c8..32d8a7b 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNewName.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnNewName.h
@@ -16,18 +16,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class INewNameDelegator : public BnNewName {
-public:
-  explicit INewNameDelegator(const std::shared_ptr<INewName> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus RealName(std::string* _aidl_return) override {
-    return _impl->RealName(_aidl_return);
-  }
-protected:
-private:
-  std::shared_ptr<INewName> _impl;
-};
-
 }  // namespace tests
 }  // namespace aidl
 }  // namespace android
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnOldName.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnOldName.h
index 4e2ad8e..e1782d1 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnOldName.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnOldName.h
@@ -16,18 +16,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class IOldNameDelegator : public BnOldName {
-public:
-  explicit IOldNameDelegator(const std::shared_ptr<IOldName> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus RealName(std::string* _aidl_return) override {
-    return _impl->RealName(_aidl_return);
-  }
-protected:
-private:
-  std::shared_ptr<IOldName> _impl;
-};
-
 }  // namespace tests
 }  // namespace aidl
 }  // namespace android
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnTestService.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnTestService.h
index dfd86b3..a33592b 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnTestService.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/BnTestService.h
@@ -16,210 +16,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class ITestServiceDelegator : public BnTestService {
-public:
-  explicit ITestServiceDelegator(const std::shared_ptr<ITestService> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus UnimplementedMethod(int32_t in_arg, int32_t* _aidl_return) override {
-    return _impl->UnimplementedMethod(in_arg, _aidl_return);
-  }
-  ::ndk::ScopedAStatus Deprecated() override __attribute__((deprecated("to make sure we have something in system/tools/aidl which does a compile check of deprecated and make sure this is reflected in goldens"))) {
-    return _impl->Deprecated();
-  }
-  ::ndk::ScopedAStatus TestOneway() override {
-    return _impl->TestOneway();
-  }
-  ::ndk::ScopedAStatus RepeatBoolean(bool in_token, bool* _aidl_return) override {
-    return _impl->RepeatBoolean(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatByte(int8_t in_token, int8_t* _aidl_return) override {
-    return _impl->RepeatByte(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatChar(char16_t in_token, char16_t* _aidl_return) override {
-    return _impl->RepeatChar(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatInt(int32_t in_token, int32_t* _aidl_return) override {
-    return _impl->RepeatInt(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatLong(int64_t in_token, int64_t* _aidl_return) override {
-    return _impl->RepeatLong(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatFloat(float in_token, float* _aidl_return) override {
-    return _impl->RepeatFloat(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatDouble(double in_token, double* _aidl_return) override {
-    return _impl->RepeatDouble(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatString(const std::string& in_token, std::string* _aidl_return) override {
-    return _impl->RepeatString(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatByteEnum(::aidl::android::aidl::tests::ByteEnum in_token, ::aidl::android::aidl::tests::ByteEnum* _aidl_return) override {
-    return _impl->RepeatByteEnum(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatIntEnum(::aidl::android::aidl::tests::IntEnum in_token, ::aidl::android::aidl::tests::IntEnum* _aidl_return) override {
-    return _impl->RepeatIntEnum(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatLongEnum(::aidl::android::aidl::tests::LongEnum in_token, ::aidl::android::aidl::tests::LongEnum* _aidl_return) override {
-    return _impl->RepeatLongEnum(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseBoolean(const std::vector<bool>& in_input, std::vector<bool>* out_repeated, std::vector<bool>* _aidl_return) override {
-    return _impl->ReverseBoolean(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseByte(const std::vector<uint8_t>& in_input, std::vector<uint8_t>* out_repeated, std::vector<uint8_t>* _aidl_return) override {
-    return _impl->ReverseByte(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseChar(const std::vector<char16_t>& in_input, std::vector<char16_t>* out_repeated, std::vector<char16_t>* _aidl_return) override {
-    return _impl->ReverseChar(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseInt(const std::vector<int32_t>& in_input, std::vector<int32_t>* out_repeated, std::vector<int32_t>* _aidl_return) override {
-    return _impl->ReverseInt(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseLong(const std::vector<int64_t>& in_input, std::vector<int64_t>* out_repeated, std::vector<int64_t>* _aidl_return) override {
-    return _impl->ReverseLong(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseFloat(const std::vector<float>& in_input, std::vector<float>* out_repeated, std::vector<float>* _aidl_return) override {
-    return _impl->ReverseFloat(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseDouble(const std::vector<double>& in_input, std::vector<double>* out_repeated, std::vector<double>* _aidl_return) override {
-    return _impl->ReverseDouble(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseString(const std::vector<std::string>& in_input, std::vector<std::string>* out_repeated, std::vector<std::string>* _aidl_return) override {
-    return _impl->ReverseString(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseByteEnum(const std::vector<::aidl::android::aidl::tests::ByteEnum>& in_input, std::vector<::aidl::android::aidl::tests::ByteEnum>* out_repeated, std::vector<::aidl::android::aidl::tests::ByteEnum>* _aidl_return) override {
-    return _impl->ReverseByteEnum(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseIntEnum(const std::vector<::aidl::android::aidl::tests::IntEnum>& in_input, std::vector<::aidl::android::aidl::tests::IntEnum>* out_repeated, std::vector<::aidl::android::aidl::tests::IntEnum>* _aidl_return) override {
-    return _impl->ReverseIntEnum(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseLongEnum(const std::vector<::aidl::android::aidl::tests::LongEnum>& in_input, std::vector<::aidl::android::aidl::tests::LongEnum>* out_repeated, std::vector<::aidl::android::aidl::tests::LongEnum>* _aidl_return) override {
-    return _impl->ReverseLongEnum(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus GetOtherTestService(const std::string& in_name, std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>* _aidl_return) override {
-    return _impl->GetOtherTestService(in_name, _aidl_return);
-  }
-  ::ndk::ScopedAStatus VerifyName(const std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>& in_service, const std::string& in_name, bool* _aidl_return) override {
-    return _impl->VerifyName(in_service, in_name, _aidl_return);
-  }
-  ::ndk::ScopedAStatus GetInterfaceArray(const std::vector<std::string>& in_names, std::vector<std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>>* _aidl_return) override {
-    return _impl->GetInterfaceArray(in_names, _aidl_return);
-  }
-  ::ndk::ScopedAStatus VerifyNamesWithInterfaceArray(const std::vector<std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>>& in_services, const std::vector<std::string>& in_names, bool* _aidl_return) override {
-    return _impl->VerifyNamesWithInterfaceArray(in_services, in_names, _aidl_return);
-  }
-  ::ndk::ScopedAStatus GetNullableInterfaceArray(const std::optional<std::vector<std::optional<std::string>>>& in_names, std::optional<std::vector<std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>>>* _aidl_return) override {
-    return _impl->GetNullableInterfaceArray(in_names, _aidl_return);
-  }
-  ::ndk::ScopedAStatus VerifyNamesWithNullableInterfaceArray(const std::optional<std::vector<std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>>>& in_services, const std::optional<std::vector<std::optional<std::string>>>& in_names, bool* _aidl_return) override {
-    return _impl->VerifyNamesWithNullableInterfaceArray(in_services, in_names, _aidl_return);
-  }
-  ::ndk::ScopedAStatus GetInterfaceList(const std::optional<std::vector<std::optional<std::string>>>& in_names, std::optional<std::vector<std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>>>* _aidl_return) override {
-    return _impl->GetInterfaceList(in_names, _aidl_return);
-  }
-  ::ndk::ScopedAStatus VerifyNamesWithInterfaceList(const std::optional<std::vector<std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>>>& in_services, const std::optional<std::vector<std::optional<std::string>>>& in_names, bool* _aidl_return) override {
-    return _impl->VerifyNamesWithInterfaceList(in_services, in_names, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseStringList(const std::vector<std::string>& in_input, std::vector<std::string>* out_repeated, std::vector<std::string>* _aidl_return) override {
-    return _impl->ReverseStringList(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatParcelFileDescriptor(const ::ndk::ScopedFileDescriptor& in_read, ::ndk::ScopedFileDescriptor* _aidl_return) override {
-    return _impl->RepeatParcelFileDescriptor(in_read, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseParcelFileDescriptorArray(const std::vector<::ndk::ScopedFileDescriptor>& in_input, std::vector<::ndk::ScopedFileDescriptor>* out_repeated, std::vector<::ndk::ScopedFileDescriptor>* _aidl_return) override {
-    return _impl->ReverseParcelFileDescriptorArray(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ThrowServiceException(int32_t in_code) override {
-    return _impl->ThrowServiceException(in_code);
-  }
-  ::ndk::ScopedAStatus RepeatNullableIntArray(const std::optional<std::vector<int32_t>>& in_input, std::optional<std::vector<int32_t>>* _aidl_return) override {
-    return _impl->RepeatNullableIntArray(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableByteEnumArray(const std::optional<std::vector<::aidl::android::aidl::tests::ByteEnum>>& in_input, std::optional<std::vector<::aidl::android::aidl::tests::ByteEnum>>* _aidl_return) override {
-    return _impl->RepeatNullableByteEnumArray(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableIntEnumArray(const std::optional<std::vector<::aidl::android::aidl::tests::IntEnum>>& in_input, std::optional<std::vector<::aidl::android::aidl::tests::IntEnum>>* _aidl_return) override {
-    return _impl->RepeatNullableIntEnumArray(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableLongEnumArray(const std::optional<std::vector<::aidl::android::aidl::tests::LongEnum>>& in_input, std::optional<std::vector<::aidl::android::aidl::tests::LongEnum>>* _aidl_return) override {
-    return _impl->RepeatNullableLongEnumArray(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableString(const std::optional<std::string>& in_input, std::optional<std::string>* _aidl_return) override {
-    return _impl->RepeatNullableString(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableStringList(const std::optional<std::vector<std::optional<std::string>>>& in_input, std::optional<std::vector<std::optional<std::string>>>* _aidl_return) override {
-    return _impl->RepeatNullableStringList(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableParcelable(const std::optional<::aidl::android::aidl::tests::ITestService::Empty>& in_input, std::optional<::aidl::android::aidl::tests::ITestService::Empty>* _aidl_return) override {
-    return _impl->RepeatNullableParcelable(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableParcelableArray(const std::optional<std::vector<std::optional<::aidl::android::aidl::tests::ITestService::Empty>>>& in_input, std::optional<std::vector<std::optional<::aidl::android::aidl::tests::ITestService::Empty>>>* _aidl_return) override {
-    return _impl->RepeatNullableParcelableArray(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableParcelableList(const std::optional<std::vector<std::optional<::aidl::android::aidl::tests::ITestService::Empty>>>& in_input, std::optional<std::vector<std::optional<::aidl::android::aidl::tests::ITestService::Empty>>>* _aidl_return) override {
-    return _impl->RepeatNullableParcelableList(in_input, _aidl_return);
-  }
-  ::ndk::ScopedAStatus TakesAnIBinder(const ::ndk::SpAIBinder& in_input) override {
-    return _impl->TakesAnIBinder(in_input);
-  }
-  ::ndk::ScopedAStatus TakesANullableIBinder(const ::ndk::SpAIBinder& in_input) override {
-    return _impl->TakesANullableIBinder(in_input);
-  }
-  ::ndk::ScopedAStatus TakesAnIBinderList(const std::vector<::ndk::SpAIBinder>& in_input) override {
-    return _impl->TakesAnIBinderList(in_input);
-  }
-  ::ndk::ScopedAStatus TakesANullableIBinderList(const std::optional<std::vector<::ndk::SpAIBinder>>& in_input) override {
-    return _impl->TakesANullableIBinderList(in_input);
-  }
-  ::ndk::ScopedAStatus RepeatUtf8CppString(const std::string& in_token, std::string* _aidl_return) override {
-    return _impl->RepeatUtf8CppString(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus RepeatNullableUtf8CppString(const std::optional<std::string>& in_token, std::optional<std::string>* _aidl_return) override {
-    return _impl->RepeatNullableUtf8CppString(in_token, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseUtf8CppString(const std::vector<std::string>& in_input, std::vector<std::string>* out_repeated, std::vector<std::string>* _aidl_return) override {
-    return _impl->ReverseUtf8CppString(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseNullableUtf8CppString(const std::optional<std::vector<std::optional<std::string>>>& in_input, std::optional<std::vector<std::optional<std::string>>>* out_repeated, std::optional<std::vector<std::optional<std::string>>>* _aidl_return) override {
-    return _impl->ReverseNullableUtf8CppString(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseUtf8CppStringList(const std::optional<std::vector<std::optional<std::string>>>& in_input, std::optional<std::vector<std::optional<std::string>>>* out_repeated, std::optional<std::vector<std::optional<std::string>>>* _aidl_return) override {
-    return _impl->ReverseUtf8CppStringList(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus GetCallback(bool in_return_null, std::shared_ptr<::aidl::android::aidl::tests::INamedCallback>* _aidl_return) override {
-    return _impl->GetCallback(in_return_null, _aidl_return);
-  }
-  ::ndk::ScopedAStatus FillOutStructuredParcelable(::aidl::android::aidl::tests::StructuredParcelable* in_parcel) override {
-    return _impl->FillOutStructuredParcelable(in_parcel);
-  }
-  ::ndk::ScopedAStatus RepeatExtendableParcelable(const ::aidl::android::aidl::tests::extension::ExtendableParcelable& in_ep, ::aidl::android::aidl::tests::extension::ExtendableParcelable* out_ep2) override {
-    return _impl->RepeatExtendableParcelable(in_ep, out_ep2);
-  }
-  ::ndk::ScopedAStatus ReverseList(const ::aidl::android::aidl::tests::RecursiveList& in_list, ::aidl::android::aidl::tests::RecursiveList* _aidl_return) override {
-    return _impl->ReverseList(in_list, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseIBinderArray(const std::vector<::ndk::SpAIBinder>& in_input, std::vector<::ndk::SpAIBinder>* out_repeated, std::vector<::ndk::SpAIBinder>* _aidl_return) override {
-    return _impl->ReverseIBinderArray(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus ReverseNullableIBinderArray(const std::optional<std::vector<::ndk::SpAIBinder>>& in_input, std::optional<std::vector<::ndk::SpAIBinder>>* out_repeated, std::optional<std::vector<::ndk::SpAIBinder>>* _aidl_return) override {
-    return _impl->ReverseNullableIBinderArray(in_input, out_repeated, _aidl_return);
-  }
-  ::ndk::ScopedAStatus GetOldNameInterface(std::shared_ptr<::aidl::android::aidl::tests::IOldName>* _aidl_return) override {
-    return _impl->GetOldNameInterface(_aidl_return);
-  }
-  ::ndk::ScopedAStatus GetNewNameInterface(std::shared_ptr<::aidl::android::aidl::tests::INewName>* _aidl_return) override {
-    return _impl->GetNewNameInterface(_aidl_return);
-  }
-  ::ndk::ScopedAStatus GetCppJavaTests(::ndk::SpAIBinder* _aidl_return) override {
-    return _impl->GetCppJavaTests(_aidl_return);
-  }
-  ::ndk::ScopedAStatus getBackendType(::aidl::android::aidl::tests::BackendType* _aidl_return) override {
-    return _impl->getBackendType(_aidl_return);
-  }
-protected:
-private:
-  std::shared_ptr<ITestService> _impl;
-};
-
 }  // namespace tests
 }  // namespace aidl
 }  // namespace android
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/nested/BnNestedService.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/nested/BnNestedService.h
index b6ea332..98ec330 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/nested/BnNestedService.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/nested/BnNestedService.h
@@ -17,21 +17,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class INestedServiceDelegator : public BnNestedService {
-public:
-  explicit INestedServiceDelegator(const std::shared_ptr<INestedService> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus flipStatus(const ::aidl::android::aidl::tests::nested::ParcelableWithNested& in_p, ::aidl::android::aidl::tests::nested::INestedService::Result* _aidl_return) override {
-    return _impl->flipStatus(in_p, _aidl_return);
-  }
-  ::ndk::ScopedAStatus flipStatusWithCallback(::aidl::android::aidl::tests::nested::ParcelableWithNested::Status in_status, const std::shared_ptr<::aidl::android::aidl::tests::nested::INestedService::ICallback>& in_cb) override {
-    return _impl->flipStatusWithCallback(in_status, in_cb);
-  }
-protected:
-private:
-  std::shared_ptr<INestedService> _impl;
-};
-
 }  // namespace nested
 }  // namespace tests
 }  // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtected.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtected.h
index 3a8674f..150c5b8 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtected.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtected.h
@@ -17,24 +17,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class IProtectedDelegator : public BnProtected {
-public:
-  explicit IProtectedDelegator(const std::shared_ptr<IProtected> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus PermissionProtected() override {
-    return _impl->PermissionProtected();
-  }
-  ::ndk::ScopedAStatus MultiplePermissionsAll() override {
-    return _impl->MultiplePermissionsAll();
-  }
-  ::ndk::ScopedAStatus MultiplePermissionsAny() override {
-    return _impl->MultiplePermissionsAny();
-  }
-protected:
-private:
-  std::shared_ptr<IProtected> _impl;
-};
-
 }  // namespace permission
 }  // namespace tests
 }  // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtectedInterface.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtectedInterface.h
index 16cc53e..ac2a46c 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtectedInterface.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtectedInterface.h
@@ -17,21 +17,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class IProtectedInterfaceDelegator : public BnProtectedInterface {
-public:
-  explicit IProtectedInterfaceDelegator(const std::shared_ptr<IProtectedInterface> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus Method1() override {
-    return _impl->Method1();
-  }
-  ::ndk::ScopedAStatus Method2() override {
-    return _impl->Method2();
-  }
-protected:
-private:
-  std::shared_ptr<IProtectedInterface> _impl;
-};
-
 }  // namespace permission
 }  // namespace tests
 }  // namespace aidl
diff --git a/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/BnLoggableInterface.h b/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/BnLoggableInterface.h
index 2ae567f..650ca86 100644
--- a/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/BnLoggableInterface.h
+++ b/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/BnLoggableInterface.h
@@ -31,18 +31,6 @@
   ::ndk::SpAIBinder createBinder() override;
 private:
 };
-class ILoggableInterfaceDelegator : public BnLoggableInterface {
-public:
-  explicit ILoggableInterfaceDelegator(const std::shared_ptr<ILoggableInterface> &impl) : _impl(impl) {}
-
-  ::ndk::ScopedAStatus LogThis(bool in_boolValue, std::vector<bool>* in_boolArray, int8_t in_byteValue, std::vector<uint8_t>* in_byteArray, char16_t in_charValue, std::vector<char16_t>* in_charArray, int32_t in_intValue, std::vector<int32_t>* in_intArray, int64_t in_longValue, std::vector<int64_t>* in_longArray, float in_floatValue, std::vector<float>* in_floatArray, double in_doubleValue, std::vector<double>* in_doubleArray, const std::string& in_stringValue, std::vector<std::string>* in_stringArray, std::vector<std::string>* in_listValue, const ::aidl::android::aidl::loggable::Data& in_dataValue, const ::ndk::SpAIBinder& in_binderValue, ::ndk::ScopedFileDescriptor* in_pfdValue, std::vector<::ndk::ScopedFileDescriptor>* in_pfdArray, std::vector<std::string>* _aidl_return) override {
-    return _impl->LogThis(in_boolValue, in_boolArray, in_byteValue, in_byteArray, in_charValue, in_charArray, in_intValue, in_intArray, in_longValue, in_longArray, in_floatValue, in_floatArray, in_doubleValue, in_doubleArray, in_stringValue, in_stringArray, in_listValue, in_dataValue, in_binderValue, in_pfdValue, in_pfdArray, _aidl_return);
-  }
-protected:
-private:
-  std::shared_ptr<ILoggableInterface> _impl;
-};
-
 }  // namespace loggable
 }  // namespace aidl
 }  // namespace android