/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; import android.Manifest.permission; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; import android.app.KeyguardManager; import android.app.Presentation; import android.content.Context; import android.content.pm.ActivityInfo; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.Region; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; import java.util.Objects; /** * The interface that apps use to talk to the window manager. *
* Each window manager instance is bound to a particular {@link Display}.
* To obtain a {@link WindowManager} for a different display, use
* {@link Context#createDisplayContext} to obtain a {@link Context} for that
* display, then use Context.getSystemService(Context.WINDOW_SERVICE)
* to get the WindowManager.
*
* The simplest way to show a window on another display is to create a * {@link Presentation}. The presentation will automatically obtain a * {@link WindowManager} and {@link Context} for that display. *
*/ @SystemService(Context.WINDOW_SERVICE) public interface WindowManager extends ViewManager { /** @hide */ int DOCKED_INVALID = -1; /** @hide */ int DOCKED_LEFT = 1; /** @hide */ int DOCKED_TOP = 2; /** @hide */ int DOCKED_RIGHT = 3; /** @hide */ int DOCKED_BOTTOM = 4; /** @hide */ final static String INPUT_CONSUMER_PIP = "pip_input_consumer"; /** @hide */ final static String INPUT_CONSUMER_NAVIGATION = "nav_input_consumer"; /** @hide */ final static String INPUT_CONSUMER_WALLPAPER = "wallpaper_input_consumer"; /** * Exception that is thrown when trying to add view whose * {@link LayoutParams} {@link LayoutParams#token} * is invalid. */ public static class BadTokenException extends RuntimeException { public BadTokenException() { } public BadTokenException(String name) { super(name); } } /** * Exception that is thrown when calling {@link #addView} to a secondary display that cannot * be found. See {@link android.app.Presentation} for more information on secondary displays. */ public static class InvalidDisplayException extends RuntimeException { public InvalidDisplayException() { } public InvalidDisplayException(String name) { super(name); } } /** * Returns the {@link Display} upon which this {@link WindowManager} instance * will create new windows. ** Despite the name of this method, the display that is returned is not * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}). * The returned display could instead be a secondary display that this * window manager instance is managing. Think of it as the display that * this {@link WindowManager} instance uses by default. *
* To create windows on a different display, you need to obtain a * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager} * class documentation for more information.) *
* * @return The display that this window manager is managing. */ public Display getDefaultDisplay(); /** * Special variation of {@link #removeView} that immediately invokes * the given view hierarchy's {@link View#onDetachedFromWindow() * View.onDetachedFromWindow()} methods before returning. This is not * for normal applications; using it correctly requires great care. * * @param view The view to be removed. */ public void removeViewImmediate(View view); /** * Used to asynchronously request Keyboard Shortcuts from the focused window. * * @hide */ public interface KeyboardShortcutsReceiver { /** * Callback used when the focused window keyboard shortcuts are ready to be displayed. * * @param result The keyboard shortcuts to be displayed. */ void onKeyboardShortcutsReceived(List* The system may change the position, size, or visibility of these windows at anytime * to reduce visual clutter to the user and also manage resources. *
* Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission. *
* The system will adjust the importance of processes with this window type to reduce the * chance of the low-memory-killer killing them. *
* In multi-user systems shows only on the owning user's screen. */ public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38; /** * End of types of system windows. */ public static final int LAST_SYSTEM_WINDOW = 2999; /** * @hide * Used internally when there is no suitable type available. */ public static final int INVALID_WINDOW_TYPE = -1; /** * Return true if the window type is an alert window. * * @param type The window type. * @return If the window type is an alert window. * @hide */ public static boolean isSystemAlertWindowType(int type) { switch (type) { case TYPE_PHONE: case TYPE_PRIORITY_PHONE: case TYPE_SYSTEM_ALERT: case TYPE_SYSTEM_ERROR: case TYPE_SYSTEM_OVERLAY: case TYPE_APPLICATION_OVERLAY: return true; } return false; } /** @deprecated this is ignored, this value is set automatically when needed. */ @Deprecated public static final int MEMORY_TYPE_NORMAL = 0; /** @deprecated this is ignored, this value is set automatically when needed. */ @Deprecated public static final int MEMORY_TYPE_HARDWARE = 1; /** @deprecated this is ignored, this value is set automatically when needed. */ @Deprecated public static final int MEMORY_TYPE_GPU = 2; /** @deprecated this is ignored, this value is set automatically when needed. */ @Deprecated public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; /** * @deprecated this is ignored */ @Deprecated public int memoryType; /** Window flag: as long as this window is visible to the user, allow * the lock screen to activate while the screen is on. * This can be used independently, or in combination with * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */ public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001; /** Window flag: everything behind this window will be dimmed. * Use {@link #dimAmount} to control the amount of dim. */ public static final int FLAG_DIM_BEHIND = 0x00000002; /** Window flag: blur everything behind this window. * @deprecated Blurring is no longer supported. */ @Deprecated public static final int FLAG_BLUR_BEHIND = 0x00000004; /** Window flag: this window won't ever get key input focus, so the * user can not send key or other button events to it. Those will * instead go to whatever focusable window is behind it. This flag * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that * is explicitly set. * *
Setting this flag also implies that the window will not need to * interact with * a soft input method, so it will be Z-ordered and positioned * independently of any active input method (typically this means it * gets Z-ordered on top of the input method, so it can use the full * screen for its content and cover the input method if needed. You * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */ public static final int FLAG_NOT_FOCUSABLE = 0x00000008; /** Window flag: this window can never receive touch events. */ public static final int FLAG_NOT_TOUCHABLE = 0x00000010; /** Window flag: even when this window is focusable (its * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events * outside of the window to be sent to the windows behind it. Otherwise * it will consume all pointer events itself, regardless of whether they * are inside of the window. */ public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020; /** Window flag: when set, if the device is asleep when the touch * screen is pressed, you will receive this first touch event. Usually * the first touch event is consumed by the system since the user can * not see what they are pressing on. * * @deprecated This flag has no effect. */ @Deprecated public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040; /** Window flag: as long as this window is visible to the user, keep * the device's screen turned on and bright. */ public static final int FLAG_KEEP_SCREEN_ON = 0x00000080; /** Window flag: place the window within the entire screen, ignoring * decorations around the border (such as the status bar). The * window must correctly position its contents to take the screen * decoration into account. This flag is normally set for you * by Window as described in {@link Window#setFlags}. */ public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100; /** Window flag: allow window to extend outside of the screen. */ public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200; /** * Window flag: hide all screen decorations (such as the status bar) while * this window is displayed. This allows the window to use the entire * display space for itself -- the status bar will be hidden when * an app window with this flag set is on the top layer. A fullscreen window * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's * {@link #softInputMode} field; the window will stay fullscreen * and will not resize. * *
This flag can be controlled in your theme through the * {@link android.R.attr#windowFullscreen} attribute; this attribute * is automatically set for you in the standard fullscreen themes * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen}, * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen}, * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen}, * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen}, * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen}, * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.
*/ public static final int FLAG_FULLSCREEN = 0x00000400; /** Window flag: override {@link #FLAG_FULLSCREEN} and force the * screen decorations (such as the status bar) to be shown. */ public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800; /** Window flag: turn on dithering when compositing this window to * the screen. * @deprecated This flag is no longer used. */ @Deprecated public static final int FLAG_DITHER = 0x00001000; /** Window flag: treat the content of the window as secure, preventing * it from appearing in screenshots or from being viewed on non-secure * displays. * *See {@link android.view.Display#FLAG_SECURE} for more details about * secure surfaces and secure displays. */ public static final int FLAG_SECURE = 0x00002000; /** Window flag: a special mode where the layout parameters are used * to perform scaling of the surface when it is composited to the * screen. */ public static final int FLAG_SCALED = 0x00004000; /** Window flag: intended for windows that will often be used when the user is * holding the screen against their face, it will aggressively filter the event * stream to prevent unintended presses in this situation that may not be * desired for a particular window, when such an event stream is detected, the * application will receive a CANCEL motion event to indicate this so applications * can handle this accordingly by taking no action on the event * until the finger is released. */ public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000; /** Window flag: a special option only for use in combination with * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the * screen your window may appear on top of or behind screen decorations * such as the status bar. By also including this flag, the window * manager will report the inset rectangle needed to ensure your * content is not covered by screen decorations. This flag is normally * set for you by Window as described in {@link Window#setFlags}.*/ public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000; /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with * respect to how this window interacts with the current method. That * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the * window will behave as if it needs to interact with the input method * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is * not set and this flag is set, then the window will behave as if it * doesn't need to interact with the input method and can be placed * to use more space and cover the input method. */ public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000; /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you * can set this flag to receive a single special MotionEvent with * the action * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for * touches that occur outside of your window. Note that you will not * receive the full down/move/up gesture, only the location of the * first down as an ACTION_OUTSIDE. */ public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000; /** Window flag: special flag to let windows be shown when the screen * is locked. This will let application windows take precedence over * key guard or any other lock screens. Can be used with * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows * directly before showing the key guard window. Can be used with * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss * non-secure keyguards. This flag only applies to the top-most * full-screen window. * @deprecated Use {@link android.R.attr#showWhenLocked} or * {@link android.app.Activity#setShowWhenLocked(boolean)} instead to prevent an * unintentional double life-cycle event. */ @Deprecated public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000; /** Window flag: ask that the system wallpaper be shown behind * your window. The window surface must be translucent to be able * to actually see the wallpaper behind it; this flag just ensures * that the wallpaper surface will be there if this window actually * has translucent regions. * *
This flag can be controlled in your theme through the * {@link android.R.attr#windowShowWallpaper} attribute; this attribute * is automatically set for you in the standard wallpaper themes * such as {@link android.R.style#Theme_Wallpaper}, * {@link android.R.style#Theme_Wallpaper_NoTitleBar}, * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen}, * {@link android.R.style#Theme_Holo_Wallpaper}, * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar}, * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.
*/ public static final int FLAG_SHOW_WALLPAPER = 0x00100000; /** Window flag: when set as a window is being added or made * visible, once the window has been shown then the system will * poke the power manager's user activity (as if the user had woken * up the device) to turn the screen on. * @deprecated Use {@link android.R.attr#turnScreenOn} or * {@link android.app.Activity#setTurnScreenOn(boolean)} instead to prevent an * unintentional double life-cycle event. */ @Deprecated public static final int FLAG_TURN_SCREEN_ON = 0x00200000; /** * Window flag: when set the window will cause the keyguard to be * dismissed, only if it is not a secure lock keyguard. Because such a * keyguard is not needed for security, it will never re-appear if the * user navigates to another window (in contrast to * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily hide both * secure and non-secure keyguards but ensure they reappear when the * user moves to another UI that doesn't hide them). If the keyguard is * currently active and is secure (requires an unlock credential) than * the user will still need to confirm it before seeing this window, * unless {@link #FLAG_SHOW_WHEN_LOCKED} has also been set. * * @deprecated Use {@link #FLAG_SHOW_WHEN_LOCKED} or * {@link KeyguardManager#requestDismissKeyguard} instead. * Since keyguard was dismissed all the time as long as an * activity with this flag on its window was focused, * keyguard couldn't guard against unintentional touches on * the screen, which isn't desired. */ @Deprecated public static final int FLAG_DISMISS_KEYGUARD = 0x00400000; /** Window flag: when set the window will accept for touch events * outside of its bounds to be sent to other windows that also * support split touch. When this flag is not set, the first pointer * that goes down determines the window to which all subsequent touches * go until all pointers go up. When this flag is set, each pointer * (not necessarily the first) that goes down determines the window * to which all subsequent touches of that pointer will go until that * pointer goes up thereby enabling touches with multiple pointers * to be split across multiple windows. */ public static final int FLAG_SPLIT_TOUCH = 0x00800000; /** *Indicates whether this window should be hardware accelerated. * Requesting hardware acceleration does not guarantee it will happen.
* *This flag can be controlled programmatically only to enable * hardware acceleration. To enable hardware acceleration for a given * window programmatically, do the following:
* ** Window w = activity.getWindow(); // in Activity's onCreate() for instance * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); ** *
It is important to remember that this flag must * be set before setting the content view of your activity or dialog.
* *This flag cannot be used to disable hardware acceleration after it * was enabled in your manifest using * {@link android.R.attr#hardwareAccelerated}. If you need to selectively * and programmatically disable hardware acceleration (for automated testing * for instance), make sure it is turned off in your manifest and enable it * on your activity or dialog when you need it instead, using the method * described above.
* *This flag is automatically set by the system if the * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated} * XML attribute is set to true on an activity or on the application.
*/ public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000; /** * Window flag: allow window contents to extend in to the screen's * overscan area, if there is one. The window should still correctly * position its contents to take the overscan area into account. * *This flag can be controlled in your theme through the * {@link android.R.attr#windowOverscan} attribute; this attribute * is automatically set for you in the standard overscan themes * such as * {@link android.R.style#Theme_Holo_NoActionBar_Overscan}, * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan}, * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.
* *When this flag is enabled for a window, its normal content may be obscured * to some degree by the overscan region of the display. To ensure key parts of * that content are visible to the user, you can use * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)} * to set the point in the view hierarchy where the appropriate offsets should * be applied. (This can be done either by directly calling this function, using * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy, * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect) * View.fitSystemWindows(Rect)} method).
* *This mechanism for positioning content elements is identical to its equivalent * use with layout and {@link View#setSystemUiVisibility(int) * View.setSystemUiVisibility(int)}; here is an example layout that will correctly * position its UI elements with this overscan flag is set:
* * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete} */ public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000; /** * Window flag: request a translucent status bar with minimal system-provided * background protection. * *This flag can be controlled in your theme through the * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute * is automatically set for you in the standard translucent decor themes * such as * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor}, * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor}, * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.
* *When this flag is enabled for a window, it automatically sets * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.
*/ public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000; /** * Window flag: request a translucent navigation bar with minimal system-provided * background protection. * *This flag can be controlled in your theme through the * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute * is automatically set for you in the standard translucent decor themes * such as * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor}, * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor}, * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.
* *When this flag is enabled for a window, it automatically sets * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.
*/ public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000; /** * Flag for a window in local focus mode. * Window in local focus mode can control focus independent of window manager using * {@link Window#setLocalFocus(boolean, boolean)}. * Usually window in this mode will not get touch/key events from window manager, but will * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}. */ public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000; /** Window flag: Enable touches to slide out of a window into neighboring * windows in mid-gesture instead of being captured for the duration of * the gesture. * * This flag changes the behavior of touch focus for this window only. * Touches can slide out of the window but they cannot necessarily slide * back in (unless the other window with touch focus permits it). * * {@hide} */ public static final int FLAG_SLIPPERY = 0x20000000; /** * Window flag: When requesting layout with an attached window, the attached window may * overlap with the screen decorations of the parent window such as the navigation bar. By * including this flag, the window manager will layout the attached window within the decor * frame of the parent window such that it doesn't overlap with screen decorations. */ public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000; /** * Flag indicating that this Window is responsible for drawing the background for the * system bars. If set, the system bars are drawn with a transparent background and the * corresponding areas in this window are filled with the colors specified in * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}. */ public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000; /** * Various behavioral options/flags. Default is none. * * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON * @see #FLAG_DIM_BEHIND * @see #FLAG_NOT_FOCUSABLE * @see #FLAG_NOT_TOUCHABLE * @see #FLAG_NOT_TOUCH_MODAL * @see #FLAG_TOUCHABLE_WHEN_WAKING * @see #FLAG_KEEP_SCREEN_ON * @see #FLAG_LAYOUT_IN_SCREEN * @see #FLAG_LAYOUT_NO_LIMITS * @see #FLAG_FULLSCREEN * @see #FLAG_FORCE_NOT_FULLSCREEN * @see #FLAG_SECURE * @see #FLAG_SCALED * @see #FLAG_IGNORE_CHEEK_PRESSES * @see #FLAG_LAYOUT_INSET_DECOR * @see #FLAG_ALT_FOCUSABLE_IM * @see #FLAG_WATCH_OUTSIDE_TOUCH * @see #FLAG_SHOW_WHEN_LOCKED * @see #FLAG_SHOW_WALLPAPER * @see #FLAG_TURN_SCREEN_ON * @see #FLAG_DISMISS_KEYGUARD * @see #FLAG_SPLIT_TOUCH * @see #FLAG_HARDWARE_ACCELERATED * @see #FLAG_LOCAL_FOCUS_MODE * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS */ @ViewDebug.ExportedProperty(flagMapping = { @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"), @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND, name = "FLAG_DIM_BEHIND"), @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND, name = "FLAG_BLUR_BEHIND"), @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE, name = "FLAG_NOT_FOCUSABLE"), @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE, name = "FLAG_NOT_TOUCHABLE"), @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL, name = "FLAG_NOT_TOUCH_MODAL"), @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING, name = "FLAG_TOUCHABLE_WHEN_WAKING"), @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON, name = "FLAG_KEEP_SCREEN_ON"), @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN, name = "FLAG_LAYOUT_IN_SCREEN"), @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS, name = "FLAG_LAYOUT_NO_LIMITS"), @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN, name = "FLAG_FULLSCREEN"), @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN, name = "FLAG_FORCE_NOT_FULLSCREEN"), @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER, name = "FLAG_DITHER"), @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE, name = "FLAG_SECURE"), @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED, name = "FLAG_SCALED"), @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES, name = "FLAG_IGNORE_CHEEK_PRESSES"), @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR, name = "FLAG_LAYOUT_INSET_DECOR"), @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM, name = "FLAG_ALT_FOCUSABLE_IM"), @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH, name = "FLAG_WATCH_OUTSIDE_TOUCH"), @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED, name = "FLAG_SHOW_WHEN_LOCKED"), @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER, name = "FLAG_SHOW_WALLPAPER"), @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON, name = "FLAG_TURN_SCREEN_ON"), @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD, name = "FLAG_DISMISS_KEYGUARD"), @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH, name = "FLAG_SPLIT_TOUCH"), @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED, name = "FLAG_HARDWARE_ACCELERATED"), @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE, name = "FLAG_LOCAL_FOCUS_MODE"), @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS, name = "FLAG_TRANSLUCENT_STATUS"), @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION, name = "FLAG_TRANSLUCENT_NAVIGATION"), @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS") }, formatToHexString = true) public int flags; /** * If the window has requested hardware acceleration, but this is not * allowed in the process it is in, then still render it as if it is * hardware accelerated. This is used for the starting preview windows * in the system process, which don't need to have the overhead of * hardware acceleration (they are just a static rendering), but should * be rendered as such to match the actual window of the app even if it * is hardware accelerated. * Even if the window isn't hardware accelerated, still do its rendering * as if it was. * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows * that need hardware acceleration (e.g. LockScreen), where hardware acceleration * is generally disabled. This flag must be specified in addition to * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system * windows. * * @hide */ public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001; /** * In the system process, we globally do not use hardware acceleration * because there are many threads doing UI there and they conflict. * If certain parts of the UI that really do want to use hardware * acceleration, this flag can be set to force it. This is basically * for the lock screen. Anyone else using it, you are probably wrong. * * @hide */ public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002; /** * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers * may elect to skip these notifications if they are not doing anything productive with * them (they do not affect the wallpaper scrolling operation) by calling * {@link * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}. * * @hide */ public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004; /** In a multiuser system if this flag is set and the owner is a system process then this * window will appear on all user screens. This overrides the default behavior of window * types that normally only appear on the owning user's screen. Refer to each window type * to determine its default behavior. * * {@hide} */ public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010; /** * Never animate position changes of the window. * * {@hide} */ @TestApi public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040; /** Window flag: special flag to limit the size of the window to be * original size ([320x480] x density). Used to create window for applications * running under compatibility mode. * * {@hide} */ public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080; /** Window flag: a special option intended for system dialogs. When * this flag is set, the window will demand focus unconditionally when * it is created. * {@hide} */ public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100; /** Window flag: maintain the previous translucent decor state when this window * becomes top-most. * {@hide} */ public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200; /** * Flag whether the current window is a keyguard window, meaning that it will hide all other * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set. * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}. * {@hide} */ public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400; /** * Flag that prevents the wallpaper behind the current window from receiving touch events. * * {@hide} */ public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800; /** * Flag to force the status bar window to be visible all the time. If the bar is hidden when * this flag is set it will be shown again and the bar will have a transparent background. * This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}. * * {@hide} */ public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000; /** * Flag indicating that the x, y, width, and height members should be * ignored (and thus their previous value preserved). For example * because they are being managed externally through repositionChild. * * {@hide} */ public static final int PRIVATE_FLAG_PRESERVE_GEOMETRY = 0x00002000; /** * Flag that will make window ignore app visibility and instead depend purely on the decor * view visibility for determining window visibility. This is used by recents to keep * drawing after it launches an app. * @hide */ public static final int PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY = 0x00004000; /** * Flag to indicate that this window is not expected to be replaced across * configuration change triggered activity relaunches. In general the WindowManager * expects Windows to be replaced after relaunch, and thus it will preserve their surfaces * until the replacement is ready to show in order to prevent visual glitch. However * some windows, such as PopupWindows expect to be cleared across configuration change, * and thus should hint to the WindowManager that it should not wait for a replacement. * @hide */ public static final int PRIVATE_FLAG_WILL_NOT_REPLACE_ON_RELAUNCH = 0x00008000; /** * Flag to indicate that this child window should always be laid-out in the parent * frame regardless of the current windowing mode configuration. * @hide */ public static final int PRIVATE_FLAG_LAYOUT_CHILD_WINDOW_IN_PARENT_FRAME = 0x00010000; /** * Flag to indicate that this window is always drawing the status bar background, no matter * what the other flags are. * @hide */ public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000; /** * Flag to indicate that this window needs Sustained Performance Mode if * the device supports it. * @hide */ public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00040000; /** * Flag to indicate that any window added by an application process that is of type * {@link #TYPE_TOAST} or that requires * {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when * this window is visible. * @hide */ @RequiresPermission(android.Manifest.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS) public static final int PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000; /** * Indicates that this window is the rounded corners overlay present on some * devices this means that it will be excluded from: screenshots, * screen magnification, and mirroring. * @hide */ public static final int PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY = 0x00100000; /** * If this flag is set on the window, window manager will acquire a sleep token that puts * all activities to sleep as long as this window is visible. When this flag is set, the * window needs to occlude all activity windows. * @hide */ @RequiresPermission(permission.DEVICE_POWER) public static final int PRIVATE_FLAG_ACQUIRES_SLEEP_TOKEN = 0x00200000; /** * Control flags that are private to the platform. * @hide */ @TestApi public int privateFlags; /** * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu * key. For this case, we should look at windows behind it to determine the appropriate * value. * * @hide */ public static final int NEEDS_MENU_UNSET = 0; /** * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a * menu key. * * @hide */ public static final int NEEDS_MENU_SET_TRUE = 1; /** * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't * needs a menu key. * * @hide */ public static final int NEEDS_MENU_SET_FALSE = 2; /** * State variable for a window belonging to an activity that responds to * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a * physical button this variable is ignored, but on devices where the Menu key is drawn in * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}. * * (Note that Action Bars, when available, are the preferred way to offer additional * functions otherwise accessed via an options menu.) * * {@hide} */ public int needsMenuKey = NEEDS_MENU_UNSET; /** * Given a particular set of window manager flags, determine whether * such a window may be a target for an input method when it has * focus. In particular, this checks the * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM} * flags and returns true if the combination of the two corresponds * to a window that needs to be behind the input method so that the * user can type into it. * * @param flags The current window manager flags. * * @return Returns true if such a window should be behind/interact * with an input method, false if not. */ public static boolean mayUseInputMethod(int flags) { switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) { case 0: case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM: return true; } return false; } /** * Mask for {@link #softInputMode} of the bits that determine the * desired visibility state of the soft input area for this window. */ public static final int SOFT_INPUT_MASK_STATE = 0x0f; /** * Visibility state for {@link #softInputMode}: no state has been specified. */ public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; /** * Visibility state for {@link #softInputMode}: please don't change the state of * the soft input area. */ public static final int SOFT_INPUT_STATE_UNCHANGED = 1; /** * Visibility state for {@link #softInputMode}: please hide any soft input * area when normally appropriate (when the user is navigating * forward to your window). */ public static final int SOFT_INPUT_STATE_HIDDEN = 2; /** * Visibility state for {@link #softInputMode}: please always hide any * soft input area when this window receives focus. */ public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; /** * Visibility state for {@link #softInputMode}: please show the soft * input area when normally appropriate (when the user is navigating * forward to your window). */ public static final int SOFT_INPUT_STATE_VISIBLE = 4; /** * Visibility state for {@link #softInputMode}: please always make the * soft input area visible when this window receives input focus. */ public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; /** * Mask for {@link #softInputMode} of the bits that determine the * way that the window should be adjusted to accommodate the soft * input window. */ public static final int SOFT_INPUT_MASK_ADJUST = 0xf0; /** Adjustment option for {@link #softInputMode}: nothing specified. * The system will try to pick one or * the other depending on the contents of the window. */ public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00; /** Adjustment option for {@link #softInputMode}: set to allow the * window to be resized when an input * method is shown, so that its contents are not covered by the input * method. This can not be combined with * {@link #SOFT_INPUT_ADJUST_PAN}; if * neither of these are set, then the system will try to pick one or * the other depending on the contents of the window. If the window's * layout parameter flags include {@link #FLAG_FULLSCREEN}, this * value for {@link #softInputMode} will be ignored; the window will * not resize, but will stay fullscreen. */ public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10; /** Adjustment option for {@link #softInputMode}: set to have a window * pan when an input method is * shown, so it doesn't need to deal with resizing but just panned * by the framework to ensure the current input focus is visible. This * can not be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if * neither of these are set, then the system will try to pick one or * the other depending on the contents of the window. */ public static final int SOFT_INPUT_ADJUST_PAN = 0x20; /** Adjustment option for {@link #softInputMode}: set to have a window * not adjust for a shown input method. The window will not be resized, * and it will not be panned to make its focus visible. */ public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30; /** * Bit for {@link #softInputMode}: set when the user has navigated * forward to the window. This is normally set automatically for * you by the system, though you may want to set it in certain cases * when you are displaying a window yourself. This flag will always * be cleared automatically after the window is displayed. */ public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100; /** * An internal annotation for flags that can be specified to {@link #softInputMode}. * * @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = { SOFT_INPUT_STATE_UNSPECIFIED, SOFT_INPUT_STATE_UNCHANGED, SOFT_INPUT_STATE_HIDDEN, SOFT_INPUT_STATE_ALWAYS_HIDDEN, SOFT_INPUT_STATE_VISIBLE, SOFT_INPUT_STATE_ALWAYS_VISIBLE, SOFT_INPUT_ADJUST_UNSPECIFIED, SOFT_INPUT_ADJUST_RESIZE, SOFT_INPUT_ADJUST_PAN, SOFT_INPUT_ADJUST_NOTHING, SOFT_INPUT_IS_FORWARD_NAVIGATION, }) public @interface SoftInputModeFlags {} /** * Desired operating mode for any soft input area. May be any combination * of: * *This flag can be controlled in your theme through the * {@link android.R.attr#windowSoftInputMode} attribute.
*/ @SoftInputModeFlags public int softInputMode; /** * Placement of window within the screen as per {@link Gravity}. Both * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, * android.graphics.Rect) Gravity.apply} and * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) * Gravity.applyDisplay} are used during window layout, with this value * given as the desired gravity. For example you can specify * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here * to control the behavior of * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect) * Gravity.applyDisplay}. * * @see Gravity */ public int gravity; /** * The horizontal margin, as a percentage of the container's width, * between the container and the widget. See * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, * android.graphics.Rect) Gravity.apply} for how this is used. This * field is added with {@link #x} to supply the xAdj parameter. */ public float horizontalMargin; /** * The vertical margin, as a percentage of the container's height, * between the container and the widget. See * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int, * android.graphics.Rect) Gravity.apply} for how this is used. This * field is added with {@link #y} to supply the yAdj parameter. */ public float verticalMargin; /** * Positive insets between the drawing surface and window content. * * @hide */ public final Rect surfaceInsets = new Rect(); /** * Whether the surface insets have been manually set. When set to * {@code false}, the view root will automatically determine the * appropriate surface insets. * * @see #surfaceInsets * @hide */ public boolean hasManualSurfaceInsets; /** * Whether the previous surface insets should be used vs. what is currently set. When set * to {@code true}, the view root will ignore surfaces insets in this object and use what * it currently has. * * @see #surfaceInsets * @hide */ public boolean preservePreviousSurfaceInsets = true; /** * The desired bitmap format. May be one of the constants in * {@link android.graphics.PixelFormat}. The choice of format * might be overridden by {@link #setColorMode(int)}. Default is OPAQUE. */ public int format; /** * A style resource defining the animations to use for this window. * This must be a system resource; it can not be an application resource * because the window manager does not have access to applications. */ public int windowAnimations; /** * An alpha value to apply to this entire window. * An alpha of 1.0 means fully opaque and 0.0 means fully transparent */ public float alpha = 1.0f; /** * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming * to apply. Range is from 1.0 for completely opaque to 0.0 for no * dim. */ public float dimAmount = 1.0f; /** * Default value for {@link #screenBrightness} and {@link #buttonBrightness} * indicating that the brightness value is not overridden for this window * and normal brightness policy should be used. */ public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f; /** * Value for {@link #screenBrightness} and {@link #buttonBrightness} * indicating that the screen or button backlight brightness should be set * to the lowest value when this window is in front. */ public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f; /** * Value for {@link #screenBrightness} and {@link #buttonBrightness} * indicating that the screen or button backlight brightness should be set * to the hightest value when this window is in front. */ public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f; /** * This can be used to override the user's preferred brightness of * the screen. A value of less than 0, the default, means to use the * preferred screen brightness. 0 to 1 adjusts the brightness from * dark to full bright. */ public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE; /** * This can be used to override the standard behavior of the button and * keyboard backlights. A value of less than 0, the default, means to * use the standard backlight behavior. 0 to 1 adjusts the brightness * from dark to full bright. */ public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE; /** * Unspecified value for {@link #rotationAnimation} indicating * a lack of preference. * @hide */ public static final int ROTATION_ANIMATION_UNSPECIFIED = -1; /** * Value for {@link #rotationAnimation} which specifies that this * window will visually rotate in or out following a rotation. */ public static final int ROTATION_ANIMATION_ROTATE = 0; /** * Value for {@link #rotationAnimation} which specifies that this * window will fade in or out following a rotation. */ public static final int ROTATION_ANIMATION_CROSSFADE = 1; /** * Value for {@link #rotationAnimation} which specifies that this window * will immediately disappear or appear following a rotation. */ public static final int ROTATION_ANIMATION_JUMPCUT = 2; /** * Value for {@link #rotationAnimation} to specify seamless rotation mode. * This works like JUMPCUT but will fall back to CROSSFADE if rotation * can't be applied without pausing the screen. For example, this is ideal * for Camera apps which don't want the viewfinder contents to ever rotate * or fade (and rather to be seamless) but also don't want ROTATION_ANIMATION_JUMPCUT * during app transition scenarios where seamless rotation can't be applied. */ public static final int ROTATION_ANIMATION_SEAMLESS = 3; /** * Define the exit and entry animations used on this window when the device is rotated. * This only has an affect if the incoming and outgoing topmost * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered * by other windows. All other situations default to the * {@link #ROTATION_ANIMATION_ROTATE} behavior. * * @see #ROTATION_ANIMATION_ROTATE * @see #ROTATION_ANIMATION_CROSSFADE * @see #ROTATION_ANIMATION_JUMPCUT */ public int rotationAnimation = ROTATION_ANIMATION_ROTATE; /** * Identifier for this window. This will usually be filled in for * you. */ public IBinder token = null; /** * Name of the package owning this window. */ public String packageName = null; /** * Specific orientation value for a window. * May be any of the same values allowed * for {@link android.content.pm.ActivityInfo#screenOrientation}. * If not set, a default value of * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED} * will be used. */ public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; /** * The preferred refresh rate for the window. * * This must be one of the supported refresh rates obtained for the display(s) the window * is on. The selected refresh rate will be applied to the display's default mode. * * This value is ignored if {@link #preferredDisplayModeId} is set. * * @see Display#getSupportedRefreshRates() * @deprecated use {@link #preferredDisplayModeId} instead */ @Deprecated public float preferredRefreshRate; /** * Id of the preferred display mode for the window. ** This must be one of the supported modes obtained for the display(s) the window is on. * A value of {@code 0} means no preference. * * @see Display#getSupportedModes() * @see Display.Mode#getModeId() */ public int preferredDisplayModeId; /** * Control the visibility of the status bar. * * @see View#STATUS_BAR_VISIBLE * @see View#STATUS_BAR_HIDDEN */ public int systemUiVisibility; /** * @hide * The ui visibility as requested by the views in this hierarchy. * the combined value should be systemUiVisibility | subtreeSystemUiVisibility. */ public int subtreeSystemUiVisibility; /** * Get callbacks about the system ui visibility changing. * * TODO: Maybe there should be a bitfield of optional callbacks that we need. * * @hide */ public boolean hasSystemUiListeners; /** * When this window has focus, disable touch pad pointer gesture processing. * The window will receive raw position updates from the touch pad instead * of pointer movements and synthetic touch events. * * @hide */ public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001; /** * Does not construct an input channel for this window. The channel will therefore * be incapable of receiving input. * * @hide */ public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002; /** * When this window has focus, does not call user activity for all input events so * the application will have to do it itself. Should only be used by * the keyguard and phone app. *
* Should only be used by the keyguard and phone app. *
* * @hide */ public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004; /** * Control special features of the input subsystem. * * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES * @see #INPUT_FEATURE_NO_INPUT_CHANNEL * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY * @hide */ public int inputFeatures; /** * Sets the number of milliseconds before the user activity timeout occurs * when this window has focus. A value of -1 uses the standard timeout. * A value of 0 uses the minimum support display timeout. ** This property can only be used to reduce the user specified display timeout; * it can never make the timeout longer than it normally would be. *
* Should only be used by the keyguard and phone app. *
* * @hide */ public long userActivityTimeout = -1; /** * For windows with an anchor (e.g. PopupWindow), keeps track of the View that anchors the * window. * * @hide */ public int accessibilityIdOfAnchor = -1; /** * The window title isn't kept in sync with what is displayed in the title bar, so we * separately track the currently shown title to provide to accessibility. * * @hide */ @TestApi public CharSequence accessibilityTitle; /** * Sets a timeout in milliseconds before which the window will be hidden * by the window manager. Useful for transient notifications like toasts * so we don't have to rely on client cooperation to ensure the window * is hidden. Must be specified at window creation time. Note that apps * are not prepared to handle their windows being removed without their * explicit request and may try to interact with the removed window * resulting in undefined behavior and crashes. Therefore, we do hide * such windows to prevent them from overlaying other apps. * * @hide */ public long hideTimeoutMilliseconds = -1; /** * The color mode requested by this window. The target display may * not be able to honor the request. When the color mode is not set * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the * pixel format specified in {@link #format}. * * @hide */ @ActivityInfo.ColorMode private int mColorMode = ActivityInfo.COLOR_MODE_DEFAULT; public LayoutParams() { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = TYPE_APPLICATION; format = PixelFormat.OPAQUE; } public LayoutParams(int _type) { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = _type; format = PixelFormat.OPAQUE; } public LayoutParams(int _type, int _flags) { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = _type; flags = _flags; format = PixelFormat.OPAQUE; } public LayoutParams(int _type, int _flags, int _format) { super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); type = _type; flags = _flags; format = _format; } public LayoutParams(int w, int h, int _type, int _flags, int _format) { super(w, h); type = _type; flags = _flags; format = _format; } public LayoutParams(int w, int h, int xpos, int ypos, int _type, int _flags, int _format) { super(w, h); x = xpos; y = ypos; type = _type; flags = _flags; format = _format; } public final void setTitle(CharSequence title) { if (null == title) title = ""; mTitle = TextUtils.stringOrSpannedString(title); } public final CharSequence getTitle() { return mTitle != null ? mTitle : ""; } /** * Sets the surface insets based on the elevation (visual z position) of the input view. * @hide */ public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) { final int surfaceInset = (int) Math.ceil(view.getZ() * 2); // Partial workaround for b/28318973. Every inset change causes a freeform window // to jump a little for a few frames. If we never allow surface insets to decrease, // they will stabilize quickly (often from the very beginning, as most windows start // as focused). // TODO(b/22668382) to fix this properly. if (surfaceInset == 0) { // OK to have 0 (this is the case for non-freeform windows). surfaceInsets.set(0, 0, 0, 0); } else { surfaceInsets.set( Math.max(surfaceInset, surfaceInsets.left), Math.max(surfaceInset, surfaceInsets.top), Math.max(surfaceInset, surfaceInsets.right), Math.max(surfaceInset, surfaceInsets.bottom)); } hasManualSurfaceInsets = manual; preservePreviousSurfaceInsets = preservePrevious; } /** *Set the color mode of the window. Setting the color mode might * override the window's pixel {@link WindowManager.LayoutParams#format format}.
* *The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT}, * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or * {@link ActivityInfo#COLOR_MODE_HDR}.
* * @see #getColorMode() */ public void setColorMode(@ActivityInfo.ColorMode int colorMode) { mColorMode = colorMode; } /** * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT}, * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}. * * @see #setColorMode(int) */ @ActivityInfo.ColorMode public int getColorMode() { return mColorMode; } /** @hide */ @SystemApi public final void setUserActivityTimeout(long timeout) { userActivityTimeout = timeout; } /** @hide */ @SystemApi public final long getUserActivityTimeout() { return userActivityTimeout; } public int describeContents() { return 0; } public void writeToParcel(Parcel out, int parcelableFlags) { out.writeInt(width); out.writeInt(height); out.writeInt(x); out.writeInt(y); out.writeInt(type); out.writeInt(flags); out.writeInt(privateFlags); out.writeInt(softInputMode); out.writeInt(gravity); out.writeFloat(horizontalMargin); out.writeFloat(verticalMargin); out.writeInt(format); out.writeInt(windowAnimations); out.writeFloat(alpha); out.writeFloat(dimAmount); out.writeFloat(screenBrightness); out.writeFloat(buttonBrightness); out.writeInt(rotationAnimation); out.writeStrongBinder(token); out.writeString(packageName); TextUtils.writeToParcel(mTitle, out, parcelableFlags); out.writeInt(screenOrientation); out.writeFloat(preferredRefreshRate); out.writeInt(preferredDisplayModeId); out.writeInt(systemUiVisibility); out.writeInt(subtreeSystemUiVisibility); out.writeInt(hasSystemUiListeners ? 1 : 0); out.writeInt(inputFeatures); out.writeLong(userActivityTimeout); out.writeInt(surfaceInsets.left); out.writeInt(surfaceInsets.top); out.writeInt(surfaceInsets.right); out.writeInt(surfaceInsets.bottom); out.writeInt(hasManualSurfaceInsets ? 1 : 0); out.writeInt(preservePreviousSurfaceInsets ? 1 : 0); out.writeInt(needsMenuKey); out.writeInt(accessibilityIdOfAnchor); TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags); out.writeInt(mColorMode); out.writeLong(hideTimeoutMilliseconds); } public static final Parcelable.Creator