ApplicationThreadNative.java revision b06ea706530e6d19eb2a1a9a7ae6c5dd77d80af0
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.Configuration; 27import android.os.Binder; 28import android.os.Bundle; 29import android.os.Parcelable; 30import android.os.RemoteException; 31import android.os.IBinder; 32import android.os.Parcel; 33import android.os.ParcelFileDescriptor; 34 35import java.io.FileDescriptor; 36import java.io.IOException; 37import java.util.HashMap; 38import java.util.List; 39import java.util.Map; 40 41/** {@hide} */ 42public abstract class ApplicationThreadNative extends Binder 43 implements IApplicationThread { 44 /** 45 * Cast a Binder object into an application thread interface, generating 46 * a proxy if needed. 47 */ 48 static public IApplicationThread asInterface(IBinder obj) { 49 if (obj == null) { 50 return null; 51 } 52 IApplicationThread in = 53 (IApplicationThread)obj.queryLocalInterface(descriptor); 54 if (in != null) { 55 return in; 56 } 57 58 return new ApplicationThreadProxy(obj); 59 } 60 61 public ApplicationThreadNative() { 62 attachInterface(this, descriptor); 63 } 64 65 @Override 66 public boolean onTransact(int code, Parcel data, Parcel reply, int flags) 67 throws RemoteException { 68 switch (code) { 69 case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION: 70 { 71 data.enforceInterface(IApplicationThread.descriptor); 72 IBinder b = data.readStrongBinder(); 73 boolean finished = data.readInt() != 0; 74 boolean userLeaving = data.readInt() != 0; 75 int configChanges = data.readInt(); 76 schedulePauseActivity(b, finished, userLeaving, configChanges); 77 return true; 78 } 79 80 case SCHEDULE_STOP_ACTIVITY_TRANSACTION: 81 { 82 data.enforceInterface(IApplicationThread.descriptor); 83 IBinder b = data.readStrongBinder(); 84 boolean show = data.readInt() != 0; 85 int configChanges = data.readInt(); 86 scheduleStopActivity(b, show, configChanges); 87 return true; 88 } 89 90 case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION: 91 { 92 data.enforceInterface(IApplicationThread.descriptor); 93 IBinder b = data.readStrongBinder(); 94 boolean show = data.readInt() != 0; 95 scheduleWindowVisibility(b, show); 96 return true; 97 } 98 99 case SCHEDULE_RESUME_ACTIVITY_TRANSACTION: 100 { 101 data.enforceInterface(IApplicationThread.descriptor); 102 IBinder b = data.readStrongBinder(); 103 boolean isForward = data.readInt() != 0; 104 scheduleResumeActivity(b, isForward); 105 return true; 106 } 107 108 case SCHEDULE_SEND_RESULT_TRANSACTION: 109 { 110 data.enforceInterface(IApplicationThread.descriptor); 111 IBinder b = data.readStrongBinder(); 112 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); 113 scheduleSendResult(b, ri); 114 return true; 115 } 116 117 case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION: 118 { 119 data.enforceInterface(IApplicationThread.descriptor); 120 Intent intent = Intent.CREATOR.createFromParcel(data); 121 IBinder b = data.readStrongBinder(); 122 int ident = data.readInt(); 123 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); 124 Bundle state = data.readBundle(); 125 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); 126 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); 127 boolean notResumed = data.readInt() != 0; 128 boolean isForward = data.readInt() != 0; 129 scheduleLaunchActivity(intent, b, ident, info, state, ri, pi, 130 notResumed, isForward); 131 return true; 132 } 133 134 case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION: 135 { 136 data.enforceInterface(IApplicationThread.descriptor); 137 IBinder b = data.readStrongBinder(); 138 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR); 139 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); 140 int configChanges = data.readInt(); 141 boolean notResumed = data.readInt() != 0; 142 scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed); 143 return true; 144 } 145 146 case SCHEDULE_NEW_INTENT_TRANSACTION: 147 { 148 data.enforceInterface(IApplicationThread.descriptor); 149 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR); 150 IBinder b = data.readStrongBinder(); 151 scheduleNewIntent(pi, b); 152 return true; 153 } 154 155 case SCHEDULE_FINISH_ACTIVITY_TRANSACTION: 156 { 157 data.enforceInterface(IApplicationThread.descriptor); 158 IBinder b = data.readStrongBinder(); 159 boolean finishing = data.readInt() != 0; 160 int configChanges = data.readInt(); 161 scheduleDestroyActivity(b, finishing, configChanges); 162 return true; 163 } 164 165 case SCHEDULE_RECEIVER_TRANSACTION: 166 { 167 data.enforceInterface(IApplicationThread.descriptor); 168 Intent intent = Intent.CREATOR.createFromParcel(data); 169 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data); 170 int resultCode = data.readInt(); 171 String resultData = data.readString(); 172 Bundle resultExtras = data.readBundle(); 173 boolean sync = data.readInt() != 0; 174 scheduleReceiver(intent, info, resultCode, resultData, 175 resultExtras, sync); 176 return true; 177 } 178 179 case SCHEDULE_CREATE_SERVICE_TRANSACTION: { 180 data.enforceInterface(IApplicationThread.descriptor); 181 IBinder token = data.readStrongBinder(); 182 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data); 183 scheduleCreateService(token, info); 184 return true; 185 } 186 187 case SCHEDULE_BIND_SERVICE_TRANSACTION: { 188 data.enforceInterface(IApplicationThread.descriptor); 189 IBinder token = data.readStrongBinder(); 190 Intent intent = Intent.CREATOR.createFromParcel(data); 191 boolean rebind = data.readInt() != 0; 192 scheduleBindService(token, intent, rebind); 193 return true; 194 } 195 196 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: { 197 data.enforceInterface(IApplicationThread.descriptor); 198 IBinder token = data.readStrongBinder(); 199 Intent intent = Intent.CREATOR.createFromParcel(data); 200 scheduleUnbindService(token, intent); 201 return true; 202 } 203 204 case SCHEDULE_SERVICE_ARGS_TRANSACTION: 205 { 206 data.enforceInterface(IApplicationThread.descriptor); 207 IBinder token = data.readStrongBinder(); 208 int startId = data.readInt(); 209 Intent args = Intent.CREATOR.createFromParcel(data); 210 scheduleServiceArgs(token, startId, args); 211 return true; 212 } 213 214 case SCHEDULE_STOP_SERVICE_TRANSACTION: 215 { 216 data.enforceInterface(IApplicationThread.descriptor); 217 IBinder token = data.readStrongBinder(); 218 scheduleStopService(token); 219 return true; 220 } 221 222 case BIND_APPLICATION_TRANSACTION: 223 { 224 data.enforceInterface(IApplicationThread.descriptor); 225 String packageName = data.readString(); 226 ApplicationInfo info = 227 ApplicationInfo.CREATOR.createFromParcel(data); 228 List<ProviderInfo> providers = 229 data.createTypedArrayList(ProviderInfo.CREATOR); 230 ComponentName testName = (data.readInt() != 0) 231 ? new ComponentName(data) : null; 232 String profileName = data.readString(); 233 Bundle testArgs = data.readBundle(); 234 IBinder binder = data.readStrongBinder(); 235 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder); 236 int testMode = data.readInt(); 237 boolean restrictedBackupMode = (data.readInt() != 0); 238 Configuration config = Configuration.CREATOR.createFromParcel(data); 239 HashMap<String, IBinder> services = data.readHashMap(null); 240 bindApplication(packageName, info, 241 providers, testName, profileName, 242 testArgs, testWatcher, testMode, restrictedBackupMode, 243 config, services); 244 return true; 245 } 246 247 case SCHEDULE_EXIT_TRANSACTION: 248 { 249 data.enforceInterface(IApplicationThread.descriptor); 250 scheduleExit(); 251 return true; 252 } 253 254 case REQUEST_THUMBNAIL_TRANSACTION: 255 { 256 data.enforceInterface(IApplicationThread.descriptor); 257 IBinder b = data.readStrongBinder(); 258 requestThumbnail(b); 259 return true; 260 } 261 262 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION: 263 { 264 data.enforceInterface(IApplicationThread.descriptor); 265 Configuration config = Configuration.CREATOR.createFromParcel(data); 266 scheduleConfigurationChanged(config); 267 return true; 268 } 269 270 case UPDATE_TIME_ZONE_TRANSACTION: { 271 data.enforceInterface(IApplicationThread.descriptor); 272 updateTimeZone(); 273 return true; 274 } 275 276 case PROCESS_IN_BACKGROUND_TRANSACTION: { 277 data.enforceInterface(IApplicationThread.descriptor); 278 processInBackground(); 279 return true; 280 } 281 282 case DUMP_SERVICE_TRANSACTION: { 283 data.enforceInterface(IApplicationThread.descriptor); 284 ParcelFileDescriptor fd = data.readFileDescriptor(); 285 final IBinder service = data.readStrongBinder(); 286 final String[] args = data.readStringArray(); 287 if (fd != null) { 288 dumpService(fd.getFileDescriptor(), service, args); 289 try { 290 fd.close(); 291 } catch (IOException e) { 292 } 293 } 294 return true; 295 } 296 297 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: { 298 data.enforceInterface(IApplicationThread.descriptor); 299 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface( 300 data.readStrongBinder()); 301 Intent intent = Intent.CREATOR.createFromParcel(data); 302 int resultCode = data.readInt(); 303 String dataStr = data.readString(); 304 Bundle extras = data.readBundle(); 305 boolean ordered = data.readInt() != 0; 306 scheduleRegisteredReceiver(receiver, intent, 307 resultCode, dataStr, extras, ordered); 308 return true; 309 } 310 311 case SCHEDULE_LOW_MEMORY_TRANSACTION: 312 { 313 scheduleLowMemory(); 314 return true; 315 } 316 317 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION: 318 { 319 data.enforceInterface(IApplicationThread.descriptor); 320 IBinder b = data.readStrongBinder(); 321 scheduleActivityConfigurationChanged(b); 322 return true; 323 } 324 325 case REQUEST_PSS_TRANSACTION: 326 { 327 data.enforceInterface(IApplicationThread.descriptor); 328 requestPss(); 329 return true; 330 } 331 332 case PROFILER_CONTROL_TRANSACTION: 333 { 334 data.enforceInterface(IApplicationThread.descriptor); 335 boolean start = data.readInt() != 0; 336 String path = data.readString(); 337 ParcelFileDescriptor fd = data.readInt() != 0 338 ? data.readFileDescriptor() : null; 339 profilerControl(start, path, fd); 340 return true; 341 } 342 343 case SET_SCHEDULING_GROUP_TRANSACTION: 344 { 345 data.enforceInterface(IApplicationThread.descriptor); 346 int group = data.readInt(); 347 setSchedulingGroup(group); 348 return true; 349 } 350 351 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION: 352 { 353 data.enforceInterface(IApplicationThread.descriptor); 354 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); 355 int backupMode = data.readInt(); 356 scheduleCreateBackupAgent(appInfo, backupMode); 357 return true; 358 } 359 360 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION: 361 { 362 data.enforceInterface(IApplicationThread.descriptor); 363 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data); 364 scheduleDestroyBackupAgent(appInfo); 365 return true; 366 } 367 } 368 369 return super.onTransact(code, data, reply, flags); 370 } 371 372 public IBinder asBinder() 373 { 374 return this; 375 } 376} 377 378class ApplicationThreadProxy implements IApplicationThread { 379 private final IBinder mRemote; 380 381 public ApplicationThreadProxy(IBinder remote) { 382 mRemote = remote; 383 } 384 385 public final IBinder asBinder() { 386 return mRemote; 387 } 388 389 public final void schedulePauseActivity(IBinder token, boolean finished, 390 boolean userLeaving, int configChanges) throws RemoteException { 391 Parcel data = Parcel.obtain(); 392 data.writeInterfaceToken(IApplicationThread.descriptor); 393 data.writeStrongBinder(token); 394 data.writeInt(finished ? 1 : 0); 395 data.writeInt(userLeaving ? 1 :0); 396 data.writeInt(configChanges); 397 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null, 398 IBinder.FLAG_ONEWAY); 399 data.recycle(); 400 } 401 402 public final void scheduleStopActivity(IBinder token, boolean showWindow, 403 int configChanges) throws RemoteException { 404 Parcel data = Parcel.obtain(); 405 data.writeInterfaceToken(IApplicationThread.descriptor); 406 data.writeStrongBinder(token); 407 data.writeInt(showWindow ? 1 : 0); 408 data.writeInt(configChanges); 409 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null, 410 IBinder.FLAG_ONEWAY); 411 data.recycle(); 412 } 413 414 public final void scheduleWindowVisibility(IBinder token, 415 boolean showWindow) throws RemoteException { 416 Parcel data = Parcel.obtain(); 417 data.writeInterfaceToken(IApplicationThread.descriptor); 418 data.writeStrongBinder(token); 419 data.writeInt(showWindow ? 1 : 0); 420 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null, 421 IBinder.FLAG_ONEWAY); 422 data.recycle(); 423 } 424 425 public final void scheduleResumeActivity(IBinder token, boolean isForward) 426 throws RemoteException { 427 Parcel data = Parcel.obtain(); 428 data.writeInterfaceToken(IApplicationThread.descriptor); 429 data.writeStrongBinder(token); 430 data.writeInt(isForward ? 1 : 0); 431 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null, 432 IBinder.FLAG_ONEWAY); 433 data.recycle(); 434 } 435 436 public final void scheduleSendResult(IBinder token, List<ResultInfo> results) 437 throws RemoteException { 438 Parcel data = Parcel.obtain(); 439 data.writeInterfaceToken(IApplicationThread.descriptor); 440 data.writeStrongBinder(token); 441 data.writeTypedList(results); 442 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null, 443 IBinder.FLAG_ONEWAY); 444 data.recycle(); 445 } 446 447 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident, 448 ActivityInfo info, Bundle state, List<ResultInfo> pendingResults, 449 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward) 450 throws RemoteException { 451 Parcel data = Parcel.obtain(); 452 data.writeInterfaceToken(IApplicationThread.descriptor); 453 intent.writeToParcel(data, 0); 454 data.writeStrongBinder(token); 455 data.writeInt(ident); 456 info.writeToParcel(data, 0); 457 data.writeBundle(state); 458 data.writeTypedList(pendingResults); 459 data.writeTypedList(pendingNewIntents); 460 data.writeInt(notResumed ? 1 : 0); 461 data.writeInt(isForward ? 1 : 0); 462 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null, 463 IBinder.FLAG_ONEWAY); 464 data.recycle(); 465 } 466 467 public final void scheduleRelaunchActivity(IBinder token, 468 List<ResultInfo> pendingResults, List<Intent> pendingNewIntents, 469 int configChanges, boolean notResumed) throws RemoteException { 470 Parcel data = Parcel.obtain(); 471 data.writeInterfaceToken(IApplicationThread.descriptor); 472 data.writeStrongBinder(token); 473 data.writeTypedList(pendingResults); 474 data.writeTypedList(pendingNewIntents); 475 data.writeInt(configChanges); 476 data.writeInt(notResumed ? 1 : 0); 477 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null, 478 IBinder.FLAG_ONEWAY); 479 data.recycle(); 480 } 481 482 public void scheduleNewIntent(List<Intent> intents, IBinder token) 483 throws RemoteException { 484 Parcel data = Parcel.obtain(); 485 data.writeInterfaceToken(IApplicationThread.descriptor); 486 data.writeTypedList(intents); 487 data.writeStrongBinder(token); 488 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null, 489 IBinder.FLAG_ONEWAY); 490 data.recycle(); 491 } 492 493 public final void scheduleDestroyActivity(IBinder token, boolean finishing, 494 int configChanges) throws RemoteException { 495 Parcel data = Parcel.obtain(); 496 data.writeInterfaceToken(IApplicationThread.descriptor); 497 data.writeStrongBinder(token); 498 data.writeInt(finishing ? 1 : 0); 499 data.writeInt(configChanges); 500 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null, 501 IBinder.FLAG_ONEWAY); 502 data.recycle(); 503 } 504 505 public final void scheduleReceiver(Intent intent, ActivityInfo info, 506 int resultCode, String resultData, 507 Bundle map, boolean sync) throws RemoteException { 508 Parcel data = Parcel.obtain(); 509 data.writeInterfaceToken(IApplicationThread.descriptor); 510 intent.writeToParcel(data, 0); 511 info.writeToParcel(data, 0); 512 data.writeInt(resultCode); 513 data.writeString(resultData); 514 data.writeBundle(map); 515 data.writeInt(sync ? 1 : 0); 516 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null, 517 IBinder.FLAG_ONEWAY); 518 data.recycle(); 519 } 520 521 public final void scheduleCreateBackupAgent(ApplicationInfo app, int backupMode) 522 throws RemoteException { 523 Parcel data = Parcel.obtain(); 524 data.writeInterfaceToken(IApplicationThread.descriptor); 525 app.writeToParcel(data, 0); 526 data.writeInt(backupMode); 527 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null, 0); 528 data.recycle(); 529 } 530 531 public final void scheduleDestroyBackupAgent(ApplicationInfo app) throws RemoteException { 532 Parcel data = Parcel.obtain(); 533 data.writeInterfaceToken(IApplicationThread.descriptor); 534 app.writeToParcel(data, 0); 535 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null, 0); 536 data.recycle(); 537 } 538 539 public final void scheduleCreateService(IBinder token, ServiceInfo info) 540 throws RemoteException { 541 Parcel data = Parcel.obtain(); 542 data.writeInterfaceToken(IApplicationThread.descriptor); 543 data.writeStrongBinder(token); 544 info.writeToParcel(data, 0); 545 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null, 546 IBinder.FLAG_ONEWAY); 547 data.recycle(); 548 } 549 550 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind) 551 throws RemoteException { 552 Parcel data = Parcel.obtain(); 553 data.writeInterfaceToken(IApplicationThread.descriptor); 554 data.writeStrongBinder(token); 555 intent.writeToParcel(data, 0); 556 data.writeInt(rebind ? 1 : 0); 557 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null, 558 IBinder.FLAG_ONEWAY); 559 data.recycle(); 560 } 561 562 public final void scheduleUnbindService(IBinder token, Intent intent) 563 throws RemoteException { 564 Parcel data = Parcel.obtain(); 565 data.writeInterfaceToken(IApplicationThread.descriptor); 566 data.writeStrongBinder(token); 567 intent.writeToParcel(data, 0); 568 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null, 569 IBinder.FLAG_ONEWAY); 570 data.recycle(); 571 } 572 573 public final void scheduleServiceArgs(IBinder token, int startId, 574 Intent args) throws RemoteException { 575 Parcel data = Parcel.obtain(); 576 data.writeInterfaceToken(IApplicationThread.descriptor); 577 data.writeStrongBinder(token); 578 data.writeInt(startId); 579 args.writeToParcel(data, 0); 580 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null, 581 IBinder.FLAG_ONEWAY); 582 data.recycle(); 583 } 584 585 public final void scheduleStopService(IBinder token) 586 throws RemoteException { 587 Parcel data = Parcel.obtain(); 588 data.writeInterfaceToken(IApplicationThread.descriptor); 589 data.writeStrongBinder(token); 590 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null, 591 IBinder.FLAG_ONEWAY); 592 data.recycle(); 593 } 594 595 public final void bindApplication(String packageName, ApplicationInfo info, 596 List<ProviderInfo> providers, ComponentName testName, 597 String profileName, Bundle testArgs, IInstrumentationWatcher testWatcher, int debugMode, 598 boolean restrictedBackupMode, Configuration config, 599 Map<String, IBinder> services) throws RemoteException { 600 Parcel data = Parcel.obtain(); 601 data.writeInterfaceToken(IApplicationThread.descriptor); 602 data.writeString(packageName); 603 info.writeToParcel(data, 0); 604 data.writeTypedList(providers); 605 if (testName == null) { 606 data.writeInt(0); 607 } else { 608 data.writeInt(1); 609 testName.writeToParcel(data, 0); 610 } 611 data.writeString(profileName); 612 data.writeBundle(testArgs); 613 data.writeStrongInterface(testWatcher); 614 data.writeInt(debugMode); 615 data.writeInt(restrictedBackupMode ? 1 : 0); 616 config.writeToParcel(data, 0); 617 data.writeMap(services); 618 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null, 619 IBinder.FLAG_ONEWAY); 620 data.recycle(); 621 } 622 623 public final void scheduleExit() throws RemoteException { 624 Parcel data = Parcel.obtain(); 625 data.writeInterfaceToken(IApplicationThread.descriptor); 626 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null, 627 IBinder.FLAG_ONEWAY); 628 data.recycle(); 629 } 630 631 public final void requestThumbnail(IBinder token) 632 throws RemoteException { 633 Parcel data = Parcel.obtain(); 634 data.writeInterfaceToken(IApplicationThread.descriptor); 635 data.writeStrongBinder(token); 636 mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null, 637 IBinder.FLAG_ONEWAY); 638 data.recycle(); 639 } 640 641 public final void scheduleConfigurationChanged(Configuration config) 642 throws RemoteException { 643 Parcel data = Parcel.obtain(); 644 data.writeInterfaceToken(IApplicationThread.descriptor); 645 config.writeToParcel(data, 0); 646 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null, 647 IBinder.FLAG_ONEWAY); 648 data.recycle(); 649 } 650 651 public void updateTimeZone() throws RemoteException { 652 Parcel data = Parcel.obtain(); 653 data.writeInterfaceToken(IApplicationThread.descriptor); 654 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null, 655 IBinder.FLAG_ONEWAY); 656 data.recycle(); 657 } 658 659 public void processInBackground() throws RemoteException { 660 Parcel data = Parcel.obtain(); 661 data.writeInterfaceToken(IApplicationThread.descriptor); 662 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null, 663 IBinder.FLAG_ONEWAY); 664 data.recycle(); 665 } 666 667 public void dumpService(FileDescriptor fd, IBinder token, String[] args) 668 throws RemoteException { 669 Parcel data = Parcel.obtain(); 670 data.writeInterfaceToken(IApplicationThread.descriptor); 671 data.writeFileDescriptor(fd); 672 data.writeStrongBinder(token); 673 data.writeStringArray(args); 674 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, 0); 675 data.recycle(); 676 } 677 678 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent, 679 int resultCode, String dataStr, Bundle extras, boolean ordered) 680 throws RemoteException { 681 Parcel data = Parcel.obtain(); 682 data.writeInterfaceToken(IApplicationThread.descriptor); 683 data.writeStrongBinder(receiver.asBinder()); 684 intent.writeToParcel(data, 0); 685 data.writeInt(resultCode); 686 data.writeString(dataStr); 687 data.writeBundle(extras); 688 data.writeInt(ordered ? 1 : 0); 689 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null, 690 IBinder.FLAG_ONEWAY); 691 data.recycle(); 692 } 693 694 public final void scheduleLowMemory() throws RemoteException { 695 Parcel data = Parcel.obtain(); 696 data.writeInterfaceToken(IApplicationThread.descriptor); 697 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null, 698 IBinder.FLAG_ONEWAY); 699 data.recycle(); 700 } 701 702 public final void scheduleActivityConfigurationChanged( 703 IBinder token) throws RemoteException { 704 Parcel data = Parcel.obtain(); 705 data.writeInterfaceToken(IApplicationThread.descriptor); 706 data.writeStrongBinder(token); 707 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null, 708 IBinder.FLAG_ONEWAY); 709 data.recycle(); 710 } 711 712 public final void requestPss() throws RemoteException { 713 Parcel data = Parcel.obtain(); 714 data.writeInterfaceToken(IApplicationThread.descriptor); 715 mRemote.transact(REQUEST_PSS_TRANSACTION, data, null, 716 IBinder.FLAG_ONEWAY); 717 data.recycle(); 718 } 719 720 public void profilerControl(boolean start, String path, 721 ParcelFileDescriptor fd) throws RemoteException { 722 Parcel data = Parcel.obtain(); 723 data.writeInterfaceToken(IApplicationThread.descriptor); 724 data.writeInt(start ? 1 : 0); 725 data.writeString(path); 726 if (fd != null) { 727 data.writeInt(1); 728 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 729 } else { 730 data.writeInt(0); 731 } 732 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null, 733 IBinder.FLAG_ONEWAY); 734 data.recycle(); 735 } 736 737 public void setSchedulingGroup(int group) throws RemoteException { 738 Parcel data = Parcel.obtain(); 739 data.writeInterfaceToken(IApplicationThread.descriptor); 740 data.writeInt(group); 741 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null, 742 IBinder.FLAG_ONEWAY); 743 data.recycle(); 744 } 745} 746 747