BaseIWindow.java revision 8643aa0179e598e78d938c59035389054535a229
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
17package com.android.internal.view;
18
19import android.content.res.Configuration;
20import android.graphics.Rect;
21import android.os.Bundle;
22import android.os.ParcelFileDescriptor;
23import android.os.RemoteException;
24import android.view.DragEvent;
25import android.view.IWindow;
26import android.view.IWindowSession;
27
28public class BaseIWindow extends IWindow.Stub {
29    private IWindowSession mSession;
30
31    public void setSession(IWindowSession session) {
32        mSession = session;
33    }
34
35    public void resized(int w, int h, Rect coveredInsets,
36            Rect visibleInsets, boolean reportDraw, Configuration newConfig) {
37        if (reportDraw) {
38            try {
39                mSession.finishDrawing(this);
40            } catch (RemoteException e) {
41            }
42        }
43    }
44
45    public void dispatchAppVisibility(boolean visible) {
46    }
47
48    public void dispatchGetNewSurface() {
49    }
50
51    public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) {
52    }
53
54    public void executeCommand(String command, String parameters, ParcelFileDescriptor out) {
55    }
56
57    public void closeSystemDialogs(String reason) {
58    }
59
60    public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) {
61        if (sync) {
62            try {
63                mSession.wallpaperOffsetsComplete(asBinder());
64            } catch (RemoteException e) {
65            }
66        }
67    }
68
69    public void dispatchDragEvent(DragEvent event) {
70    }
71
72    public void dispatchSystemUiVisibilityChanged(int visibility) {
73    }
74
75    public void dispatchWallpaperCommand(String action, int x, int y,
76            int z, Bundle extras, boolean sync) {
77        if (sync) {
78            try {
79                mSession.wallpaperCommandComplete(asBinder(), null);
80            } catch (RemoteException e) {
81            }
82        }
83    }
84}
85