Android知识点 363 —— dumpsys alarm

news/2024/11/29 6:40:24/

转载:原文 https://www.cnblogs.com/yejintianming00/p/9339701.html

返回知识列表 Android知识点list


Dumpsys alarm查看应用程序唤醒命令:命令的完整输出在文章最后面。

    在安卓adb root进如命令行后(没有root或者root群组的权限执行不了该命令),

Pending alarm batches: 48

当应用设置ALARM的时候,系统不会将这些ALARM在设置的准确时间内触发,而将用一种批量触发(batches mode)的策略,这样可以最小化地使系统从休眠状态醒来,最低程度地减少电池的消耗,即将一批触发时间接近的闹钟,压缩到某一个时间段内一起触发,而不是一个个触发,这样系统会很难休眠。

上面的字段则表示,有48个ALARM将被触发,dumpsys alarm 输出后,就是现实每一个闹钟的触发详情,如:

4293d3a8: 批处理模式下的内部ID号num = 1:表示在该batch中,只有一个闹钟start和end后的时间,表示自系统启动后,流逝的时间,该段时间粗略的表示,该闹钟会在start和end之间的时间触发
RTC #0: Alarm{4293d358 type 1 com.android.chrome}   type=1 whenElapsed=1369361 when=+19s304ms window=-1 repeatInterval=0 count=0operation=PendingIntent{429e4500: PendingIntentRecord{429dbbc8 com.android.chrome broadcastIntent}}

对于每一个alrm,都会有如上所示的三行解说

RTC:表示ALARM的类型,一般有:
RTC_WAKEUP = 0, 
RTC = 1, 
ELAPSED_REALTIME_WAKEUP = 2, 
ELAPSED_REALTIME = 3   具体可查看AlarmManagerService.java#0:表示在该批量模式中,该ALARM的标号,取值0~n-1,n为该batch中alarm个数4293d358 :闹钟的内部编号com.android.chrome:设置该闹钟的应用包名type=1:闹钟的类型,即第一条中提到的几个闹钟类型. 
******************************************************************************
这个很重要,你如果是调查异常开机问题,就需要注意只有type = 0, type = 2 才会唤醒电视。
******************************************************************************whenElapsed=1369361:该闹钟会在系统开机后,大概1369361后触发,这是大概时间when=+19s304ms:该闹钟会在执行完这条dumpsys alarm命令后,19秒304ms后触发window=:根据该alarm被调度的不同方法,设置不同的值,如果该alarm是 
setExact()或setAlarmClock()方法调用的,该值为 AlarmManager.WINDOW_EXACT(=0),
如果是 setInexactRepeating(),则赋值为AlarmManager.WINDOW_HEURISTIC(=- 1),
然而API的level不同该值也不同,API小于19(KITKAT)的是WINDOW_EXACT,大于19的是WINDOW_HEURISTICrepeatInterval=900000:改闹钟的重复频率,900000ms后重复,0表示不重复count=:表示该alarm因为某些原因而被忽略了的次数,0表示没有被忽略过operation=PendingIntent{...}:与pendingIntent相关,该intent被实例化后,可以发送广播,启动服务,或者启动Activity, 说白了就是唤醒应用的操作。

Broadcast Ref Count: 0

为了使得系统在醒来后,发送必要的广播帧,并且保证在所有的广播帧没有发送出去之前,系统不要进入睡眠状态,内部定义了一个变量:mBroadcastRefCount ,它的初始值是0,并且当需要发送的广播在队列配对的时候,该变量的值就会递增,发送一个广播后则递减,当减到0的时候,就会释放它持有的wakelock,而让系统进入休眠状态。

所以,Broadcast Ref Count: 0 表示在运行dumpsys alarm的时刻,该时刻并没有广播要发送。

top alarms:根据应用的唤醒系统的时间排行,取最长时间的前十名,然后按照降序列出,有助于找出第三方app因为编程不规范,而导致极度耗电
Alarm Stats列出所有系统中应用设置alarm的情况,可以排查设置的闹钟是否起作用了格式如下:
com.example.someapp +1s857ms running, 0 wakeups:+1s817ms 0 wakes 83 alarms: cmp={com.example.someapp/com.example.someapp.someservice}+40ms 0 wakes 1 alarms: cmp={com.example.someapp/com.example.someapp.someotherservice}
com.example.someap:设置alarm的应用包名+1s857ms running:系统总体被该应用所有的alarm消耗的时间0 wakeups:设备被闹钟唤醒的次数

 

