0

我有一项服务可以在某些时候将显示器保持在昏暗的水平,它使用“昏暗”的 WakeLock 来实现这一点。它运作良好......除了屏幕从不锁定。也就是说,当保持昏暗的 WL 时,不会出现要求用户滑动和验证的锁定屏幕。

请注意,我正在开发的平台可能对低级 Android Java 框架代码进行了供应商更改,因此这可能不是标准的 Android 行为。而且,我可以访问框架代码,并且可以在必要时更改它。我只是无法弄清楚该策略在代码中的执行位置。

4

1 回答 1

0

When the device is on external power, we want to keep the screen contents visible - but we still want it to lock.

The only way I can think of to do that is for you to maintain your own timer for when to trigger the lock, then to use DevicePolicyManager and lockNow() to lock the device at that point. This requires extra permissions and extra setup work (enabling your app as a device manager).

于 2012-05-04T14:08:19.440 回答