ApplicationThreadNative.java revision 80bea9cde179e37def61748ff0e68b4155b5360c
1/* 2 * Copyright (C) 2006 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.app; 18 19import android.content.ComponentName; 20import android.content.Intent; 21import android.content.IIntentReceiver; 22import android.content.pm.ActivityInfo; 23import android.content.pm.ApplicationInfo; 24import android.content.pm.ProviderInfo; 25import android.content.pm.ServiceInfo; 26import android.content.res.CompatibilityInfo; 27import android.content.res.Configuration; 28import android.net.Uri; 29import android.os.Binder; 30import android.os.Bundle; 31import android.os.Debug; 32import android.os.Parcelable; 33import android.os.PersistableBundle; 34import android.os.RemoteException; 35import android.os.IBinder; 36import android.os.Parcel; 37import android.os.ParcelFileDescriptor; 38import android.os.TransactionTooLargeException; 39import android.util.Log; 40 41import com.android.internal.app.IVoiceInteractor; 42import com.android.internal.content.ReferrerIntent; 43 44import java.io.FileDescriptor; 45import java.io.IOException; 46import java.util.HashMap; 47import java.util.List; 48import java.util.Map; 49 50/** {@hide} */ 51public abstract class ApplicationThreadNative extends Binder 52 implements IApplicationThread { 53 /** 54 * Cast a Binder object into an application thread interface, generating 55 * a proxy if needed. 56 */ 57 static public IApplicationThread asInterface(IBinder obj) { 58 if (obj == null) { 59 return null; 60 } 61 IApplicationThread in = 62 (IApplicationThread)obj.queryLocalInterface(descriptor); 63 if (in != null) { 64 return in; 65 } 66 67 return new ApplicationThreadProxy(obj); 68 } 69 70 public ApplicationThreadNative() { 71 attachInterface(this, descriptor); 72 } 73 74 @Override 75 public boolean onTransact(int code, Parcel data, Parcel reply, int flags) 76 throws RemoteException { 77 switch (code) { 78 case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION: 79 { 80 data.enforceInterface(IApplicationThread.descriptor); 81 IBinder b = data.readStrongBinder(); 82 boolean finished = data.readInt() != 0; 83 boolean userLeaving = data.readInt() != 0; 84 int configChanges = data.readInt(); 85 boolean dontReport = data.readInt() != 0; 86 schedulePauseActivity(b, finished, userLeaving, configChanges, dontReport); 87 return true; 88 } 89 90 case SCHEDULE_STOP_ACTIVITY_TRANSACTION: 91 { 92 data.enforceInterface(IApplicationThread.descriptor); 93 IBinder b = data.readStrongBinder(); 94 boolean show = data.readInt() != 0; 95 int configChanges = data.readInt(); 96 scheduleStopActivity(b, show, configChanges); 97 return true; 98 } 99 100 case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION: 101 { 102 data.enforceInterface(IApplicationThread.descriptor); 103 IBinder b = data.readStrongBinder(); 104 boolean show = data.readInt() != 0; 105 scheduleWindowVisibility(b, show); 106 return true; 107 } 108 109 case SCHEDULE_SLEEPING_TRANSACTION: 110 { 111 data.enforceInterface(IApplicationThread.descriptor); 112 IBinder b = data.readStrongBinder(); 113 boolean sleeping = data.readInt() != 0; 114 scheduleSleeping(b, sleeping); 115 return true; 116 } 117 118 case SCHEDULE_RESUME_ACTIVITY_TRANSACTION: 119 { 120 data.enforceInterface(IApplicationThread.descriptor); 121 IBinder b = data.readStrongBinder(); 122 int procState = data.readInt(); 123 boolean isForward = data.readInt() != 0; 124 Bundle resumeArgs = data.readBundle(); 125 scheduleResumeActivity(b, procState, isForward, resumeArgs); 126 return true; 127 } 128 129 case SCHEDULE_SEND_RESULT_TRANSACTION: 130 { 131 data.enforceInterface(IApplicationThread.descriptor); 132 IBinder b = data.readStrongBinder(); 133 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); 134 scheduleSendResult(b, ri); 135 return true; 136 } 137 138 case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION: 139 { 140 data.enforceInterface(IApplicationThread.descriptor); 141 Intent intent = Intent.CREATOR.createFromParcel(data); 142 IBinder b = data.readStrongBinder(); 143 int ident = data.readInt(); 144 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); 145 Configuration curConfig = Configuration.CREATOR.createFromParcel(data); 146 Configuration overrideConfig = null; 147 if (data.readInt() != 0) { 148 overrideConfig = Configuration.CREATOR.createFromParcel(data); 149 } 150 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); 151 String referrer = data.readString(); 152 IVoiceInteractor voiceInteractor = IVoiceInteractor.Stub.asInterface( 153 data.readStrongBinder()); 154 int procState = data.readInt(); 155 Bundle state = data.readBundle(); 156 PersistableBundle persistentState = data.readPersistableBundle(); 157 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); 158 List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR); 159 boolean notResumed = data.readInt() != 0; 160 boolean isForward = data.readInt() != 0; 161 ProfilerInfo profilerInfo = data.readInt() != 0 162 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 163 scheduleLaunchActivity(intent, b, ident, info, curConfig, overrideConfig, compatInfo, 164 referrer, voiceInteractor, procState, state, persistentState, ri, pi, 165 notResumed, isForward, profilerInfo); 166 return true; 167 } 168 169 case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION: 170 { 171 data.enforceInterface(IApplicationThread.descriptor); 172 IBinder b = data.readStrongBinder(); 173 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); 174 List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR); 175 int configChanges = data.readInt(); 176 boolean notResumed = data.readInt() != 0; 177 Configuration config = Configuration.CREATOR.createFromParcel(data); 178 Configuration overrideConfig = null; 179 if (data.readInt() != 0) { 180 overrideConfig = Configuration.CREATOR.createFromParcel(data); 181 } 182 scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config, overrideConfig); 183 return true; 184 } 185 186 case SCHEDULE_NEW_INTENT_TRANSACTION: 187 { 188 data.enforceInterface(IApplicationThread.descriptor); 189 List<ReferrerIntent> pi = data.createTypedArrayList(ReferrerIntent.CREATOR); 190 IBinder b = data.readStrongBinder(); 191 scheduleNewIntent(pi, b); 192 return true; 193 } 194 195 case SCHEDULE_FINISH_ACTIVITY_TRANSACTION: 196 { 197 data.enforceInterface(IApplicationThread.descriptor); 198 IBinder b = data.readStrongBinder(); 199 boolean finishing = data.readInt() != 0; 200 int configChanges = data.readInt(); 201 scheduleDestroyActivity(b, finishing, configChanges); 202 return true; 203 } 204 205 case SCHEDULE_RECEIVER_TRANSACTION: 206 { 207 data.enforceInterface(IApplicationThread.descriptor); 208 Intent intent = Intent.CREATOR.createFromParcel(data); 209 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); 210 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); 211 int resultCode = data.readInt(); 212 String resultData = data.readString(); 213 Bundle resultExtras = data.readBundle(); 214 boolean sync = data.readInt() != 0; 215 int sendingUser = data.readInt(); 216 int processState = data.readInt(); 217 scheduleReceiver(intent, info, compatInfo, resultCode, resultData, 218 resultExtras, sync, sendingUser, processState); 219 return true; 220 } 221 222 case SCHEDULE_CREATE_SERVICE_TRANSACTION: { 223 data.enforceInterface(IApplicationThread.descriptor); 224 IBinder token = data.readStrongBinder(); 225 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data); 226 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); 227 int processState = data.readInt(); 228 scheduleCreateService(token, info, compatInfo, processState); 229 return true; 230 } 231 232 case SCHEDULE_BIND_SERVICE_TRANSACTION: { 233 data.enforceInterface(IApplicationThread.descriptor); 234 IBinder token = data.readStrongBinder(); 235 Intent intent = Intent.CREATOR.createFromParcel(data); 236 boolean rebind = data.readInt() != 0; 237 int processState = data.readInt(); 238 scheduleBindService(token, intent, rebind, processState); 239 return true; 240 } 241 242 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: { 243 data.enforceInterface(IApplicationThread.descriptor); 244 IBinder token = data.readStrongBinder(); 245 Intent intent = Intent.CREATOR.createFromParcel(data); 246 scheduleUnbindService(token, intent); 247 return true; 248 } 249 250 case SCHEDULE_SERVICE_ARGS_TRANSACTION: 251 { 252 data.enforceInterface(IApplicationThread.descriptor); 253 IBinder token = data.readStrongBinder(); 254 boolean taskRemoved = data.readInt() != 0; 255 int startId = data.readInt(); 256 int fl = data.readInt(); 257 Intent args; 258 if (data.readInt() != 0) { 259 args = Intent.CREATOR.createFromParcel(data); 260 } else { 261 args = null; 262 } 263 scheduleServiceArgs(token, taskRemoved, startId, fl, args); 264 return true; 265 } 266 267 case SCHEDULE_STOP_SERVICE_TRANSACTION: 268 { 269 data.enforceInterface(IApplicationThread.descriptor); 270 IBinder token = data.readStrongBinder(); 271 scheduleStopService(token); 272 return true; 273 } 274 275 case BIND_APPLICATION_TRANSACTION: 276 { 277 data.enforceInterface(IApplicationThread.descriptor); 278 String packageName = data.readString(); 279 ApplicationInfo info = 280 ApplicationInfo.CREATOR.createFromParcel(data); 281 List<ProviderInfo> providers = 282 data.createTypedArrayList(ProviderInfo.CREATOR); 283 ComponentName testName = (data.readInt() != 0) 284 ? new ComponentName(data) : null; 285 ProfilerInfo profilerInfo = data.readInt() != 0 286 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 287 Bundle testArgs = data.readBundle(); 288 IBinder binder = data.readStrongBinder(); 289 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder); 290 binder = data.readStrongBinder(); 291 IUiAutomationConnection uiAutomationConnection = 292 IUiAutomationConnection.Stub.asInterface(binder); 293 int testMode = data.readInt(); 294 boolean enableBinderTracking = data.readInt() != 0; 295 boolean openGlTrace = data.readInt() != 0; 296 boolean trackAllocation = data.readInt() != 0; 297 boolean restrictedBackupMode = (data.readInt() != 0); 298 boolean persistent = (data.readInt() != 0); 299 Configuration config = Configuration.CREATOR.createFromParcel(data); 300 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); 301 HashMap<String, IBinder> services = data.readHashMap(null); 302 Bundle coreSettings = data.readBundle(); 303 bindApplication(packageName, info, providers, testName, profilerInfo, testArgs, 304 testWatcher, uiAutomationConnection, testMode, enableBinderTracking, 305 openGlTrace, trackAllocation, restrictedBackupMode, persistent, config, 306 compatInfo, services, coreSettings); 307 return true; 308 } 309 310 case SCHEDULE_EXIT_TRANSACTION: 311 { 312 data.enforceInterface(IApplicationThread.descriptor); 313 scheduleExit(); 314 return true; 315 } 316 317 case SCHEDULE_SUICIDE_TRANSACTION: 318 { 319 data.enforceInterface(IApplicationThread.descriptor); 320 scheduleSuicide(); 321 return true; 322 } 323 324 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION: 325 { 326 data.enforceInterface(IApplicationThread.descriptor); 327 Configuration config = Configuration.CREATOR.createFromParcel(data); 328 scheduleConfigurationChanged(config); 329 return true; 330 } 331 332 case UPDATE_TIME_ZONE_TRANSACTION: { 333 data.enforceInterface(IApplicationThread.descriptor); 334 updateTimeZone(); 335 return true; 336 } 337 338 case CLEAR_DNS_CACHE_TRANSACTION: { 339 data.enforceInterface(IApplicationThread.descriptor); 340 clearDnsCache(); 341 return true; 342 } 343 344 case SET_HTTP_PROXY_TRANSACTION: { 345 data.enforceInterface(IApplicationThread.descriptor); 346 final String proxy = data.readString(); 347 final String port = data.readString(); 348 final String exclList = data.readString(); 349 final Uri pacFileUrl = Uri.CREATOR.createFromParcel(data); 350 setHttpProxy(proxy, port, exclList, pacFileUrl); 351 return true; 352 } 353 354 case PROCESS_IN_BACKGROUND_TRANSACTION: { 355 data.enforceInterface(IApplicationThread.descriptor); 356 processInBackground(); 357 return true; 358 } 359 360 case DUMP_SERVICE_TRANSACTION: { 361 data.enforceInterface(IApplicationThread.descriptor); 362 ParcelFileDescriptor fd = data.readFileDescriptor(); 363 final IBinder service = data.readStrongBinder(); 364 final String[] args = data.readStringArray(); 365 if (fd != null) { 366 dumpService(fd.getFileDescriptor(), service, args); 367 try { 368 fd.close(); 369 } catch (IOException e) { 370 } 371 } 372 return true; 373 } 374 375 case DUMP_PROVIDER_TRANSACTION: { 376 data.enforceInterface(IApplicationThread.descriptor); 377 ParcelFileDescriptor fd = data.readFileDescriptor(); 378 final IBinder service = data.readStrongBinder(); 379 final String[] args = data.readStringArray(); 380 if (fd != null) { 381 dumpProvider(fd.getFileDescriptor(), service, args); 382 try { 383 fd.close(); 384 } catch (IOException e) { 385 } 386 } 387 return true; 388 } 389 390 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: { 391 data.enforceInterface(IApplicationThread.descriptor); 392 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface( 393 data.readStrongBinder()); 394 Intent intent = Intent.CREATOR.createFromParcel(data); 395 int resultCode = data.readInt(); 396 String dataStr = data.readString(); 397 Bundle extras = data.readBundle(); 398 boolean ordered = data.readInt() != 0; 399 boolean sticky = data.readInt() != 0; 400 int sendingUser = data.readInt(); 401 int processState = data.readInt(); 402 scheduleRegisteredReceiver(receiver, intent, 403 resultCode, dataStr, extras, ordered, sticky, sendingUser, processState); 404 return true; 405 } 406 407 case SCHEDULE_LOW_MEMORY_TRANSACTION: 408 { 409 data.enforceInterface(IApplicationThread.descriptor); 410 scheduleLowMemory(); 411 return true; 412 } 413 414 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION: 415 { 416 data.enforceInterface(IApplicationThread.descriptor); 417 IBinder b = data.readStrongBinder(); 418 Configuration overrideConfig = null; 419 if (data.readInt() != 0) { 420 overrideConfig = Configuration.CREATOR.createFromParcel(data); 421 } 422 scheduleActivityConfigurationChanged(b, overrideConfig); 423 return true; 424 } 425 426 case PROFILER_CONTROL_TRANSACTION: 427 { 428 data.enforceInterface(IApplicationThread.descriptor); 429 boolean start = data.readInt() != 0; 430 int profileType = data.readInt(); 431 ProfilerInfo profilerInfo = data.readInt() != 0 432 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 433 profilerControl(start, profilerInfo, profileType); 434 return true; 435 } 436 437 case SET_SCHEDULING_GROUP_TRANSACTION: 438 { 439 data.enforceInterface(IApplicationThread.descriptor); 440 int group = data.readInt(); 441 setSchedulingGroup(group); 442 return true; 443 } 444 445 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION: 446 { 447 data.enforceInterface(IApplicationThread.descriptor); 448 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); 449 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); 450 int backupMode = data.readInt(); 451 scheduleCreateBackupAgent(appInfo, compatInfo, backupMode); 452 return true; 453 } 454 455 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION: 456 { 457 data.enforceInterface(IApplicationThread.descriptor); 458 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); 459 CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data); 460 scheduleDestroyBackupAgent(appInfo, compatInfo); 461 return true; 462 } 463 464 case DISPATCH_PACKAGE_BROADCAST_TRANSACTION: 465 { 466 data.enforceInterface(IApplicationThread.descriptor); 467 int cmd = data.readInt(); 468 String[] packages = data.readStringArray(); 469 dispatchPackageBroadcast(cmd, packages); 470 return true; 471 } 472 473 case SCHEDULE_CRASH_TRANSACTION: 474 { 475 data.enforceInterface(IApplicationThread.descriptor); 476 String msg = data.readString(); 477 scheduleCrash(msg); 478 return true; 479 } 480 481 case DUMP_HEAP_TRANSACTION: 482 { 483 data.enforceInterface(IApplicationThread.descriptor); 484 boolean managed = data.readInt() != 0; 485 String path = data.readString(); 486 ParcelFileDescriptor fd = data.readInt() != 0 487 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null; 488 dumpHeap(managed, path, fd); 489 return true; 490 } 491 492 case DUMP_ACTIVITY_TRANSACTION: { 493 data.enforceInterface(IApplicationThread.descriptor); 494 ParcelFileDescriptor fd = data.readFileDescriptor(); 495 final IBinder activity = data.readStrongBinder(); 496 final String prefix = data.readString(); 497 final String[] args = data.readStringArray(); 498 if (fd != null) { 499 dumpActivity(fd.getFileDescriptor(), activity, prefix, args); 500 try { 501 fd.close(); 502 } catch (IOException e) { 503 } 504 } 505 return true; 506 } 507 508 case SET_CORE_SETTINGS_TRANSACTION: { 509 data.enforceInterface(IApplicationThread.descriptor); 510 Bundle settings = data.readBundle(); 511 setCoreSettings(settings); 512 return true; 513 } 514 515 case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: { 516 data.enforceInterface(IApplicationThread.descriptor); 517 String pkg = data.readString(); 518 CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data); 519 updatePackageCompatibilityInfo(pkg, compat); 520 return true; 521 } 522 523 case SCHEDULE_TRIM_MEMORY_TRANSACTION: { 524 data.enforceInterface(IApplicationThread.descriptor); 525 int level = data.readInt(); 526 scheduleTrimMemory(level); 527 return true; 528 } 529 530 case DUMP_MEM_INFO_TRANSACTION: 531 { 532 data.enforceInterface(IApplicationThread.descriptor); 533 ParcelFileDescriptor fd = data.readFileDescriptor(); 534 Debug.MemoryInfo mi = Debug.MemoryInfo.CREATOR.createFromParcel(data); 535 boolean checkin = data.readInt() != 0; 536 boolean dumpInfo = data.readInt() != 0; 537 boolean dumpDalvik = data.readInt() != 0; 538 boolean dumpSummaryOnly = data.readInt() != 0; 539 String[] args = data.readStringArray(); 540 if (fd != null) { 541 try { 542 dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo, 543 dumpDalvik, dumpSummaryOnly, args); 544 } finally { 545 try { 546 fd.close(); 547 } catch (IOException e) { 548 // swallowed, not propagated back to the caller 549 } 550 } 551 } 552 reply.writeNoException(); 553 return true; 554 } 555 556 case DUMP_GFX_INFO_TRANSACTION: 557 { 558 data.enforceInterface(IApplicationThread.descriptor); 559 ParcelFileDescriptor fd = data.readFileDescriptor(); 560 String[] args = data.readStringArray(); 561 if (fd != null) { 562 try { 563 dumpGfxInfo(fd.getFileDescriptor(), args); 564 } finally { 565 try { 566 fd.close(); 567 } catch (IOException e) { 568 // swallowed, not propagated back to the caller 569 } 570 } 571 } 572 reply.writeNoException(); 573 return true; 574 } 575 576 case DUMP_DB_INFO_TRANSACTION: 577 { 578 data.enforceInterface(IApplicationThread.descriptor); 579 ParcelFileDescriptor fd = data.readFileDescriptor(); 580 String[] args = data.readStringArray(); 581 if (fd != null) { 582 try { 583 dumpDbInfo(fd.getFileDescriptor(), args); 584 } finally { 585 try { 586 fd.close(); 587 } catch (IOException e) { 588 // swallowed, not propagated back to the caller 589 } 590 } 591 } 592 reply.writeNoException(); 593 return true; 594 } 595 596 case UNSTABLE_PROVIDER_DIED_TRANSACTION: 597 { 598 data.enforceInterface(IApplicationThread.descriptor); 599 IBinder provider = data.readStrongBinder(); 600 unstableProviderDied(provider); 601 reply.writeNoException(); 602 return true; 603 } 604 605 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: 606 { 607 data.enforceInterface(IApplicationThread.descriptor); 608 IBinder activityToken = data.readStrongBinder(); 609 IBinder requestToken = data.readStrongBinder(); 610 int requestType = data.readInt(); 611 requestAssistContextExtras(activityToken, requestToken, requestType); 612 reply.writeNoException(); 613 return true; 614 } 615 616 case SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION: 617 { 618 data.enforceInterface(IApplicationThread.descriptor); 619 IBinder token = data.readStrongBinder(); 620 boolean timeout = data.readInt() == 1; 621 scheduleTranslucentConversionComplete(token, timeout); 622 reply.writeNoException(); 623 return true; 624 } 625 626 case SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION: 627 { 628 data.enforceInterface(IApplicationThread.descriptor); 629 IBinder token = data.readStrongBinder(); 630 ActivityOptions options = new ActivityOptions(data.readBundle()); 631 scheduleOnNewActivityOptions(token, options); 632 reply.writeNoException(); 633 return true; 634 } 635 636 case SET_PROCESS_STATE_TRANSACTION: 637 { 638 data.enforceInterface(IApplicationThread.descriptor); 639 int state = data.readInt(); 640 setProcessState(state); 641 reply.writeNoException(); 642 return true; 643 } 644 645 case SCHEDULE_INSTALL_PROVIDER_TRANSACTION: 646 { 647 data.enforceInterface(IApplicationThread.descriptor); 648 ProviderInfo provider = ProviderInfo.CREATOR.createFromParcel(data); 649 scheduleInstallProvider(provider); 650 reply.writeNoException(); 651 return true; 652 } 653 654 case UPDATE_TIME_PREFS_TRANSACTION: 655 { 656 data.enforceInterface(IApplicationThread.descriptor); 657 byte is24Hour = data.readByte(); 658 updateTimePrefs(is24Hour == (byte) 1); 659 reply.writeNoException(); 660 return true; 661 } 662 663 case CANCEL_VISIBLE_BEHIND_TRANSACTION: 664 { 665 data.enforceInterface(IApplicationThread.descriptor); 666 IBinder token = data.readStrongBinder(); 667 scheduleCancelVisibleBehind(token); 668 reply.writeNoException(); 669 return true; 670 } 671 672 case BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION: 673 { 674 data.enforceInterface(IApplicationThread.descriptor); 675 IBinder token = data.readStrongBinder(); 676 boolean enabled = data.readInt() > 0; 677 scheduleBackgroundVisibleBehindChanged(token, enabled); 678 reply.writeNoException(); 679 return true; 680 } 681 682 case ENTER_ANIMATION_COMPLETE_TRANSACTION: 683 { 684 data.enforceInterface(IApplicationThread.descriptor); 685 IBinder token = data.readStrongBinder(); 686 scheduleEnterAnimationComplete(token); 687 reply.writeNoException(); 688 return true; 689 } 690 691 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: 692 { 693 data.enforceInterface(IApplicationThread.descriptor); 694 final byte[] firstPacket = data.createByteArray(); 695 notifyCleartextNetwork(firstPacket); 696 reply.writeNoException(); 697 return true; 698 } 699 700 case START_BINDER_TRACKING_TRANSACTION: 701 { 702 data.enforceInterface(IApplicationThread.descriptor); 703 startBinderTracking(); 704 return true; 705 } 706 707 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: 708 { 709 data.enforceInterface(IApplicationThread.descriptor); 710 ParcelFileDescriptor fd = data.readFileDescriptor(); 711 if (fd != null) { 712 stopBinderTrackingAndDump(fd.getFileDescriptor()); 713 try { 714 fd.close(); 715 } catch (IOException e) { 716 } 717 } 718 return true; 719 } 720 721 } 722 723 return super.onTransact(code, data, reply, flags); 724 } 725 726 public IBinder asBinder() 727 { 728 return this; 729 } 730} 731 732class ApplicationThreadProxy implements IApplicationThread { 733 private final IBinder mRemote; 734 735 public ApplicationThreadProxy(IBinder remote) { 736 mRemote = remote; 737 } 738 739 public final IBinder asBinder() { 740 return mRemote; 741 } 742 743 public final void schedulePauseActivity(IBinder token, boolean finished, 744 boolean userLeaving, int configChanges, boolean dontReport) throws RemoteException { 745 Parcel data = Parcel.obtain(); 746 data.writeInterfaceToken(IApplicationThread.descriptor); 747 data.writeStrongBinder(token); 748 data.writeInt(finished ? 1 : 0); 749 data.writeInt(userLeaving ? 1 :0); 750 data.writeInt(configChanges); 751 data.writeInt(dontReport ? 1 : 0); 752 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null, 753 IBinder.FLAG_ONEWAY); 754 data.recycle(); 755 } 756 757 public final void scheduleStopActivity(IBinder token, boolean showWindow, 758 int configChanges) throws RemoteException { 759 Parcel data = Parcel.obtain(); 760 data.writeInterfaceToken(IApplicationThread.descriptor); 761 data.writeStrongBinder(token); 762 data.writeInt(showWindow ? 1 : 0); 763 data.writeInt(configChanges); 764 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null, 765 IBinder.FLAG_ONEWAY); 766 data.recycle(); 767 } 768 769 public final void scheduleWindowVisibility(IBinder token, 770 boolean showWindow) throws RemoteException { 771 Parcel data = Parcel.obtain(); 772 data.writeInterfaceToken(IApplicationThread.descriptor); 773 data.writeStrongBinder(token); 774 data.writeInt(showWindow ? 1 : 0); 775 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null, 776 IBinder.FLAG_ONEWAY); 777 data.recycle(); 778 } 779 780 public final void scheduleSleeping(IBinder token, 781 boolean sleeping) throws RemoteException { 782 Parcel data = Parcel.obtain(); 783 data.writeInterfaceToken(IApplicationThread.descriptor); 784 data.writeStrongBinder(token); 785 data.writeInt(sleeping ? 1 : 0); 786 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null, 787 IBinder.FLAG_ONEWAY); 788 data.recycle(); 789 } 790 791 public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward, 792 Bundle resumeArgs) 793 throws RemoteException { 794 Parcel data = Parcel.obtain(); 795 data.writeInterfaceToken(IApplicationThread.descriptor); 796 data.writeStrongBinder(token); 797 data.writeInt(procState); 798 data.writeInt(isForward ? 1 : 0); 799 data.writeBundle(resumeArgs); 800 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null, 801 IBinder.FLAG_ONEWAY); 802 data.recycle(); 803 } 804 805 public final void scheduleSendResult(IBinder token, List<ResultInfo> results) 806 throws RemoteException { 807 Parcel data = Parcel.obtain(); 808 data.writeInterfaceToken(IApplicationThread.descriptor); 809 data.writeStrongBinder(token); 810 data.writeTypedList(results); 811 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null, 812 IBinder.FLAG_ONEWAY); 813 data.recycle(); 814 } 815 816 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, 817 ActivityInfo info, Configuration curConfig, Configuration overrideConfig, 818 CompatibilityInfo compatInfo, String referrer, IVoiceInteractor voiceInteractor, 819 int procState, Bundle state, PersistableBundle persistentState, 820 List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents, 821 boolean notResumed, boolean isForward, ProfilerInfo profilerInfo) throws RemoteException { 822 Parcel data = Parcel.obtain(); 823 data.writeInterfaceToken(IApplicationThread.descriptor); 824 intent.writeToParcel(data, 0); 825 data.writeStrongBinder(token); 826 data.writeInt(ident); 827 info.writeToParcel(data, 0); 828 curConfig.writeToParcel(data, 0); 829 if (overrideConfig != null) { 830 data.writeInt(1); 831 overrideConfig.writeToParcel(data, 0); 832 } else { 833 data.writeInt(0); 834 } 835 compatInfo.writeToParcel(data, 0); 836 data.writeString(referrer); 837 data.writeStrongBinder(voiceInteractor != null ? voiceInteractor.asBinder() : null); 838 data.writeInt(procState); 839 data.writeBundle(state); 840 data.writePersistableBundle(persistentState); 841 data.writeTypedList(pendingResults); 842 data.writeTypedList(pendingNewIntents); 843 data.writeInt(notResumed ? 1 : 0); 844 data.writeInt(isForward ? 1 : 0); 845 if (profilerInfo != null) { 846 data.writeInt(1); 847 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 848 } else { 849 data.writeInt(0); 850 } 851 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null, 852 IBinder.FLAG_ONEWAY); 853 data.recycle(); 854 } 855 856 public final void scheduleRelaunchActivity(IBinder token, 857 List<ResultInfo> pendingResults, List<ReferrerIntent> pendingNewIntents, 858 int configChanges, boolean notResumed, Configuration config, 859 Configuration overrideConfig) throws RemoteException { 860 Parcel data = Parcel.obtain(); 861 data.writeInterfaceToken(IApplicationThread.descriptor); 862 data.writeStrongBinder(token); 863 data.writeTypedList(pendingResults); 864 data.writeTypedList(pendingNewIntents); 865 data.writeInt(configChanges); 866 data.writeInt(notResumed ? 1 : 0); 867 config.writeToParcel(data, 0); 868 if (overrideConfig != null) { 869 data.writeInt(1); 870 overrideConfig.writeToParcel(data, 0); 871 } else { 872 data.writeInt(0); 873 } 874 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null, 875 IBinder.FLAG_ONEWAY); 876 data.recycle(); 877 } 878 879 public void scheduleNewIntent(List<ReferrerIntent> intents, IBinder token) 880 throws RemoteException { 881 Parcel data = Parcel.obtain(); 882 data.writeInterfaceToken(IApplicationThread.descriptor); 883 data.writeTypedList(intents); 884 data.writeStrongBinder(token); 885 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null, 886 IBinder.FLAG_ONEWAY); 887 data.recycle(); 888 } 889 890 public final void scheduleDestroyActivity(IBinder token, boolean finishing, 891 int configChanges) throws RemoteException { 892 Parcel data = Parcel.obtain(); 893 data.writeInterfaceToken(IApplicationThread.descriptor); 894 data.writeStrongBinder(token); 895 data.writeInt(finishing ? 1 : 0); 896 data.writeInt(configChanges); 897 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null, 898 IBinder.FLAG_ONEWAY); 899 data.recycle(); 900 } 901 902 public final void scheduleReceiver(Intent intent, ActivityInfo info, 903 CompatibilityInfo compatInfo, int resultCode, String resultData, 904 Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException { 905 Parcel data = Parcel.obtain(); 906 data.writeInterfaceToken(IApplicationThread.descriptor); 907 intent.writeToParcel(data, 0); 908 info.writeToParcel(data, 0); 909 compatInfo.writeToParcel(data, 0); 910 data.writeInt(resultCode); 911 data.writeString(resultData); 912 data.writeBundle(map); 913 data.writeInt(sync ? 1 : 0); 914 data.writeInt(sendingUser); 915 data.writeInt(processState); 916 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, 917 IBinder.FLAG_ONEWAY); 918 data.recycle(); 919 } 920 921 public final void scheduleCreateBackupAgent(ApplicationInfo app, 922 CompatibilityInfo compatInfo, int backupMode) throws RemoteException { 923 Parcel data = Parcel.obtain(); 924 data.writeInterfaceToken(IApplicationThread.descriptor); 925 app.writeToParcel(data, 0); 926 compatInfo.writeToParcel(data, 0); 927 data.writeInt(backupMode); 928 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null, 929 IBinder.FLAG_ONEWAY); 930 data.recycle(); 931 } 932 933 public final void scheduleDestroyBackupAgent(ApplicationInfo app, 934 CompatibilityInfo compatInfo) throws RemoteException { 935 Parcel data = Parcel.obtain(); 936 data.writeInterfaceToken(IApplicationThread.descriptor); 937 app.writeToParcel(data, 0); 938 compatInfo.writeToParcel(data, 0); 939 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null, 940 IBinder.FLAG_ONEWAY); 941 data.recycle(); 942 } 943 944 public final void scheduleCreateService(IBinder token, ServiceInfo info, 945 CompatibilityInfo compatInfo, int processState) throws RemoteException { 946 Parcel data = Parcel.obtain(); 947 data.writeInterfaceToken(IApplicationThread.descriptor); 948 data.writeStrongBinder(token); 949 info.writeToParcel(data, 0); 950 compatInfo.writeToParcel(data, 0); 951 data.writeInt(processState); 952 try { 953 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, 954 IBinder.FLAG_ONEWAY); 955 } catch (TransactionTooLargeException e) { 956 Log.e("CREATE_SERVICE", "Binder failure starting service; service=" + info); 957 throw e; 958 } 959 data.recycle(); 960 } 961 962 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind, 963 int processState) throws RemoteException { 964 Parcel data = Parcel.obtain(); 965 data.writeInterfaceToken(IApplicationThread.descriptor); 966 data.writeStrongBinder(token); 967 intent.writeToParcel(data, 0); 968 data.writeInt(rebind ? 1 : 0); 969 data.writeInt(processState); 970 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null, 971 IBinder.FLAG_ONEWAY); 972 data.recycle(); 973 } 974 975 public final void scheduleUnbindService(IBinder token, Intent intent) 976 throws RemoteException { 977 Parcel data = Parcel.obtain(); 978 data.writeInterfaceToken(IApplicationThread.descriptor); 979 data.writeStrongBinder(token); 980 intent.writeToParcel(data, 0); 981 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null, 982 IBinder.FLAG_ONEWAY); 983 data.recycle(); 984 } 985 986 public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId, 987 int flags, Intent args) throws RemoteException { 988 Parcel data = Parcel.obtain(); 989 data.writeInterfaceToken(IApplicationThread.descriptor); 990 data.writeStrongBinder(token); 991 data.writeInt(taskRemoved ? 1 : 0); 992 data.writeInt(startId); 993 data.writeInt(flags); 994 if (args != null) { 995 data.writeInt(1); 996 args.writeToParcel(data, 0); 997 } else { 998 data.writeInt(0); 999 } 1000 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null, 1001 IBinder.FLAG_ONEWAY); 1002 data.recycle(); 1003 } 1004 1005 public final void scheduleStopService(IBinder token) 1006 throws RemoteException { 1007 Parcel data = Parcel.obtain(); 1008 data.writeInterfaceToken(IApplicationThread.descriptor); 1009 data.writeStrongBinder(token); 1010 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null, 1011 IBinder.FLAG_ONEWAY); 1012 data.recycle(); 1013 } 1014 1015 @Override 1016 public final void bindApplication(String packageName, ApplicationInfo info, 1017 List<ProviderInfo> providers, ComponentName testName, ProfilerInfo profilerInfo, 1018 Bundle testArgs, IInstrumentationWatcher testWatcher, 1019 IUiAutomationConnection uiAutomationConnection, int debugMode, 1020 boolean enableBinderTracking, boolean openGlTrace, boolean trackAllocation, 1021 boolean restrictedBackupMode, boolean persistent, Configuration config, 1022 CompatibilityInfo compatInfo, Map<String, IBinder> services, 1023 Bundle coreSettings) throws RemoteException { 1024 Parcel data = Parcel.obtain(); 1025 data.writeInterfaceToken(IApplicationThread.descriptor); 1026 data.writeString(packageName); 1027 info.writeToParcel(data, 0); 1028 data.writeTypedList(providers); 1029 if (testName == null) { 1030 data.writeInt(0); 1031 } else { 1032 data.writeInt(1); 1033 testName.writeToParcel(data, 0); 1034 } 1035 if (profilerInfo != null) { 1036 data.writeInt(1); 1037 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1038 } else { 1039 data.writeInt(0); 1040 } 1041 data.writeBundle(testArgs); 1042 data.writeStrongInterface(testWatcher); 1043 data.writeStrongInterface(uiAutomationConnection); 1044 data.writeInt(debugMode); 1045 data.writeInt(enableBinderTracking ? 1 : 0); 1046 data.writeInt(openGlTrace ? 1 : 0); 1047 data.writeInt(trackAllocation ? 1 : 0); 1048 data.writeInt(restrictedBackupMode ? 1 : 0); 1049 data.writeInt(persistent ? 1 : 0); 1050 config.writeToParcel(data, 0); 1051 compatInfo.writeToParcel(data, 0); 1052 data.writeMap(services); 1053 data.writeBundle(coreSettings); 1054 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null, 1055 IBinder.FLAG_ONEWAY); 1056 data.recycle(); 1057 } 1058 1059 public final void scheduleExit() throws RemoteException { 1060 Parcel data = Parcel.obtain(); 1061 data.writeInterfaceToken(IApplicationThread.descriptor); 1062 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null, 1063 IBinder.FLAG_ONEWAY); 1064 data.recycle(); 1065 } 1066 1067 public final void scheduleSuicide() throws RemoteException { 1068 Parcel data = Parcel.obtain(); 1069 data.writeInterfaceToken(IApplicationThread.descriptor); 1070 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null, 1071 IBinder.FLAG_ONEWAY); 1072 data.recycle(); 1073 } 1074 1075 public final void scheduleConfigurationChanged(Configuration config) 1076 throws RemoteException { 1077 Parcel data = Parcel.obtain(); 1078 data.writeInterfaceToken(IApplicationThread.descriptor); 1079 config.writeToParcel(data, 0); 1080 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null, 1081 IBinder.FLAG_ONEWAY); 1082 data.recycle(); 1083 } 1084 1085 public void updateTimeZone() throws RemoteException { 1086 Parcel data = Parcel.obtain(); 1087 data.writeInterfaceToken(IApplicationThread.descriptor); 1088 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null, 1089 IBinder.FLAG_ONEWAY); 1090 data.recycle(); 1091 } 1092 1093 public void clearDnsCache() throws RemoteException { 1094 Parcel data = Parcel.obtain(); 1095 data.writeInterfaceToken(IApplicationThread.descriptor); 1096 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null, 1097 IBinder.FLAG_ONEWAY); 1098 data.recycle(); 1099 } 1100 1101 public void setHttpProxy(String proxy, String port, String exclList, 1102 Uri pacFileUrl) throws RemoteException { 1103 Parcel data = Parcel.obtain(); 1104 data.writeInterfaceToken(IApplicationThread.descriptor); 1105 data.writeString(proxy); 1106 data.writeString(port); 1107 data.writeString(exclList); 1108 pacFileUrl.writeToParcel(data, 0); 1109 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1110 data.recycle(); 1111 } 1112 1113 public void processInBackground() throws RemoteException { 1114 Parcel data = Parcel.obtain(); 1115 data.writeInterfaceToken(IApplicationThread.descriptor); 1116 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null, 1117 IBinder.FLAG_ONEWAY); 1118 data.recycle(); 1119 } 1120 1121 public void dumpService(FileDescriptor fd, IBinder token, String[] args) 1122 throws RemoteException { 1123 Parcel data = Parcel.obtain(); 1124 data.writeInterfaceToken(IApplicationThread.descriptor); 1125 data.writeFileDescriptor(fd); 1126 data.writeStrongBinder(token); 1127 data.writeStringArray(args); 1128 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1129 data.recycle(); 1130 } 1131 1132 public void dumpProvider(FileDescriptor fd, IBinder token, String[] args) 1133 throws RemoteException { 1134 Parcel data = Parcel.obtain(); 1135 data.writeInterfaceToken(IApplicationThread.descriptor); 1136 data.writeFileDescriptor(fd); 1137 data.writeStrongBinder(token); 1138 data.writeStringArray(args); 1139 mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1140 data.recycle(); 1141 } 1142 1143 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, 1144 int resultCode, String dataStr, Bundle extras, boolean ordered, 1145 boolean sticky, int sendingUser, int processState) throws RemoteException { 1146 Parcel data = Parcel.obtain(); 1147 data.writeInterfaceToken(IApplicationThread.descriptor); 1148 data.writeStrongBinder(receiver.asBinder()); 1149 intent.writeToParcel(data, 0); 1150 data.writeInt(resultCode); 1151 data.writeString(dataStr); 1152 data.writeBundle(extras); 1153 data.writeInt(ordered ? 1 : 0); 1154 data.writeInt(sticky ? 1 : 0); 1155 data.writeInt(sendingUser); 1156 data.writeInt(processState); 1157 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, 1158 IBinder.FLAG_ONEWAY); 1159 data.recycle(); 1160 } 1161 1162 @Override 1163 public final void scheduleLowMemory() throws RemoteException { 1164 Parcel data = Parcel.obtain(); 1165 data.writeInterfaceToken(IApplicationThread.descriptor); 1166 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null, 1167 IBinder.FLAG_ONEWAY); 1168 data.recycle(); 1169 } 1170 1171 @Override 1172 public final void scheduleActivityConfigurationChanged( 1173 IBinder token, Configuration overrideConfig) throws RemoteException { 1174 Parcel data = Parcel.obtain(); 1175 data.writeInterfaceToken(IApplicationThread.descriptor); 1176 data.writeStrongBinder(token); 1177 if (overrideConfig != null) { 1178 data.writeInt(1); 1179 overrideConfig.writeToParcel(data, 0); 1180 } else { 1181 data.writeInt(0); 1182 } 1183 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null, 1184 IBinder.FLAG_ONEWAY); 1185 data.recycle(); 1186 } 1187 1188 @Override 1189 public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType) 1190 throws RemoteException { 1191 Parcel data = Parcel.obtain(); 1192 data.writeInterfaceToken(IApplicationThread.descriptor); 1193 data.writeInt(start ? 1 : 0); 1194 data.writeInt(profileType); 1195 if (profilerInfo != null) { 1196 data.writeInt(1); 1197 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1198 } else { 1199 data.writeInt(0); 1200 } 1201 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null, 1202 IBinder.FLAG_ONEWAY); 1203 data.recycle(); 1204 } 1205 1206 public void setSchedulingGroup(int group) throws RemoteException { 1207 Parcel data = Parcel.obtain(); 1208 data.writeInterfaceToken(IApplicationThread.descriptor); 1209 data.writeInt(group); 1210 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null, 1211 IBinder.FLAG_ONEWAY); 1212 data.recycle(); 1213 } 1214 1215 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException { 1216 Parcel data = Parcel.obtain(); 1217 data.writeInterfaceToken(IApplicationThread.descriptor); 1218 data.writeInt(cmd); 1219 data.writeStringArray(packages); 1220 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null, 1221 IBinder.FLAG_ONEWAY); 1222 data.recycle(); 1223 } 1224 1225 public void scheduleCrash(String msg) throws RemoteException { 1226 Parcel data = Parcel.obtain(); 1227 data.writeInterfaceToken(IApplicationThread.descriptor); 1228 data.writeString(msg); 1229 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null, 1230 IBinder.FLAG_ONEWAY); 1231 data.recycle(); 1232 } 1233 1234 public void dumpHeap(boolean managed, String path, 1235 ParcelFileDescriptor fd) throws RemoteException { 1236 Parcel data = Parcel.obtain(); 1237 data.writeInterfaceToken(IApplicationThread.descriptor); 1238 data.writeInt(managed ? 1 : 0); 1239 data.writeString(path); 1240 if (fd != null) { 1241 data.writeInt(1); 1242 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1243 } else { 1244 data.writeInt(0); 1245 } 1246 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null, 1247 IBinder.FLAG_ONEWAY); 1248 data.recycle(); 1249 } 1250 1251 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args) 1252 throws RemoteException { 1253 Parcel data = Parcel.obtain(); 1254 data.writeInterfaceToken(IApplicationThread.descriptor); 1255 data.writeFileDescriptor(fd); 1256 data.writeStrongBinder(token); 1257 data.writeString(prefix); 1258 data.writeStringArray(args); 1259 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1260 data.recycle(); 1261 } 1262 1263 public void setCoreSettings(Bundle coreSettings) throws RemoteException { 1264 Parcel data = Parcel.obtain(); 1265 data.writeInterfaceToken(IApplicationThread.descriptor); 1266 data.writeBundle(coreSettings); 1267 mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1268 } 1269 1270 public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info) 1271 throws RemoteException { 1272 Parcel data = Parcel.obtain(); 1273 data.writeInterfaceToken(IApplicationThread.descriptor); 1274 data.writeString(pkg); 1275 info.writeToParcel(data, 0); 1276 mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null, 1277 IBinder.FLAG_ONEWAY); 1278 } 1279 1280 public void scheduleTrimMemory(int level) throws RemoteException { 1281 Parcel data = Parcel.obtain(); 1282 data.writeInterfaceToken(IApplicationThread.descriptor); 1283 data.writeInt(level); 1284 mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null, 1285 IBinder.FLAG_ONEWAY); 1286 data.recycle(); 1287 } 1288 1289 public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin, 1290 boolean dumpInfo, boolean dumpDalvik, boolean dumpSummaryOnly, String[] args) throws RemoteException { 1291 Parcel data = Parcel.obtain(); 1292 Parcel reply = Parcel.obtain(); 1293 data.writeInterfaceToken(IApplicationThread.descriptor); 1294 data.writeFileDescriptor(fd); 1295 mem.writeToParcel(data, 0); 1296 data.writeInt(checkin ? 1 : 0); 1297 data.writeInt(dumpInfo ? 1 : 0); 1298 data.writeInt(dumpDalvik ? 1 : 0); 1299 data.writeInt(dumpSummaryOnly ? 1 : 0); 1300 data.writeStringArray(args); 1301 mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0); 1302 reply.readException(); 1303 data.recycle(); 1304 reply.recycle(); 1305 } 1306 1307 public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException { 1308 Parcel data = Parcel.obtain(); 1309 data.writeInterfaceToken(IApplicationThread.descriptor); 1310 data.writeFileDescriptor(fd); 1311 data.writeStringArray(args); 1312 mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1313 data.recycle(); 1314 } 1315 1316 public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException { 1317 Parcel data = Parcel.obtain(); 1318 data.writeInterfaceToken(IApplicationThread.descriptor); 1319 data.writeFileDescriptor(fd); 1320 data.writeStringArray(args); 1321 mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1322 data.recycle(); 1323 } 1324 1325 @Override 1326 public void unstableProviderDied(IBinder provider) throws RemoteException { 1327 Parcel data = Parcel.obtain(); 1328 data.writeInterfaceToken(IApplicationThread.descriptor); 1329 data.writeStrongBinder(provider); 1330 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1331 data.recycle(); 1332 } 1333 1334 @Override 1335 public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken, 1336 int requestType) throws RemoteException { 1337 Parcel data = Parcel.obtain(); 1338 data.writeInterfaceToken(IApplicationThread.descriptor); 1339 data.writeStrongBinder(activityToken); 1340 data.writeStrongBinder(requestToken); 1341 data.writeInt(requestType); 1342 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, null, 1343 IBinder.FLAG_ONEWAY); 1344 data.recycle(); 1345 } 1346 1347 @Override 1348 public void scheduleTranslucentConversionComplete(IBinder token, boolean timeout) 1349 throws RemoteException { 1350 Parcel data = Parcel.obtain(); 1351 data.writeInterfaceToken(IApplicationThread.descriptor); 1352 data.writeStrongBinder(token); 1353 data.writeInt(timeout ? 1 : 0); 1354 mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null, 1355 IBinder.FLAG_ONEWAY); 1356 data.recycle(); 1357 } 1358 1359 @Override 1360 public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options) 1361 throws RemoteException { 1362 Parcel data = Parcel.obtain(); 1363 data.writeInterfaceToken(IApplicationThread.descriptor); 1364 data.writeStrongBinder(token); 1365 data.writeBundle(options == null ? null : options.toBundle()); 1366 mRemote.transact(SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION, data, null, 1367 IBinder.FLAG_ONEWAY); 1368 data.recycle(); 1369 } 1370 1371 @Override 1372 public void setProcessState(int state) throws RemoteException { 1373 Parcel data = Parcel.obtain(); 1374 data.writeInterfaceToken(IApplicationThread.descriptor); 1375 data.writeInt(state); 1376 mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1377 data.recycle(); 1378 } 1379 1380 @Override 1381 public void scheduleInstallProvider(ProviderInfo provider) throws RemoteException { 1382 Parcel data = Parcel.obtain(); 1383 data.writeInterfaceToken(IApplicationThread.descriptor); 1384 provider.writeToParcel(data, 0); 1385 mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1386 data.recycle(); 1387 } 1388 1389 @Override 1390 public void updateTimePrefs(boolean is24Hour) throws RemoteException { 1391 Parcel data = Parcel.obtain(); 1392 data.writeInterfaceToken(IApplicationThread.descriptor); 1393 data.writeByte(is24Hour ? (byte) 1 : (byte) 0); 1394 mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1395 data.recycle(); 1396 } 1397 1398 @Override 1399 public void scheduleCancelVisibleBehind(IBinder token) throws RemoteException { 1400 Parcel data = Parcel.obtain(); 1401 data.writeInterfaceToken(IApplicationThread.descriptor); 1402 data.writeStrongBinder(token); 1403 mRemote.transact(CANCEL_VISIBLE_BEHIND_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1404 data.recycle(); 1405 } 1406 1407 @Override 1408 public void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled) 1409 throws RemoteException { 1410 Parcel data = Parcel.obtain(); 1411 data.writeInterfaceToken(IApplicationThread.descriptor); 1412 data.writeStrongBinder(token); 1413 data.writeInt(enabled ? 1 : 0); 1414 mRemote.transact(BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION, data, null, 1415 IBinder.FLAG_ONEWAY); 1416 data.recycle(); 1417 } 1418 1419 @Override 1420 public void scheduleEnterAnimationComplete(IBinder token) throws RemoteException { 1421 Parcel data = Parcel.obtain(); 1422 data.writeInterfaceToken(IApplicationThread.descriptor); 1423 data.writeStrongBinder(token); 1424 mRemote.transact(ENTER_ANIMATION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1425 data.recycle(); 1426 } 1427 1428 @Override 1429 public void notifyCleartextNetwork(byte[] firstPacket) throws RemoteException { 1430 Parcel data = Parcel.obtain(); 1431 data.writeInterfaceToken(IApplicationThread.descriptor); 1432 data.writeByteArray(firstPacket); 1433 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, null, IBinder.FLAG_ONEWAY); 1434 data.recycle(); 1435 } 1436 1437 @Override 1438 public void startBinderTracking() throws RemoteException { 1439 Parcel data = Parcel.obtain(); 1440 data.writeInterfaceToken(IApplicationThread.descriptor); 1441 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, null, 1442 IBinder.FLAG_ONEWAY); 1443 data.recycle(); 1444 } 1445 1446 @Override 1447 public void stopBinderTrackingAndDump(FileDescriptor fd) throws RemoteException { 1448 Parcel data = Parcel.obtain(); 1449 data.writeInterfaceToken(IApplicationThread.descriptor); 1450 data.writeFileDescriptor(fd); 1451 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, null, 1452 IBinder.FLAG_ONEWAY); 1453 data.recycle(); 1454 } 1455} 1456