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.content.res.Configuration; 20 import android.graphics.Bitmap; 21 import android.graphics.GraphicBuffer; 22 import android.graphics.Point; 23 import android.graphics.Rect; 24 import android.graphics.Region; 25 import android.os.Bundle; 26 import android.os.IBinder; 27 import android.os.IRemoteCallback; 28 import android.os.ParcelFileDescriptor; 29 import android.os.RemoteException; 30 import android.util.DisplayMetrics; 31 32 import com.android.internal.app.IAssistScreenshotReceiver; 33 import com.android.internal.os.IResultReceiver; 34 import com.android.internal.policy.IKeyguardDismissCallback; 35 import com.android.internal.policy.IShortcutService; 36 import com.android.internal.view.IInputContext; 37 import com.android.internal.view.IInputMethodClient; 38 39 /** 40 * Basic implementation of {@link IWindowManager} so that {@link Display} (and 41 * {@link Display_Delegate}) can return a valid instance. 42 */ 43 public 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 IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation, boolean hasNavigationBar)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 getMetrics()60 public DisplayMetrics getMetrics() { 61 return mMetrics; 62 } 63 64 // ---- implementation of IWindowManager that we care about ---- 65 66 @Override getDefaultDisplayRotation()67 public int getDefaultDisplayRotation() throws RemoteException { 68 return mRotation; 69 } 70 71 @Override hasNavigationBar()72 public boolean hasNavigationBar() { 73 return mHasNavigationBar; 74 } 75 76 // ---- unused implementation of IWindowManager ---- 77 78 @Override addWindowToken(IBinder arg0, int arg1, int arg2)79 public void addWindowToken(IBinder arg0, int arg1, int arg2) throws RemoteException { 80 // TODO Auto-generated method stub 81 82 } 83 84 @Override clearForcedDisplaySize(int displayId)85 public void clearForcedDisplaySize(int displayId) throws RemoteException { 86 // TODO Auto-generated method stub 87 } 88 89 @Override clearForcedDisplayDensityForUser(int displayId, int userId)90 public void clearForcedDisplayDensityForUser(int displayId, int userId) throws RemoteException { 91 // TODO Auto-generated method stub 92 } 93 94 @Override setOverscan(int displayId, int left, int top, int right, int bottom)95 public void setOverscan(int displayId, int left, int top, int right, int bottom) 96 throws RemoteException { 97 // TODO Auto-generated method stub 98 } 99 100 @Override closeSystemDialogs(String arg0)101 public void closeSystemDialogs(String arg0) throws RemoteException { 102 // TODO Auto-generated method stub 103 104 } 105 106 @Override startFreezingScreen(int exitAnim, int enterAnim)107 public void startFreezingScreen(int exitAnim, int enterAnim) { 108 // TODO Auto-generated method stub 109 } 110 111 @Override stopFreezingScreen()112 public void stopFreezingScreen() { 113 // TODO Auto-generated method stub 114 } 115 116 @Override disableKeyguard(IBinder arg0, String arg1)117 public void disableKeyguard(IBinder arg0, String arg1) throws RemoteException { 118 // TODO Auto-generated method stub 119 120 } 121 122 @Override executeAppTransition()123 public void executeAppTransition() throws RemoteException { 124 // TODO Auto-generated method stub 125 126 } 127 128 @Override exitKeyguardSecurely(IOnKeyguardExitResult arg0)129 public void exitKeyguardSecurely(IOnKeyguardExitResult arg0) throws RemoteException { 130 // TODO Auto-generated method stub 131 132 } 133 134 @Override freezeRotation(int arg0)135 public void freezeRotation(int arg0) throws RemoteException { 136 // TODO Auto-generated method stub 137 138 } 139 140 @Override getAnimationScale(int arg0)141 public float getAnimationScale(int arg0) throws RemoteException { 142 // TODO Auto-generated method stub 143 return 0; 144 } 145 146 @Override getAnimationScales()147 public float[] getAnimationScales() throws RemoteException { 148 // TODO Auto-generated method stub 149 return null; 150 } 151 152 @Override getPendingAppTransition()153 public int getPendingAppTransition() throws RemoteException { 154 // TODO Auto-generated method stub 155 return 0; 156 } 157 158 @Override inKeyguardRestrictedInputMode()159 public boolean inKeyguardRestrictedInputMode() throws RemoteException { 160 // TODO Auto-generated method stub 161 return false; 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 prepareAppTransition(int arg0, boolean arg1)246 public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException { 247 // TODO Auto-generated method stub 248 249 } 250 251 @Override reenableKeyguard(IBinder arg0)252 public void reenableKeyguard(IBinder arg0) throws RemoteException { 253 // TODO Auto-generated method stub 254 255 } 256 257 @Override removeWindowToken(IBinder arg0, int arg1)258 public void removeWindowToken(IBinder arg0, int arg1) throws RemoteException { 259 // TODO Auto-generated method stub 260 261 } 262 263 @Override requestAssistScreenshot(IAssistScreenshotReceiver receiver)264 public boolean requestAssistScreenshot(IAssistScreenshotReceiver receiver) 265 throws RemoteException { 266 // TODO Auto-generated method stub 267 return false; 268 } 269 270 @Override setAnimationScale(int arg0, float arg1)271 public void setAnimationScale(int arg0, float arg1) throws RemoteException { 272 // TODO Auto-generated method stub 273 274 } 275 276 @Override setAnimationScales(float[] arg0)277 public void setAnimationScales(float[] arg0) throws RemoteException { 278 // TODO Auto-generated method stub 279 280 } 281 282 @Override getCurrentAnimatorScale()283 public float getCurrentAnimatorScale() throws RemoteException { 284 return 0; 285 } 286 287 @Override setEventDispatching(boolean arg0)288 public void setEventDispatching(boolean arg0) throws RemoteException { 289 // TODO Auto-generated method stub 290 } 291 292 @Override setFocusedApp(IBinder arg0, boolean arg1)293 public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException { 294 // TODO Auto-generated method stub 295 } 296 297 @Override getInitialDisplaySize(int displayId, Point size)298 public void getInitialDisplaySize(int displayId, Point size) { 299 // TODO Auto-generated method stub 300 } 301 302 @Override getBaseDisplaySize(int displayId, Point size)303 public void getBaseDisplaySize(int displayId, Point size) { 304 // TODO Auto-generated method stub 305 } 306 307 @Override setForcedDisplaySize(int displayId, int arg0, int arg1)308 public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException { 309 // TODO Auto-generated method stub 310 } 311 312 @Override getInitialDisplayDensity(int displayId)313 public int getInitialDisplayDensity(int displayId) { 314 return -1; 315 } 316 317 @Override getBaseDisplayDensity(int displayId)318 public int getBaseDisplayDensity(int displayId) { 319 return -1; 320 } 321 322 @Override setForcedDisplayDensityForUser(int displayId, int density, int userId)323 public void setForcedDisplayDensityForUser(int displayId, int density, int userId) 324 throws RemoteException { 325 // TODO Auto-generated method stub 326 } 327 328 @Override setForcedDisplayScalingMode(int displayId, int mode)329 public void setForcedDisplayScalingMode(int displayId, int mode) { 330 } 331 332 @Override setInTouchMode(boolean arg0)333 public void setInTouchMode(boolean arg0) throws RemoteException { 334 // TODO Auto-generated method stub 335 } 336 337 @Override setNewDisplayOverrideConfiguration(Configuration arg0, int displayId)338 public int[] setNewDisplayOverrideConfiguration(Configuration arg0, int displayId) 339 throws RemoteException { 340 // TODO Auto-generated method stub 341 return null; 342 } 343 344 @Override setScreenCaptureDisabled(int userId, boolean disabled)345 public void setScreenCaptureDisabled(int userId, boolean disabled) { 346 // TODO Auto-generated method stub 347 } 348 349 @Override updateRotation(boolean arg0, boolean arg1)350 public void updateRotation(boolean arg0, boolean arg1) throws RemoteException { 351 // TODO Auto-generated method stub 352 } 353 354 @Override setStrictModeVisualIndicatorPreference(String arg0)355 public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException { 356 // TODO Auto-generated method stub 357 } 358 359 @Override showStrictModeViolation(boolean arg0)360 public void showStrictModeViolation(boolean arg0) throws RemoteException { 361 // TODO Auto-generated method stub 362 } 363 364 @Override startViewServer(int arg0)365 public boolean startViewServer(int arg0) throws RemoteException { 366 // TODO Auto-generated method stub 367 return false; 368 } 369 370 @Override statusBarVisibilityChanged(int arg0)371 public void statusBarVisibilityChanged(int arg0) throws RemoteException { 372 // TODO Auto-generated method stub 373 } 374 375 @Override setRecentsVisibility(boolean visible)376 public void setRecentsVisibility(boolean visible) { 377 // TODO Auto-generated method stub 378 } 379 380 @Override setPipVisibility(boolean visible)381 public void setPipVisibility(boolean visible) { 382 // TODO Auto-generated method stub 383 } 384 385 @Override stopViewServer()386 public boolean stopViewServer() throws RemoteException { 387 // TODO Auto-generated method stub 388 return false; 389 } 390 391 @Override thawRotation()392 public void thawRotation() throws RemoteException { 393 // TODO Auto-generated method stub 394 } 395 396 @Override updateOrientationFromAppTokens(Configuration arg0, IBinder arg1, int arg2)397 public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1, int arg2) 398 throws RemoteException { 399 // TODO Auto-generated method stub 400 return null; 401 } 402 403 @Override watchRotation(IRotationWatcher arg0, int arg1)404 public int watchRotation(IRotationWatcher arg0, int arg1) throws RemoteException { 405 // TODO Auto-generated method stub 406 return 0; 407 } 408 409 @Override removeRotationWatcher(IRotationWatcher arg0)410 public void removeRotationWatcher(IRotationWatcher arg0) throws RemoteException { 411 } 412 413 @Override asBinder()414 public IBinder asBinder() { 415 // TODO Auto-generated method stub 416 return null; 417 } 418 419 @Override getPreferredOptionsPanelGravity()420 public int getPreferredOptionsPanelGravity() throws RemoteException { 421 return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; 422 } 423 424 @Override dismissKeyguard(IKeyguardDismissCallback callback)425 public void dismissKeyguard(IKeyguardDismissCallback callback) throws RemoteException { 426 } 427 428 @Override setSwitchingUser(boolean switching)429 public void setSwitchingUser(boolean switching) throws RemoteException { 430 } 431 432 @Override lockNow(Bundle options)433 public void lockNow(Bundle options) { 434 // TODO Auto-generated method stub 435 } 436 437 @Override isSafeModeEnabled()438 public boolean isSafeModeEnabled() { 439 return false; 440 } 441 442 @Override isRotationFrozen()443 public boolean isRotationFrozen() throws RemoteException { 444 // TODO Auto-generated method stub 445 return false; 446 } 447 448 @Override enableScreenIfNeeded()449 public void enableScreenIfNeeded() throws RemoteException { 450 // TODO Auto-generated method stub 451 } 452 453 @Override clearWindowContentFrameStats(IBinder token)454 public boolean clearWindowContentFrameStats(IBinder token) throws RemoteException { 455 // TODO Auto-generated method stub 456 return false; 457 } 458 459 @Override getWindowContentFrameStats(IBinder token)460 public WindowContentFrameStats getWindowContentFrameStats(IBinder token) 461 throws RemoteException { 462 // TODO Auto-generated method stub 463 return null; 464 } 465 466 @Override getDockedStackSide()467 public int getDockedStackSide() throws RemoteException { 468 return 0; 469 } 470 471 @Override setDockedStackResizing(boolean resizing)472 public void setDockedStackResizing(boolean resizing) throws RemoteException { 473 } 474 475 @Override endProlongedAnimations()476 public void endProlongedAnimations() { 477 } 478 479 @Override registerDockedStackListener(IDockedStackListener listener)480 public void registerDockedStackListener(IDockedStackListener listener) throws RemoteException { 481 } 482 483 @Override registerPinnedStackListener(int displayId, IPinnedStackListener listener)484 public void registerPinnedStackListener(int displayId, IPinnedStackListener listener) throws RemoteException { 485 } 486 487 @Override setResizeDimLayer(boolean visible, int targetStackId, float alpha)488 public void setResizeDimLayer(boolean visible, int targetStackId, float alpha) 489 throws RemoteException { 490 } 491 492 @Override setDockedStackDividerTouchRegion(Rect touchableRegion)493 public void setDockedStackDividerTouchRegion(Rect touchableRegion) throws RemoteException { 494 } 495 496 @Override requestAppKeyboardShortcuts( IResultReceiver receiver, int deviceId)497 public void requestAppKeyboardShortcuts( 498 IResultReceiver receiver, int deviceId) throws RemoteException { 499 } 500 501 @Override getStableInsets(int displayId, Rect outInsets)502 public void getStableInsets(int displayId, Rect outInsets) throws RemoteException { 503 } 504 505 @Override registerShortcutKey(long shortcutCode, IShortcutService service)506 public void registerShortcutKey(long shortcutCode, IShortcutService service) 507 throws RemoteException {} 508 509 @Override createInputConsumer(String name, InputChannel inputChannel)510 public void createInputConsumer(String name, InputChannel inputChannel) 511 throws RemoteException {} 512 513 @Override destroyInputConsumer(String name)514 public boolean destroyInputConsumer(String name) throws RemoteException { 515 return false; 516 } 517 518 @Override screenshotWallpaper()519 public Bitmap screenshotWallpaper() throws RemoteException { 520 return null; 521 } 522 523 @Override enableSurfaceTrace(ParcelFileDescriptor fd)524 public void enableSurfaceTrace(ParcelFileDescriptor fd) throws RemoteException { 525 } 526 527 @Override disableSurfaceTrace()528 public void disableSurfaceTrace() throws RemoteException { 529 } 530 531 @Override getCurrentImeTouchRegion()532 public Region getCurrentImeTouchRegion() throws RemoteException { 533 return null; 534 } 535 536 @Override registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener, int displayId)537 public boolean registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener, 538 int displayId) throws RemoteException { 539 return false; 540 } 541 542 @Override unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener, int displayId)543 public void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener, 544 int displayId) throws RemoteException { 545 } 546 } 547