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.IIntentReceiver; 21 import android.content.IIntentSender; 22 import android.content.Intent; 23 import android.content.IntentFilter; 24 import android.content.IntentSender; 25 import android.content.pm.ApplicationInfo; 26 import android.content.pm.ConfigurationInfo; 27 import android.content.pm.IPackageDataObserver; 28 import android.content.pm.UserInfo; 29 import android.content.res.Configuration; 30 import android.graphics.Bitmap; 31 import android.net.Uri; 32 import android.os.Binder; 33 import android.os.Bundle; 34 import android.os.Debug; 35 import android.os.IBinder; 36 import android.os.Parcel; 37 import android.os.ParcelFileDescriptor; 38 import android.os.Parcelable; 39 import android.os.RemoteException; 40 import android.os.ServiceManager; 41 import android.os.StrictMode; 42 import android.text.TextUtils; 43 import android.util.Log; 44 import android.util.Singleton; 45 46 import java.util.ArrayList; 47 import java.util.List; 48 49 /** {@hide} */ 50 public abstract class ActivityManagerNative extends Binder implements IActivityManager 51 { 52 /** 53 * Cast a Binder object into an activity manager interface, generating 54 * a proxy if needed. 55 */ 56 static public IActivityManager asInterface(IBinder obj) { 57 if (obj == null) { 58 return null; 59 } 60 IActivityManager in = 61 (IActivityManager)obj.queryLocalInterface(descriptor); 62 if (in != null) { 63 return in; 64 } 65 66 return new ActivityManagerProxy(obj); 67 } 68 69 /** 70 * Retrieve the system's default/global activity manager. 71 */ 72 static public IActivityManager getDefault() { 73 return gDefault.get(); 74 } 75 76 /** 77 * Convenience for checking whether the system is ready. For internal use only. 78 */ 79 static public boolean isSystemReady() { 80 if (!sSystemReady) { 81 sSystemReady = getDefault().testIsSystemReady(); 82 } 83 return sSystemReady; 84 } 85 static boolean sSystemReady = false; 86 87 /** 88 * Convenience for sending a sticky broadcast. For internal use only. 89 * If you don't care about permission, use null. 90 */ 91 static public void broadcastStickyIntent(Intent intent, String permission) { 92 try { 93 getDefault().broadcastIntent( 94 null, intent, null, null, Activity.RESULT_OK, null, null, 95 null /*permission*/, false, true, Binder.getOrigCallingUser()); 96 } catch (RemoteException ex) { 97 } 98 } 99 100 static public void noteWakeupAlarm(PendingIntent ps) { 101 try { 102 getDefault().noteWakeupAlarm(ps.getTarget()); 103 } catch (RemoteException ex) { 104 } 105 } 106 107 public ActivityManagerNative() { 108 attachInterface(this, descriptor); 109 } 110 111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags) 112 throws RemoteException { 113 switch (code) { 114 case START_ACTIVITY_TRANSACTION: 115 { 116 data.enforceInterface(IActivityManager.descriptor); 117 IBinder b = data.readStrongBinder(); 118 IApplicationThread app = ApplicationThreadNative.asInterface(b); 119 Intent intent = Intent.CREATOR.createFromParcel(data); 120 String resolvedType = data.readString(); 121 IBinder resultTo = data.readStrongBinder(); 122 String resultWho = data.readString(); 123 int requestCode = data.readInt(); 124 int startFlags = data.readInt(); 125 String profileFile = data.readString(); 126 ParcelFileDescriptor profileFd = data.readInt() != 0 127 ? data.readFileDescriptor() : null; 128 Bundle options = data.readInt() != 0 129 ? Bundle.CREATOR.createFromParcel(data) : null; 130 int result = startActivity(app, intent, resolvedType, 131 resultTo, resultWho, requestCode, startFlags, 132 profileFile, profileFd, options); 133 reply.writeNoException(); 134 reply.writeInt(result); 135 return true; 136 } 137 138 case START_ACTIVITY_AND_WAIT_TRANSACTION: 139 { 140 data.enforceInterface(IActivityManager.descriptor); 141 IBinder b = data.readStrongBinder(); 142 IApplicationThread app = ApplicationThreadNative.asInterface(b); 143 Intent intent = Intent.CREATOR.createFromParcel(data); 144 String resolvedType = data.readString(); 145 IBinder resultTo = data.readStrongBinder(); 146 String resultWho = data.readString(); 147 int requestCode = data.readInt(); 148 int startFlags = data.readInt(); 149 String profileFile = data.readString(); 150 ParcelFileDescriptor profileFd = data.readInt() != 0 151 ? data.readFileDescriptor() : null; 152 Bundle options = data.readInt() != 0 153 ? Bundle.CREATOR.createFromParcel(data) : null; 154 WaitResult result = startActivityAndWait(app, intent, resolvedType, 155 resultTo, resultWho, requestCode, startFlags, 156 profileFile, profileFd, options); 157 reply.writeNoException(); 158 result.writeToParcel(reply, 0); 159 return true; 160 } 161 162 case START_ACTIVITY_WITH_CONFIG_TRANSACTION: 163 { 164 data.enforceInterface(IActivityManager.descriptor); 165 IBinder b = data.readStrongBinder(); 166 IApplicationThread app = ApplicationThreadNative.asInterface(b); 167 Intent intent = Intent.CREATOR.createFromParcel(data); 168 String resolvedType = data.readString(); 169 IBinder resultTo = data.readStrongBinder(); 170 String resultWho = data.readString(); 171 int requestCode = data.readInt(); 172 int startFlags = data.readInt(); 173 Configuration config = Configuration.CREATOR.createFromParcel(data); 174 Bundle options = data.readInt() != 0 175 ? Bundle.CREATOR.createFromParcel(data) : null; 176 int result = startActivityWithConfig(app, intent, resolvedType, 177 resultTo, resultWho, requestCode, startFlags, config, options); 178 reply.writeNoException(); 179 reply.writeInt(result); 180 return true; 181 } 182 183 case START_ACTIVITY_INTENT_SENDER_TRANSACTION: 184 { 185 data.enforceInterface(IActivityManager.descriptor); 186 IBinder b = data.readStrongBinder(); 187 IApplicationThread app = ApplicationThreadNative.asInterface(b); 188 IntentSender intent = IntentSender.CREATOR.createFromParcel(data); 189 Intent fillInIntent = null; 190 if (data.readInt() != 0) { 191 fillInIntent = Intent.CREATOR.createFromParcel(data); 192 } 193 String resolvedType = data.readString(); 194 IBinder resultTo = data.readStrongBinder(); 195 String resultWho = data.readString(); 196 int requestCode = data.readInt(); 197 int flagsMask = data.readInt(); 198 int flagsValues = data.readInt(); 199 Bundle options = data.readInt() != 0 200 ? Bundle.CREATOR.createFromParcel(data) : null; 201 int result = startActivityIntentSender(app, intent, 202 fillInIntent, resolvedType, resultTo, resultWho, 203 requestCode, flagsMask, flagsValues, options); 204 reply.writeNoException(); 205 reply.writeInt(result); 206 return true; 207 } 208 209 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION: 210 { 211 data.enforceInterface(IActivityManager.descriptor); 212 IBinder callingActivity = data.readStrongBinder(); 213 Intent intent = Intent.CREATOR.createFromParcel(data); 214 Bundle options = data.readInt() != 0 215 ? Bundle.CREATOR.createFromParcel(data) : null; 216 boolean result = startNextMatchingActivity(callingActivity, intent, options); 217 reply.writeNoException(); 218 reply.writeInt(result ? 1 : 0); 219 return true; 220 } 221 222 case FINISH_ACTIVITY_TRANSACTION: { 223 data.enforceInterface(IActivityManager.descriptor); 224 IBinder token = data.readStrongBinder(); 225 Intent resultData = null; 226 int resultCode = data.readInt(); 227 if (data.readInt() != 0) { 228 resultData = Intent.CREATOR.createFromParcel(data); 229 } 230 boolean res = finishActivity(token, resultCode, resultData); 231 reply.writeNoException(); 232 reply.writeInt(res ? 1 : 0); 233 return true; 234 } 235 236 case FINISH_SUB_ACTIVITY_TRANSACTION: { 237 data.enforceInterface(IActivityManager.descriptor); 238 IBinder token = data.readStrongBinder(); 239 String resultWho = data.readString(); 240 int requestCode = data.readInt(); 241 finishSubActivity(token, resultWho, requestCode); 242 reply.writeNoException(); 243 return true; 244 } 245 246 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: { 247 data.enforceInterface(IActivityManager.descriptor); 248 IBinder token = data.readStrongBinder(); 249 boolean res = finishActivityAffinity(token); 250 reply.writeNoException(); 251 reply.writeInt(res ? 1 : 0); 252 return true; 253 } 254 255 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: { 256 data.enforceInterface(IActivityManager.descriptor); 257 IBinder token = data.readStrongBinder(); 258 boolean res = willActivityBeVisible(token); 259 reply.writeNoException(); 260 reply.writeInt(res ? 1 : 0); 261 return true; 262 } 263 264 case REGISTER_RECEIVER_TRANSACTION: 265 { 266 data.enforceInterface(IActivityManager.descriptor); 267 IBinder b = data.readStrongBinder(); 268 IApplicationThread app = 269 b != null ? ApplicationThreadNative.asInterface(b) : null; 270 String packageName = data.readString(); 271 b = data.readStrongBinder(); 272 IIntentReceiver rec 273 = b != null ? IIntentReceiver.Stub.asInterface(b) : null; 274 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data); 275 String perm = data.readString(); 276 Intent intent = registerReceiver(app, packageName, rec, filter, perm); 277 reply.writeNoException(); 278 if (intent != null) { 279 reply.writeInt(1); 280 intent.writeToParcel(reply, 0); 281 } else { 282 reply.writeInt(0); 283 } 284 return true; 285 } 286 287 case UNREGISTER_RECEIVER_TRANSACTION: 288 { 289 data.enforceInterface(IActivityManager.descriptor); 290 IBinder b = data.readStrongBinder(); 291 if (b == null) { 292 return true; 293 } 294 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b); 295 unregisterReceiver(rec); 296 reply.writeNoException(); 297 return true; 298 } 299 300 case BROADCAST_INTENT_TRANSACTION: 301 { 302 data.enforceInterface(IActivityManager.descriptor); 303 IBinder b = data.readStrongBinder(); 304 IApplicationThread app = 305 b != null ? ApplicationThreadNative.asInterface(b) : null; 306 Intent intent = Intent.CREATOR.createFromParcel(data); 307 String resolvedType = data.readString(); 308 b = data.readStrongBinder(); 309 IIntentReceiver resultTo = 310 b != null ? IIntentReceiver.Stub.asInterface(b) : null; 311 int resultCode = data.readInt(); 312 String resultData = data.readString(); 313 Bundle resultExtras = data.readBundle(); 314 String perm = data.readString(); 315 boolean serialized = data.readInt() != 0; 316 boolean sticky = data.readInt() != 0; 317 int userId = data.readInt(); 318 int res = broadcastIntent(app, intent, resolvedType, resultTo, 319 resultCode, resultData, resultExtras, perm, 320 serialized, sticky, userId); 321 reply.writeNoException(); 322 reply.writeInt(res); 323 return true; 324 } 325 326 case UNBROADCAST_INTENT_TRANSACTION: 327 { 328 data.enforceInterface(IActivityManager.descriptor); 329 IBinder b = data.readStrongBinder(); 330 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null; 331 Intent intent = Intent.CREATOR.createFromParcel(data); 332 int userId = data.readInt(); 333 unbroadcastIntent(app, intent, userId); 334 reply.writeNoException(); 335 return true; 336 } 337 338 case FINISH_RECEIVER_TRANSACTION: { 339 data.enforceInterface(IActivityManager.descriptor); 340 IBinder who = data.readStrongBinder(); 341 int resultCode = data.readInt(); 342 String resultData = data.readString(); 343 Bundle resultExtras = data.readBundle(); 344 boolean resultAbort = data.readInt() != 0; 345 if (who != null) { 346 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort); 347 } 348 reply.writeNoException(); 349 return true; 350 } 351 352 case ATTACH_APPLICATION_TRANSACTION: { 353 data.enforceInterface(IActivityManager.descriptor); 354 IApplicationThread app = ApplicationThreadNative.asInterface( 355 data.readStrongBinder()); 356 if (app != null) { 357 attachApplication(app); 358 } 359 reply.writeNoException(); 360 return true; 361 } 362 363 case ACTIVITY_IDLE_TRANSACTION: { 364 data.enforceInterface(IActivityManager.descriptor); 365 IBinder token = data.readStrongBinder(); 366 Configuration config = null; 367 if (data.readInt() != 0) { 368 config = Configuration.CREATOR.createFromParcel(data); 369 } 370 boolean stopProfiling = data.readInt() != 0; 371 if (token != null) { 372 activityIdle(token, config, stopProfiling); 373 } 374 reply.writeNoException(); 375 return true; 376 } 377 378 case ACTIVITY_PAUSED_TRANSACTION: { 379 data.enforceInterface(IActivityManager.descriptor); 380 IBinder token = data.readStrongBinder(); 381 activityPaused(token); 382 reply.writeNoException(); 383 return true; 384 } 385 386 case ACTIVITY_STOPPED_TRANSACTION: { 387 data.enforceInterface(IActivityManager.descriptor); 388 IBinder token = data.readStrongBinder(); 389 Bundle map = data.readBundle(); 390 Bitmap thumbnail = data.readInt() != 0 391 ? Bitmap.CREATOR.createFromParcel(data) : null; 392 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); 393 activityStopped(token, map, thumbnail, description); 394 reply.writeNoException(); 395 return true; 396 } 397 398 case ACTIVITY_SLEPT_TRANSACTION: { 399 data.enforceInterface(IActivityManager.descriptor); 400 IBinder token = data.readStrongBinder(); 401 activitySlept(token); 402 reply.writeNoException(); 403 return true; 404 } 405 406 case ACTIVITY_DESTROYED_TRANSACTION: { 407 data.enforceInterface(IActivityManager.descriptor); 408 IBinder token = data.readStrongBinder(); 409 activityDestroyed(token); 410 reply.writeNoException(); 411 return true; 412 } 413 414 case GET_CALLING_PACKAGE_TRANSACTION: { 415 data.enforceInterface(IActivityManager.descriptor); 416 IBinder token = data.readStrongBinder(); 417 String res = token != null ? getCallingPackage(token) : null; 418 reply.writeNoException(); 419 reply.writeString(res); 420 return true; 421 } 422 423 case GET_CALLING_ACTIVITY_TRANSACTION: { 424 data.enforceInterface(IActivityManager.descriptor); 425 IBinder token = data.readStrongBinder(); 426 ComponentName cn = getCallingActivity(token); 427 reply.writeNoException(); 428 ComponentName.writeToParcel(cn, reply); 429 return true; 430 } 431 432 case GET_TASKS_TRANSACTION: { 433 data.enforceInterface(IActivityManager.descriptor); 434 int maxNum = data.readInt(); 435 int fl = data.readInt(); 436 IBinder receiverBinder = data.readStrongBinder(); 437 IThumbnailReceiver receiver = receiverBinder != null 438 ? IThumbnailReceiver.Stub.asInterface(receiverBinder) 439 : null; 440 List list = getTasks(maxNum, fl, receiver); 441 reply.writeNoException(); 442 int N = list != null ? list.size() : -1; 443 reply.writeInt(N); 444 int i; 445 for (i=0; i<N; i++) { 446 ActivityManager.RunningTaskInfo info = 447 (ActivityManager.RunningTaskInfo)list.get(i); 448 info.writeToParcel(reply, 0); 449 } 450 return true; 451 } 452 453 case GET_RECENT_TASKS_TRANSACTION: { 454 data.enforceInterface(IActivityManager.descriptor); 455 int maxNum = data.readInt(); 456 int fl = data.readInt(); 457 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum, 458 fl); 459 reply.writeNoException(); 460 reply.writeTypedList(list); 461 return true; 462 } 463 464 case GET_TASK_THUMBNAILS_TRANSACTION: { 465 data.enforceInterface(IActivityManager.descriptor); 466 int id = data.readInt(); 467 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id); 468 reply.writeNoException(); 469 if (bm != null) { 470 reply.writeInt(1); 471 bm.writeToParcel(reply, 0); 472 } else { 473 reply.writeInt(0); 474 } 475 return true; 476 } 477 478 case GET_SERVICES_TRANSACTION: { 479 data.enforceInterface(IActivityManager.descriptor); 480 int maxNum = data.readInt(); 481 int fl = data.readInt(); 482 List list = getServices(maxNum, fl); 483 reply.writeNoException(); 484 int N = list != null ? list.size() : -1; 485 reply.writeInt(N); 486 int i; 487 for (i=0; i<N; i++) { 488 ActivityManager.RunningServiceInfo info = 489 (ActivityManager.RunningServiceInfo)list.get(i); 490 info.writeToParcel(reply, 0); 491 } 492 return true; 493 } 494 495 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: { 496 data.enforceInterface(IActivityManager.descriptor); 497 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState(); 498 reply.writeNoException(); 499 reply.writeTypedList(list); 500 return true; 501 } 502 503 case GET_RUNNING_APP_PROCESSES_TRANSACTION: { 504 data.enforceInterface(IActivityManager.descriptor); 505 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses(); 506 reply.writeNoException(); 507 reply.writeTypedList(list); 508 return true; 509 } 510 511 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: { 512 data.enforceInterface(IActivityManager.descriptor); 513 List<ApplicationInfo> list = getRunningExternalApplications(); 514 reply.writeNoException(); 515 reply.writeTypedList(list); 516 return true; 517 } 518 519 case MOVE_TASK_TO_FRONT_TRANSACTION: { 520 data.enforceInterface(IActivityManager.descriptor); 521 int task = data.readInt(); 522 int fl = data.readInt(); 523 Bundle options = data.readInt() != 0 524 ? Bundle.CREATOR.createFromParcel(data) : null; 525 moveTaskToFront(task, fl, options); 526 reply.writeNoException(); 527 return true; 528 } 529 530 case MOVE_TASK_TO_BACK_TRANSACTION: { 531 data.enforceInterface(IActivityManager.descriptor); 532 int task = data.readInt(); 533 moveTaskToBack(task); 534 reply.writeNoException(); 535 return true; 536 } 537 538 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: { 539 data.enforceInterface(IActivityManager.descriptor); 540 IBinder token = data.readStrongBinder(); 541 boolean nonRoot = data.readInt() != 0; 542 boolean res = moveActivityTaskToBack(token, nonRoot); 543 reply.writeNoException(); 544 reply.writeInt(res ? 1 : 0); 545 return true; 546 } 547 548 case MOVE_TASK_BACKWARDS_TRANSACTION: { 549 data.enforceInterface(IActivityManager.descriptor); 550 int task = data.readInt(); 551 moveTaskBackwards(task); 552 reply.writeNoException(); 553 return true; 554 } 555 556 case GET_TASK_FOR_ACTIVITY_TRANSACTION: { 557 data.enforceInterface(IActivityManager.descriptor); 558 IBinder token = data.readStrongBinder(); 559 boolean onlyRoot = data.readInt() != 0; 560 int res = token != null 561 ? getTaskForActivity(token, onlyRoot) : -1; 562 reply.writeNoException(); 563 reply.writeInt(res); 564 return true; 565 } 566 567 case REPORT_THUMBNAIL_TRANSACTION: { 568 data.enforceInterface(IActivityManager.descriptor); 569 IBinder token = data.readStrongBinder(); 570 Bitmap thumbnail = data.readInt() != 0 571 ? Bitmap.CREATOR.createFromParcel(data) : null; 572 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); 573 reportThumbnail(token, thumbnail, description); 574 reply.writeNoException(); 575 return true; 576 } 577 578 case GET_CONTENT_PROVIDER_TRANSACTION: { 579 data.enforceInterface(IActivityManager.descriptor); 580 IBinder b = data.readStrongBinder(); 581 IApplicationThread app = ApplicationThreadNative.asInterface(b); 582 String name = data.readString(); 583 boolean stable = data.readInt() != 0; 584 ContentProviderHolder cph = getContentProvider(app, name, stable); 585 reply.writeNoException(); 586 if (cph != null) { 587 reply.writeInt(1); 588 cph.writeToParcel(reply, 0); 589 } else { 590 reply.writeInt(0); 591 } 592 return true; 593 } 594 595 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { 596 data.enforceInterface(IActivityManager.descriptor); 597 String name = data.readString(); 598 IBinder token = data.readStrongBinder(); 599 ContentProviderHolder cph = getContentProviderExternal(name, token); 600 reply.writeNoException(); 601 if (cph != null) { 602 reply.writeInt(1); 603 cph.writeToParcel(reply, 0); 604 } else { 605 reply.writeInt(0); 606 } 607 return true; 608 } 609 610 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: { 611 data.enforceInterface(IActivityManager.descriptor); 612 IBinder b = data.readStrongBinder(); 613 IApplicationThread app = ApplicationThreadNative.asInterface(b); 614 ArrayList<ContentProviderHolder> providers = 615 data.createTypedArrayList(ContentProviderHolder.CREATOR); 616 publishContentProviders(app, providers); 617 reply.writeNoException(); 618 return true; 619 } 620 621 case REF_CONTENT_PROVIDER_TRANSACTION: { 622 data.enforceInterface(IActivityManager.descriptor); 623 IBinder b = data.readStrongBinder(); 624 int stable = data.readInt(); 625 int unstable = data.readInt(); 626 boolean res = refContentProvider(b, stable, unstable); 627 reply.writeNoException(); 628 reply.writeInt(res ? 1 : 0); 629 return true; 630 } 631 632 case UNSTABLE_PROVIDER_DIED_TRANSACTION: { 633 data.enforceInterface(IActivityManager.descriptor); 634 IBinder b = data.readStrongBinder(); 635 unstableProviderDied(b); 636 reply.writeNoException(); 637 return true; 638 } 639 640 case REMOVE_CONTENT_PROVIDER_TRANSACTION: { 641 data.enforceInterface(IActivityManager.descriptor); 642 IBinder b = data.readStrongBinder(); 643 boolean stable = data.readInt() != 0; 644 removeContentProvider(b, stable); 645 reply.writeNoException(); 646 return true; 647 } 648 649 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { 650 data.enforceInterface(IActivityManager.descriptor); 651 String name = data.readString(); 652 IBinder token = data.readStrongBinder(); 653 removeContentProviderExternal(name, token); 654 reply.writeNoException(); 655 return true; 656 } 657 658 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: { 659 data.enforceInterface(IActivityManager.descriptor); 660 ComponentName comp = ComponentName.CREATOR.createFromParcel(data); 661 PendingIntent pi = getRunningServiceControlPanel(comp); 662 reply.writeNoException(); 663 PendingIntent.writePendingIntentOrNullToParcel(pi, reply); 664 return true; 665 } 666 667 case START_SERVICE_TRANSACTION: { 668 data.enforceInterface(IActivityManager.descriptor); 669 IBinder b = data.readStrongBinder(); 670 IApplicationThread app = ApplicationThreadNative.asInterface(b); 671 Intent service = Intent.CREATOR.createFromParcel(data); 672 String resolvedType = data.readString(); 673 ComponentName cn = startService(app, service, resolvedType); 674 reply.writeNoException(); 675 ComponentName.writeToParcel(cn, reply); 676 return true; 677 } 678 679 case STOP_SERVICE_TRANSACTION: { 680 data.enforceInterface(IActivityManager.descriptor); 681 IBinder b = data.readStrongBinder(); 682 IApplicationThread app = ApplicationThreadNative.asInterface(b); 683 Intent service = Intent.CREATOR.createFromParcel(data); 684 String resolvedType = data.readString(); 685 int res = stopService(app, service, resolvedType); 686 reply.writeNoException(); 687 reply.writeInt(res); 688 return true; 689 } 690 691 case STOP_SERVICE_TOKEN_TRANSACTION: { 692 data.enforceInterface(IActivityManager.descriptor); 693 ComponentName className = ComponentName.readFromParcel(data); 694 IBinder token = data.readStrongBinder(); 695 int startId = data.readInt(); 696 boolean res = stopServiceToken(className, token, startId); 697 reply.writeNoException(); 698 reply.writeInt(res ? 1 : 0); 699 return true; 700 } 701 702 case SET_SERVICE_FOREGROUND_TRANSACTION: { 703 data.enforceInterface(IActivityManager.descriptor); 704 ComponentName className = ComponentName.readFromParcel(data); 705 IBinder token = data.readStrongBinder(); 706 int id = data.readInt(); 707 Notification notification = null; 708 if (data.readInt() != 0) { 709 notification = Notification.CREATOR.createFromParcel(data); 710 } 711 boolean removeNotification = data.readInt() != 0; 712 setServiceForeground(className, token, id, notification, removeNotification); 713 reply.writeNoException(); 714 return true; 715 } 716 717 case BIND_SERVICE_TRANSACTION: { 718 data.enforceInterface(IActivityManager.descriptor); 719 IBinder b = data.readStrongBinder(); 720 IApplicationThread app = ApplicationThreadNative.asInterface(b); 721 IBinder token = data.readStrongBinder(); 722 Intent service = Intent.CREATOR.createFromParcel(data); 723 String resolvedType = data.readString(); 724 b = data.readStrongBinder(); 725 int fl = data.readInt(); 726 int userId = data.readInt(); 727 IServiceConnection conn = IServiceConnection.Stub.asInterface(b); 728 int res = bindService(app, token, service, resolvedType, conn, fl, userId); 729 reply.writeNoException(); 730 reply.writeInt(res); 731 return true; 732 } 733 734 case UNBIND_SERVICE_TRANSACTION: { 735 data.enforceInterface(IActivityManager.descriptor); 736 IBinder b = data.readStrongBinder(); 737 IServiceConnection conn = IServiceConnection.Stub.asInterface(b); 738 boolean res = unbindService(conn); 739 reply.writeNoException(); 740 reply.writeInt(res ? 1 : 0); 741 return true; 742 } 743 744 case PUBLISH_SERVICE_TRANSACTION: { 745 data.enforceInterface(IActivityManager.descriptor); 746 IBinder token = data.readStrongBinder(); 747 Intent intent = Intent.CREATOR.createFromParcel(data); 748 IBinder service = data.readStrongBinder(); 749 publishService(token, intent, service); 750 reply.writeNoException(); 751 return true; 752 } 753 754 case UNBIND_FINISHED_TRANSACTION: { 755 data.enforceInterface(IActivityManager.descriptor); 756 IBinder token = data.readStrongBinder(); 757 Intent intent = Intent.CREATOR.createFromParcel(data); 758 boolean doRebind = data.readInt() != 0; 759 unbindFinished(token, intent, doRebind); 760 reply.writeNoException(); 761 return true; 762 } 763 764 case SERVICE_DONE_EXECUTING_TRANSACTION: { 765 data.enforceInterface(IActivityManager.descriptor); 766 IBinder token = data.readStrongBinder(); 767 int type = data.readInt(); 768 int startId = data.readInt(); 769 int res = data.readInt(); 770 serviceDoneExecuting(token, type, startId, res); 771 reply.writeNoException(); 772 return true; 773 } 774 775 case START_INSTRUMENTATION_TRANSACTION: { 776 data.enforceInterface(IActivityManager.descriptor); 777 ComponentName className = ComponentName.readFromParcel(data); 778 String profileFile = data.readString(); 779 int fl = data.readInt(); 780 Bundle arguments = data.readBundle(); 781 IBinder b = data.readStrongBinder(); 782 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b); 783 boolean res = startInstrumentation(className, profileFile, fl, arguments, w); 784 reply.writeNoException(); 785 reply.writeInt(res ? 1 : 0); 786 return true; 787 } 788 789 790 case FINISH_INSTRUMENTATION_TRANSACTION: { 791 data.enforceInterface(IActivityManager.descriptor); 792 IBinder b = data.readStrongBinder(); 793 IApplicationThread app = ApplicationThreadNative.asInterface(b); 794 int resultCode = data.readInt(); 795 Bundle results = data.readBundle(); 796 finishInstrumentation(app, resultCode, results); 797 reply.writeNoException(); 798 return true; 799 } 800 801 case GET_CONFIGURATION_TRANSACTION: { 802 data.enforceInterface(IActivityManager.descriptor); 803 Configuration config = getConfiguration(); 804 reply.writeNoException(); 805 config.writeToParcel(reply, 0); 806 return true; 807 } 808 809 case UPDATE_CONFIGURATION_TRANSACTION: { 810 data.enforceInterface(IActivityManager.descriptor); 811 Configuration config = Configuration.CREATOR.createFromParcel(data); 812 updateConfiguration(config); 813 reply.writeNoException(); 814 return true; 815 } 816 817 case SET_REQUESTED_ORIENTATION_TRANSACTION: { 818 data.enforceInterface(IActivityManager.descriptor); 819 IBinder token = data.readStrongBinder(); 820 int requestedOrientation = data.readInt(); 821 setRequestedOrientation(token, requestedOrientation); 822 reply.writeNoException(); 823 return true; 824 } 825 826 case GET_REQUESTED_ORIENTATION_TRANSACTION: { 827 data.enforceInterface(IActivityManager.descriptor); 828 IBinder token = data.readStrongBinder(); 829 int req = getRequestedOrientation(token); 830 reply.writeNoException(); 831 reply.writeInt(req); 832 return true; 833 } 834 835 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: { 836 data.enforceInterface(IActivityManager.descriptor); 837 IBinder token = data.readStrongBinder(); 838 ComponentName cn = getActivityClassForToken(token); 839 reply.writeNoException(); 840 ComponentName.writeToParcel(cn, reply); 841 return true; 842 } 843 844 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: { 845 data.enforceInterface(IActivityManager.descriptor); 846 IBinder token = data.readStrongBinder(); 847 reply.writeNoException(); 848 reply.writeString(getPackageForToken(token)); 849 return true; 850 } 851 852 case GET_INTENT_SENDER_TRANSACTION: { 853 data.enforceInterface(IActivityManager.descriptor); 854 int type = data.readInt(); 855 String packageName = data.readString(); 856 IBinder token = data.readStrongBinder(); 857 String resultWho = data.readString(); 858 int requestCode = data.readInt(); 859 Intent[] requestIntents; 860 String[] requestResolvedTypes; 861 if (data.readInt() != 0) { 862 requestIntents = data.createTypedArray(Intent.CREATOR); 863 requestResolvedTypes = data.createStringArray(); 864 } else { 865 requestIntents = null; 866 requestResolvedTypes = null; 867 } 868 int fl = data.readInt(); 869 Bundle options = data.readInt() != 0 870 ? Bundle.CREATOR.createFromParcel(data) : null; 871 IIntentSender res = getIntentSender(type, packageName, token, 872 resultWho, requestCode, requestIntents, 873 requestResolvedTypes, fl, options); 874 reply.writeNoException(); 875 reply.writeStrongBinder(res != null ? res.asBinder() : null); 876 return true; 877 } 878 879 case CANCEL_INTENT_SENDER_TRANSACTION: { 880 data.enforceInterface(IActivityManager.descriptor); 881 IIntentSender r = IIntentSender.Stub.asInterface( 882 data.readStrongBinder()); 883 cancelIntentSender(r); 884 reply.writeNoException(); 885 return true; 886 } 887 888 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: { 889 data.enforceInterface(IActivityManager.descriptor); 890 IIntentSender r = IIntentSender.Stub.asInterface( 891 data.readStrongBinder()); 892 String res = getPackageForIntentSender(r); 893 reply.writeNoException(); 894 reply.writeString(res); 895 return true; 896 } 897 898 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: { 899 data.enforceInterface(IActivityManager.descriptor); 900 IIntentSender r = IIntentSender.Stub.asInterface( 901 data.readStrongBinder()); 902 int res = getUidForIntentSender(r); 903 reply.writeNoException(); 904 reply.writeInt(res); 905 return true; 906 } 907 908 case SET_PROCESS_LIMIT_TRANSACTION: { 909 data.enforceInterface(IActivityManager.descriptor); 910 int max = data.readInt(); 911 setProcessLimit(max); 912 reply.writeNoException(); 913 return true; 914 } 915 916 case GET_PROCESS_LIMIT_TRANSACTION: { 917 data.enforceInterface(IActivityManager.descriptor); 918 int limit = getProcessLimit(); 919 reply.writeNoException(); 920 reply.writeInt(limit); 921 return true; 922 } 923 924 case SET_PROCESS_FOREGROUND_TRANSACTION: { 925 data.enforceInterface(IActivityManager.descriptor); 926 IBinder token = data.readStrongBinder(); 927 int pid = data.readInt(); 928 boolean isForeground = data.readInt() != 0; 929 setProcessForeground(token, pid, isForeground); 930 reply.writeNoException(); 931 return true; 932 } 933 934 case CHECK_PERMISSION_TRANSACTION: { 935 data.enforceInterface(IActivityManager.descriptor); 936 String perm = data.readString(); 937 int pid = data.readInt(); 938 int uid = data.readInt(); 939 int res = checkPermission(perm, pid, uid); 940 reply.writeNoException(); 941 reply.writeInt(res); 942 return true; 943 } 944 945 case CHECK_URI_PERMISSION_TRANSACTION: { 946 data.enforceInterface(IActivityManager.descriptor); 947 Uri uri = Uri.CREATOR.createFromParcel(data); 948 int pid = data.readInt(); 949 int uid = data.readInt(); 950 int mode = data.readInt(); 951 int res = checkUriPermission(uri, pid, uid, mode); 952 reply.writeNoException(); 953 reply.writeInt(res); 954 return true; 955 } 956 957 case CLEAR_APP_DATA_TRANSACTION: { 958 data.enforceInterface(IActivityManager.descriptor); 959 String packageName = data.readString(); 960 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface( 961 data.readStrongBinder()); 962 int userId = data.readInt(); 963 boolean res = clearApplicationUserData(packageName, observer, userId); 964 reply.writeNoException(); 965 reply.writeInt(res ? 1 : 0); 966 return true; 967 } 968 969 case GRANT_URI_PERMISSION_TRANSACTION: { 970 data.enforceInterface(IActivityManager.descriptor); 971 IBinder b = data.readStrongBinder(); 972 IApplicationThread app = ApplicationThreadNative.asInterface(b); 973 String targetPkg = data.readString(); 974 Uri uri = Uri.CREATOR.createFromParcel(data); 975 int mode = data.readInt(); 976 grantUriPermission(app, targetPkg, uri, mode); 977 reply.writeNoException(); 978 return true; 979 } 980 981 case REVOKE_URI_PERMISSION_TRANSACTION: { 982 data.enforceInterface(IActivityManager.descriptor); 983 IBinder b = data.readStrongBinder(); 984 IApplicationThread app = ApplicationThreadNative.asInterface(b); 985 Uri uri = Uri.CREATOR.createFromParcel(data); 986 int mode = data.readInt(); 987 revokeUriPermission(app, uri, mode); 988 reply.writeNoException(); 989 return true; 990 } 991 992 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: { 993 data.enforceInterface(IActivityManager.descriptor); 994 IBinder b = data.readStrongBinder(); 995 IApplicationThread app = ApplicationThreadNative.asInterface(b); 996 boolean waiting = data.readInt() != 0; 997 showWaitingForDebugger(app, waiting); 998 reply.writeNoException(); 999 return true; 1000 } 1001 1002 case GET_MEMORY_INFO_TRANSACTION: { 1003 data.enforceInterface(IActivityManager.descriptor); 1004 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); 1005 getMemoryInfo(mi); 1006 reply.writeNoException(); 1007 mi.writeToParcel(reply, 0); 1008 return true; 1009 } 1010 1011 case UNHANDLED_BACK_TRANSACTION: { 1012 data.enforceInterface(IActivityManager.descriptor); 1013 unhandledBack(); 1014 reply.writeNoException(); 1015 return true; 1016 } 1017 1018 case OPEN_CONTENT_URI_TRANSACTION: { 1019 data.enforceInterface(IActivityManager.descriptor); 1020 Uri uri = Uri.parse(data.readString()); 1021 ParcelFileDescriptor pfd = openContentUri(uri); 1022 reply.writeNoException(); 1023 if (pfd != null) { 1024 reply.writeInt(1); 1025 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1026 } else { 1027 reply.writeInt(0); 1028 } 1029 return true; 1030 } 1031 1032 case GOING_TO_SLEEP_TRANSACTION: { 1033 data.enforceInterface(IActivityManager.descriptor); 1034 goingToSleep(); 1035 reply.writeNoException(); 1036 return true; 1037 } 1038 1039 case WAKING_UP_TRANSACTION: { 1040 data.enforceInterface(IActivityManager.descriptor); 1041 wakingUp(); 1042 reply.writeNoException(); 1043 return true; 1044 } 1045 1046 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: { 1047 data.enforceInterface(IActivityManager.descriptor); 1048 setLockScreenShown(data.readInt() != 0); 1049 reply.writeNoException(); 1050 return true; 1051 } 1052 1053 case SET_DEBUG_APP_TRANSACTION: { 1054 data.enforceInterface(IActivityManager.descriptor); 1055 String pn = data.readString(); 1056 boolean wfd = data.readInt() != 0; 1057 boolean per = data.readInt() != 0; 1058 setDebugApp(pn, wfd, per); 1059 reply.writeNoException(); 1060 return true; 1061 } 1062 1063 case SET_ALWAYS_FINISH_TRANSACTION: { 1064 data.enforceInterface(IActivityManager.descriptor); 1065 boolean enabled = data.readInt() != 0; 1066 setAlwaysFinish(enabled); 1067 reply.writeNoException(); 1068 return true; 1069 } 1070 1071 case SET_ACTIVITY_CONTROLLER_TRANSACTION: { 1072 data.enforceInterface(IActivityManager.descriptor); 1073 IActivityController watcher = IActivityController.Stub.asInterface( 1074 data.readStrongBinder()); 1075 setActivityController(watcher); 1076 return true; 1077 } 1078 1079 case ENTER_SAFE_MODE_TRANSACTION: { 1080 data.enforceInterface(IActivityManager.descriptor); 1081 enterSafeMode(); 1082 reply.writeNoException(); 1083 return true; 1084 } 1085 1086 case NOTE_WAKEUP_ALARM_TRANSACTION: { 1087 data.enforceInterface(IActivityManager.descriptor); 1088 IIntentSender is = IIntentSender.Stub.asInterface( 1089 data.readStrongBinder()); 1090 noteWakeupAlarm(is); 1091 reply.writeNoException(); 1092 return true; 1093 } 1094 1095 case KILL_PIDS_TRANSACTION: { 1096 data.enforceInterface(IActivityManager.descriptor); 1097 int[] pids = data.createIntArray(); 1098 String reason = data.readString(); 1099 boolean secure = data.readInt() != 0; 1100 boolean res = killPids(pids, reason, secure); 1101 reply.writeNoException(); 1102 reply.writeInt(res ? 1 : 0); 1103 return true; 1104 } 1105 1106 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: { 1107 data.enforceInterface(IActivityManager.descriptor); 1108 String reason = data.readString(); 1109 boolean res = killProcessesBelowForeground(reason); 1110 reply.writeNoException(); 1111 reply.writeInt(res ? 1 : 0); 1112 return true; 1113 } 1114 1115 case START_RUNNING_TRANSACTION: { 1116 data.enforceInterface(IActivityManager.descriptor); 1117 String pkg = data.readString(); 1118 String cls = data.readString(); 1119 String action = data.readString(); 1120 String indata = data.readString(); 1121 startRunning(pkg, cls, action, indata); 1122 reply.writeNoException(); 1123 return true; 1124 } 1125 1126 case HANDLE_APPLICATION_CRASH_TRANSACTION: { 1127 data.enforceInterface(IActivityManager.descriptor); 1128 IBinder app = data.readStrongBinder(); 1129 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); 1130 handleApplicationCrash(app, ci); 1131 reply.writeNoException(); 1132 return true; 1133 } 1134 1135 case HANDLE_APPLICATION_WTF_TRANSACTION: { 1136 data.enforceInterface(IActivityManager.descriptor); 1137 IBinder app = data.readStrongBinder(); 1138 String tag = data.readString(); 1139 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); 1140 boolean res = handleApplicationWtf(app, tag, ci); 1141 reply.writeNoException(); 1142 reply.writeInt(res ? 1 : 0); 1143 return true; 1144 } 1145 1146 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: { 1147 data.enforceInterface(IActivityManager.descriptor); 1148 IBinder app = data.readStrongBinder(); 1149 int violationMask = data.readInt(); 1150 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data); 1151 handleApplicationStrictModeViolation(app, violationMask, info); 1152 reply.writeNoException(); 1153 return true; 1154 } 1155 1156 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: { 1157 data.enforceInterface(IActivityManager.descriptor); 1158 int sig = data.readInt(); 1159 signalPersistentProcesses(sig); 1160 reply.writeNoException(); 1161 return true; 1162 } 1163 1164 case KILL_BACKGROUND_PROCESSES_TRANSACTION: { 1165 data.enforceInterface(IActivityManager.descriptor); 1166 String packageName = data.readString(); 1167 killBackgroundProcesses(packageName); 1168 reply.writeNoException(); 1169 return true; 1170 } 1171 1172 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: { 1173 data.enforceInterface(IActivityManager.descriptor); 1174 killAllBackgroundProcesses(); 1175 reply.writeNoException(); 1176 return true; 1177 } 1178 1179 case FORCE_STOP_PACKAGE_TRANSACTION: { 1180 data.enforceInterface(IActivityManager.descriptor); 1181 String packageName = data.readString(); 1182 forceStopPackage(packageName); 1183 reply.writeNoException(); 1184 return true; 1185 } 1186 1187 case GET_MY_MEMORY_STATE_TRANSACTION: { 1188 data.enforceInterface(IActivityManager.descriptor); 1189 ActivityManager.RunningAppProcessInfo info = 1190 new ActivityManager.RunningAppProcessInfo(); 1191 getMyMemoryState(info); 1192 reply.writeNoException(); 1193 info.writeToParcel(reply, 0); 1194 return true; 1195 } 1196 1197 case GET_DEVICE_CONFIGURATION_TRANSACTION: { 1198 data.enforceInterface(IActivityManager.descriptor); 1199 ConfigurationInfo config = getDeviceConfigurationInfo(); 1200 reply.writeNoException(); 1201 config.writeToParcel(reply, 0); 1202 return true; 1203 } 1204 1205 case PROFILE_CONTROL_TRANSACTION: { 1206 data.enforceInterface(IActivityManager.descriptor); 1207 String process = data.readString(); 1208 boolean start = data.readInt() != 0; 1209 int profileType = data.readInt(); 1210 String path = data.readString(); 1211 ParcelFileDescriptor fd = data.readInt() != 0 1212 ? data.readFileDescriptor() : null; 1213 boolean res = profileControl(process, start, path, fd, profileType); 1214 reply.writeNoException(); 1215 reply.writeInt(res ? 1 : 0); 1216 return true; 1217 } 1218 1219 case SHUTDOWN_TRANSACTION: { 1220 data.enforceInterface(IActivityManager.descriptor); 1221 boolean res = shutdown(data.readInt()); 1222 reply.writeNoException(); 1223 reply.writeInt(res ? 1 : 0); 1224 return true; 1225 } 1226 1227 case STOP_APP_SWITCHES_TRANSACTION: { 1228 data.enforceInterface(IActivityManager.descriptor); 1229 stopAppSwitches(); 1230 reply.writeNoException(); 1231 return true; 1232 } 1233 1234 case RESUME_APP_SWITCHES_TRANSACTION: { 1235 data.enforceInterface(IActivityManager.descriptor); 1236 resumeAppSwitches(); 1237 reply.writeNoException(); 1238 return true; 1239 } 1240 1241 case PEEK_SERVICE_TRANSACTION: { 1242 data.enforceInterface(IActivityManager.descriptor); 1243 Intent service = Intent.CREATOR.createFromParcel(data); 1244 String resolvedType = data.readString(); 1245 IBinder binder = peekService(service, resolvedType); 1246 reply.writeNoException(); 1247 reply.writeStrongBinder(binder); 1248 return true; 1249 } 1250 1251 case START_BACKUP_AGENT_TRANSACTION: { 1252 data.enforceInterface(IActivityManager.descriptor); 1253 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); 1254 int backupRestoreMode = data.readInt(); 1255 boolean success = bindBackupAgent(info, backupRestoreMode); 1256 reply.writeNoException(); 1257 reply.writeInt(success ? 1 : 0); 1258 return true; 1259 } 1260 1261 case BACKUP_AGENT_CREATED_TRANSACTION: { 1262 data.enforceInterface(IActivityManager.descriptor); 1263 String packageName = data.readString(); 1264 IBinder agent = data.readStrongBinder(); 1265 backupAgentCreated(packageName, agent); 1266 reply.writeNoException(); 1267 return true; 1268 } 1269 1270 case UNBIND_BACKUP_AGENT_TRANSACTION: { 1271 data.enforceInterface(IActivityManager.descriptor); 1272 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); 1273 unbindBackupAgent(info); 1274 reply.writeNoException(); 1275 return true; 1276 } 1277 1278 case START_ACTIVITY_IN_PACKAGE_TRANSACTION: 1279 { 1280 data.enforceInterface(IActivityManager.descriptor); 1281 int uid = data.readInt(); 1282 Intent intent = Intent.CREATOR.createFromParcel(data); 1283 String resolvedType = data.readString(); 1284 IBinder resultTo = data.readStrongBinder(); 1285 String resultWho = data.readString(); 1286 int requestCode = data.readInt(); 1287 int startFlags = data.readInt(); 1288 Bundle options = data.readInt() != 0 1289 ? Bundle.CREATOR.createFromParcel(data) : null; 1290 int result = startActivityInPackage(uid, intent, resolvedType, 1291 resultTo, resultWho, requestCode, startFlags, options); 1292 reply.writeNoException(); 1293 reply.writeInt(result); 1294 return true; 1295 } 1296 1297 case KILL_APPLICATION_WITH_UID_TRANSACTION: { 1298 data.enforceInterface(IActivityManager.descriptor); 1299 String pkg = data.readString(); 1300 int uid = data.readInt(); 1301 killApplicationWithUid(pkg, uid); 1302 reply.writeNoException(); 1303 return true; 1304 } 1305 1306 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: { 1307 data.enforceInterface(IActivityManager.descriptor); 1308 String reason = data.readString(); 1309 closeSystemDialogs(reason); 1310 reply.writeNoException(); 1311 return true; 1312 } 1313 1314 case GET_PROCESS_MEMORY_INFO_TRANSACTION: { 1315 data.enforceInterface(IActivityManager.descriptor); 1316 int[] pids = data.createIntArray(); 1317 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids); 1318 reply.writeNoException(); 1319 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1320 return true; 1321 } 1322 1323 case KILL_APPLICATION_PROCESS_TRANSACTION: { 1324 data.enforceInterface(IActivityManager.descriptor); 1325 String processName = data.readString(); 1326 int uid = data.readInt(); 1327 killApplicationProcess(processName, uid); 1328 reply.writeNoException(); 1329 return true; 1330 } 1331 1332 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: { 1333 data.enforceInterface(IActivityManager.descriptor); 1334 IBinder token = data.readStrongBinder(); 1335 String packageName = data.readString(); 1336 int enterAnim = data.readInt(); 1337 int exitAnim = data.readInt(); 1338 overridePendingTransition(token, packageName, enterAnim, exitAnim); 1339 reply.writeNoException(); 1340 return true; 1341 } 1342 1343 case IS_USER_A_MONKEY_TRANSACTION: { 1344 data.enforceInterface(IActivityManager.descriptor); 1345 boolean areThey = isUserAMonkey(); 1346 reply.writeNoException(); 1347 reply.writeInt(areThey ? 1 : 0); 1348 return true; 1349 } 1350 1351 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { 1352 data.enforceInterface(IActivityManager.descriptor); 1353 finishHeavyWeightApp(); 1354 reply.writeNoException(); 1355 return true; 1356 } 1357 1358 case IS_IMMERSIVE_TRANSACTION: { 1359 data.enforceInterface(IActivityManager.descriptor); 1360 IBinder token = data.readStrongBinder(); 1361 boolean isit = isImmersive(token); 1362 reply.writeNoException(); 1363 reply.writeInt(isit ? 1 : 0); 1364 return true; 1365 } 1366 1367 case SET_IMMERSIVE_TRANSACTION: { 1368 data.enforceInterface(IActivityManager.descriptor); 1369 IBinder token = data.readStrongBinder(); 1370 boolean imm = data.readInt() == 1; 1371 setImmersive(token, imm); 1372 reply.writeNoException(); 1373 return true; 1374 } 1375 1376 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: { 1377 data.enforceInterface(IActivityManager.descriptor); 1378 boolean isit = isTopActivityImmersive(); 1379 reply.writeNoException(); 1380 reply.writeInt(isit ? 1 : 0); 1381 return true; 1382 } 1383 1384 case CRASH_APPLICATION_TRANSACTION: { 1385 data.enforceInterface(IActivityManager.descriptor); 1386 int uid = data.readInt(); 1387 int initialPid = data.readInt(); 1388 String packageName = data.readString(); 1389 String message = data.readString(); 1390 crashApplication(uid, initialPid, packageName, message); 1391 reply.writeNoException(); 1392 return true; 1393 } 1394 1395 case GET_PROVIDER_MIME_TYPE_TRANSACTION: { 1396 data.enforceInterface(IActivityManager.descriptor); 1397 Uri uri = Uri.CREATOR.createFromParcel(data); 1398 String type = getProviderMimeType(uri); 1399 reply.writeNoException(); 1400 reply.writeString(type); 1401 return true; 1402 } 1403 1404 case NEW_URI_PERMISSION_OWNER_TRANSACTION: { 1405 data.enforceInterface(IActivityManager.descriptor); 1406 String name = data.readString(); 1407 IBinder perm = newUriPermissionOwner(name); 1408 reply.writeNoException(); 1409 reply.writeStrongBinder(perm); 1410 return true; 1411 } 1412 1413 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: { 1414 data.enforceInterface(IActivityManager.descriptor); 1415 IBinder owner = data.readStrongBinder(); 1416 int fromUid = data.readInt(); 1417 String targetPkg = data.readString(); 1418 Uri uri = Uri.CREATOR.createFromParcel(data); 1419 int mode = data.readInt(); 1420 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode); 1421 reply.writeNoException(); 1422 return true; 1423 } 1424 1425 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: { 1426 data.enforceInterface(IActivityManager.descriptor); 1427 IBinder owner = data.readStrongBinder(); 1428 Uri uri = null; 1429 if (data.readInt() != 0) { 1430 Uri.CREATOR.createFromParcel(data); 1431 } 1432 int mode = data.readInt(); 1433 revokeUriPermissionFromOwner(owner, uri, mode); 1434 reply.writeNoException(); 1435 return true; 1436 } 1437 1438 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: { 1439 data.enforceInterface(IActivityManager.descriptor); 1440 int callingUid = data.readInt(); 1441 String targetPkg = data.readString(); 1442 Uri uri = Uri.CREATOR.createFromParcel(data); 1443 int modeFlags = data.readInt(); 1444 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags); 1445 reply.writeNoException(); 1446 reply.writeInt(res); 1447 return true; 1448 } 1449 1450 case DUMP_HEAP_TRANSACTION: { 1451 data.enforceInterface(IActivityManager.descriptor); 1452 String process = data.readString(); 1453 boolean managed = data.readInt() != 0; 1454 String path = data.readString(); 1455 ParcelFileDescriptor fd = data.readInt() != 0 1456 ? data.readFileDescriptor() : null; 1457 boolean res = dumpHeap(process, managed, path, fd); 1458 reply.writeNoException(); 1459 reply.writeInt(res ? 1 : 0); 1460 return true; 1461 } 1462 1463 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION: 1464 { 1465 data.enforceInterface(IActivityManager.descriptor); 1466 int uid = data.readInt(); 1467 Intent[] intents = data.createTypedArray(Intent.CREATOR); 1468 String[] resolvedTypes = data.createStringArray(); 1469 IBinder resultTo = data.readStrongBinder(); 1470 Bundle options = data.readInt() != 0 1471 ? Bundle.CREATOR.createFromParcel(data) : null; 1472 int result = startActivitiesInPackage(uid, intents, resolvedTypes, 1473 resultTo, options); 1474 reply.writeNoException(); 1475 reply.writeInt(result); 1476 return true; 1477 } 1478 1479 case START_ACTIVITIES_TRANSACTION: 1480 { 1481 data.enforceInterface(IActivityManager.descriptor); 1482 IBinder b = data.readStrongBinder(); 1483 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1484 Intent[] intents = data.createTypedArray(Intent.CREATOR); 1485 String[] resolvedTypes = data.createStringArray(); 1486 IBinder resultTo = data.readStrongBinder(); 1487 Bundle options = data.readInt() != 0 1488 ? Bundle.CREATOR.createFromParcel(data) : null; 1489 int result = startActivities(app, intents, resolvedTypes, resultTo, 1490 options); 1491 reply.writeNoException(); 1492 reply.writeInt(result); 1493 return true; 1494 } 1495 1496 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION: 1497 { 1498 data.enforceInterface(IActivityManager.descriptor); 1499 int mode = getFrontActivityScreenCompatMode(); 1500 reply.writeNoException(); 1501 reply.writeInt(mode); 1502 return true; 1503 } 1504 1505 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION: 1506 { 1507 data.enforceInterface(IActivityManager.descriptor); 1508 int mode = data.readInt(); 1509 setFrontActivityScreenCompatMode(mode); 1510 reply.writeNoException(); 1511 reply.writeInt(mode); 1512 return true; 1513 } 1514 1515 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION: 1516 { 1517 data.enforceInterface(IActivityManager.descriptor); 1518 String pkg = data.readString(); 1519 int mode = getPackageScreenCompatMode(pkg); 1520 reply.writeNoException(); 1521 reply.writeInt(mode); 1522 return true; 1523 } 1524 1525 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION: 1526 { 1527 data.enforceInterface(IActivityManager.descriptor); 1528 String pkg = data.readString(); 1529 int mode = data.readInt(); 1530 setPackageScreenCompatMode(pkg, mode); 1531 reply.writeNoException(); 1532 return true; 1533 } 1534 1535 case SWITCH_USER_TRANSACTION: { 1536 data.enforceInterface(IActivityManager.descriptor); 1537 int userid = data.readInt(); 1538 boolean result = switchUser(userid); 1539 reply.writeNoException(); 1540 reply.writeInt(result ? 1 : 0); 1541 return true; 1542 } 1543 1544 case GET_CURRENT_USER_TRANSACTION: { 1545 data.enforceInterface(IActivityManager.descriptor); 1546 UserInfo userInfo = getCurrentUser(); 1547 reply.writeNoException(); 1548 userInfo.writeToParcel(reply, 0); 1549 return true; 1550 } 1551 1552 case REMOVE_SUB_TASK_TRANSACTION: 1553 { 1554 data.enforceInterface(IActivityManager.descriptor); 1555 int taskId = data.readInt(); 1556 int subTaskIndex = data.readInt(); 1557 boolean result = removeSubTask(taskId, subTaskIndex); 1558 reply.writeNoException(); 1559 reply.writeInt(result ? 1 : 0); 1560 return true; 1561 } 1562 1563 case REMOVE_TASK_TRANSACTION: 1564 { 1565 data.enforceInterface(IActivityManager.descriptor); 1566 int taskId = data.readInt(); 1567 int fl = data.readInt(); 1568 boolean result = removeTask(taskId, fl); 1569 reply.writeNoException(); 1570 reply.writeInt(result ? 1 : 0); 1571 return true; 1572 } 1573 1574 case REGISTER_PROCESS_OBSERVER_TRANSACTION: { 1575 data.enforceInterface(IActivityManager.descriptor); 1576 IProcessObserver observer = IProcessObserver.Stub.asInterface( 1577 data.readStrongBinder()); 1578 registerProcessObserver(observer); 1579 return true; 1580 } 1581 1582 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: { 1583 data.enforceInterface(IActivityManager.descriptor); 1584 IProcessObserver observer = IProcessObserver.Stub.asInterface( 1585 data.readStrongBinder()); 1586 unregisterProcessObserver(observer); 1587 return true; 1588 } 1589 1590 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: 1591 { 1592 data.enforceInterface(IActivityManager.descriptor); 1593 String pkg = data.readString(); 1594 boolean ask = getPackageAskScreenCompat(pkg); 1595 reply.writeNoException(); 1596 reply.writeInt(ask ? 1 : 0); 1597 return true; 1598 } 1599 1600 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: 1601 { 1602 data.enforceInterface(IActivityManager.descriptor); 1603 String pkg = data.readString(); 1604 boolean ask = data.readInt() != 0; 1605 setPackageAskScreenCompat(pkg, ask); 1606 reply.writeNoException(); 1607 return true; 1608 } 1609 1610 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: { 1611 data.enforceInterface(IActivityManager.descriptor); 1612 IIntentSender r = IIntentSender.Stub.asInterface( 1613 data.readStrongBinder()); 1614 boolean res = isIntentSenderTargetedToPackage(r); 1615 reply.writeNoException(); 1616 reply.writeInt(res ? 1 : 0); 1617 return true; 1618 } 1619 1620 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: { 1621 data.enforceInterface(IActivityManager.descriptor); 1622 IIntentSender r = IIntentSender.Stub.asInterface( 1623 data.readStrongBinder()); 1624 boolean res = isIntentSenderAnActivity(r); 1625 reply.writeNoException(); 1626 reply.writeInt(res ? 1 : 0); 1627 return true; 1628 } 1629 1630 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: { 1631 data.enforceInterface(IActivityManager.descriptor); 1632 Configuration config = Configuration.CREATOR.createFromParcel(data); 1633 updatePersistentConfiguration(config); 1634 reply.writeNoException(); 1635 return true; 1636 } 1637 1638 case GET_PROCESS_PSS_TRANSACTION: { 1639 data.enforceInterface(IActivityManager.descriptor); 1640 int[] pids = data.createIntArray(); 1641 long[] pss = getProcessPss(pids); 1642 reply.writeNoException(); 1643 reply.writeLongArray(pss); 1644 return true; 1645 } 1646 1647 case SHOW_BOOT_MESSAGE_TRANSACTION: { 1648 data.enforceInterface(IActivityManager.descriptor); 1649 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); 1650 boolean always = data.readInt() != 0; 1651 showBootMessage(msg, always); 1652 reply.writeNoException(); 1653 return true; 1654 } 1655 1656 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: { 1657 data.enforceInterface(IActivityManager.descriptor); 1658 dismissKeyguardOnNextActivity(); 1659 reply.writeNoException(); 1660 return true; 1661 } 1662 1663 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: { 1664 data.enforceInterface(IActivityManager.descriptor); 1665 IBinder token = data.readStrongBinder(); 1666 String destAffinity = data.readString(); 1667 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity); 1668 reply.writeNoException(); 1669 reply.writeInt(res ? 1 : 0); 1670 return true; 1671 } 1672 1673 case NAVIGATE_UP_TO_TRANSACTION: { 1674 data.enforceInterface(IActivityManager.descriptor); 1675 IBinder token = data.readStrongBinder(); 1676 Intent target = Intent.CREATOR.createFromParcel(data); 1677 int resultCode = data.readInt(); 1678 Intent resultData = null; 1679 if (data.readInt() != 0) { 1680 resultData = Intent.CREATOR.createFromParcel(data); 1681 } 1682 boolean res = navigateUpTo(token, target, resultCode, resultData); 1683 reply.writeNoException(); 1684 reply.writeInt(res ? 1 : 0); 1685 return true; 1686 } 1687 1688 case GET_LAUNCHED_FROM_UID_TRANSACTION: { 1689 data.enforceInterface(IActivityManager.descriptor); 1690 IBinder token = data.readStrongBinder(); 1691 int res = getLaunchedFromUid(token); 1692 reply.writeNoException(); 1693 reply.writeInt(res); 1694 return true; 1695 } 1696 1697 } 1698 1699 return super.onTransact(code, data, reply, flags); 1700 } 1701 1702 public IBinder asBinder() { 1703 return this; 1704 } 1705 1706 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() { 1707 protected IActivityManager create() { 1708 IBinder b = ServiceManager.getService("activity"); 1709 if (false) { 1710 Log.v("ActivityManager", "default service binder = " + b); 1711 } 1712 IActivityManager am = asInterface(b); 1713 if (false) { 1714 Log.v("ActivityManager", "default service = " + am); 1715 } 1716 return am; 1717 } 1718 }; 1719 } 1720 1721 class ActivityManagerProxy implements IActivityManager 1722 { 1723 public ActivityManagerProxy(IBinder remote) 1724 { 1725 mRemote = remote; 1726 } 1727 1728 public IBinder asBinder() 1729 { 1730 return mRemote; 1731 } 1732 1733 public int startActivity(IApplicationThread caller, Intent intent, 1734 String resolvedType, IBinder resultTo, String resultWho, int requestCode, 1735 int startFlags, String profileFile, 1736 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException { 1737 Parcel data = Parcel.obtain(); 1738 Parcel reply = Parcel.obtain(); 1739 data.writeInterfaceToken(IActivityManager.descriptor); 1740 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 1741 intent.writeToParcel(data, 0); 1742 data.writeString(resolvedType); 1743 data.writeStrongBinder(resultTo); 1744 data.writeString(resultWho); 1745 data.writeInt(requestCode); 1746 data.writeInt(startFlags); 1747 data.writeString(profileFile); 1748 if (profileFd != null) { 1749 data.writeInt(1); 1750 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1751 } else { 1752 data.writeInt(0); 1753 } 1754 if (options != null) { 1755 data.writeInt(1); 1756 options.writeToParcel(data, 0); 1757 } else { 1758 data.writeInt(0); 1759 } 1760 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); 1761 reply.readException(); 1762 int result = reply.readInt(); 1763 reply.recycle(); 1764 data.recycle(); 1765 return result; 1766 } 1767 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent, 1768 String resolvedType, IBinder resultTo, String resultWho, 1769 int requestCode, int startFlags, String profileFile, 1770 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException { 1771 Parcel data = Parcel.obtain(); 1772 Parcel reply = Parcel.obtain(); 1773 data.writeInterfaceToken(IActivityManager.descriptor); 1774 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 1775 intent.writeToParcel(data, 0); 1776 data.writeString(resolvedType); 1777 data.writeStrongBinder(resultTo); 1778 data.writeString(resultWho); 1779 data.writeInt(requestCode); 1780 data.writeInt(startFlags); 1781 data.writeString(profileFile); 1782 if (profileFd != null) { 1783 data.writeInt(1); 1784 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1785 } else { 1786 data.writeInt(0); 1787 } 1788 if (options != null) { 1789 data.writeInt(1); 1790 options.writeToParcel(data, 0); 1791 } else { 1792 data.writeInt(0); 1793 } 1794 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0); 1795 reply.readException(); 1796 WaitResult result = WaitResult.CREATOR.createFromParcel(reply); 1797 reply.recycle(); 1798 data.recycle(); 1799 return result; 1800 } 1801 public int startActivityWithConfig(IApplicationThread caller, Intent intent, 1802 String resolvedType, IBinder resultTo, String resultWho, 1803 int requestCode, int startFlags, Configuration config, 1804 Bundle options) throws RemoteException { 1805 Parcel data = Parcel.obtain(); 1806 Parcel reply = Parcel.obtain(); 1807 data.writeInterfaceToken(IActivityManager.descriptor); 1808 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 1809 intent.writeToParcel(data, 0); 1810 data.writeString(resolvedType); 1811 data.writeStrongBinder(resultTo); 1812 data.writeString(resultWho); 1813 data.writeInt(requestCode); 1814 data.writeInt(startFlags); 1815 config.writeToParcel(data, 0); 1816 if (options != null) { 1817 data.writeInt(1); 1818 options.writeToParcel(data, 0); 1819 } else { 1820 data.writeInt(0); 1821 } 1822 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); 1823 reply.readException(); 1824 int result = reply.readInt(); 1825 reply.recycle(); 1826 data.recycle(); 1827 return result; 1828 } 1829 public int startActivityIntentSender(IApplicationThread caller, 1830 IntentSender intent, Intent fillInIntent, String resolvedType, 1831 IBinder resultTo, String resultWho, int requestCode, 1832 int flagsMask, int flagsValues, Bundle options) throws RemoteException { 1833 Parcel data = Parcel.obtain(); 1834 Parcel reply = Parcel.obtain(); 1835 data.writeInterfaceToken(IActivityManager.descriptor); 1836 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 1837 intent.writeToParcel(data, 0); 1838 if (fillInIntent != null) { 1839 data.writeInt(1); 1840 fillInIntent.writeToParcel(data, 0); 1841 } else { 1842 data.writeInt(0); 1843 } 1844 data.writeString(resolvedType); 1845 data.writeStrongBinder(resultTo); 1846 data.writeString(resultWho); 1847 data.writeInt(requestCode); 1848 data.writeInt(flagsMask); 1849 data.writeInt(flagsValues); 1850 if (options != null) { 1851 data.writeInt(1); 1852 options.writeToParcel(data, 0); 1853 } else { 1854 data.writeInt(0); 1855 } 1856 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0); 1857 reply.readException(); 1858 int result = reply.readInt(); 1859 reply.recycle(); 1860 data.recycle(); 1861 return result; 1862 } 1863 public boolean startNextMatchingActivity(IBinder callingActivity, 1864 Intent intent, Bundle options) throws RemoteException { 1865 Parcel data = Parcel.obtain(); 1866 Parcel reply = Parcel.obtain(); 1867 data.writeInterfaceToken(IActivityManager.descriptor); 1868 data.writeStrongBinder(callingActivity); 1869 intent.writeToParcel(data, 0); 1870 if (options != null) { 1871 data.writeInt(1); 1872 options.writeToParcel(data, 0); 1873 } else { 1874 data.writeInt(0); 1875 } 1876 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0); 1877 reply.readException(); 1878 int result = reply.readInt(); 1879 reply.recycle(); 1880 data.recycle(); 1881 return result != 0; 1882 } 1883 public boolean finishActivity(IBinder token, int resultCode, Intent resultData) 1884 throws RemoteException { 1885 Parcel data = Parcel.obtain(); 1886 Parcel reply = Parcel.obtain(); 1887 data.writeInterfaceToken(IActivityManager.descriptor); 1888 data.writeStrongBinder(token); 1889 data.writeInt(resultCode); 1890 if (resultData != null) { 1891 data.writeInt(1); 1892 resultData.writeToParcel(data, 0); 1893 } else { 1894 data.writeInt(0); 1895 } 1896 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0); 1897 reply.readException(); 1898 boolean res = reply.readInt() != 0; 1899 data.recycle(); 1900 reply.recycle(); 1901 return res; 1902 } 1903 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException 1904 { 1905 Parcel data = Parcel.obtain(); 1906 Parcel reply = Parcel.obtain(); 1907 data.writeInterfaceToken(IActivityManager.descriptor); 1908 data.writeStrongBinder(token); 1909 data.writeString(resultWho); 1910 data.writeInt(requestCode); 1911 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0); 1912 reply.readException(); 1913 data.recycle(); 1914 reply.recycle(); 1915 } 1916 public boolean finishActivityAffinity(IBinder token) throws RemoteException { 1917 Parcel data = Parcel.obtain(); 1918 Parcel reply = Parcel.obtain(); 1919 data.writeInterfaceToken(IActivityManager.descriptor); 1920 data.writeStrongBinder(token); 1921 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0); 1922 reply.readException(); 1923 boolean res = reply.readInt() != 0; 1924 data.recycle(); 1925 reply.recycle(); 1926 return res; 1927 } 1928 public boolean willActivityBeVisible(IBinder token) throws RemoteException { 1929 Parcel data = Parcel.obtain(); 1930 Parcel reply = Parcel.obtain(); 1931 data.writeInterfaceToken(IActivityManager.descriptor); 1932 data.writeStrongBinder(token); 1933 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0); 1934 reply.readException(); 1935 boolean res = reply.readInt() != 0; 1936 data.recycle(); 1937 reply.recycle(); 1938 return res; 1939 } 1940 public Intent registerReceiver(IApplicationThread caller, String packageName, 1941 IIntentReceiver receiver, 1942 IntentFilter filter, String perm) throws RemoteException 1943 { 1944 Parcel data = Parcel.obtain(); 1945 Parcel reply = Parcel.obtain(); 1946 data.writeInterfaceToken(IActivityManager.descriptor); 1947 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 1948 data.writeString(packageName); 1949 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); 1950 filter.writeToParcel(data, 0); 1951 data.writeString(perm); 1952 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0); 1953 reply.readException(); 1954 Intent intent = null; 1955 int haveIntent = reply.readInt(); 1956 if (haveIntent != 0) { 1957 intent = Intent.CREATOR.createFromParcel(reply); 1958 } 1959 reply.recycle(); 1960 data.recycle(); 1961 return intent; 1962 } 1963 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException 1964 { 1965 Parcel data = Parcel.obtain(); 1966 Parcel reply = Parcel.obtain(); 1967 data.writeInterfaceToken(IActivityManager.descriptor); 1968 data.writeStrongBinder(receiver.asBinder()); 1969 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0); 1970 reply.readException(); 1971 data.recycle(); 1972 reply.recycle(); 1973 } 1974 public int broadcastIntent(IApplicationThread caller, 1975 Intent intent, String resolvedType, IIntentReceiver resultTo, 1976 int resultCode, String resultData, Bundle map, 1977 String requiredPermission, boolean serialized, 1978 boolean sticky, int userId) throws RemoteException 1979 { 1980 Parcel data = Parcel.obtain(); 1981 Parcel reply = Parcel.obtain(); 1982 data.writeInterfaceToken(IActivityManager.descriptor); 1983 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 1984 intent.writeToParcel(data, 0); 1985 data.writeString(resolvedType); 1986 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null); 1987 data.writeInt(resultCode); 1988 data.writeString(resultData); 1989 data.writeBundle(map); 1990 data.writeString(requiredPermission); 1991 data.writeInt(serialized ? 1 : 0); 1992 data.writeInt(sticky ? 1 : 0); 1993 data.writeInt(userId); 1994 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0); 1995 reply.readException(); 1996 int res = reply.readInt(); 1997 reply.recycle(); 1998 data.recycle(); 1999 return res; 2000 } 2001 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId) 2002 throws RemoteException 2003 { 2004 Parcel data = Parcel.obtain(); 2005 Parcel reply = Parcel.obtain(); 2006 data.writeInterfaceToken(IActivityManager.descriptor); 2007 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2008 intent.writeToParcel(data, 0); 2009 data.writeInt(userId); 2010 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0); 2011 reply.readException(); 2012 data.recycle(); 2013 reply.recycle(); 2014 } 2015 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException 2016 { 2017 Parcel data = Parcel.obtain(); 2018 Parcel reply = Parcel.obtain(); 2019 data.writeInterfaceToken(IActivityManager.descriptor); 2020 data.writeStrongBinder(who); 2021 data.writeInt(resultCode); 2022 data.writeString(resultData); 2023 data.writeBundle(map); 2024 data.writeInt(abortBroadcast ? 1 : 0); 2025 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2026 reply.readException(); 2027 data.recycle(); 2028 reply.recycle(); 2029 } 2030 public void attachApplication(IApplicationThread app) throws RemoteException 2031 { 2032 Parcel data = Parcel.obtain(); 2033 Parcel reply = Parcel.obtain(); 2034 data.writeInterfaceToken(IActivityManager.descriptor); 2035 data.writeStrongBinder(app.asBinder()); 2036 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0); 2037 reply.readException(); 2038 data.recycle(); 2039 reply.recycle(); 2040 } 2041 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling) 2042 throws RemoteException 2043 { 2044 Parcel data = Parcel.obtain(); 2045 Parcel reply = Parcel.obtain(); 2046 data.writeInterfaceToken(IActivityManager.descriptor); 2047 data.writeStrongBinder(token); 2048 if (config != null) { 2049 data.writeInt(1); 2050 config.writeToParcel(data, 0); 2051 } else { 2052 data.writeInt(0); 2053 } 2054 data.writeInt(stopProfiling ? 1 : 0); 2055 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2056 reply.readException(); 2057 data.recycle(); 2058 reply.recycle(); 2059 } 2060 public void activityPaused(IBinder token) throws RemoteException 2061 { 2062 Parcel data = Parcel.obtain(); 2063 Parcel reply = Parcel.obtain(); 2064 data.writeInterfaceToken(IActivityManager.descriptor); 2065 data.writeStrongBinder(token); 2066 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0); 2067 reply.readException(); 2068 data.recycle(); 2069 reply.recycle(); 2070 } 2071 public void activityStopped(IBinder token, Bundle state, 2072 Bitmap thumbnail, CharSequence description) throws RemoteException 2073 { 2074 Parcel data = Parcel.obtain(); 2075 Parcel reply = Parcel.obtain(); 2076 data.writeInterfaceToken(IActivityManager.descriptor); 2077 data.writeStrongBinder(token); 2078 data.writeBundle(state); 2079 if (thumbnail != null) { 2080 data.writeInt(1); 2081 thumbnail.writeToParcel(data, 0); 2082 } else { 2083 data.writeInt(0); 2084 } 2085 TextUtils.writeToParcel(description, data, 0); 2086 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2087 reply.readException(); 2088 data.recycle(); 2089 reply.recycle(); 2090 } 2091 public void activitySlept(IBinder token) throws RemoteException 2092 { 2093 Parcel data = Parcel.obtain(); 2094 Parcel reply = Parcel.obtain(); 2095 data.writeInterfaceToken(IActivityManager.descriptor); 2096 data.writeStrongBinder(token); 2097 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2098 reply.readException(); 2099 data.recycle(); 2100 reply.recycle(); 2101 } 2102 public void activityDestroyed(IBinder token) throws RemoteException 2103 { 2104 Parcel data = Parcel.obtain(); 2105 Parcel reply = Parcel.obtain(); 2106 data.writeInterfaceToken(IActivityManager.descriptor); 2107 data.writeStrongBinder(token); 2108 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2109 reply.readException(); 2110 data.recycle(); 2111 reply.recycle(); 2112 } 2113 public String getCallingPackage(IBinder token) throws RemoteException 2114 { 2115 Parcel data = Parcel.obtain(); 2116 Parcel reply = Parcel.obtain(); 2117 data.writeInterfaceToken(IActivityManager.descriptor); 2118 data.writeStrongBinder(token); 2119 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0); 2120 reply.readException(); 2121 String res = reply.readString(); 2122 data.recycle(); 2123 reply.recycle(); 2124 return res; 2125 } 2126 public ComponentName getCallingActivity(IBinder token) 2127 throws RemoteException { 2128 Parcel data = Parcel.obtain(); 2129 Parcel reply = Parcel.obtain(); 2130 data.writeInterfaceToken(IActivityManager.descriptor); 2131 data.writeStrongBinder(token); 2132 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0); 2133 reply.readException(); 2134 ComponentName res = ComponentName.readFromParcel(reply); 2135 data.recycle(); 2136 reply.recycle(); 2137 return res; 2138 } 2139 public List getTasks(int maxNum, int flags, 2140 IThumbnailReceiver receiver) throws RemoteException { 2141 Parcel data = Parcel.obtain(); 2142 Parcel reply = Parcel.obtain(); 2143 data.writeInterfaceToken(IActivityManager.descriptor); 2144 data.writeInt(maxNum); 2145 data.writeInt(flags); 2146 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); 2147 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0); 2148 reply.readException(); 2149 ArrayList list = null; 2150 int N = reply.readInt(); 2151 if (N >= 0) { 2152 list = new ArrayList(); 2153 while (N > 0) { 2154 ActivityManager.RunningTaskInfo info = 2155 ActivityManager.RunningTaskInfo.CREATOR 2156 .createFromParcel(reply); 2157 list.add(info); 2158 N--; 2159 } 2160 } 2161 data.recycle(); 2162 reply.recycle(); 2163 return list; 2164 } 2165 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, 2166 int flags) throws RemoteException { 2167 Parcel data = Parcel.obtain(); 2168 Parcel reply = Parcel.obtain(); 2169 data.writeInterfaceToken(IActivityManager.descriptor); 2170 data.writeInt(maxNum); 2171 data.writeInt(flags); 2172 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0); 2173 reply.readException(); 2174 ArrayList<ActivityManager.RecentTaskInfo> list 2175 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR); 2176 data.recycle(); 2177 reply.recycle(); 2178 return list; 2179 } 2180 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException { 2181 Parcel data = Parcel.obtain(); 2182 Parcel reply = Parcel.obtain(); 2183 data.writeInterfaceToken(IActivityManager.descriptor); 2184 data.writeInt(id); 2185 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0); 2186 reply.readException(); 2187 ActivityManager.TaskThumbnails bm = null; 2188 if (reply.readInt() != 0) { 2189 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply); 2190 } 2191 data.recycle(); 2192 reply.recycle(); 2193 return bm; 2194 } 2195 public List getServices(int maxNum, int flags) throws RemoteException { 2196 Parcel data = Parcel.obtain(); 2197 Parcel reply = Parcel.obtain(); 2198 data.writeInterfaceToken(IActivityManager.descriptor); 2199 data.writeInt(maxNum); 2200 data.writeInt(flags); 2201 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0); 2202 reply.readException(); 2203 ArrayList list = null; 2204 int N = reply.readInt(); 2205 if (N >= 0) { 2206 list = new ArrayList(); 2207 while (N > 0) { 2208 ActivityManager.RunningServiceInfo info = 2209 ActivityManager.RunningServiceInfo.CREATOR 2210 .createFromParcel(reply); 2211 list.add(info); 2212 N--; 2213 } 2214 } 2215 data.recycle(); 2216 reply.recycle(); 2217 return list; 2218 } 2219 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() 2220 throws RemoteException { 2221 Parcel data = Parcel.obtain(); 2222 Parcel reply = Parcel.obtain(); 2223 data.writeInterfaceToken(IActivityManager.descriptor); 2224 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0); 2225 reply.readException(); 2226 ArrayList<ActivityManager.ProcessErrorStateInfo> list 2227 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR); 2228 data.recycle(); 2229 reply.recycle(); 2230 return list; 2231 } 2232 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() 2233 throws RemoteException { 2234 Parcel data = Parcel.obtain(); 2235 Parcel reply = Parcel.obtain(); 2236 data.writeInterfaceToken(IActivityManager.descriptor); 2237 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0); 2238 reply.readException(); 2239 ArrayList<ActivityManager.RunningAppProcessInfo> list 2240 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR); 2241 data.recycle(); 2242 reply.recycle(); 2243 return list; 2244 } 2245 public List<ApplicationInfo> getRunningExternalApplications() 2246 throws RemoteException { 2247 Parcel data = Parcel.obtain(); 2248 Parcel reply = Parcel.obtain(); 2249 data.writeInterfaceToken(IActivityManager.descriptor); 2250 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0); 2251 reply.readException(); 2252 ArrayList<ApplicationInfo> list 2253 = reply.createTypedArrayList(ApplicationInfo.CREATOR); 2254 data.recycle(); 2255 reply.recycle(); 2256 return list; 2257 } 2258 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException 2259 { 2260 Parcel data = Parcel.obtain(); 2261 Parcel reply = Parcel.obtain(); 2262 data.writeInterfaceToken(IActivityManager.descriptor); 2263 data.writeInt(task); 2264 data.writeInt(flags); 2265 if (options != null) { 2266 data.writeInt(1); 2267 options.writeToParcel(data, 0); 2268 } else { 2269 data.writeInt(0); 2270 } 2271 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0); 2272 reply.readException(); 2273 data.recycle(); 2274 reply.recycle(); 2275 } 2276 public void moveTaskToBack(int task) throws RemoteException 2277 { 2278 Parcel data = Parcel.obtain(); 2279 Parcel reply = Parcel.obtain(); 2280 data.writeInterfaceToken(IActivityManager.descriptor); 2281 data.writeInt(task); 2282 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0); 2283 reply.readException(); 2284 data.recycle(); 2285 reply.recycle(); 2286 } 2287 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) 2288 throws RemoteException { 2289 Parcel data = Parcel.obtain(); 2290 Parcel reply = Parcel.obtain(); 2291 data.writeInterfaceToken(IActivityManager.descriptor); 2292 data.writeStrongBinder(token); 2293 data.writeInt(nonRoot ? 1 : 0); 2294 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0); 2295 reply.readException(); 2296 boolean res = reply.readInt() != 0; 2297 data.recycle(); 2298 reply.recycle(); 2299 return res; 2300 } 2301 public void moveTaskBackwards(int task) throws RemoteException 2302 { 2303 Parcel data = Parcel.obtain(); 2304 Parcel reply = Parcel.obtain(); 2305 data.writeInterfaceToken(IActivityManager.descriptor); 2306 data.writeInt(task); 2307 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0); 2308 reply.readException(); 2309 data.recycle(); 2310 reply.recycle(); 2311 } 2312 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException 2313 { 2314 Parcel data = Parcel.obtain(); 2315 Parcel reply = Parcel.obtain(); 2316 data.writeInterfaceToken(IActivityManager.descriptor); 2317 data.writeStrongBinder(token); 2318 data.writeInt(onlyRoot ? 1 : 0); 2319 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0); 2320 reply.readException(); 2321 int res = reply.readInt(); 2322 data.recycle(); 2323 reply.recycle(); 2324 return res; 2325 } 2326 public void reportThumbnail(IBinder token, 2327 Bitmap thumbnail, CharSequence description) throws RemoteException 2328 { 2329 Parcel data = Parcel.obtain(); 2330 Parcel reply = Parcel.obtain(); 2331 data.writeInterfaceToken(IActivityManager.descriptor); 2332 data.writeStrongBinder(token); 2333 if (thumbnail != null) { 2334 data.writeInt(1); 2335 thumbnail.writeToParcel(data, 0); 2336 } else { 2337 data.writeInt(0); 2338 } 2339 TextUtils.writeToParcel(description, data, 0); 2340 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2341 reply.readException(); 2342 data.recycle(); 2343 reply.recycle(); 2344 } 2345 public ContentProviderHolder getContentProvider(IApplicationThread caller, 2346 String name, boolean stable) throws RemoteException { 2347 Parcel data = Parcel.obtain(); 2348 Parcel reply = Parcel.obtain(); 2349 data.writeInterfaceToken(IActivityManager.descriptor); 2350 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2351 data.writeString(name); 2352 data.writeInt(stable ? 1 : 0); 2353 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 2354 reply.readException(); 2355 int res = reply.readInt(); 2356 ContentProviderHolder cph = null; 2357 if (res != 0) { 2358 cph = ContentProviderHolder.CREATOR.createFromParcel(reply); 2359 } 2360 data.recycle(); 2361 reply.recycle(); 2362 return cph; 2363 } 2364 public ContentProviderHolder getContentProviderExternal(String name, IBinder token) 2365 throws RemoteException 2366 { 2367 Parcel data = Parcel.obtain(); 2368 Parcel reply = Parcel.obtain(); 2369 data.writeInterfaceToken(IActivityManager.descriptor); 2370 data.writeString(name); 2371 data.writeStrongBinder(token); 2372 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); 2373 reply.readException(); 2374 int res = reply.readInt(); 2375 ContentProviderHolder cph = null; 2376 if (res != 0) { 2377 cph = ContentProviderHolder.CREATOR.createFromParcel(reply); 2378 } 2379 data.recycle(); 2380 reply.recycle(); 2381 return cph; 2382 } 2383 public void publishContentProviders(IApplicationThread caller, 2384 List<ContentProviderHolder> providers) throws RemoteException 2385 { 2386 Parcel data = Parcel.obtain(); 2387 Parcel reply = Parcel.obtain(); 2388 data.writeInterfaceToken(IActivityManager.descriptor); 2389 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2390 data.writeTypedList(providers); 2391 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0); 2392 reply.readException(); 2393 data.recycle(); 2394 reply.recycle(); 2395 } 2396 public boolean refContentProvider(IBinder connection, int stable, int unstable) 2397 throws RemoteException { 2398 Parcel data = Parcel.obtain(); 2399 Parcel reply = Parcel.obtain(); 2400 data.writeInterfaceToken(IActivityManager.descriptor); 2401 data.writeStrongBinder(connection); 2402 data.writeInt(stable); 2403 data.writeInt(unstable); 2404 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 2405 reply.readException(); 2406 boolean res = reply.readInt() != 0; 2407 data.recycle(); 2408 reply.recycle(); 2409 return res; 2410 } 2411 public void unstableProviderDied(IBinder connection) throws RemoteException { 2412 Parcel data = Parcel.obtain(); 2413 Parcel reply = Parcel.obtain(); 2414 data.writeInterfaceToken(IActivityManager.descriptor); 2415 data.writeStrongBinder(connection); 2416 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0); 2417 reply.readException(); 2418 data.recycle(); 2419 reply.recycle(); 2420 } 2421 2422 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException { 2423 Parcel data = Parcel.obtain(); 2424 Parcel reply = Parcel.obtain(); 2425 data.writeInterfaceToken(IActivityManager.descriptor); 2426 data.writeStrongBinder(connection); 2427 data.writeInt(stable ? 1 : 0); 2428 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 2429 reply.readException(); 2430 data.recycle(); 2431 reply.recycle(); 2432 } 2433 2434 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException { 2435 Parcel data = Parcel.obtain(); 2436 Parcel reply = Parcel.obtain(); 2437 data.writeInterfaceToken(IActivityManager.descriptor); 2438 data.writeString(name); 2439 data.writeStrongBinder(token); 2440 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); 2441 reply.readException(); 2442 data.recycle(); 2443 reply.recycle(); 2444 } 2445 2446 public PendingIntent getRunningServiceControlPanel(ComponentName service) 2447 throws RemoteException 2448 { 2449 Parcel data = Parcel.obtain(); 2450 Parcel reply = Parcel.obtain(); 2451 data.writeInterfaceToken(IActivityManager.descriptor); 2452 service.writeToParcel(data, 0); 2453 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0); 2454 reply.readException(); 2455 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply); 2456 data.recycle(); 2457 reply.recycle(); 2458 return res; 2459 } 2460 2461 public ComponentName startService(IApplicationThread caller, Intent service, 2462 String resolvedType) throws RemoteException 2463 { 2464 Parcel data = Parcel.obtain(); 2465 Parcel reply = Parcel.obtain(); 2466 data.writeInterfaceToken(IActivityManager.descriptor); 2467 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2468 service.writeToParcel(data, 0); 2469 data.writeString(resolvedType); 2470 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0); 2471 reply.readException(); 2472 ComponentName res = ComponentName.readFromParcel(reply); 2473 data.recycle(); 2474 reply.recycle(); 2475 return res; 2476 } 2477 public int stopService(IApplicationThread caller, Intent service, 2478 String resolvedType) throws RemoteException 2479 { 2480 Parcel data = Parcel.obtain(); 2481 Parcel reply = Parcel.obtain(); 2482 data.writeInterfaceToken(IActivityManager.descriptor); 2483 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2484 service.writeToParcel(data, 0); 2485 data.writeString(resolvedType); 2486 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0); 2487 reply.readException(); 2488 int res = reply.readInt(); 2489 reply.recycle(); 2490 data.recycle(); 2491 return res; 2492 } 2493 public boolean stopServiceToken(ComponentName className, IBinder token, 2494 int startId) throws RemoteException { 2495 Parcel data = Parcel.obtain(); 2496 Parcel reply = Parcel.obtain(); 2497 data.writeInterfaceToken(IActivityManager.descriptor); 2498 ComponentName.writeToParcel(className, data); 2499 data.writeStrongBinder(token); 2500 data.writeInt(startId); 2501 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0); 2502 reply.readException(); 2503 boolean res = reply.readInt() != 0; 2504 data.recycle(); 2505 reply.recycle(); 2506 return res; 2507 } 2508 public void setServiceForeground(ComponentName className, IBinder token, 2509 int id, Notification notification, boolean removeNotification) throws RemoteException { 2510 Parcel data = Parcel.obtain(); 2511 Parcel reply = Parcel.obtain(); 2512 data.writeInterfaceToken(IActivityManager.descriptor); 2513 ComponentName.writeToParcel(className, data); 2514 data.writeStrongBinder(token); 2515 data.writeInt(id); 2516 if (notification != null) { 2517 data.writeInt(1); 2518 notification.writeToParcel(data, 0); 2519 } else { 2520 data.writeInt(0); 2521 } 2522 data.writeInt(removeNotification ? 1 : 0); 2523 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0); 2524 reply.readException(); 2525 data.recycle(); 2526 reply.recycle(); 2527 } 2528 public int bindService(IApplicationThread caller, IBinder token, 2529 Intent service, String resolvedType, IServiceConnection connection, 2530 int flags, int userId) throws RemoteException { 2531 Parcel data = Parcel.obtain(); 2532 Parcel reply = Parcel.obtain(); 2533 data.writeInterfaceToken(IActivityManager.descriptor); 2534 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2535 data.writeStrongBinder(token); 2536 service.writeToParcel(data, 0); 2537 data.writeString(resolvedType); 2538 data.writeStrongBinder(connection.asBinder()); 2539 data.writeInt(flags); 2540 data.writeInt(userId); 2541 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0); 2542 reply.readException(); 2543 int res = reply.readInt(); 2544 data.recycle(); 2545 reply.recycle(); 2546 return res; 2547 } 2548 public boolean unbindService(IServiceConnection connection) throws RemoteException 2549 { 2550 Parcel data = Parcel.obtain(); 2551 Parcel reply = Parcel.obtain(); 2552 data.writeInterfaceToken(IActivityManager.descriptor); 2553 data.writeStrongBinder(connection.asBinder()); 2554 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0); 2555 reply.readException(); 2556 boolean res = reply.readInt() != 0; 2557 data.recycle(); 2558 reply.recycle(); 2559 return res; 2560 } 2561 2562 public void publishService(IBinder token, 2563 Intent intent, IBinder service) throws RemoteException { 2564 Parcel data = Parcel.obtain(); 2565 Parcel reply = Parcel.obtain(); 2566 data.writeInterfaceToken(IActivityManager.descriptor); 2567 data.writeStrongBinder(token); 2568 intent.writeToParcel(data, 0); 2569 data.writeStrongBinder(service); 2570 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0); 2571 reply.readException(); 2572 data.recycle(); 2573 reply.recycle(); 2574 } 2575 2576 public void unbindFinished(IBinder token, Intent intent, boolean doRebind) 2577 throws RemoteException { 2578 Parcel data = Parcel.obtain(); 2579 Parcel reply = Parcel.obtain(); 2580 data.writeInterfaceToken(IActivityManager.descriptor); 2581 data.writeStrongBinder(token); 2582 intent.writeToParcel(data, 0); 2583 data.writeInt(doRebind ? 1 : 0); 2584 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0); 2585 reply.readException(); 2586 data.recycle(); 2587 reply.recycle(); 2588 } 2589 2590 public void serviceDoneExecuting(IBinder token, int type, int startId, 2591 int res) throws RemoteException { 2592 Parcel data = Parcel.obtain(); 2593 Parcel reply = Parcel.obtain(); 2594 data.writeInterfaceToken(IActivityManager.descriptor); 2595 data.writeStrongBinder(token); 2596 data.writeInt(type); 2597 data.writeInt(startId); 2598 data.writeInt(res); 2599 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2600 reply.readException(); 2601 data.recycle(); 2602 reply.recycle(); 2603 } 2604 2605 public IBinder peekService(Intent service, String resolvedType) throws RemoteException { 2606 Parcel data = Parcel.obtain(); 2607 Parcel reply = Parcel.obtain(); 2608 data.writeInterfaceToken(IActivityManager.descriptor); 2609 service.writeToParcel(data, 0); 2610 data.writeString(resolvedType); 2611 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0); 2612 reply.readException(); 2613 IBinder binder = reply.readStrongBinder(); 2614 reply.recycle(); 2615 data.recycle(); 2616 return binder; 2617 } 2618 2619 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode) 2620 throws RemoteException { 2621 Parcel data = Parcel.obtain(); 2622 Parcel reply = Parcel.obtain(); 2623 data.writeInterfaceToken(IActivityManager.descriptor); 2624 app.writeToParcel(data, 0); 2625 data.writeInt(backupRestoreMode); 2626 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0); 2627 reply.readException(); 2628 boolean success = reply.readInt() != 0; 2629 reply.recycle(); 2630 data.recycle(); 2631 return success; 2632 } 2633 2634 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException { 2635 Parcel data = Parcel.obtain(); 2636 Parcel reply = Parcel.obtain(); 2637 data.writeInterfaceToken(IActivityManager.descriptor); 2638 data.writeString(packageName); 2639 data.writeStrongBinder(agent); 2640 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0); 2641 reply.recycle(); 2642 data.recycle(); 2643 } 2644 2645 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException { 2646 Parcel data = Parcel.obtain(); 2647 Parcel reply = Parcel.obtain(); 2648 data.writeInterfaceToken(IActivityManager.descriptor); 2649 app.writeToParcel(data, 0); 2650 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0); 2651 reply.readException(); 2652 reply.recycle(); 2653 data.recycle(); 2654 } 2655 2656 public boolean startInstrumentation(ComponentName className, String profileFile, 2657 int flags, Bundle arguments, IInstrumentationWatcher watcher) 2658 throws RemoteException { 2659 Parcel data = Parcel.obtain(); 2660 Parcel reply = Parcel.obtain(); 2661 data.writeInterfaceToken(IActivityManager.descriptor); 2662 ComponentName.writeToParcel(className, data); 2663 data.writeString(profileFile); 2664 data.writeInt(flags); 2665 data.writeBundle(arguments); 2666 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); 2667 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0); 2668 reply.readException(); 2669 boolean res = reply.readInt() != 0; 2670 reply.recycle(); 2671 data.recycle(); 2672 return res; 2673 } 2674 2675 public void finishInstrumentation(IApplicationThread target, 2676 int resultCode, Bundle results) throws RemoteException { 2677 Parcel data = Parcel.obtain(); 2678 Parcel reply = Parcel.obtain(); 2679 data.writeInterfaceToken(IActivityManager.descriptor); 2680 data.writeStrongBinder(target != null ? target.asBinder() : null); 2681 data.writeInt(resultCode); 2682 data.writeBundle(results); 2683 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0); 2684 reply.readException(); 2685 data.recycle(); 2686 reply.recycle(); 2687 } 2688 public Configuration getConfiguration() throws RemoteException 2689 { 2690 Parcel data = Parcel.obtain(); 2691 Parcel reply = Parcel.obtain(); 2692 data.writeInterfaceToken(IActivityManager.descriptor); 2693 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0); 2694 reply.readException(); 2695 Configuration res = Configuration.CREATOR.createFromParcel(reply); 2696 reply.recycle(); 2697 data.recycle(); 2698 return res; 2699 } 2700 public void updateConfiguration(Configuration values) throws RemoteException 2701 { 2702 Parcel data = Parcel.obtain(); 2703 Parcel reply = Parcel.obtain(); 2704 data.writeInterfaceToken(IActivityManager.descriptor); 2705 values.writeToParcel(data, 0); 2706 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0); 2707 reply.readException(); 2708 data.recycle(); 2709 reply.recycle(); 2710 } 2711 public void setRequestedOrientation(IBinder token, int requestedOrientation) 2712 throws RemoteException { 2713 Parcel data = Parcel.obtain(); 2714 Parcel reply = Parcel.obtain(); 2715 data.writeInterfaceToken(IActivityManager.descriptor); 2716 data.writeStrongBinder(token); 2717 data.writeInt(requestedOrientation); 2718 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); 2719 reply.readException(); 2720 data.recycle(); 2721 reply.recycle(); 2722 } 2723 public int getRequestedOrientation(IBinder token) throws RemoteException { 2724 Parcel data = Parcel.obtain(); 2725 Parcel reply = Parcel.obtain(); 2726 data.writeInterfaceToken(IActivityManager.descriptor); 2727 data.writeStrongBinder(token); 2728 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); 2729 reply.readException(); 2730 int res = reply.readInt(); 2731 data.recycle(); 2732 reply.recycle(); 2733 return res; 2734 } 2735 public ComponentName getActivityClassForToken(IBinder token) 2736 throws RemoteException { 2737 Parcel data = Parcel.obtain(); 2738 Parcel reply = Parcel.obtain(); 2739 data.writeInterfaceToken(IActivityManager.descriptor); 2740 data.writeStrongBinder(token); 2741 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0); 2742 reply.readException(); 2743 ComponentName res = ComponentName.readFromParcel(reply); 2744 data.recycle(); 2745 reply.recycle(); 2746 return res; 2747 } 2748 public String getPackageForToken(IBinder token) throws RemoteException 2749 { 2750 Parcel data = Parcel.obtain(); 2751 Parcel reply = Parcel.obtain(); 2752 data.writeInterfaceToken(IActivityManager.descriptor); 2753 data.writeStrongBinder(token); 2754 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0); 2755 reply.readException(); 2756 String res = reply.readString(); 2757 data.recycle(); 2758 reply.recycle(); 2759 return res; 2760 } 2761 public IIntentSender getIntentSender(int type, 2762 String packageName, IBinder token, String resultWho, 2763 int requestCode, Intent[] intents, String[] resolvedTypes, int flags, 2764 Bundle options) throws RemoteException { 2765 Parcel data = Parcel.obtain(); 2766 Parcel reply = Parcel.obtain(); 2767 data.writeInterfaceToken(IActivityManager.descriptor); 2768 data.writeInt(type); 2769 data.writeString(packageName); 2770 data.writeStrongBinder(token); 2771 data.writeString(resultWho); 2772 data.writeInt(requestCode); 2773 if (intents != null) { 2774 data.writeInt(1); 2775 data.writeTypedArray(intents, 0); 2776 data.writeStringArray(resolvedTypes); 2777 } else { 2778 data.writeInt(0); 2779 } 2780 data.writeInt(flags); 2781 if (options != null) { 2782 data.writeInt(1); 2783 options.writeToParcel(data, 0); 2784 } else { 2785 data.writeInt(0); 2786 } 2787 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0); 2788 reply.readException(); 2789 IIntentSender res = IIntentSender.Stub.asInterface( 2790 reply.readStrongBinder()); 2791 data.recycle(); 2792 reply.recycle(); 2793 return res; 2794 } 2795 public void cancelIntentSender(IIntentSender sender) throws RemoteException { 2796 Parcel data = Parcel.obtain(); 2797 Parcel reply = Parcel.obtain(); 2798 data.writeInterfaceToken(IActivityManager.descriptor); 2799 data.writeStrongBinder(sender.asBinder()); 2800 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0); 2801 reply.readException(); 2802 data.recycle(); 2803 reply.recycle(); 2804 } 2805 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException { 2806 Parcel data = Parcel.obtain(); 2807 Parcel reply = Parcel.obtain(); 2808 data.writeInterfaceToken(IActivityManager.descriptor); 2809 data.writeStrongBinder(sender.asBinder()); 2810 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 2811 reply.readException(); 2812 String res = reply.readString(); 2813 data.recycle(); 2814 reply.recycle(); 2815 return res; 2816 } 2817 public int getUidForIntentSender(IIntentSender sender) throws RemoteException { 2818 Parcel data = Parcel.obtain(); 2819 Parcel reply = Parcel.obtain(); 2820 data.writeInterfaceToken(IActivityManager.descriptor); 2821 data.writeStrongBinder(sender.asBinder()); 2822 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 2823 reply.readException(); 2824 int res = reply.readInt(); 2825 data.recycle(); 2826 reply.recycle(); 2827 return res; 2828 } 2829 public void setProcessLimit(int max) throws RemoteException 2830 { 2831 Parcel data = Parcel.obtain(); 2832 Parcel reply = Parcel.obtain(); 2833 data.writeInterfaceToken(IActivityManager.descriptor); 2834 data.writeInt(max); 2835 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); 2836 reply.readException(); 2837 data.recycle(); 2838 reply.recycle(); 2839 } 2840 public int getProcessLimit() throws RemoteException 2841 { 2842 Parcel data = Parcel.obtain(); 2843 Parcel reply = Parcel.obtain(); 2844 data.writeInterfaceToken(IActivityManager.descriptor); 2845 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); 2846 reply.readException(); 2847 int res = reply.readInt(); 2848 data.recycle(); 2849 reply.recycle(); 2850 return res; 2851 } 2852 public void setProcessForeground(IBinder token, int pid, 2853 boolean isForeground) throws RemoteException { 2854 Parcel data = Parcel.obtain(); 2855 Parcel reply = Parcel.obtain(); 2856 data.writeInterfaceToken(IActivityManager.descriptor); 2857 data.writeStrongBinder(token); 2858 data.writeInt(pid); 2859 data.writeInt(isForeground ? 1 : 0); 2860 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0); 2861 reply.readException(); 2862 data.recycle(); 2863 reply.recycle(); 2864 } 2865 public int checkPermission(String permission, int pid, int uid) 2866 throws RemoteException { 2867 Parcel data = Parcel.obtain(); 2868 Parcel reply = Parcel.obtain(); 2869 data.writeInterfaceToken(IActivityManager.descriptor); 2870 data.writeString(permission); 2871 data.writeInt(pid); 2872 data.writeInt(uid); 2873 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0); 2874 reply.readException(); 2875 int res = reply.readInt(); 2876 data.recycle(); 2877 reply.recycle(); 2878 return res; 2879 } 2880 public boolean clearApplicationUserData(final String packageName, 2881 final IPackageDataObserver observer, final int userId) throws RemoteException { 2882 Parcel data = Parcel.obtain(); 2883 Parcel reply = Parcel.obtain(); 2884 data.writeInterfaceToken(IActivityManager.descriptor); 2885 data.writeString(packageName); 2886 data.writeStrongBinder(observer.asBinder()); 2887 data.writeInt(userId); 2888 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0); 2889 reply.readException(); 2890 boolean res = reply.readInt() != 0; 2891 data.recycle(); 2892 reply.recycle(); 2893 return res; 2894 } 2895 public int checkUriPermission(Uri uri, int pid, int uid, int mode) 2896 throws RemoteException { 2897 Parcel data = Parcel.obtain(); 2898 Parcel reply = Parcel.obtain(); 2899 data.writeInterfaceToken(IActivityManager.descriptor); 2900 uri.writeToParcel(data, 0); 2901 data.writeInt(pid); 2902 data.writeInt(uid); 2903 data.writeInt(mode); 2904 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0); 2905 reply.readException(); 2906 int res = reply.readInt(); 2907 data.recycle(); 2908 reply.recycle(); 2909 return res; 2910 } 2911 public void grantUriPermission(IApplicationThread caller, String targetPkg, 2912 Uri uri, int mode) throws RemoteException { 2913 Parcel data = Parcel.obtain(); 2914 Parcel reply = Parcel.obtain(); 2915 data.writeInterfaceToken(IActivityManager.descriptor); 2916 data.writeStrongBinder(caller.asBinder()); 2917 data.writeString(targetPkg); 2918 uri.writeToParcel(data, 0); 2919 data.writeInt(mode); 2920 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 2921 reply.readException(); 2922 data.recycle(); 2923 reply.recycle(); 2924 } 2925 public void revokeUriPermission(IApplicationThread caller, Uri uri, 2926 int mode) throws RemoteException { 2927 Parcel data = Parcel.obtain(); 2928 Parcel reply = Parcel.obtain(); 2929 data.writeInterfaceToken(IActivityManager.descriptor); 2930 data.writeStrongBinder(caller.asBinder()); 2931 uri.writeToParcel(data, 0); 2932 data.writeInt(mode); 2933 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); 2934 reply.readException(); 2935 data.recycle(); 2936 reply.recycle(); 2937 } 2938 public void showWaitingForDebugger(IApplicationThread who, boolean waiting) 2939 throws RemoteException { 2940 Parcel data = Parcel.obtain(); 2941 Parcel reply = Parcel.obtain(); 2942 data.writeInterfaceToken(IActivityManager.descriptor); 2943 data.writeStrongBinder(who.asBinder()); 2944 data.writeInt(waiting ? 1 : 0); 2945 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0); 2946 reply.readException(); 2947 data.recycle(); 2948 reply.recycle(); 2949 } 2950 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException { 2951 Parcel data = Parcel.obtain(); 2952 Parcel reply = Parcel.obtain(); 2953 data.writeInterfaceToken(IActivityManager.descriptor); 2954 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0); 2955 reply.readException(); 2956 outInfo.readFromParcel(reply); 2957 data.recycle(); 2958 reply.recycle(); 2959 } 2960 public void unhandledBack() throws RemoteException 2961 { 2962 Parcel data = Parcel.obtain(); 2963 Parcel reply = Parcel.obtain(); 2964 data.writeInterfaceToken(IActivityManager.descriptor); 2965 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0); 2966 reply.readException(); 2967 data.recycle(); 2968 reply.recycle(); 2969 } 2970 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException 2971 { 2972 Parcel data = Parcel.obtain(); 2973 Parcel reply = Parcel.obtain(); 2974 data.writeInterfaceToken(IActivityManager.descriptor); 2975 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0); 2976 reply.readException(); 2977 ParcelFileDescriptor pfd = null; 2978 if (reply.readInt() != 0) { 2979 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply); 2980 } 2981 data.recycle(); 2982 reply.recycle(); 2983 return pfd; 2984 } 2985 public void goingToSleep() throws RemoteException 2986 { 2987 Parcel data = Parcel.obtain(); 2988 Parcel reply = Parcel.obtain(); 2989 data.writeInterfaceToken(IActivityManager.descriptor); 2990 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0); 2991 reply.readException(); 2992 data.recycle(); 2993 reply.recycle(); 2994 } 2995 public void wakingUp() throws RemoteException 2996 { 2997 Parcel data = Parcel.obtain(); 2998 Parcel reply = Parcel.obtain(); 2999 data.writeInterfaceToken(IActivityManager.descriptor); 3000 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0); 3001 reply.readException(); 3002 data.recycle(); 3003 reply.recycle(); 3004 } 3005 public void setLockScreenShown(boolean shown) throws RemoteException 3006 { 3007 Parcel data = Parcel.obtain(); 3008 Parcel reply = Parcel.obtain(); 3009 data.writeInterfaceToken(IActivityManager.descriptor); 3010 data.writeInt(shown ? 1 : 0); 3011 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0); 3012 reply.readException(); 3013 data.recycle(); 3014 reply.recycle(); 3015 } 3016 public void setDebugApp( 3017 String packageName, boolean waitForDebugger, boolean persistent) 3018 throws RemoteException 3019 { 3020 Parcel data = Parcel.obtain(); 3021 Parcel reply = Parcel.obtain(); 3022 data.writeInterfaceToken(IActivityManager.descriptor); 3023 data.writeString(packageName); 3024 data.writeInt(waitForDebugger ? 1 : 0); 3025 data.writeInt(persistent ? 1 : 0); 3026 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0); 3027 reply.readException(); 3028 data.recycle(); 3029 reply.recycle(); 3030 } 3031 public void setAlwaysFinish(boolean enabled) throws RemoteException 3032 { 3033 Parcel data = Parcel.obtain(); 3034 Parcel reply = Parcel.obtain(); 3035 data.writeInterfaceToken(IActivityManager.descriptor); 3036 data.writeInt(enabled ? 1 : 0); 3037 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0); 3038 reply.readException(); 3039 data.recycle(); 3040 reply.recycle(); 3041 } 3042 public void setActivityController(IActivityController watcher) throws RemoteException 3043 { 3044 Parcel data = Parcel.obtain(); 3045 Parcel reply = Parcel.obtain(); 3046 data.writeInterfaceToken(IActivityManager.descriptor); 3047 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); 3048 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0); 3049 reply.readException(); 3050 data.recycle(); 3051 reply.recycle(); 3052 } 3053 public void enterSafeMode() throws RemoteException { 3054 Parcel data = Parcel.obtain(); 3055 data.writeInterfaceToken(IActivityManager.descriptor); 3056 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0); 3057 data.recycle(); 3058 } 3059 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException { 3060 Parcel data = Parcel.obtain(); 3061 data.writeStrongBinder(sender.asBinder()); 3062 data.writeInterfaceToken(IActivityManager.descriptor); 3063 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0); 3064 data.recycle(); 3065 } 3066 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException { 3067 Parcel data = Parcel.obtain(); 3068 Parcel reply = Parcel.obtain(); 3069 data.writeInterfaceToken(IActivityManager.descriptor); 3070 data.writeIntArray(pids); 3071 data.writeString(reason); 3072 data.writeInt(secure ? 1 : 0); 3073 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0); 3074 boolean res = reply.readInt() != 0; 3075 data.recycle(); 3076 reply.recycle(); 3077 return res; 3078 } 3079 @Override 3080 public boolean killProcessesBelowForeground(String reason) throws RemoteException { 3081 Parcel data = Parcel.obtain(); 3082 Parcel reply = Parcel.obtain(); 3083 data.writeInterfaceToken(IActivityManager.descriptor); 3084 data.writeString(reason); 3085 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0); 3086 boolean res = reply.readInt() != 0; 3087 data.recycle(); 3088 reply.recycle(); 3089 return res; 3090 } 3091 public void startRunning(String pkg, String cls, String action, 3092 String indata) throws RemoteException { 3093 Parcel data = Parcel.obtain(); 3094 Parcel reply = Parcel.obtain(); 3095 data.writeInterfaceToken(IActivityManager.descriptor); 3096 data.writeString(pkg); 3097 data.writeString(cls); 3098 data.writeString(action); 3099 data.writeString(indata); 3100 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0); 3101 reply.readException(); 3102 data.recycle(); 3103 reply.recycle(); 3104 } 3105 public boolean testIsSystemReady() 3106 { 3107 /* this base class version is never called */ 3108 return true; 3109 } 3110 public void handleApplicationCrash(IBinder app, 3111 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException 3112 { 3113 Parcel data = Parcel.obtain(); 3114 Parcel reply = Parcel.obtain(); 3115 data.writeInterfaceToken(IActivityManager.descriptor); 3116 data.writeStrongBinder(app); 3117 crashInfo.writeToParcel(data, 0); 3118 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0); 3119 reply.readException(); 3120 reply.recycle(); 3121 data.recycle(); 3122 } 3123 3124 public boolean handleApplicationWtf(IBinder app, String tag, 3125 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException 3126 { 3127 Parcel data = Parcel.obtain(); 3128 Parcel reply = Parcel.obtain(); 3129 data.writeInterfaceToken(IActivityManager.descriptor); 3130 data.writeStrongBinder(app); 3131 data.writeString(tag); 3132 crashInfo.writeToParcel(data, 0); 3133 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0); 3134 reply.readException(); 3135 boolean res = reply.readInt() != 0; 3136 reply.recycle(); 3137 data.recycle(); 3138 return res; 3139 } 3140 3141 public void handleApplicationStrictModeViolation(IBinder app, 3142 int violationMask, 3143 StrictMode.ViolationInfo info) throws RemoteException 3144 { 3145 Parcel data = Parcel.obtain(); 3146 Parcel reply = Parcel.obtain(); 3147 data.writeInterfaceToken(IActivityManager.descriptor); 3148 data.writeStrongBinder(app); 3149 data.writeInt(violationMask); 3150 info.writeToParcel(data, 0); 3151 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0); 3152 reply.readException(); 3153 reply.recycle(); 3154 data.recycle(); 3155 } 3156 3157 public void signalPersistentProcesses(int sig) throws RemoteException { 3158 Parcel data = Parcel.obtain(); 3159 Parcel reply = Parcel.obtain(); 3160 data.writeInterfaceToken(IActivityManager.descriptor); 3161 data.writeInt(sig); 3162 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0); 3163 reply.readException(); 3164 data.recycle(); 3165 reply.recycle(); 3166 } 3167 3168 public void killBackgroundProcesses(String packageName) throws RemoteException { 3169 Parcel data = Parcel.obtain(); 3170 Parcel reply = Parcel.obtain(); 3171 data.writeInterfaceToken(IActivityManager.descriptor); 3172 data.writeString(packageName); 3173 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); 3174 reply.readException(); 3175 data.recycle(); 3176 reply.recycle(); 3177 } 3178 3179 public void killAllBackgroundProcesses() throws RemoteException { 3180 Parcel data = Parcel.obtain(); 3181 Parcel reply = Parcel.obtain(); 3182 data.writeInterfaceToken(IActivityManager.descriptor); 3183 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); 3184 reply.readException(); 3185 data.recycle(); 3186 reply.recycle(); 3187 } 3188 3189 public void forceStopPackage(String packageName) throws RemoteException { 3190 Parcel data = Parcel.obtain(); 3191 Parcel reply = Parcel.obtain(); 3192 data.writeInterfaceToken(IActivityManager.descriptor); 3193 data.writeString(packageName); 3194 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0); 3195 reply.readException(); 3196 data.recycle(); 3197 reply.recycle(); 3198 } 3199 3200 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo) 3201 throws RemoteException 3202 { 3203 Parcel data = Parcel.obtain(); 3204 Parcel reply = Parcel.obtain(); 3205 data.writeInterfaceToken(IActivityManager.descriptor); 3206 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0); 3207 reply.readException(); 3208 outInfo.readFromParcel(reply); 3209 reply.recycle(); 3210 data.recycle(); 3211 } 3212 3213 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException 3214 { 3215 Parcel data = Parcel.obtain(); 3216 Parcel reply = Parcel.obtain(); 3217 data.writeInterfaceToken(IActivityManager.descriptor); 3218 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0); 3219 reply.readException(); 3220 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply); 3221 reply.recycle(); 3222 data.recycle(); 3223 return res; 3224 } 3225 3226 public boolean profileControl(String process, boolean start, 3227 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException 3228 { 3229 Parcel data = Parcel.obtain(); 3230 Parcel reply = Parcel.obtain(); 3231 data.writeInterfaceToken(IActivityManager.descriptor); 3232 data.writeString(process); 3233 data.writeInt(start ? 1 : 0); 3234 data.writeInt(profileType); 3235 data.writeString(path); 3236 if (fd != null) { 3237 data.writeInt(1); 3238 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 3239 } else { 3240 data.writeInt(0); 3241 } 3242 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0); 3243 reply.readException(); 3244 boolean res = reply.readInt() != 0; 3245 reply.recycle(); 3246 data.recycle(); 3247 return res; 3248 } 3249 3250 public boolean shutdown(int timeout) throws RemoteException 3251 { 3252 Parcel data = Parcel.obtain(); 3253 Parcel reply = Parcel.obtain(); 3254 data.writeInterfaceToken(IActivityManager.descriptor); 3255 data.writeInt(timeout); 3256 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0); 3257 reply.readException(); 3258 boolean res = reply.readInt() != 0; 3259 reply.recycle(); 3260 data.recycle(); 3261 return res; 3262 } 3263 3264 public void stopAppSwitches() throws RemoteException { 3265 Parcel data = Parcel.obtain(); 3266 Parcel reply = Parcel.obtain(); 3267 data.writeInterfaceToken(IActivityManager.descriptor); 3268 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0); 3269 reply.readException(); 3270 reply.recycle(); 3271 data.recycle(); 3272 } 3273 3274 public void resumeAppSwitches() throws RemoteException { 3275 Parcel data = Parcel.obtain(); 3276 Parcel reply = Parcel.obtain(); 3277 data.writeInterfaceToken(IActivityManager.descriptor); 3278 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0); 3279 reply.readException(); 3280 reply.recycle(); 3281 data.recycle(); 3282 } 3283 3284 public int startActivityInPackage(int uid, 3285 Intent intent, String resolvedType, IBinder resultTo, 3286 String resultWho, int requestCode, int startFlags, Bundle options) 3287 throws RemoteException { 3288 Parcel data = Parcel.obtain(); 3289 Parcel reply = Parcel.obtain(); 3290 data.writeInterfaceToken(IActivityManager.descriptor); 3291 data.writeInt(uid); 3292 intent.writeToParcel(data, 0); 3293 data.writeString(resolvedType); 3294 data.writeStrongBinder(resultTo); 3295 data.writeString(resultWho); 3296 data.writeInt(requestCode); 3297 data.writeInt(startFlags); 3298 if (options != null) { 3299 data.writeInt(1); 3300 options.writeToParcel(data, 0); 3301 } else { 3302 data.writeInt(0); 3303 } 3304 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0); 3305 reply.readException(); 3306 int result = reply.readInt(); 3307 reply.recycle(); 3308 data.recycle(); 3309 return result; 3310 } 3311 3312 public void killApplicationWithUid(String pkg, int uid) throws RemoteException { 3313 Parcel data = Parcel.obtain(); 3314 Parcel reply = Parcel.obtain(); 3315 data.writeInterfaceToken(IActivityManager.descriptor); 3316 data.writeString(pkg); 3317 data.writeInt(uid); 3318 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0); 3319 reply.readException(); 3320 data.recycle(); 3321 reply.recycle(); 3322 } 3323 3324 public void closeSystemDialogs(String reason) throws RemoteException { 3325 Parcel data = Parcel.obtain(); 3326 Parcel reply = Parcel.obtain(); 3327 data.writeInterfaceToken(IActivityManager.descriptor); 3328 data.writeString(reason); 3329 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0); 3330 reply.readException(); 3331 data.recycle(); 3332 reply.recycle(); 3333 } 3334 3335 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) 3336 throws RemoteException { 3337 Parcel data = Parcel.obtain(); 3338 Parcel reply = Parcel.obtain(); 3339 data.writeInterfaceToken(IActivityManager.descriptor); 3340 data.writeIntArray(pids); 3341 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0); 3342 reply.readException(); 3343 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR); 3344 data.recycle(); 3345 reply.recycle(); 3346 return res; 3347 } 3348 3349 public void killApplicationProcess(String processName, int uid) throws RemoteException { 3350 Parcel data = Parcel.obtain(); 3351 Parcel reply = Parcel.obtain(); 3352 data.writeInterfaceToken(IActivityManager.descriptor); 3353 data.writeString(processName); 3354 data.writeInt(uid); 3355 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0); 3356 reply.readException(); 3357 data.recycle(); 3358 reply.recycle(); 3359 } 3360 3361 public void overridePendingTransition(IBinder token, String packageName, 3362 int enterAnim, int exitAnim) throws RemoteException { 3363 Parcel data = Parcel.obtain(); 3364 Parcel reply = Parcel.obtain(); 3365 data.writeInterfaceToken(IActivityManager.descriptor); 3366 data.writeStrongBinder(token); 3367 data.writeString(packageName); 3368 data.writeInt(enterAnim); 3369 data.writeInt(exitAnim); 3370 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0); 3371 reply.readException(); 3372 data.recycle(); 3373 reply.recycle(); 3374 } 3375 3376 public boolean isUserAMonkey() throws RemoteException { 3377 Parcel data = Parcel.obtain(); 3378 Parcel reply = Parcel.obtain(); 3379 data.writeInterfaceToken(IActivityManager.descriptor); 3380 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0); 3381 reply.readException(); 3382 boolean res = reply.readInt() != 0; 3383 data.recycle(); 3384 reply.recycle(); 3385 return res; 3386 } 3387 3388 public void finishHeavyWeightApp() throws RemoteException { 3389 Parcel data = Parcel.obtain(); 3390 Parcel reply = Parcel.obtain(); 3391 data.writeInterfaceToken(IActivityManager.descriptor); 3392 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0); 3393 reply.readException(); 3394 data.recycle(); 3395 reply.recycle(); 3396 } 3397 3398 public void setImmersive(IBinder token, boolean immersive) 3399 throws RemoteException { 3400 Parcel data = Parcel.obtain(); 3401 Parcel reply = Parcel.obtain(); 3402 data.writeInterfaceToken(IActivityManager.descriptor); 3403 data.writeStrongBinder(token); 3404 data.writeInt(immersive ? 1 : 0); 3405 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0); 3406 reply.readException(); 3407 data.recycle(); 3408 reply.recycle(); 3409 } 3410 3411 public boolean isImmersive(IBinder token) 3412 throws RemoteException { 3413 Parcel data = Parcel.obtain(); 3414 Parcel reply = Parcel.obtain(); 3415 data.writeInterfaceToken(IActivityManager.descriptor); 3416 data.writeStrongBinder(token); 3417 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0); 3418 reply.readException(); 3419 boolean res = reply.readInt() == 1; 3420 data.recycle(); 3421 reply.recycle(); 3422 return res; 3423 } 3424 3425 public boolean isTopActivityImmersive() 3426 throws RemoteException { 3427 Parcel data = Parcel.obtain(); 3428 Parcel reply = Parcel.obtain(); 3429 data.writeInterfaceToken(IActivityManager.descriptor); 3430 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0); 3431 reply.readException(); 3432 boolean res = reply.readInt() == 1; 3433 data.recycle(); 3434 reply.recycle(); 3435 return res; 3436 } 3437 3438 public void crashApplication(int uid, int initialPid, String packageName, 3439 String message) throws RemoteException { 3440 Parcel data = Parcel.obtain(); 3441 Parcel reply = Parcel.obtain(); 3442 data.writeInterfaceToken(IActivityManager.descriptor); 3443 data.writeInt(uid); 3444 data.writeInt(initialPid); 3445 data.writeString(packageName); 3446 data.writeString(message); 3447 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0); 3448 reply.readException(); 3449 data.recycle(); 3450 reply.recycle(); 3451 } 3452 3453 public String getProviderMimeType(Uri uri) 3454 throws RemoteException { 3455 Parcel data = Parcel.obtain(); 3456 Parcel reply = Parcel.obtain(); 3457 data.writeInterfaceToken(IActivityManager.descriptor); 3458 uri.writeToParcel(data, 0); 3459 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0); 3460 reply.readException(); 3461 String res = reply.readString(); 3462 data.recycle(); 3463 reply.recycle(); 3464 return res; 3465 } 3466 3467 public IBinder newUriPermissionOwner(String name) 3468 throws RemoteException { 3469 Parcel data = Parcel.obtain(); 3470 Parcel reply = Parcel.obtain(); 3471 data.writeInterfaceToken(IActivityManager.descriptor); 3472 data.writeString(name); 3473 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0); 3474 reply.readException(); 3475 IBinder res = reply.readStrongBinder(); 3476 data.recycle(); 3477 reply.recycle(); 3478 return res; 3479 } 3480 3481 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, 3482 Uri uri, int mode) throws RemoteException { 3483 Parcel data = Parcel.obtain(); 3484 Parcel reply = Parcel.obtain(); 3485 data.writeInterfaceToken(IActivityManager.descriptor); 3486 data.writeStrongBinder(owner); 3487 data.writeInt(fromUid); 3488 data.writeString(targetPkg); 3489 uri.writeToParcel(data, 0); 3490 data.writeInt(mode); 3491 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 3492 reply.readException(); 3493 data.recycle(); 3494 reply.recycle(); 3495 } 3496 3497 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri, 3498 int mode) throws RemoteException { 3499 Parcel data = Parcel.obtain(); 3500 Parcel reply = Parcel.obtain(); 3501 data.writeInterfaceToken(IActivityManager.descriptor); 3502 data.writeStrongBinder(owner); 3503 if (uri != null) { 3504 data.writeInt(1); 3505 uri.writeToParcel(data, 0); 3506 } else { 3507 data.writeInt(0); 3508 } 3509 data.writeInt(mode); 3510 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); 3511 reply.readException(); 3512 data.recycle(); 3513 reply.recycle(); 3514 } 3515 3516 public int checkGrantUriPermission(int callingUid, String targetPkg, 3517 Uri uri, int modeFlags) throws RemoteException { 3518 Parcel data = Parcel.obtain(); 3519 Parcel reply = Parcel.obtain(); 3520 data.writeInterfaceToken(IActivityManager.descriptor); 3521 data.writeInt(callingUid); 3522 data.writeString(targetPkg); 3523 uri.writeToParcel(data, 0); 3524 data.writeInt(modeFlags); 3525 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 3526 reply.readException(); 3527 int res = reply.readInt(); 3528 data.recycle(); 3529 reply.recycle(); 3530 return res; 3531 } 3532 3533 public boolean dumpHeap(String process, boolean managed, 3534 String path, ParcelFileDescriptor fd) throws RemoteException { 3535 Parcel data = Parcel.obtain(); 3536 Parcel reply = Parcel.obtain(); 3537 data.writeInterfaceToken(IActivityManager.descriptor); 3538 data.writeString(process); 3539 data.writeInt(managed ? 1 : 0); 3540 data.writeString(path); 3541 if (fd != null) { 3542 data.writeInt(1); 3543 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 3544 } else { 3545 data.writeInt(0); 3546 } 3547 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0); 3548 reply.readException(); 3549 boolean res = reply.readInt() != 0; 3550 reply.recycle(); 3551 data.recycle(); 3552 return res; 3553 } 3554 3555 public int startActivities(IApplicationThread caller, 3556 Intent[] intents, String[] resolvedTypes, IBinder resultTo, 3557 Bundle options) throws RemoteException { 3558 Parcel data = Parcel.obtain(); 3559 Parcel reply = Parcel.obtain(); 3560 data.writeInterfaceToken(IActivityManager.descriptor); 3561 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3562 data.writeTypedArray(intents, 0); 3563 data.writeStringArray(resolvedTypes); 3564 data.writeStrongBinder(resultTo); 3565 if (options != null) { 3566 data.writeInt(1); 3567 options.writeToParcel(data, 0); 3568 } else { 3569 data.writeInt(0); 3570 } 3571 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0); 3572 reply.readException(); 3573 int result = reply.readInt(); 3574 reply.recycle(); 3575 data.recycle(); 3576 return result; 3577 } 3578 3579 public int startActivitiesInPackage(int uid, 3580 Intent[] intents, String[] resolvedTypes, IBinder resultTo, 3581 Bundle options) throws RemoteException { 3582 Parcel data = Parcel.obtain(); 3583 Parcel reply = Parcel.obtain(); 3584 data.writeInterfaceToken(IActivityManager.descriptor); 3585 data.writeInt(uid); 3586 data.writeTypedArray(intents, 0); 3587 data.writeStringArray(resolvedTypes); 3588 data.writeStrongBinder(resultTo); 3589 if (options != null) { 3590 data.writeInt(1); 3591 options.writeToParcel(data, 0); 3592 } else { 3593 data.writeInt(0); 3594 } 3595 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0); 3596 reply.readException(); 3597 int result = reply.readInt(); 3598 reply.recycle(); 3599 data.recycle(); 3600 return result; 3601 } 3602 3603 public int getFrontActivityScreenCompatMode() throws RemoteException { 3604 Parcel data = Parcel.obtain(); 3605 Parcel reply = Parcel.obtain(); 3606 data.writeInterfaceToken(IActivityManager.descriptor); 3607 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 3608 reply.readException(); 3609 int mode = reply.readInt(); 3610 reply.recycle(); 3611 data.recycle(); 3612 return mode; 3613 } 3614 3615 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException { 3616 Parcel data = Parcel.obtain(); 3617 Parcel reply = Parcel.obtain(); 3618 data.writeInterfaceToken(IActivityManager.descriptor); 3619 data.writeInt(mode); 3620 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 3621 reply.readException(); 3622 reply.recycle(); 3623 data.recycle(); 3624 } 3625 3626 public int getPackageScreenCompatMode(String packageName) throws RemoteException { 3627 Parcel data = Parcel.obtain(); 3628 Parcel reply = Parcel.obtain(); 3629 data.writeInterfaceToken(IActivityManager.descriptor); 3630 data.writeString(packageName); 3631 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 3632 reply.readException(); 3633 int mode = reply.readInt(); 3634 reply.recycle(); 3635 data.recycle(); 3636 return mode; 3637 } 3638 3639 public void setPackageScreenCompatMode(String packageName, int mode) 3640 throws RemoteException { 3641 Parcel data = Parcel.obtain(); 3642 Parcel reply = Parcel.obtain(); 3643 data.writeInterfaceToken(IActivityManager.descriptor); 3644 data.writeString(packageName); 3645 data.writeInt(mode); 3646 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 3647 reply.readException(); 3648 reply.recycle(); 3649 data.recycle(); 3650 } 3651 3652 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException { 3653 Parcel data = Parcel.obtain(); 3654 Parcel reply = Parcel.obtain(); 3655 data.writeInterfaceToken(IActivityManager.descriptor); 3656 data.writeString(packageName); 3657 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); 3658 reply.readException(); 3659 boolean ask = reply.readInt() != 0; 3660 reply.recycle(); 3661 data.recycle(); 3662 return ask; 3663 } 3664 3665 public void setPackageAskScreenCompat(String packageName, boolean ask) 3666 throws RemoteException { 3667 Parcel data = Parcel.obtain(); 3668 Parcel reply = Parcel.obtain(); 3669 data.writeInterfaceToken(IActivityManager.descriptor); 3670 data.writeString(packageName); 3671 data.writeInt(ask ? 1 : 0); 3672 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); 3673 reply.readException(); 3674 reply.recycle(); 3675 data.recycle(); 3676 } 3677 3678 public boolean switchUser(int userid) throws RemoteException { 3679 Parcel data = Parcel.obtain(); 3680 Parcel reply = Parcel.obtain(); 3681 data.writeInterfaceToken(IActivityManager.descriptor); 3682 data.writeInt(userid); 3683 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0); 3684 reply.readException(); 3685 boolean result = reply.readInt() != 0; 3686 reply.recycle(); 3687 data.recycle(); 3688 return result; 3689 } 3690 3691 public UserInfo getCurrentUser() throws RemoteException { 3692 Parcel data = Parcel.obtain(); 3693 Parcel reply = Parcel.obtain(); 3694 data.writeInterfaceToken(IActivityManager.descriptor); 3695 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0); 3696 reply.readException(); 3697 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply); 3698 reply.recycle(); 3699 data.recycle(); 3700 return userInfo; 3701 } 3702 3703 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException { 3704 Parcel data = Parcel.obtain(); 3705 Parcel reply = Parcel.obtain(); 3706 data.writeInterfaceToken(IActivityManager.descriptor); 3707 data.writeInt(taskId); 3708 data.writeInt(subTaskIndex); 3709 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0); 3710 reply.readException(); 3711 boolean result = reply.readInt() != 0; 3712 reply.recycle(); 3713 data.recycle(); 3714 return result; 3715 } 3716 3717 public boolean removeTask(int taskId, int flags) throws RemoteException { 3718 Parcel data = Parcel.obtain(); 3719 Parcel reply = Parcel.obtain(); 3720 data.writeInterfaceToken(IActivityManager.descriptor); 3721 data.writeInt(taskId); 3722 data.writeInt(flags); 3723 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0); 3724 reply.readException(); 3725 boolean result = reply.readInt() != 0; 3726 reply.recycle(); 3727 data.recycle(); 3728 return result; 3729 } 3730 3731 public void registerProcessObserver(IProcessObserver observer) throws RemoteException { 3732 Parcel data = Parcel.obtain(); 3733 Parcel reply = Parcel.obtain(); 3734 data.writeInterfaceToken(IActivityManager.descriptor); 3735 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 3736 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0); 3737 reply.readException(); 3738 data.recycle(); 3739 reply.recycle(); 3740 } 3741 3742 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException { 3743 Parcel data = Parcel.obtain(); 3744 Parcel reply = Parcel.obtain(); 3745 data.writeInterfaceToken(IActivityManager.descriptor); 3746 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 3747 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0); 3748 reply.readException(); 3749 data.recycle(); 3750 reply.recycle(); 3751 } 3752 3753 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException { 3754 Parcel data = Parcel.obtain(); 3755 Parcel reply = Parcel.obtain(); 3756 data.writeInterfaceToken(IActivityManager.descriptor); 3757 data.writeStrongBinder(sender.asBinder()); 3758 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0); 3759 reply.readException(); 3760 boolean res = reply.readInt() != 0; 3761 data.recycle(); 3762 reply.recycle(); 3763 return res; 3764 } 3765 3766 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException { 3767 Parcel data = Parcel.obtain(); 3768 Parcel reply = Parcel.obtain(); 3769 data.writeInterfaceToken(IActivityManager.descriptor); 3770 data.writeStrongBinder(sender.asBinder()); 3771 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0); 3772 reply.readException(); 3773 boolean res = reply.readInt() != 0; 3774 data.recycle(); 3775 reply.recycle(); 3776 return res; 3777 } 3778 3779 public void updatePersistentConfiguration(Configuration values) throws RemoteException 3780 { 3781 Parcel data = Parcel.obtain(); 3782 Parcel reply = Parcel.obtain(); 3783 data.writeInterfaceToken(IActivityManager.descriptor); 3784 values.writeToParcel(data, 0); 3785 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0); 3786 reply.readException(); 3787 data.recycle(); 3788 reply.recycle(); 3789 } 3790 3791 public long[] getProcessPss(int[] pids) throws RemoteException { 3792 Parcel data = Parcel.obtain(); 3793 Parcel reply = Parcel.obtain(); 3794 data.writeInterfaceToken(IActivityManager.descriptor); 3795 data.writeIntArray(pids); 3796 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0); 3797 reply.readException(); 3798 long[] res = reply.createLongArray(); 3799 data.recycle(); 3800 reply.recycle(); 3801 return res; 3802 } 3803 3804 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException { 3805 Parcel data = Parcel.obtain(); 3806 Parcel reply = Parcel.obtain(); 3807 data.writeInterfaceToken(IActivityManager.descriptor); 3808 TextUtils.writeToParcel(msg, data, 0); 3809 data.writeInt(always ? 1 : 0); 3810 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0); 3811 reply.readException(); 3812 data.recycle(); 3813 reply.recycle(); 3814 } 3815 3816 public void dismissKeyguardOnNextActivity() throws RemoteException { 3817 Parcel data = Parcel.obtain(); 3818 Parcel reply = Parcel.obtain(); 3819 data.writeInterfaceToken(IActivityManager.descriptor); 3820 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0); 3821 reply.readException(); 3822 data.recycle(); 3823 reply.recycle(); 3824 } 3825 3826 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity) 3827 throws RemoteException { 3828 Parcel data = Parcel.obtain(); 3829 Parcel reply = Parcel.obtain(); 3830 data.writeInterfaceToken(IActivityManager.descriptor); 3831 data.writeStrongBinder(token); 3832 data.writeString(destAffinity); 3833 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0); 3834 reply.readException(); 3835 boolean result = reply.readInt() != 0; 3836 data.recycle(); 3837 reply.recycle(); 3838 return result; 3839 } 3840 3841 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData) 3842 throws RemoteException { 3843 Parcel data = Parcel.obtain(); 3844 Parcel reply = Parcel.obtain(); 3845 data.writeInterfaceToken(IActivityManager.descriptor); 3846 data.writeStrongBinder(token); 3847 target.writeToParcel(data, 0); 3848 data.writeInt(resultCode); 3849 if (resultData != null) { 3850 data.writeInt(1); 3851 resultData.writeToParcel(data, 0); 3852 } else { 3853 data.writeInt(0); 3854 } 3855 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0); 3856 reply.readException(); 3857 boolean result = reply.readInt() != 0; 3858 data.recycle(); 3859 reply.recycle(); 3860 return result; 3861 } 3862 3863 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException { 3864 Parcel data = Parcel.obtain(); 3865 Parcel reply = Parcel.obtain(); 3866 data.writeInterfaceToken(IActivityManager.descriptor); 3867 data.writeStrongBinder(activityToken); 3868 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0); 3869 reply.readException(); 3870 int result = reply.readInt(); 3871 data.recycle(); 3872 reply.recycle(); 3873 return result; 3874 } 3875 3876 private IBinder mRemote; 3877 } 3878