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