Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 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 | |
Marco Nelissen | 38b9c52 | 2014-11-17 15:24:21 -0800 | [diff] [blame] | 17 | #define LOG_TAG "IInterface" |
| 18 | #include <utils/Log.h> |
Martijn Coenen | 4080edc | 2016-05-04 14:17:02 +0200 | [diff] [blame] | 19 | #include <hwbinder/IInterface.h> |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 20 | |
| 21 | namespace android { |
Martijn Coenen | f75a23d | 2016-08-01 11:55:17 +0200 | [diff] [blame^] | 22 | namespace hardware { |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 23 | |
| 24 | // --------------------------------------------------------------------------- |
| 25 | |
Mathias Agopian | a6286c3 | 2009-05-22 19:00:22 -0700 | [diff] [blame] | 26 | IInterface::IInterface() |
| 27 | : RefBase() { |
| 28 | } |
| 29 | |
| 30 | IInterface::~IInterface() { |
| 31 | } |
| 32 | |
Marco Nelissen | 461a672 | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 33 | // static |
| 34 | sp<IBinder> IInterface::asBinder(const IInterface* iface) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 35 | { |
Marco Nelissen | 461a672 | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 36 | if (iface == NULL) return NULL; |
| 37 | return const_cast<IInterface*>(iface)->onAsBinder(); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 38 | } |
| 39 | |
Marco Nelissen | 461a672 | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 40 | // static |
| 41 | sp<IBinder> IInterface::asBinder(const sp<IInterface>& iface) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 42 | { |
Marco Nelissen | 461a672 | 2014-11-14 08:01:01 -0800 | [diff] [blame] | 43 | if (iface == NULL) return NULL; |
| 44 | return iface->onAsBinder(); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Marco Nelissen | 38b9c52 | 2014-11-17 15:24:21 -0800 | [diff] [blame] | 47 | |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 48 | // --------------------------------------------------------------------------- |
| 49 | |
Martijn Coenen | f75a23d | 2016-08-01 11:55:17 +0200 | [diff] [blame^] | 50 | }; // namespace hardware |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 51 | }; // namespace android |