Enrico Granata | e23f034 | 2017-10-23 17:17:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 CAR_PROCFS_SERVER |
| 18 | #define CAR_PROCFS_SERVER |
| 19 | |
| 20 | #define LOG_TAG "com.android.car.procfsinspector" |
| 21 | #define SERVICE_NAME "com.android.car.procfsinspector" |
| 22 | |
| 23 | #include <vector> |
| 24 | |
| 25 | #include <binder/Parcel.h> |
| 26 | #include <binder/IPCThreadState.h> |
| 27 | #include <binder/ProcessState.h> |
| 28 | #include <binder/IServiceManager.h> |
| 29 | #include <binder/IBinder.h> |
| 30 | #include <binder/IInterface.h> |
| 31 | |
| 32 | #include <utils/Log.h> |
| 33 | #include <utils/String16.h> |
| 34 | |
| 35 | #include "process.h" |
| 36 | |
| 37 | using namespace android; |
| 38 | |
| 39 | namespace procfsinspector { |
| 40 | class IProcfsInspector : public IInterface { |
| 41 | public: |
| 42 | DECLARE_META_INTERFACE(ProcfsInspector); |
| 43 | |
| 44 | enum class Call : uint32_t { |
| 45 | READ_PROCESS_TABLE = IBinder::FIRST_CALL_TRANSACTION, |
| 46 | }; |
| 47 | |
| 48 | // API declarations start here |
| 49 | virtual std::vector<ProcessInfo> readProcessTable() = 0; |
| 50 | }; |
| 51 | |
| 52 | class Impl : public BnInterface<IProcfsInspector> { |
| 53 | public: |
| 54 | virtual status_t onTransact(uint32_t code, |
| 55 | const Parcel& data, |
| 56 | Parcel *reply, |
| 57 | uint32_t flags) override; |
| 58 | virtual std::vector<ProcessInfo> readProcessTable() override; |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | #endif // CAR_PROCFS_SERVER |