installd_deps.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #ifndef INSTALLD_DEPS_H_
  18. #define INSTALLD_DEPS_H_
  19. #include <inttypes.h>
  20. #include <installd_constants.h>
  21. namespace android {
  22. namespace installd {
  23. // Dependencies for a full binary. These functions need to be provided to
  24. // figure out parts of the configuration.
  25. // Retrieve a system property. Same API as cutils, just renamed.
  26. extern int get_property(const char *key,
  27. char *value,
  28. const char *default_value);
  29. // Size constants. Should be checked to be equal to the cutils requirements.
  30. constexpr size_t kPropertyKeyMax = 32u;
  31. constexpr size_t kPropertyValueMax = 92u;
  32. // Compute the output path for dex2oat.
  33. extern bool calculate_oat_file_path(char path[PKG_PATH_MAX],
  34. const char *oat_dir,
  35. const char *apk_path,
  36. const char *instruction_set);
  37. // Compute the output path for patchoat.
  38. //
  39. // Computes the odex file for the given apk_path and instruction_set, e.g.,
  40. // /system/framework/whatever.jar -> /system/framework/oat/<isa>/whatever.odex
  41. //
  42. // Returns false if it failed to determine the odex file path.
  43. //
  44. extern bool calculate_odex_file_path(char path[PKG_PATH_MAX],
  45. const char *apk_path,
  46. const char *instruction_set);
  47. // Compute the output path into the dalvik cache.
  48. extern bool create_cache_path(char path[PKG_PATH_MAX],
  49. const char *src,
  50. const char *instruction_set);
  51. } // namespace installd
  52. } // namespace android
  53. #endif // INSTALLD_DEPS_H_