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.content.res.Configuration; 20 import android.graphics.Rect; 21 import android.os.Bundle; 22 import android.os.ParcelFileDescriptor; 23 import android.os.RemoteException; 24 import android.view.DragEvent; 25 import android.view.IWindow; 26 import android.view.IWindowSession; 27 28 import com.android.internal.os.IResultReceiver; 29 30 public class BaseIWindow extends IWindow.Stub { 31 private IWindowSession mSession; 32 public int mSeq; 33 setSession(IWindowSession session)34 public void setSession(IWindowSession session) { 35 mSession = session; 36 } 37 38 @Override resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, Configuration newConfig, Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeNavBar)39 public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, 40 Rect stableInsets, Rect outsets, boolean reportDraw, Configuration newConfig, 41 Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeNavBar) { 42 if (reportDraw) { 43 try { 44 mSession.finishDrawing(this); 45 } catch (RemoteException e) { 46 } 47 } 48 } 49 50 @Override moved(int newX, int newY)51 public void moved(int newX, int newY) { 52 } 53 54 @Override dispatchAppVisibility(boolean visible)55 public void dispatchAppVisibility(boolean visible) { 56 } 57 58 @Override dispatchGetNewSurface()59 public void dispatchGetNewSurface() { 60 } 61 62 @Override windowFocusChanged(boolean hasFocus, boolean touchEnabled)63 public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) { 64 } 65 66 @Override executeCommand(String command, String parameters, ParcelFileDescriptor out)67 public void executeCommand(String command, String parameters, ParcelFileDescriptor out) { 68 } 69 70 @Override closeSystemDialogs(String reason)71 public void closeSystemDialogs(String reason) { 72 } 73 74 @Override dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync)75 public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) { 76 if (sync) { 77 try { 78 mSession.wallpaperOffsetsComplete(asBinder()); 79 } catch (RemoteException e) { 80 } 81 } 82 } 83 84 @Override dispatchDragEvent(DragEvent event)85 public void dispatchDragEvent(DragEvent event) { 86 } 87 88 @Override updatePointerIcon(float x, float y)89 public void updatePointerIcon(float x, float y) { 90 } 91 92 @Override dispatchSystemUiVisibilityChanged(int seq, int globalUi, int localValue, int localChanges)93 public void dispatchSystemUiVisibilityChanged(int seq, int globalUi, 94 int localValue, int localChanges) { 95 mSeq = seq; 96 } 97 98 @Override dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync)99 public void dispatchWallpaperCommand(String action, int x, int y, 100 int z, Bundle extras, boolean sync) { 101 if (sync) { 102 try { 103 mSession.wallpaperCommandComplete(asBinder(), null); 104 } catch (RemoteException e) { 105 } 106 } 107 } 108 109 @Override dispatchWindowShown()110 public void dispatchWindowShown() { 111 } 112 113 @Override requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId)114 public void requestAppKeyboardShortcuts(IResultReceiver receiver, int deviceId) { 115 } 116 } 117