BaseIWindow.java revision c4aad01cbbb69c916ef323693e1fd0560b0eccba
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, 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 dispatchScreenState(boolean on) {
61    }
62
63    @Override
64    public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) {
65    }
66
67    @Override
68    public void executeCommand(String command, String parameters, ParcelFileDescriptor out) {
69    }
70
71    @Override
72    public void closeSystemDialogs(String reason) {
73    }
74
75    @Override
76    public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) {
77        if (sync) {
78            try {
79                mSession.wallpaperOffsetsComplete(asBinder());
80            } catch (RemoteException e) {
81            }
82        }
83    }
84
85    @Override
86    public void dispatchDragEvent(DragEvent event) {
87    }
88
89    @Override
90    public void dispatchSystemUiVisibilityChanged(int seq, int globalUi,
91            int localValue, int localChanges) {
92        mSeq = seq;
93    }
94
95    @Override
96    public void dispatchWallpaperCommand(String action, int x, int y,
97            int z, Bundle extras, boolean sync) {
98        if (sync) {
99            try {
100                mSession.wallpaperCommandComplete(asBinder(), null);
101            } catch (RemoteException e) {
102            }
103        }
104    }
105
106    @Override
107    public void doneAnimating() {
108    }
109}
110