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