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