The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.view; |
| 18 | |
Aurimas Liutikas | 67e2ae8 | 2016-10-11 18:17:42 -0700 | [diff] [blame] | 19 | import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; |
| 20 | |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 21 | import android.annotation.ColorInt; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 22 | import android.annotation.DrawableRes; |
| 23 | import android.annotation.IdRes; |
| 24 | import android.annotation.LayoutRes; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 25 | import android.annotation.NonNull; |
| 26 | import android.annotation.Nullable; |
Tor Norbye | 417ee5b | 2015-03-10 20:57:37 -0700 | [diff] [blame] | 27 | import android.annotation.StyleRes; |
Philip P. Moltmann | d66dd99 | 2018-09-17 11:26:04 -0700 | [diff] [blame] | 28 | import android.annotation.SystemApi; |
Wale Ogunwale | 3382ab1 | 2017-07-27 08:55:03 -0700 | [diff] [blame] | 29 | import android.app.WindowConfiguration; |
Artur Satayev | ad9254c | 2019-12-10 17:47:54 +0000 | [diff] [blame] | 30 | import android.compat.annotation.UnsupportedAppUsage; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | import android.content.Context; |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 32 | import android.content.pm.ActivityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 | import android.content.res.Configuration; |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 34 | import android.content.res.Resources; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 35 | import android.content.res.TypedArray; |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 36 | import android.graphics.Insets; |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 37 | import android.graphics.PixelFormat; |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 38 | import android.graphics.Rect; |
Filip Gruszczynski | 14418da | 2015-10-04 16:43:48 -0700 | [diff] [blame] | 39 | import android.graphics.drawable.Drawable; |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 40 | import android.media.session.MediaController; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | import android.net.Uri; |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 42 | import android.os.Build; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 43 | import android.os.Bundle; |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 44 | import android.os.Handler; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 45 | import android.os.IBinder; |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 46 | import android.os.RemoteException; |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 47 | import android.transition.Scene; |
George Mount | e180337 | 2014-02-26 19:00:52 +0000 | [diff] [blame] | 48 | import android.transition.Transition; |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 49 | import android.transition.TransitionManager; |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 50 | import android.util.Pair; |
| 51 | import android.view.View.OnApplyWindowInsetsListener; |
| 52 | import android.view.ViewGroup.LayoutParams; |
Tiger Huang | 4a7835f | 2019-11-06 00:07:56 +0800 | [diff] [blame] | 53 | import android.view.WindowInsets.Side.InsetsSide; |
| 54 | import android.view.WindowInsets.Type.InsetsType; |
svetoslavganov | 75986cf | 2009-05-14 22:28:01 -0700 | [diff] [blame] | 55 | import android.view.accessibility.AccessibilityEvent; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | |
Adam Powell | 5a40b71 | 2019-04-15 15:54:02 -0700 | [diff] [blame] | 57 | import java.util.Collections; |
Clara Bayarri | 75e0979 | 2015-07-29 16:20:40 +0100 | [diff] [blame] | 58 | import java.util.List; |
| 59 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | /** |
| 61 | * Abstract base class for a top-level window look and behavior policy. An |
| 62 | * instance of this class should be used as the top-level view added to the |
| 63 | * window manager. It provides standard UI policies such as a background, title |
| 64 | * area, default key processing, etc. |
| 65 | * |
| 66 | * <p>The only existing implementation of this abstract class is |
Jorim Jaggi | b10e33f | 2015-02-04 21:57:40 +0100 | [diff] [blame] | 67 | * android.view.PhoneWindow, which you should instantiate when needing a |
| 68 | * Window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 69 | */ |
| 70 | public abstract class Window { |
| 71 | /** Flag for the "options panel" feature. This is enabled by default. */ |
| 72 | public static final int FEATURE_OPTIONS_PANEL = 0; |
| 73 | /** Flag for the "no title" feature, turning off the title at the top |
| 74 | * of the screen. */ |
| 75 | public static final int FEATURE_NO_TITLE = 1; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * Flag for the progress indicator feature. |
| 79 | * |
| 80 | * @deprecated No longer supported starting in API 21. |
| 81 | */ |
| 82 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | public static final int FEATURE_PROGRESS = 2; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 84 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | /** Flag for having an icon on the left side of the title bar */ |
| 86 | public static final int FEATURE_LEFT_ICON = 3; |
| 87 | /** Flag for having an icon on the right side of the title bar */ |
| 88 | public static final int FEATURE_RIGHT_ICON = 4; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 89 | |
| 90 | /** |
| 91 | * Flag for indeterminate progress. |
| 92 | * |
| 93 | * @deprecated No longer supported starting in API 21. |
| 94 | */ |
| 95 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 96 | public static final int FEATURE_INDETERMINATE_PROGRESS = 5; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 97 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 98 | /** Flag for the context menu. This is enabled by default. */ |
| 99 | public static final int FEATURE_CONTEXT_MENU = 6; |
| 100 | /** Flag for custom title. You cannot combine this feature with other title features. */ |
| 101 | public static final int FEATURE_CUSTOM_TITLE = 7; |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 102 | /** |
| 103 | * Flag for enabling the Action Bar. |
| 104 | * This is enabled by default for some devices. The Action Bar |
| 105 | * replaces the title bar and provides an alternate location |
| 106 | * for an on-screen menu button on some devices. |
| 107 | */ |
Adam Powell | 5d27977 | 2010-07-27 16:34:07 -0700 | [diff] [blame] | 108 | public static final int FEATURE_ACTION_BAR = 8; |
| 109 | /** |
Adam Powell | 6b336f8 | 2010-08-10 20:13:01 -0700 | [diff] [blame] | 110 | * Flag for requesting an Action Bar that overlays window content. |
| 111 | * Normally an Action Bar will sit in the space above window content, but if this |
| 112 | * feature is requested along with {@link #FEATURE_ACTION_BAR} it will be layered over |
| 113 | * the window content itself. This is useful if you would like your app to have more control |
| 114 | * over how the Action Bar is displayed, such as letting application content scroll beneath |
| 115 | * an Action Bar with a transparent background or otherwise displaying a transparent/translucent |
| 116 | * Action Bar over application content. |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 117 | * |
| 118 | * <p>This mode is especially useful with {@link View#SYSTEM_UI_FLAG_FULLSCREEN |
| 119 | * View.SYSTEM_UI_FLAG_FULLSCREEN}, which allows you to seamlessly hide the |
| 120 | * action bar in conjunction with other screen decorations. |
| 121 | * |
| 122 | * <p>As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, when an |
| 123 | * ActionBar is in this mode it will adjust the insets provided to |
| 124 | * {@link View#fitSystemWindows(android.graphics.Rect) View.fitSystemWindows(Rect)} |
| 125 | * to include the content covered by the action bar, so you can do layout within |
| 126 | * that space. |
Adam Powell | 6b336f8 | 2010-08-10 20:13:01 -0700 | [diff] [blame] | 127 | */ |
| 128 | public static final int FEATURE_ACTION_BAR_OVERLAY = 9; |
| 129 | /** |
Adam Powell | 5d27977 | 2010-07-27 16:34:07 -0700 | [diff] [blame] | 130 | * Flag for specifying the behavior of action modes when an Action Bar is not present. |
| 131 | * If overlay is enabled, the action mode UI will be allowed to cover existing window content. |
| 132 | */ |
Adam Powell | 6b336f8 | 2010-08-10 20:13:01 -0700 | [diff] [blame] | 133 | public static final int FEATURE_ACTION_MODE_OVERLAY = 10; |
Adam Powell | 18e905f | 2013-10-24 14:27:48 -0700 | [diff] [blame] | 134 | /** |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 135 | * Flag for requesting a decoration-free window that is dismissed by swiping from the left. |
Jorim Jaggi | e06b1fd | 2019-10-25 14:35:10 +0200 | [diff] [blame] | 136 | * |
| 137 | * @deprecated Swipe-to-dismiss isn't functional anymore. |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 138 | */ |
Jorim Jaggi | e06b1fd | 2019-10-25 14:35:10 +0200 | [diff] [blame] | 139 | @Deprecated |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 140 | public static final int FEATURE_SWIPE_TO_DISMISS = 11; |
Will Haldean Brown | 568628d | 2014-03-04 15:25:43 -0800 | [diff] [blame] | 141 | /** |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 142 | * Flag for requesting that window content changes should be animated using a |
| 143 | * TransitionManager. |
Adam Powell | 18e905f | 2013-10-24 14:27:48 -0700 | [diff] [blame] | 144 | * |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 145 | * <p>The TransitionManager is set using |
| 146 | * {@link #setTransitionManager(android.transition.TransitionManager)}. If none is set, |
| 147 | * a default TransitionManager will be used.</p> |
Adam Powell | 18e905f | 2013-10-24 14:27:48 -0700 | [diff] [blame] | 148 | * |
| 149 | * @see #setContentView |
| 150 | */ |
Will Haldean Brown | 568628d | 2014-03-04 15:25:43 -0800 | [diff] [blame] | 151 | public static final int FEATURE_CONTENT_TRANSITIONS = 12; |
Adam Powell | 4b6d93f | 2012-09-18 18:34:08 -0700 | [diff] [blame] | 152 | |
| 153 | /** |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 154 | * Enables Activities to run Activity Transitions either through sending or receiving |
| 155 | * ActivityOptions bundle created with |
| 156 | * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.app.Activity, |
| 157 | * android.util.Pair[])} or {@link android.app.ActivityOptions#makeSceneTransitionAnimation( |
| 158 | * android.app.Activity, View, String)}. |
| 159 | */ |
| 160 | public static final int FEATURE_ACTIVITY_TRANSITIONS = 13; |
| 161 | |
| 162 | /** |
Adam Powell | 4b6d93f | 2012-09-18 18:34:08 -0700 | [diff] [blame] | 163 | * Max value used as a feature ID |
| 164 | * @hide |
| 165 | */ |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 166 | @UnsupportedAppUsage |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 167 | public static final int FEATURE_MAX = FEATURE_ACTIVITY_TRANSITIONS; |
Adam Powell | 4b6d93f | 2012-09-18 18:34:08 -0700 | [diff] [blame] | 168 | |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 169 | /** |
| 170 | * Flag for setting the progress bar's visibility to VISIBLE. |
| 171 | * |
| 172 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 173 | * supported starting in API 21. |
| 174 | */ |
| 175 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 176 | public static final int PROGRESS_VISIBILITY_ON = -1; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 177 | |
| 178 | /** |
| 179 | * Flag for setting the progress bar's visibility to GONE. |
| 180 | * |
| 181 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 182 | * supported starting in API 21. |
| 183 | */ |
| 184 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 185 | public static final int PROGRESS_VISIBILITY_OFF = -2; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 186 | |
| 187 | /** |
| 188 | * Flag for setting the progress bar's indeterminate mode on. |
| 189 | * |
| 190 | * @deprecated {@link #FEATURE_INDETERMINATE_PROGRESS} and related methods |
| 191 | * are no longer supported starting in API 21. |
| 192 | */ |
| 193 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 194 | public static final int PROGRESS_INDETERMINATE_ON = -3; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 195 | |
| 196 | /** |
| 197 | * Flag for setting the progress bar's indeterminate mode off. |
| 198 | * |
| 199 | * @deprecated {@link #FEATURE_INDETERMINATE_PROGRESS} and related methods |
| 200 | * are no longer supported starting in API 21. |
| 201 | */ |
| 202 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 203 | public static final int PROGRESS_INDETERMINATE_OFF = -4; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 204 | |
| 205 | /** |
| 206 | * Starting value for the (primary) progress. |
| 207 | * |
| 208 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 209 | * supported starting in API 21. |
| 210 | */ |
| 211 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 212 | public static final int PROGRESS_START = 0; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 213 | |
| 214 | /** |
| 215 | * Ending value for the (primary) progress. |
| 216 | * |
| 217 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 218 | * supported starting in API 21. |
| 219 | */ |
| 220 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | public static final int PROGRESS_END = 10000; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 222 | |
| 223 | /** |
| 224 | * Lowest possible value for the secondary progress. |
| 225 | * |
| 226 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 227 | * supported starting in API 21. |
| 228 | */ |
| 229 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 230 | public static final int PROGRESS_SECONDARY_START = 20000; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 231 | |
| 232 | /** |
| 233 | * Highest possible value for the secondary progress. |
| 234 | * |
| 235 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 236 | * supported starting in API 21. |
| 237 | */ |
| 238 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 239 | public static final int PROGRESS_SECONDARY_END = 30000; |
George Mount | 238010f | 2014-06-30 17:31:17 -0700 | [diff] [blame] | 240 | |
| 241 | /** |
| 242 | * The transitionName for the status bar background View when a custom background is used. |
| 243 | * @see android.view.Window#setStatusBarColor(int) |
| 244 | */ |
| 245 | public static final String STATUS_BAR_BACKGROUND_TRANSITION_NAME = "android:status:background"; |
| 246 | |
| 247 | /** |
| 248 | * The transitionName for the navigation bar background View when a custom background is used. |
| 249 | * @see android.view.Window#setNavigationBarColor(int) |
| 250 | */ |
| 251 | public static final String NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME = |
| 252 | "android:navigation:background"; |
| 253 | |
Bryce Lee | aa1008c | 2015-01-13 09:26:46 -0800 | [diff] [blame] | 254 | /** |
| 255 | * The default features enabled. |
| 256 | * @deprecated use {@link #getDefaultFeatures(android.content.Context)} instead. |
| 257 | */ |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 258 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 259 | @SuppressWarnings({"PointlessBitwiseExpression"}) |
| 260 | protected static final int DEFAULT_FEATURES = (1 << FEATURE_OPTIONS_PANEL) | |
| 261 | (1 << FEATURE_CONTEXT_MENU); |
| 262 | |
| 263 | /** |
| 264 | * The ID that the main layout in the XML layout file should have. |
| 265 | */ |
| 266 | public static final int ID_ANDROID_CONTENT = com.android.internal.R.id.content; |
| 267 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 268 | /** |
| 269 | * Flag for letting the theme drive the color of the window caption controls. Use with |
| 270 | * {@link #setDecorCaptionShade(int)}. This is the default value. |
| 271 | */ |
| 272 | public static final int DECOR_CAPTION_SHADE_AUTO = 0; |
| 273 | /** |
| 274 | * Flag for setting light-color controls on the window caption. Use with |
| 275 | * {@link #setDecorCaptionShade(int)}. |
| 276 | */ |
| 277 | public static final int DECOR_CAPTION_SHADE_LIGHT = 1; |
| 278 | /** |
| 279 | * Flag for setting dark-color controls on the window caption. Use with |
| 280 | * {@link #setDecorCaptionShade(int)}. |
| 281 | */ |
| 282 | public static final int DECOR_CAPTION_SHADE_DARK = 2; |
| 283 | |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 284 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 285 | private final Context mContext; |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 286 | |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 287 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 288 | private TypedArray mWindowStyle; |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 289 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 290 | private Callback mCallback; |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 291 | private OnWindowDismissedCallback mOnWindowDismissedCallback; |
Michael Kwan | 67639a5 | 2016-12-16 12:38:10 -0800 | [diff] [blame] | 292 | private OnWindowSwipeDismissedCallback mOnWindowSwipeDismissedCallback; |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 293 | private WindowControllerCallback mWindowControllerCallback; |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 294 | private OnRestrictedCaptionAreaChangedListener mOnRestrictedCaptionAreaChangedListener; |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 295 | private Rect mRestrictedCaptionAreaRect; |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 296 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 297 | private WindowManager mWindowManager; |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 298 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 299 | private IBinder mAppToken; |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 300 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 301 | private String mAppName; |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 302 | @UnsupportedAppUsage |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 303 | private boolean mHardwareAccelerated; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 304 | private Window mContainer; |
| 305 | private Window mActiveChild; |
| 306 | private boolean mIsActive = false; |
| 307 | private boolean mHasChildren = false; |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 308 | private boolean mCloseOnTouchOutside = false; |
| 309 | private boolean mSetCloseOnTouchOutside = false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 310 | private int mForcedWindowFlags = 0; |
| 311 | |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 312 | @UnsupportedAppUsage |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 313 | private int mFeatures; |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 314 | @UnsupportedAppUsage |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 315 | private int mLocalFeatures; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 316 | |
| 317 | private boolean mHaveWindowFormat = false; |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 318 | private boolean mHaveDimAmount = false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 319 | private int mDefaultWindowFormat = PixelFormat.OPAQUE; |
| 320 | |
| 321 | private boolean mHasSoftInputMode = false; |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 322 | |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 323 | @UnsupportedAppUsage |
Dianne Hackborn | 291905e | 2010-08-17 15:17:15 -0700 | [diff] [blame] | 324 | private boolean mDestroyed; |
| 325 | |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 326 | private boolean mOverlayWithDecorCaptionEnabled = false; |
Michael Kwan | f7964be | 2016-11-30 16:44:33 -0800 | [diff] [blame] | 327 | private boolean mCloseOnSwipeEnabled = false; |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 328 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 329 | // The current window attributes. |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 330 | @UnsupportedAppUsage |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 331 | private final WindowManager.LayoutParams mWindowAttributes = |
| 332 | new WindowManager.LayoutParams(); |
| 333 | |
| 334 | /** |
| 335 | * API from a Window back to its caller. This allows the client to |
| 336 | * intercept key dispatching, panels and menus, etc. |
| 337 | */ |
| 338 | public interface Callback { |
| 339 | /** |
| 340 | * Called to process key events. At the very least your |
| 341 | * implementation must call |
| 342 | * {@link android.view.Window#superDispatchKeyEvent} to do the |
| 343 | * standard key processing. |
| 344 | * |
| 345 | * @param event The key event. |
| 346 | * |
| 347 | * @return boolean Return true if this event was consumed. |
| 348 | */ |
| 349 | public boolean dispatchKeyEvent(KeyEvent event); |
| 350 | |
| 351 | /** |
Jeff Brown | 64da12a | 2011-01-04 19:57:47 -0800 | [diff] [blame] | 352 | * Called to process a key shortcut event. |
| 353 | * At the very least your implementation must call |
| 354 | * {@link android.view.Window#superDispatchKeyShortcutEvent} to do the |
| 355 | * standard key shortcut processing. |
| 356 | * |
| 357 | * @param event The key shortcut event. |
| 358 | * @return True if this event was consumed. |
| 359 | */ |
| 360 | public boolean dispatchKeyShortcutEvent(KeyEvent event); |
| 361 | |
| 362 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 363 | * Called to process touch screen events. At the very least your |
| 364 | * implementation must call |
| 365 | * {@link android.view.Window#superDispatchTouchEvent} to do the |
| 366 | * standard touch screen processing. |
| 367 | * |
| 368 | * @param event The touch screen event. |
| 369 | * |
| 370 | * @return boolean Return true if this event was consumed. |
| 371 | */ |
| 372 | public boolean dispatchTouchEvent(MotionEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 373 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 374 | /** |
| 375 | * Called to process trackball events. At the very least your |
| 376 | * implementation must call |
| 377 | * {@link android.view.Window#superDispatchTrackballEvent} to do the |
| 378 | * standard trackball processing. |
| 379 | * |
| 380 | * @param event The trackball event. |
| 381 | * |
| 382 | * @return boolean Return true if this event was consumed. |
| 383 | */ |
| 384 | public boolean dispatchTrackballEvent(MotionEvent event); |
svetoslavganov | 75986cf | 2009-05-14 22:28:01 -0700 | [diff] [blame] | 385 | |
| 386 | /** |
Jeff Brown | cb1404e | 2011-01-15 18:14:15 -0800 | [diff] [blame] | 387 | * Called to process generic motion events. At the very least your |
| 388 | * implementation must call |
| 389 | * {@link android.view.Window#superDispatchGenericMotionEvent} to do the |
| 390 | * standard processing. |
| 391 | * |
| 392 | * @param event The generic motion event. |
| 393 | * |
| 394 | * @return boolean Return true if this event was consumed. |
| 395 | */ |
| 396 | public boolean dispatchGenericMotionEvent(MotionEvent event); |
| 397 | |
| 398 | /** |
svetoslavganov | 75986cf | 2009-05-14 22:28:01 -0700 | [diff] [blame] | 399 | * Called to process population of {@link AccessibilityEvent}s. |
| 400 | * |
| 401 | * @param event The event. |
| 402 | * |
| 403 | * @return boolean Return true if event population was completed. |
| 404 | */ |
| 405 | public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event); |
| 406 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 407 | /** |
| 408 | * Instantiate the view to display in the panel for 'featureId'. |
| 409 | * You can return null, in which case the default content (typically |
| 410 | * a menu) will be created for you. |
| 411 | * |
| 412 | * @param featureId Which panel is being created. |
| 413 | * |
| 414 | * @return view The top-level view to place in the panel. |
| 415 | * |
| 416 | * @see #onPreparePanel |
| 417 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 418 | @Nullable |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 419 | public View onCreatePanelView(int featureId); |
| 420 | |
| 421 | /** |
| 422 | * Initialize the contents of the menu for panel 'featureId'. This is |
| 423 | * called if onCreatePanelView() returns null, giving you a standard |
| 424 | * menu in which you can place your items. It is only called once for |
| 425 | * the panel, the first time it is shown. |
| 426 | * |
| 427 | * <p>You can safely hold on to <var>menu</var> (and any items created |
| 428 | * from it), making modifications to it as desired, until the next |
| 429 | * time onCreatePanelMenu() is called for this feature. |
| 430 | * |
| 431 | * @param featureId The panel being created. |
| 432 | * @param menu The menu inside the panel. |
| 433 | * |
| 434 | * @return boolean You must return true for the panel to be displayed; |
| 435 | * if you return false it will not be shown. |
| 436 | */ |
Ian Lake | 0b71b8e | 2018-09-13 13:56:26 -0700 | [diff] [blame] | 437 | boolean onCreatePanelMenu(int featureId, @NonNull Menu menu); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 438 | |
| 439 | /** |
| 440 | * Prepare a panel to be displayed. This is called right before the |
| 441 | * panel window is shown, every time it is shown. |
| 442 | * |
| 443 | * @param featureId The panel that is being displayed. |
| 444 | * @param view The View that was returned by onCreatePanelView(). |
| 445 | * @param menu If onCreatePanelView() returned null, this is the Menu |
| 446 | * being displayed in the panel. |
| 447 | * |
| 448 | * @return boolean You must return true for the panel to be displayed; |
| 449 | * if you return false it will not be shown. |
| 450 | * |
| 451 | * @see #onCreatePanelView |
| 452 | */ |
Ian Lake | 0b71b8e | 2018-09-13 13:56:26 -0700 | [diff] [blame] | 453 | boolean onPreparePanel(int featureId, @Nullable View view, @NonNull Menu menu); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 454 | |
| 455 | /** |
| 456 | * Called when a panel's menu is opened by the user. This may also be |
| 457 | * called when the menu is changing from one type to another (for |
| 458 | * example, from the icon menu to the expanded menu). |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 459 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 460 | * @param featureId The panel that the menu is in. |
| 461 | * @param menu The menu that is opened. |
| 462 | * @return Return true to allow the menu to open, or false to prevent |
| 463 | * the menu from opening. |
| 464 | */ |
Ian Lake | 0b71b8e | 2018-09-13 13:56:26 -0700 | [diff] [blame] | 465 | boolean onMenuOpened(int featureId, @NonNull Menu menu); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 466 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 467 | /** |
| 468 | * Called when a panel's menu item has been selected by the user. |
| 469 | * |
| 470 | * @param featureId The panel that the menu is in. |
| 471 | * @param item The menu item that was selected. |
| 472 | * |
| 473 | * @return boolean Return true to finish processing of selection, or |
| 474 | * false to perform the normal menu handling (calling its |
| 475 | * Runnable or sending a Message to its target Handler). |
| 476 | */ |
Ian Lake | 0b71b8e | 2018-09-13 13:56:26 -0700 | [diff] [blame] | 477 | boolean onMenuItemSelected(int featureId, @NonNull MenuItem item); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 478 | |
| 479 | /** |
| 480 | * This is called whenever the current window attributes change. |
| 481 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 482 | */ |
| 483 | public void onWindowAttributesChanged(WindowManager.LayoutParams attrs); |
| 484 | |
| 485 | /** |
| 486 | * This hook is called whenever the content view of the screen changes |
| 487 | * (due to a call to |
| 488 | * {@link Window#setContentView(View, android.view.ViewGroup.LayoutParams) |
| 489 | * Window.setContentView} or |
| 490 | * {@link Window#addContentView(View, android.view.ViewGroup.LayoutParams) |
| 491 | * Window.addContentView}). |
| 492 | */ |
| 493 | public void onContentChanged(); |
| 494 | |
| 495 | /** |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 496 | * This hook is called whenever the window focus changes. See |
| 497 | * {@link View#onWindowFocusChanged(boolean) |
Svetoslav | 3a0d878 | 2014-12-04 12:50:11 -0800 | [diff] [blame] | 498 | * View.onWindowFocusChangedNotLocked(boolean)} for more information. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 499 | * |
| 500 | * @param hasFocus Whether the window now has focus. |
| 501 | */ |
| 502 | public void onWindowFocusChanged(boolean hasFocus); |
| 503 | |
| 504 | /** |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 505 | * Called when the window has been attached to the window manager. |
| 506 | * See {@link View#onAttachedToWindow() View.onAttachedToWindow()} |
| 507 | * for more information. |
| 508 | */ |
| 509 | public void onAttachedToWindow(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 510 | |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 511 | /** |
Chet Haase | e7bf219 | 2017-08-18 15:24:56 -0700 | [diff] [blame] | 512 | * Called when the window has been detached from the window manager. |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 513 | * See {@link View#onDetachedFromWindow() View.onDetachedFromWindow()} |
| 514 | * for more information. |
| 515 | */ |
| 516 | public void onDetachedFromWindow(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 517 | |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 518 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 519 | * Called when a panel is being closed. If another logical subsequent |
| 520 | * panel is being opened (and this panel is being closed to make room for the subsequent |
| 521 | * panel), this method will NOT be called. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 522 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 523 | * @param featureId The panel that is being displayed. |
| 524 | * @param menu If onCreatePanelView() returned null, this is the Menu |
| 525 | * being displayed in the panel. |
| 526 | */ |
Ian Lake | 0b71b8e | 2018-09-13 13:56:26 -0700 | [diff] [blame] | 527 | void onPanelClosed(int featureId, @NonNull Menu menu); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 528 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 529 | /** |
| 530 | * Called when the user signals the desire to start a search. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 531 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 532 | * @return true if search launched, false if activity refuses (blocks) |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 533 | * |
| 534 | * @see android.app.Activity#onSearchRequested() |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 535 | */ |
| 536 | public boolean onSearchRequested(); |
Adam Powell | 6e34636 | 2010-07-23 10:18:23 -0700 | [diff] [blame] | 537 | |
| 538 | /** |
Tim Kilbourn | 6a975b3 | 2015-04-09 17:14:34 -0700 | [diff] [blame] | 539 | * Called when the user signals the desire to start a search. |
| 540 | * |
| 541 | * @param searchEvent A {@link SearchEvent} describing the signal to |
| 542 | * start a search. |
| 543 | * @return true if search launched, false if activity refuses (blocks) |
| 544 | */ |
| 545 | public boolean onSearchRequested(SearchEvent searchEvent); |
| 546 | |
| 547 | /** |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 548 | * Called when an action mode is being started for this window. Gives the |
| 549 | * callback an opportunity to handle the action mode in its own unique and |
| 550 | * beautiful way. If this method returns null the system can choose a way |
Clara Bayarri | 4423d91 | 2015-03-02 19:42:48 +0000 | [diff] [blame] | 551 | * to present the mode or choose not to start the mode at all. This is equivalent |
| 552 | * to {@link #onWindowStartingActionMode(android.view.ActionMode.Callback, int)} |
| 553 | * with type {@link ActionMode#TYPE_PRIMARY}. |
Adam Powell | 6e34636 | 2010-07-23 10:18:23 -0700 | [diff] [blame] | 554 | * |
| 555 | * @param callback Callback to control the lifecycle of this action mode |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 556 | * @return The ActionMode that was started, or null if the system should present it |
Adam Powell | 6e34636 | 2010-07-23 10:18:23 -0700 | [diff] [blame] | 557 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 558 | @Nullable |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 559 | public ActionMode onWindowStartingActionMode(ActionMode.Callback callback); |
| 560 | |
| 561 | /** |
Clara Bayarri | 4423d91 | 2015-03-02 19:42:48 +0000 | [diff] [blame] | 562 | * Called when an action mode is being started for this window. Gives the |
| 563 | * callback an opportunity to handle the action mode in its own unique and |
| 564 | * beautiful way. If this method returns null the system can choose a way |
| 565 | * to present the mode or choose not to start the mode at all. |
| 566 | * |
| 567 | * @param callback Callback to control the lifecycle of this action mode |
| 568 | * @param type One of {@link ActionMode#TYPE_PRIMARY} or {@link ActionMode#TYPE_FLOATING}. |
| 569 | * @return The ActionMode that was started, or null if the system should present it |
| 570 | */ |
| 571 | @Nullable |
| 572 | public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int type); |
| 573 | |
| 574 | /** |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 575 | * Called when an action mode has been started. The appropriate mode callback |
| 576 | * method will have already been invoked. |
| 577 | * |
| 578 | * @param mode The new mode that has just been started. |
| 579 | */ |
| 580 | public void onActionModeStarted(ActionMode mode); |
| 581 | |
| 582 | /** |
| 583 | * Called when an action mode has been finished. The appropriate mode callback |
| 584 | * method will have already been invoked. |
| 585 | * |
| 586 | * @param mode The mode that was just finished. |
| 587 | */ |
| 588 | public void onActionModeFinished(ActionMode mode); |
Clara Bayarri | 75e0979 | 2015-07-29 16:20:40 +0100 | [diff] [blame] | 589 | |
| 590 | /** |
| 591 | * Called when Keyboard Shortcuts are requested for the current window. |
| 592 | * |
| 593 | * @param data The data list to populate with shortcuts. |
| 594 | * @param menu The current menu, which may be null. |
Clara Bayarri | fcd7e80 | 2016-03-10 12:58:18 +0000 | [diff] [blame] | 595 | * @param deviceId The id for the connected device the shortcuts should be provided for. |
Clara Bayarri | 75e0979 | 2015-07-29 16:20:40 +0100 | [diff] [blame] | 596 | */ |
Sunny Goyal | 2a6d9aa | 2016-03-16 17:12:46 -0700 | [diff] [blame] | 597 | default public void onProvideKeyboardShortcuts( |
Clara Bayarri | fcd7e80 | 2016-03-10 12:58:18 +0000 | [diff] [blame] | 598 | List<KeyboardShortcutGroup> data, @Nullable Menu menu, int deviceId) { }; |
Vladislav Kaznacheev | 3787de1 | 2016-12-21 10:36:35 -0800 | [diff] [blame] | 599 | |
| 600 | /** |
| 601 | * Called when pointer capture is enabled or disabled for the current window. |
| 602 | * |
| 603 | * @param hasCapture True if the window has pointer capture. |
| 604 | */ |
| 605 | default public void onPointerCaptureChanged(boolean hasCapture) { }; |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 606 | } |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 607 | |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 608 | /** @hide */ |
| 609 | public interface OnWindowDismissedCallback { |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 610 | /** |
| 611 | * Called when a window is dismissed. This informs the callback that the |
| 612 | * window is gone, and it should finish itself. |
Wale Ogunwale | ba7881c | 2015-08-01 19:28:29 -0700 | [diff] [blame] | 613 | * @param finishTask True if the task should also be finished. |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 614 | * @param suppressWindowTransition True if the resulting exit and enter window transition |
| 615 | * animations should be suppressed. |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 616 | */ |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 617 | void onWindowDismissed(boolean finishTask, boolean suppressWindowTransition); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 618 | } |
| 619 | |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 620 | /** @hide */ |
Michael Kwan | 67639a5 | 2016-12-16 12:38:10 -0800 | [diff] [blame] | 621 | public interface OnWindowSwipeDismissedCallback { |
| 622 | /** |
| 623 | * Called when a window is swipe dismissed. This informs the callback that the |
| 624 | * window is gone, and it should finish itself. |
| 625 | * @param finishTask True if the task should also be finished. |
| 626 | * @param suppressWindowTransition True if the resulting exit and enter window transition |
| 627 | * animations should be suppressed. |
| 628 | */ |
| 629 | void onWindowSwipeDismissed(); |
| 630 | } |
| 631 | |
| 632 | /** @hide */ |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 633 | public interface WindowControllerCallback { |
| 634 | /** |
Yunfan Chen | d967af8 | 2019-01-17 18:30:18 +0900 | [diff] [blame] | 635 | * Moves the activity between {@link WindowConfiguration#WINDOWING_MODE_FREEFORM} windowing |
| 636 | * mode and {@link WindowConfiguration#WINDOWING_MODE_FULLSCREEN}. |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 637 | */ |
Yunfan Chen | d967af8 | 2019-01-17 18:30:18 +0900 | [diff] [blame] | 638 | void toggleFreeformWindowingMode() throws RemoteException; |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 639 | |
Jaewan Kim | d98dcab | 2016-05-03 02:52:18 +0900 | [diff] [blame] | 640 | /** |
| 641 | * Puts the activity in picture-in-picture mode if the activity supports. |
| 642 | * @see android.R.attr#supportsPictureInPicture |
| 643 | */ |
| 644 | void enterPictureInPictureModeIfPossible(); |
| 645 | |
Winson Chung | 4d8681f | 2017-05-23 16:22:08 -0700 | [diff] [blame] | 646 | /** Returns whether the window belongs to the task root. */ |
| 647 | boolean isTaskRoot(); |
Yunfan Chen | 91b3a1b | 2019-11-05 16:19:13 -0800 | [diff] [blame] | 648 | |
| 649 | /** |
| 650 | * Update the status bar color to a forced one. |
| 651 | */ |
| 652 | void updateStatusBarColor(int color); |
| 653 | |
| 654 | /** |
| 655 | * Update the navigation bar color to a forced one. |
| 656 | */ |
| 657 | void updateNavigationBarColor(int color); |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 658 | } |
| 659 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 660 | /** |
| 661 | * Callback for clients that want to be aware of where caption draws content. |
| 662 | */ |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 663 | public interface OnRestrictedCaptionAreaChangedListener { |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 664 | /** |
| 665 | * Called when the area where caption draws content changes. |
| 666 | * |
| 667 | * @param rect The area where caption content is positioned, relative to the top view. |
| 668 | */ |
| 669 | void onRestrictedCaptionAreaChanged(Rect rect); |
| 670 | } |
| 671 | |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 672 | /** |
| 673 | * Callback for clients that want frame timing information for each |
| 674 | * frame rendered by the Window. |
| 675 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 676 | public interface OnFrameMetricsAvailableListener { |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 677 | /** |
| 678 | * Called when information is available for the previously rendered frame. |
| 679 | * |
| 680 | * Reports can be dropped if this callback takes too |
| 681 | * long to execute, as the report producer cannot wait for the consumer to |
| 682 | * complete. |
| 683 | * |
| 684 | * It is highly recommended that clients copy the passed in FrameMetrics |
| 685 | * via {@link FrameMetrics#FrameMetrics(FrameMetrics)} within this method and defer |
| 686 | * additional computation or storage to another thread to avoid unnecessarily |
| 687 | * dropping reports. |
| 688 | * |
| 689 | * @param window The {@link Window} on which the frame was displayed. |
| 690 | * @param frameMetrics the available metrics. This object is reused on every call |
| 691 | * and thus <strong>this reference is not valid outside the scope of this method</strong>. |
| 692 | * @param dropCountSinceLastInvocation the number of reports dropped since the last time |
| 693 | * this callback was invoked. |
| 694 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 695 | void onFrameMetricsAvailable(Window window, FrameMetrics frameMetrics, |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 696 | int dropCountSinceLastInvocation); |
| 697 | } |
| 698 | |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 699 | /** |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 700 | * Listener for applying window insets on the content of a window. Used only by the framework to |
| 701 | * fit content according to legacy SystemUI flags. |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 702 | * |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 703 | * @hide |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 704 | */ |
| 705 | public interface OnContentApplyWindowInsetsListener { |
| 706 | |
| 707 | /** |
| 708 | * Called when the window needs to apply insets on the container of its content view which |
| 709 | * are set by calling {@link #setContentView}. The method should determine what insets to |
| 710 | * apply on the container of the root level content view and what should be dispatched to |
| 711 | * the content view's |
| 712 | * {@link View#setOnApplyWindowInsetsListener(OnApplyWindowInsetsListener)} through the view |
| 713 | * hierarchy. |
| 714 | * |
Adrian Roos | cd9cf09 | 2020-02-27 17:46:30 +0100 | [diff] [blame] | 715 | * @param view The view for which to apply insets. Must not be directly modified. |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 716 | * @param insets The root level insets that are about to be dispatched |
| 717 | * @return A pair, with the first element containing the insets to apply as margin to the |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 718 | * root-level content views, and the second element determining what should be |
| 719 | * dispatched to the content view. |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 720 | */ |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 721 | @NonNull |
Adrian Roos | cd9cf09 | 2020-02-27 17:46:30 +0100 | [diff] [blame] | 722 | Pair<Insets, WindowInsets> onContentApplyWindowInsets(@NonNull View view, |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 723 | @NonNull WindowInsets insets); |
| 724 | } |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 725 | |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 726 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 727 | public Window(Context context) { |
| 728 | mContext = context; |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 729 | mFeatures = mLocalFeatures = getDefaultFeatures(context); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 730 | } |
| 731 | |
| 732 | /** |
| 733 | * Return the Context this window policy is running in, for retrieving |
| 734 | * resources and other information. |
| 735 | * |
| 736 | * @return Context The Context that was supplied to the constructor. |
| 737 | */ |
| 738 | public final Context getContext() { |
| 739 | return mContext; |
| 740 | } |
| 741 | |
| 742 | /** |
| 743 | * Return the {@link android.R.styleable#Window} attributes from this |
| 744 | * window's theme. |
| 745 | */ |
| 746 | public final TypedArray getWindowStyle() { |
| 747 | synchronized (this) { |
| 748 | if (mWindowStyle == null) { |
| 749 | mWindowStyle = mContext.obtainStyledAttributes( |
| 750 | com.android.internal.R.styleable.Window); |
| 751 | } |
| 752 | return mWindowStyle; |
| 753 | } |
| 754 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 755 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 756 | /** |
| 757 | * Set the container for this window. If not set, the DecorWindow |
| 758 | * operates as a top-level window; otherwise, it negotiates with the |
| 759 | * container to display itself appropriately. |
| 760 | * |
| 761 | * @param container The desired containing Window. |
| 762 | */ |
| 763 | public void setContainer(Window container) { |
| 764 | mContainer = container; |
| 765 | if (container != null) { |
| 766 | // Embedded screens never have a title. |
| 767 | mFeatures |= 1<<FEATURE_NO_TITLE; |
| 768 | mLocalFeatures |= 1<<FEATURE_NO_TITLE; |
| 769 | container.mHasChildren = true; |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | /** |
| 774 | * Return the container for this Window. |
| 775 | * |
| 776 | * @return Window The containing window, or null if this is a |
| 777 | * top-level window. |
| 778 | */ |
| 779 | public final Window getContainer() { |
| 780 | return mContainer; |
| 781 | } |
| 782 | |
| 783 | public final boolean hasChildren() { |
| 784 | return mHasChildren; |
| 785 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 786 | |
Dianne Hackborn | 291905e | 2010-08-17 15:17:15 -0700 | [diff] [blame] | 787 | /** @hide */ |
| 788 | public final void destroy() { |
| 789 | mDestroyed = true; |
| 790 | } |
| 791 | |
| 792 | /** @hide */ |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 793 | @UnsupportedAppUsage |
Dianne Hackborn | 291905e | 2010-08-17 15:17:15 -0700 | [diff] [blame] | 794 | public final boolean isDestroyed() { |
| 795 | return mDestroyed; |
| 796 | } |
| 797 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 798 | /** |
| 799 | * Set the window manager for use by this Window to, for example, |
| 800 | * display panels. This is <em>not</em> used for displaying the |
| 801 | * Window itself -- that must be done by the client. |
| 802 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 803 | * @param wm The window manager for adding new windows. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 804 | */ |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 805 | public void setWindowManager(WindowManager wm, IBinder appToken, String appName) { |
| 806 | setWindowManager(wm, appToken, appName, false); |
| 807 | } |
| 808 | |
| 809 | /** |
| 810 | * Set the window manager for use by this Window to, for example, |
| 811 | * display panels. This is <em>not</em> used for displaying the |
| 812 | * Window itself -- that must be done by the client. |
| 813 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 814 | * @param wm The window manager for adding new windows. |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 815 | */ |
| 816 | public void setWindowManager(WindowManager wm, IBinder appToken, String appName, |
| 817 | boolean hardwareAccelerated) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 818 | mAppToken = appToken; |
| 819 | mAppName = appName; |
John Reck | e22d4d7 | 2018-03-02 15:49:48 -0800 | [diff] [blame] | 820 | mHardwareAccelerated = hardwareAccelerated; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 821 | if (wm == null) { |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 822 | wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 823 | } |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 824 | mWindowManager = ((WindowManagerImpl)wm).createLocalWindowManager(this); |
Dianne Hackborn | 5fd2169 | 2011-06-07 14:09:47 -0700 | [diff] [blame] | 825 | } |
| 826 | |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 827 | void adjustLayoutParamsForSubWindow(WindowManager.LayoutParams wp) { |
| 828 | CharSequence curTitle = wp.getTitle(); |
| 829 | if (wp.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW && |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 830 | wp.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 831 | if (wp.token == null) { |
| 832 | View decor = peekDecorView(); |
| 833 | if (decor != null) { |
| 834 | wp.token = decor.getWindowToken(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 835 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 836 | } |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 837 | if (curTitle == null || curTitle.length() == 0) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 838 | final StringBuilder title = new StringBuilder(32); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 839 | if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 840 | title.append("Media"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 841 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 842 | title.append("MediaOvr"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 843 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 844 | title.append("Panel"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 845 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 846 | title.append("SubPanel"); |
Wale Ogunwale | 0a4dc22 | 2015-04-14 12:58:42 -0700 | [diff] [blame] | 847 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 848 | title.append("AboveSubPanel"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 849 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 850 | title.append("AtchDlg"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 851 | } else { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 852 | title.append(wp.type); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 853 | } |
| 854 | if (mAppName != null) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 855 | title.append(":").append(mAppName); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 856 | } |
| 857 | wp.setTitle(title); |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 858 | } |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 859 | } else if (wp.type >= WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW && |
| 860 | wp.type <= WindowManager.LayoutParams.LAST_SYSTEM_WINDOW) { |
| 861 | // We don't set the app token to this system window because the life cycles should be |
| 862 | // independent. If an app creates a system window and then the app goes to the stopped |
| 863 | // state, the system window should not be affected (can still show and receive input |
| 864 | // events). |
| 865 | if (curTitle == null || curTitle.length() == 0) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 866 | final StringBuilder title = new StringBuilder(32); |
| 867 | title.append("Sys").append(wp.type); |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 868 | if (mAppName != null) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 869 | title.append(":").append(mAppName); |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 870 | } |
| 871 | wp.setTitle(title); |
| 872 | } |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 873 | } else { |
| 874 | if (wp.token == null) { |
| 875 | wp.token = mContainer == null ? mAppToken : mContainer.mAppToken; |
| 876 | } |
| 877 | if ((curTitle == null || curTitle.length() == 0) |
| 878 | && mAppName != null) { |
| 879 | wp.setTitle(mAppName); |
| 880 | } |
| 881 | } |
| 882 | if (wp.packageName == null) { |
| 883 | wp.packageName = mContext.getPackageName(); |
| 884 | } |
Robert Carr | 13678ee | 2016-04-20 14:04:15 -0700 | [diff] [blame] | 885 | if (mHardwareAccelerated || |
| 886 | (mWindowAttributes.flags & FLAG_HARDWARE_ACCELERATED) != 0) { |
| 887 | wp.flags |= FLAG_HARDWARE_ACCELERATED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 888 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | /** |
| 892 | * Return the window manager allowing this Window to display its own |
| 893 | * windows. |
| 894 | * |
| 895 | * @return WindowManager The ViewManager. |
| 896 | */ |
| 897 | public WindowManager getWindowManager() { |
| 898 | return mWindowManager; |
| 899 | } |
| 900 | |
| 901 | /** |
| 902 | * Set the Callback interface for this window, used to intercept key |
| 903 | * events and other dynamic operations in the window. |
| 904 | * |
| 905 | * @param callback The desired Callback interface. |
| 906 | */ |
| 907 | public void setCallback(Callback callback) { |
| 908 | mCallback = callback; |
| 909 | } |
| 910 | |
| 911 | /** |
| 912 | * Return the current Callback interface for this window. |
| 913 | */ |
| 914 | public final Callback getCallback() { |
| 915 | return mCallback; |
| 916 | } |
| 917 | |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 918 | /** |
Andrew Zeng | 8b7fb46 | 2018-08-03 13:32:04 -0700 | [diff] [blame] | 919 | * Set an observer to collect frame stats for each frame rendered in this window. |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 920 | * |
| 921 | * Must be in hardware rendering mode. |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 922 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 923 | public final void addOnFrameMetricsAvailableListener( |
| 924 | @NonNull OnFrameMetricsAvailableListener listener, |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 925 | Handler handler) { |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 926 | final View decorView = getDecorView(); |
| 927 | if (decorView == null) { |
| 928 | throw new IllegalStateException("can't observe a Window without an attached view"); |
| 929 | } |
| 930 | |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 931 | if (listener == null) { |
| 932 | throw new NullPointerException("listener cannot be null"); |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 933 | } |
| 934 | |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 935 | decorView.addFrameMetricsListener(this, listener, handler); |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 936 | } |
| 937 | |
| 938 | /** |
| 939 | * Remove observer and stop listening to frame stats for this window. |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 940 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 941 | public final void removeOnFrameMetricsAvailableListener(OnFrameMetricsAvailableListener listener) { |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 942 | final View decorView = getDecorView(); |
| 943 | if (decorView != null) { |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 944 | getDecorView().removeFrameMetricsListener(listener); |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 945 | } |
| 946 | } |
| 947 | |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 948 | /** @hide */ |
| 949 | public final void setOnWindowDismissedCallback(OnWindowDismissedCallback dcb) { |
| 950 | mOnWindowDismissedCallback = dcb; |
| 951 | } |
| 952 | |
| 953 | /** @hide */ |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 954 | public final void dispatchOnWindowDismissed( |
| 955 | boolean finishTask, boolean suppressWindowTransition) { |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 956 | if (mOnWindowDismissedCallback != null) { |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 957 | mOnWindowDismissedCallback.onWindowDismissed(finishTask, suppressWindowTransition); |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 958 | } |
| 959 | } |
| 960 | |
Stefan Kuhne | 9bad741 | 2015-08-07 10:35:52 -0700 | [diff] [blame] | 961 | /** @hide */ |
Michael Kwan | 67639a5 | 2016-12-16 12:38:10 -0800 | [diff] [blame] | 962 | public final void setOnWindowSwipeDismissedCallback(OnWindowSwipeDismissedCallback sdcb) { |
| 963 | mOnWindowSwipeDismissedCallback = sdcb; |
| 964 | } |
| 965 | |
| 966 | /** @hide */ |
| 967 | public final void dispatchOnWindowSwipeDismissed() { |
| 968 | if (mOnWindowSwipeDismissedCallback != null) { |
| 969 | mOnWindowSwipeDismissedCallback.onWindowSwipeDismissed(); |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | /** @hide */ |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 974 | public final void setWindowControllerCallback(WindowControllerCallback wccb) { |
| 975 | mWindowControllerCallback = wccb; |
Stefan Kuhne | 9bad741 | 2015-08-07 10:35:52 -0700 | [diff] [blame] | 976 | } |
| 977 | |
| 978 | /** @hide */ |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 979 | public final WindowControllerCallback getWindowControllerCallback() { |
| 980 | return mWindowControllerCallback; |
Stefan Kuhne | 9bad741 | 2015-08-07 10:35:52 -0700 | [diff] [blame] | 981 | } |
| 982 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 983 | /** |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 984 | * Set a callback for changes of area where caption will draw its content. |
| 985 | * |
| 986 | * @param listener Callback that will be called when the area changes. |
| 987 | */ |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 988 | public final void setRestrictedCaptionAreaListener(OnRestrictedCaptionAreaChangedListener listener) { |
| 989 | mOnRestrictedCaptionAreaChangedListener = listener; |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 990 | mRestrictedCaptionAreaRect = listener != null ? new Rect() : null; |
| 991 | } |
| 992 | |
| 993 | /** |
Dianne Hackborn | dc8a7f6 | 2010-05-10 11:29:34 -0700 | [diff] [blame] | 994 | * Take ownership of this window's surface. The window's view hierarchy |
| 995 | * will no longer draw into the surface, though it will otherwise continue |
| 996 | * to operate (such as for receiving input events). The given SurfaceHolder |
| 997 | * callback will be used to tell you about state changes to the surface. |
| 998 | */ |
Dianne Hackborn | d76b67c | 2010-07-13 17:48:30 -0700 | [diff] [blame] | 999 | public abstract void takeSurface(SurfaceHolder.Callback2 callback); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1000 | |
Dianne Hackborn | dc8a7f6 | 2010-05-10 11:29:34 -0700 | [diff] [blame] | 1001 | /** |
Dianne Hackborn | 1e4b9f3 | 2010-06-23 14:10:57 -0700 | [diff] [blame] | 1002 | * Take ownership of this window's InputQueue. The window will no |
| 1003 | * longer read and dispatch input events from the queue; it is your |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 1004 | * responsibility to do so. |
| 1005 | */ |
Dianne Hackborn | 1e4b9f3 | 2010-06-23 14:10:57 -0700 | [diff] [blame] | 1006 | public abstract void takeInputQueue(InputQueue.Callback callback); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1007 | |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 1008 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1009 | * Return whether this window is being displayed with a floating style |
| 1010 | * (based on the {@link android.R.attr#windowIsFloating} attribute in |
| 1011 | * the style/theme). |
| 1012 | * |
| 1013 | * @return Returns true if the window is configured to be displayed floating |
| 1014 | * on top of whatever is behind it. |
| 1015 | */ |
| 1016 | public abstract boolean isFloating(); |
| 1017 | |
| 1018 | /** |
| 1019 | * Set the width and height layout parameters of the window. The default |
Dianne Hackborn | c918935 | 2010-12-15 14:57:25 -0800 | [diff] [blame] | 1020 | * for both of these is MATCH_PARENT; you can change them to WRAP_CONTENT |
| 1021 | * or an absolute value to make a window that is not full-screen. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1022 | * |
| 1023 | * @param width The desired layout width of the window. |
| 1024 | * @param height The desired layout height of the window. |
Dianne Hackborn | c918935 | 2010-12-15 14:57:25 -0800 | [diff] [blame] | 1025 | * |
| 1026 | * @see ViewGroup.LayoutParams#height |
| 1027 | * @see ViewGroup.LayoutParams#width |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1028 | */ |
Dianne Hackborn | c918935 | 2010-12-15 14:57:25 -0800 | [diff] [blame] | 1029 | public void setLayout(int width, int height) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1030 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1031 | attrs.width = width; |
| 1032 | attrs.height = height; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1033 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1034 | } |
| 1035 | |
| 1036 | /** |
| 1037 | * Set the gravity of the window, as per the Gravity constants. This |
| 1038 | * controls how the window manager is positioned in the overall window; it |
| 1039 | * is only useful when using WRAP_CONTENT for the layout width or height. |
| 1040 | * |
| 1041 | * @param gravity The desired gravity constant. |
| 1042 | * |
| 1043 | * @see Gravity |
| 1044 | * @see #setLayout |
| 1045 | */ |
| 1046 | public void setGravity(int gravity) |
| 1047 | { |
| 1048 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1049 | attrs.gravity = gravity; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1050 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1051 | } |
| 1052 | |
| 1053 | /** |
| 1054 | * Set the type of the window, as per the WindowManager.LayoutParams |
| 1055 | * types. |
| 1056 | * |
| 1057 | * @param type The new window type (see WindowManager.LayoutParams). |
| 1058 | */ |
| 1059 | public void setType(int type) { |
| 1060 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1061 | attrs.type = type; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1062 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1063 | } |
| 1064 | |
| 1065 | /** |
| 1066 | * Set the format of window, as per the PixelFormat types. This overrides |
| 1067 | * the default format that is selected by the Window based on its |
| 1068 | * window decorations. |
| 1069 | * |
| 1070 | * @param format The new window format (see PixelFormat). Use |
| 1071 | * PixelFormat.UNKNOWN to allow the Window to select |
| 1072 | * the format. |
| 1073 | * |
| 1074 | * @see PixelFormat |
| 1075 | */ |
| 1076 | public void setFormat(int format) { |
| 1077 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1078 | if (format != PixelFormat.UNKNOWN) { |
| 1079 | attrs.format = format; |
| 1080 | mHaveWindowFormat = true; |
| 1081 | } else { |
| 1082 | attrs.format = mDefaultWindowFormat; |
| 1083 | mHaveWindowFormat = false; |
| 1084 | } |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1085 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1086 | } |
| 1087 | |
| 1088 | /** |
| 1089 | * Specify custom animations to use for the window, as per |
| 1090 | * {@link WindowManager.LayoutParams#windowAnimations |
| 1091 | * WindowManager.LayoutParams.windowAnimations}. Providing anything besides |
| 1092 | * 0 here will override the animations the window would |
| 1093 | * normally retrieve from its theme. |
| 1094 | */ |
Tor Norbye | 417ee5b | 2015-03-10 20:57:37 -0700 | [diff] [blame] | 1095 | public void setWindowAnimations(@StyleRes int resId) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1096 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1097 | attrs.windowAnimations = resId; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1098 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1099 | } |
| 1100 | |
| 1101 | /** |
| 1102 | * Specify an explicit soft input mode to use for the window, as per |
| 1103 | * {@link WindowManager.LayoutParams#softInputMode |
| 1104 | * WindowManager.LayoutParams.softInputMode}. Providing anything besides |
| 1105 | * "unspecified" here will override the input mode the window would |
| 1106 | * normally retrieve from its theme. |
| 1107 | */ |
| 1108 | public void setSoftInputMode(int mode) { |
| 1109 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1110 | if (mode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { |
| 1111 | attrs.softInputMode = mode; |
| 1112 | mHasSoftInputMode = true; |
| 1113 | } else { |
| 1114 | mHasSoftInputMode = false; |
| 1115 | } |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1116 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1117 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1118 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1119 | /** |
| 1120 | * Convenience function to set the flag bits as specified in flags, as |
| 1121 | * per {@link #setFlags}. |
| 1122 | * @param flags The flag bits to be set. |
| 1123 | * @see #setFlags |
Christopher Tate | 193fc07 | 2012-06-04 11:27:40 -0700 | [diff] [blame] | 1124 | * @see #clearFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1125 | */ |
| 1126 | public void addFlags(int flags) { |
| 1127 | setFlags(flags, flags); |
| 1128 | } |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 1129 | |
Philip P. Moltmann | d66dd99 | 2018-09-17 11:26:04 -0700 | [diff] [blame] | 1130 | /** |
| 1131 | * Add private flag bits. |
| 1132 | * |
| 1133 | * <p>Refer to the individual flags for the permissions needed. |
| 1134 | * |
Philip P. Moltmann | 66ce238 | 2018-10-09 13:46:11 -0700 | [diff] [blame] | 1135 | * @param flags The flag bits to add. |
| 1136 | * |
| 1137 | * @hide |
| 1138 | */ |
Philip P. Moltmann | 88de965 | 2019-05-09 12:53:33 -0700 | [diff] [blame] | 1139 | @UnsupportedAppUsage |
Philip P. Moltmann | 66ce238 | 2018-10-09 13:46:11 -0700 | [diff] [blame] | 1140 | public void addPrivateFlags(int flags) { |
| 1141 | setPrivateFlags(flags, flags); |
| 1142 | } |
| 1143 | |
| 1144 | /** |
| 1145 | * Add system flag bits. |
| 1146 | * |
| 1147 | * <p>Refer to the individual flags for the permissions needed. |
| 1148 | * |
Philip P. Moltmann | d66dd99 | 2018-09-17 11:26:04 -0700 | [diff] [blame] | 1149 | * <p>Note: Only for updateable system components (aka. mainline modules) |
| 1150 | * |
| 1151 | * @param flags The flag bits to add. |
| 1152 | * |
| 1153 | * @hide |
| 1154 | */ |
| 1155 | @SystemApi |
Philip P. Moltmann | 66ce238 | 2018-10-09 13:46:11 -0700 | [diff] [blame] | 1156 | public void addSystemFlags(@WindowManager.LayoutParams.SystemFlags int flags) { |
| 1157 | addPrivateFlags(flags); |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 1158 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1159 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1160 | /** |
| 1161 | * Convenience function to clear the flag bits as specified in flags, as |
| 1162 | * per {@link #setFlags}. |
| 1163 | * @param flags The flag bits to be cleared. |
| 1164 | * @see #setFlags |
Christopher Tate | 193fc07 | 2012-06-04 11:27:40 -0700 | [diff] [blame] | 1165 | * @see #addFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1166 | */ |
| 1167 | public void clearFlags(int flags) { |
| 1168 | setFlags(0, flags); |
| 1169 | } |
| 1170 | |
| 1171 | /** |
| 1172 | * Set the flags of the window, as per the |
| 1173 | * {@link WindowManager.LayoutParams WindowManager.LayoutParams} |
| 1174 | * flags. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1175 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1176 | * <p>Note that some flags must be set before the window decoration is |
| 1177 | * created (by the first call to |
| 1178 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} or |
| 1179 | * {@link #getDecorView()}: |
| 1180 | * {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN} and |
| 1181 | * {@link WindowManager.LayoutParams#FLAG_LAYOUT_INSET_DECOR}. These |
| 1182 | * will be set for you based on the {@link android.R.attr#windowIsFloating} |
| 1183 | * attribute. |
| 1184 | * |
| 1185 | * @param flags The new window flags (see WindowManager.LayoutParams). |
| 1186 | * @param mask Which of the window flag bits to modify. |
Christopher Tate | 193fc07 | 2012-06-04 11:27:40 -0700 | [diff] [blame] | 1187 | * @see #addFlags |
| 1188 | * @see #clearFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1189 | */ |
| 1190 | public void setFlags(int flags, int mask) { |
| 1191 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1192 | attrs.flags = (attrs.flags&~mask) | (flags&mask); |
| 1193 | mForcedWindowFlags |= mask; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1194 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1195 | } |
| 1196 | |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 1197 | private void setPrivateFlags(int flags, int mask) { |
| 1198 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1199 | attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask); |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1200 | dispatchWindowAttributesChanged(attrs); |
| 1201 | } |
| 1202 | |
| 1203 | /** |
| 1204 | * {@hide} |
| 1205 | */ |
| 1206 | protected void dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs) { |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 1207 | if (mCallback != null) { |
| 1208 | mCallback.onWindowAttributesChanged(attrs); |
| 1209 | } |
| 1210 | } |
| 1211 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1212 | /** |
Romain Guy | adae59b | 2017-06-20 14:45:53 -0700 | [diff] [blame] | 1213 | * <p>Sets the requested color mode of the window. The requested the color mode might |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1214 | * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p> |
| 1215 | * |
Romain Guy | adae59b | 2017-06-20 14:45:53 -0700 | [diff] [blame] | 1216 | * <p>The requested color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT}, |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1217 | * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.</p> |
Romain Guy | adae59b | 2017-06-20 14:45:53 -0700 | [diff] [blame] | 1218 | * |
| 1219 | * <p>The requested color mode is not guaranteed to be honored. Please refer to |
| 1220 | * {@link #getColorMode()} for more information.</p> |
| 1221 | * |
| 1222 | * @see #getColorMode() |
| 1223 | * @see Display#isWideColorGamut() |
| 1224 | * @see Configuration#isScreenWideColorGamut() |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1225 | */ |
| 1226 | public void setColorMode(@ActivityInfo.ColorMode int colorMode) { |
| 1227 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1228 | attrs.setColorMode(colorMode); |
| 1229 | dispatchWindowAttributesChanged(attrs); |
| 1230 | } |
| 1231 | |
| 1232 | /** |
Galia Peycheva | 056b3ee | 2019-06-26 14:05:12 +0200 | [diff] [blame] | 1233 | * If {@code isPreferred} is true, this method requests that the connected display does minimal |
| 1234 | * post processing when this window is visible on the screen. Otherwise, it requests that the |
| 1235 | * display switches back to standard image processing. |
| 1236 | * |
| 1237 | * <p> By default, the display does not do minimal post processing and if this is desired, this |
| 1238 | * method should not be used. It should be used with {@code isPreferred=true} when low |
| 1239 | * latency has a higher priority than image enhancement processing (e.g. for games or video |
| 1240 | * conferencing). The display will automatically go back into standard image processing mode |
| 1241 | * when no window requesting minimal posst processing is visible on screen anymore. |
| 1242 | * {@code setPreferMinimalPostProcessing(false)} can be used if |
| 1243 | * {@code setPreferMinimalPostProcessing(true)} was previously called for this window and |
| 1244 | * minimal post processing is no longer required. |
| 1245 | * |
| 1246 | * <p>If the Display sink is connected via HDMI, the device will begin to send infoframes with |
| 1247 | * Auto Low Latency Mode enabled and Game Content Type. This will switch the connected display |
| 1248 | * to a minimal image processing mode (if available), which reduces latency, improving the user |
| 1249 | * experience for gaming or video conferencing applications. For more information, see HDMI 2.1 |
| 1250 | * specification. |
| 1251 | * |
| 1252 | * <p>If the Display sink has an internal connection or uses some other protocol than HDMI, |
| 1253 | * effects may be similar but implementation-defined. |
| 1254 | * |
| 1255 | * <p>The ability to switch to a mode with minimal post proessing may be disabled by a user |
| 1256 | * setting in the system settings menu. In that case, this method does nothing. |
| 1257 | * |
Galia Peycheva | bdd66e3 | 2020-02-27 19:16:28 +0100 | [diff] [blame] | 1258 | * @see android.content.pm.ActivityInfo#FLAG_PREFER_MINIMAL_POST_PROCESSING |
Galia Peycheva | 056b3ee | 2019-06-26 14:05:12 +0200 | [diff] [blame] | 1259 | * @see android.view.Display#isMinimalPostProcessingSupported |
| 1260 | * @see android.view.WindowManager.LayoutParams#preferMinimalPostProcessing |
| 1261 | * |
| 1262 | * @param isPreferred Indicates whether minimal post processing is preferred for this window |
| 1263 | * ({@code isPreferred=true}) or not ({@code isPreferred=false}). |
| 1264 | */ |
| 1265 | public void setPreferMinimalPostProcessing(boolean isPreferred) { |
| 1266 | mWindowAttributes.preferMinimalPostProcessing = isPreferred; |
| 1267 | dispatchWindowAttributesChanged(mWindowAttributes); |
| 1268 | } |
| 1269 | |
| 1270 | /** |
Romain Guy | adae59b | 2017-06-20 14:45:53 -0700 | [diff] [blame] | 1271 | * Returns the requested color mode of the window, one of |
| 1272 | * {@link ActivityInfo#COLOR_MODE_DEFAULT}, {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} |
| 1273 | * or {@link ActivityInfo#COLOR_MODE_HDR}. If {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} |
| 1274 | * was requested it is possible the window will not be put in wide color gamut mode depending |
| 1275 | * on device and display support for that mode. Use {@link #isWideColorGamut} to determine |
| 1276 | * if the window is currently in wide color gamut mode. |
| 1277 | * |
| 1278 | * @see #setColorMode(int) |
| 1279 | * @see Display#isWideColorGamut() |
| 1280 | * @see Configuration#isScreenWideColorGamut() |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1281 | */ |
| 1282 | @ActivityInfo.ColorMode |
| 1283 | public int getColorMode() { |
| 1284 | return getAttributes().getColorMode(); |
| 1285 | } |
| 1286 | |
| 1287 | /** |
Romain Guy | adae59b | 2017-06-20 14:45:53 -0700 | [diff] [blame] | 1288 | * Returns true if this window's color mode is {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT}, |
| 1289 | * the display has a wide color gamut and this device supports wide color gamut rendering. |
| 1290 | * |
| 1291 | * @see Display#isWideColorGamut() |
| 1292 | * @see Configuration#isScreenWideColorGamut() |
| 1293 | */ |
| 1294 | public boolean isWideColorGamut() { |
| 1295 | return getColorMode() == ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT |
| 1296 | && getContext().getResources().getConfiguration().isScreenWideColorGamut(); |
| 1297 | } |
| 1298 | |
| 1299 | /** |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1300 | * Set the amount of dim behind the window when using |
| 1301 | * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}. This overrides |
| 1302 | * the default dim amount of that is selected by the Window based on |
| 1303 | * its theme. |
| 1304 | * |
| 1305 | * @param amount The new dim amount, from 0 for no dim to 1 for full dim. |
| 1306 | */ |
| 1307 | public void setDimAmount(float amount) { |
| 1308 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1309 | attrs.dimAmount = amount; |
| 1310 | mHaveDimAmount = true; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1311 | dispatchWindowAttributesChanged(attrs); |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1312 | } |
| 1313 | |
| 1314 | /** |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 1315 | * Sets whether the decor view should fit root-level content views for {@link WindowInsets}. |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 1316 | * <p> |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 1317 | * If set to {@code true}, the framework will inspect the now deprecated |
| 1318 | * {@link View#SYSTEM_UI_LAYOUT_FLAGS} as well the |
| 1319 | * {@link WindowManager.LayoutParams#SOFT_INPUT_ADJUST_RESIZE} flag and fits content according |
| 1320 | * to these flags. |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 1321 | * </p> |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 1322 | * <p> |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 1323 | * If set to {@code false}, the framework will not fit the content view to the insets and will |
| 1324 | * just pass through the {@link WindowInsets} to the content view. |
Jorim Jaggi | 7fb715c | 2020-01-09 23:45:41 +0100 | [diff] [blame] | 1325 | * </p> |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 1326 | * @param decorFitsSystemWindows Whether the decor view should fit root-level content views for |
| 1327 | * insets. |
Tiger Huang | 4a7835f | 2019-11-06 00:07:56 +0800 | [diff] [blame] | 1328 | */ |
Jorim Jaggi | 1f08f64 | 2020-01-29 13:11:46 +0100 | [diff] [blame] | 1329 | public void setDecorFitsSystemWindows(boolean decorFitsSystemWindows) { |
Tiger Huang | 4a7835f | 2019-11-06 00:07:56 +0800 | [diff] [blame] | 1330 | } |
| 1331 | |
| 1332 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1333 | * Specify custom window attributes. <strong>PLEASE NOTE:</strong> the |
| 1334 | * layout params you give here should generally be from values previously |
| 1335 | * retrieved with {@link #getAttributes()}; you probably do not want to |
| 1336 | * blindly create and apply your own, since this will blow away any values |
| 1337 | * set by the framework that you are not interested in. |
| 1338 | * |
| 1339 | * @param a The new window attributes, which will completely override any |
| 1340 | * current values. |
| 1341 | */ |
| 1342 | public void setAttributes(WindowManager.LayoutParams a) { |
| 1343 | mWindowAttributes.copyFrom(a); |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1344 | dispatchWindowAttributesChanged(mWindowAttributes); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1345 | } |
| 1346 | |
| 1347 | /** |
| 1348 | * Retrieve the current window attributes associated with this panel. |
| 1349 | * |
| 1350 | * @return WindowManager.LayoutParams Either the existing window |
| 1351 | * attributes object, or a freshly created one if there is none. |
| 1352 | */ |
| 1353 | public final WindowManager.LayoutParams getAttributes() { |
| 1354 | return mWindowAttributes; |
| 1355 | } |
| 1356 | |
| 1357 | /** |
| 1358 | * Return the window flags that have been explicitly set by the client, |
| 1359 | * so will not be modified by {@link #getDecorView}. |
| 1360 | */ |
| 1361 | protected final int getForcedWindowFlags() { |
| 1362 | return mForcedWindowFlags; |
| 1363 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1364 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1365 | /** |
| 1366 | * Has the app specified their own soft input mode? |
| 1367 | */ |
| 1368 | protected final boolean hasSoftInputMode() { |
| 1369 | return mHasSoftInputMode; |
| 1370 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1371 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1372 | /** @hide */ |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 1373 | @UnsupportedAppUsage |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1374 | public void setCloseOnTouchOutside(boolean close) { |
| 1375 | mCloseOnTouchOutside = close; |
| 1376 | mSetCloseOnTouchOutside = true; |
| 1377 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1378 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1379 | /** @hide */ |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 1380 | @UnsupportedAppUsage |
Dianne Hackborn | ef57575 | 2011-01-18 17:35:17 -0800 | [diff] [blame] | 1381 | public void setCloseOnTouchOutsideIfNotSet(boolean close) { |
| 1382 | if (!mSetCloseOnTouchOutside) { |
| 1383 | mCloseOnTouchOutside = close; |
| 1384 | mSetCloseOnTouchOutside = true; |
| 1385 | } |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1386 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1387 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1388 | /** @hide */ |
Mathew Inwood | a570dee | 2018-08-17 14:56:00 +0100 | [diff] [blame] | 1389 | @UnsupportedAppUsage |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1390 | public abstract void alwaysReadCloseOnTouchAttr(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1391 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1392 | /** @hide */ |
Mathew Inwood | 31755f9 | 2018-12-20 13:53:36 +0000 | [diff] [blame] | 1393 | @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1394 | public boolean shouldCloseOnTouch(Context context, MotionEvent event) { |
Michael Wright | ddec8fb | 2017-06-16 18:36:26 +0100 | [diff] [blame] | 1395 | final boolean isOutside = |
Siarhei Vishniakou | 45385e2 | 2019-05-15 10:50:09 -0700 | [diff] [blame] | 1396 | event.getAction() == MotionEvent.ACTION_UP && isOutOfBounds(context, event) |
Michael Wright | ddec8fb | 2017-06-16 18:36:26 +0100 | [diff] [blame] | 1397 | || event.getAction() == MotionEvent.ACTION_OUTSIDE; |
| 1398 | if (mCloseOnTouchOutside && peekDecorView() != null && isOutside) { |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1399 | return true; |
| 1400 | } |
| 1401 | return false; |
| 1402 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1403 | |
Ruchi Kandoi | 43e38de | 2016-04-14 19:34:53 -0700 | [diff] [blame] | 1404 | /* Sets the Sustained Performance requirement for the calling window. |
| 1405 | * @param enable disables or enables the mode. |
| 1406 | */ |
| 1407 | public void setSustainedPerformanceMode(boolean enable) { |
| 1408 | setPrivateFlags(enable |
| 1409 | ? WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE : 0, |
| 1410 | WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE); |
| 1411 | } |
| 1412 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1413 | private boolean isOutOfBounds(Context context, MotionEvent event) { |
| 1414 | final int x = (int) event.getX(); |
| 1415 | final int y = (int) event.getY(); |
| 1416 | final int slop = ViewConfiguration.get(context).getScaledWindowTouchSlop(); |
| 1417 | final View decorView = getDecorView(); |
| 1418 | return (x < -slop) || (y < -slop) |
| 1419 | || (x > (decorView.getWidth()+slop)) |
| 1420 | || (y > (decorView.getHeight()+slop)); |
| 1421 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1422 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1423 | /** |
| 1424 | * Enable extended screen features. This must be called before |
| 1425 | * setContentView(). May be called as many times as desired as long as it |
| 1426 | * is before setContentView(). If not called, no extended features |
| 1427 | * will be available. You can not turn off a feature once it is requested. |
| 1428 | * You canot use other title features with {@link #FEATURE_CUSTOM_TITLE}. |
| 1429 | * |
| 1430 | * @param featureId The desired features, defined as constants by Window. |
| 1431 | * @return The features that are now set. |
| 1432 | */ |
| 1433 | public boolean requestFeature(int featureId) { |
| 1434 | final int flag = 1<<featureId; |
| 1435 | mFeatures |= flag; |
| 1436 | mLocalFeatures |= mContainer != null ? (flag&~mContainer.mFeatures) : flag; |
| 1437 | return (mFeatures&flag) != 0; |
| 1438 | } |
| 1439 | |
Adam Powell | f4a6ec4 | 2010-08-24 14:18:10 -0700 | [diff] [blame] | 1440 | /** |
| 1441 | * @hide Used internally to help resolve conflicting features. |
| 1442 | */ |
| 1443 | protected void removeFeature(int featureId) { |
| 1444 | final int flag = 1<<featureId; |
| 1445 | mFeatures &= ~flag; |
| 1446 | mLocalFeatures &= ~(mContainer != null ? (flag&~mContainer.mFeatures) : flag); |
| 1447 | } |
| 1448 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1449 | public final void makeActive() { |
| 1450 | if (mContainer != null) { |
| 1451 | if (mContainer.mActiveChild != null) { |
| 1452 | mContainer.mActiveChild.mIsActive = false; |
| 1453 | } |
| 1454 | mContainer.mActiveChild = this; |
| 1455 | } |
| 1456 | mIsActive = true; |
| 1457 | onActive(); |
| 1458 | } |
| 1459 | |
| 1460 | public final boolean isActive() |
| 1461 | { |
| 1462 | return mIsActive; |
| 1463 | } |
| 1464 | |
| 1465 | /** |
Alan Viverette | db7423c | 2017-03-31 13:13:58 -0400 | [diff] [blame] | 1466 | * Finds a view that was identified by the {@code android:id} XML attribute |
Chris Craik | 6faa9e5 | 2018-01-11 10:46:10 -0800 | [diff] [blame] | 1467 | * that was processed in {@link android.app.Activity#onCreate}. |
| 1468 | * <p> |
| 1469 | * This will implicitly call {@link #getDecorView} with all of the associated side-effects. |
Alan Viverette | db7423c | 2017-03-31 13:13:58 -0400 | [diff] [blame] | 1470 | * <p> |
| 1471 | * <strong>Note:</strong> In most cases -- depending on compiler support -- |
| 1472 | * the resulting view is automatically cast to the target class type. If |
| 1473 | * the target class type is unconstrained, an explicit cast may be |
| 1474 | * necessary. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1475 | * |
Alan Viverette | db7423c | 2017-03-31 13:13:58 -0400 | [diff] [blame] | 1476 | * @param id the ID to search for |
| 1477 | * @return a view with given ID if found, or {@code null} otherwise |
| 1478 | * @see View#findViewById(int) |
Chris Craik | 6faa9e5 | 2018-01-11 10:46:10 -0800 | [diff] [blame] | 1479 | * @see Window#requireViewById(int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1480 | */ |
Scott Kennedy | c051955 | 2015-02-11 15:33:10 -0800 | [diff] [blame] | 1481 | @Nullable |
Alan Viverette | db7423c | 2017-03-31 13:13:58 -0400 | [diff] [blame] | 1482 | public <T extends View> T findViewById(@IdRes int id) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1483 | return getDecorView().findViewById(id); |
| 1484 | } |
Chris Craik | 6faa9e5 | 2018-01-11 10:46:10 -0800 | [diff] [blame] | 1485 | /** |
| 1486 | * Finds a view that was identified by the {@code android:id} XML attribute |
| 1487 | * that was processed in {@link android.app.Activity#onCreate}, or throws an |
| 1488 | * IllegalArgumentException if the ID is invalid, or there is no matching view in the hierarchy. |
| 1489 | * <p> |
| 1490 | * <strong>Note:</strong> In most cases -- depending on compiler support -- |
| 1491 | * the resulting view is automatically cast to the target class type. If |
| 1492 | * the target class type is unconstrained, an explicit cast may be |
| 1493 | * necessary. |
| 1494 | * |
| 1495 | * @param id the ID to search for |
| 1496 | * @return a view with given ID |
| 1497 | * @see View#requireViewById(int) |
| 1498 | * @see Window#findViewById(int) |
| 1499 | */ |
| 1500 | @NonNull |
| 1501 | public final <T extends View> T requireViewById(@IdRes int id) { |
| 1502 | T view = findViewById(id); |
| 1503 | if (view == null) { |
| 1504 | throw new IllegalArgumentException("ID does not reference a View inside this Window"); |
| 1505 | } |
| 1506 | return view; |
| 1507 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1508 | |
| 1509 | /** |
| 1510 | * Convenience for |
| 1511 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} |
| 1512 | * to set the screen content from a layout resource. The resource will be |
| 1513 | * inflated, adding all top-level views to the screen. |
| 1514 | * |
| 1515 | * @param layoutResID Resource ID to be inflated. |
| 1516 | * @see #setContentView(View, android.view.ViewGroup.LayoutParams) |
| 1517 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1518 | public abstract void setContentView(@LayoutRes int layoutResID); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1519 | |
| 1520 | /** |
| 1521 | * Convenience for |
| 1522 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} |
| 1523 | * set the screen content to an explicit view. This view is placed |
| 1524 | * directly into the screen's view hierarchy. It can itself be a complex |
| 1525 | * view hierarhcy. |
| 1526 | * |
| 1527 | * @param view The desired content to display. |
| 1528 | * @see #setContentView(View, android.view.ViewGroup.LayoutParams) |
| 1529 | */ |
| 1530 | public abstract void setContentView(View view); |
| 1531 | |
| 1532 | /** |
| 1533 | * Set the screen content to an explicit view. This view is placed |
| 1534 | * directly into the screen's view hierarchy. It can itself be a complex |
| 1535 | * view hierarchy. |
| 1536 | * |
| 1537 | * <p>Note that calling this function "locks in" various characteristics |
| 1538 | * of the window that can not, from this point forward, be changed: the |
| 1539 | * features that have been requested with {@link #requestFeature(int)}, |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 1540 | * and certain window flags as described in {@link #setFlags(int, int)}.</p> |
| 1541 | * |
| 1542 | * <p>If {@link #FEATURE_CONTENT_TRANSITIONS} is set, the window's |
| 1543 | * TransitionManager will be used to animate content from the current |
| 1544 | * content View to view.</p> |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1545 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1546 | * @param view The desired content to display. |
| 1547 | * @param params Layout parameters for the view. |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 1548 | * @see #getTransitionManager() |
| 1549 | * @see #setTransitionManager(android.transition.TransitionManager) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1550 | */ |
| 1551 | public abstract void setContentView(View view, ViewGroup.LayoutParams params); |
| 1552 | |
| 1553 | /** |
| 1554 | * Variation on |
| 1555 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} |
| 1556 | * to add an additional content view to the screen. Added after any existing |
| 1557 | * ones in the screen -- existing views are NOT removed. |
| 1558 | * |
| 1559 | * @param view The desired content to display. |
| 1560 | * @param params Layout parameters for the view. |
| 1561 | */ |
| 1562 | public abstract void addContentView(View view, ViewGroup.LayoutParams params); |
| 1563 | |
| 1564 | /** |
Filip Gruszczynski | a59ac9c | 2015-09-10 18:28:48 -0700 | [diff] [blame] | 1565 | * Remove the view that was used as the screen content. |
| 1566 | * |
| 1567 | * @hide |
| 1568 | */ |
| 1569 | public abstract void clearContentView(); |
| 1570 | |
| 1571 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1572 | * Return the view in this Window that currently has focus, or null if |
| 1573 | * there are none. Note that this does not look in any containing |
| 1574 | * Window. |
| 1575 | * |
| 1576 | * @return View The current View with focus or null. |
| 1577 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1578 | @Nullable |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1579 | public abstract View getCurrentFocus(); |
| 1580 | |
| 1581 | /** |
| 1582 | * Quick access to the {@link LayoutInflater} instance that this Window |
| 1583 | * retrieved from its Context. |
| 1584 | * |
| 1585 | * @return LayoutInflater The shared LayoutInflater. |
| 1586 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1587 | @NonNull |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1588 | public abstract LayoutInflater getLayoutInflater(); |
| 1589 | |
| 1590 | public abstract void setTitle(CharSequence title); |
| 1591 | |
Alan Viverette | 2525d9c | 2013-11-15 14:42:19 -0800 | [diff] [blame] | 1592 | @Deprecated |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 1593 | public abstract void setTitleColor(@ColorInt int textColor); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1594 | |
| 1595 | public abstract void openPanel(int featureId, KeyEvent event); |
| 1596 | |
| 1597 | public abstract void closePanel(int featureId); |
| 1598 | |
| 1599 | public abstract void togglePanel(int featureId, KeyEvent event); |
| 1600 | |
Dianne Hackborn | b31e84bc | 2010-06-08 18:04:35 -0700 | [diff] [blame] | 1601 | public abstract void invalidatePanelMenu(int featureId); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1602 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1603 | public abstract boolean performPanelShortcut(int featureId, |
| 1604 | int keyCode, |
| 1605 | KeyEvent event, |
| 1606 | int flags); |
| 1607 | public abstract boolean performPanelIdentifierAction(int featureId, |
| 1608 | int id, |
| 1609 | int flags); |
| 1610 | |
| 1611 | public abstract void closeAllPanels(); |
| 1612 | |
| 1613 | public abstract boolean performContextMenuIdentifierAction(int id, int flags); |
| 1614 | |
| 1615 | /** |
| 1616 | * Should be called when the configuration is changed. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1617 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1618 | * @param newConfig The new configuration. |
| 1619 | */ |
| 1620 | public abstract void onConfigurationChanged(Configuration newConfig); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1621 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1622 | /** |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1623 | * Sets the window elevation. |
Alan Viverette | 71922de | 2015-01-12 16:14:02 -0800 | [diff] [blame] | 1624 | * <p> |
| 1625 | * Changes to this property take effect immediately and will cause the |
| 1626 | * window surface to be recreated. This is an expensive operation and as a |
| 1627 | * result, this property should not be animated. |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1628 | * |
| 1629 | * @param elevation The window elevation. |
| 1630 | * @see View#setElevation(float) |
| 1631 | * @see android.R.styleable#Window_windowElevation |
| 1632 | */ |
| 1633 | public void setElevation(float elevation) {} |
| 1634 | |
| 1635 | /** |
Filip Gruszczynski | a59ac9c | 2015-09-10 18:28:48 -0700 | [diff] [blame] | 1636 | * Gets the window elevation. |
| 1637 | * |
| 1638 | * @hide |
| 1639 | */ |
| 1640 | public float getElevation() { |
| 1641 | return 0.0f; |
| 1642 | } |
| 1643 | |
| 1644 | /** |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1645 | * Sets whether window content should be clipped to the outline of the |
| 1646 | * window background. |
| 1647 | * |
| 1648 | * @param clipToOutline Whether window content should be clipped to the |
| 1649 | * outline of the window background. |
| 1650 | * @see View#setClipToOutline(boolean) |
| 1651 | * @see android.R.styleable#Window_windowClipToOutline |
| 1652 | */ |
| 1653 | public void setClipToOutline(boolean clipToOutline) {} |
| 1654 | |
| 1655 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1656 | * Change the background of this window to a Drawable resource. Setting the |
| 1657 | * background to null will make the window be opaque. To make the window |
| 1658 | * transparent, you can use an empty drawable (for instance a ColorDrawable |
| 1659 | * with the color 0 or the system drawable android:drawable/empty.) |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1660 | * |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1661 | * @param resId The resource identifier of a drawable resource which will |
| 1662 | * be installed as the new background. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1663 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1664 | public void setBackgroundDrawableResource(@DrawableRes int resId) { |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1665 | setBackgroundDrawable(mContext.getDrawable(resId)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1666 | } |
| 1667 | |
| 1668 | /** |
| 1669 | * Change the background of this window to a custom Drawable. Setting the |
| 1670 | * background to null will make the window be opaque. To make the window |
| 1671 | * transparent, you can use an empty drawable (for instance a ColorDrawable |
| 1672 | * with the color 0 or the system drawable android:drawable/empty.) |
| 1673 | * |
| 1674 | * @param drawable The new Drawable to use for this window's background. |
| 1675 | */ |
| 1676 | public abstract void setBackgroundDrawable(Drawable drawable); |
| 1677 | |
| 1678 | /** |
| 1679 | * Set the value for a drawable feature of this window, from a resource |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1680 | * identifier. You must have called requestFeature(featureId) before |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1681 | * calling this function. |
| 1682 | * |
| 1683 | * @see android.content.res.Resources#getDrawable(int) |
| 1684 | * |
| 1685 | * @param featureId The desired drawable feature to change, defined as a |
| 1686 | * constant by Window. |
| 1687 | * @param resId Resource identifier of the desired image. |
| 1688 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1689 | public abstract void setFeatureDrawableResource(int featureId, @DrawableRes int resId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1690 | |
| 1691 | /** |
| 1692 | * Set the value for a drawable feature of this window, from a URI. You |
| 1693 | * must have called requestFeature(featureId) before calling this |
| 1694 | * function. |
| 1695 | * |
| 1696 | * <p>The only URI currently supported is "content:", specifying an image |
| 1697 | * in a content provider. |
| 1698 | * |
| 1699 | * @see android.widget.ImageView#setImageURI |
| 1700 | * |
| 1701 | * @param featureId The desired drawable feature to change. Features are |
| 1702 | * constants defined by Window. |
| 1703 | * @param uri The desired URI. |
| 1704 | */ |
| 1705 | public abstract void setFeatureDrawableUri(int featureId, Uri uri); |
| 1706 | |
| 1707 | /** |
| 1708 | * Set an explicit Drawable value for feature of this window. You must |
| 1709 | * have called requestFeature(featureId) before calling this function. |
| 1710 | * |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1711 | * @param featureId The desired drawable feature to change. Features are |
| 1712 | * constants defined by Window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1713 | * @param drawable A Drawable object to display. |
| 1714 | */ |
| 1715 | public abstract void setFeatureDrawable(int featureId, Drawable drawable); |
| 1716 | |
| 1717 | /** |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1718 | * Set a custom alpha value for the given drawable feature, controlling how |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1719 | * much the background is visible through it. |
| 1720 | * |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1721 | * @param featureId The desired drawable feature to change. Features are |
| 1722 | * constants defined by Window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1723 | * @param alpha The alpha amount, 0 is completely transparent and 255 is |
| 1724 | * completely opaque. |
| 1725 | */ |
| 1726 | public abstract void setFeatureDrawableAlpha(int featureId, int alpha); |
| 1727 | |
| 1728 | /** |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1729 | * Set the integer value for a feature. The range of the value depends on |
| 1730 | * the feature being set. For {@link #FEATURE_PROGRESS}, it should go from |
| 1731 | * 0 to 10000. At 10000 the progress is complete and the indicator hidden. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1732 | * |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1733 | * @param featureId The desired feature to change. Features are constants |
| 1734 | * defined by Window. |
| 1735 | * @param value The value for the feature. The interpretation of this |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1736 | * value is feature-specific. |
| 1737 | */ |
| 1738 | public abstract void setFeatureInt(int featureId, int value); |
| 1739 | |
| 1740 | /** |
| 1741 | * Request that key events come to this activity. Use this if your |
| 1742 | * activity has no views with focus, but the activity still wants |
| 1743 | * a chance to process key events. |
| 1744 | */ |
| 1745 | public abstract void takeKeyEvents(boolean get); |
| 1746 | |
| 1747 | /** |
| 1748 | * Used by custom windows, such as Dialog, to pass the key press event |
| 1749 | * further down the view hierarchy. Application developers should |
| 1750 | * not need to implement or call this. |
| 1751 | * |
| 1752 | */ |
| 1753 | public abstract boolean superDispatchKeyEvent(KeyEvent event); |
| 1754 | |
| 1755 | /** |
Jeff Brown | 64da12a | 2011-01-04 19:57:47 -0800 | [diff] [blame] | 1756 | * Used by custom windows, such as Dialog, to pass the key shortcut press event |
| 1757 | * further down the view hierarchy. Application developers should |
| 1758 | * not need to implement or call this. |
| 1759 | * |
| 1760 | */ |
| 1761 | public abstract boolean superDispatchKeyShortcutEvent(KeyEvent event); |
| 1762 | |
| 1763 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1764 | * Used by custom windows, such as Dialog, to pass the touch screen event |
| 1765 | * further down the view hierarchy. Application developers should |
| 1766 | * not need to implement or call this. |
| 1767 | * |
| 1768 | */ |
| 1769 | public abstract boolean superDispatchTouchEvent(MotionEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1770 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1771 | /** |
| 1772 | * Used by custom windows, such as Dialog, to pass the trackball event |
| 1773 | * further down the view hierarchy. Application developers should |
| 1774 | * not need to implement or call this. |
| 1775 | * |
| 1776 | */ |
| 1777 | public abstract boolean superDispatchTrackballEvent(MotionEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1778 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1779 | /** |
Jeff Brown | cb1404e | 2011-01-15 18:14:15 -0800 | [diff] [blame] | 1780 | * Used by custom windows, such as Dialog, to pass the generic motion event |
| 1781 | * further down the view hierarchy. Application developers should |
| 1782 | * not need to implement or call this. |
| 1783 | * |
| 1784 | */ |
| 1785 | public abstract boolean superDispatchGenericMotionEvent(MotionEvent event); |
| 1786 | |
| 1787 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1788 | * Retrieve the top-level window decor view (containing the standard |
| 1789 | * window frame/decorations and the client's content inside of that), which |
| 1790 | * can be added as a window to the window manager. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1791 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1792 | * <p><em>Note that calling this function for the first time "locks in" |
| 1793 | * various window characteristics as described in |
| 1794 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}.</em></p> |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1795 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1796 | * @return Returns the top-level window decor view. |
| 1797 | */ |
Siarhei Vishniakou | c771e7e | 2018-04-19 11:43:29 -0700 | [diff] [blame] | 1798 | public abstract @NonNull View getDecorView(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1799 | |
| 1800 | /** |
| 1801 | * Retrieve the current decor view, but only if it has already been created; |
| 1802 | * otherwise returns null. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1803 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1804 | * @return Returns the top-level window decor or null. |
| 1805 | * @see #getDecorView |
| 1806 | */ |
| 1807 | public abstract View peekDecorView(); |
| 1808 | |
| 1809 | public abstract Bundle saveHierarchyState(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1810 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1811 | public abstract void restoreHierarchyState(Bundle savedInstanceState); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1812 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1813 | protected abstract void onActive(); |
| 1814 | |
| 1815 | /** |
| 1816 | * Return the feature bits that are enabled. This is the set of features |
| 1817 | * that were given to requestFeature(), and are being handled by this |
| 1818 | * Window itself or its container. That is, it is the set of |
| 1819 | * requested features that you can actually use. |
| 1820 | * |
| 1821 | * <p>To do: add a public version of this API that allows you to check for |
| 1822 | * features by their feature ID. |
| 1823 | * |
| 1824 | * @return int The feature bits. |
| 1825 | */ |
| 1826 | protected final int getFeatures() |
| 1827 | { |
| 1828 | return mFeatures; |
| 1829 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1830 | |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 1831 | /** |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 1832 | * Return the feature bits set by default on a window. |
| 1833 | * @param context The context used to access resources |
| 1834 | */ |
| 1835 | public static int getDefaultFeatures(Context context) { |
| 1836 | int features = 0; |
| 1837 | |
| 1838 | final Resources res = context.getResources(); |
| 1839 | if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureOptionsPanel)) { |
| 1840 | features |= 1 << FEATURE_OPTIONS_PANEL; |
| 1841 | } |
| 1842 | |
| 1843 | if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureContextMenu)) { |
| 1844 | features |= 1 << FEATURE_CONTEXT_MENU; |
| 1845 | } |
| 1846 | |
| 1847 | return features; |
| 1848 | } |
| 1849 | |
| 1850 | /** |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 1851 | * Query for the availability of a certain feature. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1852 | * |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 1853 | * @param feature The feature ID to check |
| 1854 | * @return true if the feature is enabled, false otherwise. |
| 1855 | */ |
| 1856 | public boolean hasFeature(int feature) { |
| 1857 | return (getFeatures() & (1 << feature)) != 0; |
| 1858 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1859 | |
| 1860 | /** |
| 1861 | * Return the feature bits that are being implemented by this Window. |
| 1862 | * This is the set of features that were given to requestFeature(), and are |
| 1863 | * being handled by only this Window itself, not by its containers. |
| 1864 | * |
| 1865 | * @return int The feature bits. |
| 1866 | */ |
| 1867 | protected final int getLocalFeatures() |
| 1868 | { |
| 1869 | return mLocalFeatures; |
| 1870 | } |
| 1871 | |
| 1872 | /** |
| 1873 | * Set the default format of window, as per the PixelFormat types. This |
| 1874 | * is the format that will be used unless the client specifies in explicit |
| 1875 | * format with setFormat(); |
| 1876 | * |
| 1877 | * @param format The new window format (see PixelFormat). |
| 1878 | * |
| 1879 | * @see #setFormat |
| 1880 | * @see PixelFormat |
| 1881 | */ |
| 1882 | protected void setDefaultWindowFormat(int format) { |
| 1883 | mDefaultWindowFormat = format; |
| 1884 | if (!mHaveWindowFormat) { |
| 1885 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1886 | attrs.format = format; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1887 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1888 | } |
| 1889 | } |
| 1890 | |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1891 | /** @hide */ |
| 1892 | protected boolean haveDimAmount() { |
| 1893 | return mHaveDimAmount; |
| 1894 | } |
| 1895 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1896 | public abstract void setChildDrawable(int featureId, Drawable drawable); |
| 1897 | |
| 1898 | public abstract void setChildInt(int featureId, int value); |
| 1899 | |
| 1900 | /** |
| 1901 | * Is a keypress one of the defined shortcut keys for this window. |
| 1902 | * @param keyCode the key code from {@link android.view.KeyEvent} to check. |
| 1903 | * @param event the {@link android.view.KeyEvent} to use to help check. |
| 1904 | */ |
| 1905 | public abstract boolean isShortcutKey(int keyCode, KeyEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1906 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1907 | /** |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1908 | * @see android.app.Activity#setVolumeControlStream(int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1909 | */ |
| 1910 | public abstract void setVolumeControlStream(int streamType); |
| 1911 | |
| 1912 | /** |
| 1913 | * @see android.app.Activity#getVolumeControlStream() |
| 1914 | */ |
| 1915 | public abstract int getVolumeControlStream(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1916 | |
| 1917 | /** |
RoboErik | fd63dd0 | 2014-08-28 15:22:55 -0700 | [diff] [blame] | 1918 | * Sets a {@link MediaController} to send media keys and volume changes to. |
| 1919 | * If set, this should be preferred for all media keys and volume requests |
| 1920 | * sent to this window. |
| 1921 | * |
| 1922 | * @param controller The controller for the session which should receive |
| 1923 | * media keys and volume changes. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1924 | * @see android.app.Activity#setMediaController(android.media.session.MediaController) |
| 1925 | */ |
| 1926 | public void setMediaController(MediaController controller) { |
| 1927 | } |
| 1928 | |
| 1929 | /** |
RoboErik | fd63dd0 | 2014-08-28 15:22:55 -0700 | [diff] [blame] | 1930 | * Gets the {@link MediaController} that was previously set. |
| 1931 | * |
| 1932 | * @return The controller which should receive events. |
| 1933 | * @see #setMediaController(android.media.session.MediaController) |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1934 | * @see android.app.Activity#getMediaController() |
| 1935 | */ |
| 1936 | public MediaController getMediaController() { |
| 1937 | return null; |
| 1938 | } |
| 1939 | |
| 1940 | /** |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1941 | * Set extra options that will influence the UI for this window. |
| 1942 | * @param uiOptions Flags specifying extra options for this window. |
| 1943 | */ |
| 1944 | public void setUiOptions(int uiOptions) { } |
Adam Powell | e43fca9 | 2011-08-16 12:57:01 -0700 | [diff] [blame] | 1945 | |
| 1946 | /** |
| 1947 | * Set extra options that will influence the UI for this window. |
| 1948 | * Only the bits filtered by mask will be modified. |
| 1949 | * @param uiOptions Flags specifying extra options for this window. |
| 1950 | * @param mask Flags specifying which options should be modified. Others will remain unchanged. |
| 1951 | */ |
| 1952 | public void setUiOptions(int uiOptions, int mask) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1953 | |
| 1954 | /** |
| 1955 | * Set the primary icon for this window. |
| 1956 | * |
| 1957 | * @param resId resource ID of a drawable to set |
| 1958 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1959 | public void setIcon(@DrawableRes int resId) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1960 | |
| 1961 | /** |
| 1962 | * Set the default icon for this window. |
| 1963 | * This will be overridden by any other icon set operation which could come from the |
| 1964 | * theme or another explicit set. |
| 1965 | * |
| 1966 | * @hide |
| 1967 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1968 | public void setDefaultIcon(@DrawableRes int resId) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1969 | |
| 1970 | /** |
| 1971 | * Set the logo for this window. A logo is often shown in place of an |
| 1972 | * {@link #setIcon(int) icon} but is generally wider and communicates window title information |
| 1973 | * as well. |
| 1974 | * |
| 1975 | * @param resId resource ID of a drawable to set |
| 1976 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1977 | public void setLogo(@DrawableRes int resId) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1978 | |
| 1979 | /** |
| 1980 | * Set the default logo for this window. |
| 1981 | * This will be overridden by any other logo set operation which could come from the |
| 1982 | * theme or another explicit set. |
| 1983 | * |
| 1984 | * @hide |
| 1985 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1986 | public void setDefaultLogo(@DrawableRes int resId) { } |
keunyoung | 30f420f | 2013-08-02 14:23:10 -0700 | [diff] [blame] | 1987 | |
| 1988 | /** |
| 1989 | * Set focus locally. The window should have the |
| 1990 | * {@link WindowManager.LayoutParams#FLAG_LOCAL_FOCUS_MODE} flag set already. |
| 1991 | * @param hasFocus Whether this window has focus or not. |
| 1992 | * @param inTouchMode Whether this window is in touch mode or not. |
| 1993 | */ |
| 1994 | public void setLocalFocus(boolean hasFocus, boolean inTouchMode) { } |
| 1995 | |
| 1996 | /** |
| 1997 | * Inject an event to window locally. |
| 1998 | * @param event A key or touch event to inject to this window. |
| 1999 | */ |
| 2000 | public void injectInputEvent(InputEvent event) { } |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 2001 | |
| 2002 | /** |
| 2003 | * Retrieve the {@link TransitionManager} responsible for for default transitions |
| 2004 | * in this window. Requires {@link #FEATURE_CONTENT_TRANSITIONS}. |
| 2005 | * |
| 2006 | * <p>This method will return non-null after content has been initialized (e.g. by using |
| 2007 | * {@link #setContentView}) if {@link #FEATURE_CONTENT_TRANSITIONS} has been granted.</p> |
| 2008 | * |
| 2009 | * @return This window's content TransitionManager or null if none is set. |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 2010 | * @attr ref android.R.styleable#Window_windowContentTransitionManager |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 2011 | */ |
| 2012 | public TransitionManager getTransitionManager() { |
| 2013 | return null; |
| 2014 | } |
| 2015 | |
| 2016 | /** |
| 2017 | * Set the {@link TransitionManager} to use for default transitions in this window. |
| 2018 | * Requires {@link #FEATURE_CONTENT_TRANSITIONS}. |
| 2019 | * |
| 2020 | * @param tm The TransitionManager to use for scene changes. |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 2021 | * @attr ref android.R.styleable#Window_windowContentTransitionManager |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 2022 | */ |
| 2023 | public void setTransitionManager(TransitionManager tm) { |
| 2024 | throw new UnsupportedOperationException(); |
| 2025 | } |
| 2026 | |
| 2027 | /** |
| 2028 | * Retrieve the {@link Scene} representing this window's current content. |
| 2029 | * Requires {@link #FEATURE_CONTENT_TRANSITIONS}. |
| 2030 | * |
| 2031 | * <p>This method will return null if the current content is not represented by a Scene.</p> |
| 2032 | * |
| 2033 | * @return Current Scene being shown or null |
| 2034 | */ |
| 2035 | public Scene getContentScene() { |
| 2036 | return null; |
| 2037 | } |
| 2038 | |
| 2039 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2040 | * Sets the Transition that will be used to move Views into the initial scene. The entering |
| 2041 | * Views will be those that are regular Views or ViewGroups that have |
| 2042 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 2043 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 2044 | * {@link View#INVISIBLE} to {@link View#VISIBLE}. If <code>transition</code> is null, |
| 2045 | * entering Views will remain unaffected. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2046 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2047 | * @param transition The Transition to use to move Views into the initial Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2048 | * @attr ref android.R.styleable#Window_windowEnterTransition |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 2049 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2050 | public void setEnterTransition(Transition transition) {} |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 2051 | |
| 2052 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2053 | * Sets the Transition that will be used to move Views out of the scene when the Window is |
| 2054 | * preparing to close, for example after a call to |
| 2055 | * {@link android.app.Activity#finishAfterTransition()}. The exiting |
| 2056 | * Views will be those that are regular Views or ViewGroups that have |
| 2057 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 2058 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 2059 | * {@link View#VISIBLE} to {@link View#INVISIBLE}. If <code>transition</code> is null, |
| 2060 | * entering Views will remain unaffected. If nothing is set, the default will be to |
| 2061 | * use the same value as set in {@link #setEnterTransition(android.transition.Transition)}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2062 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2063 | * @param transition The Transition to use to move Views out of the Scene when the Window |
| 2064 | * is preparing to close. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2065 | * @attr ref android.R.styleable#Window_windowReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2066 | */ |
| 2067 | public void setReturnTransition(Transition transition) {} |
| 2068 | |
| 2069 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2070 | * Sets the Transition that will be used to move Views out of the scene when starting a |
| 2071 | * new Activity. The exiting Views will be those that are regular Views or ViewGroups that |
| 2072 | * have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 2073 | * {@link android.transition.Visibility} as exiting is governed by changing visibility |
| 2074 | * from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, the views will |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2075 | * remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2076 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2077 | * @param transition The Transition to use to move Views out of the scene when calling a |
| 2078 | * new Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2079 | * @attr ref android.R.styleable#Window_windowExitTransition |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 2080 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2081 | public void setExitTransition(Transition transition) {} |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 2082 | |
| 2083 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2084 | * Sets the Transition that will be used to move Views in to the scene when returning from |
| 2085 | * a previously-started Activity. The entering Views will be those that are regular Views |
| 2086 | * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions |
| 2087 | * will extend {@link android.transition.Visibility} as exiting is governed by changing |
| 2088 | * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, |
| 2089 | * the views will remain unaffected. If nothing is set, the default will be to use the same |
| 2090 | * transition as {@link #setExitTransition(android.transition.Transition)}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2091 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2092 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2093 | * @param transition The Transition to use to move Views into the scene when reentering from a |
| 2094 | * previously-started Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2095 | * @attr ref android.R.styleable#Window_windowReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2096 | */ |
| 2097 | public void setReenterTransition(Transition transition) {} |
| 2098 | |
| 2099 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2100 | * Returns the transition used to move Views into the initial scene. The entering |
| 2101 | * Views will be those that are regular Views or ViewGroups that have |
| 2102 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 2103 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 2104 | * {@link View#INVISIBLE} to {@link View#VISIBLE}. If <code>transition</code> is null, |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2105 | * entering Views will remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2106 | * |
| 2107 | * @return the Transition to use to move Views into the initial Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2108 | * @attr ref android.R.styleable#Window_windowEnterTransition |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 2109 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2110 | public Transition getEnterTransition() { return null; } |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 2111 | |
| 2112 | /** |
Chet Haase | b64e777f | 2016-12-09 07:17:10 -0800 | [diff] [blame] | 2113 | * Returns the Transition that will be used to move Views out of the scene when the Window is |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2114 | * preparing to close, for example after a call to |
| 2115 | * {@link android.app.Activity#finishAfterTransition()}. The exiting |
| 2116 | * Views will be those that are regular Views or ViewGroups that have |
| 2117 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 2118 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 2119 | * {@link View#VISIBLE} to {@link View#INVISIBLE}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2120 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2121 | * @return The Transition to use to move Views out of the Scene when the Window |
| 2122 | * is preparing to close. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2123 | * @attr ref android.R.styleable#Window_windowReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2124 | */ |
| 2125 | public Transition getReturnTransition() { return null; } |
| 2126 | |
| 2127 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2128 | * Returns the Transition that will be used to move Views out of the scene when starting a |
| 2129 | * new Activity. The exiting Views will be those that are regular Views or ViewGroups that |
| 2130 | * have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 2131 | * {@link android.transition.Visibility} as exiting is governed by changing visibility |
| 2132 | * from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, the views will |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2133 | * remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2134 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2135 | * @return the Transition to use to move Views out of the scene when calling a |
| 2136 | * new Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2137 | * @attr ref android.R.styleable#Window_windowExitTransition |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 2138 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2139 | public Transition getExitTransition() { return null; } |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 2140 | |
| 2141 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2142 | * Returns the Transition that will be used to move Views in to the scene when returning from |
| 2143 | * a previously-started Activity. The entering Views will be those that are regular Views |
| 2144 | * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions |
| 2145 | * will extend {@link android.transition.Visibility} as exiting is governed by changing |
| 2146 | * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2147 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2148 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2149 | * @return The Transition to use to move Views into the scene when reentering from a |
| 2150 | * previously-started Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2151 | * @attr ref android.R.styleable#Window_windowReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2152 | */ |
| 2153 | public Transition getReenterTransition() { return null; } |
| 2154 | |
| 2155 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2156 | * Sets the Transition that will be used for shared elements transferred into the content |
| 2157 | * Scene. Typical Transitions will affect size and location, such as |
George Mount | 990205e | 2014-06-24 09:36:18 -0700 | [diff] [blame] | 2158 | * {@link android.transition.ChangeBounds}. A null |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2159 | * value will cause transferred shared elements to blink to the final position. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2160 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2161 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2162 | * @param transition The Transition to use for shared elements transferred into the content |
| 2163 | * Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2164 | * @attr ref android.R.styleable#Window_windowSharedElementEnterTransition |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 2165 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2166 | public void setSharedElementEnterTransition(Transition transition) {} |
George Mount | e180337 | 2014-02-26 19:00:52 +0000 | [diff] [blame] | 2167 | |
| 2168 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2169 | * Sets the Transition that will be used for shared elements transferred back to a |
| 2170 | * calling Activity. Typical Transitions will affect size and location, such as |
| 2171 | * {@link android.transition.ChangeBounds}. A null |
| 2172 | * value will cause transferred shared elements to blink to the final position. |
| 2173 | * If no value is set, the default will be to use the same value as |
| 2174 | * {@link #setSharedElementEnterTransition(android.transition.Transition)}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2175 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2176 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2177 | * @param transition The Transition to use for shared elements transferred out of the content |
| 2178 | * Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2179 | * @attr ref android.R.styleable#Window_windowSharedElementReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2180 | */ |
| 2181 | public void setSharedElementReturnTransition(Transition transition) {} |
| 2182 | |
| 2183 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2184 | * Returns the Transition that will be used for shared elements transferred into the content |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2185 | * Scene. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2186 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2187 | * @return Transition to use for sharend elements transferred into the content Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2188 | * @attr ref android.R.styleable#Window_windowSharedElementEnterTransition |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 2189 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2190 | public Transition getSharedElementEnterTransition() { return null; } |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 2191 | |
| 2192 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2193 | * Returns the Transition that will be used for shared elements transferred back to a |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2194 | * calling Activity. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2195 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2196 | * @return Transition to use for sharend elements transferred into the content Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2197 | * @attr ref android.R.styleable#Window_windowSharedElementReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2198 | */ |
| 2199 | public Transition getSharedElementReturnTransition() { return null; } |
| 2200 | |
| 2201 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2202 | * Sets the Transition that will be used for shared elements after starting a new Activity |
| 2203 | * before the shared elements are transferred to the called Activity. If the shared elements |
| 2204 | * must animate during the exit transition, this Transition should be used. Upon completion, |
| 2205 | * the shared elements may be transferred to the started Activity. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2206 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2207 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2208 | * @param transition The Transition to use for shared elements in the launching Window |
| 2209 | * prior to transferring to the launched Activity's Window. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2210 | * @attr ref android.R.styleable#Window_windowSharedElementExitTransition |
George Mount | e180337 | 2014-02-26 19:00:52 +0000 | [diff] [blame] | 2211 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2212 | public void setSharedElementExitTransition(Transition transition) {} |
| 2213 | |
| 2214 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2215 | * Sets the Transition that will be used for shared elements reentering from a started |
| 2216 | * Activity after it has returned the shared element to it start location. If no value |
| 2217 | * is set, this will default to |
| 2218 | * {@link #setSharedElementExitTransition(android.transition.Transition)}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2219 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2220 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2221 | * @param transition The Transition to use for shared elements in the launching Window |
| 2222 | * after the shared element has returned to the Window. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2223 | * @attr ref android.R.styleable#Window_windowSharedElementReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2224 | */ |
| 2225 | public void setSharedElementReenterTransition(Transition transition) {} |
| 2226 | |
| 2227 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2228 | * Returns the Transition to use for shared elements in the launching Window prior |
| 2229 | * to transferring to the launched Activity's Window. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2230 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2231 | * |
| 2232 | * @return the Transition to use for shared elements in the launching Window prior |
| 2233 | * to transferring to the launched Activity's Window. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2234 | * @attr ref android.R.styleable#Window_windowSharedElementExitTransition |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2235 | */ |
| 2236 | public Transition getSharedElementExitTransition() { return null; } |
| 2237 | |
| 2238 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2239 | * Returns the Transition that will be used for shared elements reentering from a started |
| 2240 | * Activity after it has returned the shared element to it start location. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2241 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2242 | * |
| 2243 | * @return the Transition that will be used for shared elements reentering from a started |
| 2244 | * Activity after it has returned the shared element to it start location. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2245 | * @attr ref android.R.styleable#Window_windowSharedElementReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2246 | */ |
| 2247 | public Transition getSharedElementReenterTransition() { return null; } |
| 2248 | |
| 2249 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2250 | * Controls how the transition set in |
| 2251 | * {@link #setEnterTransition(android.transition.Transition)} overlaps with the exit |
| 2252 | * transition of the calling Activity. When true, the transition will start as soon as possible. |
| 2253 | * When false, the transition will wait until the remote exiting transition completes before |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2254 | * starting. The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2255 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2256 | * @param allow true to start the enter transition when possible or false to |
| 2257 | * wait until the exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2258 | * @attr ref android.R.styleable#Window_windowAllowEnterTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2259 | */ |
| 2260 | public void setAllowEnterTransitionOverlap(boolean allow) {} |
| 2261 | |
| 2262 | /** |
| 2263 | * Returns how the transition set in |
| 2264 | * {@link #setEnterTransition(android.transition.Transition)} overlaps with the exit |
| 2265 | * transition of the calling Activity. When true, the transition will start as soon as possible. |
| 2266 | * When false, the transition will wait until the remote exiting transition completes before |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2267 | * starting. The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2268 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2269 | * @return true when the enter transition should start as soon as possible or false to |
| 2270 | * when it should wait until the exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2271 | * @attr ref android.R.styleable#Window_windowAllowEnterTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2272 | */ |
| 2273 | public boolean getAllowEnterTransitionOverlap() { return true; } |
| 2274 | |
| 2275 | /** |
| 2276 | * Controls how the transition set in |
| 2277 | * {@link #setExitTransition(android.transition.Transition)} overlaps with the exit |
| 2278 | * transition of the called Activity when reentering after if finishes. When true, |
| 2279 | * the transition will start as soon as possible. When false, the transition will wait |
| 2280 | * until the called Activity's exiting transition completes before starting. |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2281 | * The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2282 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2283 | * @param allow true to start the transition when possible or false to wait until the |
| 2284 | * called Activity's exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2285 | * @attr ref android.R.styleable#Window_windowAllowReturnTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2286 | */ |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2287 | public void setAllowReturnTransitionOverlap(boolean allow) {} |
| 2288 | |
| 2289 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2290 | * Returns how the transition set in |
| 2291 | * {@link #setExitTransition(android.transition.Transition)} overlaps with the exit |
| 2292 | * transition of the called Activity when reentering after if finishes. When true, |
| 2293 | * the transition will start as soon as possible. When false, the transition will wait |
| 2294 | * until the called Activity's exiting transition completes before starting. |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2295 | * The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2296 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2297 | * @return true when the transition should start when possible or false when it should wait |
| 2298 | * until the called Activity's exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2299 | * @attr ref android.R.styleable#Window_windowAllowReturnTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2300 | */ |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2301 | public boolean getAllowReturnTransitionOverlap() { return true; } |
| 2302 | |
| 2303 | /** |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2304 | * Returns the duration, in milliseconds, of the window background fade |
| 2305 | * when transitioning into or away from an Activity when called with an Activity Transition. |
| 2306 | * <p>When executing the enter transition, the background starts transparent |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2307 | * and fades in. This requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. The default is |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2308 | * 300 milliseconds.</p> |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2309 | * |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2310 | * @return The duration of the window background fade to opaque during enter transition. |
| 2311 | * @see #getEnterTransition() |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2312 | * @attr ref android.R.styleable#Window_windowTransitionBackgroundFadeDuration |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2313 | */ |
| 2314 | public long getTransitionBackgroundFadeDuration() { return 0; } |
| 2315 | |
| 2316 | /** |
| 2317 | * Sets the duration, in milliseconds, of the window background fade |
| 2318 | * when transitioning into or away from an Activity when called with an Activity Transition. |
| 2319 | * <p>When executing the enter transition, the background starts transparent |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2320 | * and fades in. This requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. The default is |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2321 | * 300 milliseconds.</p> |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2322 | * |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2323 | * @param fadeDurationMillis The duration of the window background fade to or from opaque |
| 2324 | * during enter transition. |
| 2325 | * @see #setEnterTransition(android.transition.Transition) |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2326 | * @attr ref android.R.styleable#Window_windowTransitionBackgroundFadeDuration |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2327 | */ |
| 2328 | public void setTransitionBackgroundFadeDuration(long fadeDurationMillis) { } |
| 2329 | |
| 2330 | /** |
George Mount | b89d5cc | 2014-08-18 16:50:50 -0700 | [diff] [blame] | 2331 | * Returns <code>true</code> when shared elements should use an Overlay during |
| 2332 | * shared element transitions or <code>false</code> when they should animate as |
| 2333 | * part of the normal View hierarchy. The default value is true. |
| 2334 | * |
| 2335 | * @return <code>true</code> when shared elements should use an Overlay during |
| 2336 | * shared element transitions or <code>false</code> when they should animate as |
| 2337 | * part of the normal View hierarchy. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2338 | * @attr ref android.R.styleable#Window_windowSharedElementsUseOverlay |
George Mount | b89d5cc | 2014-08-18 16:50:50 -0700 | [diff] [blame] | 2339 | */ |
| 2340 | public boolean getSharedElementsUseOverlay() { return true; } |
| 2341 | |
| 2342 | /** |
| 2343 | * Sets whether or not shared elements should use an Overlay during shared element transitions. |
| 2344 | * The default value is true. |
| 2345 | * |
| 2346 | * @param sharedElementsUseOverlay <code>true</code> indicates that shared elements should |
| 2347 | * be transitioned with an Overlay or <code>false</code> |
| 2348 | * to transition within the normal View hierarchy. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2349 | * @attr ref android.R.styleable#Window_windowSharedElementsUseOverlay |
George Mount | b89d5cc | 2014-08-18 16:50:50 -0700 | [diff] [blame] | 2350 | */ |
| 2351 | public void setSharedElementsUseOverlay(boolean sharedElementsUseOverlay) { } |
| 2352 | |
| 2353 | /** |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2354 | * @return the color of the status bar. |
| 2355 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2356 | @ColorInt |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2357 | public abstract int getStatusBarColor(); |
| 2358 | |
| 2359 | /** |
John Spurlock | bc4cf00 | 2015-03-24 21:51:20 -0400 | [diff] [blame] | 2360 | * Sets the color of the status bar to {@code color}. |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2361 | * |
| 2362 | * For this to take effect, |
| 2363 | * the window must be drawing the system bar backgrounds with |
| 2364 | * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and |
| 2365 | * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS} must not be set. |
| 2366 | * |
John Spurlock | bc4cf00 | 2015-03-24 21:51:20 -0400 | [diff] [blame] | 2367 | * If {@code color} is not opaque, consider setting |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2368 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and |
| 2369 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}. |
George Mount | 238010f | 2014-06-30 17:31:17 -0700 | [diff] [blame] | 2370 | * <p> |
| 2371 | * The transitionName for the view background will be "android:status:background". |
| 2372 | * </p> |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2373 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2374 | public abstract void setStatusBarColor(@ColorInt int color); |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2375 | |
| 2376 | /** |
| 2377 | * @return the color of the navigation bar. |
| 2378 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2379 | @ColorInt |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2380 | public abstract int getNavigationBarColor(); |
| 2381 | |
| 2382 | /** |
| 2383 | * Sets the color of the navigation bar to {@param color}. |
| 2384 | * |
| 2385 | * For this to take effect, |
| 2386 | * the window must be drawing the system bar backgrounds with |
| 2387 | * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and |
| 2388 | * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION} must not be set. |
| 2389 | * |
| 2390 | * If {@param color} is not opaque, consider setting |
| 2391 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and |
| 2392 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}. |
George Mount | 238010f | 2014-06-30 17:31:17 -0700 | [diff] [blame] | 2393 | * <p> |
| 2394 | * The transitionName for the view background will be "android:navigation:background". |
| 2395 | * </p> |
Jorim Jaggi | a0b78d5 | 2018-01-22 19:01:42 +0100 | [diff] [blame] | 2396 | * @attr ref android.R.styleable#Window_navigationBarColor |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2397 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2398 | public abstract void setNavigationBarColor(@ColorInt int color); |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2399 | |
Jorim Jaggi | a0b78d5 | 2018-01-22 19:01:42 +0100 | [diff] [blame] | 2400 | /** |
| 2401 | * Shows a thin line of the specified color between the navigation bar and the app |
| 2402 | * content. |
| 2403 | * <p> |
| 2404 | * For this to take effect, |
| 2405 | * the window must be drawing the system bar backgrounds with |
| 2406 | * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and |
| 2407 | * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION} must not be set. |
| 2408 | * |
| 2409 | * @param dividerColor The color of the thin line. |
| 2410 | * @attr ref android.R.styleable#Window_navigationBarDividerColor |
| 2411 | */ |
| 2412 | public void setNavigationBarDividerColor(@ColorInt int dividerColor) { |
| 2413 | } |
| 2414 | |
| 2415 | /** |
| 2416 | * Retrieves the color of the navigation bar divider. |
| 2417 | * |
| 2418 | * @return The color of the navigation bar divider color. |
| 2419 | * @see #setNavigationBarColor(int) |
| 2420 | * @attr ref android.R.styleable#Window_navigationBarDividerColor |
| 2421 | */ |
| 2422 | public @ColorInt int getNavigationBarDividerColor() { |
| 2423 | return 0; |
| 2424 | } |
| 2425 | |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2426 | /** |
| 2427 | * Sets whether the system should ensure that the status bar has enough |
| 2428 | * contrast when a fully transparent background is requested. |
| 2429 | * |
| 2430 | * <p>If set to this value, the system will determine whether a scrim is necessary |
| 2431 | * to ensure that the status bar has enough contrast with the contents of |
| 2432 | * this app, and set an appropriate effective bar background color accordingly. |
| 2433 | * |
| 2434 | * <p>When the status bar color has a non-zero alpha value, the value of this |
| 2435 | * property has no effect. |
| 2436 | * |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2437 | * @see android.R.attr#enforceStatusBarContrast |
| 2438 | * @see #isStatusBarContrastEnforced |
Adrian Roos | 6eb1ed3 | 2019-04-08 16:23:43 +0200 | [diff] [blame] | 2439 | * @see #setStatusBarColor |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2440 | */ |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2441 | public void setStatusBarContrastEnforced(boolean ensureContrast) { |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2442 | } |
| 2443 | |
| 2444 | /** |
| 2445 | * Returns whether the system is ensuring that the status bar has enough contrast when a |
| 2446 | * fully transparent background is requested. |
| 2447 | * |
| 2448 | * <p>When the status bar color has a non-zero alpha value, the value of this |
| 2449 | * property has no effect. |
| 2450 | * |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2451 | * @return true, if the system is ensuring contrast, false otherwise. |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2452 | * @see android.R.attr#enforceStatusBarContrast |
| 2453 | * @see #setStatusBarContrastEnforced |
Adrian Roos | 6eb1ed3 | 2019-04-08 16:23:43 +0200 | [diff] [blame] | 2454 | * @see #setStatusBarColor |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2455 | */ |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2456 | public boolean isStatusBarContrastEnforced() { |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2457 | return false; |
| 2458 | } |
| 2459 | |
| 2460 | /** |
| 2461 | * Sets whether the system should ensure that the navigation bar has enough |
| 2462 | * contrast when a fully transparent background is requested. |
| 2463 | * |
| 2464 | * <p>If set to this value, the system will determine whether a scrim is necessary |
| 2465 | * to ensure that the navigation bar has enough contrast with the contents of |
| 2466 | * this app, and set an appropriate effective bar background color accordingly. |
| 2467 | * |
| 2468 | * <p>When the navigation bar color has a non-zero alpha value, the value of this |
| 2469 | * property has no effect. |
| 2470 | * |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2471 | * @see android.R.attr#enforceNavigationBarContrast |
| 2472 | * @see #isNavigationBarContrastEnforced |
Adrian Roos | 6eb1ed3 | 2019-04-08 16:23:43 +0200 | [diff] [blame] | 2473 | * @see #setNavigationBarColor |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2474 | */ |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2475 | public void setNavigationBarContrastEnforced(boolean enforceContrast) { |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2476 | } |
| 2477 | |
| 2478 | /** |
| 2479 | * Returns whether the system is ensuring that the navigation bar has enough contrast when a |
| 2480 | * fully transparent background is requested. |
| 2481 | * |
| 2482 | * <p>When the navigation bar color has a non-zero alpha value, the value of this |
| 2483 | * property has no effect. |
| 2484 | * |
| 2485 | * @return true, if the system is ensuring contrast, false otherwise. |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2486 | * @see android.R.attr#enforceNavigationBarContrast |
| 2487 | * @see #setNavigationBarContrastEnforced |
Adrian Roos | 6eb1ed3 | 2019-04-08 16:23:43 +0200 | [diff] [blame] | 2488 | * @see #setNavigationBarColor |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2489 | */ |
Adrian Roos | 8c7ca4f | 2019-04-17 11:35:22 +0200 | [diff] [blame] | 2490 | public boolean isNavigationBarContrastEnforced() { |
Adrian Roos | 4c86459 | 2019-04-10 14:47:57 +0200 | [diff] [blame] | 2491 | return false; |
| 2492 | } |
| 2493 | |
Adam Powell | 5a40b71 | 2019-04-15 15:54:02 -0700 | [diff] [blame] | 2494 | /** |
| 2495 | * Sets a list of areas within this window's coordinate space where the system should not |
| 2496 | * intercept touch or other pointing device gestures. |
| 2497 | * |
| 2498 | * <p>This method should be used by apps that make use of |
| 2499 | * {@link #takeSurface(SurfaceHolder.Callback2)} and do not have a view hierarchy available. |
| 2500 | * Apps that do have a view hierarchy should use |
| 2501 | * {@link View#setSystemGestureExclusionRects(List)} instead. This method does not modify or |
| 2502 | * replace the gesture exclusion rects populated by individual views in this window's view |
| 2503 | * hierarchy using {@link View#setSystemGestureExclusionRects(List)}.</p> |
| 2504 | * |
| 2505 | * <p>Use this to tell the system which specific sub-areas of a view need to receive gesture |
| 2506 | * input in order to function correctly in the presence of global system gestures that may |
| 2507 | * conflict. For example, if the system wishes to capture swipe-in-from-screen-edge gestures |
| 2508 | * to provide system-level navigation functionality, a view such as a navigation drawer |
| 2509 | * container can mark the left (or starting) edge of itself as requiring gesture capture |
| 2510 | * priority using this API. The system may then choose to relax its own gesture recognition |
| 2511 | * to allow the app to consume the user's gesture. It is not necessary for an app to register |
| 2512 | * exclusion rects for broadly spanning regions such as the entirety of a |
| 2513 | * <code>ScrollView</code> or for simple press and release click targets such as |
| 2514 | * <code>Button</code>. Mark an exclusion rect when interacting with a view requires |
| 2515 | * a precision touch gesture in a small area in either the X or Y dimension, such as |
| 2516 | * an edge swipe or dragging a <code>SeekBar</code> thumb.</p> |
| 2517 | * |
| 2518 | * <p>Do not modify the provided list after this method is called.</p> |
| 2519 | * |
| 2520 | * @param rects A list of precision gesture regions that this window needs to function correctly |
| 2521 | */ |
| 2522 | @SuppressWarnings("unused") |
| 2523 | public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) { |
| 2524 | throw new UnsupportedOperationException("window does not support gesture exclusion rects"); |
| 2525 | } |
| 2526 | |
| 2527 | /** |
| 2528 | * Retrieve the list of areas within this window's coordinate space where the system should not |
| 2529 | * intercept touch or other pointing device gestures. This is the list as set by |
| 2530 | * {@link #setSystemGestureExclusionRects(List)} or an empty list if |
| 2531 | * {@link #setSystemGestureExclusionRects(List)} has not been called. It does not include |
| 2532 | * exclusion rects set by this window's view hierarchy. |
| 2533 | * |
| 2534 | * @return a list of system gesture exclusion rects specific to this window |
| 2535 | */ |
| 2536 | @NonNull |
| 2537 | public List<Rect> getSystemGestureExclusionRects() { |
| 2538 | return Collections.emptyList(); |
| 2539 | } |
| 2540 | |
Filip Gruszczynski | 0daf210 | 2015-09-29 08:39:07 -0700 | [diff] [blame] | 2541 | /** @hide */ |
| 2542 | public void setTheme(int resId) { |
| 2543 | } |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 2544 | |
| 2545 | /** |
| 2546 | * Whether the caption should be displayed directly on the content rather than push the content |
| 2547 | * down. This affects only freeform windows since they display the caption. |
| 2548 | * @hide |
| 2549 | */ |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 2550 | public void setOverlayWithDecorCaptionEnabled(boolean enabled) { |
| 2551 | mOverlayWithDecorCaptionEnabled = enabled; |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 2552 | } |
| 2553 | |
| 2554 | /** @hide */ |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 2555 | public boolean isOverlayWithDecorCaptionEnabled() { |
| 2556 | return mOverlayWithDecorCaptionEnabled; |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 2557 | } |
Filip Gruszczynski | 9b81e40 | 2015-12-08 15:42:01 -0800 | [diff] [blame] | 2558 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2559 | /** @hide */ |
| 2560 | public void notifyRestrictedCaptionAreaCallback(int left, int top, int right, int bottom) { |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 2561 | if (mOnRestrictedCaptionAreaChangedListener != null) { |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2562 | mRestrictedCaptionAreaRect.set(left, top, right, bottom); |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 2563 | mOnRestrictedCaptionAreaChangedListener.onRestrictedCaptionAreaChanged( |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2564 | mRestrictedCaptionAreaRect); |
| 2565 | } |
| 2566 | } |
Filip Gruszczynski | 9b81e40 | 2015-12-08 15:42:01 -0800 | [diff] [blame] | 2567 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2568 | /** |
| 2569 | * Set what color should the caption controls be. By default the system will try to determine |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 2570 | * the color from the theme. You can overwrite this by using {@link #DECOR_CAPTION_SHADE_DARK}, |
| 2571 | * {@link #DECOR_CAPTION_SHADE_LIGHT}, or {@link #DECOR_CAPTION_SHADE_AUTO}. |
| 2572 | * @see #DECOR_CAPTION_SHADE_DARK |
| 2573 | * @see #DECOR_CAPTION_SHADE_LIGHT |
| 2574 | * @see #DECOR_CAPTION_SHADE_AUTO |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2575 | */ |
| 2576 | public abstract void setDecorCaptionShade(int decorCaptionShade); |
| 2577 | |
| 2578 | /** |
| 2579 | * Set the drawable that is drawn underneath the caption during the resizing. |
| 2580 | * |
| 2581 | * During the resizing the caption might not be drawn fast enough to match the new dimensions. |
| 2582 | * There is a second caption drawn underneath it that will be fast enough. By default the |
| 2583 | * caption is constructed from the theme. You can provide a drawable, that will be drawn instead |
| 2584 | * to better match your application. |
| 2585 | */ |
| 2586 | public abstract void setResizingCaptionDrawable(Drawable drawable); |
Wale Ogunwale | eb6722c | 2015-12-08 11:43:43 -0800 | [diff] [blame] | 2587 | |
| 2588 | /** |
| 2589 | * Called when the activity changes from fullscreen mode to multi-window mode and visa-versa. |
| 2590 | * @hide |
| 2591 | */ |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 2592 | public abstract void onMultiWindowModeChanged(); |
Jorim Jaggi | 4846ee3 | 2016-01-07 17:39:12 +0100 | [diff] [blame] | 2593 | |
| 2594 | /** |
Winson Chung | 4d8681f | 2017-05-23 16:22:08 -0700 | [diff] [blame] | 2595 | * Called when the activity changes to/from picture-in-picture mode. |
| 2596 | * @hide |
| 2597 | */ |
| 2598 | public abstract void onPictureInPictureModeChanged(boolean isInPictureInPictureMode); |
| 2599 | |
| 2600 | /** |
Jorim Jaggi | 4846ee3 | 2016-01-07 17:39:12 +0100 | [diff] [blame] | 2601 | * Called when the activity just relaunched. |
| 2602 | * @hide |
| 2603 | */ |
| 2604 | public abstract void reportActivityRelaunched(); |
Michael Kwan | f7964be | 2016-11-30 16:44:33 -0800 | [diff] [blame] | 2605 | |
| 2606 | /** |
Jorim Jaggi | b603095 | 2018-10-23 18:31:52 +0200 | [diff] [blame] | 2607 | * @return The {@link WindowInsetsController} associated with this window |
| 2608 | * @see View#getWindowInsetsController() |
Jorim Jaggi | b603095 | 2018-10-23 18:31:52 +0200 | [diff] [blame] | 2609 | */ |
Tarandeep Singh | 54554e2 | 2019-11-01 14:43:05 -0700 | [diff] [blame] | 2610 | public @Nullable WindowInsetsController getInsetsController() { |
| 2611 | return null; |
| 2612 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2613 | } |