[Q] troublesome alarms

Search This thread

GLantern

Member
Jan 2, 2014
8
0
ok I know we can't remove alarmmanager because is part of system, but some behaviors are idiotic

After I recharged my phone I check battery and statistics with battery monitor widget
first 4 hours only eats 5%
wakelocks android system/alarmmanager had only 4 or 8
in some time after this android eats battery excessively
10 hours 37%
wakelocks android system/alammanager had 200+

I have greenify for skype face navigator
google apps (except gmail) and samsung trashes uninstalled with titanium backup
data, wifi, bt,gps and rotate off (I only turn on when I need some...)
many services disabled with autostart disabler (redundant XD )

dump of alarm give me this

Code:
Current Alarm Manager state:
 
  Realtime wakeup (now=2014-08-21 11:27:01):
  RTC_WAKEUP #4: Alarm{423efd98 type 0 com.sec.android.app.clockpackage}
    type=0 when=+21h42m58s793ms repeatInterval=0 count=0
    operation=PendingIntent{423efd18: PendingIntentRecord{423efc78 com.sec.android.app.clockpackage broadcastIntent}}
  RTC_WAKEUP #3: Alarm{420dc790 type 0 com.sec.android.app.clockpackage}
    type=0 when=+21h42m58s793ms repeatInterval=0 count=0
    operation=PendingIntent{420dc710: PendingIntentRecord{420dc670 com.sec.android.app.clockpackage broadcastIntent}}
  RTC_WAKEUP #2: Alarm{42252fe8 type 0 com.sec.android.app.clockpackage}
    type=0 when=+21h42m38s793ms repeatInterval=0 count=0
    operation=PendingIntent{42252f68: PendingIntentRecord{42252e78 com.sec.android.app.clockpackage broadcastIntent}}
  RTC_WAKEUP #1: Alarm{4245a4c0 type 0 com.sec.android.app.clockpackage}
    type=0 when=+21h42m38s793ms repeatInterval=0 count=0
    operation=PendingIntent{420dc9c0: PendingIntentRecord{4245a3b0 com.sec.android.app.clockpackage broadcastIntent}}
  RTC_WAKEUP #0: Alarm{41ebf518 type 0 android}
    type=0 when=+8m2s392ms repeatInterval=3697267 count=1
    operation=PendingIntent{41d7c9d0: PendingIntentRecord{422197f8 android broadcastIntent}}
  RTC #2: Alarm{4200b440 type 1 com.estrongs.android.taskmanager}
    type=1 when=+12h33m35s18ms repeatInterval=86400000 count=1
    operation=PendingIntent{4200b3c0: PendingIntentRecord{4200b2d0 com.estrongs.android.taskmanager broadcastIntent}}
  RTC #1: Alarm{420c4588 type 1 com.kk.launcher}
    type=1 when=+12h2m54s37ms repeatInterval=86400000 count=0
    operation=PendingIntent{41dd0a90: PendingIntentRecord{4219d990 com.kk.launcher startService}}
  RTC #0: Alarm{41f5a6a8 type 1 android}
    type=1 when=+32m58s793ms repeatInterval=0 count=0
    operation=PendingIntent{41d1e068: PendingIntentRecord{4220ed20 android broadcastIntent}}
 
  Elapsed realtime wakeup (now=+12h12m5s990ms):
  ELAPSED_WAKEUP #4: Alarm{41fbfa28 type 2 android}
    type=2 when=+20m0s913ms repeatInterval=0 count=0
    operation=PendingIntent{41d179b0: PendingIntentRecord{41fbf918 android broadcastIntent}}
  ELAPSED_WAKEUP #3: Alarm{420b4830 type 2 android}
    type=2 when=+18m4s927ms repeatInterval=0 count=0
    operation=PendingIntent{420321a0: PendingIntentRecord{420f9818 android broadcastIntent}}
  ELAPSED_WAKEUP #2: Alarm{42091018 type 2 android}
    type=2 when=+15m45s488ms repeatInterval=0 count=0
    operation=PendingIntent{42026c28: PendingIntentRecord{41f8bea0 android broadcastIntent}}
  ELAPSED_WAKEUP #1: Alarm{421005f8 type 2 android}
    type=2 when=+12m12s841ms repeatInterval=0 count=0
    operation=PendingIntent{41bb9510: PendingIntentRecord{42109978 android broadcastIntent}}
  ELAPSED_WAKEUP #0: Alarm{41d60d58 type 2 android}
    type=2 when=+10m33s436ms repeatInterval=0 count=0
    operation=PendingIntent{4214f928: PendingIntentRecord{41e2d400 android broadcastIntent}}
  ELAPSED #4: Alarm{421fd5f0 type 3 com.android.phone}
    type=3 when=+4h2m54s10ms repeatInterval=28800000 count=1
    operation=PendingIntent{41dd7180: PendingIntentRecord{41f72048 com.android.phone broadcastIntent}}
  ELAPSED #3: Alarm{42331880 type 3 android}
    type=3 when=+6m26s93ms repeatInterval=0 count=0
    operation=PendingIntent{41ee8130: PendingIntentRecord{4221a2f0 android broadcastIntent}}
  ELAPSED #2: Alarm{421a7670 type 3 android}
    type=3 when=+2m54s10ms repeatInterval=1800000 count=1
    operation=PendingIntent{421a7330: PendingIntentRecord{421a7290 android broadcastIntent}}
  ELAPSED #1: Alarm{423277c8 type 3 android}
    type=3 when=+58s766ms repeatInterval=0 count=0
    operation=PendingIntent{41d45120: PendingIntentRecord{4220ebf8 android broadcastIntent}}
  ELAPSED #0: Alarm{42182c48 type 3 ccc71.bmw}
    type=3 when=+15s438ms repeatInterval=60000 count=1
    operation=PendingIntent{420b1d80: PendingIntentRecord{41f43710 ccc71.bmw broadcastIntent}}
 
  Broadcast ref count: 0
 
  Alarm Stats:
  android
    50384ms running, 15 wakeups
    4 alarms: act=com.android.internal.policy.impl.PhoneWindowManager.DELAYED_KEYGUARD flg=0x14
    200 alarms: act=android.intent.action.TIME_TICK flg=0x40000014
    24 alarms: act=com.android.server.action.NETWORK_STATS_POLL flg=0x14
    58 alarms: act=com.android.server.ThrottleManager.action.POLL flg=0x14
    11 alarms: act=android.app.backup.intent.RUN flg=0x40000014
  com.android.vending
    5ms running, 2 wakeups
    2 alarms: flg=0x4 cmp=com.android.vending/com.google.android.finsky.services.DailyHygiene
  com.sec.android.app.clockpackage
    601ms running, 2 wakeups
    1 alarms: act=com.samsung.sec.android.clockpackage.alarm.ALARM_ALERT flg=0x14
    1 alarms: act=com.samsung.sec.android.clockpackage.alarm.NOTIFY_ALARM_LOCATION flg=0x14
  com.android.phone
    133ms running, 0 wakeups
    1 alarms: act=com.android.phone.UPDATE_CALLER_INFO_CACHE flg=0x14
  com.estrongs.android.taskmanager
    420ms running, 0 wakeups
    2 alarms: flg=0x14
  ccc71.bmw
    1210ms running, 0 wakeups
    60 alarms: flg=0x10000014


it's seems in this code lays the key to delete or expand the delay of the alarms http://android-er.blogspot.com/2011/05/cancel-alarm-using-alarmmanagercancelpe.html

I'm not an expert in android but I think is possible

have a nice day
 

GLantern

Member
Jan 2, 2014
8
0
I have an idea

Code:
RTC_WAKEUP #4: Alarm{423efd98 type 0 com.sec.android.app.clockpackage}
after "alarm" we can see a alphanumeric code (maybe the alarm ID) and the guilty app
so if we could got this parameters from dumpsys in some android app and extract the class from guilty app
we could use this code:
Code:
Intent intent = new Intent(this, ¿class?.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(
                this.getApplicationContext(),¿id?, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);

alarmManager.cancel(pendingIntent);
and kill those alarms and save battery