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