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/BinderService.h>
23 
24 #include "android/os/BnStoraged.h"
25 #include "android/os/storaged/BnStoragedPrivate.h"
26 
27 using namespace std;
28 using namespace android::os;
29 using namespace android::os::storaged;
30 
31 class StoragedService : public BinderService<StoragedService>, public BnStoraged {
32 private:
33     void dumpUidRecordsDebug(int fd, const vector<struct uid_record>& entries);
34     void dumpUidRecords(int fd, const vector<struct uid_record>& entries);
35 public:
36     static status_t start();
getServiceName()37     static char const* getServiceName() { return "storaged"; }
38     virtual status_t dump(int fd, const Vector<String16> &args) override;
39 
40     binder::Status onUserStarted(int32_t userId);
41     binder::Status onUserStopped(int32_t userId);
42     binder::Status getRecentPerf(int32_t* _aidl_return);
43 };
44 
45 class StoragedPrivateService : public BinderService<StoragedPrivateService>, public BnStoragedPrivate {
46 public:
47     static status_t start();
getServiceName()48     static char const* getServiceName() { return "storaged_pri"; }
49 
50     binder::Status dumpUids(vector<UidInfo>* _aidl_return);
51     binder::Status dumpPerfHistory(vector<int32_t>* _aidl_return);
52 };
53 
54 sp<IStoragedPrivate> get_storaged_pri_service();
55 
56 #endif /* _STORAGED_SERVICE_H_ */