Finding the app that abuses the “set alarm clock” feature on Android
It’s been a few weeks since I saw this unknown alarm shown on the lock screen of my Pixel 7 Pro, always set at 18:27 every day.
I know this lock screen shows an alarm set from any app, i.e., not only the stock Clock app but also other alarm apps like the excellent one I use, Sleep as Android.
However, I never set any alarms at 18:27. And also, at 18:27, nothing happens.
I suspect this is a rogue app that abuses the setAlarmClock API to wake itself for some reason (probably checking into their servers or triggering a reminder).
I didn’t manage to find an app that could investigate this issue on the Play Store, so I resorted to adb
. Let’s try dumpsys alarm
and search for 18:27
. It showed very quickly:
RTC_WAKEUP #101: Alarm{403b9b2 type 0 origWhen 1681208820041 whenElapsed 889674249 com.hip.coupleapp}
tag=*walarm*:NOTIFICATION_ID1876607358-2
type=RTC_WAKEUP origWhen=2023-04-11 18:27:00.041 window=0 exactAllowReason=permission repeatInterval=0 count=0 flags=0x3
policyWhenElapsed: requester=+1d6h12m30s444ms app_standby=-34m17s501ms device_idle=-1h26m54s580ms battery_saver=-- tare=-9d0h51m28s348ms
whenElapsed=+1d6h12m30s444ms maxWhenElapsed=+1d6h12m30s444ms
Alarm clock:
triggerTime=2023-04-11 18:27:00.041
showIntent=PendingIntent{9d67d03: PendingIntentRecord{5bc8983 com.hip.coupleapp broadcastIntent}}
....
The culprit is the app called In Love while Parenting (com.hip.coupleapp).
Then I researched how apps can set an alarm clock. The setAlarmClock method documentation says:
Note: Starting with
Build.VERSION_CODES#S
, apps targeting SDK level 31 or higher need to request theSCHEDULE_EXACT_ALARM
permission to use this API. The user and the system can revoke this permission via the special app access screen in Settings.
First, I want to confirm if the app has that permission. I used jadx to decompile the APK easily. Indeed, the app has that permission.
Since I am using Android 13, I can go to the App Info section and revoke the permission!
At the bottom of the App Info screen, there is an Alarms & reminders section where we can go in and disable it.
And that rogue alarm doesn’t show on my lock screen anymore!
Additional tip: If you want to find other apps that could cause an alarm to be shown on the lock screen, you can see the list of apps that have SCHEDULE_EXACT_ALARM
permission by going to Settings > Apps > Special app access > Alarms & reminders. You will be surprised at how many apps have that permission!