IInterface.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2005 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. #define LOG_TAG "hw-IInterface"
  17. #include <utils/Log.h>
  18. #include <hwbinder/IInterface.h>
  19. namespace android {
  20. namespace hardware {
  21. // ---------------------------------------------------------------------------
  22. IInterface::IInterface()
  23. : RefBase() {
  24. }
  25. IInterface::~IInterface() {
  26. }
  27. // static
  28. sp<IBinder> IInterface::asBinder(const IInterface* iface)
  29. {
  30. if (iface == nullptr) return nullptr;
  31. return const_cast<IInterface*>(iface)->onAsBinder();
  32. }
  33. // static
  34. sp<IBinder> IInterface::asBinder(const sp<IInterface>& iface)
  35. {
  36. if (iface == nullptr) return nullptr;
  37. return iface->onAsBinder();
  38. }
  39. // ---------------------------------------------------------------------------
  40. }; // namespace hardware
  41. }; // namespace android