最好的办法Android权限分割成多个应用程序/插件 [英] Best way to split Android permissions into multiple apps / plugins

查看:202
本文介绍了最好的办法Android权限分割成多个应用程序/插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加到我的应用程序的功能未读短信计数,这当然需要一个新的Andr​​oid权限,因为不是所有的用户都需要的功能,我想给它分配一个插件,以避免其主应用程序太多的权限。

应用程序已经在市场上,我并没有指定UID当我第一次发表这么共享UID空间是不是一种选择。

所以问题是,这是做到这一点的最好方法是什么?是AIDL远程服务是唯一的选择,我有?有没有什么简单的解决办法?

解决方案
  

是一个AIDL远程服务是唯一的选择,我有?

没有。

  

有没有什么简单的解决办法?

创建的(无证和不支持)的ContentProvider ,您试图访问。的ContentProvider 代理P>

这个目录表现出这样一个代理的项目,该代理的用户。就我而言,我进行代理的 CallLog ,但相同的概念适用于任何的ContentProvider

键是:

  • 有插件持有所需权限的ContentProvider 是代理

  • 同时拥有应用程序和插件定义自定义签名级别的权限要使用这样的插件(<许可>

  • 有应用程序持有该权限(<使用-许可>

  • 已通过了自定义权限插件保护的ContentProvider 代理(安卓权限

这将让您的应用程序来访问插件的的ContentProvider 代理,而不是泄露访问能力的代理的ContentProvider 给别人。

I would like to add to my app the functionality "unread SMS count" which off course requires a new Android permissions, since not all my users will need that functionality I'd like to distribute it as a plugin in order to avoid having too many permissions on the main app.

Application is already in the market and i did not specify an "UID" when i first published it so the shared "UID" space is not an option.

So question is, which is the best way to do this? Is an AIDL remote service the only option i have? Is there any simpler solution?

解决方案

Is an AIDL remote service the only option i have?

No.

Is there any simpler solution?

Create a ContentProvider proxy for the (undocumented and unsupported) ContentProvider that you are trying to access.

The projects in this directory demonstrate such a proxy and a consumer of that proxy. In my case, I am proxying the CallLog, but the same concept applies for any ContentProvider.

The keys are:

  • Have the plugin hold the desired permission for the ContentProvider it is proxying

  • Have both the app and the plugin define a custom signature-level permission to be used by such plugins (<permission>)

  • Have the app hold that permission (<uses-permission>)

  • Have the plugin protect the ContentProvider proxy via that custom permission (android:permission)

This will allow your app to access the plugin's ContentProvider proxy, while not leaking the capability of accessing the proxied ContentProvider to others.

这篇关于最好的办法Android权限分割成多个应用程序/插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