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