Using FLAG_SHOW_WHEN_LOCKED with disableKeyguard() in secured Android lock screen

后端 未结 5 1775
轻奢々
轻奢々 2021-01-30 11:33

The Context

Recently, I have been looking for reliable ways to control a secured Android Keyguard. Mainly to display a custom lock screen. I know that Google had state

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 12:18

    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED allows an activity(a window) to be displayed on screen on, putting the Keyguard behind

    I tried to get this but my activity always preceded by the system lock screen. isOrderdBroadcast() says that ACTION_SCREEN_NO is an ordered broadcast.

    I added flag to the activity :

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    

    in onAttachedView(). But still the system lock is getting the preference over my Custom screen lock activity.

    How did you get your activity before the system lock screen?

    EDIT On a hindsight, I think my understanding of the lock screen concept was wrong. My broadcast receiver was getting the broadcast first. But what was showing before that was the system lock screen launched when SCREEN_OFF is received. Fixed that problem as of now.

    But stumped by the ambiguity of home button behavior. This won't be a problem in post ICS devices as all hard buttons are discouraged.

提交回复
热议问题