• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 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.internal.view;
18 
19 import android.graphics.Rect;
20 import android.hardware.input.InputManager;
21 import android.os.Bundle;
22 import android.os.ParcelFileDescriptor;
23 import android.os.RemoteException;
24 import android.util.MergedConfiguration;
25 import android.view.DisplayCutout;
26 import android.view.DragEvent;
27 import android.view.IWindow;
28 import android.view.IWindowSession;
29 import android.view.PointerIcon;
30 
31 import com.android.internal.os.IResultReceiver;
32 
33 public class BaseIWindow extends IWindow.Stub {
34     private IWindowSession mSession;
35     public int mSeq;
36 
setSession(IWindowSession session)37     public void setSession(IWindowSession session) {
38         mSession = session;
39     }
40 
41     @Override
resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeNavBar, int displayId, DisplayCutout.ParcelableWrapper displayCutout)42     public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets,
43             Rect stableInsets, Rect outsets, boolean reportDraw,
44             MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout,
45             boolean alwaysConsumeNavBar, int displayId,
46             DisplayCutout.ParcelableWrapper displayCutout) {
47         if (reportDraw) {
48             try {
49                 mSession.finishDrawing(this);
50             } catch (RemoteException e) {
51             }
52         }
53     }
54 
55     @Override
moved(int newX, int newY)56     public void moved(int newX, int newY) {
57     }
58 
59     @Override
dispatchAppVisibility(boolean visible)60     public void dispatchAppVisibility(boolean visible) {
61     }
62 
63     @Override
dispatchGetNewSurface()64     public void dispatchGetNewSurface() {
65     }
66 
67     @Override
windowFocusChanged(boolean hasFocus, boolean touchEnabled)68     public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) {
69     }
70 
71     @Override
executeCommand(String command, String parameters, ParcelFileDescriptor out)72     public void executeCommand(String command, String parameters, ParcelFileDescriptor out) {
73     }
74 
75     @Override
closeSystemDialogs(String reason)76     public void closeSystemDialogs(String reason) {
77     }
78 
79     @Override
dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync)80     public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) {
81         if (sync) {
82             try {
83                 mSession.wallpaperOffsetsComplete(asBinder());
84             } catch (RemoteException e) {
85             }
86         }
87     }
88 
89     @Override
dispatchDragEvent(DragEvent event)90     public void dispatchDragEvent(DragEvent event) {
91         if (event.getAction() == DragEvent.ACTION_DROP) {
92             try {
93                 mSession.reportDropResult(this, false);
94             } catch (RemoteException e) {
95             }
96         }
97     }
98 
99     @Override
updatePointerIcon(float x, float y)100     public void updatePointerIcon(float x, float y) {
101         InputManager.getInstance().setPointerIconType(PointerIcon.TYPE_NOT_SPECIFIED);
102     }
103 
104     @Override
dispatchSystemUiVisibilityChanged(int seq, int globalUi, int localValue, int localChanges)105     public void dispatchSystemUiVisibilityChanged(int seq, int globalUi,
106             int localValue, int localChanges) {
107         mSeq = seq;
108     }
109 
110     @Override
dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync)111     public void dispatchWallpaperCommand(String action, int x, int y,
112             int z, Bundle extras, boolean sync) {
113         if (sync) {
114             try {
115                 mSession.wallpaperCommandComplete(asBinder(), null);
116             } catch (RemoteException e) {
117             }
118         }
119     }
120 
121     @Override
dispatchWindowShown()122     public void dispatchWindowShown() {
123     }
124 
125     @Override
requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId)126     public void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId) {
127     }
128 
129     @Override
dispatchPointerCaptureChanged(boolean hasCapture)130     public void dispatchPointerCaptureChanged(boolean hasCapture) {
131     }
132 }
133