blob: 4f2ee1c4880a328064355d1d06a58d0d341a15ce [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;
46 constexpr ResourceId policy_odm = 0x7f020006;
47 constexpr ResourceId policy_oem = 0x7f020007;
48 constexpr ResourceId policy_product = 0x7f020008;
49 constexpr ResourceId policy_public = 0x7f020009;
50 constexpr ResourceId policy_signature = 0x7f02000a;
51 constexpr ResourceId policy_system = 0x7f02000b;
52 constexpr ResourceId policy_system_vendor = 0x7f02000c;
53 constexpr ResourceId str1 = 0x7f02000d;
54 constexpr ResourceId str3 = 0x7f02000f;
55 constexpr ResourceId str4 = 0x7f020010;
Winson62ac8b52019-12-04 08:36:48 -080056
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020057 namespace literal { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080058 inline const std::string str1 = hexify(R::target::string::str1);
59 inline const std::string str3 = hexify(R::target::string::str3);
60 inline const std::string str4 = hexify(R::target::string::str4);
61 }
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020062 } // namespace string
63} // namespace R::target
Winson62ac8b52019-12-04 08:36:48 -080064
65namespace R::overlay {
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020066 namespace integer { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080067 constexpr ResourceId int1 = 0x7f010000;
68 }
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020069 namespace string { // NOLINT(runtime/indentation_namespace)
Winson62ac8b52019-12-04 08:36:48 -080070 constexpr ResourceId str1 = 0x7f020000;
71 constexpr ResourceId str3 = 0x7f020001;
72 constexpr ResourceId str4 = 0x7f020002;
73 }
74}
75
Winsonf56ade32019-12-04 11:32:41 -080076namespace R::overlay_shared {
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020077 namespace integer { // NOLINT(runtime/indentation_namespace)
Winsonf56ade32019-12-04 11:32:41 -080078 constexpr ResourceId int1 = 0x00010000;
79 }
Mårten Kongstadc4799eb2020-06-04 20:48:11 +020080 namespace string { // NOLINT(runtime/indentation_namespace)
Winsonf56ade32019-12-04 11:32:41 -080081 constexpr ResourceId str1 = 0x00020000;
82 constexpr ResourceId str3 = 0x00020001;
83 constexpr ResourceId str4 = 0x00020002;
84 }
85}
86
Winson62ac8b52019-12-04 08:36:48 -080087namespace R::system_overlay::string {
88 constexpr ResourceId policy_public = 0x7f010000;
89 constexpr ResourceId policy_system = 0x7f010001;
90 constexpr ResourceId policy_system_vendor = 0x7f010002;
91}
92
93namespace R::system_overlay_invalid::string {
94 constexpr ResourceId not_overlayable = 0x7f010000;
95 constexpr ResourceId other = 0x7f010001;
Winsonf56ade32019-12-04 11:32:41 -080096 constexpr ResourceId policy_actor = 0x7f010002;
97 constexpr ResourceId policy_odm = 0x7f010003;
98 constexpr ResourceId policy_oem = 0x7f010004;
99 constexpr ResourceId policy_product = 0x7f010005;
100 constexpr ResourceId policy_public = 0x7f010006;
101 constexpr ResourceId policy_signature = 0x7f010007;
102 constexpr ResourceId policy_system = 0x7f010008;
103 constexpr ResourceId policy_system_vendor = 0x7f010009;
Mårten Kongstadc4799eb2020-06-04 20:48:11 +0200104} // namespace R::system_overlay_invalid::string
Winson62ac8b52019-12-04 08:36:48 -0800105// clang-format on
106
107} // namespace android::idmap2
108
Mårten Kongstadc4799eb2020-06-04 20:48:11 +0200109#endif // IDMAP2_TESTS_R_H_