android m版本 toor,Android M反射方式freeStorageAndNotify异常

Android 5上有

a bug个,有关任何应用程序可以如何通过一定的权限清除所有缓存文件,但无法清除一个包的缓存文件,除了具有签名级权限.它的细节在哪里

PackageManager has a deleteApplicationCacheFiles() to delete the cache from one package.

This method is hidden from the SDK, and it requires

DELETE_CACHE_FILES, a signature-level permission.

PackageManager also has a freeStorageAndNotify() method, to delete

cache files from all packages. This method is hidden from the SDK, and

it requires the CLEAR_APP_CACHE permission, which is merely flagged

as “dangerous”.

有人建议,DELETE_CACHE_FILES应该有其级别放松,

CLEAR_APP_CACHE应该提高其级别.

框架工程师回应

Note that freeStorageAndNotify's purpose is not to wipe out all cache

files, but to free up X amount of space, for example by play store

before it tries to download and install an app. So there are reasons

to use it that work well with the system, but no reason for an app to

use the method that just blindly erases all cache files for a single

app (that is just there for the Settings app UI).

如果确实不是应用程序错误,那么您没有搞砸权限,它在Marshmallow / 6 / api 23上工作,而不是其他只能意味着它成为签名级别许可的工具,如DELETE_CACHE_FILES.

A signature|system permission, meaning that it can only be held by

apps that are signed with the firmware’s signing key or are installed

on the system partition (e.g., by a rooted device user). As described

in 07001.

考虑到他们的预期用途/愿景(没有任何理由让应用程序使用只是盲目擦除单个应用程序的所有缓存文件的方法),这是有道理的.由于该错误,它甚至可能受到限制.当Android 6的代码出来时,我们会更加了解(目前可用的是5.1.1 – link to PackageManager’s freeStorageAndNotify).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值