• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 ART_ODREFRESH_ODR_COMMON_H_
18 #define ART_ODREFRESH_ODR_COMMON_H_
19 
20 #include <initializer_list>
21 #include <string>
22 #include <string_view>
23 
24 #include "android-base/result.h"
25 
26 namespace art {
27 namespace odrefresh {
28 
29 // Concatenates a list of strings into a single string.
30 std::string Concatenate(std::initializer_list<std::string_view> args);
31 
32 // Quotes a path with single quotes (').
33 std::string QuotePath(std::string_view path);
34 
35 // Converts the security patch date to a comparable integer.
36 android::base::Result<int> ParseSecurityPatchStr(const std::string& security_patch_str);
37 
38 // Returns true if partial compilation should be disabled. Takes a string from
39 // `ro.build.version.security_patch`, which represents the security patch date.
40 bool ShouldDisablePartialCompilation(const std::string& security_patch_str);
41 
42 // Returns true if there is no need to load existing artifacts that are already up-to-date and write
43 // them back. See `OnDeviceRefresh::RefreshExistingArtifacts` for more details. Takes a string from
44 // `ro.build.version.sdk`, which represents the SDK version.
45 bool ShouldDisableRefresh(const std::string& sdk_version_str);
46 
47 // Passes the name and the value for each system property to the provided callback.
48 void SystemPropertyForeach(std::function<void(const char* name, const char* value)> action);
49 
50 }  // namespace odrefresh
51 }  // namespace art
52 
53 #endif  // ART_ODREFRESH_ODR_COMMON_H_
54