Merge "Remove redundant WindowContainerInsetsSourceProvider" into udc-dev
This commit is contained in:
@@ -48,7 +48,7 @@ import java.io.PrintWriter;
|
||||
* Controller for IME inset source on the server. It's called provider as it provides the
|
||||
* {@link InsetsSource} to the client that uses it in {@link InsetsSourceConsumer}.
|
||||
*/
|
||||
final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider {
|
||||
final class ImeInsetsSourceProvider extends InsetsSourceProvider {
|
||||
|
||||
/** The token tracking the current IME request or {@code null} otherwise. */
|
||||
@Nullable
|
||||
|
||||
@@ -223,10 +223,10 @@ class InsetsPolicy {
|
||||
|
||||
startAnimation(false /* show */, () -> {
|
||||
synchronized (mDisplayContent.mWmService.mGlobalLock) {
|
||||
final SparseArray<WindowContainerInsetsSourceProvider> providers =
|
||||
final SparseArray<InsetsSourceProvider> providers =
|
||||
mStateController.getSourceProviders();
|
||||
for (int i = providers.size() - 1; i >= 0; i--) {
|
||||
final WindowContainerInsetsSourceProvider provider = providers.valueAt(i);
|
||||
final InsetsSourceProvider provider = providers.valueAt(i);
|
||||
if (!isTransient(provider.getSource().getType())) {
|
||||
continue;
|
||||
}
|
||||
@@ -341,11 +341,10 @@ class InsetsPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
final SparseArray<WindowContainerInsetsSourceProvider> providers =
|
||||
mStateController.getSourceProviders();
|
||||
final SparseArray<InsetsSourceProvider> providers = mStateController.getSourceProviders();
|
||||
final int windowType = attrs.type;
|
||||
for (int i = providers.size() - 1; i >= 0; i--) {
|
||||
final WindowContainerInsetsSourceProvider otherProvider = providers.valueAt(i);
|
||||
final InsetsSourceProvider otherProvider = providers.valueAt(i);
|
||||
if (otherProvider.overridesFrame(windowType)) {
|
||||
if (state == originalState) {
|
||||
state = new InsetsState(state);
|
||||
|
||||
@@ -58,7 +58,7 @@ import java.util.function.Consumer;
|
||||
* Controller for a specific inset source on the server. It's called provider as it provides the
|
||||
* {@link InsetsSource} to the client that uses it in {@link android.view.InsetsSourceConsumer}.
|
||||
*/
|
||||
abstract class InsetsSourceProvider {
|
||||
class InsetsSourceProvider {
|
||||
|
||||
protected final DisplayContent mDisplayContent;
|
||||
protected final @NonNull InsetsSource mSource;
|
||||
|
||||
@@ -56,7 +56,7 @@ class InsetsStateController {
|
||||
private final InsetsState mState = new InsetsState();
|
||||
private final DisplayContent mDisplayContent;
|
||||
|
||||
private final SparseArray<WindowContainerInsetsSourceProvider> mProviders = new SparseArray<>();
|
||||
private final SparseArray<InsetsSourceProvider> mProviders = new SparseArray<>();
|
||||
private final ArrayMap<InsetsControlTarget, ArrayList<InsetsSourceProvider>>
|
||||
mControlTargetProvidersMap = new ArrayMap<>();
|
||||
private final SparseArray<InsetsControlTarget> mIdControlTargetMap = new SparseArray<>();
|
||||
@@ -106,22 +106,22 @@ class InsetsStateController {
|
||||
return result;
|
||||
}
|
||||
|
||||
SparseArray<WindowContainerInsetsSourceProvider> getSourceProviders() {
|
||||
SparseArray<InsetsSourceProvider> getSourceProviders() {
|
||||
return mProviders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The provider of a specific source ID.
|
||||
*/
|
||||
WindowContainerInsetsSourceProvider getOrCreateSourceProvider(int id, @InsetsType int type) {
|
||||
WindowContainerInsetsSourceProvider provider = mProviders.get(id);
|
||||
InsetsSourceProvider getOrCreateSourceProvider(int id, @InsetsType int type) {
|
||||
InsetsSourceProvider provider = mProviders.get(id);
|
||||
if (provider != null) {
|
||||
return provider;
|
||||
}
|
||||
final InsetsSource source = mState.getOrCreateSource(id, type);
|
||||
provider = id == ID_IME
|
||||
? new ImeInsetsSourceProvider(source, this, mDisplayContent)
|
||||
: new WindowContainerInsetsSourceProvider(source, this, mDisplayContent);
|
||||
: new InsetsSourceProvider(source, this, mDisplayContent);
|
||||
mProviders.put(id, provider);
|
||||
return provider;
|
||||
}
|
||||
@@ -334,7 +334,7 @@ class InsetsStateController {
|
||||
}
|
||||
mDisplayContent.mWmService.mAnimator.addAfterPrepareSurfacesRunnable(() -> {
|
||||
for (int i = mProviders.size() - 1; i >= 0; i--) {
|
||||
final WindowContainerInsetsSourceProvider provider = mProviders.valueAt(i);
|
||||
final InsetsSourceProvider provider = mProviders.valueAt(i);
|
||||
provider.onSurfaceTransactionApplied();
|
||||
}
|
||||
final ArraySet<InsetsControlTarget> newControlTargets = new ArraySet<>();
|
||||
|
||||
@@ -4122,7 +4122,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
}
|
||||
|
||||
private void hideInsetSourceViewOverflows() {
|
||||
final SparseArray<WindowContainerInsetsSourceProvider> providers =
|
||||
final SparseArray<InsetsSourceProvider> providers =
|
||||
getDisplayContent().getInsetsStateController().getSourceProviders();
|
||||
for (int i = providers.size(); i >= 0; i--) {
|
||||
final InsetsSourceProvider insetProvider = providers.valueAt(i);
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.view.InsetsSource;
|
||||
|
||||
/**
|
||||
* Controller for a specific inset source on the server. It's called provider as it provides the
|
||||
* {@link InsetsSource} to the client that uses it in {@link android.view.InsetsSourceConsumer}.
|
||||
*/
|
||||
class WindowContainerInsetsSourceProvider extends InsetsSourceProvider {
|
||||
// TODO(b/218734524): Move the window container specific stuff from InsetsSourceProvider to
|
||||
// this class.
|
||||
|
||||
WindowContainerInsetsSourceProvider(InsetsSource source,
|
||||
InsetsStateController stateController, DisplayContent displayContent) {
|
||||
super(source, stateController, displayContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,20 +42,20 @@ import org.junit.runner.RunWith;
|
||||
@SmallTest
|
||||
@Presubmit
|
||||
@RunWith(WindowTestRunner.class)
|
||||
public class WindowContainerInsetsSourceProviderTest extends WindowTestsBase {
|
||||
public class InsetsSourceProviderTest extends WindowTestsBase {
|
||||
|
||||
private InsetsSource mSource = new InsetsSource(
|
||||
InsetsSource.createId(null, 0, statusBars()), statusBars());
|
||||
private WindowContainerInsetsSourceProvider mProvider;
|
||||
private InsetsSourceProvider mProvider;
|
||||
private InsetsSource mImeSource = new InsetsSource(ID_IME, ime());
|
||||
private WindowContainerInsetsSourceProvider mImeProvider;
|
||||
private InsetsSourceProvider mImeProvider;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mSource.setVisible(true);
|
||||
mProvider = new WindowContainerInsetsSourceProvider(mSource,
|
||||
mProvider = new InsetsSourceProvider(mSource,
|
||||
mDisplayContent.getInsetsStateController(), mDisplayContent);
|
||||
mImeProvider = new WindowContainerInsetsSourceProvider(mImeSource,
|
||||
mImeProvider = new InsetsSourceProvider(mImeSource,
|
||||
mDisplayContent.getInsetsStateController(), mDisplayContent);
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
||||
// IME cannot be the IME target.
|
||||
ime.mAttrs.flags |= FLAG_NOT_FOCUSABLE;
|
||||
|
||||
WindowContainerInsetsSourceProvider statusBarProvider =
|
||||
InsetsSourceProvider statusBarProvider =
|
||||
getController().getOrCreateSourceProvider(ID_STATUS_BAR, statusBars());
|
||||
final SparseArray<TriConsumer<DisplayFrames, WindowContainer, Rect>> imeOverrideProviders =
|
||||
new SparseArray<>();
|
||||
@@ -353,7 +353,7 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
||||
public void testTransientVisibilityOfFixedRotationState() {
|
||||
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||
final WindowContainerInsetsSourceProvider provider = getController()
|
||||
final InsetsSourceProvider provider = getController()
|
||||
.getOrCreateSourceProvider(ID_STATUS_BAR, statusBars());
|
||||
provider.setWindowContainer(statusBar, null, null);
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ public class WindowContainerTests extends WindowTestsBase {
|
||||
windowState.mSurfaceAnimator).getAnimationType();
|
||||
assertTrue(parent.isAnimating(CHILDREN));
|
||||
|
||||
windowState.setControllableInsetProvider(mock(WindowContainerInsetsSourceProvider.class));
|
||||
windowState.setControllableInsetProvider(mock(InsetsSourceProvider.class));
|
||||
assertFalse(parent.isAnimating(CHILDREN));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user