Search code examples
androidwindowphone-call

Android show window over ongoing call in locked phone


I'm showing a window/view over the ongoing call window in Android, with some buttons. Before Lollipop, this worked like a charm, but now the window doesn't show before the user presses back and unlocks the phone.

These are my layoutParams:

layoutParams.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
            WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
    layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;

And remember, this works in all versions of Android before Lollipop. I've also tried adding flags like WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED and WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD.


Solution

  • This is intended behaviour. No interaction is allowed before the system is unlocked. I guess this behaviour was changed in L+.

    Edit: actually, you can use the http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#TYPE_SYSTEM_ERROR to achieve this. I guess it's not recommended nor intended, but it works.