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

Commit 5e513c21 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing SurfaceControlCompat

Bug: 213421974
Test: Presubmit
Change-Id: I0193346bf5f17a3103279a6d40fa5b3a2fc89e02
parent 4b10475f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -183,8 +183,8 @@ public class RemoteAnimationAdapterCompat {
                    }
                    // Make wallpaper visible immediately since launcher apparently won't do this.
                    for (int i = wallpapersCompat.length - 1; i >= 0; --i) {
                        t.show(wallpapersCompat[i].leash.getSurfaceControl());
                        t.setAlpha(wallpapersCompat[i].leash.getSurfaceControl(), 1.f);
                        t.show(wallpapersCompat[i].leash);
                        t.setAlpha(wallpapersCompat[i].leash, 1.f);
                    }
                } else {
                    if (launcherTask != null) {
+7 −7
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public class RemoteAnimationTargetCompat {
    public final int activityType;

    public final int taskId;
    public final SurfaceControlCompat leash;
    public final SurfaceControl leash;
    public final boolean isTranslucent;
    public final Rect clipRect;
    public final int prefixOrderIndex;
@@ -82,7 +82,7 @@ public class RemoteAnimationTargetCompat {
    public RemoteAnimationTargetCompat(RemoteAnimationTarget app) {
        taskId = app.taskId;
        mode = app.mode;
        leash = new SurfaceControlCompat(app.leash);
        leash = app.leash;
        isTranslucent = app.isTranslucent;
        clipRect = app.clipRect;
        position = app.position;
@@ -119,7 +119,7 @@ public class RemoteAnimationTargetCompat {

    public RemoteAnimationTarget unwrap() {
        return new RemoteAnimationTarget(
                taskId, mode, leash.getSurfaceControl(), isTranslucent, clipRect, contentInsets,
                taskId, mode, leash, isTranslucent, clipRect, contentInsets,
                prefixOrderIndex, position, localBounds, screenSpaceBounds, windowConfiguration,
                isNotInRecents, mStartLeash, startBounds, taskInfo, allowEnterPip, windowType
        );
@@ -211,7 +211,7 @@ public class RemoteAnimationTargetCompat {
        mode = newModeToLegacyMode(change.getMode());

        // TODO: once we can properly sync transactions across process, then get rid of this leash.
        leash = new SurfaceControlCompat(createLeash(info, change, order, t));
        leash = createLeash(info, change, order, t);

        isTranslucent = (change.getFlags() & TransitionInfo.FLAG_TRANSLUCENT) != 0
                || (change.getFlags() & TransitionInfo.FLAG_SHOW_WALLPAPER) != 0;
@@ -273,7 +273,7 @@ public class RemoteAnimationTargetCompat {
                    info.getChanges().size() - i, info, t));
            if (leashMap == null) continue;
            leashMap.put(info.getChanges().get(i).getLeash(),
                    out.get(out.size() - 1).leash.mSurfaceControl);
                    out.get(out.size() - 1).leash);
        }
        return out.toArray(new RemoteAnimationTargetCompat[out.size()]);
    }
@@ -282,8 +282,8 @@ public class RemoteAnimationTargetCompat {
     * @see SurfaceControl#release()
     */
    public void release() {
        if (leash.mSurfaceControl != null) {
            leash.mSurfaceControl.release();
        if (leash != null) {
            leash.release();
        }
        if (mStartLeash != null) {
            mStartLeash.release();
+5 −5
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ public class RemoteTransitionCompat implements Parcelable {
                }
                // Also make all the wallpapers opaque since we want the visible from the start
                for (int i = wallpapers.length - 1; i >= 0; --i) {
                    t.setAlpha(wallpapers[i].leash.mSurfaceControl, 1);
                    t.setAlpha(wallpapers[i].leash, 1);
                }
                t.apply();
                mRecentsSession.setup(controller, info, finishedCallback, pausingTasks, pipTask,
@@ -267,10 +267,10 @@ public class RemoteTransitionCompat implements Parcelable {
                // We are receiving new opening tasks, so convert to onTasksAppeared.
                final RemoteAnimationTargetCompat target = new RemoteAnimationTargetCompat(
                        openingTasks.get(i), layer, info, t);
                mLeashMap.put(mOpeningLeashes.get(i), target.leash.mSurfaceControl);
                t.reparent(target.leash.mSurfaceControl, mInfo.getRootLeash());
                t.setLayer(target.leash.mSurfaceControl, layer);
                t.hide(target.leash.mSurfaceControl);
                mLeashMap.put(mOpeningLeashes.get(i), target.leash);
                t.reparent(target.leash, mInfo.getRootLeash());
                t.setLayer(target.leash, layer);
                t.hide(target.leash);
                targets[i] = target;
            }
            t.apply();
+0 −47
Original line number Diff line number Diff line
/*
 * 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.systemui.shared.system;

import android.view.SurfaceControl;
import android.view.View;
import android.view.ViewRootImpl;

/**
 * TODO: Remove this class
 */
public class SurfaceControlCompat {
    final SurfaceControl mSurfaceControl;

    public SurfaceControlCompat(SurfaceControl surfaceControl) {
        mSurfaceControl = surfaceControl;
    }

    public SurfaceControlCompat(View v) {
        ViewRootImpl viewRootImpl = v.getViewRootImpl();
        mSurfaceControl = viewRootImpl != null
                ? viewRootImpl.getSurfaceControl()
                : null;
    }

    public boolean isValid() {
        return mSurfaceControl != null && mSurfaceControl.isValid();
    }

    public SurfaceControl getSurfaceControl() {
        return mSurfaceControl;
    }
}
+0 −7
Original line number Diff line number Diff line
@@ -202,13 +202,6 @@ public class SyncRtSurfaceTransactionApplierCompat {
            boolean visible;
            float shadowRadius;

            /**
             * @param surface The surface to modify.
             */
            public Builder(SurfaceControlCompat surface) {
                this(surface.mSurfaceControl);
            }

            /**
             * @param surface The surface to modify.
             */
Loading