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:
BpObbActionListener(const sp<IBinder> & impl)29 explicit BpObbActionListener(const sp<IBinder>& impl)
30 : BpInterface<IObbActionListener>(impl)
31 { }
32
onObbResult(const String16 &,const int32_t,const int32_t)33 virtual void onObbResult(const String16& /* filename */, const int32_t /* nonce */,
34 const int32_t /* state */) { }
35 };
36
37 IMPLEMENT_META_INTERFACE(ObbActionListener, "android.os.storage.IObbActionListener")
38
39 // ----------------------------------------------------------------------
40
onTransact(uint32_t code,const Parcel & data,Parcel * reply,uint32_t flags)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();
48 int32_t nonce = data.readInt32();
49 int32_t state = data.readInt32();
50 onObbResult(filename, nonce, state);
51 reply->writeNoException();
52 return NO_ERROR;
53 }
54 default:
55 return BBinder::onTransact(code, data, reply, flags);
56 }
57 }
58
59 // ----------------------------------------------------------------------
60
61 }
62