Wednesday, January 27, 2010

Progress update for next alpha & beta

I am now one bug fix away from launching these The bug is that certain apps are stopping the correct operation of the 2.0 optimized method I am now using. When screen first sleeps, my process attempts to get started and ready to give you a lag-free, unlocked wakeup. Basically primes itself by taking over the lockscreen. But if browser was open, this fails, & instead it only starts when you wake the screen up. It's like the request gets paused and the OS puts it off till we wake the screen up again. The result is you have to sleep it again and wake up again to get unlocked, because the logic is to do nothing at start, and wait for the next wakeup. When google talk or the home screen launcher (or even the home replacement I use- slidescreen) no conflict happens, it works like it should. But then when you're trying to wake it up to resume where you were in browsing, it just doesn't get started correctly. Totally misses the boat. The point of the 2.0 method is that it is very smooth and fast, and never fails due to CPU load. It never has a flicker. You never see the stock lockscreen since we override it at sleep. So this next release will be really solid and a better experience, if there is any fix for this bug.

You can download a totally functional test build that shows where we are at with this, it just will have a large issue trying to work on the first try when browsing or a few other apps. For the actual alpha 3 it will have no widget lockscreen option as that method won't be finished till we have launcher functions & key customization working within it (for the beta). Other than that it should include a preference whether sliding open should cause the unlock, to help protect against accidental pocket slider bumps, have had some requests for that.


Update: Still trying to resolve some more bugs. Going crazy over the failure to wakeup that seems to happen with a lot of attempts following the power key re-sleep. My current fix seems to resolve it when timeout sleeps happen. the bug doesn't want to happen when i'm plugged in to USB monitoring the program log. something in the timing is the only root cause I can think of.
I have a fix so it very reliably yields to any screen popup and runs very smoothly, plus allows exit via home key and use of notification bar. If i can get this bug killed then I will add the option if users want an Unlock slider and roll out alpha 3 with some cool new options and the custom lockscreen....

Tuesday, January 26, 2010

Android issue 6298: Unexpected KeyEvent results during sleep with activities using show when locked or dismiss keyguard flags

Submitted to the official issue log. This problem is responsible for the difficulties we are currently trying to work around to get things into beta-quality consistency.


- Steps to reproduce the problem:  I start up an activity upon receipt of screen off broadcast. The activity  adds the FLAG_SHOW_WHEN_LOCKED before inflating layout. I then call  TakeKeyEvents(true). This is supposed to allow the activity the chance to  handle key events even if it doesn't have focus. My activity does have  focus at time of creation, while the screen is off, but can lose it by  other things I do with the app. I ultimately want it to always handle key  events even if it has been pushed to the background.  - What Happened: I don't get key events. It seems I can only get events that are "wake keys"  as defined by the KeyguardViewMediator: {{{ private boolean isWakeKeyWhenKeyguardShowing(int keyCode) {         switch (keyCode) {             case KeyEvent.KEYCODE_VOLUME_UP:             case KeyEvent.KEYCODE_VOLUME_DOWN:             case KeyEvent.KEYCODE_MUTE:             case KeyEvent.KEYCODE_HEADSETHOOK:              case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:              case KeyEvent.KEYCODE_MEDIA_STOP:              case KeyEvent.KEYCODE_MEDIA_NEXT:              case KeyEvent.KEYCODE_MEDIA_PREVIOUS:              case KeyEvent.KEYCODE_MEDIA_REWIND:              case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:             case KeyEvent.KEYCODE_CAMERA:                 return false;         }         return true;     } }}}  - What you think the correct behavior should be. The window isn't able to take precedence over any key guard. Though the  display gets precedence, one does not expect that key events will still be  bound by the lockscreen. It effectively prevents your activity from  responding at all to the keys above. A related detail is the fact that the  opposite seems to happen when you use the FLAG_DISMISS_KEYGUARD. At that  point any key will cause wakeup if sleep happens while your activity is  still in progress. This behavior also seemed unexpected, as when sleep  occurs we are generally expecting the keyguard to be re-instated, but the  flag seems to be preventing that while the activity is alive.  I believe this problem affecting both flags should be considered a bug. A  fix would be appreciated, allowing these flags to be used in conjunction  with key event handling without unexpected lockscreen override of the  events. An example of what I expect to happen with either of these flags  would be if I return true on an event, that means I wanted to handle it, if  I return false then the event could next pass to the KeyguardViewMediator  to see if a wakeup should happen, etc. As it stands the event won't get  passed on in cases of sleeping while activity is alive, causing either the  unexpected unguarded wakeup, or failure to process keys that would normally  not be wakeup keys.   This happened within 2.0.1 SDK, this flag was added in API 5 and could be  extremely useful to app developers whilst there is no specific intent  support for replacing the lockscreen.

