BaseIWindow.java revision 9c79504225f60c72c947220b6aca928f11279e1c
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    public int mSeq;
31
32    public void setSession(IWindowSession session) {
33        mSession = session;
34    }
35
36    @Override
37    public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
38            Rect visibleInsets, Rect stableInsets, boolean reportDraw, Configuration newConfig) {
39        if (reportDraw) {
40            try {
41                mSession.finishDrawing(this);
42            } catch (RemoteException e) {
43            }
44        }
45    }
46
47    @Override
48    public void moved(int newX, int newY) {
49    }
50
51    @Override
52    public void dispatchAppVisibility(boolean visible) {
53    }
54
55    @Override
56    public void dispatchGetNewSurface() {
57    }
58
59    @Override
60    public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) {
61    }
62
63    @Override
64    public void executeCommand(String command, String parameters, ParcelFileDescriptor out) {
65    }
66
67    @Override
68    public void closeSystemDialogs(String reason) {
69    }
70
71    @Override
72    public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) {
73        if (sync) {
74            try {
75                mSession.wallpaperOffsetsComplete(asBinder());
76            } catch (RemoteException e) {
77            }
78        }
79    }
80
81    @Override
82    public void dispatchDragEvent(DragEvent event) {
83    }
84
85    @Override
86    public void dispatchSystemUiVisibilityChanged(int seq, int globalUi,
87            int localValue, int localChanges) {
88        mSeq = seq;
89    }
90
91    @Override
92    public void dispatchWallpaperCommand(String action, int x, int y,
93            int z, Bundle extras, boolean sync) {
94        if (sync) {
95            try {
96                mSession.wallpaperCommandComplete(asBinder(), null);
97            } catch (RemoteException e) {
98            }
99        }
100    }
101
102    @Override
103    public void doneAnimating() {
104    }
105
106    @Override
107    public void dispatchWindowShown() {
108    }
109}
110