Merge "Removing SurfaceControlCompat"
This commit is contained in:
committed by
Android (Google) Code Review
commit
2bb62ccaaa
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,47 +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.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;
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -35,70 +35,69 @@ public class TransactionCompat {
|
||||
mTransaction.apply();
|
||||
}
|
||||
|
||||
public TransactionCompat show(SurfaceControlCompat surfaceControl) {
|
||||
mTransaction.show(surfaceControl.mSurfaceControl);
|
||||
public TransactionCompat show(SurfaceControl surfaceControl) {
|
||||
mTransaction.show(surfaceControl);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat hide(SurfaceControlCompat surfaceControl) {
|
||||
mTransaction.hide(surfaceControl.mSurfaceControl);
|
||||
public TransactionCompat hide(SurfaceControl surfaceControl) {
|
||||
mTransaction.hide(surfaceControl);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setPosition(SurfaceControlCompat surfaceControl, float x, float y) {
|
||||
mTransaction.setPosition(surfaceControl.mSurfaceControl, x, y);
|
||||
public TransactionCompat setPosition(SurfaceControl surfaceControl, float x, float y) {
|
||||
mTransaction.setPosition(surfaceControl, x, y);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setSize(SurfaceControlCompat surfaceControl, int w, int h) {
|
||||
mTransaction.setBufferSize(surfaceControl.mSurfaceControl, w, h);
|
||||
public TransactionCompat setSize(SurfaceControl surfaceControl, int w, int h) {
|
||||
mTransaction.setBufferSize(surfaceControl, w, h);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setLayer(SurfaceControlCompat surfaceControl, int z) {
|
||||
mTransaction.setLayer(surfaceControl.mSurfaceControl, z);
|
||||
public TransactionCompat setLayer(SurfaceControl surfaceControl, int z) {
|
||||
mTransaction.setLayer(surfaceControl, z);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setAlpha(SurfaceControlCompat surfaceControl, float alpha) {
|
||||
mTransaction.setAlpha(surfaceControl.mSurfaceControl, alpha);
|
||||
public TransactionCompat setAlpha(SurfaceControl surfaceControl, float alpha) {
|
||||
mTransaction.setAlpha(surfaceControl, alpha);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setOpaque(SurfaceControlCompat surfaceControl, boolean opaque) {
|
||||
mTransaction.setOpaque(surfaceControl.mSurfaceControl, opaque);
|
||||
public TransactionCompat setOpaque(SurfaceControl surfaceControl, boolean opaque) {
|
||||
mTransaction.setOpaque(surfaceControl, opaque);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setMatrix(SurfaceControlCompat surfaceControl, float dsdx, float dtdx,
|
||||
public TransactionCompat setMatrix(SurfaceControl surfaceControl, float dsdx, float dtdx,
|
||||
float dtdy, float dsdy) {
|
||||
mTransaction.setMatrix(surfaceControl.mSurfaceControl, dsdx, dtdx, dtdy, dsdy);
|
||||
mTransaction.setMatrix(surfaceControl, dsdx, dtdx, dtdy, dsdy);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setMatrix(SurfaceControlCompat surfaceControl, Matrix matrix) {
|
||||
mTransaction.setMatrix(surfaceControl.mSurfaceControl, matrix, mTmpValues);
|
||||
public TransactionCompat setMatrix(SurfaceControl surfaceControl, Matrix matrix) {
|
||||
mTransaction.setMatrix(surfaceControl, matrix, mTmpValues);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setWindowCrop(SurfaceControlCompat surfaceControl, Rect crop) {
|
||||
mTransaction.setWindowCrop(surfaceControl.mSurfaceControl, crop);
|
||||
public TransactionCompat setWindowCrop(SurfaceControl surfaceControl, Rect crop) {
|
||||
mTransaction.setWindowCrop(surfaceControl, crop);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setCornerRadius(SurfaceControlCompat surfaceControl, float radius) {
|
||||
mTransaction.setCornerRadius(surfaceControl.mSurfaceControl, radius);
|
||||
public TransactionCompat setCornerRadius(SurfaceControl surfaceControl, float radius) {
|
||||
mTransaction.setCornerRadius(surfaceControl, radius);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setBackgroundBlurRadius(SurfaceControlCompat surfaceControl,
|
||||
int radius) {
|
||||
mTransaction.setBackgroundBlurRadius(surfaceControl.mSurfaceControl, radius);
|
||||
public TransactionCompat setBackgroundBlurRadius(SurfaceControl surfaceControl, int radius) {
|
||||
mTransaction.setBackgroundBlurRadius(surfaceControl, radius);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TransactionCompat setColor(SurfaceControlCompat surfaceControl, float[] color) {
|
||||
mTransaction.setColor(surfaceControl.mSurfaceControl, color);
|
||||
public TransactionCompat setColor(SurfaceControl surfaceControl, float[] color) {
|
||||
mTransaction.setColor(surfaceControl, color);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user