IWindowManagerImpl.java revision f3d46ce88f0777dddfbecebc9bd7f2f216206365
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, boolean arg4,
91                            boolean arg5)
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 void moveAppToken(int arg0, IBinder arg1) throws RemoteException {
215        // TODO Auto-generated method stub
216
217    }
218
219    @Override
220    public void moveAppTokensToBottom(List<IBinder> arg0) throws RemoteException {
221        // TODO Auto-generated method stub
222
223    }
224
225    @Override
226    public void moveAppTokensToTop(List<IBinder> arg0) throws RemoteException {
227        // TODO Auto-generated method stub
228
229    }
230
231    @Override
232    public IWindowSession openSession(IInputMethodClient arg0, IInputContext arg1)
233            throws RemoteException {
234        // TODO Auto-generated method stub
235        return null;
236    }
237
238    @Override
239    public void overridePendingAppTransition(String arg0, int arg1, int arg2,
240            IRemoteCallback startedCallback) throws RemoteException {
241        // TODO Auto-generated method stub
242
243    }
244
245    @Override
246    public void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
247            int startHeight) throws RemoteException {
248        // TODO Auto-generated method stub
249    }
250
251    @Override
252    public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY,
253            IRemoteCallback startedCallback, boolean scaleUp) throws RemoteException {
254        // TODO Auto-generated method stub
255    }
256
257    @Override
258    public void pauseKeyDispatching(IBinder arg0) throws RemoteException {
259        // TODO Auto-generated method stub
260
261    }
262
263    @Override
264    public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException {
265        // TODO Auto-generated method stub
266
267    }
268
269    @Override
270    public void reenableKeyguard(IBinder arg0) throws RemoteException {
271        // TODO Auto-generated method stub
272
273    }
274
275    @Override
276    public void removeAppToken(IBinder arg0) throws RemoteException {
277        // TODO Auto-generated method stub
278
279    }
280
281    @Override
282    public void removeWindowToken(IBinder arg0) throws RemoteException {
283        // TODO Auto-generated method stub
284
285    }
286
287    @Override
288    public void resumeKeyDispatching(IBinder arg0) throws RemoteException {
289        // TODO Auto-generated method stub
290
291    }
292
293    @Override
294    public Bitmap screenshotApplications(IBinder arg0, int displayId, int arg1, int arg2)
295            throws RemoteException {
296        // TODO Auto-generated method stub
297        return null;
298    }
299
300    @Override
301    public void setAnimationScale(int arg0, float arg1) throws RemoteException {
302        // TODO Auto-generated method stub
303
304    }
305
306    @Override
307    public void setAnimationScales(float[] arg0) throws RemoteException {
308        // TODO Auto-generated method stub
309
310    }
311
312    @Override
313    public void setAppGroupId(IBinder arg0, int arg1) throws RemoteException {
314        // TODO Auto-generated method stub
315
316    }
317
318    @Override
319    public void setAppOrientation(IApplicationToken arg0, int arg1) throws RemoteException {
320        // TODO Auto-generated method stub
321    }
322
323    @Override
324    public void setAppStartingWindow(IBinder arg0, String arg1, int arg2, CompatibilityInfo arg3,
325            CharSequence arg4, int arg5, int arg6, int arg7, IBinder arg8, boolean arg9)
326            throws RemoteException {
327        // TODO Auto-generated method stub
328    }
329
330    @Override
331    public void setAppVisibility(IBinder arg0, boolean arg1) throws RemoteException {
332        // TODO Auto-generated method stub
333
334    }
335
336    @Override
337    public void setAppWillBeHidden(IBinder arg0) throws RemoteException {
338        // TODO Auto-generated method stub
339    }
340
341    @Override
342    public void setEventDispatching(boolean arg0) throws RemoteException {
343        // TODO Auto-generated method stub
344    }
345
346    @Override
347    public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException {
348        // TODO Auto-generated method stub
349    }
350
351    @Override
352    public void getInitialDisplaySize(int displayId, Point size) {
353        // TODO Auto-generated method stub
354    }
355
356    @Override
357    public void getBaseDisplaySize(int displayId, Point size) {
358        // TODO Auto-generated method stub
359    }
360
361    @Override
362    public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException {
363        // TODO Auto-generated method stub
364    }
365
366    @Override
367    public int getInitialDisplayDensity(int displayId) {
368        return -1;
369    }
370
371    @Override
372    public int getBaseDisplayDensity(int displayId) {
373        return -1;
374    }
375
376    @Override
377    public void setForcedDisplayDensity(int displayId, int density) throws RemoteException {
378        // TODO Auto-generated method stub
379    }
380
381    @Override
382    public void setInTouchMode(boolean arg0) throws RemoteException {
383        // TODO Auto-generated method stub
384    }
385
386    @Override
387    public void setNewConfiguration(Configuration arg0) throws RemoteException {
388        // TODO Auto-generated method stub
389    }
390
391    @Override
392    public void updateRotation(boolean arg0, boolean arg1) throws RemoteException {
393        // TODO Auto-generated method stub
394    }
395
396    @Override
397    public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException {
398        // TODO Auto-generated method stub
399    }
400
401    @Override
402    public void showStrictModeViolation(boolean arg0) throws RemoteException {
403        // TODO Auto-generated method stub
404    }
405
406    @Override
407    public void startAppFreezingScreen(IBinder arg0, int arg1) throws RemoteException {
408        // TODO Auto-generated method stub
409    }
410
411    @Override
412    public boolean startViewServer(int arg0) throws RemoteException {
413        // TODO Auto-generated method stub
414        return false;
415    }
416
417    @Override
418    public void statusBarVisibilityChanged(int arg0) throws RemoteException {
419        // TODO Auto-generated method stub
420    }
421
422    @Override
423    public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException {
424        // TODO Auto-generated method stub
425    }
426
427    @Override
428    public boolean stopViewServer() throws RemoteException {
429        // TODO Auto-generated method stub
430        return false;
431    }
432
433    @Override
434    public void thawRotation() throws RemoteException {
435        // TODO Auto-generated method stub
436    }
437
438    @Override
439    public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1)
440            throws RemoteException {
441        // TODO Auto-generated method stub
442        return null;
443    }
444
445    @Override
446    public int watchRotation(IRotationWatcher arg0) throws RemoteException {
447        // TODO Auto-generated method stub
448        return 0;
449    }
450
451    @Override
452    public boolean waitForWindowDrawn(IBinder token, IRemoteCallback callback) {
453        return false;
454    }
455
456    @Override
457    public IBinder asBinder() {
458        // TODO Auto-generated method stub
459        return null;
460    }
461
462    @Override
463    public int getPreferredOptionsPanelGravity() throws RemoteException {
464        return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
465    }
466
467    @Override
468    public void dismissKeyguard() {
469    }
470
471    @Override
472    public void lockNow(Bundle options) {
473        // TODO Auto-generated method stub
474    }
475
476    @Override
477    public boolean isSafeModeEnabled() {
478        return false;
479    }
480
481    @Override
482    public void showAssistant() {
483
484    }
485
486    @Override
487    public IBinder getFocusedWindowToken() {
488        // TODO Auto-generated method stub
489        return null;
490    }
491
492    @Override
493    public void setInputFilter(IInputFilter filter) throws RemoteException {
494        // TODO Auto-generated method stub
495    }
496
497    @Override
498    public void getWindowFrame(IBinder token, Rect outFrame) {
499        // TODO Auto-generated method stub
500    }
501
502    @Override
503    public void setMagnificationCallbacks(IMagnificationCallbacks callbacks) {
504        // TODO Auto-generated method stub
505    }
506
507    @Override
508    public void setMagnificationSpec(MagnificationSpec spec) {
509        // TODO Auto-generated method stub
510    }
511
512    @Override
513    public MagnificationSpec getCompatibleMagnificationSpecForWindow(IBinder windowToken) {
514        // TODO Auto-generated method stub
515        return null;
516    }
517
518    @Override
519    public boolean isRotationFrozen() throws RemoteException {
520        // TODO Auto-generated method stub
521        return false;
522    }
523}
524