blob: 1115c78cbdcc58fbcb3ef55ab57c05f0afa5f73c [file] [log] [blame]
Jeff Sharkey6c2c0562016-12-07 12:12:00 -07001/*
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 Sharkey90aff262016-12-12 14:28:24 -070022#include <cutils/multiuser.h>
23
Jeff Sharkey6c2c0562016-12-07 12:12:00 -070024namespace android {
25namespace installd {
26
Jeff Sharkey90aff262016-12-12 14:28:24 -070027/* dexopt needed flags matching those in dalvik.system.DexFile */
28static constexpr int DEX2OAT_FROM_SCRATCH = 1;
29static constexpr int DEX2OAT_FOR_BOOT_IMAGE = 2;
30static constexpr int DEX2OAT_FOR_FILTER = 3;
31static constexpr int DEX2OAT_FOR_RELOCATION = 4;
32static constexpr int PATCHOAT_FOR_RELOCATION = 5;
33
34typedef int fd_t;
35
36bool clear_reference_profile(const char* pkgname);
37bool clear_current_profile(const char* pkgname, userid_t user);
38bool clear_current_profiles(const char* pkgname);
39
40bool move_ab(const char* apk_path, const char* instruction_set, const char* output_path);
41
42bool analyse_profiles(uid_t uid, const char* pkgname);
43bool dump_profiles(int32_t uid, const char* pkgname, const char* code_paths);
44
45bool delete_odex(const char* apk_path, const char* instruction_set, const char* output_path);
46
Jeff Sharkey6c2c0562016-12-07 12:12:00 -070047int dexopt(const char *apk_path, uid_t uid, const char *pkgName, const char *instruction_set,
48 int dexopt_needed, const char* oat_dir, int dexopt_flags, const char* compiler_filter,
49 const char* volume_uuid, const char* shared_libraries);
50
51static constexpr size_t DEXOPT_PARAM_COUNT = 10U;
52static_assert(DEXOPT_PARAM_COUNT == 10U, "Unexpected dexopt param size");
53
54// Helper for the above, converting arguments.
55int dexopt(const char* const params[DEXOPT_PARAM_COUNT]);
56
57} // namespace installd
58} // namespace android
59
60#endif // DEXOPT_H_