设备策略管理器 - 重置密码 - Android 3.0的问题管理器、策略、密码、设备

2023-09-06 19:07:48 作者:有爱就有恨

我使用的设备策略管理器在我的Andr​​oid应用程序,我有蜂窝设备有问题。当试图调用resetPassword我得到抛出的异常。这不是在升级Froyo或姜饼的情况下,作为这两个的正常工作。

I am using Device Policy Manager in my Android App and I have a problem with Honeycomb devices. When attempting to call resetPassword I get an exception thrown. This is not the case in Froyo or Gingerbread, as both of those work fine.

该错误是:

了java.lang.RuntimeException:无法启动接收Package.Name.Test:java.lang.SecurityException异常:权限拒绝:写作com.android.providers.settings.SettingsProvider URI内容://设置/ PID自= X安全,UID = Y需要android.permission.WRITE_SETTINGS

java.lang.RuntimeException: Unable to start receiver Package.Name.Test: java.lang.SecurityException: Permission Denial: writing com.android.providers.settings.SettingsProvider uri content://settings/secure from pid=x, uid=y requires android.permission.WRITE_SETTINGS

我的Andr​​oid code是如下:

My Android Code is as follows:

DevicePolicyManager mDPM = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);

if ((mDPM.getActiveAdmins() != null) && (mDPM.isAdminActive(new ComponentName(context, DeviceAdmin.class)))) {
    mDPM.resetPassword(extra, DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);
    mDPM.lockNow();
} else {
    Log.d(TAG, "Could not lock because device admin not enabled");
}

在出现该问题:

mDPM.resetPassword(extra, DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);

我的Device_Admin.xml是:

My Device_Admin.xml is:

<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-policies>
        <force-lock />
        <wipe-data />
        <reset-password />
    </uses-policies>
</device-admin>

就像我说的设备管理工作在升级Froyo和姜饼设备很大,虽然我确实有一些问题,使用不同的用户keyguards,一个例子是在Droid X和HTC Sense的。这个问题是与定时。当我打电话lockNow设备将关闭屏幕,但HTC Sense的或的MotoBlur实际上不会锁定键盘锁,直到在设置,安全设置的时间,锁定手机后。

Like I said the device admin works great on Froyo and Gingerbread devices, although I do have some problems with users using different keyguards, an example is the Droid X and HTC Sense. This problem is with timing. When I call lockNow the device will turn off the screen but HTC Sense or MotoBlur will not actually lock the keyguard until the time that was set in Settings, Security, Lock Phone After.

任何帮助将是真棒!我最近刚刚买了一部蜂窝平板在I / O和没有测试应用了此设备上,但我看到市场上的网站中的错误与Xoom的运行3.0的用户。还没有看到任何设备3.1还。

Any help would be awesome! I just recently got a honeycomb tablet at I/O and haven't tested the app out on this device yet, but I see the errors on the market website with users with the Xoom running 3.0. Have not seen any 3.1 devices yet.

推荐答案

我挣扎与此也。该解决方案还列出了你的链接之一,但我会在这里提到它也是在情况下,它可以帮助别人。

I struggled with this also. The solution is also listed on one of your links, but I'll mention it here also in case it helps someone else.

如果该设备是全新的(或恢复出厂设置)为你描述的code失败。 win10系统设备管理器串口号修改方法

If the device is brand new (or factory reset) the code fails as you describe.

如果用户使用的设置菜单中只有一次输入密码,不知何故相同code开始工作,并坚持工作。

If the user enters a password using the settings menu just once, somehow the same code starts working and keeps on working.

一个很奇怪的错误确实!!

A very weird bug indeed!!