Adam Lesinski | 282e181 | 2014-01-23 18:17:42 -0800 | [diff] [blame^] | 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.graphics.Point; |
| 20 | import com.android.internal.view.IInputContext; |
| 21 | import com.android.internal.view.IInputMethodClient; |
| 22 | |
| 23 | import android.content.res.CompatibilityInfo; |
| 24 | import android.content.res.Configuration; |
| 25 | import android.graphics.Bitmap; |
| 26 | import android.graphics.Rect; |
| 27 | import android.os.Bundle; |
| 28 | import android.os.IBinder; |
| 29 | import android.os.IRemoteCallback; |
| 30 | import android.os.RemoteException; |
| 31 | import android.util.DisplayMetrics; |
| 32 | import android.view.Display; |
| 33 | import android.view.Gravity; |
| 34 | import android.view.IApplicationToken; |
| 35 | import android.view.IInputFilter; |
| 36 | import android.view.IOnKeyguardExitResult; |
| 37 | import android.view.IRotationWatcher; |
| 38 | import android.view.IWindowManager; |
| 39 | import android.view.IWindowSession; |
| 40 | |
| 41 | import java.util.List; |
| 42 | |
| 43 | /** |
| 44 | * Basic implementation of {@link IWindowManager} so that {@link Display} (and |
| 45 | * {@link Display_Delegate}) can return a valid instance. |
| 46 | */ |
| 47 | public class IWindowManagerImpl implements IWindowManager { |
| 48 | |
| 49 | private final Configuration mConfig; |
| 50 | private final DisplayMetrics mMetrics; |
| 51 | private final int mRotation; |
| 52 | private final boolean mHasNavigationBar; |
| 53 | |
| 54 | public IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation, |
| 55 | boolean hasNavigationBar) { |
| 56 | mConfig = config; |
| 57 | mMetrics = metrics; |
| 58 | mRotation = rotation; |
| 59 | mHasNavigationBar = hasNavigationBar; |
| 60 | } |
| 61 | |
| 62 | // custom API. |
| 63 | |
| 64 | public DisplayMetrics getMetrics() { |
| 65 | return mMetrics; |
| 66 | } |
| 67 | |
| 68 | // ---- implementation of IWindowManager that we care about ---- |
| 69 | |
| 70 | @Override |
| 71 | public int getRotation() throws RemoteException { |
| 72 | return mRotation; |
| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public boolean hasNavigationBar() { |
| 77 | return mHasNavigationBar; |
| 78 | } |
| 79 | |
| 80 | // ---- unused implementation of IWindowManager ---- |
| 81 | |
| 82 | @Override |
| 83 | public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, int arg4, |
| 84 | boolean arg5, boolean arg6, int arg7) |
| 85 | throws RemoteException { |
| 86 | // TODO Auto-generated method stub |
| 87 | |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public void addWindowToken(IBinder arg0, int arg1) throws RemoteException { |
| 92 | // TODO Auto-generated method stub |
| 93 | |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public void clearForcedDisplaySize(int displayId) throws RemoteException { |
| 98 | // TODO Auto-generated method stub |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | public void clearForcedDisplayDensity(int displayId) throws RemoteException { |
| 103 | // TODO Auto-generated method stub |
| 104 | } |
| 105 | |
| 106 | @Override |
| 107 | public void setOverscan(int displayId, int left, int top, int right, int bottom) |
| 108 | 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 IWindowSession openSession(IInputMethodClient arg0, IInputContext arg1) |
| 208 | throws RemoteException { |
| 209 | // TODO Auto-generated method stub |
| 210 | return null; |
| 211 | } |
| 212 | |
| 213 | @Override |
| 214 | public void overridePendingAppTransition(String arg0, int arg1, int arg2, |
| 215 | IRemoteCallback startedCallback) throws RemoteException { |
| 216 | // TODO Auto-generated method stub |
| 217 | |
| 218 | } |
| 219 | |
| 220 | @Override |
| 221 | public void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth, |
| 222 | int startHeight) throws RemoteException { |
| 223 | // TODO Auto-generated method stub |
| 224 | } |
| 225 | |
| 226 | @Override |
| 227 | public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY, |
| 228 | IRemoteCallback startedCallback, boolean scaleUp) throws RemoteException { |
| 229 | // TODO Auto-generated method stub |
| 230 | } |
| 231 | |
| 232 | @Override |
| 233 | public void pauseKeyDispatching(IBinder arg0) throws RemoteException { |
| 234 | // TODO Auto-generated method stub |
| 235 | |
| 236 | } |
| 237 | |
| 238 | @Override |
| 239 | public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException { |
| 240 | // TODO Auto-generated method stub |
| 241 | |
| 242 | } |
| 243 | |
| 244 | @Override |
| 245 | public void reenableKeyguard(IBinder arg0) throws RemoteException { |
| 246 | // TODO Auto-generated method stub |
| 247 | |
| 248 | } |
| 249 | |
| 250 | @Override |
| 251 | public void removeAppToken(IBinder arg0) throws RemoteException { |
| 252 | // TODO Auto-generated method stub |
| 253 | |
| 254 | } |
| 255 | |
| 256 | @Override |
| 257 | public void removeWindowToken(IBinder arg0) throws RemoteException { |
| 258 | // TODO Auto-generated method stub |
| 259 | |
| 260 | } |
| 261 | |
| 262 | @Override |
| 263 | public void resumeKeyDispatching(IBinder arg0) throws RemoteException { |
| 264 | // TODO Auto-generated method stub |
| 265 | |
| 266 | } |
| 267 | |
| 268 | @Override |
| 269 | public Bitmap screenshotApplications(IBinder arg0, int displayId, int arg1, int arg2) |
| 270 | throws RemoteException { |
| 271 | // TODO Auto-generated method stub |
| 272 | return null; |
| 273 | } |
| 274 | |
| 275 | @Override |
| 276 | public void setAnimationScale(int arg0, float arg1) throws RemoteException { |
| 277 | // TODO Auto-generated method stub |
| 278 | |
| 279 | } |
| 280 | |
| 281 | @Override |
| 282 | public void setAnimationScales(float[] arg0) throws RemoteException { |
| 283 | // TODO Auto-generated method stub |
| 284 | |
| 285 | } |
| 286 | |
| 287 | @Override |
| 288 | public void setAppGroupId(IBinder arg0, int arg1) throws RemoteException { |
| 289 | // TODO Auto-generated method stub |
| 290 | |
| 291 | } |
| 292 | |
| 293 | @Override |
| 294 | public void setAppOrientation(IApplicationToken arg0, int arg1) throws RemoteException { |
| 295 | // TODO Auto-generated method stub |
| 296 | } |
| 297 | |
| 298 | @Override |
| 299 | public void setAppStartingWindow(IBinder arg0, String arg1, int arg2, CompatibilityInfo arg3, |
| 300 | CharSequence arg4, int arg5, int arg6, int arg7, int arg8, IBinder arg9, boolean arg10) |
| 301 | throws RemoteException { |
| 302 | // TODO Auto-generated method stub |
| 303 | } |
| 304 | |
| 305 | @Override |
| 306 | public void setAppVisibility(IBinder arg0, boolean arg1) throws RemoteException { |
| 307 | // TODO Auto-generated method stub |
| 308 | |
| 309 | } |
| 310 | |
| 311 | @Override |
| 312 | public void setAppWillBeHidden(IBinder arg0) throws RemoteException { |
| 313 | // TODO Auto-generated method stub |
| 314 | } |
| 315 | |
| 316 | @Override |
| 317 | public void setEventDispatching(boolean arg0) throws RemoteException { |
| 318 | // TODO Auto-generated method stub |
| 319 | } |
| 320 | |
| 321 | @Override |
| 322 | public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException { |
| 323 | // TODO Auto-generated method stub |
| 324 | } |
| 325 | |
| 326 | @Override |
| 327 | public void getInitialDisplaySize(int displayId, Point size) { |
| 328 | // TODO Auto-generated method stub |
| 329 | } |
| 330 | |
| 331 | @Override |
| 332 | public void getBaseDisplaySize(int displayId, Point size) { |
| 333 | // TODO Auto-generated method stub |
| 334 | } |
| 335 | |
| 336 | @Override |
| 337 | public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException { |
| 338 | // TODO Auto-generated method stub |
| 339 | } |
| 340 | |
| 341 | @Override |
| 342 | public int getInitialDisplayDensity(int displayId) { |
| 343 | return -1; |
| 344 | } |
| 345 | |
| 346 | @Override |
| 347 | public int getBaseDisplayDensity(int displayId) { |
| 348 | return -1; |
| 349 | } |
| 350 | |
| 351 | @Override |
| 352 | public void setForcedDisplayDensity(int displayId, int density) throws RemoteException { |
| 353 | // TODO Auto-generated method stub |
| 354 | } |
| 355 | |
| 356 | @Override |
| 357 | public void setInTouchMode(boolean arg0) throws RemoteException { |
| 358 | // TODO Auto-generated method stub |
| 359 | } |
| 360 | |
| 361 | @Override |
| 362 | public void setNewConfiguration(Configuration arg0) throws RemoteException { |
| 363 | // TODO Auto-generated method stub |
| 364 | } |
| 365 | |
| 366 | @Override |
| 367 | public void updateRotation(boolean arg0, boolean arg1) throws RemoteException { |
| 368 | // TODO Auto-generated method stub |
| 369 | } |
| 370 | |
| 371 | @Override |
| 372 | public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException { |
| 373 | // TODO Auto-generated method stub |
| 374 | } |
| 375 | |
| 376 | @Override |
| 377 | public void showStrictModeViolation(boolean arg0) throws RemoteException { |
| 378 | // TODO Auto-generated method stub |
| 379 | } |
| 380 | |
| 381 | @Override |
| 382 | public void startAppFreezingScreen(IBinder arg0, int arg1) throws RemoteException { |
| 383 | // TODO Auto-generated method stub |
| 384 | } |
| 385 | |
| 386 | @Override |
| 387 | public boolean startViewServer(int arg0) throws RemoteException { |
| 388 | // TODO Auto-generated method stub |
| 389 | return false; |
| 390 | } |
| 391 | |
| 392 | @Override |
| 393 | public void statusBarVisibilityChanged(int arg0) throws RemoteException { |
| 394 | // TODO Auto-generated method stub |
| 395 | } |
| 396 | |
| 397 | @Override |
| 398 | public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException { |
| 399 | // TODO Auto-generated method stub |
| 400 | } |
| 401 | |
| 402 | @Override |
| 403 | public boolean stopViewServer() throws RemoteException { |
| 404 | // TODO Auto-generated method stub |
| 405 | return false; |
| 406 | } |
| 407 | |
| 408 | @Override |
| 409 | public void thawRotation() throws RemoteException { |
| 410 | // TODO Auto-generated method stub |
| 411 | } |
| 412 | |
| 413 | @Override |
| 414 | public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1) |
| 415 | throws RemoteException { |
| 416 | // TODO Auto-generated method stub |
| 417 | return null; |
| 418 | } |
| 419 | |
| 420 | @Override |
| 421 | public int watchRotation(IRotationWatcher arg0) throws RemoteException { |
| 422 | // TODO Auto-generated method stub |
| 423 | return 0; |
| 424 | } |
| 425 | |
| 426 | @Override |
| 427 | public void removeRotationWatcher(IRotationWatcher arg0) throws RemoteException { |
| 428 | } |
| 429 | |
| 430 | @Override |
| 431 | public boolean waitForWindowDrawn(IBinder token, IRemoteCallback callback) { |
| 432 | return false; |
| 433 | } |
| 434 | |
| 435 | @Override |
| 436 | public IBinder asBinder() { |
| 437 | // TODO Auto-generated method stub |
| 438 | return null; |
| 439 | } |
| 440 | |
| 441 | @Override |
| 442 | public int getPreferredOptionsPanelGravity() throws RemoteException { |
| 443 | return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM; |
| 444 | } |
| 445 | |
| 446 | @Override |
| 447 | public void dismissKeyguard() { |
| 448 | } |
| 449 | |
| 450 | @Override |
| 451 | public void lockNow(Bundle options) { |
| 452 | // TODO Auto-generated method stub |
| 453 | } |
| 454 | |
| 455 | @Override |
| 456 | public boolean isSafeModeEnabled() { |
| 457 | return false; |
| 458 | } |
| 459 | |
| 460 | @Override |
| 461 | public void showAssistant() { |
| 462 | |
| 463 | } |
| 464 | |
| 465 | @Override |
| 466 | public IBinder getFocusedWindowToken() { |
| 467 | // TODO Auto-generated method stub |
| 468 | return null; |
| 469 | } |
| 470 | |
| 471 | @Override |
| 472 | public void setInputFilter(IInputFilter filter) throws RemoteException { |
| 473 | // TODO Auto-generated method stub |
| 474 | } |
| 475 | |
| 476 | @Override |
| 477 | public void getWindowFrame(IBinder token, Rect outFrame) { |
| 478 | // TODO Auto-generated method stub |
| 479 | } |
| 480 | |
| 481 | @Override |
| 482 | public void setMagnificationCallbacks(IMagnificationCallbacks callbacks) { |
| 483 | // TODO Auto-generated method stub |
| 484 | } |
| 485 | |
| 486 | @Override |
| 487 | public void setMagnificationSpec(MagnificationSpec spec) { |
| 488 | // TODO Auto-generated method stub |
| 489 | } |
| 490 | |
| 491 | @Override |
| 492 | public MagnificationSpec getCompatibleMagnificationSpecForWindow(IBinder windowToken) { |
| 493 | // TODO Auto-generated method stub |
| 494 | return null; |
| 495 | } |
| 496 | |
| 497 | @Override |
| 498 | public boolean isRotationFrozen() throws RemoteException { |
| 499 | // TODO Auto-generated method stub |
| 500 | return false; |
| 501 | } |
| 502 | } |