102d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe/*
202d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe**
302d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** Copyright 2008, The Android Open Source Project
402d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe**
502d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** Licensed under the Apache License, Version 2.0 (the "License");
602d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** you may not use this file except in compliance with the License.
702d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** You may obtain a copy of the License at
802d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe**
902d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe**     http://www.apache.org/licenses/LICENSE-2.0
1002d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe**
1102d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** Unless required by applicable law or agreed to in writing, software
1202d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** distributed under the License is distributed on an "AS IS" BASIS,
1302d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1402d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** See the License for the specific language governing permissions and
1502d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe** limitations under the License.
1602d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe*/
1702d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
1802d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe#ifndef INSTALLD_DEPS_H_
1902d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe#define INSTALLD_DEPS_H_
2002d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
2102d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe#include <inttypes.h>
2202d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
2302d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe#include <installd_constants.h>
2402d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
2502d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampenamespace android {
2602d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampenamespace installd {
2702d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
2802d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Dependencies for a full binary. These functions need to be provided to
2902d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// figure out parts of the configuration.
3002d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
3102d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Retrieve a system property. Same API as cutils, just renamed.
3202d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampeextern int get_property(const char *key,
3302d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                        char *value,
3402d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                        const char *default_value);
3502d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Size constants. Should be checked to be equal to the cutils requirements.
3602d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampeconstexpr size_t kPropertyKeyMax = 32u;
3702d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampeconstexpr size_t kPropertyValueMax = 92u;
3802d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
3902d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Compute the output path for dex2oat.
4002d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampeextern bool calculate_oat_file_path(char path[PKG_PATH_MAX],
4102d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                                    const char *oat_dir,
4202d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                                    const char *apk_path,
4302d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                                    const char *instruction_set);
4402d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Compute the output path for patchoat.
4502d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe//
4602d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Computes the odex file for the given apk_path and instruction_set, e.g.,
4702d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// /system/framework/whatever.jar -> /system/framework/oat/<isa>/whatever.odex
4802d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe//
4902d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Returns false if it failed to determine the odex file path.
5002d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe//
5102d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampeextern bool calculate_odex_file_path(char path[PKG_PATH_MAX],
5202d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                                     const char *apk_path,
5302d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                                     const char *instruction_set);
5402d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
5502d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe// Compute the output path into the dalvik cache.
5602d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampeextern bool create_cache_path(char path[PKG_PATH_MAX],
5702d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                              const char *src,
5802d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe                              const char *instruction_set);
5902d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
6002d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe}  // namespace installd
6102d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe}  // namespace android
6202d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe
6302d0de56c75347a0cb8d5a8565dc8c4ee7616057Andreas Gampe#endif  // INSTALLD_DEPS_H_
64