1 概述
关于Provider的安全的东西,一直不太理解,有时候会比较奇怪,这里有个盲点就Provider的call函数,之前没有搞定,做个小实验,测试一下,写一篇文章记录
参考文章:
Android Content Provider
Android Context ChecPermission
2 Google的说明
上面Google官方说明任何调用这个Call函数的,都必须自己进行权限校验,疑问就在于什么情况下Call 函数和Provider本身的权限是一致的。
3 对Call函数的Test
3.1 Provider Test 源码
3.1.1 权限设置
<permission android:name="com.example.author.permission" android:protectionLevel="dangerous"/>
<permission android:name="com.example.author.read_permission" android:protectionLevel="dangerous"/>
<permission android:name="com.example.author.write_permission" android:protectionLevel="dangerous"/>
<uses-permission android:name="com.example.author.permission" />
<uses-permission android:name="com.example.author.read_permission" />
<uses-permission android:name="com.example.author.write_permission" />
3.1.2 Provider的Call函数
@Nullable
@Override
public Bundle call(@NonNull String authority, @NonNull String method, @Nullable String arg, @Nullable Bundle extras) {
Log.d("com.example.call", String.format("Provider#call(%s, %s)", method, arg));
Log.i("com.example.call", String.format("Provider#call uid (%s)", Binde