1 /*
2  * Copyright (C) 2016 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 #ifndef _STORAGED_SERVICE_H_
18 #define _STORAGED_SERVICE_H_
19 
20 #include <vector>
21 
22 #include <binder/IInterface.h>
23 #include <binder/IBinder.h>
24 
25 #include "storaged.h"
26 
27 using namespace android;
28 
29 // Interface
30 class IStoraged : public IInterface {
31 public:
32     enum {
33         DUMPUIDS  = IBinder::FIRST_CALL_TRANSACTION,
34     };
35     // Request the service to run the test function
36     virtual std::vector<struct uid_info> dump_uids(const char* option) = 0;
37 
38     DECLARE_META_INTERFACE(Storaged);
39 };
40 
41 // Client
42 class BpStoraged : public BpInterface<IStoraged> {
43 public:
BpStoraged(const sp<IBinder> & impl)44     BpStoraged(const sp<IBinder>& impl) : BpInterface<IStoraged>(impl){};
45     virtual std::vector<struct uid_info> dump_uids(const char* option);
46 };
47 
48 // Server
49 class BnStoraged : public BnInterface<IStoraged> {
50     virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0);
51 };
52 
53 class Storaged : public BnStoraged {
54     virtual std::vector<struct uid_info> dump_uids(const char* option);
55     virtual status_t dump(int fd, const Vector<String16>& args);
56 };
57 
58 sp<IStoraged> get_storaged_service();
59 
60 #endif /* _STORAGED_SERVICE_H_ */