接下来是每个alarm的情况:+1s817ms:该alarm消耗的时间0 wakes:设备被唤醒的次数83 alarms:alarm被触发的次数,重复闹钟,该值大于1cmp={...}:alarm被触发,则启动该服务,服务实例位置在{}中声明
如果触发的是广播,则格式如:android +4m51s566ms running, 281 wakeups:+2m46s583ms 0 wakes 1224 alarms: act=android.intent.action.TIME_TICK+1m25s624ms 89 wakes 89 alarms: act=android.content.syncmanager.SYNC_ALARM+52s898ms 0 wakes 41 alarms: act=com.android.server.action.NETWORK_STATS_POLL...act=...:发送广播的名称

注意:-wakes 是指后面的alarm的次数中有多少次是将设备从休眠中唤醒的

dumpsys alarm的完整信息输出:--------------------------------------------------见下

dumpsys alarmCurrent Alarm Manager state:Settings:min_futurity=+5s0msmin_interval=+1m0s0mslistener_timeout=+5s0msallow_while_idle_short_time=+5s0msallow_while_idle_long_time=+9m0s0msallow_while_idle_whitelist_duration=+10s0msnowRTC=1483279792773=2017-01-01 22:09:52 nowELAPSED=782053mLastTimeChangeClockTime=1483279201060=2017-01-01 22:00:01mLastTimeChangeRealtime=+3m10s339msTime since non-interactive: +19s736msMax wakeup delay: +2m0s0msTime since last dispatch: +33s262msNext non-wakeup delivery time: -21m55s934msNext non-wakeup alarm: +7s226ms = 2017-01-01 22:09:59Next wakeup: +29s767ms = 2017-01-01 22:10:22Last wakeup: -33s262ms set at -30s232msNum time change events: 1mDeviceIdleUserWhitelist=[]Next alarm clock information:Pending alarm batches: 15Batch{dbb22e2 num=1 start=789279 end=789279 flgs=0x1}:ELAPSED #0: Alarm{a1ae673 type 3 when 789279 android}tag=*alarm*:android.intent.action.TIME_TICKtype=3 whenElapsed=+7s226ms when=+7s226mswindow=0 repeatInterval=0 count=0 flags=0x1operation=PendingIntent{f9d5930: PendingIntentRecord{24bc9a9 android broadcastIntent}}Batch{36c8b2e num=1 start=811820 end=811820 flgs=0x1}:ELAPSED_WAKEUP #0: Alarm{b3376cf type 2 when 811820 com.cleanmaster.mguard}tag=*walarm*:com.cmcm.chargemaster.action.START_DETECTING_UNSTABLE_PLUGtype=2 whenElapsed=+29s767ms when=+29s767mswindow=0 repeatInterval=0 count=0 flags=0x1operation=PendingIntent{636d85c: PendingIntentRecord{e6e5765 com.cleanmaster.mguard broadcastIntent}}Batch{ba2c3a num=11 start=941210 end=1055391}:ELAPSED_WAKEUP #10: Alarm{79ab0eb type 2 when 941210 android}tag=*walarm*:*job.deadline*type=2 whenElapsed=+2m39s157ms when=+2m39s157mswindow=+10m39s186ms repeatInterval=0 count=0 flags=0x0operation=nulllistener=android.app.AlarmManager$ListenerWrapper@f871e48ELAPSED #9: Alarm{b7204e1 type 3 when 808579 com.cleanmaster.mguard}tag=*alarm*:com.cleanmaster.screensave.intent.action.REPORT_INFOC_CMC_AVOIDtype=3 whenElapsed=+26s526ms when=+26s526mswindow=+18h0m0s0ms repeatInterval=86400000 count=0 flags=0x0operation=PendingIntent{40ed206: PendingIntentRecord{4f170c7 com.cleanmaster.mguard broadcastIntent}}RTC #8: Alarm{c13d6f4 type 1 when 1483279779410 com.cleanmaster.mguard}tag=*alarm*:com.ijinshan.common.kinfoc.ActivityTimertype=1 whenElapsed=-13s363ms when=2017-01-01 22:09:39window=+2h34m45s0ms repeatInterval=12380000 count=0 flags=0x0operation=PendingIntent{4a90e1d: PendingIntentRecord{5b60892 com.cleanmaster.mguard broadcastIntent}}ELAPSED #7: Alarm{80a5263 type 3 when 0 com.cleanmaster.mguard}tag=*alarm*:android.scenemonitor.ap_hotspot_workeralarmtype=3 whenElapsed=-18s192ms when=--window=+11m15s0ms repeatInterval=900000 count=0 flags=0x0operation=PendingIntent{d116e60: PendingIntentRecord{e4d6f19 com.cleanmaster.mguard broadcastIntent}}RTC_WAKEUP #6: Alarm{5281bde type 0 when 1483279764491 com.cleanmaster.mguard}tag=*walarm*:com.cleanmaster.service.ACTION_UPDATE_CLOUD_CFGtype=0 whenElapsed=-28s282ms when=2017-01-01 22:09:24window=+4h30m0s0ms repeatInterval=21600000 count=0 flags=0x0operation=PendingIntent{645b1bf: PendingIntentRecord{8f108c com.cleanmaster.mguard startService}}RTC #5: Alarm{c3ce3d5 type 1 when 1483279762461 com.cleanmaster.mguard}tag=*alarm*:com.ijinshan.cleanmaster_check_apk_updatetype=1 whenElapsed=-30s312ms when=2017-01-01 22:09:22window=+18h0m0s0ms repeatInterval=86400000 count=0 flags=0x0operation=PendingIntent{f1617ea: PendingIntentRecord{adaadb com.cleanmaster.mguard broadcastIntent}}ELAPSED #4: Alarm{462a978 type 3 when 748928 com.cleanmaster.mguard}tag=*alarm*:com.cleanmaster.NotificationDisturbAlarmtype=3 whenElapsed=-33s125ms when=-33s125mswindow=+4h30m0s0ms repeatInterval=21600000 count=0 flags=0x0operation=PendingIntent{874e851: PendingIntentRecord{835c8b6 com.cleanmaster.mguard broadcastIntent}}ELAPSED #3: Alarm{4d219b7 type 3 when 748850 com.cleanmaster.mguard}tag=*alarm*:android.scenetrigger.workeralarmtype=3 whenElapsed=-33s203ms when=-33s203mswindow=+22m30s0ms repeatInterval=1800000 count=0 flags=0x0operation=PendingIntent{bd4e524: PendingIntentRecord{54eb88d com.cleanmaster.mguard broadcastIntent}}ELAPSED_WAKEUP #2: Alarm{8cdba42 type 2 when 641210 android}tag=*walarm*:*job.delay*type=2 whenElapsed=-2m20s843ms when=-2m20s843mswindow=+6m54s181ms repeatInterval=0 count=0 flags=0x0operation=nulllistener=android.app.AlarmManager$ListenerWrapper@f649a53RTC #1: Alarm{40d2f90 type 1 when 1483279200000 com.emoji.keyboard.touchpal}tag=*alarm*:com.cootek.usage.alarm_operationtype=1 whenElapsed=-9m52s773ms when=2017-01-01 22:00:00window=+45m0s0ms repeatInterval=3600000 count=0 flags=0x0operation=PendingIntent{77b5089: PendingIntentRecord{501388e com.emoji.keyboard.touchpal broadcastIntent}}RTC #0: Alarm{c9488af type 1 when 1483279200000 com.emoji.keyboard.touchpal}tag=*alarm*:com.cootek.presentation.action.CONFIG_UPDATEtype=1 whenElapsed=-9m52s774ms when=2017-01-01 22:00:00window=+45m0s0ms repeatInterval=3600000 count=0 flags=0x0operation=PendingIntent{33db4bc: PendingIntentRecord{3bf6c45 com.emoji.keyboard.touchpal broadcastIntent}}Batch{ddc4f9a num=1 start=1090280 end=1090280 flgs=0x1}:RTC #0: Alarm{22b00cb type 1 when 1483280101000 com.android.deskclock}tag=*alarm*:com.android.deskclock.ON_QUARTER_HOURtype=1 whenElapsed=+5m8s227ms when=2017-01-01 22:15:01window=0 repeatInterval=0 count=0 flags=0x1operation=PendingIntent{e8f60a8: PendingIntentRecord{c6f87c1 com.android.deskclock broadcastIntent}}Batch{71fcb66 num=1 start=1090280 end=1090280 flgs=0x1}:RTC #0: Alarm{f66dea7 type 1 when 1483280101000 com.android.deskclock}tag=*alarm*:com.android.deskclock.ON_QUARTER_HOURtype=1 whenElapsed=+5m8s227ms when=2017-01-01 22:15:01window=0 repeatInterval=0 count=0 flags=0x1operation=PendingIntent{2cddf54: PendingIntentRecord{aabdefd com.android.deskclock broadcastIntent}}Batch{dcd37f2 num=1 start=1362315 end=1362315 flgs=0x5}:RTC_WAKEUP #0: Alarm{e98be43 type 0 when 1483280373035 com.android.systemui}tag=*walarm*:screen_off_app_cleartype=0 whenElapsed=+9m40s262ms when=2017-01-01 22:19:33window=0 repeatInterval=0 count=0 flags=0x5operation=PendingIntent{bd39cc0: PendingIntentRecord{f5c6df9 com.android.systemui startService}}Batch{b72e13e num=1 start=1368880 end=1818880}:ELAPSED #0: Alarm{47efb9f type 3 when 1368880 com.cleanmaster.mguard}tag=*alarm*:android.scenemonitor.badchargingworkeralarmtype=3 whenElapsed=+9m46s827ms when=+9m46s827mswindow=+7m30s0ms repeatInterval=0 count=0 flags=0x0operation=PendingIntent{6b5c4ec: PendingIntentRecord{7ecf0b5 com.cleanmaster.mguard broadcastIntent}}Batch{237d34a num=4 start=2562461 end=3169687 flgs=0x8}:RTC #3: Alarm{961b2bb type 1 when 1483281573181 com.cleanmaster.mguard}tag=*alarm*:com.cleanmaster.service.ALARM_START_BG_SCAN_MEDIASTOREtype=1 whenElapsed=+29m40s408ms when=2017-01-01 22:39:33window=+22m29s999ms repeatInterval=0 count=0 flags=0x0operation=PendingIntent{ab043d8: PendingIntentRecord{2c8e331 com.cleanmaster.mguard broadcastIntent}}RTC #2: Alarm{da7da16 type 1 when 1483280850358 com.emoji.keyboard.touchpal}tag=*alarm*:com.cootek.abtest.ACTION_UPDATE_CONFIGtype=1 whenElapsed=+17m37s585ms when=2017-01-01 22:27:30window=+22m30s0ms repeatInterval=1800000 count=0 flags=0x0operation=PendingIntent{7eebf97: PendingIntentRecord{4d1c584 com.emoji.keyboard.touchpal startService}}RTC #1: Alarm{f97816d type 1 when 1483280831598 com.emoji.keyboard.touchpal}tag=*alarm*:com.emoji.keyboard.touchpal.INTERNAL_ACTION.noah_invest_temptype=1 whenElapsed=+17m18s825ms when=2017-01-01 22:27:11window=+22m30s0ms repeatInterval=1800000 count=0 flags=0x0operation=PendingIntent{43f81a2: PendingIntentRecord{dd5be33 com.emoji.keyboard.touchpal broadcastIntent}}ELAPSED #0: Alarm{267b5f0 type 3 when 1819687 android}tag=*alarm*:com.android.server.action.NETWORK_STATS_POLLtype=3 whenElapsed=+17m17s634ms when=+17m17s634mswindow=+22m30s0ms repeatInterval=1800000 count=0 flags=0x8operation=PendingIntent{737c769: PendingIntentRecord{5b815ee android broadcastIntent}}Batch{a240a8f num=2 start=5022340 end=5322340 flgs=0x8}:ELAPSED_WAKEUP #1: Alarm{62a411c type 2 when 5022340 android}tag=*walarm*:com.android.server.ACTION_TRIGGER_IDLEtype=2 whenElapsed=+1h10m40s287ms when=+1h10m40s287mswindow=+5m0s0ms repeatInterval=0 count=0 flags=0x8operation=PendingIntent{77c7125: PendingIntentRecord{213a2fa android broadcastIntent}}RTC #0: Alarm{560c0ab type 1 when 1483282631596 com.emoji.keyboard.touchpal}tag=*alarm*:com.emoji.keyboard.touchpal.INTERNAL_ACTION.auto_updatetype=1 whenElapsed=+47m18s823ms when=2017-01-01 22:57:11window=+45m0s0ms repeatInterval=3600000 count=0 flags=0x0operation=PendingIntent{4285308: PendingIntentRecord{ea7faa1 com.emoji.keyboard.touchpal broadcastIntent}}Batch{568f4c6 num=1 start=7389280 end=7389280 flgs=0x1}:RTC #0: Alarm{f68bc87 type 1 when 1483286400000 android}tag=*alarm*:android.intent.action.DATE_CHANGEDtype=1 whenElapsed=+1h50m7s227ms when=2017-01-02 00:00:00window=0 repeatInterval=0 count=0 flags=0x1operation=PendingIntent{7397b4: PendingIntentRecord{2a89fdd android broadcastIntent}}Batch{46f9752 num=2 start=11808753 end=13348973}:RTC #1: Alarm{f0a9a23 type 1 when 1483290819473 com.cleanmaster.mguard}tag=*alarm*:com.ijinshan.cleanmaster_get_versionstype=1 whenElapsed=+3h3m46s700ms when=2017-01-02 01:13:39window=+4h36m30s0ms repeatInterval=22120000 count=0 flags=0x0operation=PendingIntent{c8c7b20: PendingIntentRecord{145cd9 com.cleanmaster.mguard broadcastIntent}}RTC #0: Alarm{5cbd69e type 1 when 1483286959693 com.cleanmaster.mguard}tag=*alarm*:com.cleanmaster.mguard.SERVICE_PROCESS_CHECKERtype=1 whenElapsed=+1h59m26s920ms when=2017-01-02 00:09:19window=+1h30m0s0ms repeatInterval=7200000 count=0 flags=0x0operation=PendingIntent{f62b57f: PendingIntentRecord{f8e294c com.cleanmaster.mguard broadcastIntent}}Batch{ce4ed95 num=2 start=14610726 end=25005724}:RTC #1: Alarm{41abeaa type 1 when 1483293621446 com.cleanmaster.mguard}tag=*alarm*:weather_alert_notification_manager_actiontype=1 whenElapsed=+3h50m28s673ms when=2017-01-02 02:00:21window=+2h53m14s998ms repeatInterval=0 count=0 flags=0x0operation=PendingIntent{6f72a9b: PendingIntentRecord{51a8e38 com.cleanmaster.mguard broadcastIntent}}RTC #0: Alarm{af3ce11 type 1 when 1483293600000 com.cleanmaster.mguard}tag=*alarm*:com.cleanmaster.service.ACTION_LOCATION_UPDATEtype=1 whenElapsed=+3h50m7s227ms when=2017-01-02 02:00:00window=+4h30m0s0ms repeatInterval=21600000 count=0 flags=0x0operation=PendingIntent{4be1b76: PendingIntentRecord{493d577 com.cleanmaster.mguard startService}}Batch{f0655e4 num=1 start=32589280 end=32589280 flgs=0x9}:RTC_WAKEUP #0: Alarm{6363a4d type 0 when 1483311600000 android}tag=*walarm*:ScheduleConditionProvider.EVALUATEtype=0 whenElapsed=+8h50m7s227ms when=2017-01-02 07:00:00window=0 repeatInterval=0 count=0 flags=0x9operation=PendingIntent{f687902: PendingIntentRecord{de65213 android broadcastIntent}}Batch{5c4ec50 num=4 start=43284665 end=44848593}:RTC #3: Alarm{ab92e49 type 1 when 1483322295385 com.cleanmaster.mguard}tag=*alarm*:com.cleanmaster.service.ACTION_WEATHER_UPDATEtype=1 whenElapsed=+11h48m22s612ms when=2017-01-02 09:58:15window=+9h0m0s0ms repeatInterval=43200000 count=0 flags=0x0operation=PendingIntent{269234e: PendingIntentRecord{bd9fc6f com.cleanmaster.mguard startService}}RTC_WAKEUP #2: Alarm{3947d7c type 0 when 1483321497763 com.mobisystems.office}tag=*walarm*:com.mobisystems.office.notifications_chaintype=0 whenElapsed=+11h35m4s990ms when=2017-01-02 09:44:57window=+18h0m0s0ms repeatInterval=86400000 count=0 flags=0x0operation=PendingIntent{e5d6605: PendingIntentRecord{fb8265a com.mobisystems.office startService}}RTC_WAKEUP #1: Alarm{b3f08b type 0 when 1483311585697 com.mobisystems.office}tag=*walarm*:com.mobisystems.office.dailycacheprunetype=0 whenElapsed=+8h49m52s924ms when=2017-01-02 06:59:45window=+18h0m0s0ms repeatInterval=86400000 count=0 flags=0x0operation=PendingIntent{669f568: PendingIntentRecord{a535d81 com.mobisystems.office startService}}RTC #0: Alarm{ec24e26 type 1 when 1483304959314 com.cleanmaster.mguard}tag=*alarm*:ss_delay_task_actiontype=1 whenElapsed=+6h59m26s541ms when=2017-01-02 05:09:19window=+5h14m59s999ms repeatInterval=0 count=0 flags=0x0operation=PendingIntent{3ef0a67: PendingIntentRecord{49d0014 com.cleanmaster.mguard broadcastIntent}}Batch{5750bd num=3 start=87151578 end=123623675}:RTC #2: Alarm{ef526b2 type 1 when 1483366162298 com.cleanmaster.mguard}tag=*alarm*:com.cmcm.adsdk.ConfigMonitor_Actiontype=1 whenElapsed=+23h59m29s525ms when=2017-01-02 22:09:22window=+18h0m0s0ms repeatInterval=86400000 count=0 flags=0x0operation=PendingIntent{fd7e603: PendingIntentRecord{540980 com.cleanmaster.mguard broadcastIntent}}RTC_WAKEUP #1: Alarm{7ad3bb9 type 0 when 1483350207514 com.mobisystems.office}tag=*walarm*:com.mobisystems.office.dormant_user_notificationtype=0 whenElapsed=+19h33m34s741ms when=2017-01-02 17:43:27window=+18h0m0s0ms repeatInterval=86400000 count=0 flags=0x0operation=PendingIntent{70afbfe: PendingIntentRecord{ce8df5f com.mobisystems.office startService}}RTC #0: Alarm{5b03dac type 1 when 1483349973730 com.cleanmaster.mguard}tag=*alarm*:com.cleanmaster.service.ALARM_SHOW_FREQUENCE_ACTIONtype=1 whenElapsed=+19h29m40s957ms when=2017-01-02 17:39:33window=+14h37m40s665ms repeatInterval=0 count=0 flags=0x0operation=PendingIntent{ddcda75: PendingIntentRecord{d16da0a com.cleanmaster.mguard broadcastIntent}}Past-due non-wakeup alarms: (none)Number of delayed alarms: 6, total delay time: +6m8s777msMax delay time: +5m25s575ms, max non-interactive time: +11m50s25msBroadcast ref count: 0mAllowWhileIdleMinTime=+5s0msLast allow while idle dispatch times:UID u0a51: -2m22s958msTop Alarms:+17s621ms running, 0 wakeups, 2 alarms: u0a54:com.emoji.keyboard.touchpal*alarm*:com.cootek.presentation.action.CONFIG_UPDATE+16s145ms running, 0 wakeups, 1 alarms: u0a47:com.cleanmaster.mguard*alarm*:com.cleanmaster.NotificationDisturbAlarm+16s140ms running, 0 wakeups, 1 alarms: u0a47:com.cleanmaster.mguard*alarm*:android.scenetrigger.workeralarm+16s139ms running, 0 wakeups, 1 alarms: u0a54:com.emoji.keyboard.touchpal*alarm*:com.emoji.keyboard.touchpal.INTERNAL_ACTION.noah_invest_temp+16s127ms running, 0 wakeups, 1 alarms: u0a54:com.emoji.keyboard.touchpal*alarm*:com.emoji.keyboard.touchpal.INTERNAL_ACTION.auto_update+16s120ms running, 0 wakeups, 1 alarms: 1000:android*alarm*:com.android.server.action.NETWORK_STATS_POLL+2s616ms running, 0 wakeups, 2 alarms: u0a54:com.emoji.keyboard.touchpal*alarm*:com.cootek.usage.alarm_operation+930ms running, 0 wakeups, 4 alarms: 1000:android*alarm*:android.intent.action.TIME_TICK+354ms running, 0 wakeups, 1 alarms: u0a40:com.android.deskclock*alarm*:com.android.deskclock.ON_QUARTER_HOUR+175ms running, 1 wakeups, 1 alarms: u0a49:com.android.mms*walarm*:com.android.mms.register.alarmAlarm Stats:1000:android +17s96ms running, 4 wakeups:+16s120ms 0 wakes 1 alarms, last -12m35s386ms:*alarm*:com.android.server.action.NETWORK_STATS_POLL+930ms 0 wakes 4 alarms, last -33s981ms:*alarm*:android.intent.action.TIME_TICK+48ms 2 wakes 2 alarms, last -11m33s123ms:*walarm*:*job.delay*+46ms 1 wakes 1 alarms, last -9m51s714ms:*walarm*:ScheduleConditionProvider.EVALUATE+37ms 1 wakes 1 alarms, last -11m33s123ms:*walarm*:*job.deadline*u0a40:com.android.deskclock +354ms running, 0 wakeups:+354ms 0 wakes 1 alarms, last -9m51s714ms:*alarm*:com.android.deskclock.ON_QUARTER_HOURu0a47:com.cleanmaster.mguard +16s219ms running, 1 wakeups:+16s145ms 0 wakes 1 alarms, last -12m35s386ms:*alarm*:com.cleanmaster.NotificationDisturbAlarm+16s140ms 0 wakes 1 alarms, last -12m35s386ms:*alarm*:android.scenetrigger.workeralarm+66ms 0 wakes 1 alarms, last -11m33s123ms:*alarm*:com.cleanmaster.screensave.intent.action.REPORT_INFOC_CMC_AVOID+46ms 0 wakes 1 alarms, last -11m33s123ms:*alarm*:com.ijinshan.common.kinfoc.ActivityTimer+40ms 1 wakes 1 alarms, last -11m33s123ms:*walarm*:com.cleanmaster.service.ACTION_UPDATE_CLOUD_CFG+40ms 0 wakes 1 alarms, last -11m33s123ms:*alarm*:com.ijinshan.cleanmaster_check_apk_update+40ms 0 wakes 1 alarms, last -11m33s123ms:*alarm*:android.scenemonitor.ap_hotspot_workeralarm+8ms 0 wakes 2 alarms, last -33s262ms:*alarm*:com.cleanmaster.service.ACTION_LOCATION_UPDATEu0a49:com.android.mms +175ms running, 1 wakeups:+175ms 1 wakes 1 alarms, last -11m33s123ms:*walarm*:com.android.mms.register.alarmu0a51:com.android.systemui +6ms running, 1 wakeups:+6ms 1 wakes 1 alarms, last -2m22s958ms:*walarm*:screen_off_app_clearu0a54:com.emoji.keyboard.touchpal +19s837ms running, 0 wakeups:+17s621ms 0 wakes 2 alarms, last -12m16s422ms:*alarm*:com.cootek.presentation.action.CONFIG_UPDATE+16s139ms 0 wakes 1 alarms, last -12m35s386ms:*alarm*:com.emoji.keyboard.touchpal.INTERNAL_ACTION.noah_invest_temp+16s127ms 0 wakes 1 alarms, last -12m35s386ms:*alarm*:com.emoji.keyboard.touchpal.INTERNAL_ACTION.auto_update+2s616ms 0 wakes 2 alarms, last -12m16s422ms:*alarm*:com.cootek.usage.alarm_operation+48ms 0 wakes 2 alarms, last -11m33s123ms:*alarm*:com.cootek.abtest.ACTION_UPDATE_CONFIGu0a76:com.android.providers.calendar +55ms running, 3 wakeups:+55ms 3 wakes 3 alarms, last -9m45s775ms:*walarm*:com.android.providers.calendar.intent.CalendarProvider2HS8937QC:/ $

 

