Re: window z-order stack

1,388 views
Skip to first unread message

Dianne Hackborn

unread,
Sep 2, 2009, 1:05:03 PM9/2/09
to android-...@googlegroups.com
It is doing exactly what you asked, by making the dialog TYPE_SYSTEM_ALERT which puts it on top of all normal windows.  If you don't want that, don't do it.  (And I am pretty positive that dialog A -is- in the window list on top of dialog B, especially since as you say it is indeed showing up on top.)

On Wed, Sep 2, 2009 at 12:47 AM, eli <sweeho...@gmail.com> wrote:

It seems the window stack does not represent what I see on the screen.
Consider this scenario.
A activity start up, and it create a dialog, let us call this dialog
A.
The window type of dialog A is changed to TYPE_SYSTEM_ALERT.
Dialog A create another Dialog, let us call this dialog B.

using adb shell dumpsys window, the window stack log shown that Dialog
B is sitting on top of Dialog A. But only Dialog A is visible.  I
would expect Dialog B to appear on top of Dialog A .




--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Dianne Hackborn

unread,
Sep 3, 2009, 1:08:37 AM9/3/09
to android-...@googlegroups.com
Oh that may be because you are displaying the window from an application.  That window type is really really not intended for use by applications -- it is for special system dialogs.  Actually I thought we had a permission protecting it so applications couldn't use that type. :/

On Wed, Sep 2, 2009 at 6:32 PM, eli <sweeho...@gmail.com> wrote:

sorry it should be TYPE_SYSTEM_ALERT instead of TYPE_SYSTEM_DIALOG

On Sep 3, 11:07 am, eli <sweehoe.l...@gmail.com> wrote:
> The screen is showing what I expected, no doubt about it. But the
> window stack is not.  I would expect the screen is showing what the
> window stack is listing.
> ex.
> adb shell dumpsys window log
>
> Window #4:
>   - Dialog B
>     mBaseLayer:=11000 (TYPE_APPLICATION)
> Window #3:
>   - Dialog A
>     mBaseLayer=81000 (TYPE_SYSTEM_DIALOG)

>
> On Sep 3, 3:05 am, Dianne Hackborn <hack...@android.com> wrote:
>
> > It is doing exactly what you asked, by making the dialog TYPE_SYSTEM_ALERT
> > which puts it on top of all normal windows.  If you don't want that, don't
> > do it.  (And I am pretty positive that dialog A -is- in the window list on
> > top of dialog B, especially since as you say it is indeed showing up on
> > top.)
>
> > On Wed, Sep 2, 2009 at 12:47 AM, eli <sweehoe.l...@gmail.com> wrote:
>
> > > It seems the window stack does not represent what I see on the screen.
> > > Consider this scenario.
> > > A activity start up, and it create a dialog, let us call this dialog
> > > A.
> > > The window type of dialog A is changed to TYPE_SYSTEM_ALERT.
> > > Dialog A create another Dialog, let us call this dialog B.
>
> > > using adb shell dumpsys window, the window stack log shown that Dialog
> > > B is sitting on top of Dialog A. But only Dialog A is visible.  I
> > > would expect Dialog B to appear on top of Dialog A .
>
> > --
> > Dianne Hackborn
> > Android framework engineer

>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.

Dianne Hackborn

unread,
Sep 3, 2009, 11:49:22 AM9/3/09
to android-...@googlegroups.com
I can suggest that you don't use SYSTEM_ALERT_WINDOW inside of an application, since it is not intended to be used that way.  If you are truly displaying a system alert, you should be part of the system, showing it from an environment where it makes sense.

Other than that, I haven't seen any of your code to know what you are actually doing, so there is little I can do to help.  I know that this type works fine in all the places where the system actually uses it.

On Thu, Sep 3, 2009 at 12:38 AM, eli <sweeho...@gmail.com> wrote:

TYPE_SYSTEM_ALERT has permission
android.Manifest.permission.SYSTEM_ALERT_WINDOW with protection level
set to "dangerous" . So any application can use it.
But my concern is since window stack is not in sync with screen, I
cannot depend on window stack to determine the "on-screen" window
stack. Is there any other method you can suggest?

eli

unread,
Sep 2, 2009, 3:47:28 AM9/2/09
to android-platform

eli

unread,
Sep 2, 2009, 9:07:46 PM9/2/09
to android-platform
The screen is showing what I expected, no doubt about it. But the
window stack is not. I would expect the screen is showing what the
window stack is listing.
ex.
adb shell dumpsys window log

Window #4:
- Dialog B
mBaseLayer:=11000 (TYPE_APPLICATION)
Window #3:
- Dialog A
mBaseLayer=81000 (TYPE_SYSTEM_DIALOG)


On Sep 3, 3:05 am, Dianne Hackborn <hack...@android.com> wrote:
> It is doing exactly what you asked, by making the dialog TYPE_SYSTEM_ALERT
> which puts it on top of all normal windows.  If you don't want that, don't
> do it.  (And I am pretty positive that dialog A -is- in the window list on
> top of dialog B, especially since as you say it is indeed showing up on
> top.)
>
> On Wed, Sep 2, 2009 at 12:47 AM, eli <sweehoe.l...@gmail.com> wrote:
>
> > It seems the window stack does not represent what I see on the screen.
> > Consider this scenario.
> > A activity start up, and it create a dialog, let us call this dialog
> > A.
> > The window type of dialog A is changed to TYPE_SYSTEM_ALERT.
> > Dialog A create another Dialog, let us call this dialog B.
>
> > using adb shell dumpsys window, the window stack log shown that Dialog
> > B is sitting on top of Dialog A. But only Dialog A is visible.  I
> > would expect Dialog B to appear on top of Dialog A .
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com

eli

unread,
Sep 2, 2009, 9:32:09 PM9/2/09
to android-platform
sorry it should be TYPE_SYSTEM_ALERT instead of TYPE_SYSTEM_DIALOG

On Sep 3, 11:07 am, eli <sweehoe.l...@gmail.com> wrote:

eli

unread,
Sep 3, 2009, 3:38:23 AM9/3/09
to android-platform
TYPE_SYSTEM_ALERT has permission
android.Manifest.permission.SYSTEM_ALERT_WINDOW with protection level
set to "dangerous" . So any application can use it.
But my concern is since window stack is not in sync with screen, I
cannot depend on window stack to determine the "on-screen" window
stack. Is there any other method you can suggest?

On Sep 3, 3:08 pm, Dianne Hackborn <hack...@android.com> wrote:

kh

unread,
Aug 29, 2012, 9:46:49 PM8/29/12
to android-...@googlegroups.com, hac...@android.com
This question is different but related to TYPE_SYSTEM_DIALOG, so posting here.

How can I use TYPE_SYSTEM_DIALOG dialog ? what permissions I need to use ?
Can I start this from a service ?
Basically, I am looking for a dialog to be displayed without an activity.
thanks.
Reply all
Reply to author
Forward
0 new messages