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