不要忽视这些信息:  像关键的  wakeups 多少次。指的是被这个进程唤醒的次数。  alarms  次数。这些统计信息用于调查问题,简直是得心应手!!


Top Alarms:+17s621ms running, 0 wakeups, 2 alarms: u0a54:com.emoji.keyboard.touchpal*alarm*:com.cootek.presentation.action.CONFIG_UPDATE+16s145ms running, 0 wakeups, 1 alarms: u0a47:com.cleanmaster.mguard*alarm*:com.cleanmaster.NotificationDisturbAlarm+16s140ms running, 0 wakeups, 1 alarms: u0a47:com.cleanmaster.mguard

注意:不能设置当前系统之前的时间。

set(int type, long triggerAtTime, PendingIntent operation)
Schedule an alarm.
设置一个闹钟 已经初步实现功能
就是有个问题 不能设置当前时间之前的时间 比如现在是19点 设置19点之间的时间 ALarm就自动启动
而我想要的是第二天的6点Alarm才启动 请问如何实现 总不能每天等到0点再来设置闹钟吧!求解!

查了下帮助文档
public void set (int type, long triggerAtTime, PendingIntent operation)
Since: API Level 1 Schedule an alarm. Note: for timing operations (ticks, timeouts, etc) it is easier and much more efficient to use Handler. If there is already an alarm scheduled for the same IntentSender, it will first be canceled.

