Home | History | Annotate | Download | only in storage
      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 
     33     virtual void onObbResult(const String16& filename, const int32_t nonce, const int32_t state) { }
     34 };
     35 
     36 IMPLEMENT_META_INTERFACE(ObbActionListener, "IObbActionListener");
     37 
     38 // ----------------------------------------------------------------------
     39 
     40 status_t BnObbActionListener::onTransact(
     41     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
     42 {
     43     switch(code) {
     44         case TRANSACTION_onObbResult: {
     45             CHECK_INTERFACE(IObbActionListener, data, reply);
     46             String16 filename = data.readString16();
     47             int32_t nonce = data.readInt32();
     48             int32_t state = data.readInt32();
     49             onObbResult(filename, nonce, state);
     50             reply->writeNoException();
     51             return NO_ERROR;
     52         } break;
     53         default:
     54             return BBinder::onTransact(code, data, reply, flags);
     55     }
     56 }
     57 
     58 // ----------------------------------------------------------------------
     59 
     60 };
     61