1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.wm; 18 19 import android.graphics.Matrix; 20 import android.graphics.Rect; 21 import android.graphics.Region; 22 import android.os.IBinder; 23 import android.os.Parcel; 24 import android.view.InputWindowHandle; 25 import android.view.Surface; 26 import android.view.SurfaceControl; 27 28 /** 29 * Stubbed {@link android.view.SurfaceControl.Transaction} class that can be used when unit 30 * testing to avoid calls to native code. 31 */ 32 public class StubTransaction extends SurfaceControl.Transaction { 33 @Override apply()34 public void apply() { 35 } 36 37 @Override close()38 public void close() { 39 } 40 41 @Override apply(boolean sync)42 public void apply(boolean sync) { 43 } 44 45 @Override setVisibility(SurfaceControl sc, boolean visible)46 public SurfaceControl.Transaction setVisibility(SurfaceControl sc, boolean visible) { 47 return this; 48 } 49 50 @Override show(SurfaceControl sc)51 public SurfaceControl.Transaction show(SurfaceControl sc) { 52 return this; 53 } 54 55 @Override hide(SurfaceControl sc)56 public SurfaceControl.Transaction hide(SurfaceControl sc) { 57 return this; 58 } 59 60 @Override setPosition(SurfaceControl sc, float x, float y)61 public SurfaceControl.Transaction setPosition(SurfaceControl sc, float x, float y) { 62 return this; 63 } 64 65 @Override setBufferSize(SurfaceControl sc, int w, int h)66 public SurfaceControl.Transaction setBufferSize(SurfaceControl sc, 67 int w, int h) { 68 return this; 69 } 70 71 @Override setLayer(SurfaceControl sc, int z)72 public SurfaceControl.Transaction setLayer(SurfaceControl sc, int z) { 73 return this; 74 } 75 76 @Override setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, int z)77 public SurfaceControl.Transaction setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, 78 int z) { 79 return this; 80 } 81 82 @Override setTransparentRegionHint(SurfaceControl sc, Region transparentRegion)83 public SurfaceControl.Transaction setTransparentRegionHint(SurfaceControl sc, 84 Region transparentRegion) { 85 return this; 86 } 87 88 @Override setAlpha(SurfaceControl sc, float alpha)89 public SurfaceControl.Transaction setAlpha(SurfaceControl sc, float alpha) { 90 return this; 91 } 92 93 @Override setInputWindowInfo(SurfaceControl sc, InputWindowHandle handle)94 public SurfaceControl.Transaction setInputWindowInfo(SurfaceControl sc, 95 InputWindowHandle handle) { 96 return this; 97 } 98 99 @Override transferTouchFocus(IBinder fromToken, IBinder toToken)100 public SurfaceControl.Transaction transferTouchFocus(IBinder fromToken, IBinder toToken) { 101 return this; 102 } 103 104 @Override setGeometry(SurfaceControl sc, Rect sourceCrop, Rect destFrame, @Surface.Rotation int orientation)105 public SurfaceControl.Transaction setGeometry(SurfaceControl sc, Rect sourceCrop, 106 Rect destFrame, @Surface.Rotation int orientation) { 107 return this; 108 } 109 110 @Override setMatrix(SurfaceControl sc, float dsdx, float dtdx, float dtdy, float dsdy)111 public SurfaceControl.Transaction setMatrix(SurfaceControl sc, 112 float dsdx, float dtdx, float dtdy, float dsdy) { 113 return this; 114 } 115 116 @Override setMatrix(SurfaceControl sc, Matrix matrix, float[] float9)117 public SurfaceControl.Transaction setMatrix(SurfaceControl sc, Matrix matrix, float[] float9) { 118 return this; 119 } 120 121 @Override setColorTransform(SurfaceControl sc, float[] matrix, float[] translation)122 public SurfaceControl.Transaction setColorTransform(SurfaceControl sc, float[] matrix, 123 float[] translation) { 124 return this; 125 } 126 127 @Override setWindowCrop(SurfaceControl sc, Rect crop)128 public SurfaceControl.Transaction setWindowCrop(SurfaceControl sc, Rect crop) { 129 return this; 130 } 131 132 @Override setWindowCrop(SurfaceControl sc, int width, int height)133 public SurfaceControl.Transaction setWindowCrop(SurfaceControl sc, int width, int height) { 134 return this; 135 } 136 137 @Override setCornerRadius(SurfaceControl sc, float cornerRadius)138 public SurfaceControl.Transaction setCornerRadius(SurfaceControl sc, float cornerRadius) { 139 return this; 140 } 141 142 @Override setLayerStack(SurfaceControl sc, int layerStack)143 public SurfaceControl.Transaction setLayerStack(SurfaceControl sc, int layerStack) { 144 return this; 145 } 146 147 @Override deferTransactionUntil(SurfaceControl sc, IBinder handle, long frameNumber)148 public SurfaceControl.Transaction deferTransactionUntil(SurfaceControl sc, IBinder handle, 149 long frameNumber) { 150 return this; 151 } 152 153 @Override deferTransactionUntilSurface(SurfaceControl sc, Surface barrierSurface, long frameNumber)154 public SurfaceControl.Transaction deferTransactionUntilSurface(SurfaceControl sc, 155 Surface barrierSurface, 156 long frameNumber) { 157 return this; 158 } 159 160 @Override reparentChildren(SurfaceControl sc, IBinder newParentHandle)161 public SurfaceControl.Transaction reparentChildren(SurfaceControl sc, IBinder newParentHandle) { 162 return this; 163 } 164 165 @Override reparent(SurfaceControl sc, SurfaceControl newParent)166 public SurfaceControl.Transaction reparent(SurfaceControl sc, SurfaceControl newParent) { 167 return this; 168 } 169 170 @Override detachChildren(SurfaceControl sc)171 public SurfaceControl.Transaction detachChildren(SurfaceControl sc) { 172 return this; 173 } 174 175 @Override setOverrideScalingMode(SurfaceControl sc, int overrideScalingMode)176 public SurfaceControl.Transaction setOverrideScalingMode(SurfaceControl sc, 177 int overrideScalingMode) { 178 return this; 179 } 180 181 @Override setColor(SurfaceControl sc, float[] color)182 public SurfaceControl.Transaction setColor(SurfaceControl sc, float[] color) { 183 return this; 184 } 185 186 @Override setGeometryAppliesWithResize(SurfaceControl sc)187 public SurfaceControl.Transaction setGeometryAppliesWithResize(SurfaceControl sc) { 188 return this; 189 } 190 191 @Override setSecure(SurfaceControl sc, boolean isSecure)192 public SurfaceControl.Transaction setSecure(SurfaceControl sc, boolean isSecure) { 193 return this; 194 } 195 196 @Override setOpaque(SurfaceControl sc, boolean isOpaque)197 public SurfaceControl.Transaction setOpaque(SurfaceControl sc, boolean isOpaque) { 198 return this; 199 } 200 201 @Override setDisplaySurface(IBinder displayToken, Surface surface)202 public SurfaceControl.Transaction setDisplaySurface(IBinder displayToken, Surface surface) { 203 return this; 204 } 205 206 @Override setDisplayLayerStack(IBinder displayToken, int layerStack)207 public SurfaceControl.Transaction setDisplayLayerStack(IBinder displayToken, int layerStack) { 208 return this; 209 } 210 211 @Override setDisplayProjection(IBinder displayToken, int orientation, Rect layerStackRect, Rect displayRect)212 public SurfaceControl.Transaction setDisplayProjection(IBinder displayToken, 213 int orientation, Rect layerStackRect, Rect displayRect) { 214 return this; 215 } 216 217 @Override setDisplaySize(IBinder displayToken, int width, int height)218 public SurfaceControl.Transaction setDisplaySize(IBinder displayToken, int width, int height) { 219 return this; 220 } 221 222 @Override setAnimationTransaction()223 public SurfaceControl.Transaction setAnimationTransaction() { 224 return this; 225 } 226 227 @Override setEarlyWakeup()228 public SurfaceControl.Transaction setEarlyWakeup() { 229 return this; 230 } 231 232 @Override setMetadata(SurfaceControl sc, int key, int data)233 public SurfaceControl.Transaction setMetadata(SurfaceControl sc, int key, int data) { 234 return this; 235 } 236 237 @Override setMetadata(SurfaceControl sc, int key, Parcel data)238 public SurfaceControl.Transaction setMetadata(SurfaceControl sc, int key, Parcel data) { 239 return this; 240 } 241 242 @Override merge(SurfaceControl.Transaction other)243 public SurfaceControl.Transaction merge(SurfaceControl.Transaction other) { 244 return this; 245 } 246 247 @Override remove(SurfaceControl sc)248 public SurfaceControl.Transaction remove(SurfaceControl sc) { 249 return this; 250 } 251 } 252