Steve (and Adam, if you ever read this) - thanks!

It looks like the key thing I was missing was the reenableKeyguard in
onKeyguardExitResult. It isn't something I think I would ever have
tried, since at that poitn the last thing we want to do is to actually
put the keyguard back up. I guess what it is really doing is releasing
our lock, and it's just a function with an unfortunate name.

I now have powerup and keyguard disable apparently working. Time for
testing.


Richard


On Feb 25, 11:01 pm, SteveV <[email protected]> wrote:
> Thanks again Jarkman...
>
> Hey, bad news is I gave up too...
>
> Good news is - I think I found a source to investigate further. I
> noticed one of my favorite apps "SMS Popup" does exactly what we're
> trying to do. Fortunately, the good developer "AdamK" decided to open
> source his project... so we can dig through & figure it out (which I
> intend to do later tonight or 
> tomorrow)http://code.google.com/p/android-smspopup/source/browse/#svn/trunk/SM...
>
> Hope that helps! cheers, Steve
>
> On Feb 25, 10:54 am, jarkman <[email protected]> wrote:
>
> > But the bad news is, I still can't make the keyguard dismissal work
> > correctly.
>
> > My current code will dismiss the keyguard the first time it runs, and
> > will go through the secure dismissal, and get my activity all the way
> > to finish();.
>
> > But, if my activity wants to run a second time during the same debug
> > session, my call to disableKeyguard is silently ignored. The keyguard
> > just doesn't go away.
>
> > I can only assume I am leaving something in a bad state at the end of
> > the first run of my activity, but I can't see what it can possibly be.
> > I guess there must be some subtlety to the keyguard lock mechanism
> > which isn't mentioned in the docs.
>
> > I'm giving up now.
>
> > R.
>
> > On Feb 25, 8:10 am, SteveV <[email protected]> wrote:
>
> > > Thanks for sharing...
> > > I had the following code.. which works on the emulator, but I can't
> > > get it to work on my phone (with or without the pattern lock enabled):
>
> > > I had a line in my onPause that calls reenableKeyguard(), if
> > > unlocked==true.
> > > I'll keep trying - I noticed your code uses
> > > PowerManager.ON_AFTER_RELEASE. I'll report back if adding that helps
> > > or if I figure it out myself.
>
> > >                 //wake phone
> > >                 Log.d(TAG, "mWakeLock.acquire/release()");
> > >                 PowerManager pm = (PowerManager) getSystemService
> > > (Context.POWER_SERVICE);
> > >                 mWakeLock = 
> > > pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK
> > >                                 | PowerManager.ACQUIRE_CAUSES_WAKEUP, 
> > > "TEST");
> > >                 mWakeLock.acquire();
> > >                 mWakeLock.release();
>
> > >                 //unlock phone
> > >                 KeyguardManager km = (KeyguardManager) getSystemService
> > > (Context.KEYGUARD_SERVICE);
> > >                 mKeyguardLock = km.newKeyguardLock("TEST");
> > >                 if (km.inKeyguardRestrictedInputMode()){
> > >                         km.exitKeyguardSecurely(new 
> > > KeyguardManager.OnKeyguardExitResult(){
> > >                                 @Override
> > >                                 public void onKeyguardExitResult(boolean 
> > > success) {
> > >                                         if (success){
> > >                                                 Log.d(TAG, 
> > > "onKeyguardExitResult success");
> > >                                         } else {
> > >                                                 Log.d(TAG, 
> > > "onKeyguardExitResult ! success");
> > >                                         }
> > >                                 }
> > >                         });
> > >                         Log.d(TAG, "inKeyguardRestrictedInputMode - 
> > > disableKeyguard");
> > >                         mKeyguardLock.disableKeyguard();
> > >                         unlocked = true;
> > >                 }
>
> > > On Feb 24, 10:22 am, jarkman <[email protected]> wrote:
>
> > > > As far as I can tell, my PowerManager code works properly when the
> > > > device is on charge, but generally doesn't wake the device up when it
> > > > is not on charge. I shall keep digging. Perhaps I need to hold the
> > > > wakelock for longer to stop it snoozing.
>
> > > > R
>
> > > > On Feb 23, 11:24 pm, SteveV <[email protected]> wrote:
>
> > > > > Does anyone know how to do this correctly?
>
> > > > > I can't find any examples & the API documentation is pretty hard to
> > > > > follow.
>
> > > > > I am guessing I need to use the KeyGuardManager and PowerManager...
> > > > > but can't figure out how to bring my activity up past the keyguard and
> > > > > re-enable the keyguard so my activity doesn't let someone get past the
> > > > > lock when my activity awakens.- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to