xref: /aosp_15_r20/frameworks/native/cmds/installd/installd_deps.h (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard Worker /*
2*38e8c45fSAndroid Build Coastguard Worker **
3*38e8c45fSAndroid Build Coastguard Worker ** Copyright 2008, The Android Open Source Project
4*38e8c45fSAndroid Build Coastguard Worker **
5*38e8c45fSAndroid Build Coastguard Worker ** Licensed under the Apache License, Version 2.0 (the "License");
6*38e8c45fSAndroid Build Coastguard Worker ** you may not use this file except in compliance with the License.
7*38e8c45fSAndroid Build Coastguard Worker ** You may obtain a copy of the License at
8*38e8c45fSAndroid Build Coastguard Worker **
9*38e8c45fSAndroid Build Coastguard Worker **     http://www.apache.org/licenses/LICENSE-2.0
10*38e8c45fSAndroid Build Coastguard Worker **
11*38e8c45fSAndroid Build Coastguard Worker ** Unless required by applicable law or agreed to in writing, software
12*38e8c45fSAndroid Build Coastguard Worker ** distributed under the License is distributed on an "AS IS" BASIS,
13*38e8c45fSAndroid Build Coastguard Worker ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*38e8c45fSAndroid Build Coastguard Worker ** See the License for the specific language governing permissions and
15*38e8c45fSAndroid Build Coastguard Worker ** limitations under the License.
16*38e8c45fSAndroid Build Coastguard Worker */
17*38e8c45fSAndroid Build Coastguard Worker 
18*38e8c45fSAndroid Build Coastguard Worker #ifndef INSTALLD_DEPS_H_
19*38e8c45fSAndroid Build Coastguard Worker #define INSTALLD_DEPS_H_
20*38e8c45fSAndroid Build Coastguard Worker 
21*38e8c45fSAndroid Build Coastguard Worker #include <inttypes.h>
22*38e8c45fSAndroid Build Coastguard Worker 
23*38e8c45fSAndroid Build Coastguard Worker #include <installd_constants.h>
24*38e8c45fSAndroid Build Coastguard Worker 
25*38e8c45fSAndroid Build Coastguard Worker namespace android {
26*38e8c45fSAndroid Build Coastguard Worker namespace installd {
27*38e8c45fSAndroid Build Coastguard Worker 
28*38e8c45fSAndroid Build Coastguard Worker // Dependencies for a full binary. These functions need to be provided to
29*38e8c45fSAndroid Build Coastguard Worker // figure out parts of the configuration.
30*38e8c45fSAndroid Build Coastguard Worker 
31*38e8c45fSAndroid Build Coastguard Worker // Retrieve a system property. Same API as cutils, just renamed.
32*38e8c45fSAndroid Build Coastguard Worker extern int get_property(const char *key,
33*38e8c45fSAndroid Build Coastguard Worker                         char *value,
34*38e8c45fSAndroid Build Coastguard Worker                         const char *default_value);
35*38e8c45fSAndroid Build Coastguard Worker // Size constants. Should be checked to be equal to the cutils requirements.
36*38e8c45fSAndroid Build Coastguard Worker constexpr size_t kPropertyKeyMax = 32u;
37*38e8c45fSAndroid Build Coastguard Worker constexpr size_t kPropertyValueMax = 92u;
38*38e8c45fSAndroid Build Coastguard Worker 
39*38e8c45fSAndroid Build Coastguard Worker // Compute the output path for dex2oat.
40*38e8c45fSAndroid Build Coastguard Worker extern bool calculate_oat_file_path(char path[PKG_PATH_MAX],
41*38e8c45fSAndroid Build Coastguard Worker                                     const char *oat_dir,
42*38e8c45fSAndroid Build Coastguard Worker                                     const char *apk_path,
43*38e8c45fSAndroid Build Coastguard Worker                                     const char *instruction_set);
44*38e8c45fSAndroid Build Coastguard Worker // Compute the output path for patchoat.
45*38e8c45fSAndroid Build Coastguard Worker //
46*38e8c45fSAndroid Build Coastguard Worker // Computes the odex file for the given apk_path and instruction_set, e.g.,
47*38e8c45fSAndroid Build Coastguard Worker // /system/framework/whatever.jar -> /system/framework/oat/<isa>/whatever.odex
48*38e8c45fSAndroid Build Coastguard Worker //
49*38e8c45fSAndroid Build Coastguard Worker // Returns false if it failed to determine the odex file path.
50*38e8c45fSAndroid Build Coastguard Worker //
51*38e8c45fSAndroid Build Coastguard Worker extern bool calculate_odex_file_path(char path[PKG_PATH_MAX],
52*38e8c45fSAndroid Build Coastguard Worker                                      const char *apk_path,
53*38e8c45fSAndroid Build Coastguard Worker                                      const char *instruction_set);
54*38e8c45fSAndroid Build Coastguard Worker 
55*38e8c45fSAndroid Build Coastguard Worker // Compute the output path into the dalvik cache.
56*38e8c45fSAndroid Build Coastguard Worker extern bool create_cache_path(char path[PKG_PATH_MAX],
57*38e8c45fSAndroid Build Coastguard Worker                               const char *src,
58*38e8c45fSAndroid Build Coastguard Worker                               const char *instruction_set);
59*38e8c45fSAndroid Build Coastguard Worker 
60*38e8c45fSAndroid Build Coastguard Worker // If true, pass "--force-jit-zygote" to dex2oat (i.e., compile without a boot image).
61*38e8c45fSAndroid Build Coastguard Worker extern bool force_compile_without_image();
62*38e8c45fSAndroid Build Coastguard Worker 
63*38e8c45fSAndroid Build Coastguard Worker }  // namespace installd
64*38e8c45fSAndroid Build Coastguard Worker }  // namespace android
65*38e8c45fSAndroid Build Coastguard Worker 
66*38e8c45fSAndroid Build Coastguard Worker #endif  // INSTALLD_DEPS_H_
67