Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 1 | /* |
Wale Ogunwale | 98d6231 | 2017-07-12 09:24:56 -0700 | [diff] [blame] | 2 | * Copyright (C) 2017 The Android Open Source Project |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 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 | |
Wale Ogunwale | 98d6231 | 2017-07-12 09:24:56 -0700 | [diff] [blame] | 17 | package com.android.server.wm; |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 18 | |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 19 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; |
| 20 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; |
| 21 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; |
| 22 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; |
| 23 | import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 24 | import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; |
Wale Ogunwale | 04a05ac | 2017-09-17 21:35:02 -0700 | [diff] [blame] | 25 | import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 26 | import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; |
Wale Ogunwale | 926aade | 2017-08-29 11:24:37 -0700 | [diff] [blame] | 27 | import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; |
| 28 | import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; |
Wale Ogunwale | 04a05ac | 2017-09-17 21:35:02 -0700 | [diff] [blame] | 29 | import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 30 | import static android.app.WindowConfiguration.activityTypeToString; |
Wale Ogunwale | ab5de37 | 2017-10-18 06:46:31 -0700 | [diff] [blame] | 31 | import static android.app.WindowConfiguration.windowingModeToString; |
Evan Rosky | 1047574 | 2018-09-05 19:02:48 -0700 | [diff] [blame] | 32 | |
Yi Jin | 6c6e9ca | 2018-03-20 16:53:35 -0700 | [diff] [blame] | 33 | import static com.android.server.wm.ConfigurationContainerProto.FULL_CONFIGURATION; |
| 34 | import static com.android.server.wm.ConfigurationContainerProto.MERGED_OVERRIDE_CONFIGURATION; |
| 35 | import static com.android.server.wm.ConfigurationContainerProto.OVERRIDE_CONFIGURATION; |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 36 | |
Wale Ogunwale | 0d5609b | 2017-09-13 05:55:07 -0700 | [diff] [blame] | 37 | import android.annotation.CallSuper; |
Wale Ogunwale | 687b427 | 2017-07-27 02:56:23 -0700 | [diff] [blame] | 38 | import android.app.WindowConfiguration; |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 39 | import android.content.res.Configuration; |
Adrian Roos | 7af9d97 | 2018-11-30 15:26:27 +0100 | [diff] [blame] | 40 | import android.graphics.Point; |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 41 | import android.graphics.Rect; |
Wale Ogunwale | 0d5609b | 2017-09-13 05:55:07 -0700 | [diff] [blame] | 42 | import android.util.proto.ProtoOutputStream; |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 43 | |
Yunfan Chen | b29cbfd | 2019-01-24 17:30:33 +0900 | [diff] [blame] | 44 | import com.android.internal.annotations.VisibleForTesting; |
| 45 | |
Wale Ogunwale | ab5de37 | 2017-10-18 06:46:31 -0700 | [diff] [blame] | 46 | import java.io.PrintWriter; |
Wale Ogunwale | 034a8ec | 2017-09-02 17:14:40 -0700 | [diff] [blame] | 47 | import java.util.ArrayList; |
| 48 | |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 49 | /** |
| 50 | * Contains common logic for classes that have override configurations and are organized in a |
| 51 | * hierarchy. |
| 52 | */ |
Wale Ogunwale | 98d6231 | 2017-07-12 09:24:56 -0700 | [diff] [blame] | 53 | public abstract class ConfigurationContainer<E extends ConfigurationContainer> { |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 54 | /** |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 55 | * {@link #Rect} returned from {@link #getRequestedOverrideBounds()} to prevent original value |
| 56 | * from being set directly. |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 57 | */ |
| 58 | private Rect mReturnBounds = new Rect(); |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 59 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Contains requested override configuration settings applied to this configuration container. |
| 62 | */ |
| 63 | private Configuration mRequestedOverrideConfiguration = new Configuration(); |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 64 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 65 | /** |
| 66 | * Contains the requested override configuration with parent and policy constraints applied. |
| 67 | * This is the set of overrides that gets applied to the full and merged configurations. |
| 68 | */ |
| 69 | private Configuration mResolvedOverrideConfiguration = new Configuration(); |
| 70 | |
| 71 | /** True if mRequestedOverrideConfiguration is not empty */ |
Adrian Roos | 4921ccf | 2017-09-28 16:54:06 +0200 | [diff] [blame] | 72 | private boolean mHasOverrideConfiguration; |
| 73 | |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 74 | /** |
| 75 | * Contains full configuration applied to this configuration container. Corresponds to full |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 76 | * parent's config with applied {@link #mResolvedOverrideConfiguration}. |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 77 | */ |
| 78 | private Configuration mFullConfiguration = new Configuration(); |
| 79 | |
| 80 | /** |
| 81 | * Contains merged override configuration settings from the top of the hierarchy down to this |
| 82 | * particular instance. It is different from {@link #mFullConfiguration} because it starts from |
| 83 | * topmost container's override config instead of global config. |
| 84 | */ |
| 85 | private Configuration mMergedOverrideConfiguration = new Configuration(); |
| 86 | |
Wale Ogunwale | 034a8ec | 2017-09-02 17:14:40 -0700 | [diff] [blame] | 87 | private ArrayList<ConfigurationContainerListener> mChangeListeners = new ArrayList<>(); |
| 88 | |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 89 | // TODO: Can't have ag/2592611 soon enough! |
| 90 | private final Configuration mTmpConfig = new Configuration(); |
| 91 | |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 92 | // Used for setting bounds |
| 93 | private final Rect mTmpRect = new Rect(); |
| 94 | |
| 95 | static final int BOUNDS_CHANGE_NONE = 0; |
| 96 | // Return value from {@link setBounds} indicating the position of the override bounds changed. |
| 97 | static final int BOUNDS_CHANGE_POSITION = 1; |
| 98 | // Return value from {@link setBounds} indicating the size of the override bounds changed. |
| 99 | static final int BOUNDS_CHANGE_SIZE = 1 << 1; |
| 100 | |
| 101 | |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 102 | /** |
| 103 | * Returns full configuration applied to this configuration container. |
| 104 | * This method should be used for getting settings applied in each particular level of the |
| 105 | * hierarchy. |
| 106 | */ |
Wale Ogunwale | 98d6231 | 2017-07-12 09:24:56 -0700 | [diff] [blame] | 107 | public Configuration getConfiguration() { |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 108 | return mFullConfiguration; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Notify that parent config changed and we need to update full configuration. |
| 113 | * @see #mFullConfiguration |
| 114 | */ |
Wale Ogunwale | 98d6231 | 2017-07-12 09:24:56 -0700 | [diff] [blame] | 115 | public void onConfigurationChanged(Configuration newParentConfig) { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 116 | mTmpConfig.setTo(mResolvedOverrideConfiguration); |
| 117 | resolveOverrideConfiguration(newParentConfig); |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 118 | mFullConfiguration.setTo(newParentConfig); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 119 | mFullConfiguration.updateFrom(mResolvedOverrideConfiguration); |
| 120 | if (!mTmpConfig.equals(mResolvedOverrideConfiguration)) { |
| 121 | onMergedOverrideConfigurationChanged(); |
| 122 | // This depends on the assumption that change-listeners don't do |
| 123 | // their own override resolution. This way, dependent hierarchies |
| 124 | // can stay properly synced-up with a primary hierarchy's constraints. |
| 125 | // Since the hierarchies will be merged, this whole thing will go away |
| 126 | // before the assumption will be broken. |
| 127 | // Inform listeners of the change. |
| 128 | for (int i = mChangeListeners.size() - 1; i >= 0; --i) { |
| 129 | mChangeListeners.get(i).onRequestedOverrideConfigurationChanged( |
| 130 | mResolvedOverrideConfiguration); |
| 131 | } |
| 132 | } |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 133 | for (int i = getChildCount() - 1; i >= 0; --i) { |
| 134 | final ConfigurationContainer child = getChildAt(i); |
| 135 | child.onConfigurationChanged(mFullConfiguration); |
| 136 | } |
| 137 | } |
| 138 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 139 | /** |
| 140 | * Resolves the current requested override configuration into |
| 141 | * {@link #mResolvedOverrideConfiguration} |
| 142 | * |
| 143 | * @param newParentConfig The new parent configuration to resolve overrides against. |
| 144 | */ |
| 145 | void resolveOverrideConfiguration(Configuration newParentConfig) { |
| 146 | mResolvedOverrideConfiguration.setTo(mRequestedOverrideConfiguration); |
| 147 | } |
| 148 | |
| 149 | /** Returns requested override configuration applied to this configuration container. */ |
| 150 | public Configuration getRequestedOverrideConfiguration() { |
| 151 | return mRequestedOverrideConfiguration; |
| 152 | } |
| 153 | |
| 154 | /** Returns the resolved override configuration. */ |
| 155 | Configuration getResolvedOverrideConfiguration() { |
| 156 | return mResolvedOverrideConfiguration; |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Update override configuration and recalculate full config. |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 161 | * @see #mRequestedOverrideConfiguration |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 162 | * @see #mFullConfiguration |
| 163 | */ |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 164 | public void onRequestedOverrideConfigurationChanged(Configuration overrideConfiguration) { |
Adrian Roos | 4921ccf | 2017-09-28 16:54:06 +0200 | [diff] [blame] | 165 | // Pre-compute this here, so we don't need to go through the entire Configuration when |
| 166 | // writing to proto (which has significant cost if we write a lot of empty configurations). |
| 167 | mHasOverrideConfiguration = !Configuration.EMPTY.equals(overrideConfiguration); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 168 | mRequestedOverrideConfiguration.setTo(overrideConfiguration); |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 169 | // Update full configuration of this container and all its children. |
| 170 | final ConfigurationContainer parent = getParent(); |
| 171 | onConfigurationChanged(parent != null ? parent.getConfiguration() : Configuration.EMPTY); |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | /** |
| 175 | * Get merged override configuration from the top of the hierarchy down to this particular |
| 176 | * instance. This should be reported to client as override config. |
| 177 | */ |
Wale Ogunwale | 98d6231 | 2017-07-12 09:24:56 -0700 | [diff] [blame] | 178 | public Configuration getMergedOverrideConfiguration() { |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 179 | return mMergedOverrideConfiguration; |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Update merged override configuration based on corresponding parent's config and notify all |
| 184 | * its children. If there is no parent, merged override configuration will set equal to current |
| 185 | * override config. |
| 186 | * @see #mMergedOverrideConfiguration |
| 187 | */ |
Wale Ogunwale | 98d6231 | 2017-07-12 09:24:56 -0700 | [diff] [blame] | 188 | void onMergedOverrideConfigurationChanged() { |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 189 | final ConfigurationContainer parent = getParent(); |
| 190 | if (parent != null) { |
| 191 | mMergedOverrideConfiguration.setTo(parent.getMergedOverrideConfiguration()); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 192 | mMergedOverrideConfiguration.updateFrom(mResolvedOverrideConfiguration); |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 193 | } else { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 194 | mMergedOverrideConfiguration.setTo(mResolvedOverrideConfiguration); |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 195 | } |
| 196 | for (int i = getChildCount() - 1; i >= 0; --i) { |
| 197 | final ConfigurationContainer child = getChildAt(i); |
| 198 | child.onMergedOverrideConfigurationChanged(); |
| 199 | } |
| 200 | } |
| 201 | |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 202 | /** |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 203 | * Indicates whether this container has not requested any bounds different from its parent. In |
| 204 | * this case, it will inherit the bounds of the first ancestor which specifies a bounds subject |
| 205 | * to policy constraints. |
| 206 | * |
| 207 | * @return {@code true} if no explicit bounds have been requested at this container level. |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 208 | * {@code false} otherwise. |
| 209 | */ |
| 210 | public boolean matchParentBounds() { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 211 | return getRequestedOverrideBounds().isEmpty(); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | /** |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 215 | * Returns whether the bounds specified are considered the same as the existing requested |
| 216 | * override bounds. This is either when the two bounds are equal or the requested override |
| 217 | * bounds are empty and the specified bounds is null. |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 218 | * |
| 219 | * @return {@code true} if the bounds are equivalent, {@code false} otherwise |
| 220 | */ |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 221 | public boolean equivalentRequestedOverrideBounds(Rect bounds) { |
| 222 | return equivalentBounds(getRequestedOverrideBounds(), bounds); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Returns whether the two bounds are equal to each other or are a combination of null or empty. |
| 227 | */ |
| 228 | public static boolean equivalentBounds(Rect bounds, Rect other) { |
| 229 | return bounds == other |
| 230 | || (bounds != null && (bounds.equals(other) || (bounds.isEmpty() && other == null))) |
| 231 | || (other != null && other.isEmpty() && bounds == null); |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Returns the effective bounds of this container, inheriting the first non-empty bounds set in |
| 236 | * its ancestral hierarchy, including itself. |
| 237 | * @return |
| 238 | */ |
| 239 | public Rect getBounds() { |
| 240 | mReturnBounds.set(getConfiguration().windowConfiguration.getBounds()); |
| 241 | return mReturnBounds; |
| 242 | } |
| 243 | |
| 244 | public void getBounds(Rect outBounds) { |
| 245 | outBounds.set(getBounds()); |
| 246 | } |
| 247 | |
| 248 | /** |
Adrian Roos | 7af9d97 | 2018-11-30 15:26:27 +0100 | [diff] [blame] | 249 | * Sets {@code out} to the top-left corner of the bounds as returned by {@link #getBounds()}. |
| 250 | */ |
| 251 | public void getPosition(Point out) { |
| 252 | Rect bounds = getBounds(); |
| 253 | out.set(bounds.left, bounds.top); |
| 254 | } |
| 255 | |
| 256 | /** |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 257 | * Returns the bounds requested on this container. These may not be the actual bounds the |
| 258 | * container ends up with due to policy constraints. The {@link Rect} handed back is |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 259 | * shared for all calls to this method and should not be modified. |
| 260 | */ |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 261 | public Rect getRequestedOverrideBounds() { |
| 262 | mReturnBounds.set(getRequestedOverrideConfiguration().windowConfiguration.getBounds()); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 263 | |
| 264 | return mReturnBounds; |
| 265 | } |
| 266 | |
| 267 | /** |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 268 | * Returns {@code true} if the {@link WindowConfiguration} in the requested override |
Bryce Lee | d92ae48 | 2018-01-22 13:56:23 -0800 | [diff] [blame] | 269 | * {@link Configuration} specifies bounds. |
| 270 | */ |
| 271 | public boolean hasOverrideBounds() { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 272 | return !getRequestedOverrideBounds().isEmpty(); |
Bryce Lee | d92ae48 | 2018-01-22 13:56:23 -0800 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | /** |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 276 | * Sets the passed in {@link Rect} to the current bounds. |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 277 | * @see {@link #getRequestedOverrideBounds()}. |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 278 | */ |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 279 | public void getRequestedOverrideBounds(Rect outBounds) { |
| 280 | outBounds.set(getRequestedOverrideBounds()); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Sets the bounds at the current hierarchy level, overriding any bounds set on an ancestor. |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 285 | * This value will be reported when {@link #getBounds()} and |
| 286 | * {@link #getRequestedOverrideBounds()}. If |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 287 | * an empty {@link Rect} or null is specified, this container will be considered to match its |
| 288 | * parent bounds {@see #matchParentBounds} and will inherit bounds from its parent. |
| 289 | * @param bounds The bounds defining the container size. |
| 290 | * @return a bitmask representing the types of changes made to the bounds. |
| 291 | */ |
| 292 | public int setBounds(Rect bounds) { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 293 | int boundsChange = diffRequestedOverrideBounds(bounds); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 294 | |
| 295 | if (boundsChange == BOUNDS_CHANGE_NONE) { |
| 296 | return boundsChange; |
| 297 | } |
| 298 | |
| 299 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 300 | mTmpConfig.setTo(getRequestedOverrideConfiguration()); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 301 | mTmpConfig.windowConfiguration.setBounds(bounds); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 302 | onRequestedOverrideConfigurationChanged(mTmpConfig); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 303 | |
| 304 | return boundsChange; |
| 305 | } |
| 306 | |
| 307 | public int setBounds(int left, int top, int right, int bottom) { |
| 308 | mTmpRect.set(left, top, right, bottom); |
| 309 | return setBounds(mTmpRect); |
| 310 | } |
| 311 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 312 | int diffRequestedOverrideBounds(Rect bounds) { |
| 313 | if (equivalentRequestedOverrideBounds(bounds)) { |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 314 | return BOUNDS_CHANGE_NONE; |
| 315 | } |
| 316 | |
| 317 | int boundsChange = BOUNDS_CHANGE_NONE; |
| 318 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 319 | final Rect existingBounds = getRequestedOverrideBounds(); |
Bryce Lee | f3c6a47 | 2017-11-14 14:53:06 -0800 | [diff] [blame] | 320 | |
| 321 | if (bounds == null || existingBounds.left != bounds.left |
| 322 | || existingBounds.top != bounds.top) { |
| 323 | boundsChange |= BOUNDS_CHANGE_POSITION; |
| 324 | } |
| 325 | |
| 326 | if (bounds == null || existingBounds.width() != bounds.width() |
| 327 | || existingBounds.height() != bounds.height()) { |
| 328 | boundsChange |= BOUNDS_CHANGE_SIZE; |
| 329 | } |
| 330 | |
| 331 | return boundsChange; |
| 332 | } |
| 333 | |
Nataniel Borges | 023ecb5 | 2019-01-16 14:15:43 -0800 | [diff] [blame] | 334 | boolean hasOverrideConfiguration() { |
| 335 | return mHasOverrideConfiguration; |
| 336 | } |
| 337 | |
Wale Ogunwale | 3382ab1 | 2017-07-27 08:55:03 -0700 | [diff] [blame] | 338 | public WindowConfiguration getWindowConfiguration() { |
| 339 | return mFullConfiguration.windowConfiguration; |
| 340 | } |
| 341 | |
| 342 | /** Returns the windowing mode the configuration container is currently in. */ |
| 343 | public int getWindowingMode() { |
| 344 | return mFullConfiguration.windowConfiguration.getWindowingMode(); |
| 345 | } |
| 346 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 347 | /** Returns the windowing mode override that is requested by this container. */ |
| 348 | public int getRequestedOverrideWindowingMode() { |
| 349 | return mRequestedOverrideConfiguration.windowConfiguration.getWindowingMode(); |
Evan Rosky | 1047574 | 2018-09-05 19:02:48 -0700 | [diff] [blame] | 350 | } |
| 351 | |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 352 | /** Sets the requested windowing mode override for the configuration container. */ |
Wale Ogunwale | eea34ee9 | 2017-08-31 20:07:45 -0700 | [diff] [blame] | 353 | public void setWindowingMode(/*@WindowConfiguration.WindowingMode*/ int windowingMode) { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 354 | mTmpConfig.setTo(getRequestedOverrideConfiguration()); |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 355 | mTmpConfig.windowConfiguration.setWindowingMode(windowingMode); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 356 | onRequestedOverrideConfigurationChanged(mTmpConfig); |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 357 | } |
| 358 | |
Kazuki Takise | 148d00a | 2018-05-31 15:32:19 +0900 | [diff] [blame] | 359 | /** Sets the always on top flag for this configuration container. |
| 360 | * When you call this function, make sure that the following functions are called as well to |
| 361 | * keep proper z-order. |
| 362 | * - {@Link DisplayContent#positionStackAt(POSITION_TOP, TaskStack)}; |
| 363 | * - {@Link ActivityDisplay#positionChildAtTop(ActivityStack)}; |
| 364 | * */ |
| 365 | public void setAlwaysOnTop(boolean alwaysOnTop) { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 366 | mTmpConfig.setTo(getRequestedOverrideConfiguration()); |
Kazuki Takise | 148d00a | 2018-05-31 15:32:19 +0900 | [diff] [blame] | 367 | mTmpConfig.windowConfiguration.setAlwaysOnTop(alwaysOnTop); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 368 | onRequestedOverrideConfigurationChanged(mTmpConfig); |
Kazuki Takise | 148d00a | 2018-05-31 15:32:19 +0900 | [diff] [blame] | 369 | } |
| 370 | |
Yunfan Chen | 7daa6ac | 2018-11-29 18:16:44 -0800 | [diff] [blame] | 371 | /** Sets the windowing mode for the configuration container. */ |
| 372 | void setDisplayWindowingMode(int windowingMode) { |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 373 | mTmpConfig.setTo(getRequestedOverrideConfiguration()); |
Yunfan Chen | 7daa6ac | 2018-11-29 18:16:44 -0800 | [diff] [blame] | 374 | mTmpConfig.windowConfiguration.setDisplayWindowingMode(windowingMode); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 375 | onRequestedOverrideConfigurationChanged(mTmpConfig); |
Yunfan Chen | 7daa6ac | 2018-11-29 18:16:44 -0800 | [diff] [blame] | 376 | } |
| 377 | |
Wale Ogunwale | 04a05ac | 2017-09-17 21:35:02 -0700 | [diff] [blame] | 378 | /** |
| 379 | * Returns true if this container is currently in multi-window mode. I.e. sharing the screen |
| 380 | * with another activity. |
| 381 | */ |
| 382 | public boolean inMultiWindowMode() { |
| 383 | /*@WindowConfiguration.WindowingMode*/ int windowingMode = |
| 384 | mFullConfiguration.windowConfiguration.getWindowingMode(); |
| 385 | return windowingMode != WINDOWING_MODE_FULLSCREEN |
| 386 | && windowingMode != WINDOWING_MODE_UNDEFINED; |
| 387 | } |
| 388 | |
Wale Ogunwale | 926aade | 2017-08-29 11:24:37 -0700 | [diff] [blame] | 389 | /** Returns true if this container is currently in split-screen windowing mode. */ |
| 390 | public boolean inSplitScreenWindowingMode() { |
Wale Ogunwale | 5acab1c | 2017-09-08 07:45:08 -0700 | [diff] [blame] | 391 | /*@WindowConfiguration.WindowingMode*/ int windowingMode = |
Wale Ogunwale | 926aade | 2017-08-29 11:24:37 -0700 | [diff] [blame] | 392 | mFullConfiguration.windowConfiguration.getWindowingMode(); |
| 393 | |
| 394 | return windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY |
| 395 | || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; |
| 396 | } |
| 397 | |
| 398 | /** Returns true if this container is currently in split-screen secondary windowing mode. */ |
| 399 | public boolean inSplitScreenSecondaryWindowingMode() { |
Wale Ogunwale | 5acab1c | 2017-09-08 07:45:08 -0700 | [diff] [blame] | 400 | /*@WindowConfiguration.WindowingMode*/ int windowingMode = |
Wale Ogunwale | 926aade | 2017-08-29 11:24:37 -0700 | [diff] [blame] | 401 | mFullConfiguration.windowConfiguration.getWindowingMode(); |
| 402 | |
| 403 | return windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; |
| 404 | } |
| 405 | |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 406 | public boolean inSplitScreenPrimaryWindowingMode() { |
| 407 | return mFullConfiguration.windowConfiguration.getWindowingMode() |
| 408 | == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; |
| 409 | } |
| 410 | |
Wale Ogunwale | 926aade | 2017-08-29 11:24:37 -0700 | [diff] [blame] | 411 | /** |
| 412 | * Returns true if this container can be put in either |
| 413 | * {@link WindowConfiguration#WINDOWING_MODE_SPLIT_SCREEN_PRIMARY} or |
| 414 | * {@link WindowConfiguration##WINDOWING_MODE_SPLIT_SCREEN_SECONDARY} windowing modes based on |
| 415 | * its current state. |
| 416 | */ |
Wale Ogunwale | 04a05ac | 2017-09-17 21:35:02 -0700 | [diff] [blame] | 417 | public boolean supportsSplitScreenWindowingMode() { |
Wale Ogunwale | 926aade | 2017-08-29 11:24:37 -0700 | [diff] [blame] | 418 | return mFullConfiguration.windowConfiguration.supportSplitScreenWindowingMode(); |
| 419 | } |
| 420 | |
Wale Ogunwale | 44f036f | 2017-09-29 05:09:09 -0700 | [diff] [blame] | 421 | public boolean inPinnedWindowingMode() { |
| 422 | return mFullConfiguration.windowConfiguration.getWindowingMode() == WINDOWING_MODE_PINNED; |
| 423 | } |
| 424 | |
| 425 | public boolean inFreeformWindowingMode() { |
| 426 | return mFullConfiguration.windowConfiguration.getWindowingMode() == WINDOWING_MODE_FREEFORM; |
| 427 | } |
| 428 | |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 429 | /** Returns the activity type associated with the the configuration container. */ |
Wale Ogunwale | eea34ee9 | 2017-08-31 20:07:45 -0700 | [diff] [blame] | 430 | /*@WindowConfiguration.ActivityType*/ |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 431 | public int getActivityType() { |
| 432 | return mFullConfiguration.windowConfiguration.getActivityType(); |
| 433 | } |
| 434 | |
| 435 | /** Sets the activity type to associate with the configuration container. */ |
Wale Ogunwale | eea34ee9 | 2017-08-31 20:07:45 -0700 | [diff] [blame] | 436 | public void setActivityType(/*@WindowConfiguration.ActivityType*/ int activityType) { |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 437 | int currentActivityType = getActivityType(); |
| 438 | if (currentActivityType == activityType) { |
| 439 | return; |
| 440 | } |
| 441 | if (currentActivityType != ACTIVITY_TYPE_UNDEFINED) { |
| 442 | throw new IllegalStateException("Can't change activity type once set: " + this |
| 443 | + " activityType=" + activityTypeToString(activityType)); |
| 444 | } |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 445 | mTmpConfig.setTo(getRequestedOverrideConfiguration()); |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 446 | mTmpConfig.windowConfiguration.setActivityType(activityType); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 447 | onRequestedOverrideConfigurationChanged(mTmpConfig); |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 448 | } |
| 449 | |
| 450 | public boolean isActivityTypeHome() { |
| 451 | return getActivityType() == ACTIVITY_TYPE_HOME; |
| 452 | } |
| 453 | |
| 454 | public boolean isActivityTypeRecents() { |
| 455 | return getActivityType() == ACTIVITY_TYPE_RECENTS; |
| 456 | } |
| 457 | |
| 458 | public boolean isActivityTypeAssistant() { |
| 459 | return getActivityType() == ACTIVITY_TYPE_ASSISTANT; |
| 460 | } |
| 461 | |
| 462 | public boolean isActivityTypeStandard() { |
| 463 | return getActivityType() == ACTIVITY_TYPE_STANDARD; |
| 464 | } |
| 465 | |
Wale Ogunwale | 034a8ec | 2017-09-02 17:14:40 -0700 | [diff] [blame] | 466 | public boolean isActivityTypeStandardOrUndefined() { |
| 467 | /*@WindowConfiguration.ActivityType*/ final int activityType = getActivityType(); |
| 468 | return activityType == ACTIVITY_TYPE_STANDARD || activityType == ACTIVITY_TYPE_UNDEFINED; |
| 469 | } |
| 470 | |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 471 | public boolean hasCompatibleActivityType(ConfigurationContainer other) { |
Wale Ogunwale | eea34ee9 | 2017-08-31 20:07:45 -0700 | [diff] [blame] | 472 | /*@WindowConfiguration.ActivityType*/ int thisType = getActivityType(); |
| 473 | /*@WindowConfiguration.ActivityType*/ int otherType = other.getActivityType(); |
Wale Ogunwale | 6fbde9f | 2017-08-24 07:24:12 -0700 | [diff] [blame] | 474 | |
Wale Ogunwale | 9dcf946 | 2017-09-19 15:13:01 -0700 | [diff] [blame] | 475 | if (thisType == otherType) { |
| 476 | return true; |
| 477 | } |
| 478 | if (thisType == ACTIVITY_TYPE_ASSISTANT) { |
| 479 | // Assistant activities are only compatible with themselves... |
| 480 | return false; |
| 481 | } |
| 482 | // Otherwise we are compatible if us or other is not currently defined. |
| 483 | return thisType == ACTIVITY_TYPE_UNDEFINED || otherType == ACTIVITY_TYPE_UNDEFINED; |
Wale Ogunwale | 687b427 | 2017-07-27 02:56:23 -0700 | [diff] [blame] | 484 | } |
| 485 | |
Wale Ogunwale | b62139d | 2017-09-20 15:37:35 -0700 | [diff] [blame] | 486 | /** |
| 487 | * Returns true if this container is compatible with the input windowing mode and activity type. |
Wale Ogunwale | 04a05ac | 2017-09-17 21:35:02 -0700 | [diff] [blame] | 488 | * The container is compatible: |
| 489 | * - If {@param activityType} and {@param windowingMode} match this container activity type and |
| 490 | * windowing mode. |
| 491 | * - If {@param activityType} is {@link WindowConfiguration#ACTIVITY_TYPE_UNDEFINED} or |
| 492 | * {@link WindowConfiguration#ACTIVITY_TYPE_STANDARD} and this containers activity type is also |
| 493 | * standard or undefined and its windowing mode matches {@param windowingMode}. |
| 494 | * - If {@param activityType} isn't {@link WindowConfiguration#ACTIVITY_TYPE_UNDEFINED} or |
| 495 | * {@link WindowConfiguration#ACTIVITY_TYPE_STANDARD} or this containers activity type isn't |
| 496 | * also standard or undefined and its activity type matches {@param activityType} regardless of |
| 497 | * if {@param windowingMode} matches the containers windowing mode. |
Wale Ogunwale | b62139d | 2017-09-20 15:37:35 -0700 | [diff] [blame] | 498 | */ |
| 499 | public boolean isCompatible(int windowingMode, int activityType) { |
| 500 | final int thisActivityType = getActivityType(); |
| 501 | final int thisWindowingMode = getWindowingMode(); |
| 502 | final boolean sameActivityType = thisActivityType == activityType; |
| 503 | final boolean sameWindowingMode = thisWindowingMode == windowingMode; |
| 504 | |
| 505 | if (sameActivityType && sameWindowingMode) { |
| 506 | return true; |
| 507 | } |
| 508 | |
Wale Ogunwale | 04a05ac | 2017-09-17 21:35:02 -0700 | [diff] [blame] | 509 | if ((activityType != ACTIVITY_TYPE_UNDEFINED && activityType != ACTIVITY_TYPE_STANDARD) |
| 510 | || !isActivityTypeStandardOrUndefined()) { |
Wale Ogunwale | b62139d | 2017-09-20 15:37:35 -0700 | [diff] [blame] | 511 | // Only activity type need to match for non-standard activity types that are defined. |
| 512 | return sameActivityType; |
| 513 | } |
| 514 | |
| 515 | // Otherwise we are compatible if the windowing mode is the same. |
| 516 | return sameWindowingMode; |
| 517 | } |
| 518 | |
Wale Ogunwale | 034a8ec | 2017-09-02 17:14:40 -0700 | [diff] [blame] | 519 | public void registerConfigurationChangeListener(ConfigurationContainerListener listener) { |
| 520 | if (mChangeListeners.contains(listener)) { |
| 521 | return; |
| 522 | } |
| 523 | mChangeListeners.add(listener); |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 524 | listener.onRequestedOverrideConfigurationChanged(mResolvedOverrideConfiguration); |
Wale Ogunwale | 034a8ec | 2017-09-02 17:14:40 -0700 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | public void unregisterConfigurationChangeListener(ConfigurationContainerListener listener) { |
| 528 | mChangeListeners.remove(listener); |
| 529 | } |
| 530 | |
Yunfan Chen | b29cbfd | 2019-01-24 17:30:33 +0900 | [diff] [blame] | 531 | @VisibleForTesting |
| 532 | boolean containsListener(ConfigurationContainerListener listener) { |
| 533 | return mChangeListeners.contains(listener); |
| 534 | } |
| 535 | |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 536 | /** |
| 537 | * Must be called when new parent for the container was set. |
| 538 | */ |
Riddle Hsu | 3a4bb61 | 2019-01-31 00:02:22 +0800 | [diff] [blame] | 539 | void onParentChanged() { |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 540 | final ConfigurationContainer parent = getParent(); |
Andrii Kulian | b94292e | 2016-10-19 13:30:58 -0700 | [diff] [blame] | 541 | // Removing parent usually means that we've detached this entity to destroy it or to attach |
| 542 | // to another parent. In both cases we don't need to update the configuration now. |
| 543 | if (parent != null) { |
| 544 | // Update full configuration of this container and all its children. |
| 545 | onConfigurationChanged(parent.mFullConfiguration); |
| 546 | // Update merged override configuration of this container and all its children. |
| 547 | onMergedOverrideConfigurationChanged(); |
| 548 | } |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 549 | } |
| 550 | |
Wale Ogunwale | 0d5609b | 2017-09-13 05:55:07 -0700 | [diff] [blame] | 551 | /** |
| 552 | * Write to a protocol buffer output stream. Protocol buffer message definition is at |
Yi Jin | 6c6e9ca | 2018-03-20 16:53:35 -0700 | [diff] [blame] | 553 | * {@link com.android.server.wm.ConfigurationContainerProto}. |
Wale Ogunwale | 0d5609b | 2017-09-13 05:55:07 -0700 | [diff] [blame] | 554 | * |
Adrian Roos | 4921ccf | 2017-09-28 16:54:06 +0200 | [diff] [blame] | 555 | * @param proto Stream to write the ConfigurationContainer object to. |
| 556 | * @param fieldId Field Id of the ConfigurationContainer as defined in the parent |
| 557 | * message. |
Nataniel Borges | 023ecb5 | 2019-01-16 14:15:43 -0800 | [diff] [blame] | 558 | * @param logLevel Determines the amount of data to be written to the Protobuf. |
Wale Ogunwale | 0d5609b | 2017-09-13 05:55:07 -0700 | [diff] [blame] | 559 | * @hide |
| 560 | */ |
| 561 | @CallSuper |
Nataniel Borges | 023ecb5 | 2019-01-16 14:15:43 -0800 | [diff] [blame] | 562 | protected void writeToProto(ProtoOutputStream proto, long fieldId, |
| 563 | @WindowTraceLogLevel int logLevel) { |
| 564 | // Critical log level logs only visible elements to mitigate performance overheard |
| 565 | if (logLevel != WindowTraceLogLevel.ALL && !mHasOverrideConfiguration) { |
| 566 | return; |
Adrian Roos | 4921ccf | 2017-09-28 16:54:06 +0200 | [diff] [blame] | 567 | } |
Nataniel Borges | 023ecb5 | 2019-01-16 14:15:43 -0800 | [diff] [blame] | 568 | |
| 569 | final long token = proto.start(fieldId); |
| 570 | mRequestedOverrideConfiguration.writeToProto(proto, OVERRIDE_CONFIGURATION, |
lumark | 137cc51 | 2019-02-18 15:00:47 +0800 | [diff] [blame] | 571 | logLevel == WindowTraceLogLevel.CRITICAL); |
Nataniel Borges | 023ecb5 | 2019-01-16 14:15:43 -0800 | [diff] [blame] | 572 | if (logLevel == WindowTraceLogLevel.ALL) { |
| 573 | mFullConfiguration.writeToProto(proto, FULL_CONFIGURATION, false /* critical */); |
| 574 | mMergedOverrideConfiguration.writeToProto(proto, MERGED_OVERRIDE_CONFIGURATION, |
| 575 | false /* critical */); |
Adrian Roos | 4921ccf | 2017-09-28 16:54:06 +0200 | [diff] [blame] | 576 | } |
| 577 | proto.end(token); |
Wale Ogunwale | 0d5609b | 2017-09-13 05:55:07 -0700 | [diff] [blame] | 578 | } |
| 579 | |
Wale Ogunwale | ab5de37 | 2017-10-18 06:46:31 -0700 | [diff] [blame] | 580 | /** |
| 581 | * Dumps the names of this container children in the input print writer indenting each |
| 582 | * level with the input prefix. |
| 583 | */ |
| 584 | public void dumpChildrenNames(PrintWriter pw, String prefix) { |
| 585 | final String childPrefix = prefix + " "; |
| 586 | pw.println(getName() |
| 587 | + " type=" + activityTypeToString(getActivityType()) |
Evan Rosky | 1047574 | 2018-09-05 19:02:48 -0700 | [diff] [blame] | 588 | + " mode=" + windowingModeToString(getWindowingMode()) |
Evan Rosky | dfe3da7 | 2018-10-26 17:21:06 -0700 | [diff] [blame] | 589 | + " override-mode=" + windowingModeToString(getRequestedOverrideWindowingMode())); |
Wale Ogunwale | ab5de37 | 2017-10-18 06:46:31 -0700 | [diff] [blame] | 590 | for (int i = getChildCount() - 1; i >= 0; --i) { |
| 591 | final E cc = getChildAt(i); |
| 592 | pw.print(childPrefix + "#" + i + " "); |
| 593 | cc.dumpChildrenNames(pw, childPrefix); |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | String getName() { |
| 598 | return toString(); |
| 599 | } |
| 600 | |
Kazuki Takise | 148d00a | 2018-05-31 15:32:19 +0900 | [diff] [blame] | 601 | public boolean isAlwaysOnTop() { |
Robert Carr | b1579c8 | 2017-09-05 14:54:47 -0700 | [diff] [blame] | 602 | return mFullConfiguration.windowConfiguration.isAlwaysOnTop(); |
| 603 | } |
| 604 | |
Andrii Kulian | 1779e61 | 2016-10-12 21:58:25 -0700 | [diff] [blame] | 605 | abstract protected int getChildCount(); |
| 606 | |
| 607 | abstract protected E getChildAt(int index); |
| 608 | |
| 609 | abstract protected ConfigurationContainer getParent(); |
| 610 | } |