Thursday, January 21, 2010

MILESTONE PARSE ERROR RESOLVED--updated

Thanks for throwing me a bone, Bernhard Fuhry. Glad it worked. Revising very frequently now trying to complete an official alpha 3 with all the major feature improvements I've been working on and bug resolutions. Sorry the custom lock preview mode in that build is a little buggy. If interested try the more recent build revisions as I post them.

Wednesday, January 13, 2010

Custom button unlock and wakeup proof of concept achieved

Thanks to a window feature called flag_dismiss_keyguard new in 2.0 I can put my own lockscreen in place every time the screen sleeps (cancelling the regular lockscreen). Then I can respond to keys however I want using regular key event handling. While I can't stop the cpu from waking up because android doesn't give apps permission to define wakeup rules, my lockscreen doesn't turn your screen on unless its a key event that we actually want to wake it up. It sends the cpu back to sleep in 5 seconds. Since it isn't doing anything it doesn't impact battery at all.

This pre-alpha test build lets camera key wake it up (once awake you see a clock, and you can use the notification panel, or press back to unlock) and keeps volume and focus camera key presses from waking the screen. Power still instant unlocks just like the rest of the myLock versions.

I am skipping alpha release for this as the first implementation of it is already in myLock complete (though non-functional as a lockscreen) and my test build APK is also up for download because I forgot to delete it.

The beta is pending completion of To-Dos:
  • Add phone listener that stops it from placing the custom lockscreen during calls -- done
  • Handle opening the slider as a wakeup event (stays asleep currently) -- done
  • Support customization for users to add widgets & app launchers -- proof of concept for widgets is done
  • Get the home key exit consistently processing correctly --mostly done
  • Get the phone call event handling rock solid --- mostly done
  • Figure out how to let the power key still unlock after an accidental press of a locked key --got a working fix that inexplicably won't work for the volume keys but does for camera/cam focus
  • figure out why random apps seem to interfere when lockscreen comes on over the top of them -- no idea. it seems to be odd lag and because it takes too long the lockscreen can't close itself since screen isn't waking up
  • Implement the 5 second re-lock grace period and also a longer timeout for pattern lockdown
  • Implement settings screen for configuring unlock/wakeup/locked down keys. I will ensure it supports double press and long press as well. Maybe you want all keys locked down except when double pressed. It will be able to do that.
  • Possible implementation of a lockdown mode. This is an extra security level allowing the user to place phone into lockdown requiring they type in their password to get out of it. The lockdown mode works by intercepting attempts to leave the lockdown screen and forcing it to open again. If I can get it rock solid where it even overrides the call answering screen, then I may include this feature in the beta.
  • Finish creating the 2.0 optimized lock-skip mode that actually uses a replacement lockscreen window with no customization -- 70% done

Saturday, January 9, 2010

Making progress- release first incarnation of myLock lite

myLock lite is an implementation of the lightest-weight lockscreen disable (short of the one that allows all buttons to wake up device - which does do by stopping lockscreen from ever being active) we've tested. This first release gives you a 1x1 widget that is used to turn myLock lite on or off. When it comes on or off a notification appears, which is a one time rather than a persistent mode like in myLock complete. It will also update the notification when a phone call happens as myLock functionality interferes with the phone app's control of the lockscreen while it turns screen on or off via the prox sensor.

The thing to know with this version is that it works like alpha 1. When you first wake up the device, the lockscreen is being paused. This means that the home long press and search keys are still locked out and using them will cause the pattern unlock to appear if you have one- if you do not, then pressing home once should cause a screen flicker at which point the home long press & search should be enabled.

I've also added pattern mode smart auto-toggle. what this does for you is pauses pattern security mode when you toggle myLock lite on. It will lock the device back down into pattern mode when you toggle it back off.

I've added the download link to myLock lite over on the left sidebar. This is the version I want to get out onto the market sometime soon.

Wednesday, January 6, 2010

version 2c - minor update

All I did was isolate and stop the cause of the force close upon receiving call. It has a slight optimization in how the stay awake is handled, and has a check box for the welcome homescreen to replace lockscreen. That doesn't work very well at the moment and is not functional at all for adding widgets so I don't recommend turning it on. If the screen is put to sleep with it up any key will wake screen back at that point.


At the moment I don't expect another update will be needed until we have some of our widgets done and the ability to place them on the welcome lockscreen.

