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.annotation.NonNull; 20 import android.graphics.ColorSpace; 21 import android.graphics.GraphicBuffer; 22 import android.graphics.Matrix; 23 import android.graphics.Rect; 24 import android.graphics.Region; 25 import android.os.IBinder; 26 import android.os.Parcel; 27 import android.view.InputWindowHandle; 28 import android.view.Surface; 29 import android.view.SurfaceControl; 30 31 /** 32 * Stubbed {@link android.view.SurfaceControl.Transaction} class that can be used when unit 33 * testing to avoid calls to native code. 34 */ 35 public class StubTransaction extends SurfaceControl.Transaction { 36 @Override apply()37 public void apply() { 38 } 39 40 @Override close()41 public void close() { 42 } 43 44 @Override apply(boolean sync)45 public void apply(boolean sync) { 46 } 47 48 @Override setVisibility(SurfaceControl sc, boolean visible)49 public SurfaceControl.Transaction setVisibility(SurfaceControl sc, boolean visible) { 50 return this; 51 } 52 53 @Override show(SurfaceControl sc)54 public SurfaceControl.Transaction show(SurfaceControl sc) { 55 return this; 56 } 57 58 @Override hide(SurfaceControl sc)59 public SurfaceControl.Transaction hide(SurfaceControl sc) { 60 return this; 61 } 62 63 @Override setPosition(SurfaceControl sc, float x, float y)64 public SurfaceControl.Transaction setPosition(SurfaceControl sc, float x, float y) { 65 return this; 66 } 67 68 @Override setBufferSize(SurfaceControl sc, int w, int h)69 public SurfaceControl.Transaction setBufferSize(SurfaceControl sc, 70 int w, int h) { 71 return this; 72 } 73 74 @Override setLayer(SurfaceControl sc, int z)75 public SurfaceControl.Transaction setLayer(SurfaceControl sc, int z) { 76 return this; 77 } 78 79 @Override setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, int z)80 public SurfaceControl.Transaction setRelativeLayer(SurfaceControl sc, SurfaceControl relativeTo, 81 int z) { 82 return this; 83 } 84 85 @Override setTransparentRegionHint(SurfaceControl sc, Region transparentRegion)86 public SurfaceControl.Transaction setTransparentRegionHint(SurfaceControl sc, 87 Region transparentRegion) { 88 return this; 89 } 90 91 @Override setAlpha(SurfaceControl sc, float alpha)92 public SurfaceControl.Transaction setAlpha(SurfaceControl sc, float alpha) { 93 return this; 94 } 95 96 @Override setInputWindowInfo(SurfaceControl sc, InputWindowHandle handle)97 public SurfaceControl.Transaction setInputWindowInfo(SurfaceControl sc, 98 InputWindowHandle handle) { 99 return this; 100 } 101 102 @Override setGeometry(SurfaceControl sc, Rect sourceCrop, Rect destFrame, @Surface.Rotation int orientation)103 public SurfaceControl.Transaction setGeometry(SurfaceControl sc, Rect sourceCrop, 104 Rect destFrame, @Surface.Rotation int orientation) { 105 return this; 106 } 107 108 @Override setMatrix(SurfaceControl sc, float dsdx, float dtdx, float dtdy, float dsdy)109 public SurfaceControl.Transaction setMatrix(SurfaceControl sc, 110 float dsdx, float dtdx, float dtdy, float dsdy) { 111 return this; 112 } 113 114 @Override setMatrix(SurfaceControl sc, Matrix matrix, float[] float9)115 public SurfaceControl.Transaction setMatrix(SurfaceControl sc, Matrix matrix, float[] float9) { 116 return this; 117 } 118 119 @Override setColorTransform(SurfaceControl sc, float[] matrix, float[] translation)120 public SurfaceControl.Transaction setColorTransform(SurfaceControl sc, float[] matrix, 121 float[] translation) { 122 return this; 123 } 124 125 @Override setWindowCrop(SurfaceControl sc, Rect crop)126 public SurfaceControl.Transaction setWindowCrop(SurfaceControl sc, Rect crop) { 127 return this; 128 } 129 130 @Override setWindowCrop(SurfaceControl sc, int width, int height)131 public SurfaceControl.Transaction setWindowCrop(SurfaceControl sc, int width, int height) { 132 return this; 133 } 134 135 @Override setCornerRadius(SurfaceControl sc, float cornerRadius)136 public SurfaceControl.Transaction setCornerRadius(SurfaceControl sc, float cornerRadius) { 137 return this; 138 } 139 140 @Override setBackgroundBlurRadius(SurfaceControl sc, int radius)141 public SurfaceControl.Transaction setBackgroundBlurRadius(SurfaceControl sc, int radius) { 142 return this; 143 } 144 145 @Override setLayerStack(SurfaceControl sc, int layerStack)146 public SurfaceControl.Transaction setLayerStack(SurfaceControl sc, int layerStack) { 147 return this; 148 } 149 150 @Override reparent(SurfaceControl sc, SurfaceControl newParent)151 public SurfaceControl.Transaction reparent(SurfaceControl sc, SurfaceControl newParent) { 152 return this; 153 } 154 155 @Override setColor(SurfaceControl sc, float[] color)156 public SurfaceControl.Transaction setColor(SurfaceControl sc, float[] color) { 157 return this; 158 } 159 160 @Override setSecure(SurfaceControl sc, boolean isSecure)161 public SurfaceControl.Transaction setSecure(SurfaceControl sc, boolean isSecure) { 162 return this; 163 } 164 165 @Override setOpaque(SurfaceControl sc, boolean isOpaque)166 public SurfaceControl.Transaction setOpaque(SurfaceControl sc, boolean isOpaque) { 167 return this; 168 } 169 170 @Override setDisplaySurface(IBinder displayToken, Surface surface)171 public SurfaceControl.Transaction setDisplaySurface(IBinder displayToken, Surface surface) { 172 return this; 173 } 174 175 @Override setDisplayLayerStack(IBinder displayToken, int layerStack)176 public SurfaceControl.Transaction setDisplayLayerStack(IBinder displayToken, int layerStack) { 177 return this; 178 } 179 180 @Override setDisplayFlags(IBinder displayToken, int flags)181 public SurfaceControl.Transaction setDisplayFlags(IBinder displayToken, int flags) { 182 return this; 183 } 184 185 @Override setDisplayProjection(IBinder displayToken, int orientation, Rect layerStackRect, Rect displayRect)186 public SurfaceControl.Transaction setDisplayProjection(IBinder displayToken, 187 int orientation, Rect layerStackRect, Rect displayRect) { 188 return this; 189 } 190 191 @Override setDisplaySize(IBinder displayToken, int width, int height)192 public SurfaceControl.Transaction setDisplaySize(IBinder displayToken, int width, int height) { 193 return this; 194 } 195 196 @Override setAnimationTransaction()197 public SurfaceControl.Transaction setAnimationTransaction() { 198 return this; 199 } 200 201 @Override setMetadata(SurfaceControl sc, int key, int data)202 public SurfaceControl.Transaction setMetadata(SurfaceControl sc, int key, int data) { 203 return this; 204 } 205 206 @Override setMetadata(SurfaceControl sc, int key, Parcel data)207 public SurfaceControl.Transaction setMetadata(SurfaceControl sc, int key, Parcel data) { 208 return this; 209 } 210 211 @Override merge(SurfaceControl.Transaction other)212 public SurfaceControl.Transaction merge(SurfaceControl.Transaction other) { 213 return this; 214 } 215 216 @Override remove(SurfaceControl sc)217 public SurfaceControl.Transaction remove(SurfaceControl sc) { 218 return this; 219 } 220 221 @Override syncInputWindows()222 public SurfaceControl.Transaction syncInputWindows() { 223 return this; 224 } 225 226 @Override setColorSpaceAgnostic(SurfaceControl sc, boolean agnostic)227 public SurfaceControl.Transaction setColorSpaceAgnostic(SurfaceControl sc, boolean agnostic) { 228 return this; 229 } 230 231 @Override setFrameRateSelectionPriority(SurfaceControl sc, int priority)232 public SurfaceControl.Transaction setFrameRateSelectionPriority(SurfaceControl sc, 233 int priority) { 234 return this; 235 } 236 237 @Override setFrameRate(SurfaceControl sc, float frameRate, int compatibility, int changeFrameRateStrategy)238 public SurfaceControl.Transaction setFrameRate(SurfaceControl sc, float frameRate, 239 int compatibility, int changeFrameRateStrategy) { 240 return this; 241 } 242 243 @Override unsetColor(SurfaceControl sc)244 public SurfaceControl.Transaction unsetColor(SurfaceControl sc) { 245 return this; 246 } 247 248 @Override setShadowRadius(SurfaceControl sc, float shadowRadius)249 public SurfaceControl.Transaction setShadowRadius(SurfaceControl sc, float shadowRadius) { 250 return this; 251 } 252 253 @Override setFixedTransformHint(SurfaceControl sc, @Surface.Rotation int transformHint)254 public SurfaceControl.Transaction setFixedTransformHint(SurfaceControl sc, 255 @Surface.Rotation int transformHint) { 256 return this; 257 } 258 259 @Override unsetFixedTransformHint(@onNull SurfaceControl sc)260 public SurfaceControl.Transaction unsetFixedTransformHint(@NonNull SurfaceControl sc) { 261 return this; 262 } 263 264 @Override setBuffer(SurfaceControl sc, GraphicBuffer buffer)265 public SurfaceControl.Transaction setBuffer(SurfaceControl sc, GraphicBuffer buffer) { 266 return this; 267 } 268 269 @Override setColorSpace(SurfaceControl sc, ColorSpace colorSpace)270 public SurfaceControl.Transaction setColorSpace(SurfaceControl sc, ColorSpace colorSpace) { 271 return this; 272 } 273 274 @Override setTrustedOverlay(SurfaceControl sc, boolean isTrustedOverlay)275 public SurfaceControl.Transaction setTrustedOverlay(SurfaceControl sc, 276 boolean isTrustedOverlay) { 277 return this; 278 } 279 } 280