IWindowManagerImpl.java revision 96f2fef2460adcf815baa1c2a74e417451fe1237
1/*
2 * Copyright (C) 2011 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 android.view;
18
19import android.graphics.Point;
20import com.android.internal.view.IInputContext;
21import com.android.internal.view.IInputMethodClient;
22
23import android.content.res.CompatibilityInfo;
24import android.content.res.Configuration;
25import android.graphics.Bitmap;
26import android.graphics.Rect;
27import android.os.Bundle;
28import android.os.IBinder;
29import android.os.IRemoteCallback;
30import android.os.RemoteException;
31import android.util.DisplayMetrics;
32import android.view.Display;
33import android.view.Gravity;
34import android.view.IApplicationToken;
35import android.view.IInputFilter;
36import android.view.IOnKeyguardExitResult;
37import android.view.IRotationWatcher;
38import android.view.IWindowManager;
39import android.view.IWindowSession;
40
41import java.util.List;
42
43/**
44 * Basic implementation of {@link IWindowManager} so that {@link Display} (and
45 * {@link Display_Delegate}) can return a valid instance.
46 */
47public class IWindowManagerImpl implements IWindowManager {
48
49    private final Configuration mConfig;
50    private final DisplayMetrics mMetrics;
51    private final int mRotation;
52    private final boolean mHasSystemNavBar;
53    private final boolean mHasNavigationBar;
54
55    public IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation,
56            boolean hasSystemNavBar, boolean hasNavigationBar) {
57        mConfig = config;
58        mMetrics = metrics;
59        mRotation = rotation;
60        mHasSystemNavBar = hasSystemNavBar;
61        mHasNavigationBar = hasNavigationBar;
62    }
63
64    // custom API.
65
66    public DisplayMetrics getMetrics() {
67        return mMetrics;
68    }
69
70    // ---- implementation of IWindowManager that we care about ----
71
72    @Override
73    public int getRotation() throws RemoteException {
74        return mRotation;
75    }
76
77    @Override
78    public boolean hasNavigationBar() {
79        return mHasNavigationBar;
80    }
81
82    @Override
83    public boolean hasSystemNavBar() throws RemoteException {
84        return mHasSystemNavBar;
85    }
86
87    // ---- unused implementation of IWindowManager ----
88
89    @Override
90    public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, int arg4,
91            boolean arg5, boolean arg6)
92            throws RemoteException {
93        // TODO Auto-generated method stub
94
95    }
96
97    @Override
98    public void addWindowToken(IBinder arg0, int arg1) throws RemoteException {
99        // TODO Auto-generated method stub
100
101    }
102
103    @Override
104    public void clearForcedDisplaySize(int displayId) throws RemoteException {
105        // TODO Auto-generated method stub
106    }
107
108    @Override
109    public void clearForcedDisplayDensity(int displayId) throws RemoteException {
110        // TODO Auto-generated method stub
111    }
112
113    @Override
114    public void setOverscan(int displayId, int left, int top, int right, int bottom)
115            throws RemoteException {
116        // TODO Auto-generated method stub
117    }
118
119    @Override
120    public void closeSystemDialogs(String arg0) throws RemoteException {
121        // TODO Auto-generated method stub
122
123    }
124
125    @Override
126    public void startFreezingScreen(int exitAnim, int enterAnim) {
127        // TODO Auto-generated method stub
128    }
129
130    @Override
131    public void stopFreezingScreen() {
132        // TODO Auto-generated method stub
133    }
134
135    @Override
136    public void disableKeyguard(IBinder arg0, String arg1) throws RemoteException {
137        // TODO Auto-generated method stub
138
139    }
140
141    @Override
142    public void executeAppTransition() throws RemoteException {
143        // TODO Auto-generated method stub
144
145    }
146
147    @Override
148    public void exitKeyguardSecurely(IOnKeyguardExitResult arg0) throws RemoteException {
149        // TODO Auto-generated method stub
150
151    }
152
153    @Override
154    public void freezeRotation(int arg0) throws RemoteException {
155        // TODO Auto-generated method stub
156
157    }
158
159    @Override
160    public float getAnimationScale(int arg0) throws RemoteException {
161        // TODO Auto-generated method stub
162        return 0;
163    }
164
165    @Override
166    public float[] getAnimationScales() throws RemoteException {
167        // TODO Auto-generated method stub
168        return null;
169    }
170
171    @Override
172    public int getAppOrientation(IApplicationToken arg0) throws RemoteException {
173        // TODO Auto-generated method stub
174        return 0;
175    }
176
177    @Override
178    public int getPendingAppTransition() throws RemoteException {
179        // TODO Auto-generated method stub
180        return 0;
181    }
182
183    @Override
184    public boolean inKeyguardRestrictedInputMode() throws RemoteException {
185        // TODO Auto-generated method stub
186        return false;
187    }
188
189    @Override
190    public boolean inputMethodClientHasFocus(IInputMethodClient arg0) throws RemoteException {
191        // TODO Auto-generated method stub
192        return false;
193    }
194
195    @Override
196    public boolean isKeyguardLocked() throws RemoteException {
197        // TODO Auto-generated method stub
198        return false;
199    }
200
201    @Override
202    public boolean isKeyguardSecure() throws RemoteException {
203        // TODO Auto-generated method stub
204        return false;
205    }
206
207    @Override
208    public boolean isViewServerRunning() throws RemoteException {
209        // TODO Auto-generated method stub
210        return false;
211    }
212
213    @Override
214    public IWindowSession openSession(IInputMethodClient arg0, IInputContext arg1)
215            throws RemoteException {
216        // TODO Auto-generated method stub
217        return null;
218    }
219
220    @Override
221    public void overridePendingAppTransition(String arg0, int arg1, int arg2,
222            IRemoteCallback startedCallback) throws RemoteException {
223        // TODO Auto-generated method stub
224
225    }
226
227    @Override
228    public void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
229            int startHeight) throws RemoteException {
230        // TODO Auto-generated method stub
231    }
232
233    @Override
234    public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY,
235            IRemoteCallback startedCallback, boolean scaleUp) throws RemoteException {
236        // TODO Auto-generated method stub
237    }
238
239    @Override
240    public void pauseKeyDispatching(IBinder arg0) throws RemoteException {
241        // TODO Auto-generated method stub
242
243    }
244
245    @Override
246    public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException {
247        // TODO Auto-generated method stub
248
249    }
250
251    @Override
252    public void reenableKeyguard(IBinder arg0) throws RemoteException {
253        // TODO Auto-generated method stub
254
255    }
256
257    @Override
258    public void removeAppToken(IBinder arg0) throws RemoteException {
259        // TODO Auto-generated method stub
260
261    }
262
263    @Override
264    public void removeWindowToken(IBinder arg0) throws RemoteException {
265        // TODO Auto-generated method stub
266
267    }
268
269    @Override
270    public void resumeKeyDispatching(IBinder arg0) throws RemoteException {
271        // TODO Auto-generated method stub
272
273    }
274
275    @Override
276    public Bitmap screenshotApplications(IBinder arg0, int displayId, int arg1, int arg2)
277            throws RemoteException {
278        // TODO Auto-generated method stub
279        return null;
280    }
281
282    @Override
283    public void setAnimationScale(int arg0, float arg1) throws RemoteException {
284        // TODO Auto-generated method stub
285
286    }
287
288    @Override
289    public void setAnimationScales(float[] arg0) throws RemoteException {
290        // TODO Auto-generated method stub
291
292    }
293
294    @Override
295    public void setAppGroupId(IBinder arg0, int arg1) throws RemoteException {
296        // TODO Auto-generated method stub
297
298    }
299
300    @Override
301    public void setAppOrientation(IApplicationToken arg0, int arg1) throws RemoteException {
302        // TODO Auto-generated method stub
303    }
304
305    @Override
306    public void setAppStartingWindow(IBinder arg0, String arg1, int arg2, CompatibilityInfo arg3,
307            CharSequence arg4, int arg5, int arg6, int arg7, IBinder arg8, boolean arg9)
308            throws RemoteException {
309        // TODO Auto-generated method stub
310    }
311
312    @Override
313    public void setAppVisibility(IBinder arg0, boolean arg1) throws RemoteException {
314        // TODO Auto-generated method stub
315
316    }
317
318    @Override
319    public void setAppWillBeHidden(IBinder arg0) throws RemoteException {
320        // TODO Auto-generated method stub
321    }
322
323    @Override
324    public void setEventDispatching(boolean arg0) throws RemoteException {
325        // TODO Auto-generated method stub
326    }
327
328    @Override
329    public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException {
330        // TODO Auto-generated method stub
331    }
332
333    @Override
334    public void getInitialDisplaySize(int displayId, Point size) {
335        // TODO Auto-generated method stub
336    }
337
338    @Override
339    public void getBaseDisplaySize(int displayId, Point size) {
340        // TODO Auto-generated method stub
341    }
342
343    @Override
344    public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException {
345        // TODO Auto-generated method stub
346    }
347
348    @Override
349    public int getInitialDisplayDensity(int displayId) {
350        return -1;
351    }
352
353    @Override
354    public int getBaseDisplayDensity(int displayId) {
355        return -1;
356    }
357
358    @Override
359    public void setForcedDisplayDensity(int displayId, int density) throws RemoteException {
360        // TODO Auto-generated method stub
361    }
362
363    @Override
364    public void setInTouchMode(boolean arg0) throws RemoteException {
365        // TODO Auto-generated method stub
366    }
367
368    @Override
369    public void setNewConfiguration(Configuration arg0) throws RemoteException {
370        // TODO Auto-generated method stub
371    }
372
373    @Override
374    public void updateRotation(boolean arg0, boolean arg1) throws RemoteException {
375        // TODO Auto-generated method stub
376    }
377
378    @Override
379    public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException {
380        // TODO Auto-generated method stub
381    }
382
383    @Override
384    public void showStrictModeViolation(boolean arg0) throws RemoteException {
385        // TODO Auto-generated method stub
386    }
387
388    @Override
389    public void startAppFreezingScreen(IBinder arg0, int arg1) throws RemoteException {
390        // TODO Auto-generated method stub
391    }
392
393    @Override
394    public boolean startViewServer(int arg0) throws RemoteException {
395        // TODO Auto-generated method stub
396        return false;
397    }
398
399    @Override
400    public void statusBarVisibilityChanged(int arg0) throws RemoteException {
401        // TODO Auto-generated method stub
402    }
403
404    @Override
405    public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException {
406        // TODO Auto-generated method stub
407    }
408
409    @Override
410    public boolean stopViewServer() throws RemoteException {
411        // TODO Auto-generated method stub
412        return false;
413    }
414
415    @Override
416    public void thawRotation() throws RemoteException {
417        // TODO Auto-generated method stub
418    }
419
420    @Override
421    public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1)
422            throws RemoteException {
423        // TODO Auto-generated method stub
424        return null;
425    }
426
427    @Override
428    public int watchRotation(IRotationWatcher arg0) throws RemoteException {
429        // TODO Auto-generated method stub
430        return 0;
431    }
432
433    @Override
434    public boolean waitForWindowDrawn(IBinder token, IRemoteCallback callback) {
435        return false;
436    }
437
438    @Override
439    public IBinder asBinder() {
440        // TODO Auto-generated method stub
441        return null;
442    }
443
444    @Override
445    public int getPreferredOptionsPanelGravity() throws RemoteException {
446        return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
447    }
448
449    @Override
450    public void dismissKeyguard() {
451    }
452
453    @Override
454    public void lockNow(Bundle options) {
455        // TODO Auto-generated method stub
456    }
457
458    @Override
459    public boolean isSafeModeEnabled() {
460        return false;
461    }
462
463    @Override
464    public void showAssistant() {
465
466    }
467
468    @Override
469    public IBinder getFocusedWindowToken() {
470        // TODO Auto-generated method stub
471        return null;
472    }
473
474    @Override
475    public void setInputFilter(IInputFilter filter) throws RemoteException {
476        // TODO Auto-generated method stub
477    }
478
479    @Override
480    public void getWindowFrame(IBinder token, Rect outFrame) {
481        // TODO Auto-generated method stub
482    }
483
484    @Override
485    public void setMagnificationCallbacks(IMagnificationCallbacks callbacks) {
486        // TODO Auto-generated method stub
487    }
488
489    @Override
490    public void setMagnificationSpec(MagnificationSpec spec) {
491        // TODO Auto-generated method stub
492    }
493
494    @Override
495    public MagnificationSpec getCompatibleMagnificationSpecForWindow(IBinder windowToken) {
496        // TODO Auto-generated method stub
497        return null;
498    }
499
500    @Override
501    public boolean isRotationFrozen() throws RemoteException {
502        // TODO Auto-generated method stub
503        return false;
504    }
505}
506