Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 <storage/IObbActionListener.h> |
| 18 | #include <binder/Parcel.h> |
| 19 | |
| 20 | namespace android { |
| 21 | |
| 22 | enum { |
| 23 | TRANSACTION_onObbResult = IBinder::FIRST_CALL_TRANSACTION, |
| 24 | }; |
| 25 | |
| 26 | // This is a stub that real consumers should override. |
| 27 | class BpObbActionListener: public BpInterface<IObbActionListener> { |
| 28 | public: |
| 29 | BpObbActionListener(const sp<IBinder>& impl) |
| 30 | : BpInterface<IObbActionListener>(impl) |
| 31 | { } |
| 32 | |
Andreas Gampe | 2b3a8cd | 2014-10-21 23:38:52 -0700 | [diff] [blame] | 33 | virtual void onObbResult(const String16& /* filename */, const int32_t /* nonce */, |
| 34 | const int32_t /* state */) { } |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
Andreas Gampe | 2b3a8cd | 2014-10-21 23:38:52 -0700 | [diff] [blame] | 37 | IMPLEMENT_META_INTERFACE(ObbActionListener, "IObbActionListener") |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 38 | |
| 39 | // ---------------------------------------------------------------------- |
| 40 | |
| 41 | status_t BnObbActionListener::onTransact( |
| 42 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
| 43 | { |
| 44 | switch(code) { |
| 45 | case TRANSACTION_onObbResult: { |
| 46 | CHECK_INTERFACE(IObbActionListener, data, reply); |
| 47 | String16 filename = data.readString16(); |
Kenny Root | af9d667 | 2010-10-08 09:21:39 -0700 | [diff] [blame] | 48 | int32_t nonce = data.readInt32(); |
| 49 | int32_t state = data.readInt32(); |
| 50 | onObbResult(filename, nonce, state); |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 51 | reply->writeNoException(); |
| 52 | return NO_ERROR; |
Andreas Gampe | 2b3a8cd | 2014-10-21 23:38:52 -0700 | [diff] [blame] | 53 | } |
Kenny Root | be857d4 | 2010-08-18 15:59:25 -0700 | [diff] [blame] | 54 | default: |
| 55 | return BBinder::onTransact(code, data, reply, flags); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // ---------------------------------------------------------------------- |
| 60 | |
Andreas Gampe | 2b3a8cd | 2014-10-21 23:38:52 -0700 | [diff] [blame] | 61 | } |