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