| Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 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 ANDROID_OS_DUMPSTATE_H_ | 
|  | 18 | #define ANDROID_OS_DUMPSTATE_H_ | 
|  | 19 |  | 
|  | 20 | #include <mutex> | 
|  | 21 | #include <vector> | 
|  | 22 |  | 
| Nandana Dutt | 05290ad | 2019-01-04 15:48:09 +0000 | [diff] [blame] | 23 | #include <android-base/unique_fd.h> | 
| Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 24 | #include <binder/BinderService.h> | 
|  | 25 |  | 
|  | 26 | #include "android/os/BnDumpstate.h" | 
| Felipe Leme | 009ecbb | 2016-11-07 10:18:44 -0800 | [diff] [blame] | 27 | #include "android/os/BnDumpstateToken.h" | 
| Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 28 | #include "dumpstate.h" | 
|  | 29 |  | 
|  | 30 | namespace android { | 
|  | 31 | namespace os { | 
|  | 32 |  | 
|  | 33 | class DumpstateService : public BinderService<DumpstateService>, public BnDumpstate { | 
|  | 34 | public: | 
|  | 35 | DumpstateService(); | 
|  | 36 |  | 
|  | 37 | static status_t Start(); | 
|  | 38 | static char const* getServiceName(); | 
|  | 39 |  | 
|  | 40 | status_t dump(int fd, const Vector<String16>& args) override; | 
|  | 41 | binder::Status setListener(const std::string& name, const sp<IDumpstateListener>& listener, | 
| Vishnu Nair | 20cf503 | 2018-01-05 13:15:49 -0800 | [diff] [blame] | 42 | bool getSectionDetails, | 
| Felipe Leme | 009ecbb | 2016-11-07 10:18:44 -0800 | [diff] [blame] | 43 | sp<IDumpstateToken>* returned_token) override; | 
| Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 44 |  | 
| Nandana Dutt | 5c91420 | 2019-01-16 17:45:18 +0000 | [diff] [blame] | 45 | binder::Status startBugreport(int32_t calling_uid, const std::string& calling_package, | 
|  | 46 | const android::base::unique_fd& bugreport_fd, | 
| Nandana Dutt | 54dbd67 | 2019-01-11 12:58:05 +0000 | [diff] [blame] | 47 | const android::base::unique_fd& screenshot_fd, int bugreport_mode, | 
| Nandana Dutt | 05290ad | 2019-01-04 15:48:09 +0000 | [diff] [blame] | 48 | const sp<IDumpstateListener>& listener) override; | 
| Nandana Dutt | cccbb5f | 2018-09-27 09:23:36 +0100 | [diff] [blame] | 49 |  | 
| Nandana Dutt | cc4ead8 | 2019-01-23 08:29:23 +0000 | [diff] [blame] | 50 | // No-op | 
|  | 51 | binder::Status cancelBugreport(); | 
|  | 52 |  | 
| Felipe Leme | 75876a2 | 2016-10-27 16:31:27 -0700 | [diff] [blame] | 53 | private: | 
|  | 54 | Dumpstate& ds_; | 
|  | 55 | std::mutex lock_; | 
|  | 56 | }; | 
|  | 57 |  | 
|  | 58 | }  // namespace os | 
|  | 59 | }  // namespace android | 
|  | 60 |  | 
|  | 61 | #endif  // ANDROID_OS_DUMPSTATE_H_ |