IInputFlinger.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2013 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <stdint.h>
  17. #include <sys/types.h>
  18. #include <binder/Parcel.h>
  19. #include <binder/IPCThreadState.h>
  20. #include <binder/IServiceManager.h>
  21. #include <input/IInputFlinger.h>
  22. namespace android {
  23. class BpInputFlinger : public BpInterface<IInputFlinger> {
  24. public:
  25. BpInputFlinger(const sp<IBinder>& impl) :
  26. BpInterface<IInputFlinger>(impl) { }
  27. virtual status_t doSomething() {
  28. Parcel data, reply;
  29. data.writeInterfaceToken(IInputFlinger::getInterfaceDescriptor());
  30. remote()->transact(BnInputFlinger::DO_SOMETHING_TRANSACTION, data, &reply);
  31. return reply.readInt32();
  32. }
  33. };
  34. IMPLEMENT_META_INTERFACE(InputFlinger, "android.input.IInputFlinger");
  35. status_t BnInputFlinger::onTransact(
  36. uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {
  37. switch(code) {
  38. case DO_SOMETHING_TRANSACTION: {
  39. CHECK_INTERFACE(IInputFlinger, data, reply);
  40. reply->writeInt32(0);
  41. break;
  42. }
  43. default:
  44. return BBinder::onTransact(code, data, reply, flags);
  45. }
  46. return NO_ERROR;
  47. }
  48. };