WIP: Android 6 Device Owner unattended install
This is a very early merge request, just to show how we could use Android 6's "device owner" PackageInstaller API.
As can be seen by comparing https://github.com/android/platform_frameworks_base/blob/59701b9ba5c453e327bc0e6873a9f6ff87a10391/services/core/java/com/android/server/pm/PackageInstallerSession.java#L211 with https://github.com/android/platform_frameworks_base/blob/marshmallow-release/services/core/java/com/android/server/pm/PackageInstallerSession.java#L221 the PackageInstaller API has been enabled for "device owners" on Android 6.
So I hacked a proof of concept code and it looks like it works.
If you like to test:
- get this branch
- To make F-Droid a device owner, do "adb shell" and then "dpm set-device-owner org.fdroid.fdroid/.receiver.DeviceOwnerReceiver" (this does not require root). However I suspect that if we want to execute this without adb and in the context of F-Droid it will require root.
- Install any app
I am not entirely sure what else can be done as a device owner, I will look into this more later. The only drawback I saw was that a notification is shown (but no further user interaction was necessary), as seen on the screenshot:
What do you think?