1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.view;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.annotation.SystemApi;
22 import android.content.Context;
23 import android.content.res.Configuration;
24 import android.content.res.Resources;
25 import android.content.res.TypedArray;
26 import android.graphics.PixelFormat;
27 import android.graphics.drawable.Drawable;
28 import android.media.session.MediaController;
29 import android.net.Uri;
30 import android.os.Bundle;
31 import android.os.IBinder;
32 import android.os.SystemProperties;
33 import android.transition.Scene;
34 import android.transition.Transition;
35 import android.transition.TransitionManager;
36 import android.view.accessibility.AccessibilityEvent;
37 
38 /**
39  * Abstract base class for a top-level window look and behavior policy.  An
40  * instance of this class should be used as the top-level view added to the
41  * window manager. It provides standard UI policies such as a background, title
42  * area, default key processing, etc.
43  *
44  * <p>The only existing implementation of this abstract class is
45  * android.policy.PhoneWindow, which you should instantiate when needing a
46  * Window.  Eventually that class will be refactored and a factory method
47  * added for creating Window instances without knowing about a particular
48  * implementation.
49  */
50 public abstract class Window {
51     /** Flag for the "options panel" feature.  This is enabled by default. */
52     public static final int FEATURE_OPTIONS_PANEL = 0;
53     /** Flag for the "no title" feature, turning off the title at the top
54      *  of the screen. */
55     public static final int FEATURE_NO_TITLE = 1;
56     /** Flag for the progress indicator feature */
57     public static final int FEATURE_PROGRESS = 2;
58     /** Flag for having an icon on the left side of the title bar */
59     public static final int FEATURE_LEFT_ICON = 3;
60     /** Flag for having an icon on the right side of the title bar */
61     public static final int FEATURE_RIGHT_ICON = 4;
62     /** Flag for indeterminate progress */
63     public static final int FEATURE_INDETERMINATE_PROGRESS = 5;
64     /** Flag for the context menu.  This is enabled by default. */
65     public static final int FEATURE_CONTEXT_MENU = 6;
66     /** Flag for custom title. You cannot combine this feature with other title features. */
67     public static final int FEATURE_CUSTOM_TITLE = 7;
68     /**
69      * Flag for enabling the Action Bar.
70      * This is enabled by default for some devices. The Action Bar
71      * replaces the title bar and provides an alternate location
72      * for an on-screen menu button on some devices.
73      */
74     public static final int FEATURE_ACTION_BAR = 8;
75     /**
76      * Flag for requesting an Action Bar that overlays window content.
77      * Normally an Action Bar will sit in the space above window content, but if this
78      * feature is requested along with {@link #FEATURE_ACTION_BAR} it will be layered over
79      * the window content itself. This is useful if you would like your app to have more control
80      * over how the Action Bar is displayed, such as letting application content scroll beneath
81      * an Action Bar with a transparent background or otherwise displaying a transparent/translucent
82      * Action Bar over application content.
83      *
84      * <p>This mode is especially useful with {@link View#SYSTEM_UI_FLAG_FULLSCREEN
85      * View.SYSTEM_UI_FLAG_FULLSCREEN}, which allows you to seamlessly hide the
86      * action bar in conjunction with other screen decorations.
87      *
88      * <p>As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, when an
89      * ActionBar is in this mode it will adjust the insets provided to
90      * {@link View#fitSystemWindows(android.graphics.Rect) View.fitSystemWindows(Rect)}
91      * to include the content covered by the action bar, so you can do layout within
92      * that space.
93      */
94     public static final int FEATURE_ACTION_BAR_OVERLAY = 9;
95     /**
96      * Flag for specifying the behavior of action modes when an Action Bar is not present.
97      * If overlay is enabled, the action mode UI will be allowed to cover existing window content.
98      */
99     public static final int FEATURE_ACTION_MODE_OVERLAY = 10;
100     /**
101      * Flag for requesting a decoration-free window that is dismissed by swiping from the left.
102      */
103     public static final int FEATURE_SWIPE_TO_DISMISS = 11;
104     /**
105      * Flag for requesting that window content changes should be animated using a
106      * TransitionManager.
107      *
108      * <p>The TransitionManager is set using
109      * {@link #setTransitionManager(android.transition.TransitionManager)}. If none is set,
110      * a default TransitionManager will be used.</p>
111      *
112      * @see #setContentView
113      */
114     public static final int FEATURE_CONTENT_TRANSITIONS = 12;
115 
116     /**
117      * Enables Activities to run Activity Transitions either through sending or receiving
118      * ActivityOptions bundle created with
119      * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.app.Activity,
120      * android.util.Pair[])} or {@link android.app.ActivityOptions#makeSceneTransitionAnimation(
121      * android.app.Activity, View, String)}.
122      */
123     public static final int FEATURE_ACTIVITY_TRANSITIONS = 13;
124 
125     /**
126      * Max value used as a feature ID
127      * @hide
128      */
129     public static final int FEATURE_MAX = FEATURE_ACTIVITY_TRANSITIONS;
130 
131     /** Flag for setting the progress bar's visibility to VISIBLE */
132     public static final int PROGRESS_VISIBILITY_ON = -1;
133     /** Flag for setting the progress bar's visibility to GONE */
134     public static final int PROGRESS_VISIBILITY_OFF = -2;
135     /** Flag for setting the progress bar's indeterminate mode on */
136     public static final int PROGRESS_INDETERMINATE_ON = -3;
137     /** Flag for setting the progress bar's indeterminate mode off */
138     public static final int PROGRESS_INDETERMINATE_OFF = -4;
139     /** Starting value for the (primary) progress */
140     public static final int PROGRESS_START = 0;
141     /** Ending value for the (primary) progress */
142     public static final int PROGRESS_END = 10000;
143     /** Lowest possible value for the secondary progress */
144     public static final int PROGRESS_SECONDARY_START = 20000;
145     /** Highest possible value for the secondary progress */
146     public static final int PROGRESS_SECONDARY_END = 30000;
147 
148     /**
149      * The transitionName for the status bar background View when a custom background is used.
150      * @see android.view.Window#setStatusBarColor(int)
151      */
152     public static final String STATUS_BAR_BACKGROUND_TRANSITION_NAME = "android:status:background";
153 
154     /**
155      * The transitionName for the navigation bar background View when a custom background is used.
156      * @see android.view.Window#setNavigationBarColor(int)
157      */
158     public static final String NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME =
159             "android:navigation:background";
160 
161     /**
162      * The default features enabled.
163      * @deprecated use {@link #getDefaultFeatures(android.content.Context)} instead.
164      */
165     @Deprecated
166     @SuppressWarnings({"PointlessBitwiseExpression"})
167     protected static final int DEFAULT_FEATURES = (1 << FEATURE_OPTIONS_PANEL) |
168             (1 << FEATURE_CONTEXT_MENU);
169 
170     /**
171      * The ID that the main layout in the XML layout file should have.
172      */
173     public static final int ID_ANDROID_CONTENT = com.android.internal.R.id.content;
174 
175     private static final String PROPERTY_HARDWARE_UI = "persist.sys.ui.hw";
176 
177     private final Context mContext;
178 
179     private TypedArray mWindowStyle;
180     private Callback mCallback;
181     private OnWindowDismissedCallback mOnWindowDismissedCallback;
182     private WindowManager mWindowManager;
183     private IBinder mAppToken;
184     private String mAppName;
185     private boolean mHardwareAccelerated;
186     private Window mContainer;
187     private Window mActiveChild;
188     private boolean mIsActive = false;
189     private boolean mHasChildren = false;
190     private boolean mCloseOnTouchOutside = false;
191     private boolean mSetCloseOnTouchOutside = false;
192     private int mForcedWindowFlags = 0;
193 
194     private int mFeatures;
195     private int mLocalFeatures;
196 
197     private boolean mHaveWindowFormat = false;
198     private boolean mHaveDimAmount = false;
199     private int mDefaultWindowFormat = PixelFormat.OPAQUE;
200 
201     private boolean mHasSoftInputMode = false;
202 
203     private boolean mDestroyed;
204 
205     // The current window attributes.
206     private final WindowManager.LayoutParams mWindowAttributes =
207         new WindowManager.LayoutParams();
208 
209     /**
210      * API from a Window back to its caller.  This allows the client to
211      * intercept key dispatching, panels and menus, etc.
212      */
213     public interface Callback {
214         /**
215          * Called to process key events.  At the very least your
216          * implementation must call
217          * {@link android.view.Window#superDispatchKeyEvent} to do the
218          * standard key processing.
219          *
220          * @param event The key event.
221          *
222          * @return boolean Return true if this event was consumed.
223          */
dispatchKeyEvent(KeyEvent event)224         public boolean dispatchKeyEvent(KeyEvent event);
225 
226         /**
227          * Called to process a key shortcut event.
228          * At the very least your implementation must call
229          * {@link android.view.Window#superDispatchKeyShortcutEvent} to do the
230          * standard key shortcut processing.
231          *
232          * @param event The key shortcut event.
233          * @return True if this event was consumed.
234          */
dispatchKeyShortcutEvent(KeyEvent event)235         public boolean dispatchKeyShortcutEvent(KeyEvent event);
236 
237         /**
238          * Called to process touch screen events.  At the very least your
239          * implementation must call
240          * {@link android.view.Window#superDispatchTouchEvent} to do the
241          * standard touch screen processing.
242          *
243          * @param event The touch screen event.
244          *
245          * @return boolean Return true if this event was consumed.
246          */
dispatchTouchEvent(MotionEvent event)247         public boolean dispatchTouchEvent(MotionEvent event);
248 
249         /**
250          * Called to process trackball events.  At the very least your
251          * implementation must call
252          * {@link android.view.Window#superDispatchTrackballEvent} to do the
253          * standard trackball processing.
254          *
255          * @param event The trackball event.
256          *
257          * @return boolean Return true if this event was consumed.
258          */
dispatchTrackballEvent(MotionEvent event)259         public boolean dispatchTrackballEvent(MotionEvent event);
260 
261         /**
262          * Called to process generic motion events.  At the very least your
263          * implementation must call
264          * {@link android.view.Window#superDispatchGenericMotionEvent} to do the
265          * standard processing.
266          *
267          * @param event The generic motion event.
268          *
269          * @return boolean Return true if this event was consumed.
270          */
dispatchGenericMotionEvent(MotionEvent event)271         public boolean dispatchGenericMotionEvent(MotionEvent event);
272 
273         /**
274          * Called to process population of {@link AccessibilityEvent}s.
275          *
276          * @param event The event.
277          *
278          * @return boolean Return true if event population was completed.
279          */
dispatchPopulateAccessibilityEvent(AccessibilityEvent event)280         public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event);
281 
282         /**
283          * Instantiate the view to display in the panel for 'featureId'.
284          * You can return null, in which case the default content (typically
285          * a menu) will be created for you.
286          *
287          * @param featureId Which panel is being created.
288          *
289          * @return view The top-level view to place in the panel.
290          *
291          * @see #onPreparePanel
292          */
293         @Nullable
onCreatePanelView(int featureId)294         public View onCreatePanelView(int featureId);
295 
296         /**
297          * Initialize the contents of the menu for panel 'featureId'.  This is
298          * called if onCreatePanelView() returns null, giving you a standard
299          * menu in which you can place your items.  It is only called once for
300          * the panel, the first time it is shown.
301          *
302          * <p>You can safely hold on to <var>menu</var> (and any items created
303          * from it), making modifications to it as desired, until the next
304          * time onCreatePanelMenu() is called for this feature.
305          *
306          * @param featureId The panel being created.
307          * @param menu The menu inside the panel.
308          *
309          * @return boolean You must return true for the panel to be displayed;
310          *         if you return false it will not be shown.
311          */
onCreatePanelMenu(int featureId, Menu menu)312         public boolean onCreatePanelMenu(int featureId, Menu menu);
313 
314         /**
315          * Prepare a panel to be displayed.  This is called right before the
316          * panel window is shown, every time it is shown.
317          *
318          * @param featureId The panel that is being displayed.
319          * @param view The View that was returned by onCreatePanelView().
320          * @param menu If onCreatePanelView() returned null, this is the Menu
321          *             being displayed in the panel.
322          *
323          * @return boolean You must return true for the panel to be displayed;
324          *         if you return false it will not be shown.
325          *
326          * @see #onCreatePanelView
327          */
onPreparePanel(int featureId, View view, Menu menu)328         public boolean onPreparePanel(int featureId, View view, Menu menu);
329 
330         /**
331          * Called when a panel's menu is opened by the user. This may also be
332          * called when the menu is changing from one type to another (for
333          * example, from the icon menu to the expanded menu).
334          *
335          * @param featureId The panel that the menu is in.
336          * @param menu The menu that is opened.
337          * @return Return true to allow the menu to open, or false to prevent
338          *         the menu from opening.
339          */
onMenuOpened(int featureId, Menu menu)340         public boolean onMenuOpened(int featureId, Menu menu);
341 
342         /**
343          * Called when a panel's menu item has been selected by the user.
344          *
345          * @param featureId The panel that the menu is in.
346          * @param item The menu item that was selected.
347          *
348          * @return boolean Return true to finish processing of selection, or
349          *         false to perform the normal menu handling (calling its
350          *         Runnable or sending a Message to its target Handler).
351          */
onMenuItemSelected(int featureId, MenuItem item)352         public boolean onMenuItemSelected(int featureId, MenuItem item);
353 
354         /**
355          * This is called whenever the current window attributes change.
356          *
357          */
onWindowAttributesChanged(WindowManager.LayoutParams attrs)358         public void onWindowAttributesChanged(WindowManager.LayoutParams attrs);
359 
360         /**
361          * This hook is called whenever the content view of the screen changes
362          * (due to a call to
363          * {@link Window#setContentView(View, android.view.ViewGroup.LayoutParams)
364          * Window.setContentView} or
365          * {@link Window#addContentView(View, android.view.ViewGroup.LayoutParams)
366          * Window.addContentView}).
367          */
onContentChanged()368         public void onContentChanged();
369 
370         /**
371          * This hook is called whenever the window focus changes.  See
372          * {@link View#onWindowFocusChanged(boolean)
373          * View.onWindowFocusChangedNotLocked(boolean)} for more information.
374          *
375          * @param hasFocus Whether the window now has focus.
376          */
onWindowFocusChanged(boolean hasFocus)377         public void onWindowFocusChanged(boolean hasFocus);
378 
379         /**
380          * Called when the window has been attached to the window manager.
381          * See {@link View#onAttachedToWindow() View.onAttachedToWindow()}
382          * for more information.
383          */
onAttachedToWindow()384         public void onAttachedToWindow();
385 
386         /**
387          * Called when the window has been attached to the window manager.
388          * See {@link View#onDetachedFromWindow() View.onDetachedFromWindow()}
389          * for more information.
390          */
onDetachedFromWindow()391         public void onDetachedFromWindow();
392 
393         /**
394          * Called when a panel is being closed.  If another logical subsequent
395          * panel is being opened (and this panel is being closed to make room for the subsequent
396          * panel), this method will NOT be called.
397          *
398          * @param featureId The panel that is being displayed.
399          * @param menu If onCreatePanelView() returned null, this is the Menu
400          *            being displayed in the panel.
401          */
onPanelClosed(int featureId, Menu menu)402         public void onPanelClosed(int featureId, Menu menu);
403 
404         /**
405          * Called when the user signals the desire to start a search.
406          *
407          * @return true if search launched, false if activity refuses (blocks)
408          *
409          * @see android.app.Activity#onSearchRequested()
410          */
onSearchRequested()411         public boolean onSearchRequested();
412 
413         /**
414          * Called when an action mode is being started for this window. Gives the
415          * callback an opportunity to handle the action mode in its own unique and
416          * beautiful way. If this method returns null the system can choose a way
417          * to present the mode or choose not to start the mode at all.
418          *
419          * @param callback Callback to control the lifecycle of this action mode
420          * @return The ActionMode that was started, or null if the system should present it
421          */
422         @Nullable
onWindowStartingActionMode(ActionMode.Callback callback)423         public ActionMode onWindowStartingActionMode(ActionMode.Callback callback);
424 
425         /**
426          * Called when an action mode has been started. The appropriate mode callback
427          * method will have already been invoked.
428          *
429          * @param mode The new mode that has just been started.
430          */
onActionModeStarted(ActionMode mode)431         public void onActionModeStarted(ActionMode mode);
432 
433         /**
434          * Called when an action mode has been finished. The appropriate mode callback
435          * method will have already been invoked.
436          *
437          * @param mode The mode that was just finished.
438          */
onActionModeFinished(ActionMode mode)439         public void onActionModeFinished(ActionMode mode);
440     }
441 
442     /** @hide */
443     public interface OnWindowDismissedCallback {
444         /**
445          * Called when a window is dismissed. This informs the callback that the
446          * window is gone, and it should finish itself.
447          */
onWindowDismissed()448         public void onWindowDismissed();
449     }
450 
Window(Context context)451     public Window(Context context) {
452         mContext = context;
453         mFeatures = mLocalFeatures = getDefaultFeatures(context);
454     }
455 
456     /**
457      * Return the Context this window policy is running in, for retrieving
458      * resources and other information.
459      *
460      * @return Context The Context that was supplied to the constructor.
461      */
getContext()462     public final Context getContext() {
463         return mContext;
464     }
465 
466     /**
467      * Return the {@link android.R.styleable#Window} attributes from this
468      * window's theme.
469      */
getWindowStyle()470     public final TypedArray getWindowStyle() {
471         synchronized (this) {
472             if (mWindowStyle == null) {
473                 mWindowStyle = mContext.obtainStyledAttributes(
474                         com.android.internal.R.styleable.Window);
475             }
476             return mWindowStyle;
477         }
478     }
479 
480     /**
481      * Set the container for this window.  If not set, the DecorWindow
482      * operates as a top-level window; otherwise, it negotiates with the
483      * container to display itself appropriately.
484      *
485      * @param container The desired containing Window.
486      */
setContainer(Window container)487     public void setContainer(Window container) {
488         mContainer = container;
489         if (container != null) {
490             // Embedded screens never have a title.
491             mFeatures |= 1<<FEATURE_NO_TITLE;
492             mLocalFeatures |= 1<<FEATURE_NO_TITLE;
493             container.mHasChildren = true;
494         }
495     }
496 
497     /**
498      * Return the container for this Window.
499      *
500      * @return Window The containing window, or null if this is a
501      *         top-level window.
502      */
getContainer()503     public final Window getContainer() {
504         return mContainer;
505     }
506 
hasChildren()507     public final boolean hasChildren() {
508         return mHasChildren;
509     }
510 
511     /** @hide */
destroy()512     public final void destroy() {
513         mDestroyed = true;
514     }
515 
516     /** @hide */
isDestroyed()517     public final boolean isDestroyed() {
518         return mDestroyed;
519     }
520 
521     /**
522      * Set the window manager for use by this Window to, for example,
523      * display panels.  This is <em>not</em> used for displaying the
524      * Window itself -- that must be done by the client.
525      *
526      * @param wm The window manager for adding new windows.
527      */
setWindowManager(WindowManager wm, IBinder appToken, String appName)528     public void setWindowManager(WindowManager wm, IBinder appToken, String appName) {
529         setWindowManager(wm, appToken, appName, false);
530     }
531 
532     /**
533      * Set the window manager for use by this Window to, for example,
534      * display panels.  This is <em>not</em> used for displaying the
535      * Window itself -- that must be done by the client.
536      *
537      * @param wm The window manager for adding new windows.
538      */
setWindowManager(WindowManager wm, IBinder appToken, String appName, boolean hardwareAccelerated)539     public void setWindowManager(WindowManager wm, IBinder appToken, String appName,
540             boolean hardwareAccelerated) {
541         mAppToken = appToken;
542         mAppName = appName;
543         mHardwareAccelerated = hardwareAccelerated
544                 || SystemProperties.getBoolean(PROPERTY_HARDWARE_UI, false);
545         if (wm == null) {
546             wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
547         }
548         mWindowManager = ((WindowManagerImpl)wm).createLocalWindowManager(this);
549     }
550 
adjustLayoutParamsForSubWindow(WindowManager.LayoutParams wp)551     void adjustLayoutParamsForSubWindow(WindowManager.LayoutParams wp) {
552         CharSequence curTitle = wp.getTitle();
553         if (wp.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW &&
554             wp.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {
555             if (wp.token == null) {
556                 View decor = peekDecorView();
557                 if (decor != null) {
558                     wp.token = decor.getWindowToken();
559                 }
560             }
561             if (curTitle == null || curTitle.length() == 0) {
562                 String title;
563                 if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA) {
564                     title="Media";
565                 } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY) {
566                     title="MediaOvr";
567                 } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) {
568                     title="Panel";
569                 } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL) {
570                     title="SubPanel";
571                 } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG) {
572                     title="AtchDlg";
573                 } else {
574                     title=Integer.toString(wp.type);
575                 }
576                 if (mAppName != null) {
577                     title += ":" + mAppName;
578                 }
579                 wp.setTitle(title);
580             }
581         } else {
582             if (wp.token == null) {
583                 wp.token = mContainer == null ? mAppToken : mContainer.mAppToken;
584             }
585             if ((curTitle == null || curTitle.length() == 0)
586                     && mAppName != null) {
587                 wp.setTitle(mAppName);
588             }
589         }
590         if (wp.packageName == null) {
591             wp.packageName = mContext.getPackageName();
592         }
593         if (mHardwareAccelerated) {
594             wp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
595         }
596     }
597 
598     /**
599      * Return the window manager allowing this Window to display its own
600      * windows.
601      *
602      * @return WindowManager The ViewManager.
603      */
getWindowManager()604     public WindowManager getWindowManager() {
605         return mWindowManager;
606     }
607 
608     /**
609      * Set the Callback interface for this window, used to intercept key
610      * events and other dynamic operations in the window.
611      *
612      * @param callback The desired Callback interface.
613      */
setCallback(Callback callback)614     public void setCallback(Callback callback) {
615         mCallback = callback;
616     }
617 
618     /**
619      * Return the current Callback interface for this window.
620      */
getCallback()621     public final Callback getCallback() {
622         return mCallback;
623     }
624 
625     /** @hide */
setOnWindowDismissedCallback(OnWindowDismissedCallback dcb)626     public final void setOnWindowDismissedCallback(OnWindowDismissedCallback dcb) {
627         mOnWindowDismissedCallback = dcb;
628     }
629 
630     /** @hide */
dispatchOnWindowDismissed()631     public final void dispatchOnWindowDismissed() {
632         if (mOnWindowDismissedCallback != null) {
633             mOnWindowDismissedCallback.onWindowDismissed();
634         }
635     }
636 
637     /**
638      * Take ownership of this window's surface.  The window's view hierarchy
639      * will no longer draw into the surface, though it will otherwise continue
640      * to operate (such as for receiving input events).  The given SurfaceHolder
641      * callback will be used to tell you about state changes to the surface.
642      */
takeSurface(SurfaceHolder.Callback2 callback)643     public abstract void takeSurface(SurfaceHolder.Callback2 callback);
644 
645     /**
646      * Take ownership of this window's InputQueue.  The window will no
647      * longer read and dispatch input events from the queue; it is your
648      * responsibility to do so.
649      */
takeInputQueue(InputQueue.Callback callback)650     public abstract void takeInputQueue(InputQueue.Callback callback);
651 
652     /**
653      * Return whether this window is being displayed with a floating style
654      * (based on the {@link android.R.attr#windowIsFloating} attribute in
655      * the style/theme).
656      *
657      * @return Returns true if the window is configured to be displayed floating
658      * on top of whatever is behind it.
659      */
isFloating()660     public abstract boolean isFloating();
661 
662     /**
663      * Set the width and height layout parameters of the window.  The default
664      * for both of these is MATCH_PARENT; you can change them to WRAP_CONTENT
665      * or an absolute value to make a window that is not full-screen.
666      *
667      * @param width The desired layout width of the window.
668      * @param height The desired layout height of the window.
669      *
670      * @see ViewGroup.LayoutParams#height
671      * @see ViewGroup.LayoutParams#width
672      */
setLayout(int width, int height)673     public void setLayout(int width, int height) {
674         final WindowManager.LayoutParams attrs = getAttributes();
675         attrs.width = width;
676         attrs.height = height;
677         dispatchWindowAttributesChanged(attrs);
678     }
679 
680     /**
681      * Set the gravity of the window, as per the Gravity constants.  This
682      * controls how the window manager is positioned in the overall window; it
683      * is only useful when using WRAP_CONTENT for the layout width or height.
684      *
685      * @param gravity The desired gravity constant.
686      *
687      * @see Gravity
688      * @see #setLayout
689      */
setGravity(int gravity)690     public void setGravity(int gravity)
691     {
692         final WindowManager.LayoutParams attrs = getAttributes();
693         attrs.gravity = gravity;
694         dispatchWindowAttributesChanged(attrs);
695     }
696 
697     /**
698      * Set the type of the window, as per the WindowManager.LayoutParams
699      * types.
700      *
701      * @param type The new window type (see WindowManager.LayoutParams).
702      */
setType(int type)703     public void setType(int type) {
704         final WindowManager.LayoutParams attrs = getAttributes();
705         attrs.type = type;
706         dispatchWindowAttributesChanged(attrs);
707     }
708 
709     /**
710      * Set the format of window, as per the PixelFormat types.  This overrides
711      * the default format that is selected by the Window based on its
712      * window decorations.
713      *
714      * @param format The new window format (see PixelFormat).  Use
715      *               PixelFormat.UNKNOWN to allow the Window to select
716      *               the format.
717      *
718      * @see PixelFormat
719      */
setFormat(int format)720     public void setFormat(int format) {
721         final WindowManager.LayoutParams attrs = getAttributes();
722         if (format != PixelFormat.UNKNOWN) {
723             attrs.format = format;
724             mHaveWindowFormat = true;
725         } else {
726             attrs.format = mDefaultWindowFormat;
727             mHaveWindowFormat = false;
728         }
729         dispatchWindowAttributesChanged(attrs);
730     }
731 
732     /**
733      * Specify custom animations to use for the window, as per
734      * {@link WindowManager.LayoutParams#windowAnimations
735      * WindowManager.LayoutParams.windowAnimations}.  Providing anything besides
736      * 0 here will override the animations the window would
737      * normally retrieve from its theme.
738      */
setWindowAnimations(int resId)739     public void setWindowAnimations(int resId) {
740         final WindowManager.LayoutParams attrs = getAttributes();
741         attrs.windowAnimations = resId;
742         dispatchWindowAttributesChanged(attrs);
743     }
744 
745     /**
746      * Specify an explicit soft input mode to use for the window, as per
747      * {@link WindowManager.LayoutParams#softInputMode
748      * WindowManager.LayoutParams.softInputMode}.  Providing anything besides
749      * "unspecified" here will override the input mode the window would
750      * normally retrieve from its theme.
751      */
setSoftInputMode(int mode)752     public void setSoftInputMode(int mode) {
753         final WindowManager.LayoutParams attrs = getAttributes();
754         if (mode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) {
755             attrs.softInputMode = mode;
756             mHasSoftInputMode = true;
757         } else {
758             mHasSoftInputMode = false;
759         }
760         dispatchWindowAttributesChanged(attrs);
761     }
762 
763     /**
764      * Convenience function to set the flag bits as specified in flags, as
765      * per {@link #setFlags}.
766      * @param flags The flag bits to be set.
767      * @see #setFlags
768      * @see #clearFlags
769      */
addFlags(int flags)770     public void addFlags(int flags) {
771         setFlags(flags, flags);
772     }
773 
774     /** @hide */
addPrivateFlags(int flags)775     public void addPrivateFlags(int flags) {
776         setPrivateFlags(flags, flags);
777     }
778 
779     /**
780      * Convenience function to clear the flag bits as specified in flags, as
781      * per {@link #setFlags}.
782      * @param flags The flag bits to be cleared.
783      * @see #setFlags
784      * @see #addFlags
785      */
clearFlags(int flags)786     public void clearFlags(int flags) {
787         setFlags(0, flags);
788     }
789 
790     /**
791      * Set the flags of the window, as per the
792      * {@link WindowManager.LayoutParams WindowManager.LayoutParams}
793      * flags.
794      *
795      * <p>Note that some flags must be set before the window decoration is
796      * created (by the first call to
797      * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} or
798      * {@link #getDecorView()}:
799      * {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN} and
800      * {@link WindowManager.LayoutParams#FLAG_LAYOUT_INSET_DECOR}.  These
801      * will be set for you based on the {@link android.R.attr#windowIsFloating}
802      * attribute.
803      *
804      * @param flags The new window flags (see WindowManager.LayoutParams).
805      * @param mask Which of the window flag bits to modify.
806      * @see #addFlags
807      * @see #clearFlags
808      */
setFlags(int flags, int mask)809     public void setFlags(int flags, int mask) {
810         final WindowManager.LayoutParams attrs = getAttributes();
811         attrs.flags = (attrs.flags&~mask) | (flags&mask);
812         mForcedWindowFlags |= mask;
813         dispatchWindowAttributesChanged(attrs);
814     }
815 
setPrivateFlags(int flags, int mask)816     private void setPrivateFlags(int flags, int mask) {
817         final WindowManager.LayoutParams attrs = getAttributes();
818         attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask);
819         dispatchWindowAttributesChanged(attrs);
820     }
821 
822     /**
823      * {@hide}
824      */
setNeedsMenuKey(int value)825     protected void setNeedsMenuKey(int value) {
826         final WindowManager.LayoutParams attrs = getAttributes();
827         attrs.needsMenuKey = value;
828         dispatchWindowAttributesChanged(attrs);
829     }
830 
831     /**
832      * {@hide}
833      */
dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs)834     protected void dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs) {
835         if (mCallback != null) {
836             mCallback.onWindowAttributesChanged(attrs);
837         }
838     }
839 
840     /**
841      * Set the amount of dim behind the window when using
842      * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}.  This overrides
843      * the default dim amount of that is selected by the Window based on
844      * its theme.
845      *
846      * @param amount The new dim amount, from 0 for no dim to 1 for full dim.
847      */
setDimAmount(float amount)848     public void setDimAmount(float amount) {
849         final WindowManager.LayoutParams attrs = getAttributes();
850         attrs.dimAmount = amount;
851         mHaveDimAmount = true;
852         dispatchWindowAttributesChanged(attrs);
853     }
854 
855     /**
856      * Specify custom window attributes.  <strong>PLEASE NOTE:</strong> the
857      * layout params you give here should generally be from values previously
858      * retrieved with {@link #getAttributes()}; you probably do not want to
859      * blindly create and apply your own, since this will blow away any values
860      * set by the framework that you are not interested in.
861      *
862      * @param a The new window attributes, which will completely override any
863      *          current values.
864      */
setAttributes(WindowManager.LayoutParams a)865     public void setAttributes(WindowManager.LayoutParams a) {
866         mWindowAttributes.copyFrom(a);
867         dispatchWindowAttributesChanged(mWindowAttributes);
868     }
869 
870     /**
871      * Retrieve the current window attributes associated with this panel.
872      *
873      * @return WindowManager.LayoutParams Either the existing window
874      *         attributes object, or a freshly created one if there is none.
875      */
getAttributes()876     public final WindowManager.LayoutParams getAttributes() {
877         return mWindowAttributes;
878     }
879 
880     /**
881      * Return the window flags that have been explicitly set by the client,
882      * so will not be modified by {@link #getDecorView}.
883      */
getForcedWindowFlags()884     protected final int getForcedWindowFlags() {
885         return mForcedWindowFlags;
886     }
887 
888     /**
889      * Has the app specified their own soft input mode?
890      */
hasSoftInputMode()891     protected final boolean hasSoftInputMode() {
892         return mHasSoftInputMode;
893     }
894 
895     /** @hide */
setCloseOnTouchOutside(boolean close)896     public void setCloseOnTouchOutside(boolean close) {
897         mCloseOnTouchOutside = close;
898         mSetCloseOnTouchOutside = true;
899     }
900 
901     /** @hide */
setCloseOnTouchOutsideIfNotSet(boolean close)902     public void setCloseOnTouchOutsideIfNotSet(boolean close) {
903         if (!mSetCloseOnTouchOutside) {
904             mCloseOnTouchOutside = close;
905             mSetCloseOnTouchOutside = true;
906         }
907     }
908 
909     /** @hide */
910     @SystemApi
setDisableWallpaperTouchEvents(boolean disable)911     public void setDisableWallpaperTouchEvents(boolean disable) {
912         setPrivateFlags(disable
913                 ? WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS : 0,
914                 WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS);
915     }
916 
917     /** @hide */
alwaysReadCloseOnTouchAttr()918     public abstract void alwaysReadCloseOnTouchAttr();
919 
920     /** @hide */
shouldCloseOnTouch(Context context, MotionEvent event)921     public boolean shouldCloseOnTouch(Context context, MotionEvent event) {
922         if (mCloseOnTouchOutside && event.getAction() == MotionEvent.ACTION_DOWN
923                 && isOutOfBounds(context, event) && peekDecorView() != null) {
924             return true;
925         }
926         return false;
927     }
928 
isOutOfBounds(Context context, MotionEvent event)929     private boolean isOutOfBounds(Context context, MotionEvent event) {
930         final int x = (int) event.getX();
931         final int y = (int) event.getY();
932         final int slop = ViewConfiguration.get(context).getScaledWindowTouchSlop();
933         final View decorView = getDecorView();
934         return (x < -slop) || (y < -slop)
935                 || (x > (decorView.getWidth()+slop))
936                 || (y > (decorView.getHeight()+slop));
937     }
938 
939     /**
940      * Enable extended screen features.  This must be called before
941      * setContentView().  May be called as many times as desired as long as it
942      * is before setContentView().  If not called, no extended features
943      * will be available.  You can not turn off a feature once it is requested.
944      * You canot use other title features with {@link #FEATURE_CUSTOM_TITLE}.
945      *
946      * @param featureId The desired features, defined as constants by Window.
947      * @return The features that are now set.
948      */
requestFeature(int featureId)949     public boolean requestFeature(int featureId) {
950         final int flag = 1<<featureId;
951         mFeatures |= flag;
952         mLocalFeatures |= mContainer != null ? (flag&~mContainer.mFeatures) : flag;
953         return (mFeatures&flag) != 0;
954     }
955 
956     /**
957      * @hide Used internally to help resolve conflicting features.
958      */
removeFeature(int featureId)959     protected void removeFeature(int featureId) {
960         final int flag = 1<<featureId;
961         mFeatures &= ~flag;
962         mLocalFeatures &= ~(mContainer != null ? (flag&~mContainer.mFeatures) : flag);
963     }
964 
makeActive()965     public final void makeActive() {
966         if (mContainer != null) {
967             if (mContainer.mActiveChild != null) {
968                 mContainer.mActiveChild.mIsActive = false;
969             }
970             mContainer.mActiveChild = this;
971         }
972         mIsActive = true;
973         onActive();
974     }
975 
isActive()976     public final boolean isActive()
977     {
978         return mIsActive;
979     }
980 
981     /**
982      * Finds a view that was identified by the id attribute from the XML that
983      * was processed in {@link android.app.Activity#onCreate}.  This will
984      * implicitly call {@link #getDecorView} for you, with all of the
985      * associated side-effects.
986      *
987      * @return The view if found or null otherwise.
988      */
findViewById(int id)989     public View findViewById(int id) {
990         return getDecorView().findViewById(id);
991     }
992 
993     /**
994      * Convenience for
995      * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}
996      * to set the screen content from a layout resource.  The resource will be
997      * inflated, adding all top-level views to the screen.
998      *
999      * @param layoutResID Resource ID to be inflated.
1000      * @see #setContentView(View, android.view.ViewGroup.LayoutParams)
1001      */
setContentView(int layoutResID)1002     public abstract void setContentView(int layoutResID);
1003 
1004     /**
1005      * Convenience for
1006      * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}
1007      * set the screen content to an explicit view.  This view is placed
1008      * directly into the screen's view hierarchy.  It can itself be a complex
1009      * view hierarhcy.
1010      *
1011      * @param view The desired content to display.
1012      * @see #setContentView(View, android.view.ViewGroup.LayoutParams)
1013      */
setContentView(View view)1014     public abstract void setContentView(View view);
1015 
1016     /**
1017      * Set the screen content to an explicit view.  This view is placed
1018      * directly into the screen's view hierarchy.  It can itself be a complex
1019      * view hierarchy.
1020      *
1021      * <p>Note that calling this function "locks in" various characteristics
1022      * of the window that can not, from this point forward, be changed: the
1023      * features that have been requested with {@link #requestFeature(int)},
1024      * and certain window flags as described in {@link #setFlags(int, int)}.</p>
1025      *
1026      * <p>If {@link #FEATURE_CONTENT_TRANSITIONS} is set, the window's
1027      * TransitionManager will be used to animate content from the current
1028      * content View to view.</p>
1029      *
1030      * @param view The desired content to display.
1031      * @param params Layout parameters for the view.
1032      * @see #getTransitionManager()
1033      * @see #setTransitionManager(android.transition.TransitionManager)
1034      */
setContentView(View view, ViewGroup.LayoutParams params)1035     public abstract void setContentView(View view, ViewGroup.LayoutParams params);
1036 
1037     /**
1038      * Variation on
1039      * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}
1040      * to add an additional content view to the screen.  Added after any existing
1041      * ones in the screen -- existing views are NOT removed.
1042      *
1043      * @param view The desired content to display.
1044      * @param params Layout parameters for the view.
1045      */
addContentView(View view, ViewGroup.LayoutParams params)1046     public abstract void addContentView(View view, ViewGroup.LayoutParams params);
1047 
1048     /**
1049      * Return the view in this Window that currently has focus, or null if
1050      * there are none.  Note that this does not look in any containing
1051      * Window.
1052      *
1053      * @return View The current View with focus or null.
1054      */
1055     @Nullable
getCurrentFocus()1056     public abstract View getCurrentFocus();
1057 
1058     /**
1059      * Quick access to the {@link LayoutInflater} instance that this Window
1060      * retrieved from its Context.
1061      *
1062      * @return LayoutInflater The shared LayoutInflater.
1063      */
1064     @NonNull
getLayoutInflater()1065     public abstract LayoutInflater getLayoutInflater();
1066 
setTitle(CharSequence title)1067     public abstract void setTitle(CharSequence title);
1068 
1069     @Deprecated
setTitleColor(int textColor)1070     public abstract void setTitleColor(int textColor);
1071 
openPanel(int featureId, KeyEvent event)1072     public abstract void openPanel(int featureId, KeyEvent event);
1073 
closePanel(int featureId)1074     public abstract void closePanel(int featureId);
1075 
togglePanel(int featureId, KeyEvent event)1076     public abstract void togglePanel(int featureId, KeyEvent event);
1077 
invalidatePanelMenu(int featureId)1078     public abstract void invalidatePanelMenu(int featureId);
1079 
performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags)1080     public abstract boolean performPanelShortcut(int featureId,
1081                                                  int keyCode,
1082                                                  KeyEvent event,
1083                                                  int flags);
performPanelIdentifierAction(int featureId, int id, int flags)1084     public abstract boolean performPanelIdentifierAction(int featureId,
1085                                                  int id,
1086                                                  int flags);
1087 
closeAllPanels()1088     public abstract void closeAllPanels();
1089 
performContextMenuIdentifierAction(int id, int flags)1090     public abstract boolean performContextMenuIdentifierAction(int id, int flags);
1091 
1092     /**
1093      * Should be called when the configuration is changed.
1094      *
1095      * @param newConfig The new configuration.
1096      */
onConfigurationChanged(Configuration newConfig)1097     public abstract void onConfigurationChanged(Configuration newConfig);
1098 
1099     /**
1100      * Sets the window elevation.
1101      * <p>
1102      * Changes to this property take effect immediately and will cause the
1103      * window surface to be recreated. This is an expensive operation and as a
1104      * result, this property should not be animated.
1105      *
1106      * @param elevation The window elevation.
1107      * @see View#setElevation(float)
1108      * @see android.R.styleable#Window_windowElevation
1109      */
setElevation(float elevation)1110     public void setElevation(float elevation) {}
1111 
1112     /**
1113      * Sets whether window content should be clipped to the outline of the
1114      * window background.
1115      *
1116      * @param clipToOutline Whether window content should be clipped to the
1117      *                      outline of the window background.
1118      * @see View#setClipToOutline(boolean)
1119      * @see android.R.styleable#Window_windowClipToOutline
1120      */
setClipToOutline(boolean clipToOutline)1121     public void setClipToOutline(boolean clipToOutline) {}
1122 
1123     /**
1124      * Change the background of this window to a Drawable resource. Setting the
1125      * background to null will make the window be opaque. To make the window
1126      * transparent, you can use an empty drawable (for instance a ColorDrawable
1127      * with the color 0 or the system drawable android:drawable/empty.)
1128      *
1129      * @param resId The resource identifier of a drawable resource which will
1130      *              be installed as the new background.
1131      */
setBackgroundDrawableResource(int resId)1132     public void setBackgroundDrawableResource(int resId) {
1133         setBackgroundDrawable(mContext.getDrawable(resId));
1134     }
1135 
1136     /**
1137      * Change the background of this window to a custom Drawable. Setting the
1138      * background to null will make the window be opaque. To make the window
1139      * transparent, you can use an empty drawable (for instance a ColorDrawable
1140      * with the color 0 or the system drawable android:drawable/empty.)
1141      *
1142      * @param drawable The new Drawable to use for this window's background.
1143      */
setBackgroundDrawable(Drawable drawable)1144     public abstract void setBackgroundDrawable(Drawable drawable);
1145 
1146     /**
1147      * Set the value for a drawable feature of this window, from a resource
1148      * identifier.  You must have called requestFeauture(featureId) before
1149      * calling this function.
1150      *
1151      * @see android.content.res.Resources#getDrawable(int)
1152      *
1153      * @param featureId The desired drawable feature to change, defined as a
1154      * constant by Window.
1155      * @param resId Resource identifier of the desired image.
1156      */
setFeatureDrawableResource(int featureId, int resId)1157     public abstract void setFeatureDrawableResource(int featureId, int resId);
1158 
1159     /**
1160      * Set the value for a drawable feature of this window, from a URI. You
1161      * must have called requestFeature(featureId) before calling this
1162      * function.
1163      *
1164      * <p>The only URI currently supported is "content:", specifying an image
1165      * in a content provider.
1166      *
1167      * @see android.widget.ImageView#setImageURI
1168      *
1169      * @param featureId The desired drawable feature to change. Features are
1170      * constants defined by Window.
1171      * @param uri The desired URI.
1172      */
setFeatureDrawableUri(int featureId, Uri uri)1173     public abstract void setFeatureDrawableUri(int featureId, Uri uri);
1174 
1175     /**
1176      * Set an explicit Drawable value for feature of this window. You must
1177      * have called requestFeature(featureId) before calling this function.
1178      *
1179      * @param featureId The desired drawable feature to change. Features are
1180      *                  constants defined by Window.
1181      * @param drawable A Drawable object to display.
1182      */
setFeatureDrawable(int featureId, Drawable drawable)1183     public abstract void setFeatureDrawable(int featureId, Drawable drawable);
1184 
1185     /**
1186      * Set a custom alpha value for the given drawable feature, controlling how
1187      * much the background is visible through it.
1188      *
1189      * @param featureId The desired drawable feature to change. Features are
1190      *                  constants defined by Window.
1191      * @param alpha The alpha amount, 0 is completely transparent and 255 is
1192      *              completely opaque.
1193      */
setFeatureDrawableAlpha(int featureId, int alpha)1194     public abstract void setFeatureDrawableAlpha(int featureId, int alpha);
1195 
1196     /**
1197      * Set the integer value for a feature. The range of the value depends on
1198      * the feature being set. For {@link #FEATURE_PROGRESS}, it should go from
1199      * 0 to 10000. At 10000 the progress is complete and the indicator hidden.
1200      *
1201      * @param featureId The desired feature to change. Features are constants
1202      *                  defined by Window.
1203      * @param value The value for the feature. The interpretation of this
1204      *              value is feature-specific.
1205      */
setFeatureInt(int featureId, int value)1206     public abstract void setFeatureInt(int featureId, int value);
1207 
1208     /**
1209      * Request that key events come to this activity. Use this if your
1210      * activity has no views with focus, but the activity still wants
1211      * a chance to process key events.
1212      */
takeKeyEvents(boolean get)1213     public abstract void takeKeyEvents(boolean get);
1214 
1215     /**
1216      * Used by custom windows, such as Dialog, to pass the key press event
1217      * further down the view hierarchy. Application developers should
1218      * not need to implement or call this.
1219      *
1220      */
superDispatchKeyEvent(KeyEvent event)1221     public abstract boolean superDispatchKeyEvent(KeyEvent event);
1222 
1223     /**
1224      * Used by custom windows, such as Dialog, to pass the key shortcut press event
1225      * further down the view hierarchy. Application developers should
1226      * not need to implement or call this.
1227      *
1228      */
superDispatchKeyShortcutEvent(KeyEvent event)1229     public abstract boolean superDispatchKeyShortcutEvent(KeyEvent event);
1230 
1231     /**
1232      * Used by custom windows, such as Dialog, to pass the touch screen event
1233      * further down the view hierarchy. Application developers should
1234      * not need to implement or call this.
1235      *
1236      */
superDispatchTouchEvent(MotionEvent event)1237     public abstract boolean superDispatchTouchEvent(MotionEvent event);
1238 
1239     /**
1240      * Used by custom windows, such as Dialog, to pass the trackball event
1241      * further down the view hierarchy. Application developers should
1242      * not need to implement or call this.
1243      *
1244      */
superDispatchTrackballEvent(MotionEvent event)1245     public abstract boolean superDispatchTrackballEvent(MotionEvent event);
1246 
1247     /**
1248      * Used by custom windows, such as Dialog, to pass the generic motion event
1249      * further down the view hierarchy. Application developers should
1250      * not need to implement or call this.
1251      *
1252      */
superDispatchGenericMotionEvent(MotionEvent event)1253     public abstract boolean superDispatchGenericMotionEvent(MotionEvent event);
1254 
1255     /**
1256      * Retrieve the top-level window decor view (containing the standard
1257      * window frame/decorations and the client's content inside of that), which
1258      * can be added as a window to the window manager.
1259      *
1260      * <p><em>Note that calling this function for the first time "locks in"
1261      * various window characteristics as described in
1262      * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}.</em></p>
1263      *
1264      * @return Returns the top-level window decor view.
1265      */
getDecorView()1266     public abstract View getDecorView();
1267 
1268     /**
1269      * Retrieve the current decor view, but only if it has already been created;
1270      * otherwise returns null.
1271      *
1272      * @return Returns the top-level window decor or null.
1273      * @see #getDecorView
1274      */
peekDecorView()1275     public abstract View peekDecorView();
1276 
saveHierarchyState()1277     public abstract Bundle saveHierarchyState();
1278 
restoreHierarchyState(Bundle savedInstanceState)1279     public abstract void restoreHierarchyState(Bundle savedInstanceState);
1280 
onActive()1281     protected abstract void onActive();
1282 
1283     /**
1284      * Return the feature bits that are enabled.  This is the set of features
1285      * that were given to requestFeature(), and are being handled by this
1286      * Window itself or its container.  That is, it is the set of
1287      * requested features that you can actually use.
1288      *
1289      * <p>To do: add a public version of this API that allows you to check for
1290      * features by their feature ID.
1291      *
1292      * @return int The feature bits.
1293      */
getFeatures()1294     protected final int getFeatures()
1295     {
1296         return mFeatures;
1297     }
1298 
1299     /**
1300      * Return the feature bits set by default on a window.
1301      * @param context The context used to access resources
1302      */
getDefaultFeatures(Context context)1303     public static int getDefaultFeatures(Context context) {
1304         int features = 0;
1305 
1306         final Resources res = context.getResources();
1307         if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureOptionsPanel)) {
1308             features |= 1 << FEATURE_OPTIONS_PANEL;
1309         }
1310 
1311         if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureContextMenu)) {
1312             features |= 1 << FEATURE_CONTEXT_MENU;
1313         }
1314 
1315         return features;
1316     }
1317 
1318     /**
1319      * Query for the availability of a certain feature.
1320      *
1321      * @param feature The feature ID to check
1322      * @return true if the feature is enabled, false otherwise.
1323      */
hasFeature(int feature)1324     public boolean hasFeature(int feature) {
1325         return (getFeatures() & (1 << feature)) != 0;
1326     }
1327 
1328     /**
1329      * Return the feature bits that are being implemented by this Window.
1330      * This is the set of features that were given to requestFeature(), and are
1331      * being handled by only this Window itself, not by its containers.
1332      *
1333      * @return int The feature bits.
1334      */
getLocalFeatures()1335     protected final int getLocalFeatures()
1336     {
1337         return mLocalFeatures;
1338     }
1339 
1340     /**
1341      * Set the default format of window, as per the PixelFormat types.  This
1342      * is the format that will be used unless the client specifies in explicit
1343      * format with setFormat();
1344      *
1345      * @param format The new window format (see PixelFormat).
1346      *
1347      * @see #setFormat
1348      * @see PixelFormat
1349      */
setDefaultWindowFormat(int format)1350     protected void setDefaultWindowFormat(int format) {
1351         mDefaultWindowFormat = format;
1352         if (!mHaveWindowFormat) {
1353             final WindowManager.LayoutParams attrs = getAttributes();
1354             attrs.format = format;
1355             dispatchWindowAttributesChanged(attrs);
1356         }
1357     }
1358 
1359     /** @hide */
haveDimAmount()1360     protected boolean haveDimAmount() {
1361         return mHaveDimAmount;
1362     }
1363 
setChildDrawable(int featureId, Drawable drawable)1364     public abstract void setChildDrawable(int featureId, Drawable drawable);
1365 
setChildInt(int featureId, int value)1366     public abstract void setChildInt(int featureId, int value);
1367 
1368     /**
1369      * Is a keypress one of the defined shortcut keys for this window.
1370      * @param keyCode the key code from {@link android.view.KeyEvent} to check.
1371      * @param event the {@link android.view.KeyEvent} to use to help check.
1372      */
isShortcutKey(int keyCode, KeyEvent event)1373     public abstract boolean isShortcutKey(int keyCode, KeyEvent event);
1374 
1375     /**
1376      * @see android.app.Activity#setVolumeControlStream(int)
1377      */
setVolumeControlStream(int streamType)1378     public abstract void setVolumeControlStream(int streamType);
1379 
1380     /**
1381      * @see android.app.Activity#getVolumeControlStream()
1382      */
getVolumeControlStream()1383     public abstract int getVolumeControlStream();
1384 
1385     /**
1386      * Sets a {@link MediaController} to send media keys and volume changes to.
1387      * If set, this should be preferred for all media keys and volume requests
1388      * sent to this window.
1389      *
1390      * @param controller The controller for the session which should receive
1391      *            media keys and volume changes.
1392      * @see android.app.Activity#setMediaController(android.media.session.MediaController)
1393      */
setMediaController(MediaController controller)1394     public void setMediaController(MediaController controller) {
1395     }
1396 
1397     /**
1398      * Gets the {@link MediaController} that was previously set.
1399      *
1400      * @return The controller which should receive events.
1401      * @see #setMediaController(android.media.session.MediaController)
1402      * @see android.app.Activity#getMediaController()
1403      */
getMediaController()1404     public MediaController getMediaController() {
1405         return null;
1406     }
1407 
1408     /**
1409      * Set extra options that will influence the UI for this window.
1410      * @param uiOptions Flags specifying extra options for this window.
1411      */
setUiOptions(int uiOptions)1412     public void setUiOptions(int uiOptions) { }
1413 
1414     /**
1415      * Set extra options that will influence the UI for this window.
1416      * Only the bits filtered by mask will be modified.
1417      * @param uiOptions Flags specifying extra options for this window.
1418      * @param mask Flags specifying which options should be modified. Others will remain unchanged.
1419      */
setUiOptions(int uiOptions, int mask)1420     public void setUiOptions(int uiOptions, int mask) { }
1421 
1422     /**
1423      * Set the primary icon for this window.
1424      *
1425      * @param resId resource ID of a drawable to set
1426      */
setIcon(int resId)1427     public void setIcon(int resId) { }
1428 
1429     /**
1430      * Set the default icon for this window.
1431      * This will be overridden by any other icon set operation which could come from the
1432      * theme or another explicit set.
1433      *
1434      * @hide
1435      */
setDefaultIcon(int resId)1436     public void setDefaultIcon(int resId) { }
1437 
1438     /**
1439      * Set the logo for this window. A logo is often shown in place of an
1440      * {@link #setIcon(int) icon} but is generally wider and communicates window title information
1441      * as well.
1442      *
1443      * @param resId resource ID of a drawable to set
1444      */
setLogo(int resId)1445     public void setLogo(int resId) { }
1446 
1447     /**
1448      * Set the default logo for this window.
1449      * This will be overridden by any other logo set operation which could come from the
1450      * theme or another explicit set.
1451      *
1452      * @hide
1453      */
setDefaultLogo(int resId)1454     public void setDefaultLogo(int resId) { }
1455 
1456     /**
1457      * Set focus locally. The window should have the
1458      * {@link WindowManager.LayoutParams#FLAG_LOCAL_FOCUS_MODE} flag set already.
1459      * @param hasFocus Whether this window has focus or not.
1460      * @param inTouchMode Whether this window is in touch mode or not.
1461      */
setLocalFocus(boolean hasFocus, boolean inTouchMode)1462     public void setLocalFocus(boolean hasFocus, boolean inTouchMode) { }
1463 
1464     /**
1465      * Inject an event to window locally.
1466      * @param event A key or touch event to inject to this window.
1467      */
injectInputEvent(InputEvent event)1468     public void injectInputEvent(InputEvent event) { }
1469 
1470     /**
1471      * Retrieve the {@link TransitionManager} responsible for  for default transitions
1472      * in this window. Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
1473      *
1474      * <p>This method will return non-null after content has been initialized (e.g. by using
1475      * {@link #setContentView}) if {@link #FEATURE_CONTENT_TRANSITIONS} has been granted.</p>
1476      *
1477      * @return This window's content TransitionManager or null if none is set.
1478      * @attr ref android.R.styleable#Window_windowContentTransitionManager
1479      */
getTransitionManager()1480     public TransitionManager getTransitionManager() {
1481         return null;
1482     }
1483 
1484     /**
1485      * Set the {@link TransitionManager} to use for default transitions in this window.
1486      * Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
1487      *
1488      * @param tm The TransitionManager to use for scene changes.
1489      * @attr ref android.R.styleable#Window_windowContentTransitionManager
1490      */
setTransitionManager(TransitionManager tm)1491     public void setTransitionManager(TransitionManager tm) {
1492         throw new UnsupportedOperationException();
1493     }
1494 
1495     /**
1496      * Retrieve the {@link Scene} representing this window's current content.
1497      * Requires {@link #FEATURE_CONTENT_TRANSITIONS}.
1498      *
1499      * <p>This method will return null if the current content is not represented by a Scene.</p>
1500      *
1501      * @return Current Scene being shown or null
1502      */
getContentScene()1503     public Scene getContentScene() {
1504         return null;
1505     }
1506 
1507     /**
1508      * Sets the Transition that will be used to move Views into the initial scene. The entering
1509      * Views will be those that are regular Views or ViewGroups that have
1510      * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
1511      * {@link android.transition.Visibility} as entering is governed by changing visibility from
1512      * {@link View#INVISIBLE} to {@link View#VISIBLE}. If <code>transition</code> is null,
1513      * entering Views will remain unaffected.
1514      *
1515      * @param transition The Transition to use to move Views into the initial Scene.
1516      * @attr ref android.R.styleable#Window_windowEnterTransition
1517      */
setEnterTransition(Transition transition)1518     public void setEnterTransition(Transition transition) {}
1519 
1520     /**
1521      * Sets the Transition that will be used to move Views out of the scene when the Window is
1522      * preparing to close, for example after a call to
1523      * {@link android.app.Activity#finishAfterTransition()}. The exiting
1524      * Views will be those that are regular Views or ViewGroups that have
1525      * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
1526      * {@link android.transition.Visibility} as entering is governed by changing visibility from
1527      * {@link View#VISIBLE} to {@link View#INVISIBLE}. If <code>transition</code> is null,
1528      * entering Views will remain unaffected. If nothing is set, the default will be to
1529      * use the same value as set in {@link #setEnterTransition(android.transition.Transition)}.
1530      *
1531      * @param transition The Transition to use to move Views out of the Scene when the Window
1532      *                   is preparing to close.
1533      * @attr ref android.R.styleable#Window_windowReturnTransition
1534      */
setReturnTransition(Transition transition)1535     public void setReturnTransition(Transition transition) {}
1536 
1537     /**
1538      * Sets the Transition that will be used to move Views out of the scene when starting a
1539      * new Activity. The exiting Views will be those that are regular Views or ViewGroups that
1540      * have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
1541      * {@link android.transition.Visibility} as exiting is governed by changing visibility
1542      * from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, the views will
1543      * remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1544      *
1545      * @param transition The Transition to use to move Views out of the scene when calling a
1546      *                   new Activity.
1547      * @attr ref android.R.styleable#Window_windowExitTransition
1548      */
setExitTransition(Transition transition)1549     public void setExitTransition(Transition transition) {}
1550 
1551     /**
1552      * Sets the Transition that will be used to move Views in to the scene when returning from
1553      * a previously-started Activity. The entering Views will be those that are regular Views
1554      * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions
1555      * will extend {@link android.transition.Visibility} as exiting is governed by changing
1556      * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null,
1557      * the views will remain unaffected. If nothing is set, the default will be to use the same
1558      * transition as {@link #setExitTransition(android.transition.Transition)}.
1559      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1560      *
1561      * @param transition The Transition to use to move Views into the scene when reentering from a
1562      *                   previously-started Activity.
1563      * @attr ref android.R.styleable#Window_windowReenterTransition
1564      */
setReenterTransition(Transition transition)1565     public void setReenterTransition(Transition transition) {}
1566 
1567     /**
1568      * Returns the transition used to move Views into the initial scene. The entering
1569      * Views will be those that are regular Views or ViewGroups that have
1570      * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
1571      * {@link android.transition.Visibility} as entering is governed by changing visibility from
1572      * {@link View#INVISIBLE} to {@link View#VISIBLE}. If <code>transition</code> is null,
1573      * entering Views will remain unaffected.  Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1574      *
1575      * @return the Transition to use to move Views into the initial Scene.
1576      * @attr ref android.R.styleable#Window_windowEnterTransition
1577      */
getEnterTransition()1578     public Transition getEnterTransition() { return null; }
1579 
1580     /**
1581      * Returns he Transition that will be used to move Views out of the scene when the Window is
1582      * preparing to close, for example after a call to
1583      * {@link android.app.Activity#finishAfterTransition()}. The exiting
1584      * Views will be those that are regular Views or ViewGroups that have
1585      * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
1586      * {@link android.transition.Visibility} as entering is governed by changing visibility from
1587      * {@link View#VISIBLE} to {@link View#INVISIBLE}.
1588      *
1589      * @return The Transition to use to move Views out of the Scene when the Window
1590      *         is preparing to close.
1591      * @attr ref android.R.styleable#Window_windowReturnTransition
1592      */
getReturnTransition()1593     public Transition getReturnTransition() { return null; }
1594 
1595     /**
1596      * Returns the Transition that will be used to move Views out of the scene when starting a
1597      * new Activity. The exiting Views will be those that are regular Views or ViewGroups that
1598      * have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend
1599      * {@link android.transition.Visibility} as exiting is governed by changing visibility
1600      * from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, the views will
1601      * remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1602      *
1603      * @return the Transition to use to move Views out of the scene when calling a
1604      * new Activity.
1605      * @attr ref android.R.styleable#Window_windowExitTransition
1606      */
getExitTransition()1607     public Transition getExitTransition() { return null; }
1608 
1609     /**
1610      * Returns the Transition that will be used to move Views in to the scene when returning from
1611      * a previously-started Activity. The entering Views will be those that are regular Views
1612      * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions
1613      * will extend {@link android.transition.Visibility} as exiting is governed by changing
1614      * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}.
1615      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1616      *
1617      * @return The Transition to use to move Views into the scene when reentering from a
1618      *         previously-started Activity.
1619      * @attr ref android.R.styleable#Window_windowReenterTransition
1620      */
getReenterTransition()1621     public Transition getReenterTransition() { return null; }
1622 
1623     /**
1624      * Sets the Transition that will be used for shared elements transferred into the content
1625      * Scene. Typical Transitions will affect size and location, such as
1626      * {@link android.transition.ChangeBounds}. A null
1627      * value will cause transferred shared elements to blink to the final position.
1628      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1629      *
1630      * @param transition The Transition to use for shared elements transferred into the content
1631      *                   Scene.
1632      * @attr ref android.R.styleable#Window_windowSharedElementEnterTransition
1633      */
setSharedElementEnterTransition(Transition transition)1634     public void setSharedElementEnterTransition(Transition transition) {}
1635 
1636     /**
1637      * Sets the Transition that will be used for shared elements transferred back to a
1638      * calling Activity. Typical Transitions will affect size and location, such as
1639      * {@link android.transition.ChangeBounds}. A null
1640      * value will cause transferred shared elements to blink to the final position.
1641      * If no value is set, the default will be to use the same value as
1642      * {@link #setSharedElementEnterTransition(android.transition.Transition)}.
1643      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1644      *
1645      * @param transition The Transition to use for shared elements transferred out of the content
1646      *                   Scene.
1647      * @attr ref android.R.styleable#Window_windowSharedElementReturnTransition
1648      */
setSharedElementReturnTransition(Transition transition)1649     public void setSharedElementReturnTransition(Transition transition) {}
1650 
1651     /**
1652      * Returns the Transition that will be used for shared elements transferred into the content
1653      * Scene. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1654      *
1655      * @return Transition to use for sharend elements transferred into the content Scene.
1656      * @attr ref android.R.styleable#Window_windowSharedElementEnterTransition
1657      */
getSharedElementEnterTransition()1658     public Transition getSharedElementEnterTransition() { return null; }
1659 
1660     /**
1661      * Returns the Transition that will be used for shared elements transferred back to a
1662      * calling Activity. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1663      *
1664      * @return Transition to use for sharend elements transferred into the content Scene.
1665      * @attr ref android.R.styleable#Window_windowSharedElementReturnTransition
1666      */
getSharedElementReturnTransition()1667     public Transition getSharedElementReturnTransition() { return null; }
1668 
1669     /**
1670      * Sets the Transition that will be used for shared elements after starting a new Activity
1671      * before the shared elements are transferred to the called Activity. If the shared elements
1672      * must animate during the exit transition, this Transition should be used. Upon completion,
1673      * the shared elements may be transferred to the started Activity.
1674      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1675      *
1676      * @param transition The Transition to use for shared elements in the launching Window
1677      *                   prior to transferring to the launched Activity's Window.
1678      * @attr ref android.R.styleable#Window_windowSharedElementExitTransition
1679      */
setSharedElementExitTransition(Transition transition)1680     public void setSharedElementExitTransition(Transition transition) {}
1681 
1682     /**
1683      * Sets the Transition that will be used for shared elements reentering from a started
1684      * Activity after it has returned the shared element to it start location. If no value
1685      * is set, this will default to
1686      * {@link #setSharedElementExitTransition(android.transition.Transition)}.
1687      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1688      *
1689      * @param transition The Transition to use for shared elements in the launching Window
1690      *                   after the shared element has returned to the Window.
1691      * @attr ref android.R.styleable#Window_windowSharedElementReenterTransition
1692      */
setSharedElementReenterTransition(Transition transition)1693     public void setSharedElementReenterTransition(Transition transition) {}
1694 
1695     /**
1696      * Returns the Transition to use for shared elements in the launching Window prior
1697      * to transferring to the launched Activity's Window.
1698      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1699      *
1700      * @return the Transition to use for shared elements in the launching Window prior
1701      * to transferring to the launched Activity's Window.
1702      * @attr ref android.R.styleable#Window_windowSharedElementExitTransition
1703      */
getSharedElementExitTransition()1704     public Transition getSharedElementExitTransition() { return null; }
1705 
1706     /**
1707      * Returns the Transition that will be used for shared elements reentering from a started
1708      * Activity after it has returned the shared element to it start location.
1709      * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}.
1710      *
1711      * @return the Transition that will be used for shared elements reentering from a started
1712      * Activity after it has returned the shared element to it start location.
1713      * @attr ref android.R.styleable#Window_windowSharedElementReenterTransition
1714      */
getSharedElementReenterTransition()1715     public Transition getSharedElementReenterTransition() { return null; }
1716 
1717     /**
1718      * Controls how the transition set in
1719      * {@link #setEnterTransition(android.transition.Transition)} overlaps with the exit
1720      * transition of the calling Activity. When true, the transition will start as soon as possible.
1721      * When false, the transition will wait until the remote exiting transition completes before
1722      * starting.
1723      *
1724      * @param allow true to start the enter transition when possible or false to
1725      *              wait until the exiting transition completes.
1726      * @attr ref android.R.styleable#Window_windowAllowEnterTransitionOverlap
1727      */
setAllowEnterTransitionOverlap(boolean allow)1728     public void setAllowEnterTransitionOverlap(boolean allow) {}
1729 
1730     /**
1731      * Returns how the transition set in
1732      * {@link #setEnterTransition(android.transition.Transition)} overlaps with the exit
1733      * transition of the calling Activity. When true, the transition will start as soon as possible.
1734      * When false, the transition will wait until the remote exiting transition completes before
1735      * starting.
1736      *
1737      * @return true when the enter transition should start as soon as possible or false to
1738      * when it should wait until the exiting transition completes.
1739      * @attr ref android.R.styleable#Window_windowAllowEnterTransitionOverlap
1740      */
getAllowEnterTransitionOverlap()1741     public boolean getAllowEnterTransitionOverlap() { return true; }
1742 
1743     /**
1744      * Controls how the transition set in
1745      * {@link #setExitTransition(android.transition.Transition)} overlaps with the exit
1746      * transition of the called Activity when reentering after if finishes. When true,
1747      * the transition will start as soon as possible. When false, the transition will wait
1748      * until the called Activity's exiting transition completes before starting.
1749      *
1750      * @param allow true to start the transition when possible or false to wait until the
1751      *              called Activity's exiting transition completes.
1752      * @attr ref android.R.styleable#Window_windowAllowReturnTransitionOverlap
1753      */
setAllowReturnTransitionOverlap(boolean allow)1754     public void setAllowReturnTransitionOverlap(boolean allow) {}
1755 
1756     /**
1757      * TODO: remove this.
1758      * @hide
1759      */
setAllowExitTransitionOverlap(boolean allow)1760     public void setAllowExitTransitionOverlap(boolean allow) {
1761         setAllowReturnTransitionOverlap(allow);
1762     }
1763 
1764     /**
1765      * Returns how the transition set in
1766      * {@link #setExitTransition(android.transition.Transition)} overlaps with the exit
1767      * transition of the called Activity when reentering after if finishes. When true,
1768      * the transition will start as soon as possible. When false, the transition will wait
1769      * until the called Activity's exiting transition completes before starting.
1770      *
1771      * @return true when the transition should start when possible or false when it should wait
1772      * until the called Activity's exiting transition completes.
1773      * @attr ref android.R.styleable#Window_windowAllowReturnTransitionOverlap
1774      */
getAllowReturnTransitionOverlap()1775     public boolean getAllowReturnTransitionOverlap() { return true; }
1776 
1777     /**
1778      * TODO: remove this.
1779      * @hide
1780      */
getAllowExitTransitionOverlap()1781     public boolean getAllowExitTransitionOverlap() { return getAllowReturnTransitionOverlap(); }
1782 
1783     /**
1784      * Returns the duration, in milliseconds, of the window background fade
1785      * when transitioning into or away from an Activity when called with an Activity Transition.
1786      * <p>When executing the enter transition, the background starts transparent
1787      * and fades in. This requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. The default is
1788      * 300 milliseconds.</p>
1789      *
1790      * @return The duration of the window background fade to opaque during enter transition.
1791      * @see #getEnterTransition()
1792      * @attr ref android.R.styleable#Window_windowTransitionBackgroundFadeDuration
1793      */
getTransitionBackgroundFadeDuration()1794     public long getTransitionBackgroundFadeDuration() { return 0; }
1795 
1796     /**
1797      * Sets the duration, in milliseconds, of the window background fade
1798      * when transitioning into or away from an Activity when called with an Activity Transition.
1799      * <p>When executing the enter transition, the background starts transparent
1800      * and fades in. This requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. The default is
1801      * 300 milliseconds.</p>
1802      *
1803      * @param fadeDurationMillis The duration of the window background fade to or from opaque
1804      *                           during enter transition.
1805      * @see #setEnterTransition(android.transition.Transition)
1806      * @attr ref android.R.styleable#Window_windowTransitionBackgroundFadeDuration
1807      */
setTransitionBackgroundFadeDuration(long fadeDurationMillis)1808     public void setTransitionBackgroundFadeDuration(long fadeDurationMillis) { }
1809 
1810     /**
1811      * Returns <code>true</code> when shared elements should use an Overlay during
1812      * shared element transitions or <code>false</code> when they should animate as
1813      * part of the normal View hierarchy. The default value is true.
1814      *
1815      * @return <code>true</code> when shared elements should use an Overlay during
1816      * shared element transitions or <code>false</code> when they should animate as
1817      * part of the normal View hierarchy.
1818      * @attr ref android.R.styleable#Window_windowSharedElementsUseOverlay
1819      */
getSharedElementsUseOverlay()1820     public boolean getSharedElementsUseOverlay() { return true; }
1821 
1822     /**
1823      * Sets whether or not shared elements should use an Overlay during shared element transitions.
1824      * The default value is true.
1825      *
1826      * @param sharedElementsUseOverlay <code>true</code> indicates that shared elements should
1827      *                                 be transitioned with an Overlay or <code>false</code>
1828      *                                 to transition within the normal View hierarchy.
1829      * @attr ref android.R.styleable#Window_windowSharedElementsUseOverlay
1830      */
setSharedElementsUseOverlay(boolean sharedElementsUseOverlay)1831     public void setSharedElementsUseOverlay(boolean sharedElementsUseOverlay) { }
1832 
1833     /**
1834      * @return the color of the status bar.
1835      */
getStatusBarColor()1836     public abstract int getStatusBarColor();
1837 
1838     /**
1839      * Sets the color of the status bar to {@param color}.
1840      *
1841      * For this to take effect,
1842      * the window must be drawing the system bar backgrounds with
1843      * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and
1844      * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS} must not be set.
1845      *
1846      * If {@param color} is not opaque, consider setting
1847      * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1848      * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.
1849      * <p>
1850      * The transitionName for the view background will be "android:status:background".
1851      * </p>
1852      */
setStatusBarColor(int color)1853     public abstract void setStatusBarColor(int color);
1854 
1855     /**
1856      * @return the color of the navigation bar.
1857      */
getNavigationBarColor()1858     public abstract int getNavigationBarColor();
1859 
1860     /**
1861      * Sets the color of the navigation bar to {@param color}.
1862      *
1863      * For this to take effect,
1864      * the window must be drawing the system bar backgrounds with
1865      * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and
1866      * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION} must not be set.
1867      *
1868      * If {@param color} is not opaque, consider setting
1869      * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
1870      * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.
1871      * <p>
1872      * The transitionName for the view background will be "android:navigation:background".
1873      * </p>
1874      */
setNavigationBarColor(int color)1875     public abstract void setNavigationBarColor(int color);
1876 
1877 
1878 }
1879