blob: 9975c413d976a4fa88b8f03aed7e9ec089655fa3 [file] [log] [blame]
/*
* 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.graphics.Matrix;
import android.graphics.Rect;
import android.os.IBinder;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
public class TransactionCompat {
private final Transaction mTransaction;
private final float[] mTmpValues = new float[9];
public TransactionCompat() {
mTransaction = new Transaction();
}
public void apply() {
mTransaction.apply();
}
public TransactionCompat show(SurfaceControlCompat surfaceControl) {
mTransaction.show(surfaceControl.mSurfaceControl);
return this;
}
public TransactionCompat hide(SurfaceControlCompat surfaceControl) {
mTransaction.hide(surfaceControl.mSurfaceControl);
return this;
}
public TransactionCompat setPosition(SurfaceControlCompat surfaceControl, float x, float y) {
mTransaction.setPosition(surfaceControl.mSurfaceControl, x, y);
return this;
}
public TransactionCompat setSize(SurfaceControlCompat surfaceControl, int w, int h) {
mTransaction.setSize(surfaceControl.mSurfaceControl, w, h);
return this;
}
public TransactionCompat setLayer(SurfaceControlCompat surfaceControl, int z) {
mTransaction.setLayer(surfaceControl.mSurfaceControl, z);
return this;
}
public TransactionCompat setAlpha(SurfaceControlCompat surfaceControl, float alpha) {
mTransaction.setAlpha(surfaceControl.mSurfaceControl, alpha);
return this;
}
public TransactionCompat setMatrix(SurfaceControlCompat surfaceControl, float dsdx, float dtdx,
float dtdy, float dsdy) {
mTransaction.setMatrix(surfaceControl.mSurfaceControl, dsdx, dtdx, dtdy, dsdy);
return this;
}
public TransactionCompat setMatrix(SurfaceControlCompat surfaceControl, Matrix matrix) {
mTransaction.setMatrix(surfaceControl.mSurfaceControl, matrix, mTmpValues);
return this;
}
public TransactionCompat setWindowCrop(SurfaceControlCompat surfaceControl, Rect crop) {
mTransaction.setWindowCrop(surfaceControl.mSurfaceControl, crop);
return this;
}
public TransactionCompat setFinalCrop(SurfaceControlCompat surfaceControl, Rect crop) {
mTransaction.setFinalCrop(surfaceControl.mSurfaceControl, crop);
return this;
}
public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl,
IBinder handle, long frameNumber) {
mTransaction.deferTransactionUntil(surfaceControl.mSurfaceControl, handle, frameNumber);
return this;
}
public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl,
Surface barrier, long frameNumber) {
mTransaction.deferTransactionUntilSurface(surfaceControl.mSurfaceControl, barrier,
frameNumber);
return this;
}
public TransactionCompat setEarlyWakeup() {
mTransaction.setEarlyWakeup();
return this;
}
public TransactionCompat setColor(SurfaceControlCompat surfaceControl, float[] color) {
mTransaction.setColor(surfaceControl.mSurfaceControl, color);
return this;
}
}