Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 DEXOPT_H_ |
| 18 | #define DEXOPT_H_ |
| 19 | |
| 20 | #include <sys/types.h> |
| 21 | |
Jeff Sharkey | 90aff26 | 2016-12-12 14:28:24 -0700 | [diff] [blame] | 22 | #include <cutils/multiuser.h> |
| 23 | |
Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 24 | namespace android { |
| 25 | namespace installd { |
| 26 | |
Jeff Sharkey | 90aff26 | 2016-12-12 14:28:24 -0700 | [diff] [blame] | 27 | /* dexopt needed flags matching those in dalvik.system.DexFile */ |
Calin Juravle | 80a2125 | 2017-01-17 14:43:25 -0800 | [diff] [blame] | 28 | static constexpr int NO_DEXOPT_NEEDED = 0; |
Jeff Sharkey | 90aff26 | 2016-12-12 14:28:24 -0700 | [diff] [blame] | 29 | static constexpr int DEX2OAT_FROM_SCRATCH = 1; |
| 30 | static constexpr int DEX2OAT_FOR_BOOT_IMAGE = 2; |
| 31 | static constexpr int DEX2OAT_FOR_FILTER = 3; |
| 32 | static constexpr int DEX2OAT_FOR_RELOCATION = 4; |
| 33 | static constexpr int PATCHOAT_FOR_RELOCATION = 5; |
| 34 | |
| 35 | typedef int fd_t; |
| 36 | |
| 37 | bool clear_reference_profile(const char* pkgname); |
| 38 | bool clear_current_profile(const char* pkgname, userid_t user); |
| 39 | bool clear_current_profiles(const char* pkgname); |
| 40 | |
| 41 | bool move_ab(const char* apk_path, const char* instruction_set, const char* output_path); |
| 42 | |
| 43 | bool analyse_profiles(uid_t uid, const char* pkgname); |
| 44 | bool dump_profiles(int32_t uid, const char* pkgname, const char* code_paths); |
| 45 | |
| 46 | bool delete_odex(const char* apk_path, const char* instruction_set, const char* output_path); |
| 47 | |
Calin Juravle | c9eab38 | 2017-01-25 01:17:17 -0800 | [diff] [blame^] | 48 | bool reconcile_secondary_dex_file(const std::string& dex_path, |
| 49 | const std::string& pkgname, int uid, const std::vector<std::string>& isas, |
| 50 | const std::unique_ptr<std::string>& volumeUuid, int storage_flag, |
| 51 | /*out*/bool* out_secondary_dex_exists); |
| 52 | |
Jeff Sharkey | 6c2c056 | 2016-12-07 12:12:00 -0700 | [diff] [blame] | 53 | int dexopt(const char *apk_path, uid_t uid, const char *pkgName, const char *instruction_set, |
| 54 | int dexopt_needed, const char* oat_dir, int dexopt_flags, const char* compiler_filter, |
| 55 | const char* volume_uuid, const char* shared_libraries); |
| 56 | |
| 57 | static constexpr size_t DEXOPT_PARAM_COUNT = 10U; |
| 58 | static_assert(DEXOPT_PARAM_COUNT == 10U, "Unexpected dexopt param size"); |
| 59 | |
| 60 | // Helper for the above, converting arguments. |
| 61 | int dexopt(const char* const params[DEXOPT_PARAM_COUNT]); |
| 62 | |
| 63 | } // namespace installd |
| 64 | } // namespace android |
| 65 | |
| 66 | #endif // DEXOPT_H_ |