Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5947c364 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove WindowContainerController

It is no longer used. Reference removal:
root 31acb3f1, stack 279f5585, task 0e7aff96, activity 1ee84ea6.

Bug: 80414790
Bug: 141248611
Test: go/wm-smoke
Change-Id: I23515d7ad5f218a70dfa05e5818a6ec2c2f857e8
parent cb17c921
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -84,8 +84,7 @@ import java.util.ArrayList;
 * Exactly one of these classes per Display in the system. Capable of holding zero or more
 * attached {@link ActivityStack}s.
 */
class ActivityDisplay extends ConfigurationContainer<ActivityStack>
        implements WindowContainerListener {
class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
    private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityDisplay" : TAG_ATM;
    private static final String TAG_STACK = TAG + POSTFIX_STACK;

@@ -201,11 +200,6 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
        }
    }

    @Override
    public void onInitializeOverrideConfiguration(Configuration config) {
        getRequestedOverrideConfiguration().updateFrom(config);
    }

    void addChild(ActivityStack stack, int position) {
        if (position == POSITION_BOTTOM) {
            position = 0;
@@ -291,9 +285,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
        }

        // Since positionChildAt() is called during the creation process of pinned stacks,
        // ActivityStack#getStack() can be null. In this special case,
        // since DisplayContest#positionStackAt() is called in TaskStack#onConfigurationChanged(),
        // we don't have to call WindowContainerController#positionChildAt() here.
        // ActivityStack#getStack() can be null.
        if (stack.getTaskStack() != null && mDisplayContent != null) {
            mDisplayContent.positionStackAt(insertPosition,
                    stack.getTaskStack(), includingParents);
@@ -1202,8 +1194,8 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
        // Stacks could be reparented from the removed display to other display. While
        // reparenting the last stack of the removed display, the remove display is ready to be
        // released (no more ActivityStack). But, we cannot release it at that moment or the
        // related WindowContainer and WindowContainerController will also be removed. So, we
        // set display as removed after reparenting stack finished.
        // related WindowContainer will also be removed. So, we set display as removed after
        // reparenting stack finished.
        final ActivityDisplay toDisplay = mRootActivityContainer.getDefaultDisplay();
        mRootActivityContainer.mStackSupervisor.beginDeferResume();
        try {
+2 −1
Original line number Diff line number Diff line
@@ -1145,7 +1145,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
     */
    void initializeDisplayOverrideConfiguration() {
        if (mAcitvityDisplay != null) {
            mAcitvityDisplay.onInitializeOverrideConfiguration(getRequestedOverrideConfiguration());
            mAcitvityDisplay.getRequestedOverrideConfiguration()
                    .updateFrom(getRequestedOverrideConfiguration());
        }
    }

+0 −25
Original line number Diff line number Diff line
@@ -106,9 +106,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    private final Pools.SynchronizedPool<ForAllWindowsConsumerWrapper> mConsumerWrapperPool =
            new Pools.SynchronizedPool<>(3);

    // The owner/creator for this container. No controller if null.
    WindowContainerController mController;

    // The display this window container is on.
    protected DisplayContent mDisplayContent;

@@ -356,11 +353,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        if (mParent != null) {
            mParent.removeChild(this);
        }

        if (mController != null) {
            setController(null);
        }

    }

    /**
@@ -1005,23 +997,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        } while (current != null);
    }

    WindowContainerController getController() {
        return mController;
    }

    void setController(WindowContainerController controller) {
        if (mController != null && controller != null) {
            throw new IllegalArgumentException("Can't set controller=" + mController
                    + " for container=" + this + " Already set to=" + mController);
        }
        if (controller != null) {
            controller.setContainer(this);
        } else if (mController != null) {
            mController.setContainer(null);
        }
        mController = controller;
    }

    SurfaceControl.Builder makeSurface() {
        final WindowContainer p = getParent();
        return p.makeChildSurface(this);
+0 −83
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.server.wm;

import android.content.res.Configuration;

/**
 * Class that allows the owner/creator of a {@link WindowContainer} to communicate directly with the
 * container and make changes.
 * Note that public calls (mostly in sub-classes) into this class are assumed to be originating from
 * outside the window manager so the window manager lock is held and appropriate permissions are
 * checked before calls are allowed to proceed.
 *
 * Test class: {@link WindowContainerControllerTests}
 */
class WindowContainerController<E extends WindowContainer, I extends WindowContainerListener>
        implements ConfigurationContainerListener {

    final WindowManagerService mService;
    final RootWindowContainer mRoot;
    final WindowManagerGlobalLock mGlobalLock;

    // The window container this controller owns.
    E mContainer;
    // Interface for communicating changes back to the owner.
    final I mListener;

    WindowContainerController(I listener, WindowManagerService service) {
        mListener = listener;
        mService = service;
        mRoot = mService != null ? mService.mRoot : null;
        mGlobalLock = mService != null ? mService.mGlobalLock : null;
    }

    void setContainer(E container) {
        if (mContainer != null && container != null) {
            throw new IllegalArgumentException("Can't set container=" + container
                    + " for controller=" + this + " Already set to=" + mContainer);
        }
        mContainer = container;
        if (mContainer != null && mListener != null) {
            mListener.registerConfigurationChangeListener(this);
        }
    }

    void removeContainer() {
        // TODO: See if most uses cases should support removeIfPossible here.
        //mContainer.removeIfPossible();
        if (mContainer == null) {
            return;
        }

        mContainer.setController(null);
        mContainer = null;
        if (mListener != null) {
            mListener.unregisterConfigurationChangeListener(this);
        }
    }

    @Override
    public void onRequestedOverrideConfigurationChanged(Configuration overrideConfiguration) {
        synchronized (mGlobalLock) {
            if (mContainer == null) {
                return;
            }
            mContainer.onRequestedOverrideConfigurationChanged(overrideConfiguration);
        }
    }
}
+0 −29
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.server.wm;

import android.content.res.Configuration;

/**
 * Interface used by the owner/creator of the container to listen to changes with the container.
 * @see WindowContainerController
 */
public interface WindowContainerListener {
    void registerConfigurationChangeListener(ConfigurationContainerListener listener);
    void unregisterConfigurationChangeListener(ConfigurationContainerListener listener);
    default void onInitializeOverrideConfiguration(Configuration config) {}
}
Loading