aboutsummaryrefslogtreecommitdiff
path: root/tests/golden_output/aidl-test-interface-cpp-analyzer-source/gen/android/aidl/tests/nested/INestedService.cpp
blob: 1b39506f65adc6a61c247f1982ba1b05339437b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <iostream>
#include <binder/Parcel.h>
#include <android/binder_to_string.h>
#include <android/aidl/tests/nested/INestedService.h>
namespace {
android::status_t analyzeINestedService(uint32_t _aidl_code, const android::Parcel& _aidl_data, const android::Parcel& _aidl_reply) {
  android::status_t _aidl_ret_status;
  switch(_aidl_code) {
    case ::android::IBinder::FIRST_CALL_TRANSACTION + 0:
    {
      std::cout << "INestedService.flipStatus()" << std::endl;
      _aidl_ret_status = ::android::OK;
      if (!(_aidl_data.enforceInterface(android::String16("android.aidl.tests.nested.INestedService")))) {
        _aidl_ret_status = ::android::BAD_TYPE;
        std::cout << "  Failure: Parcel interface does not match." << std::endl;
        break;
      }
      ::android::aidl::tests::nested::ParcelableWithNested in_p;
      ::android::binder::Status binderStatus;
      binderStatus.readFromParcel(_aidl_reply);
      ::android::aidl::tests::nested::INestedService::Result _aidl_return;
      bool returnError = false;
      _aidl_ret_status = _aidl_reply.readParcelable(&_aidl_return);
      if (((_aidl_ret_status) != (android::NO_ERROR))) {
        std::cerr << "Failure: error in reading return value from Parcel." << std::endl;
        returnError = true;
      }
      do { // Single-pass loop to break if argument reading fails
        _aidl_ret_status = _aidl_data.readParcelable(&in_p);
        if (((_aidl_ret_status) != (android::NO_ERROR))) {
          std::cerr << "Failure: error in reading argument p from Parcel." << std::endl;
          break;
        }
      } while(false);
      if (!_aidl_data.enforceNoDataAvail().isOk()) {
        _aidl_ret_status = android::BAD_VALUE;
        std::cout << "  Failure: Parcel has too much data." << std::endl;
        break;
      }
      std::cout << "  arguments: " << std::endl;
      std::cout << "    p: " << ::android::internal::ToString(in_p) << std::endl;
      if (returnError) {
        std::cout << "  return: <error>" << std::endl;
      } else {std::cout << "  return: " << ::android::internal::ToString(_aidl_return) << std::endl;
      }
    }
    break;
    case ::android::IBinder::FIRST_CALL_TRANSACTION + 1:
    {
      std::cout << "INestedService.flipStatusWithCallback()" << std::endl;
      _aidl_ret_status = ::android::OK;
      if (!(_aidl_data.enforceInterface(android::String16("android.aidl.tests.nested.INestedService")))) {
        _aidl_ret_status = ::android::BAD_TYPE;
        std::cout << "  Failure: Parcel interface does not match." << std::endl;
        break;
      }
      ::android::aidl::tests::nested::ParcelableWithNested::Status in_status;
      ::android::sp<::android::aidl::tests::nested::INestedService::ICallback> in_cb;
      ::android::binder::Status binderStatus;
      binderStatus.readFromParcel(_aidl_reply);
      do { // Single-pass loop to break if argument reading fails
        _aidl_ret_status = _aidl_data.readByte(reinterpret_cast<int8_t *>(&in_status));
        if (((_aidl_ret_status) != (android::NO_ERROR))) {
          std::cerr << "Failure: error in reading argument status from Parcel." << std::endl;
          break;
        }
        _aidl_ret_status = _aidl_data.readStrongBinder(&in_cb);
        if (((_aidl_ret_status) != (android::NO_ERROR))) {
          std::cerr << "Failure: error in reading argument cb from Parcel." << std::endl;
          break;
        }
      } while(false);
      if (!_aidl_data.enforceNoDataAvail().isOk()) {
        _aidl_ret_status = android::BAD_VALUE;
        std::cout << "  Failure: Parcel has too much data." << std::endl;
        break;
      }
      std::cout << "  arguments: " << std::endl;
      std::cout << "    status: " << ::android::internal::ToString(in_status) << std::endl;
      std::cout << "    cb: " << ::android::internal::ToString(in_cb) << std::endl;
      std::cout << "  return: void" << std::endl;
    }
    break;
    default:
    {
      std::cout << "  Transaction code " << _aidl_code << " not known." << std::endl;
    _aidl_ret_status = android::UNKNOWN_TRANSACTION;
    }
  }
  return _aidl_ret_status;
  // To prevent unused variable warnings
  (void)_aidl_ret_status; (void)_aidl_data; (void)_aidl_reply;
}

} // namespace

#include <Analyzer.h>
using android::aidl::Analyzer;
__attribute__((constructor)) static void addAnalyzer() {
  Analyzer::installAnalyzer(std::make_unique<Analyzer>("android.aidl.tests.nested.INestedService", "INestedService", &analyzeINestedService));
}