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