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

Commit 01d2fe9b authored by Tiger's avatar Tiger
Browse files

Remove redundant WindowContainerInsetsSourceProvider

It has been the same as InsetsSourceProvider. We don't need this derived
class.

Bug: 199449177
Test: presubmit
Change-Id: I89e649d05b6291325840ff29dccbceb7effc0fa1
parent 13abddd9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ import java.io.PrintWriter;
 * Controller for IME inset source on the server. It's called provider as it provides the
 * 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}.
 * {@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. */
    /** The token tracking the current IME request or {@code null} otherwise. */
    @Nullable
    @Nullable
+4 −5
Original line number Original line Diff line number Diff line
@@ -223,10 +223,10 @@ class InsetsPolicy {


        startAnimation(false /* show */, () -> {
        startAnimation(false /* show */, () -> {
            synchronized (mDisplayContent.mWmService.mGlobalLock) {
            synchronized (mDisplayContent.mWmService.mGlobalLock) {
                final SparseArray<WindowContainerInsetsSourceProvider> providers =
                final SparseArray<InsetsSourceProvider> providers =
                        mStateController.getSourceProviders();
                        mStateController.getSourceProviders();
                for (int i = providers.size() - 1; i >= 0; i--) {
                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())) {
                    if (!isTransient(provider.getSource().getType())) {
                        continue;
                        continue;
                    }
                    }
@@ -337,11 +337,10 @@ class InsetsPolicy {
            state.removeSource(InsetsState.ITYPE_CAPTION_BAR);
            state.removeSource(InsetsState.ITYPE_CAPTION_BAR);
        }
        }


        final SparseArray<WindowContainerInsetsSourceProvider> providers =
        final SparseArray<InsetsSourceProvider> providers = mStateController.getSourceProviders();
                mStateController.getSourceProviders();
        final int windowType = attrs.type;
        final int windowType = attrs.type;
        for (int i = providers.size() - 1; i >= 0; i--) {
        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 (otherProvider.overridesFrame(windowType)) {
                if (state == originalState) {
                if (state == originalState) {
                    state = new InsetsState(state);
                    state = new InsetsState(state);
+1 −1
Original line number Original line Diff line number Diff line
@@ -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
 * 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}.
 * {@link InsetsSource} to the client that uses it in {@link android.view.InsetsSourceConsumer}.
 */
 */
abstract class InsetsSourceProvider {
class InsetsSourceProvider {


    protected final DisplayContent mDisplayContent;
    protected final DisplayContent mDisplayContent;
    protected final @NonNull InsetsSource mSource;
    protected final @NonNull InsetsSource mSource;
+6 −6
Original line number Original line Diff line number Diff line
@@ -56,7 +56,7 @@ class InsetsStateController {
    private final InsetsState mState = new InsetsState();
    private final InsetsState mState = new InsetsState();
    private final DisplayContent mDisplayContent;
    private final DisplayContent mDisplayContent;


    private final SparseArray<WindowContainerInsetsSourceProvider> mProviders = new SparseArray<>();
    private final SparseArray<InsetsSourceProvider> mProviders = new SparseArray<>();
    private final ArrayMap<InsetsControlTarget, ArrayList<InsetsSourceProvider>>
    private final ArrayMap<InsetsControlTarget, ArrayList<InsetsSourceProvider>>
            mControlTargetProvidersMap = new ArrayMap<>();
            mControlTargetProvidersMap = new ArrayMap<>();
    private final SparseArray<InsetsControlTarget> mIdControlTargetMap = new SparseArray<>();
    private final SparseArray<InsetsControlTarget> mIdControlTargetMap = new SparseArray<>();
@@ -106,22 +106,22 @@ class InsetsStateController {
        return result;
        return result;
    }
    }


    SparseArray<WindowContainerInsetsSourceProvider> getSourceProviders() {
    SparseArray<InsetsSourceProvider> getSourceProviders() {
        return mProviders;
        return mProviders;
    }
    }


    /**
    /**
     * @return The provider of a specific source ID.
     * @return The provider of a specific source ID.
     */
     */
    WindowContainerInsetsSourceProvider getOrCreateSourceProvider(int id, @InsetsType int type) {
    InsetsSourceProvider getOrCreateSourceProvider(int id, @InsetsType int type) {
        WindowContainerInsetsSourceProvider provider = mProviders.get(id);
        InsetsSourceProvider provider = mProviders.get(id);
        if (provider != null) {
        if (provider != null) {
            return provider;
            return provider;
        }
        }
        final InsetsSource source = mState.getOrCreateSource(id, type);
        final InsetsSource source = mState.getOrCreateSource(id, type);
        provider = id == ID_IME
        provider = id == ID_IME
                ? new ImeInsetsSourceProvider(source, this, mDisplayContent)
                ? new ImeInsetsSourceProvider(source, this, mDisplayContent)
                : new WindowContainerInsetsSourceProvider(source, this, mDisplayContent);
                : new InsetsSourceProvider(source, this, mDisplayContent);
        mProviders.put(id, provider);
        mProviders.put(id, provider);
        return provider;
        return provider;
    }
    }
@@ -334,7 +334,7 @@ class InsetsStateController {
        }
        }
        mDisplayContent.mWmService.mAnimator.addAfterPrepareSurfacesRunnable(() -> {
        mDisplayContent.mWmService.mAnimator.addAfterPrepareSurfacesRunnable(() -> {
            for (int i = mProviders.size() - 1; i >= 0; i--) {
            for (int i = mProviders.size() - 1; i >= 0; i--) {
                final WindowContainerInsetsSourceProvider provider = mProviders.valueAt(i);
                final InsetsSourceProvider provider = mProviders.valueAt(i);
                provider.onSurfaceTransactionApplied();
                provider.onSurfaceTransactionApplied();
            }
            }
            final ArraySet<InsetsControlTarget> newControlTargets = new ArraySet<>();
            final ArraySet<InsetsControlTarget> newControlTargets = new ArraySet<>();
+1 −1
Original line number Original line Diff line number Diff line
@@ -4122,7 +4122,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        }
        }


        private void hideInsetSourceViewOverflows() {
        private void hideInsetSourceViewOverflows() {
            final SparseArray<WindowContainerInsetsSourceProvider> providers =
            final SparseArray<InsetsSourceProvider> providers =
                    getDisplayContent().getInsetsStateController().getSourceProviders();
                    getDisplayContent().getInsetsStateController().getSourceProviders();
            for (int i = providers.size(); i >= 0; i--) {
            for (int i = providers.size(); i >= 0; i--) {
                final InsetsSourceProvider insetProvider = providers.valueAt(i);
                final InsetsSourceProvider insetProvider = providers.valueAt(i);
Loading