我正在尝试使用隐藏的API来激活我的系统应用程序的设备所有者从DevicePolicyManager
方法dpm.setDeviceOwner(cmpName)
开始。此方法引发非法状态异常。我也试过Settings.Global.putInt(context.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
和Settings.Secure.putInt(context.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0);
。但是android studio仍然会引发错误。
注:清单<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
和<uses-permission android:name="android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS" />
]均得到我的许可>
我正在尝试使用DevicePolicyManager方法dpm.setDeviceOwner(cmpName)中的隐藏API激活系统应用程序的设备所有者。此方法引发非法状态异常。我也是...
我在dpm.setProfileOwner
之前调用dpm.setActiveAdmin
时收到了该错误;毕竟,个人资料所有者必须首先是活动管理员。但是,即使您发出适当的命令序列,您也会很快发现,然后您将收到错误:java.lang.IllegalStateException: Unable to set non-default profile owner post-setup
。