If the time occurs in the past, the alarm will be triggered immediately. If there is already an alarm for this Intent scheduled (with the equality of two intents being defined by filterEquals(Intent)), then it will be removed and replaced by this one.

红色那句解释了原因.
就是有个问题 不能设置当前时间之前的时间 比如现在是19点 设置19点之间的时间 ALarm就自动启动.

 

 


http://www.ppmy.cn/news/409219.html

相关文章

极限求法总结(四)

目录 两个重要极限 lim ⁡ x → 0 s i n x x \lim_{x\rightarrow 0}\frac{sinx}{x} limx→0​xsinx​1 lim ⁡ x → ∞ ( 1 1 x ) x \lim_{x\rightarrow \infty}(1\frac{1}{x})^x limx→∞​(1x1​)xe或者 lim ⁡ x → 0 ( 1 x ) 1 x \lim_{x\rightarrow 0}(1x)^\frac{1}{x} …

linux系统数据库引擎启动失败,案例:linux bug导致db2start无法启动

环境: db2 v95 linux RH4 Update6 EM64T, kernel 2.6.9 问题: 原来系统跑在db2 v91 fp2,工作良好,当升级到db2 v95 fp1后db2start无法启动,报错 $db2start Floating point exception 分析: 首先,看到这个错误以后第一个反应就是db2安装出错。 拿到db2安装日志仔细扫两眼…

