blob: 1d2090c431aeaee6405804afcde048ad3e7946e6 [file] [log] [blame]
Mårten Kongstad02751232018-04-27 13:16:32 +02001/*
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 Mitchell55ef6162020-11-13 23:55:20 +000020#include <string>
21
Mårten Kongstad02751232018-04-27 13:16:32 +020022#include <android-base/unique_fd.h>
23#include <binder/BinderService.h>
Mårten Kongstad02751232018-04-27 13:16:32 +020024
Ryan Mitchellbf1f45b2020-09-29 17:22:52 -070025#include <string>
26
Mårten Kongstad02751232018-04-27 13:16:32 +020027#include "android/os/BnIdmap2.h"
28
Mårten Kongstad0eba72a2018-11-29 08:23:14 +010029namespace android::os {
30
Mårten Kongstad02751232018-04-27 13:16:32 +020031class 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 Kongstadcb85d9c2018-12-21 08:28:40 +010038 std::string* _aidl_return) override;
Mårten Kongstad02751232018-04-27 13:16:32 +020039
40 binder::Status removeIdmap(const std::string& overlay_apk_path, int32_t user_id,
Mårten Kongstadcb85d9c2018-12-21 08:28:40 +010041 bool* _aidl_return) override;
Mårten Kongstad02751232018-04-27 13:16:32 +020042
hg.choia3a68132020-01-15 17:12:48 +090043 binder::Status verifyIdmap(const std::string& target_apk_path,
44 const std::string& overlay_apk_path, int32_t fulfilled_policies,
Mårten Kongstadcb85d9c2018-12-21 08:28:40 +010045 bool enforce_overlayable, int32_t user_id,
46 bool* _aidl_return) override;
Mårten Kongstadef0695d2018-12-04 14:36:48 +010047
Mårten Kongstad02751232018-04-27 13:16:32 +020048 binder::Status createIdmap(const std::string& target_apk_path,
Mårten Kongstadd10d06d2019-01-07 17:26:25 -080049 const std::string& overlay_apk_path, int32_t fulfilled_policies,
50 bool enforce_overlayable, int32_t user_id,
Jooyung Han16bac852020-08-10 12:53:14 +090051 std::optional<std::string>* _aidl_return) override;
Ryan Mitchell7d53f192020-04-24 17:45:25 -070052
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 Kongstad02751232018-04-27 13:16:32 +020056};
Mårten Kongstad0eba72a2018-11-29 08:23:14 +010057
58} // namespace android::os
Mårten Kongstad02751232018-04-27 13:16:32 +020059
60#endif // IDMAP2_IDMAP2D_IDMAP2SERVICE_H_