1 /*
2  * Copyright (C) 2016 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.Point;
20 import android.os.Bundle;
21 import android.os.ParcelFileDescriptor;
22 import android.os.RemoteException;
23 import android.util.MergedConfiguration;
24 import android.view.DragEvent;
25 import android.view.IScrollCaptureResponseListener;
26 import android.view.IWindow;
27 import android.view.InsetsSourceControl;
28 import android.view.InsetsState;
29 import android.view.ScrollCaptureResponse;
30 import android.window.ClientWindowFrames;
31 
32 import com.android.internal.os.IResultReceiver;
33 
34 import java.util.ArrayList;
35 
36 public class TestIWindow extends IWindow.Stub {
37 
38     private ArrayList<DragEvent> mDragEvents;
39 
40     @Override
executeCommand(String command, String parameters, ParcelFileDescriptor descriptor)41     public void executeCommand(String command, String parameters,
42             ParcelFileDescriptor descriptor) throws RemoteException {
43     }
44 
45     @Override
resized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfig, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId)46     public void resized(ClientWindowFrames frames, boolean reportDraw,
47             MergedConfiguration mergedConfig, boolean forceLayout, boolean alwaysConsumeSystemBars,
48             int displayId) throws RemoteException {
49     }
50 
51     @Override
locationInParentDisplayChanged(Point offset)52     public void locationInParentDisplayChanged(Point offset) throws RemoteException {
53     }
54 
55     @Override
insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize)56     public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {
57     }
58 
59     @Override
insetsControlChanged(InsetsState insetsState, InsetsSourceControl[] activeControls, boolean willMove, boolean willResize)60     public void insetsControlChanged(InsetsState insetsState,
61             InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {
62     }
63 
64     @Override
moved(int newX, int newY)65     public void moved(int newX, int newY) throws RemoteException {
66     }
67 
68     @Override
dispatchAppVisibility(boolean visible)69     public void dispatchAppVisibility(boolean visible) throws RemoteException {
70     }
71 
72     @Override
dispatchGetNewSurface()73     public void dispatchGetNewSurface() throws RemoteException {
74     }
75 
76     @Override
windowFocusChanged(boolean hasFocus, boolean inTouchMode)77     public void windowFocusChanged(boolean hasFocus, boolean inTouchMode) throws RemoteException {
78     }
79 
80     @Override
closeSystemDialogs(String reason)81     public void closeSystemDialogs(String reason) throws RemoteException {
82     }
83 
84     @Override
dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, float zoom, boolean sync)85     public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, float zoom,
86             boolean sync)
87             throws RemoteException {
88     }
89 
90     @Override
dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync)91     public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras,
92             boolean sync) throws RemoteException {
93     }
94 
setDragEventJournal(ArrayList<DragEvent> journal)95     public void setDragEventJournal(ArrayList<DragEvent> journal) {
96         mDragEvents = journal;
97     }
98 
99     @Override
dispatchDragEvent(DragEvent event)100     public void dispatchDragEvent(DragEvent event) throws RemoteException {
101         if (mDragEvents != null) {
102             mDragEvents.add(DragEvent.obtain(event));
103         }
104     }
105 
106     @Override
updatePointerIcon(float x, float y)107     public void updatePointerIcon(float x, float y) throws RemoteException {
108     }
109 
110     @Override
dispatchWindowShown()111     public void dispatchWindowShown() throws RemoteException {
112     }
113 
114     @Override
requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId)115     public void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId)
116             throws RemoteException {
117     }
118 
119     @Override
requestScrollCapture(IScrollCaptureResponseListener listener)120     public void requestScrollCapture(IScrollCaptureResponseListener listener)
121             throws RemoteException {
122         try {
123             listener.onScrollCaptureResponse(
124                     new ScrollCaptureResponse.Builder().setDescription("Not Implemented").build());
125 
126         } catch (RemoteException ex) {
127             // ignore
128         }
129     }
130 
131     @Override
showInsets(int types, boolean fromIme)132     public void showInsets(int types, boolean fromIme) throws RemoteException {
133     }
134 
135     @Override
hideInsets(int types, boolean fromIme)136     public void hideInsets(int types, boolean fromIme) throws RemoteException {
137     }
138 }
139