清除缓存,同时删除缓存文件夹

来源:互联网 发布:与犯罪的战争 知乎 编辑:程序博客网 时间:2024/06/05 21:58

在清除应用缓存时,默认不会删除cache文件夹,所以清除缓存后,查看缓存大小为12k(也可能是别的值,只是不为0),可以修改:

frameworks/native/cmds/installd/commands.cpp

int delete_cache(const char *uuid, const char *pkgname, userid_t userid)
{
    std::string _cachedir(
            create_data_user_package_path(uuid, userid, pkgname) + CACHE_DIR_POSTFIX);
    const char* cachedir = _cachedir.c_str();

    /* delete contents, not the directory, no exceptions */
    return delete_dir_contents(cachedir, 1, NULL); //这里把0改成1.
}

 

0 0
原创粉丝点击