This should give us time to turn up any other minor case bugs.

Monday, January 4, 2010

Update - version alpha 2b

This version provides settings toggle for the foreground mode, and a new tool - stay awake mode which you can check and the screen will not auto-sleep.

The lockscreen skip itself must be toggled by the main button because the settings has no way of reading whether the service is running. first press will get status, turn it on if it was not, and then 2nd press confirms stop. When foreground mode is off, you won't know it's on until you try to wake the phone. But go ahead and use it if you don't like the persistent icon. I am not sure if there are bugs once you change settings but the functions being toggled have all been tested up to now in independent past versions as the features were built, so I am betting it is all pretty stable. I was able to toggle everything from various states of operation and have it all come out as expected. But alpha as always means try not to get too mad if something breaks or fails! ;]

Please send feedback to mylockandroid at gmail. Thanks!

Also check out the new faq before contacting us. Double thanks.

(Download link is posted on the sidebar at left)

Friday, January 1, 2010

alpha two is here

Made several breakthroughs today, earning total progress the title of alpha 2.

New functionality:
  • Foreground service mode- This means you see a notification icon in the status bar. You can jump directly to the settings by opening the notification. This serves to ensure the service will work at all times. It does not impact memory usage, battery, or OS performance. It also makes it more convenient to open settings without having to hunt for the icon.
  • Wakeup screen- The lockscreen bypass occasionally takes the CPU a short time. Normally not more than 1 second, and most often it appears to be instant. The wakeup screen displays a clock, & automatically clears itself when the lockscreen has been successfully bypassed. This is a great benefit because it takes the same amount of time as using the unlock slider, but you get it done with just one button press. This screen is a preview for the upcoming optional wakeup homescreen we are working on for the beta. It basically provides things that used to be on the lockscreen & other useful things we wished were on it- sound mode, brightness, clock, and other useful tools, or even any widget you have on the device can also be placed on it.
  • Added our custom icon.
Bug Fixes:
  • The phone will no longer incorrectly bring the lockscreen back while a call is in progress. If a call ends with the screen on, you may see the lockscreen come back. For now this is normal, but normal auto-unlock resumes correctly.
  • The home button recent-apps shortcut and the search button now respond correctly after auto-unlock.

If you dislike the persistent icon & notification panel presence, the option is forthcoming to disable it (with a disclaimer that we do recommend running it in foreground mode for stability).

Bug fixing & feature experimentation

I turned up this thread while googling disablekeyguard to try and fix a bug happening in my app. Interesting thoughts going on there, they really don't want people creating a replacement for the secure lock that really stops user from doing other things till it is done. Good thing my app wants to add more freedom and not take it away!

How myLock works up to now is it disables the lockscreen automatically on wakeup. It works except for one thing. The home button causes an odd quirk. When I implement the code such that disable always happens at screen on and reenable at screen off, if you try to do home long press to call up the app switcher, it never happens. When you release home, the screen re-draws (see a black screen for an instant) then home screen appears (even if you were already at the home screen). After that, the long press works for the rest of the time the device is awake.

I was just trying to fix this bug to work toward a beta release, but at the same time experimenting with disabling the keyguard and not calling re-enable-- I noticed that in every other usage of disabling the keyguard, it gets forced back on when home is pressed then screen off happens. My code simply breaks after that, the disablekeyguard command doesn't work anymore at screen on. The only reason I would want to code it like that is to try to open the door to customized button wakeup. I think that feature will have to be postponed.

To try to learn how to fix the bug in the working implementation, I found myself looking for the code of what happens when the user is trying to do home button short or long presses to see if there was any way my app could be notified. And indeed it seems the only way would be to have the app be the default home.

I can't figure out how the other apps that skip the keyguard are getting around the bug (keyguard disabler by mikeDg or screenmodewidget), but I really don't want it to allow all buttons to wakeup uncustomizably. All I want to do is eliminate the bug. I am relatively ok with keeping wakeup limited to the power button or slide open actions. You can even program a shake to wake it up since that is done through the sensor. I'm talking with the developer of an app that wants to do that and has it working to wake to the lockscreen.

Our next goal is to launch a custom subclass of the launcher (regular home scren) at every wakeup, immediately after the keyguard disable, so that the end user has a welcome screen where their favorite widgets, app shortcuts, and tools will reside. I want the user to be able to press home to get to the real launcher, or escape to get to whatever was going on before the screen went off. Before I move on to that I will make the utilities widget to be included in a beta release. 2nd beta release will implement the wakeup home.