将“脉冲通知灯”更改为/ Android 上的轨迹球灯设置(仅限 Nexus One?)

发布于 2024-08-20 15:03:52 字数 1783 浏览 11 评论 0原文

在 Nexus One 上(至少在 2.1-update1 中,我认为在 2.1 中),“声音和声音”下有一个设置。显示:“脉冲通知灯”。这似乎并不存在于“2.1 with Google APIs”模拟器映像中。我还没有检查过任何其他设备。

脉冲通知灯:重复脉冲轨迹球灯以获取新通知http://chris.boyle.name/images/20100206-pulse-trackball.png

我想以编程方式设置此功能而无需用户交互,以便制作一个区域设置插件,所以当我醒在办公桌前时,该设备可以吸引我的注意力,而不会在凌晨 4 点有人向我发送垃圾邮件时让它照亮整个房间。非常明亮。

我没有在 android.provider.Settings.System 这个屏幕上还有很多其他东西,所以我查看了平台源代码。在NotificationManagerService中有一些相关部分,位于enqueueNotificationWithTagupdateLightsLocked。这进入 HardwareService 似乎远远超出了关心用户设置的范围。我不知道这个设置是在哪里实现的,也不知道我会如何影响它。

我完全希望答案是“没有这方面的 API”(可能与 Nexus One 特定有关),并且我能做的最好的事情就是安排(使用区域设置或其他方式)ACTION_DISPLAY_SETTINGS 提醒我手动设置该框,这很糟糕。我希望我错过了一些东西,或者 a Google 员工正在阅读这篇文章,可以告诉我这是计划添加到 API 中的吗?

On the Nexus One (at least in 2.1-update1, and I think in 2.1), there is a setting under Sound & Display: "Pulse notification light". This doesn't seem to be present on the "2.1 with Google APIs" emulator image. I've not yet checked any other devices.

Pulse notification light: Pulse trackball light repeatedly for new notifications http://chris.boyle.name/images/20100206-pulse-trackball.png

I want to set this programmatically without user interaction, in order to make a Locale plugin, so the device can grab my attention when I'm awake at my desk, without having it floodlighting the room when someone spams me at 4am. It's quite bright.

I didn't see it in android.provider.Settings.System where many other things on this screen live, so I had a look in the platform source. There are some relevant parts in NotificationManagerService, in enqueueNotificationWithTag and updateLightsLocked. That goes off into HardwareService which seems well past the point of caring about user settings. I've no idea where this setting is implemented or how I might influence it.

I fully expect the answer to be "there is no API for this" (perhaps related to it being Nexus One specific), and that the best I can do is to schedule (using Locale or something else) an Intent of ACTION_DISPLAY_SETTINGS to remind me to set the box manually, which would suck. I'm hoping that I've missed something, or that a Googler is reading this and can tell me that this is planned for addition to the API?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野味少女 2024-08-27 15:03:52

我知道我会因为使用未记录的 API(或者更确切地说,未记录的系统设置名称)而痛苦地死去,但这里有一条神奇的线:

android.provider.Settings.System.putInt(context.getContentResolver(),
        "notification_light_pulse", on ? 1 : 0);

在我自己的设备上使用 sqlite3 找到的。

这是一个方便的区域设置插件中的解决方案: http://chris.boyle.name/projects/ptlp< /a>

I know I'm going to die painfully for using an undocumented API (or rather, undocumented system setting name), but here is the magic line:

android.provider.Settings.System.putInt(context.getContentResolver(),
        "notification_light_pulse", on ? 1 : 0);

Found using sqlite3 on my own device.

Here is this solution in a convenient Locale plugin: http://chris.boyle.name/projects/ptlp

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文