Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a "Panel" in an Android Window?

The reference documentation for Android Window and related pages (e.g., WindowManager.LayoutParams and Window.Callback) refers to "Panels" in a number of places. For example, the Window.Callback page has the following.

Window.Callback API from a Window back to its caller. This allows the client to intercept key dispatching, panels and menus, etc.

and

public abstract View onCreatePanelView (int featureId)

Added in API level 1

Instantiate the view to display in the panel for 'featureId'. You can return null, in which case the default content (typically a menu) will be created for you.

Parameters featureId: Which panel is being created.

Returns view: The top-level view to place in the panel.

WindowManager.LayoutParams seems to view Panels as Windows "types", e.g.:

TYPE_APPLICATION_PANEL Window type: a panel on top of an application window. TYPE_APPLICATION_SUB_PANEL Window type: a sub-panel on top of an application window. TYPE_STATUS_BAR_PANEL Window type: panel that slides out from over the status bar In multiuser systems shows on all users' windows. TYPE_SYSTEM_DIALOG Window type: panel that slides out from the status bar In multiuser systems shows on all users' windows.

I also perused the source code, but wasn't able to make any significant progress without spending hours in the process.

What is a Windows Panel, as used in the reference documentation?

On a related note, what is the featureId? In onCreatePanelView (int featureId), above, it appears to be an ID used to specify the panel, but in other contexts it appears to be used to identify a set of Windows features, e.g., for Window.requestFeature():

public boolean requestFeature (int featureId)

Added in API level 1

Enable extended screen features. This must be called before setContentView(). May be called as many times as desired as long as it is before setContentView(). If not called, no extended features will be available. You can not turn off a feature once it is requested. You canot use other title features with FEATURE_CUSTOM_TITLE.

Parameters featureId: The desired features, defined as constants by Window.

Returns: The features that are now set.

Thanks, Barry

like image 289
Barry Holroyd Avatar asked Nov 25 '15 19:11

Barry Holroyd


1 Answers

I did a bunch of additional research on this, mostly pawing through Android source code. For the most part, Panel seems to be synonymous with Sub-Window, as sub-windows are defined in WindowManager.LayoutParams. I.e., Window types between FIRST_SUB_WINDOW and LAST_SUB_WINDOW, inclusive.

For example, from WindowManagerGlobal.addView():

// If this is a panel window, then find the window it is being
// attached to for future reference.
if (wparams.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW &&
  wparams.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {
    final int count = mViews.size();
    for (int i = 0; i < count; i++) {
      if (mRoots.get(i).mWindow.asBinder() == wparams.token) {
        panelParentView = mViews.get(i);
    }
  }
}

If someone knows this to be inaccurate, or has a broader or different definition of Panel, please let me/us know.

like image 95
Barry Holroyd Avatar answered Oct 12 '22 10:10

Barry Holroyd