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