1 /* 2 * Copyright (C) 2009 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.app.cts; 18 19 import android.app.Activity; 20 import android.app.Application; 21 import android.app.Instrumentation; 22 import android.app.Instrumentation.ActivityMonitor; 23 import android.app.Instrumentation.ActivityResult; 24 import android.app.stubs.InstrumentationTestActivity; 25 import android.app.stubs.MockApplication; 26 import android.content.ComponentName; 27 import android.content.Context; 28 import android.content.Intent; 29 import android.content.IntentFilter; 30 import android.content.pm.ActivityInfo; 31 import android.content.res.Configuration; 32 import android.graphics.Point; 33 import android.graphics.drawable.Drawable; 34 import android.net.Uri; 35 import android.os.Bundle; 36 import android.os.Debug; 37 import android.os.SystemClock; 38 import android.test.InstrumentationTestCase; 39 import android.test.UiThreadTest; 40 import android.view.InputQueue; 41 import android.view.KeyCharacterMap; 42 import android.view.KeyEvent; 43 import android.view.LayoutInflater; 44 import android.view.MotionEvent; 45 import android.view.SurfaceHolder; 46 import android.view.View; 47 import android.view.ViewGroup.LayoutParams; 48 import android.view.Window; 49 50 import java.util.List; 51 52 import android.app.stubs.R; 53 54 public class InstrumentationTest extends InstrumentationTestCase { 55 56 private static final int WAIT_TIME = 1000; 57 private Instrumentation mInstrumentation; 58 private InstrumentationTestActivity mActivity; 59 private Intent mIntent; 60 private boolean mRunOnMainSyncResult; 61 private Context mContext; 62 private MockActivity mMockActivity; 63 64 @Override setUp()65 protected void setUp() throws Exception { 66 super.setUp(); 67 mInstrumentation = getInstrumentation(); 68 mContext = mInstrumentation.getTargetContext(); 69 mIntent = new Intent(mContext, InstrumentationTestActivity.class); 70 mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 71 mActivity = (InstrumentationTestActivity) mInstrumentation.startActivitySync(mIntent); 72 } 73 tearDown()74 protected void tearDown() throws Exception { 75 mInstrumentation = null; 76 mIntent = null; 77 if (mActivity != null) { 78 mActivity.finish(); 79 mActivity = null; 80 } 81 super.tearDown(); 82 } 83 testConstructor()84 public void testConstructor() throws Exception { 85 new Instrumentation(); 86 } 87 testMonitor()88 public void testMonitor() throws Exception { 89 if (mActivity != null) 90 mActivity.finish(); 91 ActivityResult result = new ActivityResult(Activity.RESULT_OK, new Intent()); 92 ActivityMonitor monitor = new ActivityMonitor( 93 InstrumentationTestActivity.class.getName(), result, false); 94 mInstrumentation.addMonitor(monitor); 95 Intent intent = new Intent(mContext, InstrumentationTestActivity.class); 96 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 97 mContext.startActivity(intent); 98 Activity activity = mInstrumentation.waitForMonitorWithTimeout(monitor, WAIT_TIME); 99 assertTrue(activity instanceof InstrumentationTestActivity); 100 assertTrue(mInstrumentation.checkMonitorHit(monitor, 1)); 101 activity.finish(); 102 103 mInstrumentation.addMonitor(monitor); 104 mInstrumentation.removeMonitor(monitor); 105 Activity a = mInstrumentation.startActivitySync(intent); 106 assertTrue(a instanceof InstrumentationTestActivity); 107 activity = mInstrumentation.waitForMonitorWithTimeout(monitor, WAIT_TIME); 108 assertNull(activity); 109 a.finish(); 110 111 IntentFilter filter = new IntentFilter(); 112 ActivityMonitor am = mInstrumentation.addMonitor(filter, result, false); 113 mContext.startActivity(intent); 114 mInstrumentation.waitForIdleSync(); 115 activity = am.waitForActivity(); 116 assertTrue(activity instanceof InstrumentationTestActivity); 117 activity.finish(); 118 mInstrumentation.removeMonitor(am); 119 am = mInstrumentation 120 .addMonitor(InstrumentationTestActivity.class.getName(), result, false); 121 mContext.startActivity(intent); 122 activity = am.waitForActivity(); 123 assertTrue(activity instanceof InstrumentationTestActivity); 124 activity.finish(); 125 mInstrumentation.removeMonitor(am); 126 } 127 testCallActivityOnCreate()128 public void testCallActivityOnCreate() throws Throwable { 129 mActivity.setOnCreateCalled(false); 130 runTestOnUiThread(new Runnable() { 131 public void run() { 132 mInstrumentation.callActivityOnCreate(mActivity, new Bundle()); 133 } 134 }); 135 mInstrumentation.waitForIdleSync(); 136 assertTrue(mActivity.isOnCreateCalled()); 137 } 138 testAllocCounting()139 public void testAllocCounting() throws Exception { 140 mInstrumentation.startAllocCounting(); 141 142 Bundle b = mInstrumentation.getAllocCounts(); 143 assertTrue(b.size() > 0); 144 b = mInstrumentation.getBinderCounts(); 145 assertTrue(b.size() > 0); 146 147 int globeAllocCount = Debug.getGlobalAllocCount(); 148 int globeAllocSize = Debug.getGlobalAllocSize(); 149 int globeExternalAllCount = Debug.getGlobalExternalAllocCount(); 150 int globeExternalAllSize = Debug.getGlobalExternalAllocSize(); 151 int threadAllocCount = Debug.getThreadAllocCount(); 152 153 assertTrue(Debug.getGlobalAllocCount() >= globeAllocCount); 154 assertTrue(Debug.getGlobalAllocSize() >= globeAllocSize); 155 assertTrue(Debug.getGlobalExternalAllocCount() >= globeExternalAllCount); 156 assertTrue(Debug.getGlobalExternalAllocSize() >= globeExternalAllSize); 157 assertTrue(Debug.getThreadAllocCount() >= threadAllocCount); 158 159 mInstrumentation.stopAllocCounting(); 160 161 globeAllocCount = Debug.getGlobalAllocCount(); 162 globeAllocSize = Debug.getGlobalAllocSize(); 163 globeExternalAllCount = Debug.getGlobalExternalAllocCount(); 164 globeExternalAllSize = Debug.getGlobalExternalAllocSize(); 165 threadAllocCount = Debug.getThreadAllocCount(); 166 assertEquals(globeAllocCount, Debug.getGlobalAllocCount()); 167 assertEquals(globeAllocSize, Debug.getGlobalAllocSize()); 168 assertEquals(globeExternalAllCount, Debug.getGlobalExternalAllocCount()); 169 assertEquals(globeExternalAllSize, Debug.getGlobalExternalAllocSize()); 170 assertEquals(threadAllocCount, Debug.getThreadAllocCount()); 171 } 172 testSendTrackballEventSync()173 public void testSendTrackballEventSync() throws Exception { 174 long now = SystemClock.uptimeMillis(); 175 MotionEvent orig = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, 176 100, 100, 0); 177 mInstrumentation.sendTrackballEventSync(orig); 178 mInstrumentation.waitForIdleSync(); 179 180 MotionEvent motionEvent = mActivity.getMotionEvent(); 181 assertEquals(orig.getMetaState(), motionEvent.getMetaState()); 182 assertEquals(orig.getEventTime(), motionEvent.getEventTime()); 183 assertEquals(orig.getDownTime(), motionEvent.getDownTime()); 184 } 185 testCallApplicationOnCreate()186 public void testCallApplicationOnCreate() throws Exception { 187 InstrumentationTestStub ca = new InstrumentationTestStub(); 188 mInstrumentation.callApplicationOnCreate(ca); 189 assertTrue(ca.mIsOnCreateCalled); 190 } 191 testContext()192 public void testContext() throws Exception { 193 Context c1 = mInstrumentation.getContext(); 194 Context c2 = mInstrumentation.getTargetContext(); 195 assertNotSame(c1.getPackageName(), c2.getPackageName()); 196 } 197 testInvokeMenuActionSync()198 public void testInvokeMenuActionSync() throws Exception { 199 final int resId = R.id.goto_menu_id; 200 if (mActivity.getWindow().hasFeature(Window.FEATURE_OPTIONS_PANEL)) { 201 mInstrumentation.invokeMenuActionSync(mActivity, resId, 0); 202 mInstrumentation.waitForIdleSync(); 203 204 assertEquals(resId, mActivity.getMenuID()); 205 } 206 } 207 testCallActivityOnPostCreate()208 public void testCallActivityOnPostCreate() throws Throwable { 209 mActivity.setOnPostCreate(false); 210 runTestOnUiThread(new Runnable() { 211 public void run() { 212 mInstrumentation.callActivityOnPostCreate(mActivity, new Bundle()); 213 } 214 }); 215 mInstrumentation.waitForIdleSync(); 216 assertTrue(mActivity.isOnPostCreate()); 217 } 218 testCallActivityOnNewIntent()219 public void testCallActivityOnNewIntent() throws Throwable { 220 mActivity.setOnNewIntentCalled(false); 221 runTestOnUiThread(new Runnable() { 222 public void run() { 223 mInstrumentation.callActivityOnNewIntent(mActivity, null); 224 } 225 }); 226 mInstrumentation.waitForIdleSync(); 227 228 assertTrue(mActivity.isOnNewIntentCalled()); 229 } 230 testCallActivityOnResume()231 public void testCallActivityOnResume() throws Throwable { 232 mActivity.setOnResume(false); 233 runTestOnUiThread(new Runnable() { 234 public void run() { 235 mInstrumentation.callActivityOnResume(mActivity); 236 } 237 }); 238 mInstrumentation.waitForIdleSync(); 239 assertTrue(mActivity.isOnResume()); 240 } 241 testMisc()242 public void testMisc() throws Exception { 243 } 244 testPerformanceSnapshot()245 public void testPerformanceSnapshot() throws Exception { 246 mInstrumentation.setAutomaticPerformanceSnapshots(); 247 mInstrumentation.startPerformanceSnapshot(); 248 mInstrumentation.endPerformanceSnapshot(); 249 } 250 testProfiling()251 public void testProfiling() throws Exception { 252 // by default, profiling was disabled. but after set the handleProfiling attribute in the 253 // manifest file for this Instrumentation to true, the profiling was also disabled. 254 assertFalse(mInstrumentation.isProfiling()); 255 256 mInstrumentation.startProfiling(); 257 mInstrumentation.stopProfiling(); 258 } 259 testInvokeContextMenuAction()260 public void testInvokeContextMenuAction() throws Exception { 261 mActivity.runOnUiThread(new Runnable() { 262 public void run() { 263 mMockActivity = new MockActivity(); 264 } 265 }); 266 mInstrumentation.waitForIdleSync(); 267 final int id = 1; 268 final int flag = 2; 269 mInstrumentation.invokeContextMenuAction(mMockActivity, id, flag); 270 mInstrumentation.waitForIdleSync(); 271 272 assertEquals(id, mMockActivity.mWindow.mId); 273 assertEquals(flag, mMockActivity.mWindow.mFlags); 274 } 275 testSendStringSync()276 public void testSendStringSync() { 277 final String text = "abcd"; 278 mInstrumentation.sendStringSync(text); 279 mInstrumentation.waitForIdleSync(); 280 281 List<KeyEvent> keyUpList = mActivity.getKeyUpList(); 282 List<KeyEvent> keyDownList = mActivity.getKeyDownList(); 283 assertEquals(text.length(), keyDownList.size()); 284 assertEquals(text.length(), keyUpList.size()); 285 286 KeyCharacterMap kcm = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); 287 KeyEvent[] keyEvents = kcm.getEvents(text.toCharArray()); 288 289 int i = 0; 290 for (int j = 0; j < keyDownList.size(); j++) { 291 assertEquals(keyEvents[i++].getKeyCode(), keyDownList.get(j).getKeyCode()); 292 assertEquals(keyEvents[i++].getKeyCode(), keyUpList.get(j).getKeyCode()); 293 } 294 } 295 testCallActivityOnSaveInstanceState()296 public void testCallActivityOnSaveInstanceState() throws Throwable { 297 final Bundle bundle = new Bundle(); 298 mActivity.setOnSaveInstanceState(false); 299 runTestOnUiThread(new Runnable() { 300 public void run() { 301 mInstrumentation.callActivityOnSaveInstanceState(mActivity, bundle); 302 } 303 }); 304 mInstrumentation.waitForIdleSync(); 305 306 assertTrue(mActivity.isOnSaveInstanceState()); 307 assertSame(bundle, mActivity.getBundle()); 308 } 309 testSendPointerSync()310 public void testSendPointerSync() throws Exception { 311 mInstrumentation.waitForIdleSync(); 312 mInstrumentation.setInTouchMode(true); 313 314 // Send a touch event to the middle of the activity. 315 // We assume that the Activity is empty so there won't be anything in the middle 316 // to handle the touch. Consequently the Activity should receive onTouchEvent 317 // because nothing else handled it. 318 Point size = new Point(); 319 mActivity.getWindowManager().getDefaultDisplay().getSize(size); 320 final int x = size.x / 2; 321 final int y = size.y / 2; 322 long now = SystemClock.uptimeMillis(); 323 MotionEvent orig = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN, 324 x, y, 0); 325 mInstrumentation.sendPointerSync(orig); 326 327 mInstrumentation.waitForIdleSync(); 328 assertTrue(mActivity.isOnTouchEventCalled()); 329 mActivity.setOnTouchEventCalled(false); 330 } 331 testGetComponentName()332 public void testGetComponentName() throws Exception { 333 ComponentName com = getInstrumentation().getComponentName(); 334 assertNotNull(com.getPackageName()); 335 assertNotNull(com.getClassName()); 336 assertNotNull(com.getShortClassName()); 337 } 338 testNewApplication()339 public void testNewApplication() throws Exception { 340 final String className = "android.app.stubs.MockApplication"; 341 ClassLoader cl = getClass().getClassLoader(); 342 343 Application app = mInstrumentation.newApplication(cl, className, mContext); 344 assertEquals(className, app.getClass().getName()); 345 346 app = Instrumentation.newApplication(MockApplication.class, mContext); 347 assertEquals(className, app.getClass().getName()); 348 } 349 testRunOnMainSync()350 public void testRunOnMainSync() throws Exception { 351 mRunOnMainSyncResult = false; 352 mInstrumentation.runOnMainSync(new Runnable() { 353 public void run() { 354 mRunOnMainSyncResult = true; 355 } 356 }); 357 mInstrumentation.waitForIdleSync(); 358 assertTrue(mRunOnMainSyncResult); 359 } 360 testCallActivityOnPause()361 public void testCallActivityOnPause() throws Exception { 362 mActivity.setOnPauseCalled(false); 363 mInstrumentation.callActivityOnPause(mActivity); 364 mInstrumentation.waitForIdleSync(); 365 assertTrue(mActivity.isOnPauseCalled()); 366 } 367 testSendKeyDownUpSync()368 public void testSendKeyDownUpSync() throws Exception { 369 mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_0); 370 mInstrumentation.waitForIdleSync(); 371 assertEquals(1, mActivity.getKeyUpList().size()); 372 assertEquals(1, mActivity.getKeyDownList().size()); 373 assertEquals(KeyEvent.KEYCODE_0, mActivity.getKeyUpList().get(0).getKeyCode()); 374 assertEquals(KeyEvent.KEYCODE_0, mActivity.getKeyDownList().get(0).getKeyCode()); 375 } 376 377 @UiThreadTest testNewActivity()378 public void testNewActivity() throws Exception { 379 Intent intent = new Intent(); 380 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 381 382 ClassLoader cl = getClass().getClassLoader(); 383 Activity activity = mInstrumentation.newActivity(cl, InstrumentationTestActivity.class 384 .getName(), intent); 385 assertEquals(InstrumentationTestActivity.class.getName(), activity.getClass().getName()); 386 activity.finish(); 387 activity = null; 388 389 intent = new Intent(mContext, InstrumentationTestActivity.class); 390 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 391 392 Activity father = new Activity(); 393 ActivityInfo info = new ActivityInfo(); 394 395 activity = mInstrumentation 396 .newActivity(InstrumentationTestActivity.class, mContext, null, null, intent, info, 397 InstrumentationTestActivity.class.getName(), father, null, null); 398 399 assertEquals(father, activity.getParent()); 400 assertEquals(InstrumentationTestActivity.class.getName(), activity.getClass().getName()); 401 activity.finish(); 402 } 403 testCallActivityOnStart()404 public void testCallActivityOnStart() throws Exception { 405 mActivity.setOnStart(false); 406 mInstrumentation.callActivityOnStart(mActivity); 407 mInstrumentation.waitForIdleSync(); 408 assertTrue(mActivity.isOnStart()); 409 } 410 testWaitForIdle()411 public void testWaitForIdle() throws Exception { 412 MockRunnable mr = new MockRunnable(); 413 assertFalse(mr.isRunCalled()); 414 mInstrumentation.waitForIdle(mr); 415 Thread.sleep(WAIT_TIME); 416 assertTrue(mr.isRunCalled()); 417 } 418 testSendCharacterSync()419 public void testSendCharacterSync() throws Exception { 420 mInstrumentation.sendCharacterSync(KeyEvent.KEYCODE_0); 421 mInstrumentation.waitForIdleSync(); 422 assertEquals(KeyEvent.KEYCODE_0, mActivity.getKeyDownCode()); 423 assertEquals(KeyEvent.KEYCODE_0, mActivity.getKeyUpCode()); 424 } 425 testCallActivityOnRestart()426 public void testCallActivityOnRestart() throws Exception { 427 mActivity.setOnRestart(false); 428 mInstrumentation.callActivityOnRestart(mActivity); 429 mInstrumentation.waitForIdleSync(); 430 assertTrue(mActivity.isOnRestart()); 431 } 432 testCallActivityOnStop()433 public void testCallActivityOnStop() throws Exception { 434 mActivity.setOnStop(false); 435 mInstrumentation.callActivityOnStop(mActivity); 436 mInstrumentation.waitForIdleSync(); 437 assertTrue(mActivity.isOnStop()); 438 } 439 testCallActivityOnUserLeaving()440 public void testCallActivityOnUserLeaving() throws Exception { 441 assertFalse(mActivity.isOnLeave()); 442 mInstrumentation.callActivityOnUserLeaving(mActivity); 443 mInstrumentation.waitForIdleSync(); 444 assertTrue(mActivity.isOnLeave()); 445 } 446 testCallActivityOnRestoreInstanceState()447 public void testCallActivityOnRestoreInstanceState() throws Exception { 448 mActivity.setOnRestoreInstanceState(false); 449 mInstrumentation.callActivityOnRestoreInstanceState(mActivity, new Bundle()); 450 mInstrumentation.waitForIdleSync(); 451 assertTrue(mActivity.isOnRestoreInstanceState()); 452 } 453 testSendKeySync()454 public void testSendKeySync() throws Exception { 455 KeyEvent key = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_0); 456 mInstrumentation.sendKeySync(key); 457 mInstrumentation.waitForIdleSync(); 458 assertEquals(KeyEvent.KEYCODE_0, mActivity.getKeyDownCode()); 459 } 460 461 private static class MockRunnable implements Runnable { 462 private boolean mIsRunCalled ; 463 run()464 public void run() { 465 mIsRunCalled = true; 466 } 467 isRunCalled()468 public boolean isRunCalled() { 469 return mIsRunCalled; 470 } 471 } 472 473 private class MockActivity extends Activity { 474 MockWindow mWindow = new MockWindow(mContext); 475 476 @Override getWindow()477 public Window getWindow() { 478 return mWindow; 479 } 480 481 private class MockWindow extends Window { 482 483 public int mId; 484 public int mFlags; 485 MockWindow(Context context)486 public MockWindow(Context context) { 487 super(context); 488 } 489 490 @Override addContentView(View view, LayoutParams params)491 public void addContentView(View view, LayoutParams params) { 492 } 493 494 @Override closeAllPanels()495 public void closeAllPanels() { 496 } 497 498 @Override closePanel(int featureId)499 public void closePanel(int featureId) { 500 } 501 502 @Override getCurrentFocus()503 public View getCurrentFocus() { 504 return null; 505 } 506 507 @Override getDecorView()508 public View getDecorView() { 509 return null; 510 } 511 512 @Override getLayoutInflater()513 public LayoutInflater getLayoutInflater() { 514 return null; 515 } 516 517 @Override getVolumeControlStream()518 public int getVolumeControlStream() { 519 return 0; 520 } 521 522 @Override isFloating()523 public boolean isFloating() { 524 return false; 525 } 526 527 @Override isShortcutKey(int keyCode, KeyEvent event)528 public boolean isShortcutKey(int keyCode, KeyEvent event) { 529 return false; 530 } 531 532 @Override onActive()533 protected void onActive() { 534 } 535 536 @Override onConfigurationChanged(Configuration newConfig)537 public void onConfigurationChanged(Configuration newConfig) { 538 } 539 540 @Override openPanel(int featureId, KeyEvent event)541 public void openPanel(int featureId, KeyEvent event) { 542 } 543 alwaysReadCloseOnTouchAttr()544 public void alwaysReadCloseOnTouchAttr() { 545 } 546 547 @Override peekDecorView()548 public View peekDecorView() { 549 return null; 550 } 551 552 @Override performContextMenuIdentifierAction(int id, int flags)553 public boolean performContextMenuIdentifierAction(int id, int flags) { 554 mId = id; 555 mFlags = flags; 556 return false; 557 } 558 559 @Override performPanelIdentifierAction(int featureId, int id, int flags)560 public boolean performPanelIdentifierAction(int featureId, int id, int flags) { 561 return false; 562 } 563 564 @Override performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags)565 public boolean performPanelShortcut(int featureId, int keyCode, 566 KeyEvent event, int flags) { 567 return false; 568 } 569 570 @Override restoreHierarchyState(Bundle savedInstanceState)571 public void restoreHierarchyState(Bundle savedInstanceState) { 572 } 573 574 @Override saveHierarchyState()575 public Bundle saveHierarchyState() { 576 return null; 577 } 578 579 @Override setBackgroundDrawable(Drawable drawable)580 public void setBackgroundDrawable(Drawable drawable) { 581 } 582 583 @Override setChildDrawable(int featureId, Drawable drawable)584 public void setChildDrawable(int featureId, Drawable drawable) { 585 } 586 587 @Override setChildInt(int featureId, int value)588 public void setChildInt(int featureId, int value) { 589 } 590 591 @Override setContentView(int layoutResID)592 public void setContentView(int layoutResID) { 593 } 594 595 @Override setContentView(View view)596 public void setContentView(View view) { 597 } 598 599 @Override setContentView(View view, LayoutParams params)600 public void setContentView(View view, LayoutParams params) { 601 } 602 603 @Override setFeatureDrawable(int featureId, Drawable drawable)604 public void setFeatureDrawable(int featureId, Drawable drawable) { 605 } 606 607 @Override setFeatureDrawableAlpha(int featureId, int alpha)608 public void setFeatureDrawableAlpha(int featureId, int alpha) { 609 } 610 611 @Override setFeatureDrawableResource(int featureId, int resId)612 public void setFeatureDrawableResource(int featureId, int resId) { 613 } 614 615 @Override setFeatureDrawableUri(int featureId, Uri uri)616 public void setFeatureDrawableUri(int featureId, Uri uri) { 617 } 618 619 @Override setFeatureInt(int featureId, int value)620 public void setFeatureInt(int featureId, int value) { 621 } 622 623 @Override setTitle(CharSequence title)624 public void setTitle(CharSequence title) { 625 } 626 627 @Override setTitleColor(int textColor)628 public void setTitleColor(int textColor) { 629 } 630 631 @Override setVolumeControlStream(int streamType)632 public void setVolumeControlStream(int streamType) { 633 } 634 635 @Override superDispatchKeyEvent(KeyEvent event)636 public boolean superDispatchKeyEvent(KeyEvent event) { 637 return false; 638 } 639 640 @Override superDispatchKeyShortcutEvent(KeyEvent event)641 public boolean superDispatchKeyShortcutEvent(KeyEvent event) { 642 return false; 643 } 644 645 @Override superDispatchTouchEvent(MotionEvent event)646 public boolean superDispatchTouchEvent(MotionEvent event) { 647 return false; 648 } 649 650 @Override superDispatchTrackballEvent(MotionEvent event)651 public boolean superDispatchTrackballEvent(MotionEvent event) { 652 return false; 653 } 654 655 @Override superDispatchGenericMotionEvent(MotionEvent event)656 public boolean superDispatchGenericMotionEvent(MotionEvent event) { 657 return false; 658 } 659 660 @Override takeKeyEvents(boolean get)661 public void takeKeyEvents(boolean get) { 662 } 663 664 @Override togglePanel(int featureId, KeyEvent event)665 public void togglePanel(int featureId, KeyEvent event) { 666 } 667 668 @Override invalidatePanelMenu(int featureId)669 public void invalidatePanelMenu(int featureId) { 670 } 671 672 @Override takeSurface(SurfaceHolder.Callback2 callback)673 public void takeSurface(SurfaceHolder.Callback2 callback) { 674 } 675 676 @Override takeInputQueue(InputQueue.Callback queue)677 public void takeInputQueue(InputQueue.Callback queue) { 678 } 679 680 @Override setStatusBarColor(int color)681 public void setStatusBarColor(int color) { 682 } 683 684 @Override getStatusBarColor()685 public int getStatusBarColor() { 686 return 0; 687 } 688 689 @Override setNavigationBarColor(int color)690 public void setNavigationBarColor(int color) { 691 } 692 693 @Override setDecorCaptionShade(int decorCaptionShade)694 public void setDecorCaptionShade(int decorCaptionShade) { 695 } 696 697 @Override setResizingCaptionDrawable(Drawable drawable)698 public void setResizingCaptionDrawable(Drawable drawable) { 699 } 700 701 @Override getNavigationBarColor()702 public int getNavigationBarColor() { 703 return 0; 704 } 705 } 706 } 707 708 private static class InstrumentationTestStub extends Application { 709 boolean mIsOnCreateCalled = false; 710 711 @Override onCreate()712 public void onCreate() { 713 super.onCreate(); 714 mIsOnCreateCalled = true; 715 } 716 } 717 } 718