Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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 IDMAP2_IDMAP2D_IDMAP2SERVICE_H_ |
| 18 | #define IDMAP2_IDMAP2D_IDMAP2SERVICE_H_ |
| 19 | |
Ryan Mitchell | 55ef616 | 2020-11-13 23:55:20 +0000 | [diff] [blame^] | 20 | #include <string> |
| 21 | |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 22 | #include <android-base/unique_fd.h> |
| 23 | #include <binder/BinderService.h> |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 24 | |
Ryan Mitchell | bf1f45b | 2020-09-29 17:22:52 -0700 | [diff] [blame] | 25 | #include <string> |
| 26 | |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 27 | #include "android/os/BnIdmap2.h" |
| 28 | |
Mårten Kongstad | 0eba72a | 2018-11-29 08:23:14 +0100 | [diff] [blame] | 29 | namespace android::os { |
| 30 | |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 31 | class Idmap2Service : public BinderService<Idmap2Service>, public BnIdmap2 { |
| 32 | public: |
| 33 | static char const* getServiceName() { |
| 34 | return "idmap"; |
| 35 | } |
| 36 | |
| 37 | binder::Status getIdmapPath(const std::string& overlay_apk_path, int32_t user_id, |
Mårten Kongstad | cb85d9c | 2018-12-21 08:28:40 +0100 | [diff] [blame] | 38 | std::string* _aidl_return) override; |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 39 | |
| 40 | binder::Status removeIdmap(const std::string& overlay_apk_path, int32_t user_id, |
Mårten Kongstad | cb85d9c | 2018-12-21 08:28:40 +0100 | [diff] [blame] | 41 | bool* _aidl_return) override; |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 42 | |
hg.choi | a3a6813 | 2020-01-15 17:12:48 +0900 | [diff] [blame] | 43 | binder::Status verifyIdmap(const std::string& target_apk_path, |
| 44 | const std::string& overlay_apk_path, int32_t fulfilled_policies, |
Mårten Kongstad | cb85d9c | 2018-12-21 08:28:40 +0100 | [diff] [blame] | 45 | bool enforce_overlayable, int32_t user_id, |
| 46 | bool* _aidl_return) override; |
Mårten Kongstad | ef0695d | 2018-12-04 14:36:48 +0100 | [diff] [blame] | 47 | |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 48 | binder::Status createIdmap(const std::string& target_apk_path, |
Mårten Kongstad | d10d06d | 2019-01-07 17:26:25 -0800 | [diff] [blame] | 49 | const std::string& overlay_apk_path, int32_t fulfilled_policies, |
| 50 | bool enforce_overlayable, int32_t user_id, |
Jooyung Han | 16bac85 | 2020-08-10 12:53:14 +0900 | [diff] [blame] | 51 | std::optional<std::string>* _aidl_return) override; |
Ryan Mitchell | 7d53f19 | 2020-04-24 17:45:25 -0700 | [diff] [blame] | 52 | |
| 53 | private: |
| 54 | // Cache the crc of the android framework package since the crc cannot change without a reboot. |
| 55 | std::optional<uint32_t> android_crc_; |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 56 | }; |
Mårten Kongstad | 0eba72a | 2018-11-29 08:23:14 +0100 | [diff] [blame] | 57 | |
| 58 | } // namespace android::os |
Mårten Kongstad | 0275123 | 2018-04-27 13:16:32 +0200 | [diff] [blame] | 59 | |
| 60 | #endif // IDMAP2_IDMAP2D_IDMAP2SERVICE_H_ |