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