blob: 854b57fb22aa84c5fb5f2ca96e47b3958bb25b0e [file] [log] [blame]
Winson62ac8b52019-12-04 08:36:48 -08001/*
2 * Copyright (C) 2019 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
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020017#ifndef IDMAP2_TESTS_R_H_
18#define IDMAP2_TESTS_R_H_
Winson62ac8b52019-12-04 08:36:48 -080019
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020020#include <string>
21
22#include "idmap2/ResourceUtils.h"
Winson62ac8b52019-12-04 08:36:48 -080023
24namespace android::idmap2 {
25
26static std::string hexify(ResourceId id) {
27 std::stringstream stream;
28 stream << std::hex << static_cast<uint32_t>(id);
29 return stream.str();
30}
31
32// clang-format off
33namespace R::target {
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020034 namespace integer { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080035 constexpr ResourceId int1 = 0x7f010000;
36
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020037 namespace literal { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080038 inline const std::string int1 = hexify(R::target::integer::int1);
39 }
40 }
41
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020042 namespace string { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080043 constexpr ResourceId not_overlayable = 0x7f020003;
44 constexpr ResourceId other = 0x7f020004;
Winsonf56ade32019-12-04 11:32:41 -080045 constexpr ResourceId policy_actor = 0x7f020005;
Zoran Jovanovic9336d9e2020-06-09 18:51:57 +020046 constexpr ResourceId policy_config_signature = 0x7f020006;
47 constexpr ResourceId policy_odm = 0x7f020007;
48 constexpr ResourceId policy_oem = 0x7f020008;
49 constexpr ResourceId policy_product = 0x7f020009;
50 constexpr ResourceId policy_public = 0x7f02000a;
51 constexpr ResourceId policy_signature = 0x7f02000b;
52 constexpr ResourceId policy_system = 0x7f02000c;
53 constexpr ResourceId policy_system_vendor = 0x7f02000d;
54 constexpr ResourceId str1 = 0x7f02000e;
55 constexpr ResourceId str3 = 0x7f020010;
56 constexpr ResourceId str4 = 0x7f020011;
Winson62ac8b52019-12-04 08:36:48 -080057
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020058 namespace literal { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080059 inline const std::string str1 = hexify(R::target::string::str1);
60 inline const std::string str3 = hexify(R::target::string::str3);
61 inline const std::string str4 = hexify(R::target::string::str4);
62 }
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020063 } // namespace string
64} // namespace R::target
Winson62ac8b52019-12-04 08:36:48 -080065
66namespace R::overlay {
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020067 namespace integer { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080068 constexpr ResourceId int1 = 0x7f010000;
69 }
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020070 namespace string { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080071 constexpr ResourceId str1 = 0x7f020000;
72 constexpr ResourceId str3 = 0x7f020001;
73 constexpr ResourceId str4 = 0x7f020002;
74 }
75}
76
Winsonf56ade32019-12-04 11:32:41 -080077namespace R::overlay_shared {
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020078 namespace integer { // NOLINT(runtime/indentation_namespace)
Winsonf56ade32019-12-04 11:32:41 -080079 constexpr ResourceId int1 = 0x00010000;
80 }
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020081 namespace string { // NOLINT(runtime/indentation_namespace)
Winsonf56ade32019-12-04 11:32:41 -080082 constexpr ResourceId str1 = 0x00020000;
83 constexpr ResourceId str3 = 0x00020001;
84 constexpr ResourceId str4 = 0x00020002;
85 }
86}
87
Winson62ac8b52019-12-04 08:36:48 -080088namespace R::system_overlay::string {
89 constexpr ResourceId policy_public = 0x7f010000;
90 constexpr ResourceId policy_system = 0x7f010001;
91 constexpr ResourceId policy_system_vendor = 0x7f010002;
92}
93
94namespace R::system_overlay_invalid::string {
95 constexpr ResourceId not_overlayable = 0x7f010000;
96 constexpr ResourceId other = 0x7f010001;
Winsonf56ade32019-12-04 11:32:41 -080097 constexpr ResourceId policy_actor = 0x7f010002;
Zoran Jovanovic9336d9e2020-06-09 18:51:57 +020098 constexpr ResourceId policy_config_signature = 0x7f010003;
99 constexpr ResourceId policy_odm = 0x7f010004;
100 constexpr ResourceId policy_oem = 0x7f010005;
101 constexpr ResourceId policy_product = 0x7f010006;
102 constexpr ResourceId policy_public = 0x7f010007;
103 constexpr ResourceId policy_signature = 0x7f010008;
104 constexpr ResourceId policy_system = 0x7f010009;
105 constexpr ResourceId policy_system_vendor = 0x7f01000a;
Mårten Kongstadc4799eb2020-06-04 20:48:11 +0200106} // namespace R::system_overlay_invalid::string
Winson62ac8b52019-12-04 08:36:48 -0800107// clang-format on
108
109} // namespace android::idmap2
110
Mårten Kongstadc4799eb2020-06-04 20:48:11 +0200111#endif // IDMAP2_TESTS_R_H_