blob: e990f1b69549d4ebe400dda7175c2f56017b16be [file] [log] [blame]
Andreas Gampe02d0de52015-11-11 20:43:16 -08001/*
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 COMMANDS_H_
19#define COMMANDS_H_
20
21#include <inttypes.h>
22#include <unistd.h>
23
24#include <cutils/multiuser.h>
25
26#include <installd_constants.h>
27
28namespace android {
29namespace installd {
30
Andreas Gamped089ca12016-06-27 14:25:30 -070031static constexpr size_t DEXOPT_PARAM_COUNT = 10U;
32
Jeff Sharkeyc7d1b222016-01-11 13:07:09 -070033int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags,
Janis Danisevskiseecb2d22016-01-12 14:45:55 +000034 appid_t appid, const char* seinfo, int target_sdk_version);
Jeff Sharkeyc7d1b222016-01-11 13:07:09 -070035int restorecon_app_data(const char* uuid, const char* pkgName, userid_t userid, int flags,
36 appid_t appid, const char* seinfo);
Jeff Sharkeycc6281c2016-02-06 19:46:09 -070037int migrate_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags);
Jeff Sharkey2f720f72016-04-10 20:51:40 -060038int clear_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags,
39 ino_t ce_data_inode);
40int destroy_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags,
41 ino_t ce_data_inode);
Jeff Sharkeyc7d1b222016-01-11 13:07:09 -070042
43int move_complete_app(const char* from_uuid, const char *to_uuid, const char *package_name,
Janis Danisevskiseecb2d22016-01-12 14:45:55 +000044 const char *data_app_name, appid_t appid, const char* seinfo, int target_sdk_version);
Jeff Sharkeyc7d1b222016-01-11 13:07:09 -070045
Jeff Sharkey2f720f72016-04-10 20:51:40 -060046int get_app_size(const char *uuid, const char *pkgname, int userid, int flags, ino_t ce_data_inode,
47 const char* code_path, int64_t *codesize, int64_t *datasize, int64_t *cachesize,
48 int64_t *asecsize);
49int get_app_data_inode(const char *uuid, const char *pkgname, int userid, int flags, ino_t *inode);
Jeff Sharkeyc7d1b222016-01-11 13:07:09 -070050
Jeff Sharkey379a12b2016-04-14 20:45:06 -060051int create_user_data(const char *uuid, userid_t userid, int user_serial, int flags);
52int destroy_user_data(const char *uuid, userid_t userid, int flags);
53
Andreas Gampe02d0de52015-11-11 20:43:16 -080054int rm_dex(const char *path, const char *instruction_set);
Andreas Gampe02d0de52015-11-11 20:43:16 -080055int free_cache(const char *uuid, int64_t free_size);
Andreas Gampe4d0f8252016-03-20 11:30:28 -070056
57bool merge_profiles(uid_t uid, const char *pkgname);
58
David Sehr6727c2d2016-05-17 16:06:22 -070059bool dump_profile(uid_t uid, const char *pkgname, const char *dex_files);
60
Andreas Gampe548bdb92016-06-02 17:56:45 -070061int dexopt(const char *apk_path,
62 uid_t uid,
63 const char *pkgName,
64 const char *instruction_set,
65 int dexopt_needed,
66 const char* oat_dir,
67 int dexopt_flags,
68 const char* compiler_filter,
69 const char* volume_uuid,
70 const char* shared_libraries);
71static_assert(DEXOPT_PARAM_COUNT == 10U, "Unexpected dexopt param size");
72
73// Helper for the above, converting arguments.
Andreas Gamped089ca12016-06-27 14:25:30 -070074int dexopt(const char* const params[DEXOPT_PARAM_COUNT]);
Andreas Gampe548bdb92016-06-02 17:56:45 -070075
Andreas Gampe02d0de52015-11-11 20:43:16 -080076int mark_boot_complete(const char *instruction_set);
Andreas Gampe02d0de52015-11-11 20:43:16 -080077int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId);
78int idmap(const char *target_path, const char *overlay_path, uid_t uid);
Andreas Gampe02d0de52015-11-11 20:43:16 -080079int create_oat_dir(const char* oat_dir, const char *instruction_set);
80int rm_package_dir(const char* apk_path);
Calin Juravleedae6692016-03-23 13:55:31 +000081int clear_app_profiles(const char* pkgname);
82int destroy_app_profiles(const char* pkgname);
Andreas Gampe02d0de52015-11-11 20:43:16 -080083int link_file(const char *relative_path, const char *from_base, const char *to_base);
84
Andreas Gampee65b4fa2016-03-01 11:46:45 -080085// Move a B version over to the A location. Only works for oat_dir != nullptr.
86int move_ab(const char *apk_path, const char *instruction_set, const char* oat_dir);
87
Andreas Gampe02d0de52015-11-11 20:43:16 -080088} // namespace installd
89} // namespace android
90
91#endif // COMMANDS_H_