Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | |
| 17 | #include <stdint.h> |
| 18 | #include <sys/types.h> |
| 19 | |
| 20 | #include <media/IRemoteDisplay.h> |
| 21 | |
| 22 | namespace android { |
| 23 | |
| 24 | enum { |
Jeff Brown | ced24b3 | 2012-09-05 17:48:03 -0700 | [diff] [blame^] | 25 | DISPOSE = IBinder::FIRST_CALL_TRANSACTION, |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | class BpRemoteDisplay: public BpInterface<IRemoteDisplay> |
| 29 | { |
| 30 | public: |
| 31 | BpRemoteDisplay(const sp<IBinder>& impl) |
| 32 | : BpInterface<IRemoteDisplay>(impl) |
| 33 | { |
| 34 | } |
| 35 | |
Jeff Brown | ced24b3 | 2012-09-05 17:48:03 -0700 | [diff] [blame^] | 36 | status_t dispose() |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 37 | { |
| 38 | Parcel data, reply; |
| 39 | data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor()); |
Jeff Brown | ced24b3 | 2012-09-05 17:48:03 -0700 | [diff] [blame^] | 40 | remote()->transact(DISPOSE, data, &reply); |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 41 | return reply.readInt32(); |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | IMPLEMENT_META_INTERFACE(RemoteDisplay, "android.media.IRemoteDisplay"); |
| 46 | |
| 47 | // ---------------------------------------------------------------------- |
| 48 | |
| 49 | status_t BnRemoteDisplay::onTransact( |
| 50 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
| 51 | { |
| 52 | switch (code) { |
Jeff Brown | ced24b3 | 2012-09-05 17:48:03 -0700 | [diff] [blame^] | 53 | case DISPOSE: { |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 54 | CHECK_INTERFACE(IRemoteDisplay, data, reply); |
Jeff Brown | ced24b3 | 2012-09-05 17:48:03 -0700 | [diff] [blame^] | 55 | reply->writeInt32(dispose()); |
Jeff Brown | 2013a54 | 2012-09-04 21:38:42 -0700 | [diff] [blame] | 56 | return NO_ERROR; |
| 57 | } |
| 58 | default: |
| 59 | return BBinder::onTransact(code, data, reply, flags); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | }; // namespace android |