installd.h revision e36372423000a906bafae68844ebc6c42d09335a
194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood/* 294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** 394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** Copyright 2008, The Android Open Source Project 494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** 594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** Licensed under the Apache License, Version 2.0 (the "License"); 694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** you may not use this file except in compliance with the License. 794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** You may obtain a copy of the License at 894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** 994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** http://www.apache.org/licenses/LICENSE-2.0 1094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** 1194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** Unless required by applicable law or agreed to in writing, software 1294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** distributed under the License is distributed on an "AS IS" BASIS, 1394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** See the License for the specific language governing permissions and 1594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood** limitations under the License. 1694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood*/ 1794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 1894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define LOG_TAG "installd" 1994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 2094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <stdio.h> 2194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <stdlib.h> 2294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <stdint.h> 2394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <inttypes.h> 2494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <sys/stat.h> 2594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <dirent.h> 2694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <unistd.h> 2794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <ctype.h> 2894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <fcntl.h> 2994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <errno.h> 3094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <utime.h> 3194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <sys/socket.h> 3294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <sys/types.h> 3394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <sys/wait.h> 34c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkey#include <string> 35e36372423000a906bafae68844ebc6c42d09335aJeff Sharkey#include <vector> 3694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 3794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <cutils/fs.h> 3894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <cutils/sockets.h> 3994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <cutils/log.h> 4094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <cutils/properties.h> 4194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <cutils/multiuser.h> 4294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 4394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <private/android_filesystem_config.h> 4494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 459a4e7f492e6e80bb171111d307658be7e2132ae3Elliott Hughes#if defined(__APPLE__) 4694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <sys/mount.h> 4794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#else 4894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#include <sys/statfs.h> 4994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#endif 5094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 5194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define SOCKET_PATH "installd" 5294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 5394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 5494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood/* elements combined with a valid package name to form paths */ 5594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 5694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define PRIMARY_USER_PREFIX "data/" 5794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define SECONDARY_USER_PREFIX "user/" 5894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 5994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define PKG_DIR_POSTFIX "" 6094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 6194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define PKG_LIB_POSTFIX "/lib" 6294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 6394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define CACHE_DIR_POSTFIX "/cache" 64c796b681e52fbb792da9a5b4f30e935cc927c1d7Jeff Sharkey#define CODE_CACHE_DIR_POSTFIX "/code_cache" 6594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 6694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define APP_SUBDIR "app/" // sub-directory under ANDROID_DATA 67770180a4dd86f8bda6af2e6db4676e99a5bb1548Jeff Sharkey#define PRIV_APP_SUBDIR "priv-app/" // sub-directory under ANDROID_DATA 6894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 6994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define APP_LIB_SUBDIR "app-lib/" // sub-directory under ANDROID_DATA 7094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 7194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define MEDIA_SUBDIR "media/" // sub-directory under ANDROID_DATA 7294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 7394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood/* other handy constants */ 7494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 7594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define PRIVATE_APP_SUBDIR "app-private/" // sub-directory under ANDROID_DATA 7694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 7794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define DALVIK_CACHE_PREFIX "/data/dalvik-cache/" 7894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define DALVIK_CACHE_POSTFIX "/classes.dex" 7994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 8094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define UPDATE_COMMANDS_DIR_PREFIX "/system/etc/updatecmds/" 8194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 8263568b1430d741f40ca008391c854ef1cc880138Mårten Kongstad#define IDMAP_PREFIX "/data/resource-cache/" 8363568b1430d741f40ca008391c854ef1cc880138Mårten Kongstad#define IDMAP_SUFFIX "@idmap" 8463568b1430d741f40ca008391c854ef1cc880138Mårten Kongstad 8594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define PKG_NAME_MAX 128 /* largest allowed package name */ 8694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood#define PKG_PATH_MAX 256 /* max size of any path we use */ 8794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 88c92fb6247d4c4fbc34c0a5deb26ccf538ca9ec81Richard Uhler/* dexopt needed flags matching those in dalvik.system.DexFile */ 89c92fb6247d4c4fbc34c0a5deb26ccf538ca9ec81Richard Uhler#define DEXOPT_DEX2OAT_NEEDED 1 90c92fb6247d4c4fbc34c0a5deb26ccf538ca9ec81Richard Uhler#define DEXOPT_PATCHOAT_NEEDED 2 91c92fb6247d4c4fbc34c0a5deb26ccf538ca9ec81Richard Uhler#define DEXOPT_SELF_PATCHOAT_NEEDED 3 92c92fb6247d4c4fbc34c0a5deb26ccf538ca9ec81Richard Uhler 93e36372423000a906bafae68844ebc6c42d09335aJeff Sharkey#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) 94e36372423000a906bafae68844ebc6c42d09335aJeff Sharkey 9594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood/* data structures */ 9694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 9794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodtypedef struct { 9894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood char* path; 9994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood size_t len; 10094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood} dir_rec_t; 10194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 10294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodtypedef struct { 10394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood size_t count; 10494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood dir_rec_t* dirs; 10594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood} dir_rec_array_t; 10694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 10794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodextern dir_rec_t android_app_dir; 10894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodextern dir_rec_t android_app_private_dir; 10994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodextern dir_rec_t android_app_lib_dir; 11094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodextern dir_rec_t android_data_dir; 11194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodextern dir_rec_t android_asec_dir; 11294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodextern dir_rec_t android_media_dir; 113e23a13299a4f6f2488935b4786cdbb46f46e3d3cJeff Sharkeyextern dir_rec_t android_mnt_expand_dir; 11494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodextern dir_rec_array_t android_system_dirs; 11594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 11694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodtypedef struct cache_dir_struct { 11794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood struct cache_dir_struct* parent; 11894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood int32_t childCount; 11994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood int32_t hiddenCount; 12094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood int32_t deleted; 12194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood char name[]; 12294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood} cache_dir_t; 12394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 12494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodtypedef struct { 12594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood cache_dir_t* dir; 12694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood time_t modTime; 12794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood char name[]; 12894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood} cache_file_t; 12994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 13094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodtypedef struct { 13194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood size_t numDirs; 13294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood size_t availDirs; 13394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood cache_dir_t** dirs; 13494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood size_t numFiles; 13594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood size_t availFiles; 13694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood cache_file_t** files; 13794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood size_t numCollected; 13894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood void* memBlocks; 13994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood int8_t* curMemBlockAvail; 14094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood int8_t* curMemBlockEnd; 14194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood} cache_t; 14294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 14394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood/* util.c */ 14494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 14541ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkey// TODO: rename to create_data_user_package_path 146c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeystd::string create_package_data_path(const char* volume_uuid, 147c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkey const char* package_name, userid_t user); 14894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 14994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint create_pkg_path(char path[PKG_PATH_MAX], 15094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood const char *pkgname, 15194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood const char *postfix, 152abe4fe5b46157ecd2a52d28abf938c816c3ce878Jeff Sharkey userid_t userid); 15394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 15441ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeystd::string create_data_path(const char* volume_uuid); 15541ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkey 15641ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeystd::string create_data_user_path(const char* volume_uuid, userid_t userid); 15794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 15841ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeystd::string create_data_media_path(const char* volume_uuid, userid_t userid); 15994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 160e36372423000a906bafae68844ebc6c42d09335aJeff Sharkeystd::vector<userid_t> get_known_users(const char* volume_uuid); 161e36372423000a906bafae68844ebc6c42d09335aJeff Sharkey 162095c763dd9aa26a206d10ab7c1d7e1c569298fb3Robin Leeint create_user_config_path(char path[PKG_PATH_MAX], userid_t userid); 163095c763dd9aa26a206d10ab7c1d7e1c569298fb3Robin Lee 16494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint create_move_path(char path[PKG_PATH_MAX], 16594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood const char* pkgname, 16694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood const char* leaf, 167abe4fe5b46157ecd2a52d28abf938c816c3ce878Jeff Sharkey userid_t userid); 16894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 16994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint is_valid_package_name(const char* pkgname); 17094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 1711b4003207750ea8fe8c7b03eb32d80f1df83979eNarayan Kamathint create_cache_path(char path[PKG_PATH_MAX], const char *src, 1721b4003207750ea8fe8c7b03eb32d80f1df83979eNarayan Kamath const char *instruction_set); 17394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 17494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint delete_dir_contents(const char *pathname, 17594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood int also_delete_dir, 1763aee2c5c749dc2589f001b26fae1ec958ec89524Narayan Kamath int (*exclusion_predicate)(const char *name, const int is_dir)); 17794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 17894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint delete_dir_contents_fd(int dfd, const char *name); 17994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 18060fd3feecab4336d964ca8e31c7c3220e1afb558Robin Leeint copy_dir_files(const char *srcname, const char *dstname, uid_t owner, gid_t group); 18160fd3feecab4336d964ca8e31c7c3220e1afb558Robin Lee 18294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint lookup_media_dir(char basepath[PATH_MAX], const char *dir); 18394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 18441ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeyint64_t data_disk_free(const std::string& data_path); 18594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 18694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodcache_t* start_cache_collection(); 18794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 18894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodvoid add_cache_files(cache_t* cache, const char *basepath, const char *cachedir); 18994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 19041ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeyvoid clear_cache_files(const std::string& data_path, cache_t* cache, int64_t free_size); 19194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 19294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodvoid finish_cache_collection(cache_t* cache); 19394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 19494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint validate_system_app_path(const char* path); 19594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 19694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint get_path_from_env(dir_rec_t* rec, const char* var); 19794afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 19894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint get_path_from_string(dir_rec_t* rec, const char* path); 19994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 20094afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint copy_and_append(dir_rec_t* dst, const dir_rec_t* src, const char* suffix); 20194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 20294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint validate_apk_path(const char *path); 20394afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 20494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint append_and_increment(char** dst, const char* src, size_t* dst_size); 20594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 20619803807cd7ae01868fcfa50305f4a7dd13765e2Jeff Sharkeychar *build_string2(const char *s1, const char *s2); 20719803807cd7ae01868fcfa50305f4a7dd13765e2Jeff Sharkeychar *build_string3(const char *s1, const char *s2, const char *s3); 20894afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 20994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint ensure_dir(const char* path, mode_t mode, uid_t uid, gid_t gid); 21041ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeyint ensure_media_user_dirs(const char* uuid, userid_t userid); 211095c763dd9aa26a206d10ab7c1d7e1c569298fb3Robin Leeint ensure_config_user_dirs(userid_t userid); 212d93707342a61e66bc3eb2145628158452f577f42Dave Allisonint create_profile_file(const char *pkgname, gid_t gid); 213d93707342a61e66bc3eb2145628158452f577f42Dave Allisonvoid remove_profile_file(const char *pkgname); 21494afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 21594afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood/* commands.c */ 21694afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwood 217c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint install(const char *uuid, const char *pkgname, uid_t uid, gid_t gid, const char *seinfo); 218c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint uninstall(const char *uuid, const char *pkgname, userid_t userid); 21994afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint renamepkg(const char *oldpkgname, const char *newpkgname); 220c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint fix_uid(const char *uuid, const char *pkgname, uid_t uid, gid_t gid); 221c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint delete_user_data(const char *uuid, const char *pkgname, userid_t userid); 222e36372423000a906bafae68844ebc6c42d09335aJeff Sharkeyint make_user_data(const char *uuid, const char *pkgname, uid_t uid, 223e36372423000a906bafae68844ebc6c42d09335aJeff Sharkey userid_t userid, const char* seinfo); 224e36372423000a906bafae68844ebc6c42d09335aJeff Sharkeyint move_user_data(const char* from_uuid, const char *to_uuid, 225e36372423000a906bafae68844ebc6c42d09335aJeff Sharkey const char *package_name, appid_t appid, const char* seinfo); 2267c8bec01790087748ec7afa69a31789828b751f9Robin Leeint make_user_config(userid_t userid); 22741ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeyint delete_user(const char *uuid, userid_t userid); 228c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint delete_cache(const char *uuid, const char *pkgname, userid_t userid); 229c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint delete_code_cache(const char *uuid, const char *pkgname, userid_t userid); 2301b4003207750ea8fe8c7b03eb32d80f1df83979eNarayan Kamathint move_dex(const char *src, const char *dst, const char *instruction_set); 2311b4003207750ea8fe8c7b03eb32d80f1df83979eNarayan Kamathint rm_dex(const char *path, const char *instruction_set); 23294afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint protect(char *pkgname, gid_t gid); 233c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint get_size(const char *uuid, const char *pkgname, userid_t userid, const char *apkpath, const char *libdirpath, 2341b4003207750ea8fe8c7b03eb32d80f1df83979eNarayan Kamath const char *fwdlock_apkpath, const char *asecpath, const char *instruction_set, 2351b4003207750ea8fe8c7b03eb32d80f1df83979eNarayan Kamath int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize); 23641ea424413c0381ef2aa15fc5bd5d4b88abd23c4Jeff Sharkeyint free_cache(const char *uuid, int64_t free_size); 237b1efac103523efccbe671e76cc0eaaeab810415bCalin Juravleint dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName, 238c92fb6247d4c4fbc34c0a5deb26ccf538ca9ec81Richard Uhler const char *instruction_set, int dexopt_needed, bool vm_safe_mode, 239c92fb6247d4c4fbc34c0a5deb26ccf538ca9ec81Richard Uhler bool debuggable, const char* oat_dir); 240091ea779d4e575856c04d51d82f45cc8a6155b5eNarayan Kamathint mark_boot_complete(const char *instruction_set); 24194afecf4b6f437b3ee9a076242402e421c6c07a6Mike Lockwoodint movefiles(); 2426fe28a06012250da85f808a0869f87e06e0bcce9Jeff Sharkeyint linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId); 24363568b1430d741f40ca008391c854ef1cc880138Mårten Kongstadint idmap(const char *target_path, const char *overlay_path, uid_t uid); 244c03de09173f98506e73e7cf7df21fe11795d4b24Jeff Sharkeyint restorecon_data(const char *uuid, const char* pkgName, const char* seinfo, uid_t uid); 24588ce4ff7a95ea2008fa28f12b880ee526e331440Fyodor Kupolovint create_oat_dir(const char* oat_dir, const char *instruction_set); 24688ce4ff7a95ea2008fa28f12b880ee526e331440Fyodor Kupolovint rm_package_dir(const char* apk_path); 24788ce4ff7a95ea2008fa28f12b880ee526e331440Fyodor Kupolovint calculate_oat_file_path(char path[PKG_PATH_MAX], const char *oat_dir, const char *apk_path, 248e23a13299a4f6f2488935b4786cdbb46f46e3d3cJeff Sharkey const char *instruction_set); 249e36372423000a906bafae68844ebc6c42d09335aJeff Sharkeyint move_package_dir(char path[PKG_PATH_MAX], const char *oat_dir, const char *apk_path, 250e36372423000a906bafae68844ebc6c42d09335aJeff Sharkey const char *instruction_set); 251