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