blob: 131aff30a3083e1fedb00f19b9af08e2eec91a3d [file] [log] [blame]
Felipe Leme75876a22016-10-27 16:31:27 -07001/**
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 ANDROID_OS_DUMPSTATE_H_
18#define ANDROID_OS_DUMPSTATE_H_
19
20#include <mutex>
21#include <vector>
22
23#include <binder/BinderService.h>
24
25#include "android/os/BnDumpstate.h"
Felipe Leme009ecbb2016-11-07 10:18:44 -080026#include "android/os/BnDumpstateToken.h"
Felipe Leme75876a22016-10-27 16:31:27 -070027#include "dumpstate.h"
28
29namespace android {
30namespace os {
31
32class DumpstateService : public BinderService<DumpstateService>, public BnDumpstate {
33 public:
34 DumpstateService();
35
36 static status_t Start();
37 static char const* getServiceName();
38
39 status_t dump(int fd, const Vector<String16>& args) override;
40 binder::Status setListener(const std::string& name, const sp<IDumpstateListener>& listener,
Vishnu Nair20cf5032018-01-05 13:15:49 -080041 bool getSectionDetails,
Felipe Leme009ecbb2016-11-07 10:18:44 -080042 sp<IDumpstateToken>* returned_token) override;
Felipe Leme75876a22016-10-27 16:31:27 -070043
Nandana Duttcccbb5f2018-09-27 09:23:36 +010044 binder::Status startBugreport(int fd, const sp<IDumpstateListener>& listener,
45 const DumpstateOptions& options, int32_t* returned_id) override;
46
Felipe Leme75876a22016-10-27 16:31:27 -070047 private:
48 Dumpstate& ds_;
49 std::mutex lock_;
50};
51
52} // namespace os
53} // namespace android
54
55#endif // ANDROID_OS_DUMPSTATE_H_