tahainfocreator / kraigsandroid

Automatically exported from code.google.com/p/kraigsandroid
0 stars 0 forks source link

alarm UI doesn't bypass lockscreen #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When fired the alarm doesn't show its UI over lockscreen. It rings, but there 
is need to unlock the phone to get the UI and snooze/dismiss it.
I use LG GT540 Optimus with firmware 2.0E (Android-2.1). The issue raised just 
after OS update, on the previous firmware (Android 1.6) Alarm Klock worked like 
a charm.

And another couple of things probably worth to be mentioned. Just after reboot 
a testing alarm (set to couple of minutes later) fires without any problem with 
the UI bypassing lockscreen, but several hours later the problem returns... The 
build-in alarm-clock bypasses lockscreen flawlessly.

WBR
 Andrew

PS: Thank a LOT for the best alarm-clock on the android-market.

Original issue reported on code.google.com by av.n...@gmail.com on 23 Jun 2011 at 10:42

GoogleCodeExporter commented 9 years ago
Hmm, I haven't seen this problem before, and you are the first to report it.  
Perhaps there's another application on your phone holding the wake lock?

Original comment by kraigs.a...@gmail.com on 27 Jun 2011 at 3:50

GoogleCodeExporter commented 9 years ago
I've also thought that some app interferes with Alarm Klock, but I can't 
imagine which one. I have rather small number of apps installed in addition to 
the stock ones. And none of them should touch lockscreen. Anyway nothing 
prevents the buildin clock to show it's UI over lockstscreen while ringing. (Of 
course I don't launch two alarm applications at the same time).
I've tried to switch on the debug mode in Alarm-Klock, but it didn't help to 
find out what happens. What else can I do, to narrow down the problem?

Original comment by av.n...@gmail.com on 27 Jun 2011 at 4:24

GoogleCodeExporter commented 9 years ago
If you have the android development kit, you could try using the logcat feature 
of adb.
http://developer.android.com/guide/developing/tools/logcat.html
This allows you to collect the system log.  The screen lock events contain the 
package name KeyguardManager.  You should be able to see which apps are trying 
to lock/unlock the screen and if any of them are causing errors.

Sorry there's not an easier way to try to find the problem.

Original comment by kraigs.a...@gmail.com on 27 Jun 2011 at 4:38

GoogleCodeExporter commented 9 years ago
Ok. I made several test runs (setting alarm to 1min in advance) and obtained 
corresponding logs with "./adb logcat -c && ./adb logcat *:V > log" command. On 
each run the alarm UI was still created behind the lockscreen, but the logs 
contains no "KeyguardManager" strings. Moreover, according to the logs activity 
"com.angrydoughnuts.android.alarmclock/.ActivityAlarmNotification" was 
displayed flawlessly each time...
I rebooted the phone and the problem gone (for some time, I suppose). I 
obtained another bunch of logs for this "working" state. The logs looks much 
the same as in "non-working" case. The only difference I can find is the launch 
time of ActivityAlarmNotification: 800ms (in hidden case) vs 1800ms (in visible 
case)...

I looked through your ActivityAlarmNotification.java source file, and found out 
that you use KeyguardManager.KeyguardLock directly for temporary disable and 
re-enable Keyguard. I'm not an Android (and even Java) developer and I don't 
know what is the best practice for these things, but googling showed that there 
is also special window flag 
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.h
tml#FLAG_SHOW_WHEN_LOCKED , which someone recommended. Can you try to make use 
of it? I hope it could be more robust.

Original comment by av.n...@gmail.com on 27 Jun 2011 at 11:26

GoogleCodeExporter commented 9 years ago
Very interesting, thanks for digging into this.  The docs claim that this 
FLAG_SHOW_WHEN_LOCKED flag was added in SDK version 5, which came after the 
initial write of Alarm Klock.  It seems to have a lot of advantages over using 
the KeyguardManager, including a few security fixes.  It also means that the 
package would need one fewer install permission (DISABLE_KEYGUARD).  I built an 
apk that removes all of the KeyguardManager code and the DISABLE_KEYGUARD 
permission in favor of this flag
http://kraigsandroid.googlecode.com/files/Alarm%20Klock-lockscreen.apk

The only reason I would be hesitant to release this change is that it would 
increase the minimum API version from 4 to 5.  There are currently over 10,000 
users still using the app on API version 4, so I don't want to drop them unless 
there's a really compelling reason.  I tried this change in the emulator with 
API 4 and it still worked, but I'm not sure why.  I'll have to dig through the 
android code to see if it really is safe to release with version 4.  In the 
mean time, could you try this version out to see if it fixes your problem?

Thanks again,
Craig

Original comment by kraigs.a...@gmail.com on 28 Jun 2011 at 3:38

GoogleCodeExporter commented 9 years ago
Thanks for the fast response. Meanwhile the problem returned for the base 
version of AlarmKlock (in 12 hours after rebooting). Looks like the result of 
Android's memory cleaner - may be the KeyguardLock instance was lost somehow? 
Anyway it's mere guesswork...
So, your updated version was to the point. My problem is gone for now. Thanks 
again. But only time will show whether this fuzzy issue is fixed completely. 
I'll watch over it and report back later.

As for API version, I also think that it's a very good point to support 
Android-1.6 (API v4, right?), which is still rather widespread. For example, I 
got my LG GT540 Optimus just a year ago with Android-1.6 installed. I suppose, 
many people don't risk to flash updated firmware, and don't want to throw away 
one-year-old phone. :)

Best regards,
  Andrew

Original comment by av.n...@gmail.com on 28 Jun 2011 at 5:14

GoogleCodeExporter commented 9 years ago
Well. Several days passed away and the updated version still works flawlessly, 
waking me up comfortably and reliably :). So I think my problem is fixed. 
Thanks!

Original comment by av.n...@gmail.com on 1 Jul 2011 at 8:56

GoogleCodeExporter commented 9 years ago
I found an old G1 running 1.6 to try this on as well.  It seemed to work even 
though the docs say it wasn't supported in that version.  I still want to dig 
around in the android code to figure out why it works, but it at least seems to 
be safe to release.  Thanks for testing it out.

Original comment by kraigs.a...@gmail.com on 2 Jul 2011 at 4:59

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Just upgraded my phone from Galaxy S II (Sprint) to the Galaxy S 4 and this 
issue has started with the pin-style lock screen. Current Android version is 
4.2.2

Original comment by deepfrye...@gmail.com on 8 Jun 2013 at 12:40

GoogleCodeExporter commented 9 years ago
Fix released in version 1.8
https://code.google.com/p/kraigsandroid/source/detail?r=6fe8668ef3e1d9908ffed4a6
15c15a59b9654d10

Original comment by kraigs.a...@gmail.com on 9 Dec 2013 at 3:38