Wale Ogunwale | b699ce0 | 2016-07-18 12:05:30 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 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 com.android.server.wm; |
| 18 | |
| 19 | import com.android.internal.policy.IShortcutService; |
| 20 | |
| 21 | import android.content.Context; |
| 22 | import android.content.pm.ActivityInfo; |
| 23 | import android.content.res.CompatibilityInfo; |
| 24 | import android.content.res.Configuration; |
| 25 | import android.graphics.Rect; |
| 26 | import android.os.Bundle; |
| 27 | import android.os.IBinder; |
| 28 | import android.os.RemoteException; |
| 29 | import android.view.Display; |
| 30 | import android.view.IWindowManager; |
| 31 | import android.view.KeyEvent; |
| 32 | import android.view.Surface; |
| 33 | import android.view.View; |
| 34 | import android.view.WindowManager; |
| 35 | import android.view.WindowManagerPolicy; |
| 36 | import android.view.animation.Animation; |
| 37 | |
| 38 | import java.io.PrintWriter; |
| 39 | |
| 40 | public class TestWindowManagerPolicy implements WindowManagerPolicy { |
| 41 | |
| 42 | @Override |
| 43 | public void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver) |
| 44 | throws RemoteException { |
| 45 | |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public void init(Context context, IWindowManager windowManager, |
| 50 | WindowManagerFuncs windowManagerFuncs) { |
| 51 | |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public boolean isDefaultOrientationForced() { |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public void setInitialDisplaySize(Display display, int width, int height, int density) { |
| 61 | |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public void setDisplayOverscan(Display display, int left, int top, int right, int bottom) { |
| 66 | |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public int checkAddPermission(WindowManager.LayoutParams attrs, int[] outAppOp) { |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public boolean checkShowToOwnerOnly(WindowManager.LayoutParams attrs) { |
| 76 | return false; |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public void adjustWindowParamsLw(WindowManager.LayoutParams attrs) { |
| 81 | |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public void adjustConfigurationLw(Configuration config, int keyboardPresence, |
| 86 | int navigationPresence) { |
| 87 | |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public int windowTypeToLayerLw(int type) { |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | @Override |
| 96 | public int subWindowTypeToLayerLw(int type) { |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | @Override |
| 101 | public int getMaxWallpaperLayer() { |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | @Override |
| 106 | public int getNonDecorDisplayWidth(int fullWidth, int fullHeight, int rotation, int uiMode) { |
| 107 | return 0; |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation, int uiMode) { |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation, int uiMode) { |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | @Override |
| 121 | public int getConfigDisplayHeight(int fullWidth, int fullHeight, int rotation, int uiMode) { |
| 122 | return 0; |
| 123 | } |
| 124 | |
| 125 | @Override |
| 126 | public boolean isForceHiding(WindowManager.LayoutParams attrs) { |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | @Override |
| 131 | public boolean isKeyguardHostWindow(WindowManager.LayoutParams attrs) { |
| 132 | return false; |
| 133 | } |
| 134 | |
| 135 | @Override |
| 136 | public boolean canBeForceHidden(WindowState win, |
| 137 | WindowManager.LayoutParams attrs) { |
| 138 | return false; |
| 139 | } |
| 140 | |
| 141 | @Override |
| 142 | public WindowState getWinShowWhenLockedLw() { |
| 143 | return null; |
| 144 | } |
| 145 | |
| 146 | @Override |
| 147 | public View addStartingWindow(IBinder appToken, String packageName, int theme, |
| 148 | CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, |
| 149 | int logo, int windowFlags, Configuration overrideConfig) { |
| 150 | return null; |
| 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public void removeStartingWindow(IBinder appToken, View window) { |
| 155 | |
| 156 | } |
| 157 | |
| 158 | @Override |
| 159 | public int prepareAddWindowLw(WindowState win, |
| 160 | WindowManager.LayoutParams attrs) { |
| 161 | return 0; |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public void removeWindowLw(WindowState win) { |
| 166 | |
| 167 | } |
| 168 | |
| 169 | @Override |
| 170 | public int selectAnimationLw(WindowState win, int transit) { |
| 171 | return 0; |
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public void selectRotationAnimationLw(int[] anim) { |
| 176 | |
| 177 | } |
| 178 | |
| 179 | @Override |
| 180 | public boolean validateRotationAnimationLw(int exitAnimId, int enterAnimId, |
| 181 | boolean forceDefault) { |
| 182 | return false; |
| 183 | } |
| 184 | |
| 185 | @Override |
| 186 | public Animation createForceHideEnterAnimation(boolean onWallpaper, |
| 187 | boolean goingToNotificationShade) { |
| 188 | return null; |
| 189 | } |
| 190 | |
| 191 | @Override |
| 192 | public Animation createForceHideWallpaperExitAnimation(boolean goingToNotificationShade) { |
| 193 | return null; |
| 194 | } |
| 195 | |
| 196 | @Override |
| 197 | public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags) { |
| 198 | return 0; |
| 199 | } |
| 200 | |
| 201 | @Override |
| 202 | public int interceptMotionBeforeQueueingNonInteractive(long whenNanos, int policyFlags) { |
| 203 | return 0; |
| 204 | } |
| 205 | |
| 206 | @Override |
| 207 | public long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, |
| 208 | int policyFlags) { |
| 209 | return 0; |
| 210 | } |
| 211 | |
| 212 | @Override |
| 213 | public KeyEvent dispatchUnhandledKey(WindowState win, KeyEvent event, |
| 214 | int policyFlags) { |
| 215 | return null; |
| 216 | } |
| 217 | |
| 218 | @Override |
| 219 | public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight, |
| 220 | int displayRotation, int uiMode) { |
| 221 | |
| 222 | } |
| 223 | |
| 224 | @Override |
| 225 | public int getSystemDecorLayerLw() { |
| 226 | return 0; |
| 227 | } |
| 228 | |
| 229 | @Override |
| 230 | public void getContentRectLw(Rect r) { |
| 231 | |
| 232 | } |
| 233 | |
| 234 | @Override |
| 235 | public void layoutWindowLw(WindowState win, |
| 236 | WindowState attached) { |
| 237 | |
| 238 | } |
| 239 | |
| 240 | @Override |
| 241 | public boolean getInsetHintLw(WindowManager.LayoutParams attrs, Rect taskBounds, |
| 242 | int displayRotation, int displayWidth, int displayHeight, Rect outContentInsets, |
| 243 | Rect outStableInsets, Rect outOutsets) { |
| 244 | return false; |
| 245 | } |
| 246 | |
| 247 | @Override |
| 248 | public void finishLayoutLw() { |
| 249 | |
| 250 | } |
| 251 | |
| 252 | @Override |
| 253 | public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight) { |
| 254 | |
| 255 | } |
| 256 | |
| 257 | @Override |
| 258 | public void applyPostLayoutPolicyLw(WindowState win, |
| 259 | WindowManager.LayoutParams attrs, WindowState attached) { |
| 260 | |
| 261 | } |
| 262 | |
| 263 | @Override |
| 264 | public int finishPostLayoutPolicyLw() { |
| 265 | return 0; |
| 266 | } |
| 267 | |
| 268 | @Override |
| 269 | public boolean allowAppAnimationsLw() { |
| 270 | return false; |
| 271 | } |
| 272 | |
| 273 | @Override |
| 274 | public int focusChangedLw(WindowState lastFocus, |
| 275 | WindowState newFocus) { |
| 276 | return 0; |
| 277 | } |
| 278 | |
| 279 | @Override |
| 280 | public void startedWakingUp() { |
| 281 | |
| 282 | } |
| 283 | |
| 284 | @Override |
| 285 | public void finishedWakingUp() { |
| 286 | |
| 287 | } |
| 288 | |
| 289 | @Override |
| 290 | public void startedGoingToSleep(int why) { |
| 291 | |
| 292 | } |
| 293 | |
| 294 | @Override |
| 295 | public void finishedGoingToSleep(int why) { |
| 296 | |
| 297 | } |
| 298 | |
| 299 | @Override |
| 300 | public void screenTurningOn(ScreenOnListener screenOnListener) { |
| 301 | |
| 302 | } |
| 303 | |
| 304 | @Override |
| 305 | public void screenTurnedOn() { |
| 306 | |
| 307 | } |
| 308 | |
| 309 | @Override |
| 310 | public void screenTurnedOff() { |
| 311 | |
| 312 | } |
| 313 | |
| 314 | @Override |
| 315 | public boolean isScreenOn() { |
| 316 | return false; |
| 317 | } |
| 318 | |
| 319 | @Override |
| 320 | public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) { |
| 321 | |
| 322 | } |
| 323 | |
| 324 | @Override |
| 325 | public void notifyCameraLensCoverSwitchChanged(long whenNanos, boolean lensCovered) { |
| 326 | |
| 327 | } |
| 328 | |
| 329 | @Override |
| 330 | public void enableKeyguard(boolean enabled) { |
| 331 | |
| 332 | } |
| 333 | |
| 334 | @Override |
| 335 | public void exitKeyguardSecurely(OnKeyguardExitResult callback) { |
| 336 | |
| 337 | } |
| 338 | |
| 339 | @Override |
| 340 | public boolean isKeyguardLocked() { |
| 341 | return false; |
| 342 | } |
| 343 | |
| 344 | @Override |
| 345 | public boolean isKeyguardSecure(int userId) { |
| 346 | return false; |
| 347 | } |
| 348 | |
| 349 | @Override |
| 350 | public boolean isKeyguardShowingOrOccluded() { |
| 351 | return false; |
| 352 | } |
| 353 | |
| 354 | @Override |
| 355 | public boolean isKeyguardShowingAndNotOccluded() { |
| 356 | return false; |
| 357 | } |
| 358 | |
| 359 | @Override |
| 360 | public boolean inKeyguardRestrictedKeyInputMode() { |
| 361 | return false; |
| 362 | } |
| 363 | |
| 364 | @Override |
| 365 | public void dismissKeyguardLw() { |
| 366 | |
| 367 | } |
| 368 | |
| 369 | @Override |
| 370 | public void notifyActivityDrawnForKeyguardLw() { |
| 371 | |
| 372 | } |
| 373 | |
| 374 | @Override |
| 375 | public boolean isKeyguardDrawnLw() { |
| 376 | return false; |
| 377 | } |
| 378 | |
| 379 | @Override |
| 380 | public int rotationForOrientationLw(int orientation, |
| 381 | int lastRotation) { |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | @Override |
| 386 | public boolean rotationHasCompatibleMetricsLw(int orientation, |
| 387 | int rotation) { |
| 388 | return false; |
| 389 | } |
| 390 | |
| 391 | @Override |
| 392 | public void setRotationLw(int rotation) { |
| 393 | |
| 394 | } |
| 395 | |
| 396 | @Override |
| 397 | public void setSafeMode(boolean safeMode) { |
| 398 | |
| 399 | } |
| 400 | |
| 401 | @Override |
| 402 | public void systemReady() { |
| 403 | |
| 404 | } |
| 405 | |
| 406 | @Override |
| 407 | public void systemBooted() { |
| 408 | |
| 409 | } |
| 410 | |
| 411 | @Override |
| 412 | public void showBootMessage(CharSequence msg, boolean always) { |
| 413 | |
| 414 | } |
| 415 | |
| 416 | @Override |
| 417 | public void hideBootMessages() { |
| 418 | |
| 419 | } |
| 420 | |
| 421 | @Override |
| 422 | public void userActivity() { |
| 423 | |
| 424 | } |
| 425 | |
| 426 | @Override |
| 427 | public void enableScreenAfterBoot() { |
| 428 | |
| 429 | } |
| 430 | |
| 431 | @Override |
| 432 | public void setCurrentOrientationLw(int newOrientation) { |
| 433 | |
| 434 | } |
| 435 | |
| 436 | @Override |
| 437 | public boolean performHapticFeedbackLw(WindowState win, int effectId, |
| 438 | boolean always) { |
| 439 | return false; |
| 440 | } |
| 441 | |
| 442 | @Override |
| 443 | public void keepScreenOnStartedLw() { |
| 444 | |
| 445 | } |
| 446 | |
| 447 | @Override |
| 448 | public void keepScreenOnStoppedLw() { |
| 449 | |
| 450 | } |
| 451 | |
| 452 | @Override |
| 453 | public int getUserRotationMode() { |
| 454 | return 0; |
| 455 | } |
| 456 | |
| 457 | @Override |
| 458 | public void setUserRotationMode(int mode, |
| 459 | int rotation) { |
| 460 | |
| 461 | } |
| 462 | |
| 463 | @Override |
| 464 | public int adjustSystemUiVisibilityLw(int visibility) { |
| 465 | return 0; |
| 466 | } |
| 467 | |
| 468 | @Override |
| 469 | public boolean hasNavigationBar() { |
| 470 | return false; |
| 471 | } |
| 472 | |
| 473 | @Override |
| 474 | public void lockNow(Bundle options) { |
| 475 | |
| 476 | } |
| 477 | |
| 478 | @Override |
| 479 | public void setLastInputMethodWindowLw(WindowState ime, |
| 480 | WindowState target) { |
| 481 | |
| 482 | } |
| 483 | |
| 484 | @Override |
| 485 | public void showRecentApps(boolean fromHome) { |
| 486 | |
| 487 | } |
| 488 | |
| 489 | @Override |
| 490 | public void showGlobalActions() { |
| 491 | |
| 492 | } |
| 493 | |
| 494 | @Override |
| 495 | public int getInputMethodWindowVisibleHeightLw() { |
| 496 | return 0; |
| 497 | } |
| 498 | |
| 499 | @Override |
| 500 | public void setCurrentUserLw(int newUserId) { |
| 501 | |
| 502 | } |
| 503 | |
| 504 | @Override |
| 505 | public void dump(String prefix, PrintWriter writer, String[] args) { |
| 506 | |
| 507 | } |
| 508 | |
| 509 | @Override |
| 510 | public boolean canMagnifyWindow(int windowType) { |
| 511 | return false; |
| 512 | } |
| 513 | |
| 514 | @Override |
| 515 | public boolean isTopLevelWindow(int windowType) { |
| 516 | return false; |
| 517 | } |
| 518 | |
| 519 | @Override |
| 520 | public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) { |
| 521 | |
| 522 | } |
| 523 | |
| 524 | @Override |
| 525 | public void getStableInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
| 526 | Rect outInsets) { |
| 527 | |
| 528 | } |
| 529 | |
| 530 | @Override |
| 531 | public boolean isNavBarForcedShownLw(WindowState win) { |
| 532 | return false; |
| 533 | } |
| 534 | |
| 535 | @Override |
| 536 | public void getNonDecorInsetsLw(int displayRotation, int displayWidth, int displayHeight, |
| 537 | Rect outInsets) { |
| 538 | |
| 539 | } |
| 540 | |
| 541 | @Override |
| 542 | public boolean isDockSideAllowed(int dockSide) { |
| 543 | return false; |
| 544 | } |
| 545 | |
| 546 | @Override |
| 547 | public void onConfigurationChanged() { |
| 548 | |
| 549 | } |
| 550 | |
| 551 | @Override |
| 552 | public boolean shouldRotateSeamlessly(int oldRotation, int newRotation) { |
| 553 | return false; |
| 554 | } |
| 555 | } |