手机更新时间后,过期的闹钟异常响起

前段时间测试提了一个bug,是这样的,设置一个闹铃,等待闹铃时间到,闹铃响应,然后插拔电池,让手机系统时间恢复到出厂默认时间,让手机联网,等待手机时间更新后,已经过期的闹钟突然响了,这让人百思不得其解,我在试图修改的时候发现在Desclock里竟然没有比对系统时间与设置闹铃时间比对然后执行响铃的逻辑(可能是本人水平有限),在解析唯一一个传入进来的Intent的时候发现唯一一个没被处理的消息类型TIME_TICk,然后追踪发现在framework的AlrmManagerService中有一个PengdingIntent是发送这个消息的(猜想比对时间的逻辑可能更加底层),当时在想如果在发送PengdingIntent的时候加个判断,如果当前时间与系统时间的差值大于一分钟,就停止响铃,可一想又不对,如果我在这里禁止里一分钟意外的响铃,那么延时闹钟也会被禁掉,所以将此问题提交给MTK平台,他们给出的回复是这样的:

After change the system time, System will send TIME_SET broadcast, DeckClock receives it and set the passed alarm as MISSED state.
however, because the user has set an valid alarm before, AlarmManager will send the alarm broadcast either, and this action will make the alarm rings.
That is the problem, if DeskClock receives the AlarmManager’s action first, it will ring, then receive TIME_SET, that it makes the alarm dismiss.
The behavior is expected as per Google default design.
The processsing of broadcast for TIME_SET may be parsed as per the system scheduling.
In some cases the AlarmManager action for alarm expiry may be parsed before processing TIME_SET by alarm service.
This causes the Alarm screen to appear. However, as soon as the TIME_SET is processed, we configure the MISSED_STATE for the alarm and dismiss the screen.

由此可知这根本不是bug,而是谷歌设计师当初设计的时候就是这样的

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值