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