[FIX]Potential fix for the stock alarm clock snoozing itself off after just a few sec

InfX

Senior Member
May 1, 2008
885
216
73
The issue.
I've just experienced the dreaded alarm self-snoozing itself issue again, yet this time managed to catch it on logcat and find out what triggers the snooze. Seems like the screen going off is interpreted by the alarm as snooze press!!! For some reason, sometimes, but not always, the screen goes off during the alarm just mere seconds after it starts ringing, and that's what snoozes it off.

Potential fix/workaround.
I've bypassed the onReceive methods in the 3 broadcast receivers that receive the screen off notifications to see if this solves the problem and if it got any serious negative side effects. Since the issue isn't reproducible 'on demand', i'll upload a patcher in the second post, with instructions, and expecting the thread readers cooperations. Currently the only (obvious) side effect i've found is being unable to snooze the alarm by pressing the power button.

PS: Ideas? Suggestions? Feedbacks?
PPS: Uploading patch.
 
Last edited:

InfX

Senior Member
May 1, 2008
885
216
73
Patch requirements:

  1. Windows OS with wscript/cscript installed (installed on Windows by default)
  2. Java runtimes installed.

Instructions:

  1. Download the patch and unzip into some local directory
  2. Fetch the "ClockPackage.apk" from your system apps dir and place it in the same directory, next to the "Patch.js" file
  3. Run "Patch.js"
  4. Assuming the patch success, reupload the modified apk to back to your system apps dir.


PS: Since this is a dev forum, i assume no detailed step by step instructions on each items are neccessary.
PPS: Thanks in advance for cooperation.
 

Attachments

InfX

Senior Member
May 1, 2008
885
216
73
If you wake up to the sound of the stock alarm and see your phone screen off, then the workaround has done it's job. And it just happened to me today.


ROM builders - please consider adding the workaround to your ROMs. No credits necessary, but do, instead, discredit Samsung for not fixing such a thing for ages.
 

PMoto

Senior Member
Jun 16, 2009
757
59
0
Porto - Portugal
I'm quite confused, as I have this strange behavior with alarm, but after update android this is gone.
I mean, forever. I never have this issue again...
So, what is the problem afterall.???
 

InfX

Senior Member
May 1, 2008
885
216
73
PMoto, if you don't have the issue then, i guess, you don't need the patch, but, mind it, it seems to somehow relate to the pattern lock, keyguard etc, so i really don't know. Since there are no significant side effect whatsoever, i'll patch all the ROMs i install from now on, you know, just in case.
 

xewl

Member
Jan 19, 2011
26
1
0
PMoto, if you don't have the issue then, i guess, you don't need the patch, but, mind it, it seems to somehow relate to the pattern lock, keyguard etc, so i really don't know. Since there are no significant side effect whatsoever, i'll patch all the ROMs i install from now on, you know, just in case.
I have the same problem with my pattern-locked Samsung Galaxy S3 Mini. Would this patch work?
 

InfX

Senior Member
May 1, 2008
885
216
73
I have the same problem with my pattern-locked Samsung Galaxy S3 Mini. Would this patch work?
Read and understand what i did. Sure, it can work, but you may need to adapt the patcher a little bit for it to succeed.
 

Goldie

Inactive Recognized Developer
Oct 16, 2010
9,966
22,759
0
Nicely done! And good work on getting the log. Do you still have it? If so can you upload it please? Nice method to implement for users too. Im suprised this thread is so quiet. Good job mate :)

Sent from my GT-I9305 using Tapatalk 4 Beta
 
  • Like
Reactions: InfX

InfX

Senior Member
May 1, 2008
885
216
73
Nicely done! And good work on getting the log. Do you still have it? If so can you upload it please? Nice method to implement for users too. Im suprised this thread is so quiet. Good job mate :)
Thanks.

No, sorry, i no longer have it, but trust me, it has been 100% clear it the screen going off snoozing it. One wouldn't have to be an expert to spot it. I am also surprised this thread got buried, i've been getting this issue and been searching XDA to no avail for the solution, until, eventually, i've got it logged and solved it myself.

BTW, this is no longer a potential fix, its a valid and tested workaround.
 
  • Like
Reactions: Crescendo Xenomorph

InfX

Senior Member
May 1, 2008
885
216
73
Posting in development thread i really expect the readers to actually understand what's being done here, not blindly run the patch, see it failing and not understand why...

Let me clarify a few things:

  1. ==> Error, "temp\classes.dex", file not found, invalid apk
    If you look at the script, this happens after i've tried to unpack the classes.dex file from the apk, but failed. The most obvious reason for this would be an odexed ROM. Decompiling and odex file (from an odexed ROM) in order to patch it would require a lot of dependencies pulled in along with the odex, bringing half of the ROM in, just for this patch. Take it as "impossible".
  2. In order to try & use the patch on an odexed ROM you have 2 options. The first is deodex an entire ROM. The second (potencial!!!) way is finding the mentioned APK from a same version base deodexed ROM, applying a patch on it, and replacing the APK, removing the odex. This assumes no dependencies hell with this odex, the assumption may be wrong, so BACKUP before you try.
 
Last edited:

InfX

Senior Member
May 1, 2008
885
216
73
Permission denied to what? Mind it, there is a reason i've posted it in a dev thread, i actually expect people to try & deal with this kind of stuff.

PS: Find what permission, why is it denied, fix it, and try again. Sorry.