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