netty4.0源码解析(持续更新)

文章目录 netty1:环境配置与其他对比future缺陷 2:结构3:设计模式 delay策略模式 todo责任链模式 todo单例模式模式 todo装饰者模式ReplayingDecoder todo 观察者模式 todo迭代器模式 todo工厂模式 todo组合模式 4:netty源码解析C…

linux 小包 性能,网络数据小包吞吐量测试与分析

摘 要: 吞吐量是评价网络平台性能的重要指标,是网络用户关注的焦点,对于不同帧长的以太网数据包,网络平台的处理能力存在较大差异,主要体现在处理64B和128B小包数据时,吞吐量有明显的降低。针对这一问题,以研祥一款网络平台专用主板NET-1715VD4N为测试对象,采用SmartB…

Edge Drawing: A combined real-time edge and segment detector 翻译

论文名 : 边缘绘制:结合实时边缘和分割检测器 摘要: 提出了一种新的边缘检测算法,该算法能够实时生成高质量的边缘,每个边缘是一个线性像素链。与传统的边缘检测器不同,传统的边缘检测器通过阈值梯度幅值聚类来确定边缘元素&…

EDCircles: A real-time circle detector with a false detection control 翻译

论文名:EDCircles:一个带有错误检测控制的实时圆检测器 摘要 我们提出了一种实时的,无参数的圆检测算法,具有高的检测率,产生准确的结果,并控制错误的圆检测的数量。该算法利用了无参数边缘段检测器产生的连续(连通)边…

python笔记 - urllib模块(二十一)

urllib库用于操作网页 URL,并对网页的内容进行抓取处理 包含以下模块: urllib.request 打开和读取URLurllib.error 包含urllib.request抛出的异常urllib.parse 解析URLurllib.robotparser 解析robots.txt文件 1、urllib.request模块 定义了一些打开URL…

设计模式——结构型模式

前言 本文只是记录本人学习设计模式时记录的一些学习笔记,可能不全,但是可以做到一些提醒记忆的作用,如有侵权,联系删改,文章后会贴出学习时参考的链接。此前言适用于本人所写设计模式系列。 结构型模式 ​ 描述的是…