WindowManagerPolicy.java revision 3eefb4c313d0269f7e8bd226bdcc2d039f9e5608
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
17package android.view;
18
19import android.annotation.IntDef;
20import android.annotation.SystemApi;
21import android.app.ActivityManager.StackId;
22import android.content.Context;
23import android.content.pm.ActivityInfo;
24import android.content.res.CompatibilityInfo;
25import android.content.res.Configuration;
26import android.graphics.Point;
27import android.graphics.Rect;
28import android.graphics.RectF;
29import android.os.Bundle;
30import android.os.IBinder;
31import android.os.Looper;
32import android.os.RemoteException;
33import android.view.animation.Animation;
34import com.android.internal.policy.IShortcutService;
35
36import java.io.PrintWriter;
37import java.lang.annotation.Retention;
38import java.lang.annotation.RetentionPolicy;
39
40/**
41 * This interface supplies all UI-specific behavior of the window manager.  An
42 * instance of it is created by the window manager when it starts up, and allows
43 * customization of window layering, special window types, key dispatching, and
44 * layout.
45 *
46 * <p>Because this provides deep interaction with the system window manager,
47 * specific methods on this interface can be called from a variety of contexts
48 * with various restrictions on what they can do.  These are encoded through
49 * a suffixes at the end of a method encoding the thread the method is called
50 * from and any locks that are held when it is being called; if no suffix
51 * is attached to a method, then it is not called with any locks and may be
52 * called from the main window manager thread or another thread calling into
53 * the window manager.
54 *
55 * <p>The current suffixes are:
56 *
57 * <dl>
58 * <dt> Ti <dd> Called from the input thread.  This is the thread that
59 * collects pending input events and dispatches them to the appropriate window.
60 * It may block waiting for events to be processed, so that the input stream is
61 * properly serialized.
62 * <dt> Tq <dd> Called from the low-level input queue thread.  This is the
63 * thread that reads events out of the raw input devices and places them
64 * into the global input queue that is read by the <var>Ti</var> thread.
65 * This thread should not block for a long period of time on anything but the
66 * key driver.
67 * <dt> Lw <dd> Called with the main window manager lock held.  Because the
68 * window manager is a very low-level system service, there are few other
69 * system services you can call with this lock held.  It is explicitly okay to
70 * make calls into the package manager and power manager; it is explicitly not
71 * okay to make calls into the activity manager or most other services.  Note that
72 * {@link android.content.Context#checkPermission(String, int, int)} and
73 * variations require calling into the activity manager.
74 * <dt> Li <dd> Called with the input thread lock held.  This lock can be
75 * acquired by the window manager while it holds the window lock, so this is
76 * even more restrictive than <var>Lw</var>.
77 * </dl>
78 *
79 * @hide
80 */
81public interface WindowManagerPolicy {
82    // Policy flags.  These flags are also defined in frameworks/base/include/ui/Input.h.
83    public final static int FLAG_WAKE = 0x00000001;
84    public final static int FLAG_VIRTUAL = 0x00000002;
85
86    public final static int FLAG_INJECTED = 0x01000000;
87    public final static int FLAG_TRUSTED = 0x02000000;
88    public final static int FLAG_FILTERED = 0x04000000;
89    public final static int FLAG_DISABLE_KEY_REPEAT = 0x08000000;
90
91    public final static int FLAG_INTERACTIVE = 0x20000000;
92    public final static int FLAG_PASS_TO_USER = 0x40000000;
93
94    // Flags for IActivityManager.keyguardGoingAway()
95    public final static int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0;
96    public final static int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1;
97    public final static int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2;
98
99    // Flags used for indicating whether the internal and/or external input devices
100    // of some type are available.
101    public final static int PRESENCE_INTERNAL = 1 << 0;
102    public final static int PRESENCE_EXTERNAL = 1 << 1;
103
104    public final static boolean WATCH_POINTER = false;
105
106    /**
107     * Sticky broadcast of the current HDMI plugged state.
108     */
109    public final static String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED";
110
111    /**
112     * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if
113     * plugged in to HDMI, false if not.
114     */
115    public final static String EXTRA_HDMI_PLUGGED_STATE = "state";
116
117    /**
118     * Set to {@code true} when intent was invoked from pressing the home key.
119     * @hide
120     */
121    @SystemApi
122    public static final String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY";
123
124    /**
125     * Pass this event to the user / app.  To be returned from
126     * {@link #interceptKeyBeforeQueueing}.
127     */
128    public final static int ACTION_PASS_TO_USER = 0x00000001;
129
130    /**
131     * Register shortcuts for window manager to dispatch.
132     * Shortcut code is packed as (metaState << Integer.SIZE) | keyCode
133     * @hide
134     */
135    void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver)
136            throws RemoteException;
137
138    /**
139     * Interface to the Window Manager state associated with a particular
140     * window.  You can hold on to an instance of this interface from the call
141     * to prepareAddWindow() until removeWindow().
142     */
143    public interface WindowState {
144        /**
145         * Return the uid of the app that owns this window.
146         */
147        int getOwningUid();
148
149        /**
150         * Return the package name of the app that owns this window.
151         */
152        String getOwningPackage();
153
154        /**
155         * Perform standard frame computation.  The result can be obtained with
156         * getFrame() if so desired.  Must be called with the window manager
157         * lock held.
158         *
159         * @param parentFrame The frame of the parent container this window
160         * is in, used for computing its basic position.
161         * @param displayFrame The frame of the overall display in which this
162         * window can appear, used for constraining the overall dimensions
163         * of the window.
164         * @param overlayFrame The frame within the display that is inside
165         * of the overlay region.
166         * @param contentFrame The frame within the display in which we would
167         * like active content to appear.  This will cause windows behind to
168         * be resized to match the given content frame.
169         * @param visibleFrame The frame within the display that the window
170         * is actually visible, used for computing its visible insets to be
171         * given to windows behind.
172         * This can be used as a hint for scrolling (avoiding resizing)
173         * the window to make certain that parts of its content
174         * are visible.
175         * @param decorFrame The decor frame specified by policy specific to this window,
176         * to use for proper cropping during animation.
177         * @param stableFrame The frame around which stable system decoration is positioned.
178         * @param outsetFrame The frame that includes areas that aren't part of the surface but we
179         * want to treat them as such.
180         */
181        public void computeFrameLw(Rect parentFrame, Rect displayFrame,
182                Rect overlayFrame, Rect contentFrame, Rect visibleFrame, Rect decorFrame,
183                Rect stableFrame, Rect outsetFrame);
184
185        /**
186         * Retrieve the current frame of the window that has been assigned by
187         * the window manager.  Must be called with the window manager lock held.
188         *
189         * @return Rect The rectangle holding the window frame.
190         */
191        public Rect getFrameLw();
192
193        /**
194         * Retrieve the current position of the window that is actually shown.
195         * Must be called with the window manager lock held.
196         *
197         * @return Point The point holding the shown window position.
198         */
199        public Point getShownPositionLw();
200
201        /**
202         * Retrieve the frame of the display that this window was last
203         * laid out in.  Must be called with the
204         * window manager lock held.
205         *
206         * @return Rect The rectangle holding the display frame.
207         */
208        public Rect getDisplayFrameLw();
209
210        /**
211         * Retrieve the frame of the area inside the overscan region of the
212         * display that this window was last laid out in.  Must be called with the
213         * window manager lock held.
214         *
215         * @return Rect The rectangle holding the display overscan frame.
216         */
217        public Rect getOverscanFrameLw();
218
219        /**
220         * Retrieve the frame of the content area that this window was last
221         * laid out in.  This is the area in which the content of the window
222         * should be placed.  It will be smaller than the display frame to
223         * account for screen decorations such as a status bar or soft
224         * keyboard.  Must be called with the
225         * window manager lock held.
226         *
227         * @return Rect The rectangle holding the content frame.
228         */
229        public Rect getContentFrameLw();
230
231        /**
232         * Retrieve the frame of the visible area that this window was last
233         * laid out in.  This is the area of the screen in which the window
234         * will actually be fully visible.  It will be smaller than the
235         * content frame to account for transient UI elements blocking it
236         * such as an input method's candidates UI.  Must be called with the
237         * window manager lock held.
238         *
239         * @return Rect The rectangle holding the visible frame.
240         */
241        public Rect getVisibleFrameLw();
242
243        /**
244         * Returns true if this window is waiting to receive its given
245         * internal insets from the client app, and so should not impact the
246         * layout of other windows.
247         */
248        public boolean getGivenInsetsPendingLw();
249
250        /**
251         * Retrieve the insets given by this window's client for the content
252         * area of windows behind it.  Must be called with the
253         * window manager lock held.
254         *
255         * @return Rect The left, top, right, and bottom insets, relative
256         * to the window's frame, of the actual contents.
257         */
258        public Rect getGivenContentInsetsLw();
259
260        /**
261         * Retrieve the insets given by this window's client for the visible
262         * area of windows behind it.  Must be called with the
263         * window manager lock held.
264         *
265         * @return Rect The left, top, right, and bottom insets, relative
266         * to the window's frame, of the actual visible area.
267         */
268        public Rect getGivenVisibleInsetsLw();
269
270        /**
271         * Retrieve the current LayoutParams of the window.
272         *
273         * @return WindowManager.LayoutParams The window's internal LayoutParams
274         *         instance.
275         */
276        public WindowManager.LayoutParams getAttrs();
277
278        /**
279         * Return whether this window needs the menu key shown.  Must be called
280         * with window lock held, because it may need to traverse down through
281         * window list to determine the result.
282         * @param bottom The bottom-most window to consider when determining this.
283         */
284        public boolean getNeedsMenuLw(WindowState bottom);
285
286        /**
287         * Retrieve the current system UI visibility flags associated with
288         * this window.
289         */
290        public int getSystemUiVisibility();
291
292        /**
293         * Get the layer at which this window's surface will be Z-ordered.
294         */
295        public int getSurfaceLayer();
296
297        /**
298         * Retrieve the type of the top-level window.
299         *
300         * @return the base type of the parent window if attached or its own type otherwise
301         */
302        public int getBaseType();
303
304        /**
305         * Return the token for the application (actually activity) that owns
306         * this window.  May return null for system windows.
307         *
308         * @return An IApplicationToken identifying the owning activity.
309         */
310        public IApplicationToken getAppToken();
311
312        /**
313         * Return true if this window is participating in voice interaction.
314         */
315        public boolean isVoiceInteraction();
316
317        /**
318         * Return true if, at any point, the application token associated with
319         * this window has actually displayed any windows.  This is most useful
320         * with the "starting up" window to determine if any windows were
321         * displayed when it is closed.
322         *
323         * @return Returns true if one or more windows have been displayed,
324         *         else false.
325         */
326        public boolean hasAppShownWindows();
327
328        /**
329         * Is this window visible?  It is not visible if there is no
330         * surface, or we are in the process of running an exit animation
331         * that will remove the surface.
332         */
333        boolean isVisibleLw();
334
335        /**
336         * Like {@link #isVisibleLw}, but also counts a window that is currently
337         * "hidden" behind the keyguard as visible.  This allows us to apply
338         * things like window flags that impact the keyguard.
339         */
340        boolean isVisibleOrBehindKeyguardLw();
341
342        /**
343         * Is this window currently visible to the user on-screen?  It is
344         * displayed either if it is visible or it is currently running an
345         * animation before no longer being visible.  Must be called with the
346         * window manager lock held.
347         */
348        boolean isDisplayedLw();
349
350        /**
351         * Return true if this window (or a window it is attached to, but not
352         * considering its app token) is currently animating.
353         */
354        boolean isAnimatingLw();
355
356        /**
357         * Is this window considered to be gone for purposes of layout?
358         */
359        boolean isGoneForLayoutLw();
360
361        /**
362         * Returns true if the window has a surface that it has drawn a
363         * complete UI in to. Note that this is different from {@link #hasDrawnLw()}
364         * in that it also returns true if the window is READY_TO_SHOW, but was not yet
365         * promoted to HAS_DRAWN.
366         */
367        boolean isDrawnLw();
368
369        /**
370         * Returns true if this window has been shown on screen at some time in
371         * the past.  Must be called with the window manager lock held.
372         */
373        public boolean hasDrawnLw();
374
375        /**
376         * Can be called by the policy to force a window to be hidden,
377         * regardless of whether the client or window manager would like
378         * it shown.  Must be called with the window manager lock held.
379         * Returns true if {@link #showLw} was last called for the window.
380         */
381        public boolean hideLw(boolean doAnimation);
382
383        /**
384         * Can be called to undo the effect of {@link #hideLw}, allowing a
385         * window to be shown as long as the window manager and client would
386         * also like it to be shown.  Must be called with the window manager
387         * lock held.
388         * Returns true if {@link #hideLw} was last called for the window.
389         */
390        public boolean showLw(boolean doAnimation);
391
392        /**
393         * Check whether the process hosting this window is currently alive.
394         */
395        public boolean isAlive();
396
397        /**
398         * Check if window is on {@link Display#DEFAULT_DISPLAY}.
399         * @return true if window is on default display.
400         */
401        public boolean isDefaultDisplay();
402
403        /**
404         * Check whether the window is currently dimming.
405         */
406        public boolean isDimming();
407
408        /**
409         * @return the stack id this windows belongs to, or {@link StackId#INVALID_STACK_ID} if
410         *         not attached to any stack.
411         */
412        int getStackId();
413
414        /**
415         * Returns true if the window is current in multi-windowing mode. i.e. it shares the
416         * screen with other application windows.
417         */
418        public boolean isInMultiWindowMode();
419    }
420
421    /**
422     * Representation of a input consumer that the policy has added to the
423     * window manager to consume input events going to windows below it.
424     */
425    public interface InputConsumer {
426        /**
427         * Remove the input consumer from the window manager.
428         */
429        void dismiss();
430    }
431
432    /**
433     * Interface for calling back in to the window manager that is private
434     * between it and the policy.
435     */
436    public interface WindowManagerFuncs {
437        public static final int LID_ABSENT = -1;
438        public static final int LID_CLOSED = 0;
439        public static final int LID_OPEN = 1;
440
441        public static final int CAMERA_LENS_COVER_ABSENT = -1;
442        public static final int CAMERA_LENS_UNCOVERED = 0;
443        public static final int CAMERA_LENS_COVERED = 1;
444
445        /**
446         * Ask the window manager to re-evaluate the system UI flags.
447         */
448        public void reevaluateStatusBarVisibility();
449
450        /**
451         * Add a input consumer which will consume all input events going to any window below it.
452         */
453        public InputConsumer addInputConsumer(Looper looper,
454                InputEventReceiver.Factory inputEventReceiverFactory);
455
456        /**
457         * Returns a code that describes the current state of the lid switch.
458         */
459        public int getLidState();
460
461        /**
462         * Lock the device now.
463         */
464        public void lockDeviceNow();
465
466        /**
467         * Returns a code that descripbes whether the camera lens is covered or not.
468         */
469        public int getCameraLensCoverState();
470
471        /**
472         * Switch the input method, to be precise, input method subtype.
473         *
474         * @param forwardDirection {@code true} to rotate in a forward direction.
475         */
476        public void switchInputMethod(boolean forwardDirection);
477
478        public void shutdown(boolean confirm);
479        public void rebootSafeMode(boolean confirm);
480
481        /**
482         * Return the window manager lock needed to correctly call "Lw" methods.
483         */
484        public Object getWindowManagerLock();
485
486        /** Register a system listener for touch events */
487        void registerPointerEventListener(PointerEventListener listener);
488
489        /** Unregister a system listener for touch events */
490        void unregisterPointerEventListener(PointerEventListener listener);
491
492        /**
493         * @return The content insets of the docked divider window.
494         */
495        int getDockedDividerInsetsLw();
496
497        /**
498         * Retrieves the {@param outBounds} from the stack with id {@param stackId}.
499         */
500        void getStackBounds(int stackId, Rect outBounds);
501    }
502
503    public interface PointerEventListener {
504        /**
505         * 1. onPointerEvent will be called on the service.UiThread.
506         * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a
507         * copy() must be made and the copy must be recycled.
508         **/
509        public void onPointerEvent(MotionEvent motionEvent);
510    }
511
512    /** Window has been added to the screen. */
513    public static final int TRANSIT_ENTER = 1;
514    /** Window has been removed from the screen. */
515    public static final int TRANSIT_EXIT = 2;
516    /** Window has been made visible. */
517    public static final int TRANSIT_SHOW = 3;
518    /** Window has been made invisible.
519     * TODO: Consider removal as this is unused. */
520    public static final int TRANSIT_HIDE = 4;
521    /** The "application starting" preview window is no longer needed, and will
522     * animate away to show the real window. */
523    public static final int TRANSIT_PREVIEW_DONE = 5;
524
525    // NOTE: screen off reasons are in order of significance, with more
526    // important ones lower than less important ones.
527
528    /** Screen turned off because of a device admin */
529    public final int OFF_BECAUSE_OF_ADMIN = 1;
530    /** Screen turned off because of power button */
531    public final int OFF_BECAUSE_OF_USER = 2;
532    /** Screen turned off because of timeout */
533    public final int OFF_BECAUSE_OF_TIMEOUT = 3;
534
535    /** @hide */
536    @IntDef({USER_ROTATION_FREE, USER_ROTATION_LOCKED})
537    @Retention(RetentionPolicy.SOURCE)
538    public @interface UserRotationMode {}
539
540    /** When not otherwise specified by the activity's screenOrientation, rotation should be
541     * determined by the system (that is, using sensors). */
542    public final int USER_ROTATION_FREE = 0;
543    /** When not otherwise specified by the activity's screenOrientation, rotation is set by
544     * the user. */
545    public final int USER_ROTATION_LOCKED = 1;
546
547    /**
548     * Perform initialization of the policy.
549     *
550     * @param context The system context we are running in.
551     */
552    public void init(Context context, IWindowManager windowManager,
553            WindowManagerFuncs windowManagerFuncs);
554
555    /**
556     * @return true if com.android.internal.R.bool#config_forceDefaultOrientation is true.
557     */
558    public boolean isDefaultOrientationForced();
559
560    /**
561     * Called by window manager once it has the initial, default native
562     * display dimensions.
563     */
564    public void setInitialDisplaySize(Display display, int width, int height, int density);
565
566    /**
567     * Called by window manager to set the overscan region that should be used for the
568     * given display.
569     */
570    public void setDisplayOverscan(Display display, int left, int top, int right, int bottom);
571
572    /**
573     * Check permissions when adding a window.
574     *
575     * @param attrs The window's LayoutParams.
576     * @param outAppOp First element will be filled with the app op corresponding to
577     *                 this window, or OP_NONE.
578     *
579     * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed;
580     *      else an error code, usually
581     *      {@link WindowManagerGlobal#ADD_PERMISSION_DENIED}, to abort the add.
582     */
583    public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp);
584
585    /**
586     * Check permissions when adding a window.
587     *
588     * @param attrs The window's LayoutParams.
589     *
590     * @return True if the window may only be shown to the current user, false if the window can
591     * be shown on all users' windows.
592     */
593    public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs);
594
595    /**
596     * Sanitize the layout parameters coming from a client.  Allows the policy
597     * to do things like ensure that windows of a specific type can't take
598     * input focus.
599     *
600     * @param attrs The window layout parameters to be modified.  These values
601     * are modified in-place.
602     */
603    public void adjustWindowParamsLw(WindowManager.LayoutParams attrs);
604
605    /**
606     * After the window manager has computed the current configuration based
607     * on its knowledge of the display and input devices, it gives the policy
608     * a chance to adjust the information contained in it.  If you want to
609     * leave it as-is, simply do nothing.
610     *
611     * <p>This method may be called by any thread in the window manager, but
612     * no internal locks in the window manager will be held.
613     *
614     * @param config The Configuration being computed, for you to change as
615     * desired.
616     * @param keyboardPresence Flags that indicate whether internal or external
617     * keyboards are present.
618     * @param navigationPresence Flags that indicate whether internal or external
619     * navigation devices are present.
620     */
621    public void adjustConfigurationLw(Configuration config, int keyboardPresence,
622            int navigationPresence);
623
624    /**
625     * Assign a window type to a layer.  Allows you to control how different
626     * kinds of windows are ordered on-screen.
627     *
628     * @param type The type of window being assigned.
629     *
630     * @return int An arbitrary integer used to order windows, with lower
631     *         numbers below higher ones.
632     */
633    public int windowTypeToLayerLw(int type);
634
635    /**
636     * Return how to Z-order sub-windows in relation to the window they are
637     * attached to.  Return positive to have them ordered in front, negative for
638     * behind.
639     *
640     * @param type The sub-window type code.
641     *
642     * @return int Layer in relation to the attached window, where positive is
643     *         above and negative is below.
644     */
645    public int subWindowTypeToLayerLw(int type);
646
647    /**
648     * Get the highest layer (actually one more than) that the wallpaper is
649     * allowed to be in.
650     */
651    public int getMaxWallpaperLayer();
652
653    /**
654     * Return the display width available after excluding any screen
655     * decorations that could never be removed in Honeycomb. That is, system bar or
656     * button bar.
657     */
658    public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation,
659            int uiMode);
660
661    /**
662     * Return the display height available after excluding any screen
663     * decorations that could never be removed in Honeycomb. That is, system bar or
664     * button bar.
665     */
666    public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation,
667            int uiMode);
668
669    /**
670     * Return the available screen width that we should report for the
671     * configuration.  This must be no larger than
672     * {@link #getNonDecorDisplayWidth(int, int, int)}; it may be smaller than
673     * that to account for more transient decoration like a status bar.
674     */
675    public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation,
676            int uiMode);
677
678    /**
679     * Return the available screen height that we should report for the
680     * configuration.  This must be no larger than
681     * {@link #getNonDecorDisplayHeight(int, int, int)}; it may be smaller than
682     * that to account for more transient decoration like a status bar.
683     */
684    public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation,
685            int uiMode);
686
687    /**
688     * Return whether the given window is forcibly hiding all windows except windows with
689     * FLAG_SHOW_WHEN_LOCKED set.  Typically returns true for the keyguard.
690     */
691    public boolean isForceHiding(WindowManager.LayoutParams attrs);
692
693
694    /**
695     * Return whether the given window can become one that passes isForceHiding() test.
696     * Typically returns true for the StatusBar.
697     */
698    public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs);
699
700    /**
701     * Determine if a window that is behind one that is force hiding
702     * (as determined by {@link #isForceHiding}) should actually be hidden.
703     * For example, typically returns false for the status bar.  Be careful
704     * to return false for any window that you may hide yourself, since this
705     * will conflict with what you set.
706     */
707    public boolean canBeForceHidden(WindowState win, WindowManager.LayoutParams attrs);
708
709    /**
710     * Return the window that is hiding the keyguard, if such a thing exists.
711     */
712    public WindowState getWinShowWhenLockedLw();
713
714    /**
715     * Called when the system would like to show a UI to indicate that an
716     * application is starting.  You can use this to add a
717     * APPLICATION_STARTING_TYPE window with the given appToken to the window
718     * manager (using the normal window manager APIs) that will be shown until
719     * the application displays its own window.  This is called without the
720     * window manager locked so that you can call back into it.
721     *
722     * @param appToken Token of the application being started.
723     * @param packageName The name of the application package being started.
724     * @param theme Resource defining the application's overall visual theme.
725     * @param nonLocalizedLabel The default title label of the application if
726     *        no data is found in the resource.
727     * @param labelRes The resource ID the application would like to use as its name.
728     * @param icon The resource ID the application would like to use as its icon.
729     * @param windowFlags Window layout flags.
730     * @param overrideConfig override configuration to consider when generating
731     *        context to for resources.
732     *
733     * @return Optionally you can return the View that was used to create the
734     *         window, for easy removal in removeStartingWindow.
735     *
736     * @see #removeStartingWindow
737     */
738    public View addStartingWindow(IBinder appToken, String packageName,
739            int theme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel,
740            int labelRes, int icon, int logo, int windowFlags, Configuration overrideConfig);
741
742    /**
743     * Called when the first window of an application has been displayed, while
744     * {@link #addStartingWindow} has created a temporary initial window for
745     * that application.  You should at this point remove the window from the
746     * window manager.  This is called without the window manager locked so
747     * that you can call back into it.
748     *
749     * <p>Note: due to the nature of these functions not being called with the
750     * window manager locked, you must be prepared for this function to be
751     * called multiple times and/or an initial time with a null View window
752     * even if you previously returned one.
753     *
754     * @param appToken Token of the application that has started.
755     * @param window Window View that was returned by createStartingWindow.
756     *
757     * @see #addStartingWindow
758     */
759    public void removeStartingWindow(IBinder appToken, View window);
760
761    /**
762     * Prepare for a window being added to the window manager.  You can throw an
763     * exception here to prevent the window being added, or do whatever setup
764     * you need to keep track of the window.
765     *
766     * @param win The window being added.
767     * @param attrs The window's LayoutParams.
768     *
769     * @return {@link WindowManagerGlobal#ADD_OKAY} if the add can proceed, else an
770     *         error code to abort the add.
771     */
772    public int prepareAddWindowLw(WindowState win,
773            WindowManager.LayoutParams attrs);
774
775    /**
776     * Called when a window is being removed from a window manager.  Must not
777     * throw an exception -- clean up as much as possible.
778     *
779     * @param win The window being removed.
780     */
781    public void removeWindowLw(WindowState win);
782
783    /**
784     * Control the animation to run when a window's state changes.  Return a
785     * non-0 number to force the animation to a specific resource ID, or 0
786     * to use the default animation.
787     *
788     * @param win The window that is changing.
789     * @param transit What is happening to the window: {@link #TRANSIT_ENTER},
790     *                {@link #TRANSIT_EXIT}, {@link #TRANSIT_SHOW}, or
791     *                {@link #TRANSIT_HIDE}.
792     *
793     * @return Resource ID of the actual animation to use, or 0 for none.
794     */
795    public int selectAnimationLw(WindowState win, int transit);
796
797    /**
798     * Determine the animation to run for a rotation transition based on the
799     * top fullscreen windows {@link WindowManager.LayoutParams#rotationAnimation}
800     * and whether it is currently fullscreen and frontmost.
801     *
802     * @param anim The exiting animation resource id is stored in anim[0], the
803     * entering animation resource id is stored in anim[1].
804     */
805    public void selectRotationAnimationLw(int anim[]);
806
807    /**
808     * Validate whether the current top fullscreen has specified the same
809     * {@link WindowManager.LayoutParams#rotationAnimation} value as that
810     * being passed in from the previous top fullscreen window.
811     *
812     * @param exitAnimId exiting resource id from the previous window.
813     * @param enterAnimId entering resource id from the previous window.
814     * @param forceDefault For rotation animations only, if true ignore the
815     * animation values and just return false.
816     * @return true if the previous values are still valid, false if they
817     * should be replaced with the default.
818     */
819    public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId,
820            boolean forceDefault);
821
822    /**
823     * Create and return an animation to re-display a force hidden window.
824     */
825    public Animation createForceHideEnterAnimation(boolean onWallpaper,
826            boolean goingToNotificationShade);
827
828    /**
829     * Create and return an animation to let the wallpaper disappear after being shown on a force
830     * hiding window.
831     */
832    public Animation createForceHideWallpaperExitAnimation(boolean goingToNotificationShade);
833
834    /**
835     * Called from the input reader thread before a key is enqueued.
836     *
837     * <p>There are some actions that need to be handled here because they
838     * affect the power state of the device, for example, the power keys.
839     * Generally, it's best to keep as little as possible in the queue thread
840     * because it's the most fragile.
841     * @param event The key event.
842     * @param policyFlags The policy flags associated with the key.
843     *
844     * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
845     */
846    public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags);
847
848    /**
849     * Called from the input reader thread before a motion is enqueued when the device is in a
850     * non-interactive state.
851     *
852     * <p>There are some actions that need to be handled here because they
853     * affect the power state of the device, for example, waking on motions.
854     * Generally, it's best to keep as little as possible in the queue thread
855     * because it's the most fragile.
856     * @param policyFlags The policy flags associated with the motion.
857     *
858     * @return Actions flags: may be {@link #ACTION_PASS_TO_USER}.
859     */
860    public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags);
861
862    /**
863     * Called from the input dispatcher thread before a key is dispatched to a window.
864     *
865     * <p>Allows you to define
866     * behavior for keys that can not be overridden by applications.
867     * This method is called from the input thread, with no locks held.
868     *
869     * @param win The window that currently has focus.  This is where the key
870     *            event will normally go.
871     * @param event The key event.
872     * @param policyFlags The policy flags associated with the key.
873     * @return 0 if the key should be dispatched immediately, -1 if the key should
874     * not be dispatched ever, or a positive value indicating the number of
875     * milliseconds by which the key dispatch should be delayed before trying
876     * again.
877     */
878    public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags);
879
880    /**
881     * Called from the input dispatcher thread when an application did not handle
882     * a key that was dispatched to it.
883     *
884     * <p>Allows you to define default global behavior for keys that were not handled
885     * by applications.  This method is called from the input thread, with no locks held.
886     *
887     * @param win The window that currently has focus.  This is where the key
888     *            event will normally go.
889     * @param event The key event.
890     * @param policyFlags The policy flags associated with the key.
891     * @return Returns an alternate key event to redispatch as a fallback, or null to give up.
892     * The caller is responsible for recycling the key event.
893     */
894    public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, int policyFlags);
895
896    /**
897     * Called when layout of the windows is about to start.
898     *
899     * @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}.
900     * @param displayWidth The current full width of the screen.
901     * @param displayHeight The current full height of the screen.
902     * @param displayRotation The current rotation being applied to the base window.
903     * @param uiMode The current uiMode in configuration.
904     */
905    public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
906                              int displayRotation, int uiMode);
907
908    /**
909     * Returns the bottom-most layer of the system decor, above which no policy decor should
910     * be applied.
911     */
912    public int getSystemDecorLayerLw();
913
914    /**
915     * Return the rectangle of the screen that is available for applications to run in.
916     * This will be called immediately after {@link #beginLayoutLw}.
917     *
918     * @param r The rectangle to be filled with the boundaries available to applications.
919     */
920    public void getContentRectLw(Rect r);
921
922    /**
923     * Called for each window attached to the window manager as layout is
924     * proceeding.  The implementation of this function must take care of
925     * setting the window's frame, either here or in finishLayout().
926     *
927     * @param win The window being positioned.
928     * @param attached For sub-windows, the window it is attached to; this
929     *                 window will already have had layoutWindow() called on it
930     *                 so you can use its Rect.  Otherwise null.
931     */
932    public void layoutWindowLw(WindowState win, WindowState attached);
933
934
935    /**
936     * Return the insets for the areas covered by system windows. These values
937     * are computed on the most recent layout, so they are not guaranteed to
938     * be correct.
939     *
940     * @param attrs The LayoutParams of the window.
941     * @param rotation Rotation of the display.
942     * @param outContentInsets The areas covered by system windows, expressed as positive insets.
943     * @param outStableInsets The areas covered by stable system windows irrespective of their
944     *                        current visibility. Expressed as positive insets.
945     * @param outOutsets The areas that are not real display, but we would like to treat as such.
946     * @return Whether to always consume the navigation bar.
947     *         See {@link #isNavBarForcedShownLw(WindowState)}.
948     */
949    public boolean getInsetHintLw(WindowManager.LayoutParams attrs, int rotation,
950            Rect outContentInsets, Rect outStableInsets, Rect outOutsets);
951
952    /**
953     * Called when layout of the windows is finished.  After this function has
954     * returned, all windows given to layoutWindow() <em>must</em> have had a
955     * frame assigned.
956     */
957    public void finishLayoutLw();
958
959    /** Layout state may have changed (so another layout will be performed) */
960    static final int FINISH_LAYOUT_REDO_LAYOUT = 0x0001;
961    /** Configuration state may have changed */
962    static final int FINISH_LAYOUT_REDO_CONFIG = 0x0002;
963    /** Wallpaper may need to move */
964    static final int FINISH_LAYOUT_REDO_WALLPAPER = 0x0004;
965    /** Need to recompute animations */
966    static final int FINISH_LAYOUT_REDO_ANIM = 0x0008;
967
968    /**
969     * Called following layout of all windows before each window has policy applied.
970     *
971     * @param displayWidth The current full width of the screen.
972     * @param displayHeight The current full height of the screen.
973     */
974    public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight);
975
976    /**
977     * Called following layout of all window to apply policy to each window.
978     *
979     * @param win The window being positioned.
980     * @param attrs The LayoutParams of the window.
981     * @param attached For sub-windows, the window it is attached to. Otherwise null.
982     */
983    public void applyPostLayoutPolicyLw(WindowState win,
984            WindowManager.LayoutParams attrs, WindowState attached);
985
986    /**
987     * Called following layout of all windows and after policy has been applied
988     * to each window. If in this function you do
989     * something that may have modified the animation state of another window,
990     * be sure to return non-zero in order to perform another pass through layout.
991     *
992     * @return Return any bit set of {@link #FINISH_LAYOUT_REDO_LAYOUT},
993     * {@link #FINISH_LAYOUT_REDO_CONFIG}, {@link #FINISH_LAYOUT_REDO_WALLPAPER},
994     * or {@link #FINISH_LAYOUT_REDO_ANIM}.
995     */
996    public int finishPostLayoutPolicyLw();
997
998    /**
999     * Return true if it is okay to perform animations for an app transition
1000     * that is about to occur.  You may return false for this if, for example,
1001     * the lock screen is currently displayed so the switch should happen
1002     * immediately.
1003     */
1004    public boolean allowAppAnimationsLw();
1005
1006
1007    /**
1008     * A new window has been focused.
1009     */
1010    public int focusChangedLw(WindowState lastFocus, WindowState newFocus);
1011
1012    /**
1013     * Called when the device has started waking up.
1014     */
1015    public void startedWakingUp();
1016
1017    /**
1018     * Called when the device has finished waking up.
1019     */
1020    public void finishedWakingUp();
1021
1022    /**
1023     * Called when the device has started going to sleep.
1024     *
1025     * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1026     * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1027     */
1028    public void startedGoingToSleep(int why);
1029
1030    /**
1031     * Called when the device has finished going to sleep.
1032     *
1033     * @param why {@link #OFF_BECAUSE_OF_USER}, {@link #OFF_BECAUSE_OF_ADMIN},
1034     * or {@link #OFF_BECAUSE_OF_TIMEOUT}.
1035     */
1036    public void finishedGoingToSleep(int why);
1037
1038    /**
1039     * Called when the device is about to turn on the screen to show content.
1040     * When waking up, this method will be called once after the call to wakingUp().
1041     * When dozing, the method will be called sometime after the call to goingToSleep() and
1042     * may be called repeatedly in the case where the screen is pulsing on and off.
1043     *
1044     * Must call back on the listener to tell it when the higher-level system
1045     * is ready for the screen to go on (i.e. the lock screen is shown).
1046     */
1047    public void screenTurningOn(ScreenOnListener screenOnListener);
1048
1049    /**
1050     * Called when the device has actually turned on the screen, i.e. the display power state has
1051     * been set to ON and the screen is unblocked.
1052     */
1053    public void screenTurnedOn();
1054
1055    /**
1056     * Called when the device has turned the screen off.
1057     */
1058    public void screenTurnedOff();
1059
1060    public interface ScreenOnListener {
1061        void onScreenOn();
1062    }
1063
1064    /**
1065     * Return whether the default display is on and not blocked by a black surface.
1066     */
1067    public boolean isScreenOn();
1068
1069    /**
1070     * Tell the policy that the lid switch has changed state.
1071     * @param whenNanos The time when the change occurred in uptime nanoseconds.
1072     * @param lidOpen True if the lid is now open.
1073     */
1074    public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen);
1075
1076    /**
1077     * Tell the policy that the camera lens has been covered or uncovered.
1078     * @param whenNanos The time when the change occurred in uptime nanoseconds.
1079     * @param lensCovered True if the lens is covered.
1080     */
1081    public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered);
1082
1083    /**
1084     * Tell the policy if anyone is requesting that keyguard not come on.
1085     *
1086     * @param enabled Whether keyguard can be on or not.  does not actually
1087     * turn it on, unless it was previously disabled with this function.
1088     *
1089     * @see android.app.KeyguardManager.KeyguardLock#disableKeyguard()
1090     * @see android.app.KeyguardManager.KeyguardLock#reenableKeyguard()
1091     */
1092    @SuppressWarnings("javadoc")
1093    public void enableKeyguard(boolean enabled);
1094
1095    /**
1096     * Callback used by {@link WindowManagerPolicy#exitKeyguardSecurely}
1097     */
1098    interface OnKeyguardExitResult {
1099        void onKeyguardExitResult(boolean success);
1100    }
1101
1102    /**
1103     * Tell the policy if anyone is requesting the keyguard to exit securely
1104     * (this would be called after the keyguard was disabled)
1105     * @param callback Callback to send the result back.
1106     * @see android.app.KeyguardManager#exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult)
1107     */
1108    @SuppressWarnings("javadoc")
1109    void exitKeyguardSecurely(OnKeyguardExitResult callback);
1110
1111    /**
1112     * isKeyguardLocked
1113     *
1114     * Return whether the keyguard is currently locked.
1115     *
1116     * @return true if in keyguard is locked.
1117     */
1118    public boolean isKeyguardLocked();
1119
1120    /**
1121     * isKeyguardSecure
1122     *
1123     * Return whether the keyguard requires a password to unlock.
1124     *
1125     * @return true if in keyguard is secure.
1126     */
1127    public boolean isKeyguardSecure();
1128
1129    /**
1130     * Return whether the keyguard is on.
1131     *
1132     * @return true if in keyguard is on.
1133     */
1134    public boolean isKeyguardShowingOrOccluded();
1135
1136    /**
1137     * inKeyguardRestrictedKeyInputMode
1138     *
1139     * if keyguard screen is showing or in restricted key input mode (i.e. in
1140     * keyguard password emergency screen). When in such mode, certain keys,
1141     * such as the Home key and the right soft keys, don't work.
1142     *
1143     * @return true if in keyguard restricted input mode.
1144     */
1145    public boolean inKeyguardRestrictedKeyInputMode();
1146
1147    /**
1148     * Ask the policy to dismiss the keyguard, if it is currently shown.
1149     */
1150    public void dismissKeyguardLw();
1151
1152    /**
1153     * Notifies the keyguard that the activity has drawn it was waiting for.
1154     */
1155    public void notifyActivityDrawnForKeyguardLw();
1156
1157    /**
1158     * Ask the policy whether the Keyguard has drawn. If the Keyguard is disabled, this method
1159     * returns true as soon as we know that Keyguard is disabled.
1160     *
1161     * @return true if the keyguard has drawn.
1162     */
1163    public boolean isKeyguardDrawnLw();
1164
1165    /**
1166     * Given an orientation constant, returns the appropriate surface rotation,
1167     * taking into account sensors, docking mode, rotation lock, and other factors.
1168     *
1169     * @param orientation An orientation constant, such as
1170     * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1171     * @param lastRotation The most recently used rotation.
1172     * @return The surface rotation to use.
1173     */
1174    public int rotationForOrientationLw(@ActivityInfo.ScreenOrientation int orientation,
1175            int lastRotation);
1176
1177    /**
1178     * Given an orientation constant and a rotation, returns true if the rotation
1179     * has compatible metrics to the requested orientation.  For example, if
1180     * the application requested landscape and got seascape, then the rotation
1181     * has compatible metrics; if the application requested portrait and got landscape,
1182     * then the rotation has incompatible metrics; if the application did not specify
1183     * a preference, then anything goes.
1184     *
1185     * @param orientation An orientation constant, such as
1186     * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_LANDSCAPE}.
1187     * @param rotation The rotation to check.
1188     * @return True if the rotation is compatible with the requested orientation.
1189     */
1190    public boolean rotationHasCompatibleMetricsLw(@ActivityInfo.ScreenOrientation int orientation,
1191            int rotation);
1192
1193    /**
1194     * Called by the window manager when the rotation changes.
1195     *
1196     * @param rotation The new rotation.
1197     */
1198    public void setRotationLw(int rotation);
1199
1200    /**
1201     * Called when the system is mostly done booting to set whether
1202     * the system should go into safe mode.
1203     */
1204    public void setSafeMode(boolean safeMode);
1205
1206    /**
1207     * Called when the system is mostly done booting.
1208     */
1209    public void systemReady();
1210
1211    /**
1212     * Called when the system is done booting to the point where the
1213     * user can start interacting with it.
1214     */
1215    public void systemBooted();
1216
1217    /**
1218     * Show boot time message to the user.
1219     */
1220    public void showBootMessage(final CharSequence msg, final boolean always);
1221
1222    /**
1223     * Hide the UI for showing boot messages, never to be displayed again.
1224     */
1225    public void hideBootMessages();
1226
1227    /**
1228     * Called when userActivity is signalled in the power manager.
1229     * This is safe to call from any thread, with any window manager locks held or not.
1230     */
1231    public void userActivity();
1232
1233    /**
1234     * Called when we have finished booting and can now display the home
1235     * screen to the user.  This will happen after systemReady(), and at
1236     * this point the display is active.
1237     */
1238    public void enableScreenAfterBoot();
1239
1240    public void setCurrentOrientationLw(@ActivityInfo.ScreenOrientation int newOrientation);
1241
1242    /**
1243     * Call from application to perform haptic feedback on its window.
1244     */
1245    public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always);
1246
1247    /**
1248     * Called when we have started keeping the screen on because a window
1249     * requesting this has become visible.
1250     */
1251    public void keepScreenOnStartedLw();
1252
1253    /**
1254     * Called when we have stopped keeping the screen on because the last window
1255     * requesting this is no longer visible.
1256     */
1257    public void keepScreenOnStoppedLw();
1258
1259    /**
1260     * Gets the current user rotation mode.
1261     *
1262     * @return The rotation mode.
1263     *
1264     * @see WindowManagerPolicy#USER_ROTATION_LOCKED
1265     * @see WindowManagerPolicy#USER_ROTATION_FREE
1266     */
1267    @UserRotationMode
1268    public int getUserRotationMode();
1269
1270    /**
1271     * Inform the policy that the user has chosen a preferred orientation ("rotation lock").
1272     *
1273     * @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
1274     *             {@link WindowManagerPolicy#USER_ROTATION_FREE}.
1275     * @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
1276     *                 {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
1277     */
1278    public void setUserRotationMode(@UserRotationMode int mode, @Surface.Rotation int rotation);
1279
1280    /**
1281     * Called when a new system UI visibility is being reported, allowing
1282     * the policy to adjust what is actually reported.
1283     * @param visibility The raw visibility reported by the status bar.
1284     * @return The new desired visibility.
1285     */
1286    public int adjustSystemUiVisibilityLw(int visibility);
1287
1288    /**
1289     * Specifies whether there is an on-screen navigation bar separate from the status bar.
1290     */
1291    public boolean hasNavigationBar();
1292
1293    /**
1294     * Lock the device now.
1295     */
1296    public void lockNow(Bundle options);
1297
1298    /**
1299     * Set the last used input method window state. This state is used to make IME transition
1300     * smooth.
1301     * @hide
1302     */
1303    public void setLastInputMethodWindowLw(WindowState ime, WindowState target);
1304
1305    /**
1306     * Show the recents task list app.
1307     * @hide
1308     */
1309    public void showRecentApps(boolean fromHome);
1310
1311    /**
1312     * Show the global actions dialog.
1313     * @hide
1314     */
1315    public void showGlobalActions();
1316
1317    /**
1318     * @return The current height of the input method window.
1319     */
1320    public int getInputMethodWindowVisibleHeightLw();
1321
1322    /**
1323     * Called when the current user changes. Guaranteed to be called before the broadcast
1324     * of the new user id is made to all listeners.
1325     *
1326     * @param newUserId The id of the incoming user.
1327     */
1328    public void setCurrentUserLw(int newUserId);
1329
1330    /**
1331     * Print the WindowManagerPolicy's state into the given stream.
1332     *
1333     * @param prefix Text to print at the front of each line.
1334     * @param writer The PrintWriter to which you should dump your state.  This will be
1335     * closed for you after you return.
1336     * @param args additional arguments to the dump request.
1337     */
1338    public void dump(String prefix, PrintWriter writer, String[] args);
1339
1340    /**
1341     * Returns whether a given window type can be magnified.
1342     *
1343     * @param windowType The window type.
1344     * @return True if the window can be magnified.
1345     */
1346    public boolean canMagnifyWindow(int windowType);
1347
1348    /**
1349     * Returns whether a given window type is considered a top level one.
1350     * A top level window does not have a container, i.e. attached window,
1351     * or if it has a container it is laid out as a top-level window, not
1352     * as a child of its container.
1353     *
1354     * @param windowType The window type.
1355     * @return True if the window is a top level one.
1356     */
1357    public boolean isTopLevelWindow(int windowType);
1358
1359    /**
1360     * Notifies the keyguard to start fading out.
1361     *
1362     * @param startTime the start time of the animation in uptime milliseconds
1363     * @param fadeoutDuration the duration of the exit animation, in milliseconds
1364     */
1365    public void startKeyguardExitAnimation(long startTime, long fadeoutDuration);
1366
1367    /**
1368     * Calculates the stable insets without running a layout.
1369     *
1370     * @param displayRotation the current display rotation
1371     * @param displayWidth the current display width
1372     * @param displayHeight the current display height
1373     * @param outInsets the insets to return
1374     */
1375    public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1376            Rect outInsets);
1377
1378
1379    /**
1380     * @return true if the navigation bar is forced to stay visible
1381     */
1382    public boolean isNavBarForcedShownLw(WindowState win);
1383
1384    /**
1385     * Calculates the insets for the areas that could never be removed in Honeycomb, i.e. system
1386     * bar or button bar. See {@link #getNonDecorDisplayWidth}.
1387     *
1388     * @param displayRotation the current display rotation
1389     * @param displayWidth the current display width
1390     * @param displayHeight the current display height
1391     * @param outInsets the insets to return
1392     */
1393    public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight,
1394            Rect outInsets);
1395
1396    /**
1397     * @return True if a specified {@param dockSide} is allowed on the current device, or false
1398     *         otherwise. It is guaranteed that at least one dock side for a particular orientation
1399     *         is allowed, so for example, if DOCKED_RIGHT is not allowed, DOCKED_LEFT is allowed.
1400     */
1401    public boolean isDockSideAllowed(int dockSide);
1402
1403    /**
1404     * Called when the configuration has changed, and it's safe to load new values from resources.
1405     */
1406    public void onConfigurationChanged();
1407}
1408