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