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/IMountShutdownObserver.h>
     18 #include <binder/Parcel.h>
     19 
     20 namespace android {
     21 
     22 enum {
     23     TRANSACTION_onShutDownComplete = IBinder::FIRST_CALL_TRANSACTION,
     24 };
     25 
     26 class BpMountShutdownObserver: public BpInterface<IMountShutdownObserver> {
     27 public:
     28     explicit BpMountShutdownObserver(const sp<IBinder>& impl)
     29             : BpInterface<IMountShutdownObserver>(impl) { }
     30 
     31     virtual void onShutDownComplete(const int32_t /* statusCode */) {}
     32 };
     33 
     34 IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IStorageShutdownObserver")
     35 
     36 status_t BnMountShutdownObserver::onTransact(
     37     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
     38 {
     39     switch(code) {
     40         case TRANSACTION_onShutDownComplete: {
     41             CHECK_INTERFACE(IMountShutdownObserver, data, reply);
     42             int32_t statusCode = data.readInt32();
     43             onShutDownComplete(statusCode);
     44             reply->writeNoException();
     45             return NO_ERROR;
     46         }
     47         default:
     48             return BBinder::onTransact(code, data, reply, flags);
     49     }
     50 }
     51 // ----------------------------------------------------------------------
     52 
     53 }
     54