diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2011-12-25 17:37:53 +0700 |
---|---|---|
committer | Pawit Pornkitprasan <p.pawit@gmail.com> | 2011-12-25 17:40:11 +0700 |
commit | e352795c49bfd3935a9c166431762cc7df0a10aa (patch) | |
tree | 95294e2498ff9924cfe9d68f73bb849828530eba /cmds | |
parent | d536a7f743c0390cabc642b6047c14d189c88319 (diff) | |
download | frameworks_base-e352795c49bfd3935a9c166431762cc7df0a10aa.zip frameworks_base-e352795c49bfd3935a9c166431762cc7df0a10aa.tar.gz frameworks_base-e352795c49bfd3935a9c166431762cc7df0a10aa.tar.bz2 |
installd: Delete cache properly for devices using datadata partition
The java side already checks /data/data for free space but installd
still checks /data causing it to never reap the cache (because it
thinks that enough free space is available.)
Change-Id: I191f3ceb84df1101ab2918ec0038213d72ec1ce2
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/installd/commands.c | 7 | ||||
-rw-r--r-- | cmds/installd/installd.c | 5 | ||||
-rw-r--r-- | cmds/installd/installd.h | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c index 4ede33f..a420d70 100644 --- a/cmds/installd/commands.c +++ b/cmds/installd/commands.c @@ -19,6 +19,7 @@ /* Directory records that are used in execution of commands. */ dir_rec_t android_data_dir; +dir_rec_t android_datadata_dir; dir_rec_t android_asec_dir; dir_rec_t android_app_dir; dir_rec_t android_app_private_dir; @@ -162,7 +163,11 @@ int delete_cache(const char *pkgname) static int64_t disk_free() { struct statfs sfs; - if (statfs(android_data_dir.path, &sfs) == 0) { + /* Scanning /data/data because on some devices, it's on a different partition + * and scanning /data will yield the incorrect result. (This function is only + * used for freeing space on /data/data so it is okay to be more specific.) + */ + if (statfs(android_datadata_dir.path, &sfs) == 0) { return sfs.f_bavail * sfs.f_bsize; } else { LOGE("Couldn't statfs %s: %s\n", android_data_dir.path, strerror(errno)); diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c index feb6b92..9beee90 100644 --- a/cmds/installd/installd.c +++ b/cmds/installd/installd.c @@ -270,6 +270,11 @@ int initialize_globals() { return -1; } + // Get the android datadata directory. + if (copy_and_append(&android_datadata_dir, &android_data_dir, DATA_SUBDIR) < 0) { + return -1; + } + // Get the android app directory. if (copy_and_append(&android_app_dir, &android_data_dir, APP_SUBDIR) < 0) { return -1; diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index 173cabf..fff44b6 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -58,6 +58,7 @@ #define CACHE_DIR_POSTFIX "/cache" +#define DATA_SUBDIR "data/" // sub-directory under ANDROID_DATA #define APP_SUBDIR "app/" // sub-directory under ANDROID_DATA /* other handy constants */ @@ -87,6 +88,7 @@ typedef struct { extern dir_rec_t android_app_dir; extern dir_rec_t android_app_private_dir; extern dir_rec_t android_data_dir; +extern dir_rec_t android_datadata_dir; extern dir_rec_t android_asec_dir; extern dir_rec_array_t android_system_dirs; |