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.app.ActivityManager.StackInfo; 20 import android.content.ComponentName; 21 import android.content.IIntentReceiver; 22 import android.content.IIntentSender; 23 import android.content.Intent; 24 import android.content.IntentFilter; 25 import android.content.IntentSender; 26 import android.content.UriPermission; 27 import android.content.pm.ApplicationInfo; 28 import android.content.pm.ConfigurationInfo; 29 import android.content.pm.IPackageDataObserver; 30 import android.content.pm.ParceledListSlice; 31 import android.content.pm.UserInfo; 32 import android.content.res.Configuration; 33 import android.graphics.Bitmap; 34 import android.graphics.Point; 35 import android.graphics.Rect; 36 import android.net.Uri; 37 import android.os.Binder; 38 import android.os.Bundle; 39 import android.os.Debug; 40 import android.os.IBinder; 41 import android.os.Parcel; 42 import android.os.ParcelFileDescriptor; 43 import android.os.Parcelable; 44 import android.os.PersistableBundle; 45 import android.os.RemoteException; 46 import android.os.ServiceManager; 47 import android.os.StrictMode; 48 import android.service.voice.IVoiceInteractionSession; 49 import android.text.TextUtils; 50 import android.util.Log; 51 import android.util.Singleton; 52 import com.android.internal.app.IVoiceInteractor; 53 54 import java.util.ArrayList; 55 import java.util.List; 56 57 /** {@hide} */ 58 public abstract class ActivityManagerNative extends Binder implements IActivityManager 59 { 60 /** 61 * Cast a Binder object into an activity manager interface, generating 62 * a proxy if needed. 63 */ 64 static public IActivityManager asInterface(IBinder obj) { 65 if (obj == null) { 66 return null; 67 } 68 IActivityManager in = 69 (IActivityManager)obj.queryLocalInterface(descriptor); 70 if (in != null) { 71 return in; 72 } 73 74 return new ActivityManagerProxy(obj); 75 } 76 77 /** 78 * Retrieve the system's default/global activity manager. 79 */ 80 static public IActivityManager getDefault() { 81 return gDefault.get(); 82 } 83 84 /** 85 * Convenience for checking whether the system is ready. For internal use only. 86 */ 87 static public boolean isSystemReady() { 88 if (!sSystemReady) { 89 sSystemReady = getDefault().testIsSystemReady(); 90 } 91 return sSystemReady; 92 } 93 static boolean sSystemReady = false; 94 95 /** 96 * Convenience for sending a sticky broadcast. For internal use only. 97 * If you don't care about permission, use null. 98 */ 99 static public void broadcastStickyIntent(Intent intent, String permission, int userId) { 100 try { 101 getDefault().broadcastIntent( 102 null, intent, null, null, Activity.RESULT_OK, null, null, 103 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId); 104 } catch (RemoteException ex) { 105 } 106 } 107 108 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) { 109 try { 110 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg); 111 } catch (RemoteException ex) { 112 } 113 } 114 115 public ActivityManagerNative() { 116 attachInterface(this, descriptor); 117 } 118 119 @Override 120 public boolean onTransact(int code, Parcel data, Parcel reply, int flags) 121 throws RemoteException { 122 switch (code) { 123 case START_ACTIVITY_TRANSACTION: 124 { 125 data.enforceInterface(IActivityManager.descriptor); 126 IBinder b = data.readStrongBinder(); 127 IApplicationThread app = ApplicationThreadNative.asInterface(b); 128 String callingPackage = data.readString(); 129 Intent intent = Intent.CREATOR.createFromParcel(data); 130 String resolvedType = data.readString(); 131 IBinder resultTo = data.readStrongBinder(); 132 String resultWho = data.readString(); 133 int requestCode = data.readInt(); 134 int startFlags = data.readInt(); 135 ProfilerInfo profilerInfo = data.readInt() != 0 136 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 137 Bundle options = data.readInt() != 0 138 ? Bundle.CREATOR.createFromParcel(data) : null; 139 int result = startActivity(app, callingPackage, intent, resolvedType, 140 resultTo, resultWho, requestCode, startFlags, profilerInfo, options); 141 reply.writeNoException(); 142 reply.writeInt(result); 143 return true; 144 } 145 146 case START_ACTIVITY_AS_USER_TRANSACTION: 147 { 148 data.enforceInterface(IActivityManager.descriptor); 149 IBinder b = data.readStrongBinder(); 150 IApplicationThread app = ApplicationThreadNative.asInterface(b); 151 String callingPackage = data.readString(); 152 Intent intent = Intent.CREATOR.createFromParcel(data); 153 String resolvedType = data.readString(); 154 IBinder resultTo = data.readStrongBinder(); 155 String resultWho = data.readString(); 156 int requestCode = data.readInt(); 157 int startFlags = data.readInt(); 158 ProfilerInfo profilerInfo = data.readInt() != 0 159 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 160 Bundle options = data.readInt() != 0 161 ? Bundle.CREATOR.createFromParcel(data) : null; 162 int userId = data.readInt(); 163 int result = startActivityAsUser(app, callingPackage, intent, resolvedType, 164 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId); 165 reply.writeNoException(); 166 reply.writeInt(result); 167 return true; 168 } 169 170 case START_ACTIVITY_AS_CALLER_TRANSACTION: 171 { 172 data.enforceInterface(IActivityManager.descriptor); 173 IBinder b = data.readStrongBinder(); 174 IApplicationThread app = ApplicationThreadNative.asInterface(b); 175 String callingPackage = data.readString(); 176 Intent intent = Intent.CREATOR.createFromParcel(data); 177 String resolvedType = data.readString(); 178 IBinder resultTo = data.readStrongBinder(); 179 String resultWho = data.readString(); 180 int requestCode = data.readInt(); 181 int startFlags = data.readInt(); 182 ProfilerInfo profilerInfo = data.readInt() != 0 183 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 184 Bundle options = data.readInt() != 0 185 ? Bundle.CREATOR.createFromParcel(data) : null; 186 int userId = data.readInt(); 187 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType, 188 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId); 189 reply.writeNoException(); 190 reply.writeInt(result); 191 return true; 192 } 193 194 case START_ACTIVITY_AND_WAIT_TRANSACTION: 195 { 196 data.enforceInterface(IActivityManager.descriptor); 197 IBinder b = data.readStrongBinder(); 198 IApplicationThread app = ApplicationThreadNative.asInterface(b); 199 String callingPackage = data.readString(); 200 Intent intent = Intent.CREATOR.createFromParcel(data); 201 String resolvedType = data.readString(); 202 IBinder resultTo = data.readStrongBinder(); 203 String resultWho = data.readString(); 204 int requestCode = data.readInt(); 205 int startFlags = data.readInt(); 206 ProfilerInfo profilerInfo = data.readInt() != 0 207 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 208 Bundle options = data.readInt() != 0 209 ? Bundle.CREATOR.createFromParcel(data) : null; 210 int userId = data.readInt(); 211 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType, 212 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId); 213 reply.writeNoException(); 214 result.writeToParcel(reply, 0); 215 return true; 216 } 217 218 case START_ACTIVITY_WITH_CONFIG_TRANSACTION: 219 { 220 data.enforceInterface(IActivityManager.descriptor); 221 IBinder b = data.readStrongBinder(); 222 IApplicationThread app = ApplicationThreadNative.asInterface(b); 223 String callingPackage = data.readString(); 224 Intent intent = Intent.CREATOR.createFromParcel(data); 225 String resolvedType = data.readString(); 226 IBinder resultTo = data.readStrongBinder(); 227 String resultWho = data.readString(); 228 int requestCode = data.readInt(); 229 int startFlags = data.readInt(); 230 Configuration config = Configuration.CREATOR.createFromParcel(data); 231 Bundle options = data.readInt() != 0 232 ? Bundle.CREATOR.createFromParcel(data) : null; 233 int userId = data.readInt(); 234 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType, 235 resultTo, resultWho, requestCode, startFlags, config, options, userId); 236 reply.writeNoException(); 237 reply.writeInt(result); 238 return true; 239 } 240 241 case START_ACTIVITY_INTENT_SENDER_TRANSACTION: 242 { 243 data.enforceInterface(IActivityManager.descriptor); 244 IBinder b = data.readStrongBinder(); 245 IApplicationThread app = ApplicationThreadNative.asInterface(b); 246 IntentSender intent = IntentSender.CREATOR.createFromParcel(data); 247 Intent fillInIntent = null; 248 if (data.readInt() != 0) { 249 fillInIntent = Intent.CREATOR.createFromParcel(data); 250 } 251 String resolvedType = data.readString(); 252 IBinder resultTo = data.readStrongBinder(); 253 String resultWho = data.readString(); 254 int requestCode = data.readInt(); 255 int flagsMask = data.readInt(); 256 int flagsValues = data.readInt(); 257 Bundle options = data.readInt() != 0 258 ? Bundle.CREATOR.createFromParcel(data) : null; 259 int result = startActivityIntentSender(app, intent, 260 fillInIntent, resolvedType, resultTo, resultWho, 261 requestCode, flagsMask, flagsValues, options); 262 reply.writeNoException(); 263 reply.writeInt(result); 264 return true; 265 } 266 267 case START_VOICE_ACTIVITY_TRANSACTION: 268 { 269 data.enforceInterface(IActivityManager.descriptor); 270 String callingPackage = data.readString(); 271 int callingPid = data.readInt(); 272 int callingUid = data.readInt(); 273 Intent intent = Intent.CREATOR.createFromParcel(data); 274 String resolvedType = data.readString(); 275 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface( 276 data.readStrongBinder()); 277 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface( 278 data.readStrongBinder()); 279 int startFlags = data.readInt(); 280 ProfilerInfo profilerInfo = data.readInt() != 0 281 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 282 Bundle options = data.readInt() != 0 283 ? Bundle.CREATOR.createFromParcel(data) : null; 284 int userId = data.readInt(); 285 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent, 286 resolvedType, session, interactor, startFlags, profilerInfo, options, userId); 287 reply.writeNoException(); 288 reply.writeInt(result); 289 return true; 290 } 291 292 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION: 293 { 294 data.enforceInterface(IActivityManager.descriptor); 295 IBinder callingActivity = data.readStrongBinder(); 296 Intent intent = Intent.CREATOR.createFromParcel(data); 297 Bundle options = data.readInt() != 0 298 ? Bundle.CREATOR.createFromParcel(data) : null; 299 boolean result = startNextMatchingActivity(callingActivity, intent, options); 300 reply.writeNoException(); 301 reply.writeInt(result ? 1 : 0); 302 return true; 303 } 304 305 case START_ACTIVITY_FROM_RECENTS_TRANSACTION: 306 { 307 data.enforceInterface(IActivityManager.descriptor); 308 int taskId = data.readInt(); 309 Bundle options = data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data); 310 int result = startActivityFromRecents(taskId, options); 311 reply.writeNoException(); 312 reply.writeInt(result); 313 return true; 314 } 315 316 case FINISH_ACTIVITY_TRANSACTION: { 317 data.enforceInterface(IActivityManager.descriptor); 318 IBinder token = data.readStrongBinder(); 319 Intent resultData = null; 320 int resultCode = data.readInt(); 321 if (data.readInt() != 0) { 322 resultData = Intent.CREATOR.createFromParcel(data); 323 } 324 boolean finishTask = (data.readInt() != 0); 325 boolean res = finishActivity(token, resultCode, resultData, finishTask); 326 reply.writeNoException(); 327 reply.writeInt(res ? 1 : 0); 328 return true; 329 } 330 331 case FINISH_SUB_ACTIVITY_TRANSACTION: { 332 data.enforceInterface(IActivityManager.descriptor); 333 IBinder token = data.readStrongBinder(); 334 String resultWho = data.readString(); 335 int requestCode = data.readInt(); 336 finishSubActivity(token, resultWho, requestCode); 337 reply.writeNoException(); 338 return true; 339 } 340 341 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: { 342 data.enforceInterface(IActivityManager.descriptor); 343 IBinder token = data.readStrongBinder(); 344 boolean res = finishActivityAffinity(token); 345 reply.writeNoException(); 346 reply.writeInt(res ? 1 : 0); 347 return true; 348 } 349 350 case FINISH_VOICE_TASK_TRANSACTION: { 351 data.enforceInterface(IActivityManager.descriptor); 352 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface( 353 data.readStrongBinder()); 354 finishVoiceTask(session); 355 reply.writeNoException(); 356 return true; 357 } 358 359 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: { 360 data.enforceInterface(IActivityManager.descriptor); 361 IBinder token = data.readStrongBinder(); 362 boolean res = releaseActivityInstance(token); 363 reply.writeNoException(); 364 reply.writeInt(res ? 1 : 0); 365 return true; 366 } 367 368 case RELEASE_SOME_ACTIVITIES_TRANSACTION: { 369 data.enforceInterface(IActivityManager.descriptor); 370 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder()); 371 releaseSomeActivities(app); 372 reply.writeNoException(); 373 return true; 374 } 375 376 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: { 377 data.enforceInterface(IActivityManager.descriptor); 378 IBinder token = data.readStrongBinder(); 379 boolean res = willActivityBeVisible(token); 380 reply.writeNoException(); 381 reply.writeInt(res ? 1 : 0); 382 return true; 383 } 384 385 case REGISTER_RECEIVER_TRANSACTION: 386 { 387 data.enforceInterface(IActivityManager.descriptor); 388 IBinder b = data.readStrongBinder(); 389 IApplicationThread app = 390 b != null ? ApplicationThreadNative.asInterface(b) : null; 391 String packageName = data.readString(); 392 b = data.readStrongBinder(); 393 IIntentReceiver rec 394 = b != null ? IIntentReceiver.Stub.asInterface(b) : null; 395 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data); 396 String perm = data.readString(); 397 int userId = data.readInt(); 398 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId); 399 reply.writeNoException(); 400 if (intent != null) { 401 reply.writeInt(1); 402 intent.writeToParcel(reply, 0); 403 } else { 404 reply.writeInt(0); 405 } 406 return true; 407 } 408 409 case UNREGISTER_RECEIVER_TRANSACTION: 410 { 411 data.enforceInterface(IActivityManager.descriptor); 412 IBinder b = data.readStrongBinder(); 413 if (b == null) { 414 return true; 415 } 416 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b); 417 unregisterReceiver(rec); 418 reply.writeNoException(); 419 return true; 420 } 421 422 case BROADCAST_INTENT_TRANSACTION: 423 { 424 data.enforceInterface(IActivityManager.descriptor); 425 IBinder b = data.readStrongBinder(); 426 IApplicationThread app = 427 b != null ? ApplicationThreadNative.asInterface(b) : null; 428 Intent intent = Intent.CREATOR.createFromParcel(data); 429 String resolvedType = data.readString(); 430 b = data.readStrongBinder(); 431 IIntentReceiver resultTo = 432 b != null ? IIntentReceiver.Stub.asInterface(b) : null; 433 int resultCode = data.readInt(); 434 String resultData = data.readString(); 435 Bundle resultExtras = data.readBundle(); 436 String perm = data.readString(); 437 int appOp = data.readInt(); 438 boolean serialized = data.readInt() != 0; 439 boolean sticky = data.readInt() != 0; 440 int userId = data.readInt(); 441 int res = broadcastIntent(app, intent, resolvedType, resultTo, 442 resultCode, resultData, resultExtras, perm, appOp, 443 serialized, sticky, userId); 444 reply.writeNoException(); 445 reply.writeInt(res); 446 return true; 447 } 448 449 case UNBROADCAST_INTENT_TRANSACTION: 450 { 451 data.enforceInterface(IActivityManager.descriptor); 452 IBinder b = data.readStrongBinder(); 453 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null; 454 Intent intent = Intent.CREATOR.createFromParcel(data); 455 int userId = data.readInt(); 456 unbroadcastIntent(app, intent, userId); 457 reply.writeNoException(); 458 return true; 459 } 460 461 case FINISH_RECEIVER_TRANSACTION: { 462 data.enforceInterface(IActivityManager.descriptor); 463 IBinder who = data.readStrongBinder(); 464 int resultCode = data.readInt(); 465 String resultData = data.readString(); 466 Bundle resultExtras = data.readBundle(); 467 boolean resultAbort = data.readInt() != 0; 468 if (who != null) { 469 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort); 470 } 471 reply.writeNoException(); 472 return true; 473 } 474 475 case ATTACH_APPLICATION_TRANSACTION: { 476 data.enforceInterface(IActivityManager.descriptor); 477 IApplicationThread app = ApplicationThreadNative.asInterface( 478 data.readStrongBinder()); 479 if (app != null) { 480 attachApplication(app); 481 } 482 reply.writeNoException(); 483 return true; 484 } 485 486 case ACTIVITY_IDLE_TRANSACTION: { 487 data.enforceInterface(IActivityManager.descriptor); 488 IBinder token = data.readStrongBinder(); 489 Configuration config = null; 490 if (data.readInt() != 0) { 491 config = Configuration.CREATOR.createFromParcel(data); 492 } 493 boolean stopProfiling = data.readInt() != 0; 494 if (token != null) { 495 activityIdle(token, config, stopProfiling); 496 } 497 reply.writeNoException(); 498 return true; 499 } 500 501 case ACTIVITY_RESUMED_TRANSACTION: { 502 data.enforceInterface(IActivityManager.descriptor); 503 IBinder token = data.readStrongBinder(); 504 activityResumed(token); 505 reply.writeNoException(); 506 return true; 507 } 508 509 case ACTIVITY_PAUSED_TRANSACTION: { 510 data.enforceInterface(IActivityManager.descriptor); 511 IBinder token = data.readStrongBinder(); 512 activityPaused(token); 513 reply.writeNoException(); 514 return true; 515 } 516 517 case ACTIVITY_STOPPED_TRANSACTION: { 518 data.enforceInterface(IActivityManager.descriptor); 519 IBinder token = data.readStrongBinder(); 520 Bundle map = data.readBundle(); 521 PersistableBundle persistentState = data.readPersistableBundle(); 522 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); 523 activityStopped(token, map, persistentState, description); 524 reply.writeNoException(); 525 return true; 526 } 527 528 case ACTIVITY_SLEPT_TRANSACTION: { 529 data.enforceInterface(IActivityManager.descriptor); 530 IBinder token = data.readStrongBinder(); 531 activitySlept(token); 532 reply.writeNoException(); 533 return true; 534 } 535 536 case ACTIVITY_DESTROYED_TRANSACTION: { 537 data.enforceInterface(IActivityManager.descriptor); 538 IBinder token = data.readStrongBinder(); 539 activityDestroyed(token); 540 reply.writeNoException(); 541 return true; 542 } 543 544 case GET_CALLING_PACKAGE_TRANSACTION: { 545 data.enforceInterface(IActivityManager.descriptor); 546 IBinder token = data.readStrongBinder(); 547 String res = token != null ? getCallingPackage(token) : null; 548 reply.writeNoException(); 549 reply.writeString(res); 550 return true; 551 } 552 553 case GET_CALLING_ACTIVITY_TRANSACTION: { 554 data.enforceInterface(IActivityManager.descriptor); 555 IBinder token = data.readStrongBinder(); 556 ComponentName cn = getCallingActivity(token); 557 reply.writeNoException(); 558 ComponentName.writeToParcel(cn, reply); 559 return true; 560 } 561 562 case GET_APP_TASKS_TRANSACTION: { 563 data.enforceInterface(IActivityManager.descriptor); 564 String callingPackage = data.readString(); 565 List<IAppTask> list = getAppTasks(callingPackage); 566 reply.writeNoException(); 567 int N = list != null ? list.size() : -1; 568 reply.writeInt(N); 569 int i; 570 for (i=0; i<N; i++) { 571 IAppTask task = list.get(i); 572 reply.writeStrongBinder(task.asBinder()); 573 } 574 return true; 575 } 576 577 case ADD_APP_TASK_TRANSACTION: { 578 data.enforceInterface(IActivityManager.descriptor); 579 IBinder activityToken = data.readStrongBinder(); 580 Intent intent = Intent.CREATOR.createFromParcel(data); 581 ActivityManager.TaskDescription descr 582 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data); 583 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data); 584 int res = addAppTask(activityToken, intent, descr, thumbnail); 585 reply.writeNoException(); 586 reply.writeInt(res); 587 return true; 588 } 589 590 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: { 591 data.enforceInterface(IActivityManager.descriptor); 592 Point size = getAppTaskThumbnailSize(); 593 reply.writeNoException(); 594 size.writeToParcel(reply, 0); 595 return true; 596 } 597 598 case GET_TASKS_TRANSACTION: { 599 data.enforceInterface(IActivityManager.descriptor); 600 int maxNum = data.readInt(); 601 int fl = data.readInt(); 602 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl); 603 reply.writeNoException(); 604 int N = list != null ? list.size() : -1; 605 reply.writeInt(N); 606 int i; 607 for (i=0; i<N; i++) { 608 ActivityManager.RunningTaskInfo info = list.get(i); 609 info.writeToParcel(reply, 0); 610 } 611 return true; 612 } 613 614 case GET_RECENT_TASKS_TRANSACTION: { 615 data.enforceInterface(IActivityManager.descriptor); 616 int maxNum = data.readInt(); 617 int fl = data.readInt(); 618 int userId = data.readInt(); 619 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum, 620 fl, userId); 621 reply.writeNoException(); 622 reply.writeTypedList(list); 623 return true; 624 } 625 626 case GET_TASK_THUMBNAIL_TRANSACTION: { 627 data.enforceInterface(IActivityManager.descriptor); 628 int id = data.readInt(); 629 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id); 630 reply.writeNoException(); 631 if (taskThumbnail != null) { 632 reply.writeInt(1); 633 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 634 } else { 635 reply.writeInt(0); 636 } 637 return true; 638 } 639 640 case GET_SERVICES_TRANSACTION: { 641 data.enforceInterface(IActivityManager.descriptor); 642 int maxNum = data.readInt(); 643 int fl = data.readInt(); 644 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl); 645 reply.writeNoException(); 646 int N = list != null ? list.size() : -1; 647 reply.writeInt(N); 648 int i; 649 for (i=0; i<N; i++) { 650 ActivityManager.RunningServiceInfo info = list.get(i); 651 info.writeToParcel(reply, 0); 652 } 653 return true; 654 } 655 656 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: { 657 data.enforceInterface(IActivityManager.descriptor); 658 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState(); 659 reply.writeNoException(); 660 reply.writeTypedList(list); 661 return true; 662 } 663 664 case GET_RUNNING_APP_PROCESSES_TRANSACTION: { 665 data.enforceInterface(IActivityManager.descriptor); 666 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses(); 667 reply.writeNoException(); 668 reply.writeTypedList(list); 669 return true; 670 } 671 672 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: { 673 data.enforceInterface(IActivityManager.descriptor); 674 List<ApplicationInfo> list = getRunningExternalApplications(); 675 reply.writeNoException(); 676 reply.writeTypedList(list); 677 return true; 678 } 679 680 case MOVE_TASK_TO_FRONT_TRANSACTION: { 681 data.enforceInterface(IActivityManager.descriptor); 682 int task = data.readInt(); 683 int fl = data.readInt(); 684 Bundle options = data.readInt() != 0 685 ? Bundle.CREATOR.createFromParcel(data) : null; 686 moveTaskToFront(task, fl, options); 687 reply.writeNoException(); 688 return true; 689 } 690 691 case MOVE_TASK_TO_BACK_TRANSACTION: { 692 data.enforceInterface(IActivityManager.descriptor); 693 int task = data.readInt(); 694 moveTaskToBack(task); 695 reply.writeNoException(); 696 return true; 697 } 698 699 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: { 700 data.enforceInterface(IActivityManager.descriptor); 701 IBinder token = data.readStrongBinder(); 702 boolean nonRoot = data.readInt() != 0; 703 boolean res = moveActivityTaskToBack(token, nonRoot); 704 reply.writeNoException(); 705 reply.writeInt(res ? 1 : 0); 706 return true; 707 } 708 709 case MOVE_TASK_BACKWARDS_TRANSACTION: { 710 data.enforceInterface(IActivityManager.descriptor); 711 int task = data.readInt(); 712 moveTaskBackwards(task); 713 reply.writeNoException(); 714 return true; 715 } 716 717 case MOVE_TASK_TO_STACK_TRANSACTION: { 718 data.enforceInterface(IActivityManager.descriptor); 719 int taskId = data.readInt(); 720 int stackId = data.readInt(); 721 boolean toTop = data.readInt() != 0; 722 moveTaskToStack(taskId, stackId, toTop); 723 reply.writeNoException(); 724 return true; 725 } 726 727 case RESIZE_STACK_TRANSACTION: { 728 data.enforceInterface(IActivityManager.descriptor); 729 int stackId = data.readInt(); 730 float weight = data.readFloat(); 731 Rect r = Rect.CREATOR.createFromParcel(data); 732 resizeStack(stackId, r); 733 reply.writeNoException(); 734 return true; 735 } 736 737 case GET_ALL_STACK_INFOS_TRANSACTION: { 738 data.enforceInterface(IActivityManager.descriptor); 739 List<StackInfo> list = getAllStackInfos(); 740 reply.writeNoException(); 741 reply.writeTypedList(list); 742 return true; 743 } 744 745 case GET_STACK_INFO_TRANSACTION: { 746 data.enforceInterface(IActivityManager.descriptor); 747 int stackId = data.readInt(); 748 StackInfo info = getStackInfo(stackId); 749 reply.writeNoException(); 750 if (info != null) { 751 reply.writeInt(1); 752 info.writeToParcel(reply, 0); 753 } else { 754 reply.writeInt(0); 755 } 756 return true; 757 } 758 759 case IS_IN_HOME_STACK_TRANSACTION: { 760 data.enforceInterface(IActivityManager.descriptor); 761 int taskId = data.readInt(); 762 boolean isInHomeStack = isInHomeStack(taskId); 763 reply.writeNoException(); 764 reply.writeInt(isInHomeStack ? 1 : 0); 765 return true; 766 } 767 768 case SET_FOCUSED_STACK_TRANSACTION: { 769 data.enforceInterface(IActivityManager.descriptor); 770 int stackId = data.readInt(); 771 setFocusedStack(stackId); 772 reply.writeNoException(); 773 return true; 774 } 775 776 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: { 777 data.enforceInterface(IActivityManager.descriptor); 778 IBinder token = data.readStrongBinder(); 779 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token)); 780 reply.writeNoException(); 781 return true; 782 } 783 784 case GET_TASK_FOR_ACTIVITY_TRANSACTION: { 785 data.enforceInterface(IActivityManager.descriptor); 786 IBinder token = data.readStrongBinder(); 787 boolean onlyRoot = data.readInt() != 0; 788 int res = token != null 789 ? getTaskForActivity(token, onlyRoot) : -1; 790 reply.writeNoException(); 791 reply.writeInt(res); 792 return true; 793 } 794 795 case GET_CONTENT_PROVIDER_TRANSACTION: { 796 data.enforceInterface(IActivityManager.descriptor); 797 IBinder b = data.readStrongBinder(); 798 IApplicationThread app = ApplicationThreadNative.asInterface(b); 799 String name = data.readString(); 800 int userId = data.readInt(); 801 boolean stable = data.readInt() != 0; 802 ContentProviderHolder cph = getContentProvider(app, name, userId, stable); 803 reply.writeNoException(); 804 if (cph != null) { 805 reply.writeInt(1); 806 cph.writeToParcel(reply, 0); 807 } else { 808 reply.writeInt(0); 809 } 810 return true; 811 } 812 813 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { 814 data.enforceInterface(IActivityManager.descriptor); 815 String name = data.readString(); 816 int userId = data.readInt(); 817 IBinder token = data.readStrongBinder(); 818 ContentProviderHolder cph = getContentProviderExternal(name, userId, token); 819 reply.writeNoException(); 820 if (cph != null) { 821 reply.writeInt(1); 822 cph.writeToParcel(reply, 0); 823 } else { 824 reply.writeInt(0); 825 } 826 return true; 827 } 828 829 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: { 830 data.enforceInterface(IActivityManager.descriptor); 831 IBinder b = data.readStrongBinder(); 832 IApplicationThread app = ApplicationThreadNative.asInterface(b); 833 ArrayList<ContentProviderHolder> providers = 834 data.createTypedArrayList(ContentProviderHolder.CREATOR); 835 publishContentProviders(app, providers); 836 reply.writeNoException(); 837 return true; 838 } 839 840 case REF_CONTENT_PROVIDER_TRANSACTION: { 841 data.enforceInterface(IActivityManager.descriptor); 842 IBinder b = data.readStrongBinder(); 843 int stable = data.readInt(); 844 int unstable = data.readInt(); 845 boolean res = refContentProvider(b, stable, unstable); 846 reply.writeNoException(); 847 reply.writeInt(res ? 1 : 0); 848 return true; 849 } 850 851 case UNSTABLE_PROVIDER_DIED_TRANSACTION: { 852 data.enforceInterface(IActivityManager.descriptor); 853 IBinder b = data.readStrongBinder(); 854 unstableProviderDied(b); 855 reply.writeNoException(); 856 return true; 857 } 858 859 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: { 860 data.enforceInterface(IActivityManager.descriptor); 861 IBinder b = data.readStrongBinder(); 862 appNotRespondingViaProvider(b); 863 reply.writeNoException(); 864 return true; 865 } 866 867 case REMOVE_CONTENT_PROVIDER_TRANSACTION: { 868 data.enforceInterface(IActivityManager.descriptor); 869 IBinder b = data.readStrongBinder(); 870 boolean stable = data.readInt() != 0; 871 removeContentProvider(b, stable); 872 reply.writeNoException(); 873 return true; 874 } 875 876 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { 877 data.enforceInterface(IActivityManager.descriptor); 878 String name = data.readString(); 879 IBinder token = data.readStrongBinder(); 880 removeContentProviderExternal(name, token); 881 reply.writeNoException(); 882 return true; 883 } 884 885 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: { 886 data.enforceInterface(IActivityManager.descriptor); 887 ComponentName comp = ComponentName.CREATOR.createFromParcel(data); 888 PendingIntent pi = getRunningServiceControlPanel(comp); 889 reply.writeNoException(); 890 PendingIntent.writePendingIntentOrNullToParcel(pi, reply); 891 return true; 892 } 893 894 case START_SERVICE_TRANSACTION: { 895 data.enforceInterface(IActivityManager.descriptor); 896 IBinder b = data.readStrongBinder(); 897 IApplicationThread app = ApplicationThreadNative.asInterface(b); 898 Intent service = Intent.CREATOR.createFromParcel(data); 899 String resolvedType = data.readString(); 900 int userId = data.readInt(); 901 ComponentName cn = startService(app, service, resolvedType, userId); 902 reply.writeNoException(); 903 ComponentName.writeToParcel(cn, reply); 904 return true; 905 } 906 907 case STOP_SERVICE_TRANSACTION: { 908 data.enforceInterface(IActivityManager.descriptor); 909 IBinder b = data.readStrongBinder(); 910 IApplicationThread app = ApplicationThreadNative.asInterface(b); 911 Intent service = Intent.CREATOR.createFromParcel(data); 912 String resolvedType = data.readString(); 913 int userId = data.readInt(); 914 int res = stopService(app, service, resolvedType, userId); 915 reply.writeNoException(); 916 reply.writeInt(res); 917 return true; 918 } 919 920 case STOP_SERVICE_TOKEN_TRANSACTION: { 921 data.enforceInterface(IActivityManager.descriptor); 922 ComponentName className = ComponentName.readFromParcel(data); 923 IBinder token = data.readStrongBinder(); 924 int startId = data.readInt(); 925 boolean res = stopServiceToken(className, token, startId); 926 reply.writeNoException(); 927 reply.writeInt(res ? 1 : 0); 928 return true; 929 } 930 931 case SET_SERVICE_FOREGROUND_TRANSACTION: { 932 data.enforceInterface(IActivityManager.descriptor); 933 ComponentName className = ComponentName.readFromParcel(data); 934 IBinder token = data.readStrongBinder(); 935 int id = data.readInt(); 936 Notification notification = null; 937 if (data.readInt() != 0) { 938 notification = Notification.CREATOR.createFromParcel(data); 939 } 940 boolean removeNotification = data.readInt() != 0; 941 setServiceForeground(className, token, id, notification, removeNotification); 942 reply.writeNoException(); 943 return true; 944 } 945 946 case BIND_SERVICE_TRANSACTION: { 947 data.enforceInterface(IActivityManager.descriptor); 948 IBinder b = data.readStrongBinder(); 949 IApplicationThread app = ApplicationThreadNative.asInterface(b); 950 IBinder token = data.readStrongBinder(); 951 Intent service = Intent.CREATOR.createFromParcel(data); 952 String resolvedType = data.readString(); 953 b = data.readStrongBinder(); 954 int fl = data.readInt(); 955 int userId = data.readInt(); 956 IServiceConnection conn = IServiceConnection.Stub.asInterface(b); 957 int res = bindService(app, token, service, resolvedType, conn, fl, userId); 958 reply.writeNoException(); 959 reply.writeInt(res); 960 return true; 961 } 962 963 case UNBIND_SERVICE_TRANSACTION: { 964 data.enforceInterface(IActivityManager.descriptor); 965 IBinder b = data.readStrongBinder(); 966 IServiceConnection conn = IServiceConnection.Stub.asInterface(b); 967 boolean res = unbindService(conn); 968 reply.writeNoException(); 969 reply.writeInt(res ? 1 : 0); 970 return true; 971 } 972 973 case PUBLISH_SERVICE_TRANSACTION: { 974 data.enforceInterface(IActivityManager.descriptor); 975 IBinder token = data.readStrongBinder(); 976 Intent intent = Intent.CREATOR.createFromParcel(data); 977 IBinder service = data.readStrongBinder(); 978 publishService(token, intent, service); 979 reply.writeNoException(); 980 return true; 981 } 982 983 case UNBIND_FINISHED_TRANSACTION: { 984 data.enforceInterface(IActivityManager.descriptor); 985 IBinder token = data.readStrongBinder(); 986 Intent intent = Intent.CREATOR.createFromParcel(data); 987 boolean doRebind = data.readInt() != 0; 988 unbindFinished(token, intent, doRebind); 989 reply.writeNoException(); 990 return true; 991 } 992 993 case SERVICE_DONE_EXECUTING_TRANSACTION: { 994 data.enforceInterface(IActivityManager.descriptor); 995 IBinder token = data.readStrongBinder(); 996 int type = data.readInt(); 997 int startId = data.readInt(); 998 int res = data.readInt(); 999 serviceDoneExecuting(token, type, startId, res); 1000 reply.writeNoException(); 1001 return true; 1002 } 1003 1004 case START_INSTRUMENTATION_TRANSACTION: { 1005 data.enforceInterface(IActivityManager.descriptor); 1006 ComponentName className = ComponentName.readFromParcel(data); 1007 String profileFile = data.readString(); 1008 int fl = data.readInt(); 1009 Bundle arguments = data.readBundle(); 1010 IBinder b = data.readStrongBinder(); 1011 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b); 1012 b = data.readStrongBinder(); 1013 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b); 1014 int userId = data.readInt(); 1015 String abiOverride = data.readString(); 1016 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId, 1017 abiOverride); 1018 reply.writeNoException(); 1019 reply.writeInt(res ? 1 : 0); 1020 return true; 1021 } 1022 1023 1024 case FINISH_INSTRUMENTATION_TRANSACTION: { 1025 data.enforceInterface(IActivityManager.descriptor); 1026 IBinder b = data.readStrongBinder(); 1027 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1028 int resultCode = data.readInt(); 1029 Bundle results = data.readBundle(); 1030 finishInstrumentation(app, resultCode, results); 1031 reply.writeNoException(); 1032 return true; 1033 } 1034 1035 case GET_CONFIGURATION_TRANSACTION: { 1036 data.enforceInterface(IActivityManager.descriptor); 1037 Configuration config = getConfiguration(); 1038 reply.writeNoException(); 1039 config.writeToParcel(reply, 0); 1040 return true; 1041 } 1042 1043 case UPDATE_CONFIGURATION_TRANSACTION: { 1044 data.enforceInterface(IActivityManager.descriptor); 1045 Configuration config = Configuration.CREATOR.createFromParcel(data); 1046 updateConfiguration(config); 1047 reply.writeNoException(); 1048 return true; 1049 } 1050 1051 case SET_REQUESTED_ORIENTATION_TRANSACTION: { 1052 data.enforceInterface(IActivityManager.descriptor); 1053 IBinder token = data.readStrongBinder(); 1054 int requestedOrientation = data.readInt(); 1055 setRequestedOrientation(token, requestedOrientation); 1056 reply.writeNoException(); 1057 return true; 1058 } 1059 1060 case GET_REQUESTED_ORIENTATION_TRANSACTION: { 1061 data.enforceInterface(IActivityManager.descriptor); 1062 IBinder token = data.readStrongBinder(); 1063 int req = getRequestedOrientation(token); 1064 reply.writeNoException(); 1065 reply.writeInt(req); 1066 return true; 1067 } 1068 1069 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: { 1070 data.enforceInterface(IActivityManager.descriptor); 1071 IBinder token = data.readStrongBinder(); 1072 ComponentName cn = getActivityClassForToken(token); 1073 reply.writeNoException(); 1074 ComponentName.writeToParcel(cn, reply); 1075 return true; 1076 } 1077 1078 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: { 1079 data.enforceInterface(IActivityManager.descriptor); 1080 IBinder token = data.readStrongBinder(); 1081 reply.writeNoException(); 1082 reply.writeString(getPackageForToken(token)); 1083 return true; 1084 } 1085 1086 case GET_INTENT_SENDER_TRANSACTION: { 1087 data.enforceInterface(IActivityManager.descriptor); 1088 int type = data.readInt(); 1089 String packageName = data.readString(); 1090 IBinder token = data.readStrongBinder(); 1091 String resultWho = data.readString(); 1092 int requestCode = data.readInt(); 1093 Intent[] requestIntents; 1094 String[] requestResolvedTypes; 1095 if (data.readInt() != 0) { 1096 requestIntents = data.createTypedArray(Intent.CREATOR); 1097 requestResolvedTypes = data.createStringArray(); 1098 } else { 1099 requestIntents = null; 1100 requestResolvedTypes = null; 1101 } 1102 int fl = data.readInt(); 1103 Bundle options = data.readInt() != 0 1104 ? Bundle.CREATOR.createFromParcel(data) : null; 1105 int userId = data.readInt(); 1106 IIntentSender res = getIntentSender(type, packageName, token, 1107 resultWho, requestCode, requestIntents, 1108 requestResolvedTypes, fl, options, userId); 1109 reply.writeNoException(); 1110 reply.writeStrongBinder(res != null ? res.asBinder() : null); 1111 return true; 1112 } 1113 1114 case CANCEL_INTENT_SENDER_TRANSACTION: { 1115 data.enforceInterface(IActivityManager.descriptor); 1116 IIntentSender r = IIntentSender.Stub.asInterface( 1117 data.readStrongBinder()); 1118 cancelIntentSender(r); 1119 reply.writeNoException(); 1120 return true; 1121 } 1122 1123 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: { 1124 data.enforceInterface(IActivityManager.descriptor); 1125 IIntentSender r = IIntentSender.Stub.asInterface( 1126 data.readStrongBinder()); 1127 String res = getPackageForIntentSender(r); 1128 reply.writeNoException(); 1129 reply.writeString(res); 1130 return true; 1131 } 1132 1133 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: { 1134 data.enforceInterface(IActivityManager.descriptor); 1135 IIntentSender r = IIntentSender.Stub.asInterface( 1136 data.readStrongBinder()); 1137 int res = getUidForIntentSender(r); 1138 reply.writeNoException(); 1139 reply.writeInt(res); 1140 return true; 1141 } 1142 1143 case HANDLE_INCOMING_USER_TRANSACTION: { 1144 data.enforceInterface(IActivityManager.descriptor); 1145 int callingPid = data.readInt(); 1146 int callingUid = data.readInt(); 1147 int userId = data.readInt(); 1148 boolean allowAll = data.readInt() != 0 ; 1149 boolean requireFull = data.readInt() != 0; 1150 String name = data.readString(); 1151 String callerPackage = data.readString(); 1152 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll, 1153 requireFull, name, callerPackage); 1154 reply.writeNoException(); 1155 reply.writeInt(res); 1156 return true; 1157 } 1158 1159 case SET_PROCESS_LIMIT_TRANSACTION: { 1160 data.enforceInterface(IActivityManager.descriptor); 1161 int max = data.readInt(); 1162 setProcessLimit(max); 1163 reply.writeNoException(); 1164 return true; 1165 } 1166 1167 case GET_PROCESS_LIMIT_TRANSACTION: { 1168 data.enforceInterface(IActivityManager.descriptor); 1169 int limit = getProcessLimit(); 1170 reply.writeNoException(); 1171 reply.writeInt(limit); 1172 return true; 1173 } 1174 1175 case SET_PROCESS_FOREGROUND_TRANSACTION: { 1176 data.enforceInterface(IActivityManager.descriptor); 1177 IBinder token = data.readStrongBinder(); 1178 int pid = data.readInt(); 1179 boolean isForeground = data.readInt() != 0; 1180 setProcessForeground(token, pid, isForeground); 1181 reply.writeNoException(); 1182 return true; 1183 } 1184 1185 case CHECK_PERMISSION_TRANSACTION: { 1186 data.enforceInterface(IActivityManager.descriptor); 1187 String perm = data.readString(); 1188 int pid = data.readInt(); 1189 int uid = data.readInt(); 1190 int res = checkPermission(perm, pid, uid); 1191 reply.writeNoException(); 1192 reply.writeInt(res); 1193 return true; 1194 } 1195 1196 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: { 1197 data.enforceInterface(IActivityManager.descriptor); 1198 String perm = data.readString(); 1199 int pid = data.readInt(); 1200 int uid = data.readInt(); 1201 IBinder token = data.readStrongBinder(); 1202 int res = checkPermissionWithToken(perm, pid, uid, token); 1203 reply.writeNoException(); 1204 reply.writeInt(res); 1205 return true; 1206 } 1207 1208 case CHECK_URI_PERMISSION_TRANSACTION: { 1209 data.enforceInterface(IActivityManager.descriptor); 1210 Uri uri = Uri.CREATOR.createFromParcel(data); 1211 int pid = data.readInt(); 1212 int uid = data.readInt(); 1213 int mode = data.readInt(); 1214 int userId = data.readInt(); 1215 IBinder callerToken = data.readStrongBinder(); 1216 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken); 1217 reply.writeNoException(); 1218 reply.writeInt(res); 1219 return true; 1220 } 1221 1222 case CLEAR_APP_DATA_TRANSACTION: { 1223 data.enforceInterface(IActivityManager.descriptor); 1224 String packageName = data.readString(); 1225 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface( 1226 data.readStrongBinder()); 1227 int userId = data.readInt(); 1228 boolean res = clearApplicationUserData(packageName, observer, userId); 1229 reply.writeNoException(); 1230 reply.writeInt(res ? 1 : 0); 1231 return true; 1232 } 1233 1234 case GRANT_URI_PERMISSION_TRANSACTION: { 1235 data.enforceInterface(IActivityManager.descriptor); 1236 IBinder b = data.readStrongBinder(); 1237 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1238 String targetPkg = data.readString(); 1239 Uri uri = Uri.CREATOR.createFromParcel(data); 1240 int mode = data.readInt(); 1241 int userId = data.readInt(); 1242 grantUriPermission(app, targetPkg, uri, mode, userId); 1243 reply.writeNoException(); 1244 return true; 1245 } 1246 1247 case REVOKE_URI_PERMISSION_TRANSACTION: { 1248 data.enforceInterface(IActivityManager.descriptor); 1249 IBinder b = data.readStrongBinder(); 1250 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1251 Uri uri = Uri.CREATOR.createFromParcel(data); 1252 int mode = data.readInt(); 1253 int userId = data.readInt(); 1254 revokeUriPermission(app, uri, mode, userId); 1255 reply.writeNoException(); 1256 return true; 1257 } 1258 1259 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: { 1260 data.enforceInterface(IActivityManager.descriptor); 1261 Uri uri = Uri.CREATOR.createFromParcel(data); 1262 int mode = data.readInt(); 1263 int userId = data.readInt(); 1264 takePersistableUriPermission(uri, mode, userId); 1265 reply.writeNoException(); 1266 return true; 1267 } 1268 1269 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: { 1270 data.enforceInterface(IActivityManager.descriptor); 1271 Uri uri = Uri.CREATOR.createFromParcel(data); 1272 int mode = data.readInt(); 1273 int userId = data.readInt(); 1274 releasePersistableUriPermission(uri, mode, userId); 1275 reply.writeNoException(); 1276 return true; 1277 } 1278 1279 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: { 1280 data.enforceInterface(IActivityManager.descriptor); 1281 final String packageName = data.readString(); 1282 final boolean incoming = data.readInt() != 0; 1283 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions( 1284 packageName, incoming); 1285 reply.writeNoException(); 1286 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1287 return true; 1288 } 1289 1290 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: { 1291 data.enforceInterface(IActivityManager.descriptor); 1292 IBinder b = data.readStrongBinder(); 1293 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1294 boolean waiting = data.readInt() != 0; 1295 showWaitingForDebugger(app, waiting); 1296 reply.writeNoException(); 1297 return true; 1298 } 1299 1300 case GET_MEMORY_INFO_TRANSACTION: { 1301 data.enforceInterface(IActivityManager.descriptor); 1302 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); 1303 getMemoryInfo(mi); 1304 reply.writeNoException(); 1305 mi.writeToParcel(reply, 0); 1306 return true; 1307 } 1308 1309 case UNHANDLED_BACK_TRANSACTION: { 1310 data.enforceInterface(IActivityManager.descriptor); 1311 unhandledBack(); 1312 reply.writeNoException(); 1313 return true; 1314 } 1315 1316 case OPEN_CONTENT_URI_TRANSACTION: { 1317 data.enforceInterface(IActivityManager.descriptor); 1318 Uri uri = Uri.parse(data.readString()); 1319 ParcelFileDescriptor pfd = openContentUri(uri); 1320 reply.writeNoException(); 1321 if (pfd != null) { 1322 reply.writeInt(1); 1323 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1324 } else { 1325 reply.writeInt(0); 1326 } 1327 return true; 1328 } 1329 1330 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: { 1331 data.enforceInterface(IActivityManager.descriptor); 1332 setLockScreenShown(data.readInt() != 0); 1333 reply.writeNoException(); 1334 return true; 1335 } 1336 1337 case SET_DEBUG_APP_TRANSACTION: { 1338 data.enforceInterface(IActivityManager.descriptor); 1339 String pn = data.readString(); 1340 boolean wfd = data.readInt() != 0; 1341 boolean per = data.readInt() != 0; 1342 setDebugApp(pn, wfd, per); 1343 reply.writeNoException(); 1344 return true; 1345 } 1346 1347 case SET_ALWAYS_FINISH_TRANSACTION: { 1348 data.enforceInterface(IActivityManager.descriptor); 1349 boolean enabled = data.readInt() != 0; 1350 setAlwaysFinish(enabled); 1351 reply.writeNoException(); 1352 return true; 1353 } 1354 1355 case SET_ACTIVITY_CONTROLLER_TRANSACTION: { 1356 data.enforceInterface(IActivityManager.descriptor); 1357 IActivityController watcher = IActivityController.Stub.asInterface( 1358 data.readStrongBinder()); 1359 setActivityController(watcher); 1360 reply.writeNoException(); 1361 return true; 1362 } 1363 1364 case ENTER_SAFE_MODE_TRANSACTION: { 1365 data.enforceInterface(IActivityManager.descriptor); 1366 enterSafeMode(); 1367 reply.writeNoException(); 1368 return true; 1369 } 1370 1371 case NOTE_WAKEUP_ALARM_TRANSACTION: { 1372 data.enforceInterface(IActivityManager.descriptor); 1373 IIntentSender is = IIntentSender.Stub.asInterface( 1374 data.readStrongBinder()); 1375 int sourceUid = data.readInt(); 1376 String sourcePkg = data.readString(); 1377 noteWakeupAlarm(is, sourceUid, sourcePkg); 1378 reply.writeNoException(); 1379 return true; 1380 } 1381 1382 case KILL_PIDS_TRANSACTION: { 1383 data.enforceInterface(IActivityManager.descriptor); 1384 int[] pids = data.createIntArray(); 1385 String reason = data.readString(); 1386 boolean secure = data.readInt() != 0; 1387 boolean res = killPids(pids, reason, secure); 1388 reply.writeNoException(); 1389 reply.writeInt(res ? 1 : 0); 1390 return true; 1391 } 1392 1393 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: { 1394 data.enforceInterface(IActivityManager.descriptor); 1395 String reason = data.readString(); 1396 boolean res = killProcessesBelowForeground(reason); 1397 reply.writeNoException(); 1398 reply.writeInt(res ? 1 : 0); 1399 return true; 1400 } 1401 1402 case HANDLE_APPLICATION_CRASH_TRANSACTION: { 1403 data.enforceInterface(IActivityManager.descriptor); 1404 IBinder app = data.readStrongBinder(); 1405 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); 1406 handleApplicationCrash(app, ci); 1407 reply.writeNoException(); 1408 return true; 1409 } 1410 1411 case HANDLE_APPLICATION_WTF_TRANSACTION: { 1412 data.enforceInterface(IActivityManager.descriptor); 1413 IBinder app = data.readStrongBinder(); 1414 String tag = data.readString(); 1415 boolean system = data.readInt() != 0; 1416 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); 1417 boolean res = handleApplicationWtf(app, tag, system, ci); 1418 reply.writeNoException(); 1419 reply.writeInt(res ? 1 : 0); 1420 return true; 1421 } 1422 1423 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: { 1424 data.enforceInterface(IActivityManager.descriptor); 1425 IBinder app = data.readStrongBinder(); 1426 int violationMask = data.readInt(); 1427 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data); 1428 handleApplicationStrictModeViolation(app, violationMask, info); 1429 reply.writeNoException(); 1430 return true; 1431 } 1432 1433 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: { 1434 data.enforceInterface(IActivityManager.descriptor); 1435 int sig = data.readInt(); 1436 signalPersistentProcesses(sig); 1437 reply.writeNoException(); 1438 return true; 1439 } 1440 1441 case KILL_BACKGROUND_PROCESSES_TRANSACTION: { 1442 data.enforceInterface(IActivityManager.descriptor); 1443 String packageName = data.readString(); 1444 int userId = data.readInt(); 1445 killBackgroundProcesses(packageName, userId); 1446 reply.writeNoException(); 1447 return true; 1448 } 1449 1450 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: { 1451 data.enforceInterface(IActivityManager.descriptor); 1452 killAllBackgroundProcesses(); 1453 reply.writeNoException(); 1454 return true; 1455 } 1456 1457 case FORCE_STOP_PACKAGE_TRANSACTION: { 1458 data.enforceInterface(IActivityManager.descriptor); 1459 String packageName = data.readString(); 1460 int userId = data.readInt(); 1461 forceStopPackage(packageName, userId); 1462 reply.writeNoException(); 1463 return true; 1464 } 1465 1466 case GET_MY_MEMORY_STATE_TRANSACTION: { 1467 data.enforceInterface(IActivityManager.descriptor); 1468 ActivityManager.RunningAppProcessInfo info = 1469 new ActivityManager.RunningAppProcessInfo(); 1470 getMyMemoryState(info); 1471 reply.writeNoException(); 1472 info.writeToParcel(reply, 0); 1473 return true; 1474 } 1475 1476 case GET_DEVICE_CONFIGURATION_TRANSACTION: { 1477 data.enforceInterface(IActivityManager.descriptor); 1478 ConfigurationInfo config = getDeviceConfigurationInfo(); 1479 reply.writeNoException(); 1480 config.writeToParcel(reply, 0); 1481 return true; 1482 } 1483 1484 case PROFILE_CONTROL_TRANSACTION: { 1485 data.enforceInterface(IActivityManager.descriptor); 1486 String process = data.readString(); 1487 int userId = data.readInt(); 1488 boolean start = data.readInt() != 0; 1489 int profileType = data.readInt(); 1490 ProfilerInfo profilerInfo = data.readInt() != 0 1491 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 1492 boolean res = profileControl(process, userId, start, profilerInfo, profileType); 1493 reply.writeNoException(); 1494 reply.writeInt(res ? 1 : 0); 1495 return true; 1496 } 1497 1498 case SHUTDOWN_TRANSACTION: { 1499 data.enforceInterface(IActivityManager.descriptor); 1500 boolean res = shutdown(data.readInt()); 1501 reply.writeNoException(); 1502 reply.writeInt(res ? 1 : 0); 1503 return true; 1504 } 1505 1506 case STOP_APP_SWITCHES_TRANSACTION: { 1507 data.enforceInterface(IActivityManager.descriptor); 1508 stopAppSwitches(); 1509 reply.writeNoException(); 1510 return true; 1511 } 1512 1513 case RESUME_APP_SWITCHES_TRANSACTION: { 1514 data.enforceInterface(IActivityManager.descriptor); 1515 resumeAppSwitches(); 1516 reply.writeNoException(); 1517 return true; 1518 } 1519 1520 case PEEK_SERVICE_TRANSACTION: { 1521 data.enforceInterface(IActivityManager.descriptor); 1522 Intent service = Intent.CREATOR.createFromParcel(data); 1523 String resolvedType = data.readString(); 1524 IBinder binder = peekService(service, resolvedType); 1525 reply.writeNoException(); 1526 reply.writeStrongBinder(binder); 1527 return true; 1528 } 1529 1530 case START_BACKUP_AGENT_TRANSACTION: { 1531 data.enforceInterface(IActivityManager.descriptor); 1532 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); 1533 int backupRestoreMode = data.readInt(); 1534 boolean success = bindBackupAgent(info, backupRestoreMode); 1535 reply.writeNoException(); 1536 reply.writeInt(success ? 1 : 0); 1537 return true; 1538 } 1539 1540 case BACKUP_AGENT_CREATED_TRANSACTION: { 1541 data.enforceInterface(IActivityManager.descriptor); 1542 String packageName = data.readString(); 1543 IBinder agent = data.readStrongBinder(); 1544 backupAgentCreated(packageName, agent); 1545 reply.writeNoException(); 1546 return true; 1547 } 1548 1549 case UNBIND_BACKUP_AGENT_TRANSACTION: { 1550 data.enforceInterface(IActivityManager.descriptor); 1551 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); 1552 unbindBackupAgent(info); 1553 reply.writeNoException(); 1554 return true; 1555 } 1556 1557 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: { 1558 data.enforceInterface(IActivityManager.descriptor); 1559 String packageName = data.readString(); 1560 addPackageDependency(packageName); 1561 reply.writeNoException(); 1562 return true; 1563 } 1564 1565 case KILL_APPLICATION_WITH_APPID_TRANSACTION: { 1566 data.enforceInterface(IActivityManager.descriptor); 1567 String pkg = data.readString(); 1568 int appid = data.readInt(); 1569 String reason = data.readString(); 1570 killApplicationWithAppId(pkg, appid, reason); 1571 reply.writeNoException(); 1572 return true; 1573 } 1574 1575 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: { 1576 data.enforceInterface(IActivityManager.descriptor); 1577 String reason = data.readString(); 1578 closeSystemDialogs(reason); 1579 reply.writeNoException(); 1580 return true; 1581 } 1582 1583 case GET_PROCESS_MEMORY_INFO_TRANSACTION: { 1584 data.enforceInterface(IActivityManager.descriptor); 1585 int[] pids = data.createIntArray(); 1586 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids); 1587 reply.writeNoException(); 1588 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1589 return true; 1590 } 1591 1592 case KILL_APPLICATION_PROCESS_TRANSACTION: { 1593 data.enforceInterface(IActivityManager.descriptor); 1594 String processName = data.readString(); 1595 int uid = data.readInt(); 1596 killApplicationProcess(processName, uid); 1597 reply.writeNoException(); 1598 return true; 1599 } 1600 1601 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: { 1602 data.enforceInterface(IActivityManager.descriptor); 1603 IBinder token = data.readStrongBinder(); 1604 String packageName = data.readString(); 1605 int enterAnim = data.readInt(); 1606 int exitAnim = data.readInt(); 1607 overridePendingTransition(token, packageName, enterAnim, exitAnim); 1608 reply.writeNoException(); 1609 return true; 1610 } 1611 1612 case IS_USER_A_MONKEY_TRANSACTION: { 1613 data.enforceInterface(IActivityManager.descriptor); 1614 boolean areThey = isUserAMonkey(); 1615 reply.writeNoException(); 1616 reply.writeInt(areThey ? 1 : 0); 1617 return true; 1618 } 1619 1620 case SET_USER_IS_MONKEY_TRANSACTION: { 1621 data.enforceInterface(IActivityManager.descriptor); 1622 final boolean monkey = (data.readInt() == 1); 1623 setUserIsMonkey(monkey); 1624 reply.writeNoException(); 1625 return true; 1626 } 1627 1628 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { 1629 data.enforceInterface(IActivityManager.descriptor); 1630 finishHeavyWeightApp(); 1631 reply.writeNoException(); 1632 return true; 1633 } 1634 1635 case IS_IMMERSIVE_TRANSACTION: { 1636 data.enforceInterface(IActivityManager.descriptor); 1637 IBinder token = data.readStrongBinder(); 1638 boolean isit = isImmersive(token); 1639 reply.writeNoException(); 1640 reply.writeInt(isit ? 1 : 0); 1641 return true; 1642 } 1643 1644 case IS_TOP_OF_TASK_TRANSACTION: { 1645 data.enforceInterface(IActivityManager.descriptor); 1646 IBinder token = data.readStrongBinder(); 1647 final boolean isTopOfTask = isTopOfTask(token); 1648 reply.writeNoException(); 1649 reply.writeInt(isTopOfTask ? 1 : 0); 1650 return true; 1651 } 1652 1653 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: { 1654 data.enforceInterface(IActivityManager.descriptor); 1655 IBinder token = data.readStrongBinder(); 1656 boolean converted = convertFromTranslucent(token); 1657 reply.writeNoException(); 1658 reply.writeInt(converted ? 1 : 0); 1659 return true; 1660 } 1661 1662 case CONVERT_TO_TRANSLUCENT_TRANSACTION: { 1663 data.enforceInterface(IActivityManager.descriptor); 1664 IBinder token = data.readStrongBinder(); 1665 final Bundle bundle; 1666 if (data.readInt() == 0) { 1667 bundle = null; 1668 } else { 1669 bundle = data.readBundle(); 1670 } 1671 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle); 1672 boolean converted = convertToTranslucent(token, options); 1673 reply.writeNoException(); 1674 reply.writeInt(converted ? 1 : 0); 1675 return true; 1676 } 1677 1678 case GET_ACTIVITY_OPTIONS_TRANSACTION: { 1679 data.enforceInterface(IActivityManager.descriptor); 1680 IBinder token = data.readStrongBinder(); 1681 final ActivityOptions options = getActivityOptions(token); 1682 reply.writeNoException(); 1683 reply.writeBundle(options == null ? null : options.toBundle()); 1684 return true; 1685 } 1686 1687 case SET_IMMERSIVE_TRANSACTION: { 1688 data.enforceInterface(IActivityManager.descriptor); 1689 IBinder token = data.readStrongBinder(); 1690 boolean imm = data.readInt() == 1; 1691 setImmersive(token, imm); 1692 reply.writeNoException(); 1693 return true; 1694 } 1695 1696 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: { 1697 data.enforceInterface(IActivityManager.descriptor); 1698 boolean isit = isTopActivityImmersive(); 1699 reply.writeNoException(); 1700 reply.writeInt(isit ? 1 : 0); 1701 return true; 1702 } 1703 1704 case CRASH_APPLICATION_TRANSACTION: { 1705 data.enforceInterface(IActivityManager.descriptor); 1706 int uid = data.readInt(); 1707 int initialPid = data.readInt(); 1708 String packageName = data.readString(); 1709 String message = data.readString(); 1710 crashApplication(uid, initialPid, packageName, message); 1711 reply.writeNoException(); 1712 return true; 1713 } 1714 1715 case GET_PROVIDER_MIME_TYPE_TRANSACTION: { 1716 data.enforceInterface(IActivityManager.descriptor); 1717 Uri uri = Uri.CREATOR.createFromParcel(data); 1718 int userId = data.readInt(); 1719 String type = getProviderMimeType(uri, userId); 1720 reply.writeNoException(); 1721 reply.writeString(type); 1722 return true; 1723 } 1724 1725 case NEW_URI_PERMISSION_OWNER_TRANSACTION: { 1726 data.enforceInterface(IActivityManager.descriptor); 1727 String name = data.readString(); 1728 IBinder perm = newUriPermissionOwner(name); 1729 reply.writeNoException(); 1730 reply.writeStrongBinder(perm); 1731 return true; 1732 } 1733 1734 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: { 1735 data.enforceInterface(IActivityManager.descriptor); 1736 IBinder owner = data.readStrongBinder(); 1737 int fromUid = data.readInt(); 1738 String targetPkg = data.readString(); 1739 Uri uri = Uri.CREATOR.createFromParcel(data); 1740 int mode = data.readInt(); 1741 int sourceUserId = data.readInt(); 1742 int targetUserId = data.readInt(); 1743 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId, 1744 targetUserId); 1745 reply.writeNoException(); 1746 return true; 1747 } 1748 1749 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: { 1750 data.enforceInterface(IActivityManager.descriptor); 1751 IBinder owner = data.readStrongBinder(); 1752 Uri uri = null; 1753 if (data.readInt() != 0) { 1754 uri = Uri.CREATOR.createFromParcel(data); 1755 } 1756 int mode = data.readInt(); 1757 int userId = data.readInt(); 1758 revokeUriPermissionFromOwner(owner, uri, mode, userId); 1759 reply.writeNoException(); 1760 return true; 1761 } 1762 1763 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: { 1764 data.enforceInterface(IActivityManager.descriptor); 1765 int callingUid = data.readInt(); 1766 String targetPkg = data.readString(); 1767 Uri uri = Uri.CREATOR.createFromParcel(data); 1768 int modeFlags = data.readInt(); 1769 int userId = data.readInt(); 1770 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId); 1771 reply.writeNoException(); 1772 reply.writeInt(res); 1773 return true; 1774 } 1775 1776 case DUMP_HEAP_TRANSACTION: { 1777 data.enforceInterface(IActivityManager.descriptor); 1778 String process = data.readString(); 1779 int userId = data.readInt(); 1780 boolean managed = data.readInt() != 0; 1781 String path = data.readString(); 1782 ParcelFileDescriptor fd = data.readInt() != 0 1783 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null; 1784 boolean res = dumpHeap(process, userId, managed, path, fd); 1785 reply.writeNoException(); 1786 reply.writeInt(res ? 1 : 0); 1787 return true; 1788 } 1789 1790 case START_ACTIVITIES_TRANSACTION: 1791 { 1792 data.enforceInterface(IActivityManager.descriptor); 1793 IBinder b = data.readStrongBinder(); 1794 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1795 String callingPackage = data.readString(); 1796 Intent[] intents = data.createTypedArray(Intent.CREATOR); 1797 String[] resolvedTypes = data.createStringArray(); 1798 IBinder resultTo = data.readStrongBinder(); 1799 Bundle options = data.readInt() != 0 1800 ? Bundle.CREATOR.createFromParcel(data) : null; 1801 int userId = data.readInt(); 1802 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo, 1803 options, userId); 1804 reply.writeNoException(); 1805 reply.writeInt(result); 1806 return true; 1807 } 1808 1809 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION: 1810 { 1811 data.enforceInterface(IActivityManager.descriptor); 1812 int mode = getFrontActivityScreenCompatMode(); 1813 reply.writeNoException(); 1814 reply.writeInt(mode); 1815 return true; 1816 } 1817 1818 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION: 1819 { 1820 data.enforceInterface(IActivityManager.descriptor); 1821 int mode = data.readInt(); 1822 setFrontActivityScreenCompatMode(mode); 1823 reply.writeNoException(); 1824 reply.writeInt(mode); 1825 return true; 1826 } 1827 1828 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION: 1829 { 1830 data.enforceInterface(IActivityManager.descriptor); 1831 String pkg = data.readString(); 1832 int mode = getPackageScreenCompatMode(pkg); 1833 reply.writeNoException(); 1834 reply.writeInt(mode); 1835 return true; 1836 } 1837 1838 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION: 1839 { 1840 data.enforceInterface(IActivityManager.descriptor); 1841 String pkg = data.readString(); 1842 int mode = data.readInt(); 1843 setPackageScreenCompatMode(pkg, mode); 1844 reply.writeNoException(); 1845 return true; 1846 } 1847 1848 case SWITCH_USER_TRANSACTION: { 1849 data.enforceInterface(IActivityManager.descriptor); 1850 int userid = data.readInt(); 1851 boolean result = switchUser(userid); 1852 reply.writeNoException(); 1853 reply.writeInt(result ? 1 : 0); 1854 return true; 1855 } 1856 1857 case START_USER_IN_BACKGROUND_TRANSACTION: { 1858 data.enforceInterface(IActivityManager.descriptor); 1859 int userid = data.readInt(); 1860 boolean result = startUserInBackground(userid); 1861 reply.writeNoException(); 1862 reply.writeInt(result ? 1 : 0); 1863 return true; 1864 } 1865 1866 case STOP_USER_TRANSACTION: { 1867 data.enforceInterface(IActivityManager.descriptor); 1868 int userid = data.readInt(); 1869 IStopUserCallback callback = IStopUserCallback.Stub.asInterface( 1870 data.readStrongBinder()); 1871 int result = stopUser(userid, callback); 1872 reply.writeNoException(); 1873 reply.writeInt(result); 1874 return true; 1875 } 1876 1877 case GET_CURRENT_USER_TRANSACTION: { 1878 data.enforceInterface(IActivityManager.descriptor); 1879 UserInfo userInfo = getCurrentUser(); 1880 reply.writeNoException(); 1881 userInfo.writeToParcel(reply, 0); 1882 return true; 1883 } 1884 1885 case IS_USER_RUNNING_TRANSACTION: { 1886 data.enforceInterface(IActivityManager.descriptor); 1887 int userid = data.readInt(); 1888 boolean orStopping = data.readInt() != 0; 1889 boolean result = isUserRunning(userid, orStopping); 1890 reply.writeNoException(); 1891 reply.writeInt(result ? 1 : 0); 1892 return true; 1893 } 1894 1895 case GET_RUNNING_USER_IDS_TRANSACTION: { 1896 data.enforceInterface(IActivityManager.descriptor); 1897 int[] result = getRunningUserIds(); 1898 reply.writeNoException(); 1899 reply.writeIntArray(result); 1900 return true; 1901 } 1902 1903 case REMOVE_TASK_TRANSACTION: 1904 { 1905 data.enforceInterface(IActivityManager.descriptor); 1906 int taskId = data.readInt(); 1907 boolean result = removeTask(taskId); 1908 reply.writeNoException(); 1909 reply.writeInt(result ? 1 : 0); 1910 return true; 1911 } 1912 1913 case REGISTER_PROCESS_OBSERVER_TRANSACTION: { 1914 data.enforceInterface(IActivityManager.descriptor); 1915 IProcessObserver observer = IProcessObserver.Stub.asInterface( 1916 data.readStrongBinder()); 1917 registerProcessObserver(observer); 1918 return true; 1919 } 1920 1921 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: { 1922 data.enforceInterface(IActivityManager.descriptor); 1923 IProcessObserver observer = IProcessObserver.Stub.asInterface( 1924 data.readStrongBinder()); 1925 unregisterProcessObserver(observer); 1926 return true; 1927 } 1928 1929 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: 1930 { 1931 data.enforceInterface(IActivityManager.descriptor); 1932 String pkg = data.readString(); 1933 boolean ask = getPackageAskScreenCompat(pkg); 1934 reply.writeNoException(); 1935 reply.writeInt(ask ? 1 : 0); 1936 return true; 1937 } 1938 1939 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: 1940 { 1941 data.enforceInterface(IActivityManager.descriptor); 1942 String pkg = data.readString(); 1943 boolean ask = data.readInt() != 0; 1944 setPackageAskScreenCompat(pkg, ask); 1945 reply.writeNoException(); 1946 return true; 1947 } 1948 1949 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: { 1950 data.enforceInterface(IActivityManager.descriptor); 1951 IIntentSender r = IIntentSender.Stub.asInterface( 1952 data.readStrongBinder()); 1953 boolean res = isIntentSenderTargetedToPackage(r); 1954 reply.writeNoException(); 1955 reply.writeInt(res ? 1 : 0); 1956 return true; 1957 } 1958 1959 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: { 1960 data.enforceInterface(IActivityManager.descriptor); 1961 IIntentSender r = IIntentSender.Stub.asInterface( 1962 data.readStrongBinder()); 1963 boolean res = isIntentSenderAnActivity(r); 1964 reply.writeNoException(); 1965 reply.writeInt(res ? 1 : 0); 1966 return true; 1967 } 1968 1969 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: { 1970 data.enforceInterface(IActivityManager.descriptor); 1971 IIntentSender r = IIntentSender.Stub.asInterface( 1972 data.readStrongBinder()); 1973 Intent intent = getIntentForIntentSender(r); 1974 reply.writeNoException(); 1975 if (intent != null) { 1976 reply.writeInt(1); 1977 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1978 } else { 1979 reply.writeInt(0); 1980 } 1981 return true; 1982 } 1983 1984 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: { 1985 data.enforceInterface(IActivityManager.descriptor); 1986 IIntentSender r = IIntentSender.Stub.asInterface( 1987 data.readStrongBinder()); 1988 String prefix = data.readString(); 1989 String tag = getTagForIntentSender(r, prefix); 1990 reply.writeNoException(); 1991 reply.writeString(tag); 1992 return true; 1993 } 1994 1995 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: { 1996 data.enforceInterface(IActivityManager.descriptor); 1997 Configuration config = Configuration.CREATOR.createFromParcel(data); 1998 updatePersistentConfiguration(config); 1999 reply.writeNoException(); 2000 return true; 2001 } 2002 2003 case GET_PROCESS_PSS_TRANSACTION: { 2004 data.enforceInterface(IActivityManager.descriptor); 2005 int[] pids = data.createIntArray(); 2006 long[] pss = getProcessPss(pids); 2007 reply.writeNoException(); 2008 reply.writeLongArray(pss); 2009 return true; 2010 } 2011 2012 case SHOW_BOOT_MESSAGE_TRANSACTION: { 2013 data.enforceInterface(IActivityManager.descriptor); 2014 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); 2015 boolean always = data.readInt() != 0; 2016 showBootMessage(msg, always); 2017 reply.writeNoException(); 2018 return true; 2019 } 2020 2021 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: { 2022 data.enforceInterface(IActivityManager.descriptor); 2023 keyguardWaitingForActivityDrawn(); 2024 reply.writeNoException(); 2025 return true; 2026 } 2027 2028 case SHOULD_UP_RECREATE_TASK_TRANSACTION: { 2029 data.enforceInterface(IActivityManager.descriptor); 2030 IBinder token = data.readStrongBinder(); 2031 String destAffinity = data.readString(); 2032 boolean res = shouldUpRecreateTask(token, destAffinity); 2033 reply.writeNoException(); 2034 reply.writeInt(res ? 1 : 0); 2035 return true; 2036 } 2037 2038 case NAVIGATE_UP_TO_TRANSACTION: { 2039 data.enforceInterface(IActivityManager.descriptor); 2040 IBinder token = data.readStrongBinder(); 2041 Intent target = Intent.CREATOR.createFromParcel(data); 2042 int resultCode = data.readInt(); 2043 Intent resultData = null; 2044 if (data.readInt() != 0) { 2045 resultData = Intent.CREATOR.createFromParcel(data); 2046 } 2047 boolean res = navigateUpTo(token, target, resultCode, resultData); 2048 reply.writeNoException(); 2049 reply.writeInt(res ? 1 : 0); 2050 return true; 2051 } 2052 2053 case GET_LAUNCHED_FROM_UID_TRANSACTION: { 2054 data.enforceInterface(IActivityManager.descriptor); 2055 IBinder token = data.readStrongBinder(); 2056 int res = getLaunchedFromUid(token); 2057 reply.writeNoException(); 2058 reply.writeInt(res); 2059 return true; 2060 } 2061 2062 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: { 2063 data.enforceInterface(IActivityManager.descriptor); 2064 IBinder token = data.readStrongBinder(); 2065 String res = getLaunchedFromPackage(token); 2066 reply.writeNoException(); 2067 reply.writeString(res); 2068 return true; 2069 } 2070 2071 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { 2072 data.enforceInterface(IActivityManager.descriptor); 2073 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( 2074 data.readStrongBinder()); 2075 registerUserSwitchObserver(observer); 2076 reply.writeNoException(); 2077 return true; 2078 } 2079 2080 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { 2081 data.enforceInterface(IActivityManager.descriptor); 2082 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( 2083 data.readStrongBinder()); 2084 unregisterUserSwitchObserver(observer); 2085 reply.writeNoException(); 2086 return true; 2087 } 2088 2089 case REQUEST_BUG_REPORT_TRANSACTION: { 2090 data.enforceInterface(IActivityManager.descriptor); 2091 requestBugReport(); 2092 reply.writeNoException(); 2093 return true; 2094 } 2095 2096 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: { 2097 data.enforceInterface(IActivityManager.descriptor); 2098 int pid = data.readInt(); 2099 boolean aboveSystem = data.readInt() != 0; 2100 String reason = data.readString(); 2101 long res = inputDispatchingTimedOut(pid, aboveSystem, reason); 2102 reply.writeNoException(); 2103 reply.writeLong(res); 2104 return true; 2105 } 2106 2107 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: { 2108 data.enforceInterface(IActivityManager.descriptor); 2109 int requestType = data.readInt(); 2110 Bundle res = getAssistContextExtras(requestType); 2111 reply.writeNoException(); 2112 reply.writeBundle(res); 2113 return true; 2114 } 2115 2116 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: { 2117 data.enforceInterface(IActivityManager.descriptor); 2118 IBinder token = data.readStrongBinder(); 2119 Bundle extras = data.readBundle(); 2120 reportAssistContextExtras(token, extras); 2121 reply.writeNoException(); 2122 return true; 2123 } 2124 2125 case LAUNCH_ASSIST_INTENT_TRANSACTION: { 2126 data.enforceInterface(IActivityManager.descriptor); 2127 Intent intent = Intent.CREATOR.createFromParcel(data); 2128 int requestType = data.readInt(); 2129 String hint = data.readString(); 2130 int userHandle = data.readInt(); 2131 boolean res = launchAssistIntent(intent, requestType, hint, userHandle); 2132 reply.writeNoException(); 2133 reply.writeInt(res ? 1 : 0); 2134 return true; 2135 } 2136 2137 case KILL_UID_TRANSACTION: { 2138 data.enforceInterface(IActivityManager.descriptor); 2139 int uid = data.readInt(); 2140 String reason = data.readString(); 2141 killUid(uid, reason); 2142 reply.writeNoException(); 2143 return true; 2144 } 2145 2146 case HANG_TRANSACTION: { 2147 data.enforceInterface(IActivityManager.descriptor); 2148 IBinder who = data.readStrongBinder(); 2149 boolean allowRestart = data.readInt() != 0; 2150 hang(who, allowRestart); 2151 reply.writeNoException(); 2152 return true; 2153 } 2154 2155 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: { 2156 data.enforceInterface(IActivityManager.descriptor); 2157 IBinder token = data.readStrongBinder(); 2158 reportActivityFullyDrawn(token); 2159 reply.writeNoException(); 2160 return true; 2161 } 2162 2163 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: { 2164 data.enforceInterface(IActivityManager.descriptor); 2165 IBinder token = data.readStrongBinder(); 2166 notifyActivityDrawn(token); 2167 reply.writeNoException(); 2168 return true; 2169 } 2170 2171 case RESTART_TRANSACTION: { 2172 data.enforceInterface(IActivityManager.descriptor); 2173 restart(); 2174 reply.writeNoException(); 2175 return true; 2176 } 2177 2178 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: { 2179 data.enforceInterface(IActivityManager.descriptor); 2180 performIdleMaintenance(); 2181 reply.writeNoException(); 2182 return true; 2183 } 2184 2185 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: { 2186 data.enforceInterface(IActivityManager.descriptor); 2187 IBinder parentActivityToken = data.readStrongBinder(); 2188 IActivityContainerCallback callback = 2189 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder()); 2190 IActivityContainer activityContainer = 2191 createActivityContainer(parentActivityToken, callback); 2192 reply.writeNoException(); 2193 if (activityContainer != null) { 2194 reply.writeInt(1); 2195 reply.writeStrongBinder(activityContainer.asBinder()); 2196 } else { 2197 reply.writeInt(0); 2198 } 2199 return true; 2200 } 2201 2202 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: { 2203 data.enforceInterface(IActivityManager.descriptor); 2204 IActivityContainer activityContainer = 2205 IActivityContainer.Stub.asInterface(data.readStrongBinder()); 2206 deleteActivityContainer(activityContainer); 2207 reply.writeNoException(); 2208 return true; 2209 } 2210 2211 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: { 2212 data.enforceInterface(IActivityManager.descriptor); 2213 IBinder activityToken = data.readStrongBinder(); 2214 int displayId = getActivityDisplayId(activityToken); 2215 reply.writeNoException(); 2216 reply.writeInt(displayId); 2217 return true; 2218 } 2219 2220 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: { 2221 data.enforceInterface(IActivityManager.descriptor); 2222 IBinder homeActivityToken = getHomeActivityToken(); 2223 reply.writeNoException(); 2224 reply.writeStrongBinder(homeActivityToken); 2225 return true; 2226 } 2227 2228 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: { 2229 data.enforceInterface(IActivityManager.descriptor); 2230 final int taskId = data.readInt(); 2231 startLockTaskMode(taskId); 2232 reply.writeNoException(); 2233 return true; 2234 } 2235 2236 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: { 2237 data.enforceInterface(IActivityManager.descriptor); 2238 IBinder token = data.readStrongBinder(); 2239 startLockTaskMode(token); 2240 reply.writeNoException(); 2241 return true; 2242 } 2243 2244 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: { 2245 data.enforceInterface(IActivityManager.descriptor); 2246 startLockTaskModeOnCurrent(); 2247 reply.writeNoException(); 2248 return true; 2249 } 2250 2251 case STOP_LOCK_TASK_MODE_TRANSACTION: { 2252 data.enforceInterface(IActivityManager.descriptor); 2253 stopLockTaskMode(); 2254 reply.writeNoException(); 2255 return true; 2256 } 2257 2258 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: { 2259 data.enforceInterface(IActivityManager.descriptor); 2260 stopLockTaskModeOnCurrent(); 2261 reply.writeNoException(); 2262 return true; 2263 } 2264 2265 case IS_IN_LOCK_TASK_MODE_TRANSACTION: { 2266 data.enforceInterface(IActivityManager.descriptor); 2267 final boolean isInLockTaskMode = isInLockTaskMode(); 2268 reply.writeNoException(); 2269 reply.writeInt(isInLockTaskMode ? 1 : 0); 2270 return true; 2271 } 2272 2273 case SET_TASK_DESCRIPTION_TRANSACTION: { 2274 data.enforceInterface(IActivityManager.descriptor); 2275 IBinder token = data.readStrongBinder(); 2276 ActivityManager.TaskDescription values = 2277 ActivityManager.TaskDescription.CREATOR.createFromParcel(data); 2278 setTaskDescription(token, values); 2279 reply.writeNoException(); 2280 return true; 2281 } 2282 2283 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: { 2284 data.enforceInterface(IActivityManager.descriptor); 2285 String filename = data.readString(); 2286 Bitmap icon = getTaskDescriptionIcon(filename); 2287 reply.writeNoException(); 2288 if (icon == null) { 2289 reply.writeInt(0); 2290 } else { 2291 reply.writeInt(1); 2292 icon.writeToParcel(reply, 0); 2293 } 2294 return true; 2295 } 2296 2297 case START_IN_PLACE_ANIMATION_TRANSACTION: { 2298 data.enforceInterface(IActivityManager.descriptor); 2299 final Bundle bundle; 2300 if (data.readInt() == 0) { 2301 bundle = null; 2302 } else { 2303 bundle = data.readBundle(); 2304 } 2305 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle); 2306 startInPlaceAnimationOnFrontMostApplication(options); 2307 reply.writeNoException(); 2308 return true; 2309 } 2310 2311 case REQUEST_VISIBLE_BEHIND_TRANSACTION: { 2312 data.enforceInterface(IActivityManager.descriptor); 2313 IBinder token = data.readStrongBinder(); 2314 boolean enable = data.readInt() > 0; 2315 boolean success = requestVisibleBehind(token, enable); 2316 reply.writeNoException(); 2317 reply.writeInt(success ? 1 : 0); 2318 return true; 2319 } 2320 2321 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: { 2322 data.enforceInterface(IActivityManager.descriptor); 2323 IBinder token = data.readStrongBinder(); 2324 final boolean enabled = isBackgroundVisibleBehind(token); 2325 reply.writeNoException(); 2326 reply.writeInt(enabled ? 1 : 0); 2327 return true; 2328 } 2329 2330 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: { 2331 data.enforceInterface(IActivityManager.descriptor); 2332 IBinder token = data.readStrongBinder(); 2333 backgroundResourcesReleased(token); 2334 reply.writeNoException(); 2335 return true; 2336 } 2337 2338 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: { 2339 data.enforceInterface(IActivityManager.descriptor); 2340 IBinder token = data.readStrongBinder(); 2341 notifyLaunchTaskBehindComplete(token); 2342 reply.writeNoException(); 2343 return true; 2344 } 2345 2346 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: { 2347 data.enforceInterface(IActivityManager.descriptor); 2348 IBinder token = data.readStrongBinder(); 2349 notifyEnterAnimationComplete(token); 2350 reply.writeNoException(); 2351 return true; 2352 } 2353 2354 case BOOT_ANIMATION_COMPLETE_TRANSACTION: { 2355 data.enforceInterface(IActivityManager.descriptor); 2356 bootAnimationComplete(); 2357 reply.writeNoException(); 2358 return true; 2359 } 2360 2361 case SYSTEM_BACKUP_RESTORED: { 2362 data.enforceInterface(IActivityManager.descriptor); 2363 systemBackupRestored(); 2364 reply.writeNoException(); 2365 return true; 2366 } 2367 } 2368 2369 return super.onTransact(code, data, reply, flags); 2370 } 2371 2372 public IBinder asBinder() { 2373 return this; 2374 } 2375 2376 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() { 2377 protected IActivityManager create() { 2378 IBinder b = ServiceManager.getService("activity"); 2379 if (false) { 2380 Log.v("ActivityManager", "default service binder = " + b); 2381 } 2382 IActivityManager am = asInterface(b); 2383 if (false) { 2384 Log.v("ActivityManager", "default service = " + am); 2385 } 2386 return am; 2387 } 2388 }; 2389 } 2390 2391 class ActivityManagerProxy implements IActivityManager 2392 { 2393 public ActivityManagerProxy(IBinder remote) 2394 { 2395 mRemote = remote; 2396 } 2397 2398 public IBinder asBinder() 2399 { 2400 return mRemote; 2401 } 2402 2403 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent, 2404 String resolvedType, IBinder resultTo, String resultWho, int requestCode, 2405 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException { 2406 Parcel data = Parcel.obtain(); 2407 Parcel reply = Parcel.obtain(); 2408 data.writeInterfaceToken(IActivityManager.descriptor); 2409 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2410 data.writeString(callingPackage); 2411 intent.writeToParcel(data, 0); 2412 data.writeString(resolvedType); 2413 data.writeStrongBinder(resultTo); 2414 data.writeString(resultWho); 2415 data.writeInt(requestCode); 2416 data.writeInt(startFlags); 2417 if (profilerInfo != null) { 2418 data.writeInt(1); 2419 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 2420 } else { 2421 data.writeInt(0); 2422 } 2423 if (options != null) { 2424 data.writeInt(1); 2425 options.writeToParcel(data, 0); 2426 } else { 2427 data.writeInt(0); 2428 } 2429 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); 2430 reply.readException(); 2431 int result = reply.readInt(); 2432 reply.recycle(); 2433 data.recycle(); 2434 return result; 2435 } 2436 2437 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent, 2438 String resolvedType, IBinder resultTo, String resultWho, int requestCode, 2439 int startFlags, ProfilerInfo profilerInfo, Bundle options, 2440 int userId) throws RemoteException { 2441 Parcel data = Parcel.obtain(); 2442 Parcel reply = Parcel.obtain(); 2443 data.writeInterfaceToken(IActivityManager.descriptor); 2444 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2445 data.writeString(callingPackage); 2446 intent.writeToParcel(data, 0); 2447 data.writeString(resolvedType); 2448 data.writeStrongBinder(resultTo); 2449 data.writeString(resultWho); 2450 data.writeInt(requestCode); 2451 data.writeInt(startFlags); 2452 if (profilerInfo != null) { 2453 data.writeInt(1); 2454 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 2455 } else { 2456 data.writeInt(0); 2457 } 2458 if (options != null) { 2459 data.writeInt(1); 2460 options.writeToParcel(data, 0); 2461 } else { 2462 data.writeInt(0); 2463 } 2464 data.writeInt(userId); 2465 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0); 2466 reply.readException(); 2467 int result = reply.readInt(); 2468 reply.recycle(); 2469 data.recycle(); 2470 return result; 2471 } 2472 public int startActivityAsCaller(IApplicationThread caller, String callingPackage, 2473 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, 2474 int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId) throws RemoteException { 2475 Parcel data = Parcel.obtain(); 2476 Parcel reply = Parcel.obtain(); 2477 data.writeInterfaceToken(IActivityManager.descriptor); 2478 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2479 data.writeString(callingPackage); 2480 intent.writeToParcel(data, 0); 2481 data.writeString(resolvedType); 2482 data.writeStrongBinder(resultTo); 2483 data.writeString(resultWho); 2484 data.writeInt(requestCode); 2485 data.writeInt(startFlags); 2486 if (profilerInfo != null) { 2487 data.writeInt(1); 2488 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 2489 } else { 2490 data.writeInt(0); 2491 } 2492 if (options != null) { 2493 data.writeInt(1); 2494 options.writeToParcel(data, 0); 2495 } else { 2496 data.writeInt(0); 2497 } 2498 data.writeInt(userId); 2499 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0); 2500 reply.readException(); 2501 int result = reply.readInt(); 2502 reply.recycle(); 2503 data.recycle(); 2504 return result; 2505 } 2506 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage, 2507 Intent intent, String resolvedType, IBinder resultTo, String resultWho, 2508 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options, 2509 int userId) throws RemoteException { 2510 Parcel data = Parcel.obtain(); 2511 Parcel reply = Parcel.obtain(); 2512 data.writeInterfaceToken(IActivityManager.descriptor); 2513 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2514 data.writeString(callingPackage); 2515 intent.writeToParcel(data, 0); 2516 data.writeString(resolvedType); 2517 data.writeStrongBinder(resultTo); 2518 data.writeString(resultWho); 2519 data.writeInt(requestCode); 2520 data.writeInt(startFlags); 2521 if (profilerInfo != null) { 2522 data.writeInt(1); 2523 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 2524 } else { 2525 data.writeInt(0); 2526 } 2527 if (options != null) { 2528 data.writeInt(1); 2529 options.writeToParcel(data, 0); 2530 } else { 2531 data.writeInt(0); 2532 } 2533 data.writeInt(userId); 2534 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0); 2535 reply.readException(); 2536 WaitResult result = WaitResult.CREATOR.createFromParcel(reply); 2537 reply.recycle(); 2538 data.recycle(); 2539 return result; 2540 } 2541 public int startActivityWithConfig(IApplicationThread caller, String callingPackage, 2542 Intent intent, String resolvedType, IBinder resultTo, String resultWho, 2543 int requestCode, int startFlags, Configuration config, 2544 Bundle options, int userId) throws RemoteException { 2545 Parcel data = Parcel.obtain(); 2546 Parcel reply = Parcel.obtain(); 2547 data.writeInterfaceToken(IActivityManager.descriptor); 2548 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2549 data.writeString(callingPackage); 2550 intent.writeToParcel(data, 0); 2551 data.writeString(resolvedType); 2552 data.writeStrongBinder(resultTo); 2553 data.writeString(resultWho); 2554 data.writeInt(requestCode); 2555 data.writeInt(startFlags); 2556 config.writeToParcel(data, 0); 2557 if (options != null) { 2558 data.writeInt(1); 2559 options.writeToParcel(data, 0); 2560 } else { 2561 data.writeInt(0); 2562 } 2563 data.writeInt(userId); 2564 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); 2565 reply.readException(); 2566 int result = reply.readInt(); 2567 reply.recycle(); 2568 data.recycle(); 2569 return result; 2570 } 2571 public int startActivityIntentSender(IApplicationThread caller, 2572 IntentSender intent, Intent fillInIntent, String resolvedType, 2573 IBinder resultTo, String resultWho, int requestCode, 2574 int flagsMask, int flagsValues, Bundle options) throws RemoteException { 2575 Parcel data = Parcel.obtain(); 2576 Parcel reply = Parcel.obtain(); 2577 data.writeInterfaceToken(IActivityManager.descriptor); 2578 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2579 intent.writeToParcel(data, 0); 2580 if (fillInIntent != null) { 2581 data.writeInt(1); 2582 fillInIntent.writeToParcel(data, 0); 2583 } else { 2584 data.writeInt(0); 2585 } 2586 data.writeString(resolvedType); 2587 data.writeStrongBinder(resultTo); 2588 data.writeString(resultWho); 2589 data.writeInt(requestCode); 2590 data.writeInt(flagsMask); 2591 data.writeInt(flagsValues); 2592 if (options != null) { 2593 data.writeInt(1); 2594 options.writeToParcel(data, 0); 2595 } else { 2596 data.writeInt(0); 2597 } 2598 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0); 2599 reply.readException(); 2600 int result = reply.readInt(); 2601 reply.recycle(); 2602 data.recycle(); 2603 return result; 2604 } 2605 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid, 2606 Intent intent, String resolvedType, IVoiceInteractionSession session, 2607 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo, 2608 Bundle options, int userId) throws RemoteException { 2609 Parcel data = Parcel.obtain(); 2610 Parcel reply = Parcel.obtain(); 2611 data.writeInterfaceToken(IActivityManager.descriptor); 2612 data.writeString(callingPackage); 2613 data.writeInt(callingPid); 2614 data.writeInt(callingUid); 2615 intent.writeToParcel(data, 0); 2616 data.writeString(resolvedType); 2617 data.writeStrongBinder(session.asBinder()); 2618 data.writeStrongBinder(interactor.asBinder()); 2619 data.writeInt(startFlags); 2620 if (profilerInfo != null) { 2621 data.writeInt(1); 2622 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 2623 } else { 2624 data.writeInt(0); 2625 } 2626 if (options != null) { 2627 data.writeInt(1); 2628 options.writeToParcel(data, 0); 2629 } else { 2630 data.writeInt(0); 2631 } 2632 data.writeInt(userId); 2633 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0); 2634 reply.readException(); 2635 int result = reply.readInt(); 2636 reply.recycle(); 2637 data.recycle(); 2638 return result; 2639 } 2640 public boolean startNextMatchingActivity(IBinder callingActivity, 2641 Intent intent, Bundle options) throws RemoteException { 2642 Parcel data = Parcel.obtain(); 2643 Parcel reply = Parcel.obtain(); 2644 data.writeInterfaceToken(IActivityManager.descriptor); 2645 data.writeStrongBinder(callingActivity); 2646 intent.writeToParcel(data, 0); 2647 if (options != null) { 2648 data.writeInt(1); 2649 options.writeToParcel(data, 0); 2650 } else { 2651 data.writeInt(0); 2652 } 2653 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0); 2654 reply.readException(); 2655 int result = reply.readInt(); 2656 reply.recycle(); 2657 data.recycle(); 2658 return result != 0; 2659 } 2660 public int startActivityFromRecents(int taskId, Bundle options) throws RemoteException { 2661 Parcel data = Parcel.obtain(); 2662 Parcel reply = Parcel.obtain(); 2663 data.writeInterfaceToken(IActivityManager.descriptor); 2664 data.writeInt(taskId); 2665 if (options == null) { 2666 data.writeInt(0); 2667 } else { 2668 data.writeInt(1); 2669 options.writeToParcel(data, 0); 2670 } 2671 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0); 2672 reply.readException(); 2673 int result = reply.readInt(); 2674 reply.recycle(); 2675 data.recycle(); 2676 return result; 2677 } 2678 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask) 2679 throws RemoteException { 2680 Parcel data = Parcel.obtain(); 2681 Parcel reply = Parcel.obtain(); 2682 data.writeInterfaceToken(IActivityManager.descriptor); 2683 data.writeStrongBinder(token); 2684 data.writeInt(resultCode); 2685 if (resultData != null) { 2686 data.writeInt(1); 2687 resultData.writeToParcel(data, 0); 2688 } else { 2689 data.writeInt(0); 2690 } 2691 data.writeInt(finishTask ? 1 : 0); 2692 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0); 2693 reply.readException(); 2694 boolean res = reply.readInt() != 0; 2695 data.recycle(); 2696 reply.recycle(); 2697 return res; 2698 } 2699 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException 2700 { 2701 Parcel data = Parcel.obtain(); 2702 Parcel reply = Parcel.obtain(); 2703 data.writeInterfaceToken(IActivityManager.descriptor); 2704 data.writeStrongBinder(token); 2705 data.writeString(resultWho); 2706 data.writeInt(requestCode); 2707 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0); 2708 reply.readException(); 2709 data.recycle(); 2710 reply.recycle(); 2711 } 2712 public boolean finishActivityAffinity(IBinder token) throws RemoteException { 2713 Parcel data = Parcel.obtain(); 2714 Parcel reply = Parcel.obtain(); 2715 data.writeInterfaceToken(IActivityManager.descriptor); 2716 data.writeStrongBinder(token); 2717 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0); 2718 reply.readException(); 2719 boolean res = reply.readInt() != 0; 2720 data.recycle(); 2721 reply.recycle(); 2722 return res; 2723 } 2724 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException { 2725 Parcel data = Parcel.obtain(); 2726 Parcel reply = Parcel.obtain(); 2727 data.writeInterfaceToken(IActivityManager.descriptor); 2728 data.writeStrongBinder(session.asBinder()); 2729 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0); 2730 reply.readException(); 2731 data.recycle(); 2732 reply.recycle(); 2733 } 2734 public boolean releaseActivityInstance(IBinder token) throws RemoteException { 2735 Parcel data = Parcel.obtain(); 2736 Parcel reply = Parcel.obtain(); 2737 data.writeInterfaceToken(IActivityManager.descriptor); 2738 data.writeStrongBinder(token); 2739 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0); 2740 reply.readException(); 2741 boolean res = reply.readInt() != 0; 2742 data.recycle(); 2743 reply.recycle(); 2744 return res; 2745 } 2746 public void releaseSomeActivities(IApplicationThread app) throws RemoteException { 2747 Parcel data = Parcel.obtain(); 2748 Parcel reply = Parcel.obtain(); 2749 data.writeInterfaceToken(IActivityManager.descriptor); 2750 data.writeStrongBinder(app.asBinder()); 2751 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0); 2752 reply.readException(); 2753 data.recycle(); 2754 reply.recycle(); 2755 } 2756 public boolean willActivityBeVisible(IBinder token) throws RemoteException { 2757 Parcel data = Parcel.obtain(); 2758 Parcel reply = Parcel.obtain(); 2759 data.writeInterfaceToken(IActivityManager.descriptor); 2760 data.writeStrongBinder(token); 2761 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0); 2762 reply.readException(); 2763 boolean res = reply.readInt() != 0; 2764 data.recycle(); 2765 reply.recycle(); 2766 return res; 2767 } 2768 public Intent registerReceiver(IApplicationThread caller, String packageName, 2769 IIntentReceiver receiver, 2770 IntentFilter filter, String perm, int userId) throws RemoteException 2771 { 2772 Parcel data = Parcel.obtain(); 2773 Parcel reply = Parcel.obtain(); 2774 data.writeInterfaceToken(IActivityManager.descriptor); 2775 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2776 data.writeString(packageName); 2777 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); 2778 filter.writeToParcel(data, 0); 2779 data.writeString(perm); 2780 data.writeInt(userId); 2781 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0); 2782 reply.readException(); 2783 Intent intent = null; 2784 int haveIntent = reply.readInt(); 2785 if (haveIntent != 0) { 2786 intent = Intent.CREATOR.createFromParcel(reply); 2787 } 2788 reply.recycle(); 2789 data.recycle(); 2790 return intent; 2791 } 2792 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException 2793 { 2794 Parcel data = Parcel.obtain(); 2795 Parcel reply = Parcel.obtain(); 2796 data.writeInterfaceToken(IActivityManager.descriptor); 2797 data.writeStrongBinder(receiver.asBinder()); 2798 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0); 2799 reply.readException(); 2800 data.recycle(); 2801 reply.recycle(); 2802 } 2803 public int broadcastIntent(IApplicationThread caller, 2804 Intent intent, String resolvedType, IIntentReceiver resultTo, 2805 int resultCode, String resultData, Bundle map, 2806 String requiredPermission, int appOp, boolean serialized, 2807 boolean sticky, int userId) throws RemoteException 2808 { 2809 Parcel data = Parcel.obtain(); 2810 Parcel reply = Parcel.obtain(); 2811 data.writeInterfaceToken(IActivityManager.descriptor); 2812 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2813 intent.writeToParcel(data, 0); 2814 data.writeString(resolvedType); 2815 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null); 2816 data.writeInt(resultCode); 2817 data.writeString(resultData); 2818 data.writeBundle(map); 2819 data.writeString(requiredPermission); 2820 data.writeInt(appOp); 2821 data.writeInt(serialized ? 1 : 0); 2822 data.writeInt(sticky ? 1 : 0); 2823 data.writeInt(userId); 2824 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0); 2825 reply.readException(); 2826 int res = reply.readInt(); 2827 reply.recycle(); 2828 data.recycle(); 2829 return res; 2830 } 2831 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId) 2832 throws RemoteException 2833 { 2834 Parcel data = Parcel.obtain(); 2835 Parcel reply = Parcel.obtain(); 2836 data.writeInterfaceToken(IActivityManager.descriptor); 2837 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 2838 intent.writeToParcel(data, 0); 2839 data.writeInt(userId); 2840 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0); 2841 reply.readException(); 2842 data.recycle(); 2843 reply.recycle(); 2844 } 2845 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException 2846 { 2847 Parcel data = Parcel.obtain(); 2848 Parcel reply = Parcel.obtain(); 2849 data.writeInterfaceToken(IActivityManager.descriptor); 2850 data.writeStrongBinder(who); 2851 data.writeInt(resultCode); 2852 data.writeString(resultData); 2853 data.writeBundle(map); 2854 data.writeInt(abortBroadcast ? 1 : 0); 2855 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2856 reply.readException(); 2857 data.recycle(); 2858 reply.recycle(); 2859 } 2860 public void attachApplication(IApplicationThread app) throws RemoteException 2861 { 2862 Parcel data = Parcel.obtain(); 2863 Parcel reply = Parcel.obtain(); 2864 data.writeInterfaceToken(IActivityManager.descriptor); 2865 data.writeStrongBinder(app.asBinder()); 2866 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0); 2867 reply.readException(); 2868 data.recycle(); 2869 reply.recycle(); 2870 } 2871 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling) 2872 throws RemoteException 2873 { 2874 Parcel data = Parcel.obtain(); 2875 Parcel reply = Parcel.obtain(); 2876 data.writeInterfaceToken(IActivityManager.descriptor); 2877 data.writeStrongBinder(token); 2878 if (config != null) { 2879 data.writeInt(1); 2880 config.writeToParcel(data, 0); 2881 } else { 2882 data.writeInt(0); 2883 } 2884 data.writeInt(stopProfiling ? 1 : 0); 2885 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2886 reply.readException(); 2887 data.recycle(); 2888 reply.recycle(); 2889 } 2890 public void activityResumed(IBinder token) throws RemoteException 2891 { 2892 Parcel data = Parcel.obtain(); 2893 Parcel reply = Parcel.obtain(); 2894 data.writeInterfaceToken(IActivityManager.descriptor); 2895 data.writeStrongBinder(token); 2896 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0); 2897 reply.readException(); 2898 data.recycle(); 2899 reply.recycle(); 2900 } 2901 public void activityPaused(IBinder token) throws RemoteException 2902 { 2903 Parcel data = Parcel.obtain(); 2904 Parcel reply = Parcel.obtain(); 2905 data.writeInterfaceToken(IActivityManager.descriptor); 2906 data.writeStrongBinder(token); 2907 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0); 2908 reply.readException(); 2909 data.recycle(); 2910 reply.recycle(); 2911 } 2912 public void activityStopped(IBinder token, Bundle state, 2913 PersistableBundle persistentState, CharSequence description) throws RemoteException 2914 { 2915 Parcel data = Parcel.obtain(); 2916 Parcel reply = Parcel.obtain(); 2917 data.writeInterfaceToken(IActivityManager.descriptor); 2918 data.writeStrongBinder(token); 2919 data.writeBundle(state); 2920 data.writePersistableBundle(persistentState); 2921 TextUtils.writeToParcel(description, data, 0); 2922 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2923 reply.readException(); 2924 data.recycle(); 2925 reply.recycle(); 2926 } 2927 public void activitySlept(IBinder token) throws RemoteException 2928 { 2929 Parcel data = Parcel.obtain(); 2930 Parcel reply = Parcel.obtain(); 2931 data.writeInterfaceToken(IActivityManager.descriptor); 2932 data.writeStrongBinder(token); 2933 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2934 reply.readException(); 2935 data.recycle(); 2936 reply.recycle(); 2937 } 2938 public void activityDestroyed(IBinder token) throws RemoteException 2939 { 2940 Parcel data = Parcel.obtain(); 2941 Parcel reply = Parcel.obtain(); 2942 data.writeInterfaceToken(IActivityManager.descriptor); 2943 data.writeStrongBinder(token); 2944 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 2945 reply.readException(); 2946 data.recycle(); 2947 reply.recycle(); 2948 } 2949 public String getCallingPackage(IBinder token) throws RemoteException 2950 { 2951 Parcel data = Parcel.obtain(); 2952 Parcel reply = Parcel.obtain(); 2953 data.writeInterfaceToken(IActivityManager.descriptor); 2954 data.writeStrongBinder(token); 2955 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0); 2956 reply.readException(); 2957 String res = reply.readString(); 2958 data.recycle(); 2959 reply.recycle(); 2960 return res; 2961 } 2962 public ComponentName getCallingActivity(IBinder token) 2963 throws RemoteException { 2964 Parcel data = Parcel.obtain(); 2965 Parcel reply = Parcel.obtain(); 2966 data.writeInterfaceToken(IActivityManager.descriptor); 2967 data.writeStrongBinder(token); 2968 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0); 2969 reply.readException(); 2970 ComponentName res = ComponentName.readFromParcel(reply); 2971 data.recycle(); 2972 reply.recycle(); 2973 return res; 2974 } 2975 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException { 2976 Parcel data = Parcel.obtain(); 2977 Parcel reply = Parcel.obtain(); 2978 data.writeInterfaceToken(IActivityManager.descriptor); 2979 data.writeString(callingPackage); 2980 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0); 2981 reply.readException(); 2982 ArrayList<IAppTask> list = null; 2983 int N = reply.readInt(); 2984 if (N >= 0) { 2985 list = new ArrayList<IAppTask>(); 2986 while (N > 0) { 2987 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder()); 2988 list.add(task); 2989 N--; 2990 } 2991 } 2992 data.recycle(); 2993 reply.recycle(); 2994 return list; 2995 } 2996 public int addAppTask(IBinder activityToken, Intent intent, 2997 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException { 2998 Parcel data = Parcel.obtain(); 2999 Parcel reply = Parcel.obtain(); 3000 data.writeInterfaceToken(IActivityManager.descriptor); 3001 data.writeStrongBinder(activityToken); 3002 intent.writeToParcel(data, 0); 3003 description.writeToParcel(data, 0); 3004 thumbnail.writeToParcel(data, 0); 3005 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0); 3006 reply.readException(); 3007 int res = reply.readInt(); 3008 data.recycle(); 3009 reply.recycle(); 3010 return res; 3011 } 3012 public Point getAppTaskThumbnailSize() throws RemoteException { 3013 Parcel data = Parcel.obtain(); 3014 Parcel reply = Parcel.obtain(); 3015 data.writeInterfaceToken(IActivityManager.descriptor); 3016 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0); 3017 reply.readException(); 3018 Point size = Point.CREATOR.createFromParcel(reply); 3019 data.recycle(); 3020 reply.recycle(); 3021 return size; 3022 } 3023 public List getTasks(int maxNum, int flags) throws RemoteException { 3024 Parcel data = Parcel.obtain(); 3025 Parcel reply = Parcel.obtain(); 3026 data.writeInterfaceToken(IActivityManager.descriptor); 3027 data.writeInt(maxNum); 3028 data.writeInt(flags); 3029 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0); 3030 reply.readException(); 3031 ArrayList list = null; 3032 int N = reply.readInt(); 3033 if (N >= 0) { 3034 list = new ArrayList(); 3035 while (N > 0) { 3036 ActivityManager.RunningTaskInfo info = 3037 ActivityManager.RunningTaskInfo.CREATOR 3038 .createFromParcel(reply); 3039 list.add(info); 3040 N--; 3041 } 3042 } 3043 data.recycle(); 3044 reply.recycle(); 3045 return list; 3046 } 3047 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, 3048 int flags, int userId) throws RemoteException { 3049 Parcel data = Parcel.obtain(); 3050 Parcel reply = Parcel.obtain(); 3051 data.writeInterfaceToken(IActivityManager.descriptor); 3052 data.writeInt(maxNum); 3053 data.writeInt(flags); 3054 data.writeInt(userId); 3055 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0); 3056 reply.readException(); 3057 ArrayList<ActivityManager.RecentTaskInfo> list 3058 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR); 3059 data.recycle(); 3060 reply.recycle(); 3061 return list; 3062 } 3063 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException { 3064 Parcel data = Parcel.obtain(); 3065 Parcel reply = Parcel.obtain(); 3066 data.writeInterfaceToken(IActivityManager.descriptor); 3067 data.writeInt(id); 3068 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0); 3069 reply.readException(); 3070 ActivityManager.TaskThumbnail taskThumbnail = null; 3071 if (reply.readInt() != 0) { 3072 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply); 3073 } 3074 data.recycle(); 3075 reply.recycle(); 3076 return taskThumbnail; 3077 } 3078 public List getServices(int maxNum, int flags) throws RemoteException { 3079 Parcel data = Parcel.obtain(); 3080 Parcel reply = Parcel.obtain(); 3081 data.writeInterfaceToken(IActivityManager.descriptor); 3082 data.writeInt(maxNum); 3083 data.writeInt(flags); 3084 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0); 3085 reply.readException(); 3086 ArrayList list = null; 3087 int N = reply.readInt(); 3088 if (N >= 0) { 3089 list = new ArrayList(); 3090 while (N > 0) { 3091 ActivityManager.RunningServiceInfo info = 3092 ActivityManager.RunningServiceInfo.CREATOR 3093 .createFromParcel(reply); 3094 list.add(info); 3095 N--; 3096 } 3097 } 3098 data.recycle(); 3099 reply.recycle(); 3100 return list; 3101 } 3102 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() 3103 throws RemoteException { 3104 Parcel data = Parcel.obtain(); 3105 Parcel reply = Parcel.obtain(); 3106 data.writeInterfaceToken(IActivityManager.descriptor); 3107 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0); 3108 reply.readException(); 3109 ArrayList<ActivityManager.ProcessErrorStateInfo> list 3110 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR); 3111 data.recycle(); 3112 reply.recycle(); 3113 return list; 3114 } 3115 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() 3116 throws RemoteException { 3117 Parcel data = Parcel.obtain(); 3118 Parcel reply = Parcel.obtain(); 3119 data.writeInterfaceToken(IActivityManager.descriptor); 3120 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0); 3121 reply.readException(); 3122 ArrayList<ActivityManager.RunningAppProcessInfo> list 3123 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR); 3124 data.recycle(); 3125 reply.recycle(); 3126 return list; 3127 } 3128 public List<ApplicationInfo> getRunningExternalApplications() 3129 throws RemoteException { 3130 Parcel data = Parcel.obtain(); 3131 Parcel reply = Parcel.obtain(); 3132 data.writeInterfaceToken(IActivityManager.descriptor); 3133 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0); 3134 reply.readException(); 3135 ArrayList<ApplicationInfo> list 3136 = reply.createTypedArrayList(ApplicationInfo.CREATOR); 3137 data.recycle(); 3138 reply.recycle(); 3139 return list; 3140 } 3141 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException 3142 { 3143 Parcel data = Parcel.obtain(); 3144 Parcel reply = Parcel.obtain(); 3145 data.writeInterfaceToken(IActivityManager.descriptor); 3146 data.writeInt(task); 3147 data.writeInt(flags); 3148 if (options != null) { 3149 data.writeInt(1); 3150 options.writeToParcel(data, 0); 3151 } else { 3152 data.writeInt(0); 3153 } 3154 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0); 3155 reply.readException(); 3156 data.recycle(); 3157 reply.recycle(); 3158 } 3159 public void moveTaskToBack(int task) throws RemoteException 3160 { 3161 Parcel data = Parcel.obtain(); 3162 Parcel reply = Parcel.obtain(); 3163 data.writeInterfaceToken(IActivityManager.descriptor); 3164 data.writeInt(task); 3165 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0); 3166 reply.readException(); 3167 data.recycle(); 3168 reply.recycle(); 3169 } 3170 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) 3171 throws RemoteException { 3172 Parcel data = Parcel.obtain(); 3173 Parcel reply = Parcel.obtain(); 3174 data.writeInterfaceToken(IActivityManager.descriptor); 3175 data.writeStrongBinder(token); 3176 data.writeInt(nonRoot ? 1 : 0); 3177 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0); 3178 reply.readException(); 3179 boolean res = reply.readInt() != 0; 3180 data.recycle(); 3181 reply.recycle(); 3182 return res; 3183 } 3184 public void moveTaskBackwards(int task) throws RemoteException 3185 { 3186 Parcel data = Parcel.obtain(); 3187 Parcel reply = Parcel.obtain(); 3188 data.writeInterfaceToken(IActivityManager.descriptor); 3189 data.writeInt(task); 3190 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0); 3191 reply.readException(); 3192 data.recycle(); 3193 reply.recycle(); 3194 } 3195 @Override 3196 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException 3197 { 3198 Parcel data = Parcel.obtain(); 3199 Parcel reply = Parcel.obtain(); 3200 data.writeInterfaceToken(IActivityManager.descriptor); 3201 data.writeInt(taskId); 3202 data.writeInt(stackId); 3203 data.writeInt(toTop ? 1 : 0); 3204 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0); 3205 reply.readException(); 3206 data.recycle(); 3207 reply.recycle(); 3208 } 3209 @Override 3210 public void resizeStack(int stackBoxId, Rect r) throws RemoteException 3211 { 3212 Parcel data = Parcel.obtain(); 3213 Parcel reply = Parcel.obtain(); 3214 data.writeInterfaceToken(IActivityManager.descriptor); 3215 data.writeInt(stackBoxId); 3216 r.writeToParcel(data, 0); 3217 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3218 reply.readException(); 3219 data.recycle(); 3220 reply.recycle(); 3221 } 3222 @Override 3223 public List<StackInfo> getAllStackInfos() throws RemoteException 3224 { 3225 Parcel data = Parcel.obtain(); 3226 Parcel reply = Parcel.obtain(); 3227 data.writeInterfaceToken(IActivityManager.descriptor); 3228 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0); 3229 reply.readException(); 3230 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR); 3231 data.recycle(); 3232 reply.recycle(); 3233 return list; 3234 } 3235 @Override 3236 public StackInfo getStackInfo(int stackId) throws RemoteException 3237 { 3238 Parcel data = Parcel.obtain(); 3239 Parcel reply = Parcel.obtain(); 3240 data.writeInterfaceToken(IActivityManager.descriptor); 3241 data.writeInt(stackId); 3242 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0); 3243 reply.readException(); 3244 int res = reply.readInt(); 3245 StackInfo info = null; 3246 if (res != 0) { 3247 info = StackInfo.CREATOR.createFromParcel(reply); 3248 } 3249 data.recycle(); 3250 reply.recycle(); 3251 return info; 3252 } 3253 @Override 3254 public boolean isInHomeStack(int taskId) throws RemoteException { 3255 Parcel data = Parcel.obtain(); 3256 Parcel reply = Parcel.obtain(); 3257 data.writeInterfaceToken(IActivityManager.descriptor); 3258 data.writeInt(taskId); 3259 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0); 3260 reply.readException(); 3261 boolean isInHomeStack = reply.readInt() > 0; 3262 data.recycle(); 3263 reply.recycle(); 3264 return isInHomeStack; 3265 } 3266 @Override 3267 public void setFocusedStack(int stackId) throws RemoteException 3268 { 3269 Parcel data = Parcel.obtain(); 3270 Parcel reply = Parcel.obtain(); 3271 data.writeInterfaceToken(IActivityManager.descriptor); 3272 data.writeInt(stackId); 3273 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3274 reply.readException(); 3275 data.recycle(); 3276 reply.recycle(); 3277 } 3278 @Override 3279 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException 3280 { 3281 Parcel data = Parcel.obtain(); 3282 Parcel reply = Parcel.obtain(); 3283 data.writeInterfaceToken(IActivityManager.descriptor); 3284 data.writeStrongBinder(listener.asBinder()); 3285 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3286 reply.readException(); 3287 data.recycle(); 3288 reply.recycle(); 3289 } 3290 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException 3291 { 3292 Parcel data = Parcel.obtain(); 3293 Parcel reply = Parcel.obtain(); 3294 data.writeInterfaceToken(IActivityManager.descriptor); 3295 data.writeStrongBinder(token); 3296 data.writeInt(onlyRoot ? 1 : 0); 3297 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0); 3298 reply.readException(); 3299 int res = reply.readInt(); 3300 data.recycle(); 3301 reply.recycle(); 3302 return res; 3303 } 3304 public ContentProviderHolder getContentProvider(IApplicationThread caller, 3305 String name, int userId, boolean stable) throws RemoteException { 3306 Parcel data = Parcel.obtain(); 3307 Parcel reply = Parcel.obtain(); 3308 data.writeInterfaceToken(IActivityManager.descriptor); 3309 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3310 data.writeString(name); 3311 data.writeInt(userId); 3312 data.writeInt(stable ? 1 : 0); 3313 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 3314 reply.readException(); 3315 int res = reply.readInt(); 3316 ContentProviderHolder cph = null; 3317 if (res != 0) { 3318 cph = ContentProviderHolder.CREATOR.createFromParcel(reply); 3319 } 3320 data.recycle(); 3321 reply.recycle(); 3322 return cph; 3323 } 3324 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token) 3325 throws RemoteException { 3326 Parcel data = Parcel.obtain(); 3327 Parcel reply = Parcel.obtain(); 3328 data.writeInterfaceToken(IActivityManager.descriptor); 3329 data.writeString(name); 3330 data.writeInt(userId); 3331 data.writeStrongBinder(token); 3332 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); 3333 reply.readException(); 3334 int res = reply.readInt(); 3335 ContentProviderHolder cph = null; 3336 if (res != 0) { 3337 cph = ContentProviderHolder.CREATOR.createFromParcel(reply); 3338 } 3339 data.recycle(); 3340 reply.recycle(); 3341 return cph; 3342 } 3343 public void publishContentProviders(IApplicationThread caller, 3344 List<ContentProviderHolder> providers) throws RemoteException 3345 { 3346 Parcel data = Parcel.obtain(); 3347 Parcel reply = Parcel.obtain(); 3348 data.writeInterfaceToken(IActivityManager.descriptor); 3349 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3350 data.writeTypedList(providers); 3351 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0); 3352 reply.readException(); 3353 data.recycle(); 3354 reply.recycle(); 3355 } 3356 public boolean refContentProvider(IBinder connection, int stable, int unstable) 3357 throws RemoteException { 3358 Parcel data = Parcel.obtain(); 3359 Parcel reply = Parcel.obtain(); 3360 data.writeInterfaceToken(IActivityManager.descriptor); 3361 data.writeStrongBinder(connection); 3362 data.writeInt(stable); 3363 data.writeInt(unstable); 3364 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 3365 reply.readException(); 3366 boolean res = reply.readInt() != 0; 3367 data.recycle(); 3368 reply.recycle(); 3369 return res; 3370 } 3371 3372 public void unstableProviderDied(IBinder connection) throws RemoteException { 3373 Parcel data = Parcel.obtain(); 3374 Parcel reply = Parcel.obtain(); 3375 data.writeInterfaceToken(IActivityManager.descriptor); 3376 data.writeStrongBinder(connection); 3377 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0); 3378 reply.readException(); 3379 data.recycle(); 3380 reply.recycle(); 3381 } 3382 3383 @Override 3384 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException { 3385 Parcel data = Parcel.obtain(); 3386 Parcel reply = Parcel.obtain(); 3387 data.writeInterfaceToken(IActivityManager.descriptor); 3388 data.writeStrongBinder(connection); 3389 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0); 3390 reply.readException(); 3391 data.recycle(); 3392 reply.recycle(); 3393 } 3394 3395 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException { 3396 Parcel data = Parcel.obtain(); 3397 Parcel reply = Parcel.obtain(); 3398 data.writeInterfaceToken(IActivityManager.descriptor); 3399 data.writeStrongBinder(connection); 3400 data.writeInt(stable ? 1 : 0); 3401 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 3402 reply.readException(); 3403 data.recycle(); 3404 reply.recycle(); 3405 } 3406 3407 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException { 3408 Parcel data = Parcel.obtain(); 3409 Parcel reply = Parcel.obtain(); 3410 data.writeInterfaceToken(IActivityManager.descriptor); 3411 data.writeString(name); 3412 data.writeStrongBinder(token); 3413 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); 3414 reply.readException(); 3415 data.recycle(); 3416 reply.recycle(); 3417 } 3418 3419 public PendingIntent getRunningServiceControlPanel(ComponentName service) 3420 throws RemoteException 3421 { 3422 Parcel data = Parcel.obtain(); 3423 Parcel reply = Parcel.obtain(); 3424 data.writeInterfaceToken(IActivityManager.descriptor); 3425 service.writeToParcel(data, 0); 3426 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0); 3427 reply.readException(); 3428 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply); 3429 data.recycle(); 3430 reply.recycle(); 3431 return res; 3432 } 3433 3434 public ComponentName startService(IApplicationThread caller, Intent service, 3435 String resolvedType, int userId) throws RemoteException 3436 { 3437 Parcel data = Parcel.obtain(); 3438 Parcel reply = Parcel.obtain(); 3439 data.writeInterfaceToken(IActivityManager.descriptor); 3440 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3441 service.writeToParcel(data, 0); 3442 data.writeString(resolvedType); 3443 data.writeInt(userId); 3444 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0); 3445 reply.readException(); 3446 ComponentName res = ComponentName.readFromParcel(reply); 3447 data.recycle(); 3448 reply.recycle(); 3449 return res; 3450 } 3451 public int stopService(IApplicationThread caller, Intent service, 3452 String resolvedType, int userId) throws RemoteException 3453 { 3454 Parcel data = Parcel.obtain(); 3455 Parcel reply = Parcel.obtain(); 3456 data.writeInterfaceToken(IActivityManager.descriptor); 3457 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3458 service.writeToParcel(data, 0); 3459 data.writeString(resolvedType); 3460 data.writeInt(userId); 3461 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0); 3462 reply.readException(); 3463 int res = reply.readInt(); 3464 reply.recycle(); 3465 data.recycle(); 3466 return res; 3467 } 3468 public boolean stopServiceToken(ComponentName className, IBinder token, 3469 int startId) throws RemoteException { 3470 Parcel data = Parcel.obtain(); 3471 Parcel reply = Parcel.obtain(); 3472 data.writeInterfaceToken(IActivityManager.descriptor); 3473 ComponentName.writeToParcel(className, data); 3474 data.writeStrongBinder(token); 3475 data.writeInt(startId); 3476 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0); 3477 reply.readException(); 3478 boolean res = reply.readInt() != 0; 3479 data.recycle(); 3480 reply.recycle(); 3481 return res; 3482 } 3483 public void setServiceForeground(ComponentName className, IBinder token, 3484 int id, Notification notification, boolean removeNotification) throws RemoteException { 3485 Parcel data = Parcel.obtain(); 3486 Parcel reply = Parcel.obtain(); 3487 data.writeInterfaceToken(IActivityManager.descriptor); 3488 ComponentName.writeToParcel(className, data); 3489 data.writeStrongBinder(token); 3490 data.writeInt(id); 3491 if (notification != null) { 3492 data.writeInt(1); 3493 notification.writeToParcel(data, 0); 3494 } else { 3495 data.writeInt(0); 3496 } 3497 data.writeInt(removeNotification ? 1 : 0); 3498 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0); 3499 reply.readException(); 3500 data.recycle(); 3501 reply.recycle(); 3502 } 3503 public int bindService(IApplicationThread caller, IBinder token, 3504 Intent service, String resolvedType, IServiceConnection connection, 3505 int flags, int userId) throws RemoteException { 3506 Parcel data = Parcel.obtain(); 3507 Parcel reply = Parcel.obtain(); 3508 data.writeInterfaceToken(IActivityManager.descriptor); 3509 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3510 data.writeStrongBinder(token); 3511 service.writeToParcel(data, 0); 3512 data.writeString(resolvedType); 3513 data.writeStrongBinder(connection.asBinder()); 3514 data.writeInt(flags); 3515 data.writeInt(userId); 3516 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0); 3517 reply.readException(); 3518 int res = reply.readInt(); 3519 data.recycle(); 3520 reply.recycle(); 3521 return res; 3522 } 3523 public boolean unbindService(IServiceConnection connection) throws RemoteException 3524 { 3525 Parcel data = Parcel.obtain(); 3526 Parcel reply = Parcel.obtain(); 3527 data.writeInterfaceToken(IActivityManager.descriptor); 3528 data.writeStrongBinder(connection.asBinder()); 3529 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0); 3530 reply.readException(); 3531 boolean res = reply.readInt() != 0; 3532 data.recycle(); 3533 reply.recycle(); 3534 return res; 3535 } 3536 3537 public void publishService(IBinder token, 3538 Intent intent, IBinder service) throws RemoteException { 3539 Parcel data = Parcel.obtain(); 3540 Parcel reply = Parcel.obtain(); 3541 data.writeInterfaceToken(IActivityManager.descriptor); 3542 data.writeStrongBinder(token); 3543 intent.writeToParcel(data, 0); 3544 data.writeStrongBinder(service); 3545 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0); 3546 reply.readException(); 3547 data.recycle(); 3548 reply.recycle(); 3549 } 3550 3551 public void unbindFinished(IBinder token, Intent intent, boolean doRebind) 3552 throws RemoteException { 3553 Parcel data = Parcel.obtain(); 3554 Parcel reply = Parcel.obtain(); 3555 data.writeInterfaceToken(IActivityManager.descriptor); 3556 data.writeStrongBinder(token); 3557 intent.writeToParcel(data, 0); 3558 data.writeInt(doRebind ? 1 : 0); 3559 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0); 3560 reply.readException(); 3561 data.recycle(); 3562 reply.recycle(); 3563 } 3564 3565 public void serviceDoneExecuting(IBinder token, int type, int startId, 3566 int res) throws RemoteException { 3567 Parcel data = Parcel.obtain(); 3568 Parcel reply = Parcel.obtain(); 3569 data.writeInterfaceToken(IActivityManager.descriptor); 3570 data.writeStrongBinder(token); 3571 data.writeInt(type); 3572 data.writeInt(startId); 3573 data.writeInt(res); 3574 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3575 reply.readException(); 3576 data.recycle(); 3577 reply.recycle(); 3578 } 3579 3580 public IBinder peekService(Intent service, String resolvedType) throws RemoteException { 3581 Parcel data = Parcel.obtain(); 3582 Parcel reply = Parcel.obtain(); 3583 data.writeInterfaceToken(IActivityManager.descriptor); 3584 service.writeToParcel(data, 0); 3585 data.writeString(resolvedType); 3586 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0); 3587 reply.readException(); 3588 IBinder binder = reply.readStrongBinder(); 3589 reply.recycle(); 3590 data.recycle(); 3591 return binder; 3592 } 3593 3594 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode) 3595 throws RemoteException { 3596 Parcel data = Parcel.obtain(); 3597 Parcel reply = Parcel.obtain(); 3598 data.writeInterfaceToken(IActivityManager.descriptor); 3599 app.writeToParcel(data, 0); 3600 data.writeInt(backupRestoreMode); 3601 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0); 3602 reply.readException(); 3603 boolean success = reply.readInt() != 0; 3604 reply.recycle(); 3605 data.recycle(); 3606 return success; 3607 } 3608 3609 public void clearPendingBackup() throws RemoteException { 3610 Parcel data = Parcel.obtain(); 3611 Parcel reply = Parcel.obtain(); 3612 data.writeInterfaceToken(IActivityManager.descriptor); 3613 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0); 3614 reply.recycle(); 3615 data.recycle(); 3616 } 3617 3618 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException { 3619 Parcel data = Parcel.obtain(); 3620 Parcel reply = Parcel.obtain(); 3621 data.writeInterfaceToken(IActivityManager.descriptor); 3622 data.writeString(packageName); 3623 data.writeStrongBinder(agent); 3624 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0); 3625 reply.recycle(); 3626 data.recycle(); 3627 } 3628 3629 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException { 3630 Parcel data = Parcel.obtain(); 3631 Parcel reply = Parcel.obtain(); 3632 data.writeInterfaceToken(IActivityManager.descriptor); 3633 app.writeToParcel(data, 0); 3634 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0); 3635 reply.readException(); 3636 reply.recycle(); 3637 data.recycle(); 3638 } 3639 3640 public boolean startInstrumentation(ComponentName className, String profileFile, 3641 int flags, Bundle arguments, IInstrumentationWatcher watcher, 3642 IUiAutomationConnection connection, int userId, String instructionSet) 3643 throws RemoteException { 3644 Parcel data = Parcel.obtain(); 3645 Parcel reply = Parcel.obtain(); 3646 data.writeInterfaceToken(IActivityManager.descriptor); 3647 ComponentName.writeToParcel(className, data); 3648 data.writeString(profileFile); 3649 data.writeInt(flags); 3650 data.writeBundle(arguments); 3651 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); 3652 data.writeStrongBinder(connection != null ? connection.asBinder() : null); 3653 data.writeInt(userId); 3654 data.writeString(instructionSet); 3655 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0); 3656 reply.readException(); 3657 boolean res = reply.readInt() != 0; 3658 reply.recycle(); 3659 data.recycle(); 3660 return res; 3661 } 3662 3663 public void finishInstrumentation(IApplicationThread target, 3664 int resultCode, Bundle results) throws RemoteException { 3665 Parcel data = Parcel.obtain(); 3666 Parcel reply = Parcel.obtain(); 3667 data.writeInterfaceToken(IActivityManager.descriptor); 3668 data.writeStrongBinder(target != null ? target.asBinder() : null); 3669 data.writeInt(resultCode); 3670 data.writeBundle(results); 3671 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0); 3672 reply.readException(); 3673 data.recycle(); 3674 reply.recycle(); 3675 } 3676 public Configuration getConfiguration() throws RemoteException 3677 { 3678 Parcel data = Parcel.obtain(); 3679 Parcel reply = Parcel.obtain(); 3680 data.writeInterfaceToken(IActivityManager.descriptor); 3681 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0); 3682 reply.readException(); 3683 Configuration res = Configuration.CREATOR.createFromParcel(reply); 3684 reply.recycle(); 3685 data.recycle(); 3686 return res; 3687 } 3688 public void updateConfiguration(Configuration values) throws RemoteException 3689 { 3690 Parcel data = Parcel.obtain(); 3691 Parcel reply = Parcel.obtain(); 3692 data.writeInterfaceToken(IActivityManager.descriptor); 3693 values.writeToParcel(data, 0); 3694 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0); 3695 reply.readException(); 3696 data.recycle(); 3697 reply.recycle(); 3698 } 3699 public void setRequestedOrientation(IBinder token, int requestedOrientation) 3700 throws RemoteException { 3701 Parcel data = Parcel.obtain(); 3702 Parcel reply = Parcel.obtain(); 3703 data.writeInterfaceToken(IActivityManager.descriptor); 3704 data.writeStrongBinder(token); 3705 data.writeInt(requestedOrientation); 3706 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); 3707 reply.readException(); 3708 data.recycle(); 3709 reply.recycle(); 3710 } 3711 public int getRequestedOrientation(IBinder token) throws RemoteException { 3712 Parcel data = Parcel.obtain(); 3713 Parcel reply = Parcel.obtain(); 3714 data.writeInterfaceToken(IActivityManager.descriptor); 3715 data.writeStrongBinder(token); 3716 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); 3717 reply.readException(); 3718 int res = reply.readInt(); 3719 data.recycle(); 3720 reply.recycle(); 3721 return res; 3722 } 3723 public ComponentName getActivityClassForToken(IBinder token) 3724 throws RemoteException { 3725 Parcel data = Parcel.obtain(); 3726 Parcel reply = Parcel.obtain(); 3727 data.writeInterfaceToken(IActivityManager.descriptor); 3728 data.writeStrongBinder(token); 3729 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0); 3730 reply.readException(); 3731 ComponentName res = ComponentName.readFromParcel(reply); 3732 data.recycle(); 3733 reply.recycle(); 3734 return res; 3735 } 3736 public String getPackageForToken(IBinder token) throws RemoteException 3737 { 3738 Parcel data = Parcel.obtain(); 3739 Parcel reply = Parcel.obtain(); 3740 data.writeInterfaceToken(IActivityManager.descriptor); 3741 data.writeStrongBinder(token); 3742 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0); 3743 reply.readException(); 3744 String res = reply.readString(); 3745 data.recycle(); 3746 reply.recycle(); 3747 return res; 3748 } 3749 public IIntentSender getIntentSender(int type, 3750 String packageName, IBinder token, String resultWho, 3751 int requestCode, Intent[] intents, String[] resolvedTypes, int flags, 3752 Bundle options, int userId) throws RemoteException { 3753 Parcel data = Parcel.obtain(); 3754 Parcel reply = Parcel.obtain(); 3755 data.writeInterfaceToken(IActivityManager.descriptor); 3756 data.writeInt(type); 3757 data.writeString(packageName); 3758 data.writeStrongBinder(token); 3759 data.writeString(resultWho); 3760 data.writeInt(requestCode); 3761 if (intents != null) { 3762 data.writeInt(1); 3763 data.writeTypedArray(intents, 0); 3764 data.writeStringArray(resolvedTypes); 3765 } else { 3766 data.writeInt(0); 3767 } 3768 data.writeInt(flags); 3769 if (options != null) { 3770 data.writeInt(1); 3771 options.writeToParcel(data, 0); 3772 } else { 3773 data.writeInt(0); 3774 } 3775 data.writeInt(userId); 3776 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0); 3777 reply.readException(); 3778 IIntentSender res = IIntentSender.Stub.asInterface( 3779 reply.readStrongBinder()); 3780 data.recycle(); 3781 reply.recycle(); 3782 return res; 3783 } 3784 public void cancelIntentSender(IIntentSender sender) throws RemoteException { 3785 Parcel data = Parcel.obtain(); 3786 Parcel reply = Parcel.obtain(); 3787 data.writeInterfaceToken(IActivityManager.descriptor); 3788 data.writeStrongBinder(sender.asBinder()); 3789 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0); 3790 reply.readException(); 3791 data.recycle(); 3792 reply.recycle(); 3793 } 3794 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException { 3795 Parcel data = Parcel.obtain(); 3796 Parcel reply = Parcel.obtain(); 3797 data.writeInterfaceToken(IActivityManager.descriptor); 3798 data.writeStrongBinder(sender.asBinder()); 3799 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 3800 reply.readException(); 3801 String res = reply.readString(); 3802 data.recycle(); 3803 reply.recycle(); 3804 return res; 3805 } 3806 public int getUidForIntentSender(IIntentSender sender) throws RemoteException { 3807 Parcel data = Parcel.obtain(); 3808 Parcel reply = Parcel.obtain(); 3809 data.writeInterfaceToken(IActivityManager.descriptor); 3810 data.writeStrongBinder(sender.asBinder()); 3811 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 3812 reply.readException(); 3813 int res = reply.readInt(); 3814 data.recycle(); 3815 reply.recycle(); 3816 return res; 3817 } 3818 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, 3819 boolean requireFull, String name, String callerPackage) throws RemoteException { 3820 Parcel data = Parcel.obtain(); 3821 Parcel reply = Parcel.obtain(); 3822 data.writeInterfaceToken(IActivityManager.descriptor); 3823 data.writeInt(callingPid); 3824 data.writeInt(callingUid); 3825 data.writeInt(userId); 3826 data.writeInt(allowAll ? 1 : 0); 3827 data.writeInt(requireFull ? 1 : 0); 3828 data.writeString(name); 3829 data.writeString(callerPackage); 3830 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0); 3831 reply.readException(); 3832 int res = reply.readInt(); 3833 data.recycle(); 3834 reply.recycle(); 3835 return res; 3836 } 3837 public void setProcessLimit(int max) throws RemoteException 3838 { 3839 Parcel data = Parcel.obtain(); 3840 Parcel reply = Parcel.obtain(); 3841 data.writeInterfaceToken(IActivityManager.descriptor); 3842 data.writeInt(max); 3843 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); 3844 reply.readException(); 3845 data.recycle(); 3846 reply.recycle(); 3847 } 3848 public int getProcessLimit() throws RemoteException 3849 { 3850 Parcel data = Parcel.obtain(); 3851 Parcel reply = Parcel.obtain(); 3852 data.writeInterfaceToken(IActivityManager.descriptor); 3853 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); 3854 reply.readException(); 3855 int res = reply.readInt(); 3856 data.recycle(); 3857 reply.recycle(); 3858 return res; 3859 } 3860 public void setProcessForeground(IBinder token, int pid, 3861 boolean isForeground) throws RemoteException { 3862 Parcel data = Parcel.obtain(); 3863 Parcel reply = Parcel.obtain(); 3864 data.writeInterfaceToken(IActivityManager.descriptor); 3865 data.writeStrongBinder(token); 3866 data.writeInt(pid); 3867 data.writeInt(isForeground ? 1 : 0); 3868 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0); 3869 reply.readException(); 3870 data.recycle(); 3871 reply.recycle(); 3872 } 3873 public int checkPermission(String permission, int pid, int uid) 3874 throws RemoteException { 3875 Parcel data = Parcel.obtain(); 3876 Parcel reply = Parcel.obtain(); 3877 data.writeInterfaceToken(IActivityManager.descriptor); 3878 data.writeString(permission); 3879 data.writeInt(pid); 3880 data.writeInt(uid); 3881 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0); 3882 reply.readException(); 3883 int res = reply.readInt(); 3884 data.recycle(); 3885 reply.recycle(); 3886 return res; 3887 } 3888 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken) 3889 throws RemoteException { 3890 Parcel data = Parcel.obtain(); 3891 Parcel reply = Parcel.obtain(); 3892 data.writeInterfaceToken(IActivityManager.descriptor); 3893 data.writeString(permission); 3894 data.writeInt(pid); 3895 data.writeInt(uid); 3896 data.writeStrongBinder(callerToken); 3897 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0); 3898 reply.readException(); 3899 int res = reply.readInt(); 3900 data.recycle(); 3901 reply.recycle(); 3902 return res; 3903 } 3904 public boolean clearApplicationUserData(final String packageName, 3905 final IPackageDataObserver observer, final int userId) throws RemoteException { 3906 Parcel data = Parcel.obtain(); 3907 Parcel reply = Parcel.obtain(); 3908 data.writeInterfaceToken(IActivityManager.descriptor); 3909 data.writeString(packageName); 3910 data.writeStrongBinder((observer != null) ? observer.asBinder() : null); 3911 data.writeInt(userId); 3912 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0); 3913 reply.readException(); 3914 boolean res = reply.readInt() != 0; 3915 data.recycle(); 3916 reply.recycle(); 3917 return res; 3918 } 3919 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId, 3920 IBinder callerToken) throws RemoteException { 3921 Parcel data = Parcel.obtain(); 3922 Parcel reply = Parcel.obtain(); 3923 data.writeInterfaceToken(IActivityManager.descriptor); 3924 uri.writeToParcel(data, 0); 3925 data.writeInt(pid); 3926 data.writeInt(uid); 3927 data.writeInt(mode); 3928 data.writeInt(userId); 3929 data.writeStrongBinder(callerToken); 3930 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0); 3931 reply.readException(); 3932 int res = reply.readInt(); 3933 data.recycle(); 3934 reply.recycle(); 3935 return res; 3936 } 3937 public void grantUriPermission(IApplicationThread caller, String targetPkg, 3938 Uri uri, int mode, int userId) throws RemoteException { 3939 Parcel data = Parcel.obtain(); 3940 Parcel reply = Parcel.obtain(); 3941 data.writeInterfaceToken(IActivityManager.descriptor); 3942 data.writeStrongBinder(caller.asBinder()); 3943 data.writeString(targetPkg); 3944 uri.writeToParcel(data, 0); 3945 data.writeInt(mode); 3946 data.writeInt(userId); 3947 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 3948 reply.readException(); 3949 data.recycle(); 3950 reply.recycle(); 3951 } 3952 public void revokeUriPermission(IApplicationThread caller, Uri uri, 3953 int mode, int userId) throws RemoteException { 3954 Parcel data = Parcel.obtain(); 3955 Parcel reply = Parcel.obtain(); 3956 data.writeInterfaceToken(IActivityManager.descriptor); 3957 data.writeStrongBinder(caller.asBinder()); 3958 uri.writeToParcel(data, 0); 3959 data.writeInt(mode); 3960 data.writeInt(userId); 3961 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); 3962 reply.readException(); 3963 data.recycle(); 3964 reply.recycle(); 3965 } 3966 3967 @Override 3968 public void takePersistableUriPermission(Uri uri, int mode, int userId) 3969 throws RemoteException { 3970 Parcel data = Parcel.obtain(); 3971 Parcel reply = Parcel.obtain(); 3972 data.writeInterfaceToken(IActivityManager.descriptor); 3973 uri.writeToParcel(data, 0); 3974 data.writeInt(mode); 3975 data.writeInt(userId); 3976 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0); 3977 reply.readException(); 3978 data.recycle(); 3979 reply.recycle(); 3980 } 3981 3982 @Override 3983 public void releasePersistableUriPermission(Uri uri, int mode, int userId) 3984 throws RemoteException { 3985 Parcel data = Parcel.obtain(); 3986 Parcel reply = Parcel.obtain(); 3987 data.writeInterfaceToken(IActivityManager.descriptor); 3988 uri.writeToParcel(data, 0); 3989 data.writeInt(mode); 3990 data.writeInt(userId); 3991 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0); 3992 reply.readException(); 3993 data.recycle(); 3994 reply.recycle(); 3995 } 3996 3997 @Override 3998 public ParceledListSlice<UriPermission> getPersistedUriPermissions( 3999 String packageName, boolean incoming) throws RemoteException { 4000 Parcel data = Parcel.obtain(); 4001 Parcel reply = Parcel.obtain(); 4002 data.writeInterfaceToken(IActivityManager.descriptor); 4003 data.writeString(packageName); 4004 data.writeInt(incoming ? 1 : 0); 4005 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0); 4006 reply.readException(); 4007 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel( 4008 reply); 4009 data.recycle(); 4010 reply.recycle(); 4011 return perms; 4012 } 4013 4014 public void showWaitingForDebugger(IApplicationThread who, boolean waiting) 4015 throws RemoteException { 4016 Parcel data = Parcel.obtain(); 4017 Parcel reply = Parcel.obtain(); 4018 data.writeInterfaceToken(IActivityManager.descriptor); 4019 data.writeStrongBinder(who.asBinder()); 4020 data.writeInt(waiting ? 1 : 0); 4021 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0); 4022 reply.readException(); 4023 data.recycle(); 4024 reply.recycle(); 4025 } 4026 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException { 4027 Parcel data = Parcel.obtain(); 4028 Parcel reply = Parcel.obtain(); 4029 data.writeInterfaceToken(IActivityManager.descriptor); 4030 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0); 4031 reply.readException(); 4032 outInfo.readFromParcel(reply); 4033 data.recycle(); 4034 reply.recycle(); 4035 } 4036 public void unhandledBack() throws RemoteException 4037 { 4038 Parcel data = Parcel.obtain(); 4039 Parcel reply = Parcel.obtain(); 4040 data.writeInterfaceToken(IActivityManager.descriptor); 4041 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0); 4042 reply.readException(); 4043 data.recycle(); 4044 reply.recycle(); 4045 } 4046 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException 4047 { 4048 Parcel data = Parcel.obtain(); 4049 Parcel reply = Parcel.obtain(); 4050 data.writeInterfaceToken(IActivityManager.descriptor); 4051 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0); 4052 reply.readException(); 4053 ParcelFileDescriptor pfd = null; 4054 if (reply.readInt() != 0) { 4055 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply); 4056 } 4057 data.recycle(); 4058 reply.recycle(); 4059 return pfd; 4060 } 4061 public void setLockScreenShown(boolean shown) throws RemoteException 4062 { 4063 Parcel data = Parcel.obtain(); 4064 Parcel reply = Parcel.obtain(); 4065 data.writeInterfaceToken(IActivityManager.descriptor); 4066 data.writeInt(shown ? 1 : 0); 4067 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0); 4068 reply.readException(); 4069 data.recycle(); 4070 reply.recycle(); 4071 } 4072 public void setDebugApp( 4073 String packageName, boolean waitForDebugger, boolean persistent) 4074 throws RemoteException 4075 { 4076 Parcel data = Parcel.obtain(); 4077 Parcel reply = Parcel.obtain(); 4078 data.writeInterfaceToken(IActivityManager.descriptor); 4079 data.writeString(packageName); 4080 data.writeInt(waitForDebugger ? 1 : 0); 4081 data.writeInt(persistent ? 1 : 0); 4082 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0); 4083 reply.readException(); 4084 data.recycle(); 4085 reply.recycle(); 4086 } 4087 public void setAlwaysFinish(boolean enabled) throws RemoteException 4088 { 4089 Parcel data = Parcel.obtain(); 4090 Parcel reply = Parcel.obtain(); 4091 data.writeInterfaceToken(IActivityManager.descriptor); 4092 data.writeInt(enabled ? 1 : 0); 4093 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0); 4094 reply.readException(); 4095 data.recycle(); 4096 reply.recycle(); 4097 } 4098 public void setActivityController(IActivityController watcher) throws RemoteException 4099 { 4100 Parcel data = Parcel.obtain(); 4101 Parcel reply = Parcel.obtain(); 4102 data.writeInterfaceToken(IActivityManager.descriptor); 4103 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); 4104 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0); 4105 reply.readException(); 4106 data.recycle(); 4107 reply.recycle(); 4108 } 4109 public void enterSafeMode() throws RemoteException { 4110 Parcel data = Parcel.obtain(); 4111 data.writeInterfaceToken(IActivityManager.descriptor); 4112 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0); 4113 data.recycle(); 4114 } 4115 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg) 4116 throws RemoteException { 4117 Parcel data = Parcel.obtain(); 4118 data.writeInterfaceToken(IActivityManager.descriptor); 4119 data.writeStrongBinder(sender.asBinder()); 4120 data.writeInt(sourceUid); 4121 data.writeString(sourcePkg); 4122 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0); 4123 data.recycle(); 4124 } 4125 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException { 4126 Parcel data = Parcel.obtain(); 4127 Parcel reply = Parcel.obtain(); 4128 data.writeInterfaceToken(IActivityManager.descriptor); 4129 data.writeIntArray(pids); 4130 data.writeString(reason); 4131 data.writeInt(secure ? 1 : 0); 4132 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0); 4133 reply.readException(); 4134 boolean res = reply.readInt() != 0; 4135 data.recycle(); 4136 reply.recycle(); 4137 return res; 4138 } 4139 @Override 4140 public boolean killProcessesBelowForeground(String reason) throws RemoteException { 4141 Parcel data = Parcel.obtain(); 4142 Parcel reply = Parcel.obtain(); 4143 data.writeInterfaceToken(IActivityManager.descriptor); 4144 data.writeString(reason); 4145 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0); 4146 boolean res = reply.readInt() != 0; 4147 data.recycle(); 4148 reply.recycle(); 4149 return res; 4150 } 4151 public boolean testIsSystemReady() 4152 { 4153 /* this base class version is never called */ 4154 return true; 4155 } 4156 public void handleApplicationCrash(IBinder app, 4157 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException 4158 { 4159 Parcel data = Parcel.obtain(); 4160 Parcel reply = Parcel.obtain(); 4161 data.writeInterfaceToken(IActivityManager.descriptor); 4162 data.writeStrongBinder(app); 4163 crashInfo.writeToParcel(data, 0); 4164 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0); 4165 reply.readException(); 4166 reply.recycle(); 4167 data.recycle(); 4168 } 4169 4170 public boolean handleApplicationWtf(IBinder app, String tag, boolean system, 4171 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException 4172 { 4173 Parcel data = Parcel.obtain(); 4174 Parcel reply = Parcel.obtain(); 4175 data.writeInterfaceToken(IActivityManager.descriptor); 4176 data.writeStrongBinder(app); 4177 data.writeString(tag); 4178 data.writeInt(system ? 1 : 0); 4179 crashInfo.writeToParcel(data, 0); 4180 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0); 4181 reply.readException(); 4182 boolean res = reply.readInt() != 0; 4183 reply.recycle(); 4184 data.recycle(); 4185 return res; 4186 } 4187 4188 public void handleApplicationStrictModeViolation(IBinder app, 4189 int violationMask, 4190 StrictMode.ViolationInfo info) throws RemoteException 4191 { 4192 Parcel data = Parcel.obtain(); 4193 Parcel reply = Parcel.obtain(); 4194 data.writeInterfaceToken(IActivityManager.descriptor); 4195 data.writeStrongBinder(app); 4196 data.writeInt(violationMask); 4197 info.writeToParcel(data, 0); 4198 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0); 4199 reply.readException(); 4200 reply.recycle(); 4201 data.recycle(); 4202 } 4203 4204 public void signalPersistentProcesses(int sig) throws RemoteException { 4205 Parcel data = Parcel.obtain(); 4206 Parcel reply = Parcel.obtain(); 4207 data.writeInterfaceToken(IActivityManager.descriptor); 4208 data.writeInt(sig); 4209 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0); 4210 reply.readException(); 4211 data.recycle(); 4212 reply.recycle(); 4213 } 4214 4215 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException { 4216 Parcel data = Parcel.obtain(); 4217 Parcel reply = Parcel.obtain(); 4218 data.writeInterfaceToken(IActivityManager.descriptor); 4219 data.writeString(packageName); 4220 data.writeInt(userId); 4221 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); 4222 reply.readException(); 4223 data.recycle(); 4224 reply.recycle(); 4225 } 4226 4227 public void killAllBackgroundProcesses() throws RemoteException { 4228 Parcel data = Parcel.obtain(); 4229 Parcel reply = Parcel.obtain(); 4230 data.writeInterfaceToken(IActivityManager.descriptor); 4231 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); 4232 reply.readException(); 4233 data.recycle(); 4234 reply.recycle(); 4235 } 4236 4237 public void forceStopPackage(String packageName, int userId) throws RemoteException { 4238 Parcel data = Parcel.obtain(); 4239 Parcel reply = Parcel.obtain(); 4240 data.writeInterfaceToken(IActivityManager.descriptor); 4241 data.writeString(packageName); 4242 data.writeInt(userId); 4243 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0); 4244 reply.readException(); 4245 data.recycle(); 4246 reply.recycle(); 4247 } 4248 4249 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo) 4250 throws RemoteException 4251 { 4252 Parcel data = Parcel.obtain(); 4253 Parcel reply = Parcel.obtain(); 4254 data.writeInterfaceToken(IActivityManager.descriptor); 4255 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0); 4256 reply.readException(); 4257 outInfo.readFromParcel(reply); 4258 reply.recycle(); 4259 data.recycle(); 4260 } 4261 4262 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException 4263 { 4264 Parcel data = Parcel.obtain(); 4265 Parcel reply = Parcel.obtain(); 4266 data.writeInterfaceToken(IActivityManager.descriptor); 4267 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0); 4268 reply.readException(); 4269 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply); 4270 reply.recycle(); 4271 data.recycle(); 4272 return res; 4273 } 4274 4275 public boolean profileControl(String process, int userId, boolean start, 4276 ProfilerInfo profilerInfo, int profileType) throws RemoteException 4277 { 4278 Parcel data = Parcel.obtain(); 4279 Parcel reply = Parcel.obtain(); 4280 data.writeInterfaceToken(IActivityManager.descriptor); 4281 data.writeString(process); 4282 data.writeInt(userId); 4283 data.writeInt(start ? 1 : 0); 4284 data.writeInt(profileType); 4285 if (profilerInfo != null) { 4286 data.writeInt(1); 4287 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 4288 } else { 4289 data.writeInt(0); 4290 } 4291 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0); 4292 reply.readException(); 4293 boolean res = reply.readInt() != 0; 4294 reply.recycle(); 4295 data.recycle(); 4296 return res; 4297 } 4298 4299 public boolean shutdown(int timeout) throws RemoteException 4300 { 4301 Parcel data = Parcel.obtain(); 4302 Parcel reply = Parcel.obtain(); 4303 data.writeInterfaceToken(IActivityManager.descriptor); 4304 data.writeInt(timeout); 4305 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0); 4306 reply.readException(); 4307 boolean res = reply.readInt() != 0; 4308 reply.recycle(); 4309 data.recycle(); 4310 return res; 4311 } 4312 4313 public void stopAppSwitches() throws RemoteException { 4314 Parcel data = Parcel.obtain(); 4315 Parcel reply = Parcel.obtain(); 4316 data.writeInterfaceToken(IActivityManager.descriptor); 4317 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0); 4318 reply.readException(); 4319 reply.recycle(); 4320 data.recycle(); 4321 } 4322 4323 public void resumeAppSwitches() throws RemoteException { 4324 Parcel data = Parcel.obtain(); 4325 Parcel reply = Parcel.obtain(); 4326 data.writeInterfaceToken(IActivityManager.descriptor); 4327 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0); 4328 reply.readException(); 4329 reply.recycle(); 4330 data.recycle(); 4331 } 4332 4333 public void addPackageDependency(String packageName) throws RemoteException { 4334 Parcel data = Parcel.obtain(); 4335 Parcel reply = Parcel.obtain(); 4336 data.writeInterfaceToken(IActivityManager.descriptor); 4337 data.writeString(packageName); 4338 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0); 4339 reply.readException(); 4340 data.recycle(); 4341 reply.recycle(); 4342 } 4343 4344 public void killApplicationWithAppId(String pkg, int appid, String reason) 4345 throws RemoteException { 4346 Parcel data = Parcel.obtain(); 4347 Parcel reply = Parcel.obtain(); 4348 data.writeInterfaceToken(IActivityManager.descriptor); 4349 data.writeString(pkg); 4350 data.writeInt(appid); 4351 data.writeString(reason); 4352 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0); 4353 reply.readException(); 4354 data.recycle(); 4355 reply.recycle(); 4356 } 4357 4358 public void closeSystemDialogs(String reason) throws RemoteException { 4359 Parcel data = Parcel.obtain(); 4360 Parcel reply = Parcel.obtain(); 4361 data.writeInterfaceToken(IActivityManager.descriptor); 4362 data.writeString(reason); 4363 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0); 4364 reply.readException(); 4365 data.recycle(); 4366 reply.recycle(); 4367 } 4368 4369 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) 4370 throws RemoteException { 4371 Parcel data = Parcel.obtain(); 4372 Parcel reply = Parcel.obtain(); 4373 data.writeInterfaceToken(IActivityManager.descriptor); 4374 data.writeIntArray(pids); 4375 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0); 4376 reply.readException(); 4377 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR); 4378 data.recycle(); 4379 reply.recycle(); 4380 return res; 4381 } 4382 4383 public void killApplicationProcess(String processName, int uid) throws RemoteException { 4384 Parcel data = Parcel.obtain(); 4385 Parcel reply = Parcel.obtain(); 4386 data.writeInterfaceToken(IActivityManager.descriptor); 4387 data.writeString(processName); 4388 data.writeInt(uid); 4389 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0); 4390 reply.readException(); 4391 data.recycle(); 4392 reply.recycle(); 4393 } 4394 4395 public void overridePendingTransition(IBinder token, String packageName, 4396 int enterAnim, int exitAnim) throws RemoteException { 4397 Parcel data = Parcel.obtain(); 4398 Parcel reply = Parcel.obtain(); 4399 data.writeInterfaceToken(IActivityManager.descriptor); 4400 data.writeStrongBinder(token); 4401 data.writeString(packageName); 4402 data.writeInt(enterAnim); 4403 data.writeInt(exitAnim); 4404 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0); 4405 reply.readException(); 4406 data.recycle(); 4407 reply.recycle(); 4408 } 4409 4410 public boolean isUserAMonkey() throws RemoteException { 4411 Parcel data = Parcel.obtain(); 4412 Parcel reply = Parcel.obtain(); 4413 data.writeInterfaceToken(IActivityManager.descriptor); 4414 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0); 4415 reply.readException(); 4416 boolean res = reply.readInt() != 0; 4417 data.recycle(); 4418 reply.recycle(); 4419 return res; 4420 } 4421 4422 public void setUserIsMonkey(boolean monkey) throws RemoteException { 4423 Parcel data = Parcel.obtain(); 4424 Parcel reply = Parcel.obtain(); 4425 data.writeInterfaceToken(IActivityManager.descriptor); 4426 data.writeInt(monkey ? 1 : 0); 4427 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0); 4428 reply.readException(); 4429 data.recycle(); 4430 reply.recycle(); 4431 } 4432 4433 public void finishHeavyWeightApp() throws RemoteException { 4434 Parcel data = Parcel.obtain(); 4435 Parcel reply = Parcel.obtain(); 4436 data.writeInterfaceToken(IActivityManager.descriptor); 4437 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0); 4438 reply.readException(); 4439 data.recycle(); 4440 reply.recycle(); 4441 } 4442 4443 public boolean convertFromTranslucent(IBinder token) 4444 throws RemoteException { 4445 Parcel data = Parcel.obtain(); 4446 Parcel reply = Parcel.obtain(); 4447 data.writeInterfaceToken(IActivityManager.descriptor); 4448 data.writeStrongBinder(token); 4449 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0); 4450 reply.readException(); 4451 boolean res = reply.readInt() != 0; 4452 data.recycle(); 4453 reply.recycle(); 4454 return res; 4455 } 4456 4457 public boolean convertToTranslucent(IBinder token, ActivityOptions options) 4458 throws RemoteException { 4459 Parcel data = Parcel.obtain(); 4460 Parcel reply = Parcel.obtain(); 4461 data.writeInterfaceToken(IActivityManager.descriptor); 4462 data.writeStrongBinder(token); 4463 if (options == null) { 4464 data.writeInt(0); 4465 } else { 4466 data.writeInt(1); 4467 data.writeBundle(options.toBundle()); 4468 } 4469 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0); 4470 reply.readException(); 4471 boolean res = reply.readInt() != 0; 4472 data.recycle(); 4473 reply.recycle(); 4474 return res; 4475 } 4476 4477 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException { 4478 Parcel data = Parcel.obtain(); 4479 Parcel reply = Parcel.obtain(); 4480 data.writeInterfaceToken(IActivityManager.descriptor); 4481 data.writeStrongBinder(token); 4482 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0); 4483 reply.readException(); 4484 Bundle bundle = reply.readBundle(); 4485 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle); 4486 data.recycle(); 4487 reply.recycle(); 4488 return options; 4489 } 4490 4491 public void setImmersive(IBinder token, boolean immersive) 4492 throws RemoteException { 4493 Parcel data = Parcel.obtain(); 4494 Parcel reply = Parcel.obtain(); 4495 data.writeInterfaceToken(IActivityManager.descriptor); 4496 data.writeStrongBinder(token); 4497 data.writeInt(immersive ? 1 : 0); 4498 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0); 4499 reply.readException(); 4500 data.recycle(); 4501 reply.recycle(); 4502 } 4503 4504 public boolean isImmersive(IBinder token) 4505 throws RemoteException { 4506 Parcel data = Parcel.obtain(); 4507 Parcel reply = Parcel.obtain(); 4508 data.writeInterfaceToken(IActivityManager.descriptor); 4509 data.writeStrongBinder(token); 4510 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0); 4511 reply.readException(); 4512 boolean res = reply.readInt() == 1; 4513 data.recycle(); 4514 reply.recycle(); 4515 return res; 4516 } 4517 4518 public boolean isTopOfTask(IBinder token) throws RemoteException { 4519 Parcel data = Parcel.obtain(); 4520 Parcel reply = Parcel.obtain(); 4521 data.writeInterfaceToken(IActivityManager.descriptor); 4522 data.writeStrongBinder(token); 4523 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0); 4524 reply.readException(); 4525 boolean res = reply.readInt() == 1; 4526 data.recycle(); 4527 reply.recycle(); 4528 return res; 4529 } 4530 4531 public boolean isTopActivityImmersive() 4532 throws RemoteException { 4533 Parcel data = Parcel.obtain(); 4534 Parcel reply = Parcel.obtain(); 4535 data.writeInterfaceToken(IActivityManager.descriptor); 4536 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0); 4537 reply.readException(); 4538 boolean res = reply.readInt() == 1; 4539 data.recycle(); 4540 reply.recycle(); 4541 return res; 4542 } 4543 4544 public void crashApplication(int uid, int initialPid, String packageName, 4545 String message) throws RemoteException { 4546 Parcel data = Parcel.obtain(); 4547 Parcel reply = Parcel.obtain(); 4548 data.writeInterfaceToken(IActivityManager.descriptor); 4549 data.writeInt(uid); 4550 data.writeInt(initialPid); 4551 data.writeString(packageName); 4552 data.writeString(message); 4553 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0); 4554 reply.readException(); 4555 data.recycle(); 4556 reply.recycle(); 4557 } 4558 4559 public String getProviderMimeType(Uri uri, int userId) throws RemoteException { 4560 Parcel data = Parcel.obtain(); 4561 Parcel reply = Parcel.obtain(); 4562 data.writeInterfaceToken(IActivityManager.descriptor); 4563 uri.writeToParcel(data, 0); 4564 data.writeInt(userId); 4565 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0); 4566 reply.readException(); 4567 String res = reply.readString(); 4568 data.recycle(); 4569 reply.recycle(); 4570 return res; 4571 } 4572 4573 public IBinder newUriPermissionOwner(String name) 4574 throws RemoteException { 4575 Parcel data = Parcel.obtain(); 4576 Parcel reply = Parcel.obtain(); 4577 data.writeInterfaceToken(IActivityManager.descriptor); 4578 data.writeString(name); 4579 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0); 4580 reply.readException(); 4581 IBinder res = reply.readStrongBinder(); 4582 data.recycle(); 4583 reply.recycle(); 4584 return res; 4585 } 4586 4587 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, 4588 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException { 4589 Parcel data = Parcel.obtain(); 4590 Parcel reply = Parcel.obtain(); 4591 data.writeInterfaceToken(IActivityManager.descriptor); 4592 data.writeStrongBinder(owner); 4593 data.writeInt(fromUid); 4594 data.writeString(targetPkg); 4595 uri.writeToParcel(data, 0); 4596 data.writeInt(mode); 4597 data.writeInt(sourceUserId); 4598 data.writeInt(targetUserId); 4599 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 4600 reply.readException(); 4601 data.recycle(); 4602 reply.recycle(); 4603 } 4604 4605 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri, 4606 int mode, int userId) throws RemoteException { 4607 Parcel data = Parcel.obtain(); 4608 Parcel reply = Parcel.obtain(); 4609 data.writeInterfaceToken(IActivityManager.descriptor); 4610 data.writeStrongBinder(owner); 4611 if (uri != null) { 4612 data.writeInt(1); 4613 uri.writeToParcel(data, 0); 4614 } else { 4615 data.writeInt(0); 4616 } 4617 data.writeInt(mode); 4618 data.writeInt(userId); 4619 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); 4620 reply.readException(); 4621 data.recycle(); 4622 reply.recycle(); 4623 } 4624 4625 public int checkGrantUriPermission(int callingUid, String targetPkg, 4626 Uri uri, int modeFlags, int userId) throws RemoteException { 4627 Parcel data = Parcel.obtain(); 4628 Parcel reply = Parcel.obtain(); 4629 data.writeInterfaceToken(IActivityManager.descriptor); 4630 data.writeInt(callingUid); 4631 data.writeString(targetPkg); 4632 uri.writeToParcel(data, 0); 4633 data.writeInt(modeFlags); 4634 data.writeInt(userId); 4635 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 4636 reply.readException(); 4637 int res = reply.readInt(); 4638 data.recycle(); 4639 reply.recycle(); 4640 return res; 4641 } 4642 4643 public boolean dumpHeap(String process, int userId, boolean managed, 4644 String path, ParcelFileDescriptor fd) throws RemoteException { 4645 Parcel data = Parcel.obtain(); 4646 Parcel reply = Parcel.obtain(); 4647 data.writeInterfaceToken(IActivityManager.descriptor); 4648 data.writeString(process); 4649 data.writeInt(userId); 4650 data.writeInt(managed ? 1 : 0); 4651 data.writeString(path); 4652 if (fd != null) { 4653 data.writeInt(1); 4654 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 4655 } else { 4656 data.writeInt(0); 4657 } 4658 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0); 4659 reply.readException(); 4660 boolean res = reply.readInt() != 0; 4661 reply.recycle(); 4662 data.recycle(); 4663 return res; 4664 } 4665 4666 public int startActivities(IApplicationThread caller, String callingPackage, 4667 Intent[] intents, String[] resolvedTypes, IBinder resultTo, 4668 Bundle options, int userId) throws RemoteException { 4669 Parcel data = Parcel.obtain(); 4670 Parcel reply = Parcel.obtain(); 4671 data.writeInterfaceToken(IActivityManager.descriptor); 4672 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 4673 data.writeString(callingPackage); 4674 data.writeTypedArray(intents, 0); 4675 data.writeStringArray(resolvedTypes); 4676 data.writeStrongBinder(resultTo); 4677 if (options != null) { 4678 data.writeInt(1); 4679 options.writeToParcel(data, 0); 4680 } else { 4681 data.writeInt(0); 4682 } 4683 data.writeInt(userId); 4684 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0); 4685 reply.readException(); 4686 int result = reply.readInt(); 4687 reply.recycle(); 4688 data.recycle(); 4689 return result; 4690 } 4691 4692 public int getFrontActivityScreenCompatMode() throws RemoteException { 4693 Parcel data = Parcel.obtain(); 4694 Parcel reply = Parcel.obtain(); 4695 data.writeInterfaceToken(IActivityManager.descriptor); 4696 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 4697 reply.readException(); 4698 int mode = reply.readInt(); 4699 reply.recycle(); 4700 data.recycle(); 4701 return mode; 4702 } 4703 4704 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException { 4705 Parcel data = Parcel.obtain(); 4706 Parcel reply = Parcel.obtain(); 4707 data.writeInterfaceToken(IActivityManager.descriptor); 4708 data.writeInt(mode); 4709 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 4710 reply.readException(); 4711 reply.recycle(); 4712 data.recycle(); 4713 } 4714 4715 public int getPackageScreenCompatMode(String packageName) throws RemoteException { 4716 Parcel data = Parcel.obtain(); 4717 Parcel reply = Parcel.obtain(); 4718 data.writeInterfaceToken(IActivityManager.descriptor); 4719 data.writeString(packageName); 4720 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 4721 reply.readException(); 4722 int mode = reply.readInt(); 4723 reply.recycle(); 4724 data.recycle(); 4725 return mode; 4726 } 4727 4728 public void setPackageScreenCompatMode(String packageName, int mode) 4729 throws RemoteException { 4730 Parcel data = Parcel.obtain(); 4731 Parcel reply = Parcel.obtain(); 4732 data.writeInterfaceToken(IActivityManager.descriptor); 4733 data.writeString(packageName); 4734 data.writeInt(mode); 4735 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 4736 reply.readException(); 4737 reply.recycle(); 4738 data.recycle(); 4739 } 4740 4741 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException { 4742 Parcel data = Parcel.obtain(); 4743 Parcel reply = Parcel.obtain(); 4744 data.writeInterfaceToken(IActivityManager.descriptor); 4745 data.writeString(packageName); 4746 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); 4747 reply.readException(); 4748 boolean ask = reply.readInt() != 0; 4749 reply.recycle(); 4750 data.recycle(); 4751 return ask; 4752 } 4753 4754 public void setPackageAskScreenCompat(String packageName, boolean ask) 4755 throws RemoteException { 4756 Parcel data = Parcel.obtain(); 4757 Parcel reply = Parcel.obtain(); 4758 data.writeInterfaceToken(IActivityManager.descriptor); 4759 data.writeString(packageName); 4760 data.writeInt(ask ? 1 : 0); 4761 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); 4762 reply.readException(); 4763 reply.recycle(); 4764 data.recycle(); 4765 } 4766 4767 public boolean switchUser(int userid) throws RemoteException { 4768 Parcel data = Parcel.obtain(); 4769 Parcel reply = Parcel.obtain(); 4770 data.writeInterfaceToken(IActivityManager.descriptor); 4771 data.writeInt(userid); 4772 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0); 4773 reply.readException(); 4774 boolean result = reply.readInt() != 0; 4775 reply.recycle(); 4776 data.recycle(); 4777 return result; 4778 } 4779 4780 public boolean startUserInBackground(int userid) throws RemoteException { 4781 Parcel data = Parcel.obtain(); 4782 Parcel reply = Parcel.obtain(); 4783 data.writeInterfaceToken(IActivityManager.descriptor); 4784 data.writeInt(userid); 4785 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0); 4786 reply.readException(); 4787 boolean result = reply.readInt() != 0; 4788 reply.recycle(); 4789 data.recycle(); 4790 return result; 4791 } 4792 4793 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException { 4794 Parcel data = Parcel.obtain(); 4795 Parcel reply = Parcel.obtain(); 4796 data.writeInterfaceToken(IActivityManager.descriptor); 4797 data.writeInt(userid); 4798 data.writeStrongInterface(callback); 4799 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0); 4800 reply.readException(); 4801 int result = reply.readInt(); 4802 reply.recycle(); 4803 data.recycle(); 4804 return result; 4805 } 4806 4807 public UserInfo getCurrentUser() throws RemoteException { 4808 Parcel data = Parcel.obtain(); 4809 Parcel reply = Parcel.obtain(); 4810 data.writeInterfaceToken(IActivityManager.descriptor); 4811 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0); 4812 reply.readException(); 4813 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply); 4814 reply.recycle(); 4815 data.recycle(); 4816 return userInfo; 4817 } 4818 4819 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException { 4820 Parcel data = Parcel.obtain(); 4821 Parcel reply = Parcel.obtain(); 4822 data.writeInterfaceToken(IActivityManager.descriptor); 4823 data.writeInt(userid); 4824 data.writeInt(orStopping ? 1 : 0); 4825 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0); 4826 reply.readException(); 4827 boolean result = reply.readInt() != 0; 4828 reply.recycle(); 4829 data.recycle(); 4830 return result; 4831 } 4832 4833 public int[] getRunningUserIds() throws RemoteException { 4834 Parcel data = Parcel.obtain(); 4835 Parcel reply = Parcel.obtain(); 4836 data.writeInterfaceToken(IActivityManager.descriptor); 4837 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0); 4838 reply.readException(); 4839 int[] result = reply.createIntArray(); 4840 reply.recycle(); 4841 data.recycle(); 4842 return result; 4843 } 4844 4845 public boolean removeTask(int taskId) throws RemoteException { 4846 Parcel data = Parcel.obtain(); 4847 Parcel reply = Parcel.obtain(); 4848 data.writeInterfaceToken(IActivityManager.descriptor); 4849 data.writeInt(taskId); 4850 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0); 4851 reply.readException(); 4852 boolean result = reply.readInt() != 0; 4853 reply.recycle(); 4854 data.recycle(); 4855 return result; 4856 } 4857 4858 public void registerProcessObserver(IProcessObserver observer) throws RemoteException { 4859 Parcel data = Parcel.obtain(); 4860 Parcel reply = Parcel.obtain(); 4861 data.writeInterfaceToken(IActivityManager.descriptor); 4862 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 4863 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0); 4864 reply.readException(); 4865 data.recycle(); 4866 reply.recycle(); 4867 } 4868 4869 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException { 4870 Parcel data = Parcel.obtain(); 4871 Parcel reply = Parcel.obtain(); 4872 data.writeInterfaceToken(IActivityManager.descriptor); 4873 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 4874 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0); 4875 reply.readException(); 4876 data.recycle(); 4877 reply.recycle(); 4878 } 4879 4880 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException { 4881 Parcel data = Parcel.obtain(); 4882 Parcel reply = Parcel.obtain(); 4883 data.writeInterfaceToken(IActivityManager.descriptor); 4884 data.writeStrongBinder(sender.asBinder()); 4885 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0); 4886 reply.readException(); 4887 boolean res = reply.readInt() != 0; 4888 data.recycle(); 4889 reply.recycle(); 4890 return res; 4891 } 4892 4893 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException { 4894 Parcel data = Parcel.obtain(); 4895 Parcel reply = Parcel.obtain(); 4896 data.writeInterfaceToken(IActivityManager.descriptor); 4897 data.writeStrongBinder(sender.asBinder()); 4898 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0); 4899 reply.readException(); 4900 boolean res = reply.readInt() != 0; 4901 data.recycle(); 4902 reply.recycle(); 4903 return res; 4904 } 4905 4906 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException { 4907 Parcel data = Parcel.obtain(); 4908 Parcel reply = Parcel.obtain(); 4909 data.writeInterfaceToken(IActivityManager.descriptor); 4910 data.writeStrongBinder(sender.asBinder()); 4911 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 4912 reply.readException(); 4913 Intent res = reply.readInt() != 0 4914 ? Intent.CREATOR.createFromParcel(reply) : null; 4915 data.recycle(); 4916 reply.recycle(); 4917 return res; 4918 } 4919 4920 public String getTagForIntentSender(IIntentSender sender, String prefix) 4921 throws RemoteException { 4922 Parcel data = Parcel.obtain(); 4923 Parcel reply = Parcel.obtain(); 4924 data.writeInterfaceToken(IActivityManager.descriptor); 4925 data.writeStrongBinder(sender.asBinder()); 4926 data.writeString(prefix); 4927 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 4928 reply.readException(); 4929 String res = reply.readString(); 4930 data.recycle(); 4931 reply.recycle(); 4932 return res; 4933 } 4934 4935 public void updatePersistentConfiguration(Configuration values) throws RemoteException 4936 { 4937 Parcel data = Parcel.obtain(); 4938 Parcel reply = Parcel.obtain(); 4939 data.writeInterfaceToken(IActivityManager.descriptor); 4940 values.writeToParcel(data, 0); 4941 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0); 4942 reply.readException(); 4943 data.recycle(); 4944 reply.recycle(); 4945 } 4946 4947 public long[] getProcessPss(int[] pids) throws RemoteException { 4948 Parcel data = Parcel.obtain(); 4949 Parcel reply = Parcel.obtain(); 4950 data.writeInterfaceToken(IActivityManager.descriptor); 4951 data.writeIntArray(pids); 4952 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0); 4953 reply.readException(); 4954 long[] res = reply.createLongArray(); 4955 data.recycle(); 4956 reply.recycle(); 4957 return res; 4958 } 4959 4960 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException { 4961 Parcel data = Parcel.obtain(); 4962 Parcel reply = Parcel.obtain(); 4963 data.writeInterfaceToken(IActivityManager.descriptor); 4964 TextUtils.writeToParcel(msg, data, 0); 4965 data.writeInt(always ? 1 : 0); 4966 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0); 4967 reply.readException(); 4968 data.recycle(); 4969 reply.recycle(); 4970 } 4971 4972 public void keyguardWaitingForActivityDrawn() throws RemoteException { 4973 Parcel data = Parcel.obtain(); 4974 Parcel reply = Parcel.obtain(); 4975 data.writeInterfaceToken(IActivityManager.descriptor); 4976 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0); 4977 reply.readException(); 4978 data.recycle(); 4979 reply.recycle(); 4980 } 4981 4982 public boolean shouldUpRecreateTask(IBinder token, String destAffinity) 4983 throws RemoteException { 4984 Parcel data = Parcel.obtain(); 4985 Parcel reply = Parcel.obtain(); 4986 data.writeInterfaceToken(IActivityManager.descriptor); 4987 data.writeStrongBinder(token); 4988 data.writeString(destAffinity); 4989 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0); 4990 reply.readException(); 4991 boolean result = reply.readInt() != 0; 4992 data.recycle(); 4993 reply.recycle(); 4994 return result; 4995 } 4996 4997 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData) 4998 throws RemoteException { 4999 Parcel data = Parcel.obtain(); 5000 Parcel reply = Parcel.obtain(); 5001 data.writeInterfaceToken(IActivityManager.descriptor); 5002 data.writeStrongBinder(token); 5003 target.writeToParcel(data, 0); 5004 data.writeInt(resultCode); 5005 if (resultData != null) { 5006 data.writeInt(1); 5007 resultData.writeToParcel(data, 0); 5008 } else { 5009 data.writeInt(0); 5010 } 5011 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0); 5012 reply.readException(); 5013 boolean result = reply.readInt() != 0; 5014 data.recycle(); 5015 reply.recycle(); 5016 return result; 5017 } 5018 5019 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException { 5020 Parcel data = Parcel.obtain(); 5021 Parcel reply = Parcel.obtain(); 5022 data.writeInterfaceToken(IActivityManager.descriptor); 5023 data.writeStrongBinder(activityToken); 5024 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0); 5025 reply.readException(); 5026 int result = reply.readInt(); 5027 data.recycle(); 5028 reply.recycle(); 5029 return result; 5030 } 5031 5032 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException { 5033 Parcel data = Parcel.obtain(); 5034 Parcel reply = Parcel.obtain(); 5035 data.writeInterfaceToken(IActivityManager.descriptor); 5036 data.writeStrongBinder(activityToken); 5037 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0); 5038 reply.readException(); 5039 String result = reply.readString(); 5040 data.recycle(); 5041 reply.recycle(); 5042 return result; 5043 } 5044 5045 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { 5046 Parcel data = Parcel.obtain(); 5047 Parcel reply = Parcel.obtain(); 5048 data.writeInterfaceToken(IActivityManager.descriptor); 5049 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 5050 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); 5051 reply.readException(); 5052 data.recycle(); 5053 reply.recycle(); 5054 } 5055 5056 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { 5057 Parcel data = Parcel.obtain(); 5058 Parcel reply = Parcel.obtain(); 5059 data.writeInterfaceToken(IActivityManager.descriptor); 5060 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 5061 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); 5062 reply.readException(); 5063 data.recycle(); 5064 reply.recycle(); 5065 } 5066 5067 public void requestBugReport() throws RemoteException { 5068 Parcel data = Parcel.obtain(); 5069 Parcel reply = Parcel.obtain(); 5070 data.writeInterfaceToken(IActivityManager.descriptor); 5071 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0); 5072 reply.readException(); 5073 data.recycle(); 5074 reply.recycle(); 5075 } 5076 5077 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason) 5078 throws RemoteException { 5079 Parcel data = Parcel.obtain(); 5080 Parcel reply = Parcel.obtain(); 5081 data.writeInterfaceToken(IActivityManager.descriptor); 5082 data.writeInt(pid); 5083 data.writeInt(aboveSystem ? 1 : 0); 5084 data.writeString(reason); 5085 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0); 5086 reply.readException(); 5087 long res = reply.readInt(); 5088 data.recycle(); 5089 reply.recycle(); 5090 return res; 5091 } 5092 5093 public Bundle getAssistContextExtras(int requestType) throws RemoteException { 5094 Parcel data = Parcel.obtain(); 5095 Parcel reply = Parcel.obtain(); 5096 data.writeInterfaceToken(IActivityManager.descriptor); 5097 data.writeInt(requestType); 5098 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0); 5099 reply.readException(); 5100 Bundle res = reply.readBundle(); 5101 data.recycle(); 5102 reply.recycle(); 5103 return res; 5104 } 5105 5106 public void reportAssistContextExtras(IBinder token, Bundle extras) 5107 throws RemoteException { 5108 Parcel data = Parcel.obtain(); 5109 Parcel reply = Parcel.obtain(); 5110 data.writeInterfaceToken(IActivityManager.descriptor); 5111 data.writeStrongBinder(token); 5112 data.writeBundle(extras); 5113 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0); 5114 reply.readException(); 5115 data.recycle(); 5116 reply.recycle(); 5117 } 5118 5119 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle) 5120 throws RemoteException { 5121 Parcel data = Parcel.obtain(); 5122 Parcel reply = Parcel.obtain(); 5123 data.writeInterfaceToken(IActivityManager.descriptor); 5124 intent.writeToParcel(data, 0); 5125 data.writeInt(requestType); 5126 data.writeString(hint); 5127 data.writeInt(userHandle); 5128 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0); 5129 reply.readException(); 5130 boolean res = reply.readInt() != 0; 5131 data.recycle(); 5132 reply.recycle(); 5133 return res; 5134 } 5135 5136 public void killUid(int uid, String reason) throws RemoteException { 5137 Parcel data = Parcel.obtain(); 5138 Parcel reply = Parcel.obtain(); 5139 data.writeInterfaceToken(IActivityManager.descriptor); 5140 data.writeInt(uid); 5141 data.writeString(reason); 5142 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0); 5143 reply.readException(); 5144 data.recycle(); 5145 reply.recycle(); 5146 } 5147 5148 public void hang(IBinder who, boolean allowRestart) throws RemoteException { 5149 Parcel data = Parcel.obtain(); 5150 Parcel reply = Parcel.obtain(); 5151 data.writeInterfaceToken(IActivityManager.descriptor); 5152 data.writeStrongBinder(who); 5153 data.writeInt(allowRestart ? 1 : 0); 5154 mRemote.transact(HANG_TRANSACTION, data, reply, 0); 5155 reply.readException(); 5156 data.recycle(); 5157 reply.recycle(); 5158 } 5159 5160 public void reportActivityFullyDrawn(IBinder token) throws RemoteException { 5161 Parcel data = Parcel.obtain(); 5162 Parcel reply = Parcel.obtain(); 5163 data.writeInterfaceToken(IActivityManager.descriptor); 5164 data.writeStrongBinder(token); 5165 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0); 5166 reply.readException(); 5167 data.recycle(); 5168 reply.recycle(); 5169 } 5170 5171 public void notifyActivityDrawn(IBinder token) throws RemoteException { 5172 Parcel data = Parcel.obtain(); 5173 Parcel reply = Parcel.obtain(); 5174 data.writeInterfaceToken(IActivityManager.descriptor); 5175 data.writeStrongBinder(token); 5176 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0); 5177 reply.readException(); 5178 data.recycle(); 5179 reply.recycle(); 5180 } 5181 5182 public void restart() throws RemoteException { 5183 Parcel data = Parcel.obtain(); 5184 Parcel reply = Parcel.obtain(); 5185 data.writeInterfaceToken(IActivityManager.descriptor); 5186 mRemote.transact(RESTART_TRANSACTION, data, reply, 0); 5187 reply.readException(); 5188 data.recycle(); 5189 reply.recycle(); 5190 } 5191 5192 public void performIdleMaintenance() throws RemoteException { 5193 Parcel data = Parcel.obtain(); 5194 Parcel reply = Parcel.obtain(); 5195 data.writeInterfaceToken(IActivityManager.descriptor); 5196 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0); 5197 reply.readException(); 5198 data.recycle(); 5199 reply.recycle(); 5200 } 5201 5202 public IActivityContainer createActivityContainer(IBinder parentActivityToken, 5203 IActivityContainerCallback callback) throws RemoteException { 5204 Parcel data = Parcel.obtain(); 5205 Parcel reply = Parcel.obtain(); 5206 data.writeInterfaceToken(IActivityManager.descriptor); 5207 data.writeStrongBinder(parentActivityToken); 5208 data.writeStrongBinder(callback == null ? null : callback.asBinder()); 5209 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0); 5210 reply.readException(); 5211 final int result = reply.readInt(); 5212 final IActivityContainer res; 5213 if (result == 1) { 5214 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder()); 5215 } else { 5216 res = null; 5217 } 5218 data.recycle(); 5219 reply.recycle(); 5220 return res; 5221 } 5222 5223 public void deleteActivityContainer(IActivityContainer activityContainer) 5224 throws RemoteException { 5225 Parcel data = Parcel.obtain(); 5226 Parcel reply = Parcel.obtain(); 5227 data.writeInterfaceToken(IActivityManager.descriptor); 5228 data.writeStrongBinder(activityContainer.asBinder()); 5229 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0); 5230 reply.readException(); 5231 data.recycle(); 5232 reply.recycle(); 5233 } 5234 5235 @Override 5236 public int getActivityDisplayId(IBinder activityToken) throws RemoteException { 5237 Parcel data = Parcel.obtain(); 5238 Parcel reply = Parcel.obtain(); 5239 data.writeInterfaceToken(IActivityManager.descriptor); 5240 data.writeStrongBinder(activityToken); 5241 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0); 5242 reply.readException(); 5243 final int displayId = reply.readInt(); 5244 data.recycle(); 5245 reply.recycle(); 5246 return displayId; 5247 } 5248 5249 @Override 5250 public IBinder getHomeActivityToken() throws RemoteException { 5251 Parcel data = Parcel.obtain(); 5252 Parcel reply = Parcel.obtain(); 5253 data.writeInterfaceToken(IActivityManager.descriptor); 5254 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0); 5255 reply.readException(); 5256 IBinder res = reply.readStrongBinder(); 5257 data.recycle(); 5258 reply.recycle(); 5259 return res; 5260 } 5261 5262 @Override 5263 public void startLockTaskMode(int taskId) throws RemoteException { 5264 Parcel data = Parcel.obtain(); 5265 Parcel reply = Parcel.obtain(); 5266 data.writeInterfaceToken(IActivityManager.descriptor); 5267 data.writeInt(taskId); 5268 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0); 5269 reply.readException(); 5270 data.recycle(); 5271 reply.recycle(); 5272 } 5273 5274 @Override 5275 public void startLockTaskMode(IBinder token) throws RemoteException { 5276 Parcel data = Parcel.obtain(); 5277 Parcel reply = Parcel.obtain(); 5278 data.writeInterfaceToken(IActivityManager.descriptor); 5279 data.writeStrongBinder(token); 5280 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0); 5281 reply.readException(); 5282 data.recycle(); 5283 reply.recycle(); 5284 } 5285 5286 @Override 5287 public void startLockTaskModeOnCurrent() throws RemoteException { 5288 Parcel data = Parcel.obtain(); 5289 Parcel reply = Parcel.obtain(); 5290 data.writeInterfaceToken(IActivityManager.descriptor); 5291 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0); 5292 reply.readException(); 5293 data.recycle(); 5294 reply.recycle(); 5295 } 5296 5297 @Override 5298 public void stopLockTaskMode() throws RemoteException { 5299 Parcel data = Parcel.obtain(); 5300 Parcel reply = Parcel.obtain(); 5301 data.writeInterfaceToken(IActivityManager.descriptor); 5302 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0); 5303 reply.readException(); 5304 data.recycle(); 5305 reply.recycle(); 5306 } 5307 5308 @Override 5309 public void stopLockTaskModeOnCurrent() throws RemoteException { 5310 Parcel data = Parcel.obtain(); 5311 Parcel reply = Parcel.obtain(); 5312 data.writeInterfaceToken(IActivityManager.descriptor); 5313 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0); 5314 reply.readException(); 5315 data.recycle(); 5316 reply.recycle(); 5317 } 5318 5319 @Override 5320 public boolean isInLockTaskMode() throws RemoteException { 5321 Parcel data = Parcel.obtain(); 5322 Parcel reply = Parcel.obtain(); 5323 data.writeInterfaceToken(IActivityManager.descriptor); 5324 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0); 5325 reply.readException(); 5326 boolean isInLockTaskMode = reply.readInt() == 1; 5327 data.recycle(); 5328 reply.recycle(); 5329 return isInLockTaskMode; 5330 } 5331 5332 @Override 5333 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values) 5334 throws RemoteException { 5335 Parcel data = Parcel.obtain(); 5336 Parcel reply = Parcel.obtain(); 5337 data.writeInterfaceToken(IActivityManager.descriptor); 5338 data.writeStrongBinder(token); 5339 values.writeToParcel(data, 0); 5340 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 5341 reply.readException(); 5342 data.recycle(); 5343 reply.recycle(); 5344 } 5345 5346 @Override 5347 public Bitmap getTaskDescriptionIcon(String filename) throws RemoteException { 5348 Parcel data = Parcel.obtain(); 5349 Parcel reply = Parcel.obtain(); 5350 data.writeInterfaceToken(IActivityManager.descriptor); 5351 data.writeString(filename); 5352 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0); 5353 reply.readException(); 5354 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply); 5355 data.recycle(); 5356 reply.recycle(); 5357 return icon; 5358 } 5359 5360 @Override 5361 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options) 5362 throws RemoteException { 5363 Parcel data = Parcel.obtain(); 5364 Parcel reply = Parcel.obtain(); 5365 data.writeInterfaceToken(IActivityManager.descriptor); 5366 if (options == null) { 5367 data.writeInt(0); 5368 } else { 5369 data.writeInt(1); 5370 data.writeBundle(options.toBundle()); 5371 } 5372 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 5373 reply.readException(); 5374 data.recycle(); 5375 reply.recycle(); 5376 } 5377 5378 @Override 5379 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException { 5380 Parcel data = Parcel.obtain(); 5381 Parcel reply = Parcel.obtain(); 5382 data.writeInterfaceToken(IActivityManager.descriptor); 5383 data.writeStrongBinder(token); 5384 data.writeInt(visible ? 1 : 0); 5385 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0); 5386 reply.readException(); 5387 boolean success = reply.readInt() > 0; 5388 data.recycle(); 5389 reply.recycle(); 5390 return success; 5391 } 5392 5393 @Override 5394 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException { 5395 Parcel data = Parcel.obtain(); 5396 Parcel reply = Parcel.obtain(); 5397 data.writeInterfaceToken(IActivityManager.descriptor); 5398 data.writeStrongBinder(token); 5399 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0); 5400 reply.readException(); 5401 final boolean visible = reply.readInt() > 0; 5402 data.recycle(); 5403 reply.recycle(); 5404 return visible; 5405 } 5406 5407 @Override 5408 public void backgroundResourcesReleased(IBinder token) throws RemoteException { 5409 Parcel data = Parcel.obtain(); 5410 Parcel reply = Parcel.obtain(); 5411 data.writeInterfaceToken(IActivityManager.descriptor); 5412 data.writeStrongBinder(token); 5413 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 5414 IBinder.FLAG_ONEWAY); 5415 reply.readException(); 5416 data.recycle(); 5417 reply.recycle(); 5418 } 5419 5420 @Override 5421 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException { 5422 Parcel data = Parcel.obtain(); 5423 Parcel reply = Parcel.obtain(); 5424 data.writeInterfaceToken(IActivityManager.descriptor); 5425 data.writeStrongBinder(token); 5426 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 5427 IBinder.FLAG_ONEWAY); 5428 reply.readException(); 5429 data.recycle(); 5430 reply.recycle(); 5431 } 5432 5433 @Override 5434 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException { 5435 Parcel data = Parcel.obtain(); 5436 Parcel reply = Parcel.obtain(); 5437 data.writeInterfaceToken(IActivityManager.descriptor); 5438 data.writeStrongBinder(token); 5439 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 5440 IBinder.FLAG_ONEWAY); 5441 reply.readException(); 5442 data.recycle(); 5443 reply.recycle(); 5444 } 5445 5446 @Override 5447 public void bootAnimationComplete() throws RemoteException { 5448 Parcel data = Parcel.obtain(); 5449 Parcel reply = Parcel.obtain(); 5450 data.writeInterfaceToken(IActivityManager.descriptor); 5451 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0); 5452 reply.readException(); 5453 data.recycle(); 5454 reply.recycle(); 5455 } 5456 5457 @Override 5458 public void systemBackupRestored() throws RemoteException { 5459 Parcel data = Parcel.obtain(); 5460 Parcel reply = Parcel.obtain(); 5461 data.writeInterfaceToken(IActivityManager.descriptor); 5462 mRemote.transact(SYSTEM_BACKUP_RESTORED, data, reply, 0); 5463 reply.readException(); 5464 data.recycle(); 5465 reply.recycle(); 5466 } 5467 5468 private IBinder mRemote; 5469 } 5470