2

I am developing a Policy Manager for Android. Depending on a given set of rules and the current state of the device, it is supposed to restrict (allow/disallow) the user from starting certain applications.

I am thinking it should be a service running in the background, maybe intercepting all attempts to start applications, checking whether it is OK or not, and then starting them if they are allowed to run. It might also start and stop certain applications by itself, if the state of the device indicates this should be done.

Is there a way to do this programmatically? To control which applications are allowed to start at a certain time and which aren't? And also to stop applications that are already running?

In conclusion, is there a way to programmatically "intercept" attempts to start applications, and possibly deny these?

4

2 回答 2

0

找到了防止应用程序被启用/可见的解决方案。

只需将应用程序 apk 从 /data/app 复制到 /sdcard/ 然后卸载应用程序,然后将 apk 从 /sdcard/ 复制到 system/app/ 最后重新启动设备。这将为您的应用系统提供特权。

现在您可以使用以下代码来启用/禁用您的应用程序(使其完全不可见,即使在设置菜单中也是如此):

包管理器 pm=this.getPackageManager(); pm.setApplicationEnabledSetting("com.gueei.applocker",PackageManager.COMPONENT_ENABLED_STATE_DISABLED,0);

唯一的事情是您必须知道要显示/隐藏的应用程序的包名称。如果您不将您的 apk 复制到 /system/app/,您将收到权限拒绝错误。

于 2014-02-17T15:48:17.763 回答
0

我找到了以下名为 AppLocker 的开源项目:

http://code.google.com/p/applocker/source/checkout

如果任何其他不允许的活动试图进入前台,它会每 100 毫秒检查一次。如果是这样,那么 AppLocker 会在其他应用程序的活动有时间到达 OnCreate() 方法之前快速启动它自己的阻塞密码请求活动(当然取决于检查前台活动状态的频率)。

然而,这个应用程序似乎不适用于 Android 4.1 以上,因为权限 READ_LOGS 已被删除。:-(

但是,似乎在有根设备上,无论如何都可能获得许可。看到这篇文章: 果冻豆(api 16)的READ_LOGS权限

于 2014-02-14T16:45:49.303 回答