Winson Chung | 59a47ded | 2018-01-25 17:46:06 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2018 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 com.android.server.wm; |
| 18 | |
| 19 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STACK; |
| 20 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
| 21 | |
| 22 | import android.content.res.Configuration; |
| 23 | import android.util.Slog; |
| 24 | |
| 25 | /** |
| 26 | * Controller for the display container. This is created by activity manager to link activity |
| 27 | * displays to the display content they use in window manager. |
| 28 | */ |
| 29 | public class DisplayWindowController |
| 30 | extends WindowContainerController<DisplayContent, WindowContainerListener> { |
| 31 | |
| 32 | private final int mDisplayId; |
| 33 | |
| 34 | public DisplayWindowController(int displayId, WindowContainerListener listener) { |
| 35 | super(listener, WindowManagerService.getInstance()); |
| 36 | mDisplayId = displayId; |
| 37 | |
| 38 | synchronized (mWindowMap) { |
| 39 | // TODO: Convert to setContainer() from DisplayContent once everything is hooked up. |
| 40 | // Currently we are not setup to register for config changes. |
| 41 | mContainer = mRoot.getDisplayContentOrCreate(displayId); |
| 42 | if (mContainer == null) { |
| 43 | throw new IllegalArgumentException("Trying to add displayId=" + displayId); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public void removeContainer() { |
| 50 | // TODO: Pipe through from ActivityDisplay to remove the display |
| 51 | throw new UnsupportedOperationException("To be implemented"); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public void onOverrideConfigurationChanged(Configuration overrideConfiguration) { |
| 56 | // TODO: Pipe through from ActivityDisplay to update the configuration for the display |
| 57 | throw new UnsupportedOperationException("To be implemented"); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Positions the task stack at the given position in the task stack container. |
| 62 | */ |
| 63 | public void positionChildAt(StackWindowController child, int position) { |
| 64 | synchronized (mWindowMap) { |
| 65 | if (DEBUG_STACK) Slog.i(TAG_WM, "positionTaskStackAt: positioning stack=" + child |
| 66 | + " at " + position); |
| 67 | if (mContainer == null) { |
| 68 | if (DEBUG_STACK) Slog.i(TAG_WM, |
| 69 | "positionTaskStackAt: could not find display=" + mContainer); |
| 70 | return; |
| 71 | } |
| 72 | if (child.mContainer == null) { |
| 73 | if (DEBUG_STACK) Slog.i(TAG_WM, |
| 74 | "positionTaskStackAt: could not find stack=" + this); |
| 75 | return; |
| 76 | } |
| 77 | mContainer.positionStackAt(position, child.mContainer); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | @Override |
| 82 | public String toString() { |
| 83 | return "{DisplayWindowController displayId=" + mDisplayId + "}"; |
| 84 | } |
| 85 | } |