7

In Android Q / Android 10 using USES_POLICY_DISABLE_KEYGUARD_FEATURES of the keyguard_features causes a security exception.

devicePolicyManager.setKeyguardDisabledFeatures(componentName, DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE);

java.lang.SecurityException: Admin ComponentInfo{ ... } is not a device owner or profile owner, so may not use policy: disable-keyguard-features

Upon further inspection, I found that android pie has marked KEYGUARD_FEATURES deprecated and removed it in android-q / Android 10. Is there any other alternative to disable keyguard_features

Skyyy
  • 1,539
  • 2
  • 23
  • 60

1 Answers1

3

Generally starting from Android P google started to deprecate Device Admin API completely - further there will be even more deprecations and SecurityExceptions. More info here

There are new ways to handle several deprecated Device Admin API usecases in terms of keyguard usage, though. From your question it is unclear for what do you need to use Device Admin API but here is the description of what has left from vast Device Admin API capabilities in context of keyguard and how to use it.

There are no ways to use this features starting from API 29. There are no workarounds available yet.

Here is described what can you do as IT admin for your company.

Generally - use custom devices with custom AOSP, root and patch, don't bother.

Sorry for the absence of a valid answer but currently there are no such.

Hope it will help you somehow either way.

Pavlo Ostasha
  • 14,527
  • 11
  • 35
  • I guess you can. You just need to create a patch for the system for it to ignore this new rules - this is quite hard. The best option is not to use 29 API devices - I recommend this only because you are thinking about device root thus you app wont be going to the PlayStore, so just limit your app for the devices up to 29 – Pavlo Ostasha Feb 03 '20 at 08:58
  • My app uses `compileSdkVersion` 28 for now. Google recently made changes to google play store policies that app now requires to use minimum 28 version. And in the next few months with the release of a new Android version, they will make 29 version mandatory and my app will become useless. So I was hoping If I can get away with root then my app may still be useful. But according to you play store doesn't allow apps that uses root? I don't know I have seen many apps use root and are available in play store. – Skyyy Feb 03 '20 at 18:04
  • In order to use app that uses some restricted APIs the user has to root their phone themself with special software - you cannot create app that roots user device after installing from play store. Thus it really makes your app irrelevant starting from API 29 - sorry, mate. – Pavlo Ostasha Feb 04 '20 at 09:58