Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error making HomerPlayer privileged application, missing intent-filter declaration? #19

Open
TheIronMarx opened this issue Sep 12, 2019 · 8 comments

Comments

@TheIronMarx
Copy link

I've set up multiple tablets in full kiosk mode with homerplayer. I always seem to have issues granting privileges to the app with ADB for one reason or another, but this one is new to me:
Error: DeviceAdminReceiver ComponentInfo{com.studio4plus.homerplayer/com.studio4plus.homerplayer.HomerPlayerDeviceAdmin} must be protected with android.permission.BIND_DEVICE_ADMIN

Reading this, https://developer.android.com/reference/kotlin/android/app/admin/DeviceAdminReceiver, I would guess that the Manifest is missing a specific intent-filter for DEVICE_ADMIN_ENABLED, but why this wouldn't be an issue in the past is beyond me.

Any thoughts?

@DonnKey
Copy link

DonnKey commented Sep 12, 2019 via email

@msimonides
Copy link
Owner

TL;DR

There are secretly two versions of Homer Player: the one in Google Play Store that cannot be set as a device owner on Android 7+ and the one here on Github that has all the necessary permissions.

For full-kiosk mode please use the latter (but also see the section on QR codes below).

Yes, I should make it known that there are two versions of the app.

Long explanation

The "device owner" mode has been introduced in Android 5 and didn't require the BIND_DEVICE_ADMIN permission back then. Starting with Android 7 the permission is needed.

The files released here on Github do have the permission.
The version in Google Play doesn't, and the reason is their policy.

Google Play Store policy has some requirements for the use of the BIND_DEVICE_ADMIN permission:

Provide prominent user facing disclosure of this usage before asking the user to enable this permission within your app. Your disclosure must meet each of the following requirements: ...

(you only get this detailed info when your app is removed from the Play Store)

This is reasonable for apps that send the ACTION_ADD_DEVICE_ADMIN intent to request becoming a device admin (which is different than a device owner). These apps respond to user action (e.g. "enable feature X" from within the app's UI) and that's when they are supposed to show the disclosure message and only then request the permission (in runtime!).

This doesn't work for a feature that requires expert knowledge and ADB to enable. What's more, I can't comply with the policy because the permission needs to be hard-coded in the manifest. But in Play Store's defense I can say that the device owner mode is an enterprise functionality that "takes over" the device and as such doesn't really belong in consumer apps.
Although in my opinion they should have used a completely separate permission.

Therefore there are these two versions of the app and I am sorry about this.

(it might be best to split the device owner component into a separate app and distribute it separately).

QR code provisioning

Starting with Android 7 Google not only introduced tighter security with this permission but also added a new method of provisioning a device: scanning a QR code. This may be by far the best and easiest way to do this but so far no-one but me has tested it for Homer Player.

Here's the process: https://developers.google.com/android/work/play/emm-api/prov-devices#qr_code_provisioning_process

And here's a QR code for Homer Player:
image

@mtbottens
Copy link

@msimonides Glad you commented this here, FYI, QR code method did not work for us, but downloading the APK worked like a charm.

Thanks for your work on this!

@techge
Copy link

techge commented Oct 1, 2021

Slightly related, but afaik not noted elsewhere...

For those of you trying to get the privilege for device manager done on a phone that does not support QR privisioning (e.g. a lineageos), but are able to use a shell:

You can use the adb shell and the following command to give the right permissions (reset the device nonetheless, $people say there shall be no accounts configured for this to work)

dpm set-device-owner com.studio4plus.homerplayer/.HomerPlayerDeviceAdmin

@msimonides
Copy link
Owner

Thank you @techge. I should probably add this to the documentation for Android 7+. This is described in the documentation for Android 5 and 6 but people with newer devices are unlikely to check it.

Please be aware that on Android 7+ the app needs to declare the BIND_DEVICE_ADMIN permission which is only present in builds downloaded from GitHub, not Play Store, as discussed above.

@techge
Copy link

techge commented Oct 2, 2021

This is described in the documentation for Android 5 and 6 but people with newer devices are unlikely to check it.

I see. Yes, indeed, I wasn't even thinking about looking there 😅

@DonnKey
Copy link

DonnKey commented Oct 2, 2021 via email

@AlessioM
Copy link

In case anyone else stumbles across this, for version 1.0.9 the command is (only tested under Android 5 though)
adb shell dpm set-device-owner com.studio4plus.homerplayer/.deviceadmin.HomerPlayerDeviceAdmin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants