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.annotation.UserIdInt; 20 import android.app.ActivityManager.StackInfo; 21 import android.app.assist.AssistContent; 22 import android.app.assist.AssistStructure; 23 import android.content.ComponentName; 24 import android.content.IIntentReceiver; 25 import android.content.IIntentSender; 26 import android.content.Intent; 27 import android.content.IntentFilter; 28 import android.content.IntentSender; 29 import android.content.UriPermission; 30 import android.content.pm.ApplicationInfo; 31 import android.content.pm.ConfigurationInfo; 32 import android.content.pm.IPackageDataObserver; 33 import android.content.pm.ParceledListSlice; 34 import android.content.pm.UserInfo; 35 import android.content.res.Configuration; 36 import android.graphics.Bitmap; 37 import android.graphics.Point; 38 import android.graphics.Rect; 39 import android.net.Uri; 40 import android.os.Binder; 41 import android.os.Bundle; 42 import android.os.Debug; 43 import android.os.IBinder; 44 import android.os.IProgressListener; 45 import android.os.Parcel; 46 import android.os.ParcelFileDescriptor; 47 import android.os.Parcelable; 48 import android.os.PersistableBundle; 49 import android.os.RemoteException; 50 import android.os.ServiceManager; 51 import android.os.StrictMode; 52 import android.service.voice.IVoiceInteractionSession; 53 import android.text.TextUtils; 54 import android.util.Log; 55 import android.util.Singleton; 56 import com.android.internal.app.IVoiceInteractor; 57 import com.android.internal.os.IResultReceiver; 58 59 import java.util.ArrayList; 60 import java.util.List; 61 62 /** {@hide} */ 63 public abstract class ActivityManagerNative extends Binder implements IActivityManager 64 { 65 /** 66 * Cast a Binder object into an activity manager interface, generating 67 * a proxy if needed. 68 */ asInterface(IBinder obj)69 static public IActivityManager asInterface(IBinder obj) { 70 if (obj == null) { 71 return null; 72 } 73 IActivityManager in = 74 (IActivityManager)obj.queryLocalInterface(descriptor); 75 if (in != null) { 76 return in; 77 } 78 79 return new ActivityManagerProxy(obj); 80 } 81 82 /** 83 * Retrieve the system's default/global activity manager. 84 */ getDefault()85 static public IActivityManager getDefault() { 86 return gDefault.get(); 87 } 88 89 /** 90 * Convenience for checking whether the system is ready. For internal use only. 91 */ isSystemReady()92 static public boolean isSystemReady() { 93 if (!sSystemReady) { 94 sSystemReady = getDefault().testIsSystemReady(); 95 } 96 return sSystemReady; 97 } 98 static volatile boolean sSystemReady = false; 99 broadcastStickyIntent(Intent intent, String permission, int userId)100 static public void broadcastStickyIntent(Intent intent, String permission, int userId) { 101 broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId); 102 } 103 104 /** 105 * Convenience for sending a sticky broadcast. For internal use only. 106 * If you don't care about permission, use null. 107 */ broadcastStickyIntent(Intent intent, String permission, int appOp, int userId)108 static public void broadcastStickyIntent(Intent intent, String permission, int appOp, 109 int userId) { 110 try { 111 getDefault().broadcastIntent( 112 null, intent, null, null, Activity.RESULT_OK, null, null, 113 null /*permission*/, appOp, null, false, true, userId); 114 } catch (RemoteException ex) { 115 } 116 } 117 noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg, String tag)118 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg, 119 String tag) { 120 try { 121 getDefault().noteWakeupAlarm((ps != null) ? ps.getTarget() : null, 122 sourceUid, sourcePkg, tag); 123 } catch (RemoteException ex) { 124 } 125 } 126 noteAlarmStart(PendingIntent ps, int sourceUid, String tag)127 static public void noteAlarmStart(PendingIntent ps, int sourceUid, String tag) { 128 try { 129 getDefault().noteAlarmStart((ps != null) ? ps.getTarget() : null, sourceUid, tag); 130 } catch (RemoteException ex) { 131 } 132 } 133 noteAlarmFinish(PendingIntent ps, int sourceUid, String tag)134 static public void noteAlarmFinish(PendingIntent ps, int sourceUid, String tag) { 135 try { 136 getDefault().noteAlarmFinish((ps != null) ? ps.getTarget() : null, sourceUid, tag); 137 } catch (RemoteException ex) { 138 } 139 } 140 ActivityManagerNative()141 public ActivityManagerNative() { 142 attachInterface(this, descriptor); 143 } 144 145 @Override onTransact(int code, Parcel data, Parcel reply, int flags)146 public boolean onTransact(int code, Parcel data, Parcel reply, int flags) 147 throws RemoteException { 148 switch (code) { 149 case START_ACTIVITY_TRANSACTION: 150 { 151 data.enforceInterface(IActivityManager.descriptor); 152 IBinder b = data.readStrongBinder(); 153 IApplicationThread app = ApplicationThreadNative.asInterface(b); 154 String callingPackage = data.readString(); 155 Intent intent = Intent.CREATOR.createFromParcel(data); 156 String resolvedType = data.readString(); 157 IBinder resultTo = data.readStrongBinder(); 158 String resultWho = data.readString(); 159 int requestCode = data.readInt(); 160 int startFlags = data.readInt(); 161 ProfilerInfo profilerInfo = data.readInt() != 0 162 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 163 Bundle options = data.readInt() != 0 164 ? Bundle.CREATOR.createFromParcel(data) : null; 165 int result = startActivity(app, callingPackage, intent, resolvedType, 166 resultTo, resultWho, requestCode, startFlags, profilerInfo, options); 167 reply.writeNoException(); 168 reply.writeInt(result); 169 return true; 170 } 171 172 case START_ACTIVITY_AS_USER_TRANSACTION: 173 { 174 data.enforceInterface(IActivityManager.descriptor); 175 IBinder b = data.readStrongBinder(); 176 IApplicationThread app = ApplicationThreadNative.asInterface(b); 177 String callingPackage = data.readString(); 178 Intent intent = Intent.CREATOR.createFromParcel(data); 179 String resolvedType = data.readString(); 180 IBinder resultTo = data.readStrongBinder(); 181 String resultWho = data.readString(); 182 int requestCode = data.readInt(); 183 int startFlags = data.readInt(); 184 ProfilerInfo profilerInfo = data.readInt() != 0 185 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 186 Bundle options = data.readInt() != 0 187 ? Bundle.CREATOR.createFromParcel(data) : null; 188 int userId = data.readInt(); 189 int result = startActivityAsUser(app, callingPackage, intent, resolvedType, 190 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId); 191 reply.writeNoException(); 192 reply.writeInt(result); 193 return true; 194 } 195 196 case START_ACTIVITY_AS_CALLER_TRANSACTION: 197 { 198 data.enforceInterface(IActivityManager.descriptor); 199 IBinder b = data.readStrongBinder(); 200 IApplicationThread app = ApplicationThreadNative.asInterface(b); 201 String callingPackage = data.readString(); 202 Intent intent = Intent.CREATOR.createFromParcel(data); 203 String resolvedType = data.readString(); 204 IBinder resultTo = data.readStrongBinder(); 205 String resultWho = data.readString(); 206 int requestCode = data.readInt(); 207 int startFlags = data.readInt(); 208 ProfilerInfo profilerInfo = data.readInt() != 0 209 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 210 Bundle options = data.readInt() != 0 211 ? Bundle.CREATOR.createFromParcel(data) : null; 212 boolean ignoreTargetSecurity = data.readInt() != 0; 213 int userId = data.readInt(); 214 int result = startActivityAsCaller(app, callingPackage, intent, resolvedType, 215 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, 216 ignoreTargetSecurity, userId); 217 reply.writeNoException(); 218 reply.writeInt(result); 219 return true; 220 } 221 222 case START_ACTIVITY_AND_WAIT_TRANSACTION: 223 { 224 data.enforceInterface(IActivityManager.descriptor); 225 IBinder b = data.readStrongBinder(); 226 IApplicationThread app = ApplicationThreadNative.asInterface(b); 227 String callingPackage = data.readString(); 228 Intent intent = Intent.CREATOR.createFromParcel(data); 229 String resolvedType = data.readString(); 230 IBinder resultTo = data.readStrongBinder(); 231 String resultWho = data.readString(); 232 int requestCode = data.readInt(); 233 int startFlags = data.readInt(); 234 ProfilerInfo profilerInfo = data.readInt() != 0 235 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 236 Bundle options = data.readInt() != 0 237 ? Bundle.CREATOR.createFromParcel(data) : null; 238 int userId = data.readInt(); 239 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType, 240 resultTo, resultWho, requestCode, startFlags, profilerInfo, options, userId); 241 reply.writeNoException(); 242 result.writeToParcel(reply, 0); 243 return true; 244 } 245 246 case START_ACTIVITY_WITH_CONFIG_TRANSACTION: 247 { 248 data.enforceInterface(IActivityManager.descriptor); 249 IBinder b = data.readStrongBinder(); 250 IApplicationThread app = ApplicationThreadNative.asInterface(b); 251 String callingPackage = data.readString(); 252 Intent intent = Intent.CREATOR.createFromParcel(data); 253 String resolvedType = data.readString(); 254 IBinder resultTo = data.readStrongBinder(); 255 String resultWho = data.readString(); 256 int requestCode = data.readInt(); 257 int startFlags = data.readInt(); 258 Configuration config = Configuration.CREATOR.createFromParcel(data); 259 Bundle options = data.readInt() != 0 260 ? Bundle.CREATOR.createFromParcel(data) : null; 261 int userId = data.readInt(); 262 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType, 263 resultTo, resultWho, requestCode, startFlags, config, options, userId); 264 reply.writeNoException(); 265 reply.writeInt(result); 266 return true; 267 } 268 269 case START_ACTIVITY_INTENT_SENDER_TRANSACTION: 270 { 271 data.enforceInterface(IActivityManager.descriptor); 272 IBinder b = data.readStrongBinder(); 273 IApplicationThread app = ApplicationThreadNative.asInterface(b); 274 IntentSender intent = IntentSender.CREATOR.createFromParcel(data); 275 Intent fillInIntent = null; 276 if (data.readInt() != 0) { 277 fillInIntent = Intent.CREATOR.createFromParcel(data); 278 } 279 String resolvedType = data.readString(); 280 IBinder resultTo = data.readStrongBinder(); 281 String resultWho = data.readString(); 282 int requestCode = data.readInt(); 283 int flagsMask = data.readInt(); 284 int flagsValues = data.readInt(); 285 Bundle options = data.readInt() != 0 286 ? Bundle.CREATOR.createFromParcel(data) : null; 287 int result = startActivityIntentSender(app, intent, 288 fillInIntent, resolvedType, resultTo, resultWho, 289 requestCode, flagsMask, flagsValues, options); 290 reply.writeNoException(); 291 reply.writeInt(result); 292 return true; 293 } 294 295 case START_VOICE_ACTIVITY_TRANSACTION: 296 { 297 data.enforceInterface(IActivityManager.descriptor); 298 String callingPackage = data.readString(); 299 int callingPid = data.readInt(); 300 int callingUid = data.readInt(); 301 Intent intent = Intent.CREATOR.createFromParcel(data); 302 String resolvedType = data.readString(); 303 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface( 304 data.readStrongBinder()); 305 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface( 306 data.readStrongBinder()); 307 int startFlags = data.readInt(); 308 ProfilerInfo profilerInfo = data.readInt() != 0 309 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 310 Bundle options = data.readInt() != 0 311 ? Bundle.CREATOR.createFromParcel(data) : null; 312 int userId = data.readInt(); 313 int result = startVoiceActivity(callingPackage, callingPid, callingUid, intent, 314 resolvedType, session, interactor, startFlags, profilerInfo, options, userId); 315 reply.writeNoException(); 316 reply.writeInt(result); 317 return true; 318 } 319 320 case START_LOCAL_VOICE_INTERACTION_TRANSACTION: 321 { 322 data.enforceInterface(IActivityManager.descriptor); 323 IBinder token = data.readStrongBinder(); 324 Bundle options = data.readBundle(); 325 startLocalVoiceInteraction(token, options); 326 reply.writeNoException(); 327 return true; 328 } 329 330 case STOP_LOCAL_VOICE_INTERACTION_TRANSACTION: 331 { 332 data.enforceInterface(IActivityManager.descriptor); 333 IBinder token = data.readStrongBinder(); 334 stopLocalVoiceInteraction(token); 335 reply.writeNoException(); 336 return true; 337 } 338 339 case SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION: 340 { 341 data.enforceInterface(IActivityManager.descriptor); 342 boolean result = supportsLocalVoiceInteraction(); 343 reply.writeNoException(); 344 reply.writeInt(result? 1 : 0); 345 return true; 346 } 347 348 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION: 349 { 350 data.enforceInterface(IActivityManager.descriptor); 351 IBinder callingActivity = data.readStrongBinder(); 352 Intent intent = Intent.CREATOR.createFromParcel(data); 353 Bundle options = data.readInt() != 0 354 ? Bundle.CREATOR.createFromParcel(data) : null; 355 boolean result = startNextMatchingActivity(callingActivity, intent, options); 356 reply.writeNoException(); 357 reply.writeInt(result ? 1 : 0); 358 return true; 359 } 360 361 case START_ACTIVITY_FROM_RECENTS_TRANSACTION: 362 { 363 data.enforceInterface(IActivityManager.descriptor); 364 final int taskId = data.readInt(); 365 final Bundle options = 366 data.readInt() == 0 ? null : Bundle.CREATOR.createFromParcel(data); 367 final int result = startActivityFromRecents(taskId, options); 368 reply.writeNoException(); 369 reply.writeInt(result); 370 return true; 371 } 372 373 case FINISH_ACTIVITY_TRANSACTION: { 374 data.enforceInterface(IActivityManager.descriptor); 375 IBinder token = data.readStrongBinder(); 376 Intent resultData = null; 377 int resultCode = data.readInt(); 378 if (data.readInt() != 0) { 379 resultData = Intent.CREATOR.createFromParcel(data); 380 } 381 int finishTask = data.readInt(); 382 boolean res = finishActivity(token, resultCode, resultData, finishTask); 383 reply.writeNoException(); 384 reply.writeInt(res ? 1 : 0); 385 return true; 386 } 387 388 case FINISH_SUB_ACTIVITY_TRANSACTION: { 389 data.enforceInterface(IActivityManager.descriptor); 390 IBinder token = data.readStrongBinder(); 391 String resultWho = data.readString(); 392 int requestCode = data.readInt(); 393 finishSubActivity(token, resultWho, requestCode); 394 reply.writeNoException(); 395 return true; 396 } 397 398 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: { 399 data.enforceInterface(IActivityManager.descriptor); 400 IBinder token = data.readStrongBinder(); 401 boolean res = finishActivityAffinity(token); 402 reply.writeNoException(); 403 reply.writeInt(res ? 1 : 0); 404 return true; 405 } 406 407 case FINISH_VOICE_TASK_TRANSACTION: { 408 data.enforceInterface(IActivityManager.descriptor); 409 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface( 410 data.readStrongBinder()); 411 finishVoiceTask(session); 412 reply.writeNoException(); 413 return true; 414 } 415 416 case RELEASE_ACTIVITY_INSTANCE_TRANSACTION: { 417 data.enforceInterface(IActivityManager.descriptor); 418 IBinder token = data.readStrongBinder(); 419 boolean res = releaseActivityInstance(token); 420 reply.writeNoException(); 421 reply.writeInt(res ? 1 : 0); 422 return true; 423 } 424 425 case RELEASE_SOME_ACTIVITIES_TRANSACTION: { 426 data.enforceInterface(IActivityManager.descriptor); 427 IApplicationThread app = ApplicationThreadNative.asInterface(data.readStrongBinder()); 428 releaseSomeActivities(app); 429 reply.writeNoException(); 430 return true; 431 } 432 433 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: { 434 data.enforceInterface(IActivityManager.descriptor); 435 IBinder token = data.readStrongBinder(); 436 boolean res = willActivityBeVisible(token); 437 reply.writeNoException(); 438 reply.writeInt(res ? 1 : 0); 439 return true; 440 } 441 442 case REGISTER_RECEIVER_TRANSACTION: 443 { 444 data.enforceInterface(IActivityManager.descriptor); 445 IBinder b = data.readStrongBinder(); 446 IApplicationThread app = 447 b != null ? ApplicationThreadNative.asInterface(b) : null; 448 String packageName = data.readString(); 449 b = data.readStrongBinder(); 450 IIntentReceiver rec 451 = b != null ? IIntentReceiver.Stub.asInterface(b) : null; 452 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data); 453 String perm = data.readString(); 454 int userId = data.readInt(); 455 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId); 456 reply.writeNoException(); 457 if (intent != null) { 458 reply.writeInt(1); 459 intent.writeToParcel(reply, 0); 460 } else { 461 reply.writeInt(0); 462 } 463 return true; 464 } 465 466 case UNREGISTER_RECEIVER_TRANSACTION: 467 { 468 data.enforceInterface(IActivityManager.descriptor); 469 IBinder b = data.readStrongBinder(); 470 if (b == null) { 471 return true; 472 } 473 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b); 474 unregisterReceiver(rec); 475 reply.writeNoException(); 476 return true; 477 } 478 479 case BROADCAST_INTENT_TRANSACTION: 480 { 481 data.enforceInterface(IActivityManager.descriptor); 482 IBinder b = data.readStrongBinder(); 483 IApplicationThread app = 484 b != null ? ApplicationThreadNative.asInterface(b) : null; 485 Intent intent = Intent.CREATOR.createFromParcel(data); 486 String resolvedType = data.readString(); 487 b = data.readStrongBinder(); 488 IIntentReceiver resultTo = 489 b != null ? IIntentReceiver.Stub.asInterface(b) : null; 490 int resultCode = data.readInt(); 491 String resultData = data.readString(); 492 Bundle resultExtras = data.readBundle(); 493 String[] perms = data.readStringArray(); 494 int appOp = data.readInt(); 495 Bundle options = data.readBundle(); 496 boolean serialized = data.readInt() != 0; 497 boolean sticky = data.readInt() != 0; 498 int userId = data.readInt(); 499 int res = broadcastIntent(app, intent, resolvedType, resultTo, 500 resultCode, resultData, resultExtras, perms, appOp, 501 options, serialized, sticky, userId); 502 reply.writeNoException(); 503 reply.writeInt(res); 504 return true; 505 } 506 507 case UNBROADCAST_INTENT_TRANSACTION: 508 { 509 data.enforceInterface(IActivityManager.descriptor); 510 IBinder b = data.readStrongBinder(); 511 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null; 512 Intent intent = Intent.CREATOR.createFromParcel(data); 513 int userId = data.readInt(); 514 unbroadcastIntent(app, intent, userId); 515 reply.writeNoException(); 516 return true; 517 } 518 519 case FINISH_RECEIVER_TRANSACTION: { 520 data.enforceInterface(IActivityManager.descriptor); 521 IBinder who = data.readStrongBinder(); 522 int resultCode = data.readInt(); 523 String resultData = data.readString(); 524 Bundle resultExtras = data.readBundle(); 525 boolean resultAbort = data.readInt() != 0; 526 int intentFlags = data.readInt(); 527 if (who != null) { 528 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort, intentFlags); 529 } 530 reply.writeNoException(); 531 return true; 532 } 533 534 case ATTACH_APPLICATION_TRANSACTION: { 535 data.enforceInterface(IActivityManager.descriptor); 536 IApplicationThread app = ApplicationThreadNative.asInterface( 537 data.readStrongBinder()); 538 if (app != null) { 539 attachApplication(app); 540 } 541 reply.writeNoException(); 542 return true; 543 } 544 545 case ACTIVITY_IDLE_TRANSACTION: { 546 data.enforceInterface(IActivityManager.descriptor); 547 IBinder token = data.readStrongBinder(); 548 Configuration config = null; 549 if (data.readInt() != 0) { 550 config = Configuration.CREATOR.createFromParcel(data); 551 } 552 boolean stopProfiling = data.readInt() != 0; 553 if (token != null) { 554 activityIdle(token, config, stopProfiling); 555 } 556 reply.writeNoException(); 557 return true; 558 } 559 560 case ACTIVITY_RESUMED_TRANSACTION: { 561 data.enforceInterface(IActivityManager.descriptor); 562 IBinder token = data.readStrongBinder(); 563 activityResumed(token); 564 reply.writeNoException(); 565 return true; 566 } 567 568 case ACTIVITY_PAUSED_TRANSACTION: { 569 data.enforceInterface(IActivityManager.descriptor); 570 IBinder token = data.readStrongBinder(); 571 activityPaused(token); 572 reply.writeNoException(); 573 return true; 574 } 575 576 case ACTIVITY_STOPPED_TRANSACTION: { 577 data.enforceInterface(IActivityManager.descriptor); 578 IBinder token = data.readStrongBinder(); 579 Bundle map = data.readBundle(); 580 PersistableBundle persistentState = data.readPersistableBundle(); 581 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); 582 activityStopped(token, map, persistentState, description); 583 reply.writeNoException(); 584 return true; 585 } 586 587 case ACTIVITY_SLEPT_TRANSACTION: { 588 data.enforceInterface(IActivityManager.descriptor); 589 IBinder token = data.readStrongBinder(); 590 activitySlept(token); 591 reply.writeNoException(); 592 return true; 593 } 594 595 case ACTIVITY_DESTROYED_TRANSACTION: { 596 data.enforceInterface(IActivityManager.descriptor); 597 IBinder token = data.readStrongBinder(); 598 activityDestroyed(token); 599 reply.writeNoException(); 600 return true; 601 } 602 603 case ACTIVITY_RELAUNCHED_TRANSACTION: { 604 data.enforceInterface(IActivityManager.descriptor); 605 IBinder token = data.readStrongBinder(); 606 activityRelaunched(token); 607 reply.writeNoException(); 608 return true; 609 } 610 611 case GET_CALLING_PACKAGE_TRANSACTION: { 612 data.enforceInterface(IActivityManager.descriptor); 613 IBinder token = data.readStrongBinder(); 614 String res = token != null ? getCallingPackage(token) : null; 615 reply.writeNoException(); 616 reply.writeString(res); 617 return true; 618 } 619 620 case GET_CALLING_ACTIVITY_TRANSACTION: { 621 data.enforceInterface(IActivityManager.descriptor); 622 IBinder token = data.readStrongBinder(); 623 ComponentName cn = getCallingActivity(token); 624 reply.writeNoException(); 625 ComponentName.writeToParcel(cn, reply); 626 return true; 627 } 628 629 case GET_APP_TASKS_TRANSACTION: { 630 data.enforceInterface(IActivityManager.descriptor); 631 String callingPackage = data.readString(); 632 List<IAppTask> list = getAppTasks(callingPackage); 633 reply.writeNoException(); 634 int N = list != null ? list.size() : -1; 635 reply.writeInt(N); 636 int i; 637 for (i=0; i<N; i++) { 638 IAppTask task = list.get(i); 639 reply.writeStrongBinder(task.asBinder()); 640 } 641 return true; 642 } 643 644 case ADD_APP_TASK_TRANSACTION: { 645 data.enforceInterface(IActivityManager.descriptor); 646 IBinder activityToken = data.readStrongBinder(); 647 Intent intent = Intent.CREATOR.createFromParcel(data); 648 ActivityManager.TaskDescription descr 649 = ActivityManager.TaskDescription.CREATOR.createFromParcel(data); 650 Bitmap thumbnail = Bitmap.CREATOR.createFromParcel(data); 651 int res = addAppTask(activityToken, intent, descr, thumbnail); 652 reply.writeNoException(); 653 reply.writeInt(res); 654 return true; 655 } 656 657 case GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION: { 658 data.enforceInterface(IActivityManager.descriptor); 659 Point size = getAppTaskThumbnailSize(); 660 reply.writeNoException(); 661 size.writeToParcel(reply, 0); 662 return true; 663 } 664 665 case GET_TASKS_TRANSACTION: { 666 data.enforceInterface(IActivityManager.descriptor); 667 int maxNum = data.readInt(); 668 int fl = data.readInt(); 669 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl); 670 reply.writeNoException(); 671 int N = list != null ? list.size() : -1; 672 reply.writeInt(N); 673 int i; 674 for (i=0; i<N; i++) { 675 ActivityManager.RunningTaskInfo info = list.get(i); 676 info.writeToParcel(reply, 0); 677 } 678 return true; 679 } 680 681 case GET_RECENT_TASKS_TRANSACTION: { 682 data.enforceInterface(IActivityManager.descriptor); 683 int maxNum = data.readInt(); 684 int fl = data.readInt(); 685 int userId = data.readInt(); 686 ParceledListSlice<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum, 687 fl, userId); 688 reply.writeNoException(); 689 list.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 690 return true; 691 } 692 693 case GET_TASK_THUMBNAIL_TRANSACTION: { 694 data.enforceInterface(IActivityManager.descriptor); 695 int id = data.readInt(); 696 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id); 697 reply.writeNoException(); 698 if (taskThumbnail != null) { 699 reply.writeInt(1); 700 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 701 } else { 702 reply.writeInt(0); 703 } 704 return true; 705 } 706 707 case GET_SERVICES_TRANSACTION: { 708 data.enforceInterface(IActivityManager.descriptor); 709 int maxNum = data.readInt(); 710 int fl = data.readInt(); 711 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl); 712 reply.writeNoException(); 713 int N = list != null ? list.size() : -1; 714 reply.writeInt(N); 715 int i; 716 for (i=0; i<N; i++) { 717 ActivityManager.RunningServiceInfo info = list.get(i); 718 info.writeToParcel(reply, 0); 719 } 720 return true; 721 } 722 723 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: { 724 data.enforceInterface(IActivityManager.descriptor); 725 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState(); 726 reply.writeNoException(); 727 reply.writeTypedList(list); 728 return true; 729 } 730 731 case GET_RUNNING_APP_PROCESSES_TRANSACTION: { 732 data.enforceInterface(IActivityManager.descriptor); 733 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses(); 734 reply.writeNoException(); 735 reply.writeTypedList(list); 736 return true; 737 } 738 739 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: { 740 data.enforceInterface(IActivityManager.descriptor); 741 List<ApplicationInfo> list = getRunningExternalApplications(); 742 reply.writeNoException(); 743 reply.writeTypedList(list); 744 return true; 745 } 746 747 case MOVE_TASK_TO_FRONT_TRANSACTION: { 748 data.enforceInterface(IActivityManager.descriptor); 749 int task = data.readInt(); 750 int fl = data.readInt(); 751 Bundle options = data.readInt() != 0 752 ? Bundle.CREATOR.createFromParcel(data) : null; 753 moveTaskToFront(task, fl, options); 754 reply.writeNoException(); 755 return true; 756 } 757 758 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: { 759 data.enforceInterface(IActivityManager.descriptor); 760 IBinder token = data.readStrongBinder(); 761 boolean nonRoot = data.readInt() != 0; 762 boolean res = moveActivityTaskToBack(token, nonRoot); 763 reply.writeNoException(); 764 reply.writeInt(res ? 1 : 0); 765 return true; 766 } 767 768 case MOVE_TASK_BACKWARDS_TRANSACTION: { 769 data.enforceInterface(IActivityManager.descriptor); 770 int task = data.readInt(); 771 moveTaskBackwards(task); 772 reply.writeNoException(); 773 return true; 774 } 775 776 case MOVE_TASK_TO_STACK_TRANSACTION: { 777 data.enforceInterface(IActivityManager.descriptor); 778 int taskId = data.readInt(); 779 int stackId = data.readInt(); 780 boolean toTop = data.readInt() != 0; 781 moveTaskToStack(taskId, stackId, toTop); 782 reply.writeNoException(); 783 return true; 784 } 785 786 case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: { 787 data.enforceInterface(IActivityManager.descriptor); 788 int taskId = data.readInt(); 789 int createMode = data.readInt(); 790 boolean toTop = data.readInt() != 0; 791 boolean animate = data.readInt() != 0; 792 Rect bounds = null; 793 boolean hasBounds = data.readInt() != 0; 794 if (hasBounds) { 795 bounds = Rect.CREATOR.createFromParcel(data); 796 } 797 final boolean moveHomeStackFront = data.readInt() != 0; 798 final boolean res = moveTaskToDockedStack( 799 taskId, createMode, toTop, animate, bounds, moveHomeStackFront); 800 reply.writeNoException(); 801 reply.writeInt(res ? 1 : 0); 802 return true; 803 } 804 805 case MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION: { 806 data.enforceInterface(IActivityManager.descriptor); 807 final int stackId = data.readInt(); 808 final Rect r = Rect.CREATOR.createFromParcel(data); 809 final boolean res = moveTopActivityToPinnedStack(stackId, r); 810 reply.writeNoException(); 811 reply.writeInt(res ? 1 : 0); 812 return true; 813 } 814 815 case RESIZE_STACK_TRANSACTION: { 816 data.enforceInterface(IActivityManager.descriptor); 817 final int stackId = data.readInt(); 818 final boolean hasRect = data.readInt() != 0; 819 Rect r = null; 820 if (hasRect) { 821 r = Rect.CREATOR.createFromParcel(data); 822 } 823 final boolean allowResizeInDockedMode = data.readInt() == 1; 824 final boolean preserveWindows = data.readInt() == 1; 825 final boolean animate = data.readInt() == 1; 826 final int animationDuration = data.readInt(); 827 resizeStack(stackId, 828 r, allowResizeInDockedMode, preserveWindows, animate, animationDuration); 829 reply.writeNoException(); 830 return true; 831 } 832 case RESIZE_PINNED_STACK_TRANSACTION: { 833 data.enforceInterface(IActivityManager.descriptor); 834 final boolean hasBounds = data.readInt() != 0; 835 Rect bounds = null; 836 if (hasBounds) { 837 bounds = Rect.CREATOR.createFromParcel(data); 838 } 839 final boolean hasTempPinnedTaskBounds = data.readInt() != 0; 840 Rect tempPinnedTaskBounds = null; 841 if (hasTempPinnedTaskBounds) { 842 tempPinnedTaskBounds = Rect.CREATOR.createFromParcel(data); 843 } 844 resizePinnedStack(bounds, tempPinnedTaskBounds); 845 return true; 846 } 847 case SWAP_DOCKED_AND_FULLSCREEN_STACK: { 848 data.enforceInterface(IActivityManager.descriptor); 849 swapDockedAndFullscreenStack(); 850 reply.writeNoException(); 851 return true; 852 } 853 case RESIZE_DOCKED_STACK_TRANSACTION: { 854 data.enforceInterface(IActivityManager.descriptor); 855 final boolean hasBounds = data.readInt() != 0; 856 Rect bounds = null; 857 if (hasBounds) { 858 bounds = Rect.CREATOR.createFromParcel(data); 859 } 860 final boolean hasTempDockedTaskBounds = data.readInt() != 0; 861 Rect tempDockedTaskBounds = null; 862 if (hasTempDockedTaskBounds) { 863 tempDockedTaskBounds = Rect.CREATOR.createFromParcel(data); 864 } 865 final boolean hasTempDockedTaskInsetBounds = data.readInt() != 0; 866 Rect tempDockedTaskInsetBounds = null; 867 if (hasTempDockedTaskInsetBounds) { 868 tempDockedTaskInsetBounds = Rect.CREATOR.createFromParcel(data); 869 } 870 final boolean hasTempOtherTaskBounds = data.readInt() != 0; 871 Rect tempOtherTaskBounds = null; 872 if (hasTempOtherTaskBounds) { 873 tempOtherTaskBounds = Rect.CREATOR.createFromParcel(data); 874 } 875 final boolean hasTempOtherTaskInsetBounds = data.readInt() != 0; 876 Rect tempOtherTaskInsetBounds = null; 877 if (hasTempOtherTaskInsetBounds) { 878 tempOtherTaskInsetBounds = Rect.CREATOR.createFromParcel(data); 879 } 880 resizeDockedStack(bounds, tempDockedTaskBounds, tempDockedTaskInsetBounds, 881 tempOtherTaskBounds, tempOtherTaskInsetBounds); 882 reply.writeNoException(); 883 return true; 884 } 885 886 case POSITION_TASK_IN_STACK_TRANSACTION: { 887 data.enforceInterface(IActivityManager.descriptor); 888 int taskId = data.readInt(); 889 int stackId = data.readInt(); 890 int position = data.readInt(); 891 positionTaskInStack(taskId, stackId, position); 892 reply.writeNoException(); 893 return true; 894 } 895 896 case GET_ALL_STACK_INFOS_TRANSACTION: { 897 data.enforceInterface(IActivityManager.descriptor); 898 List<StackInfo> list = getAllStackInfos(); 899 reply.writeNoException(); 900 reply.writeTypedList(list); 901 return true; 902 } 903 904 case GET_STACK_INFO_TRANSACTION: { 905 data.enforceInterface(IActivityManager.descriptor); 906 int stackId = data.readInt(); 907 StackInfo info = getStackInfo(stackId); 908 reply.writeNoException(); 909 if (info != null) { 910 reply.writeInt(1); 911 info.writeToParcel(reply, 0); 912 } else { 913 reply.writeInt(0); 914 } 915 return true; 916 } 917 918 case IS_IN_HOME_STACK_TRANSACTION: { 919 data.enforceInterface(IActivityManager.descriptor); 920 int taskId = data.readInt(); 921 boolean isInHomeStack = isInHomeStack(taskId); 922 reply.writeNoException(); 923 reply.writeInt(isInHomeStack ? 1 : 0); 924 return true; 925 } 926 927 case SET_FOCUSED_STACK_TRANSACTION: { 928 data.enforceInterface(IActivityManager.descriptor); 929 int stackId = data.readInt(); 930 setFocusedStack(stackId); 931 reply.writeNoException(); 932 return true; 933 } 934 935 case GET_FOCUSED_STACK_ID_TRANSACTION: { 936 data.enforceInterface(IActivityManager.descriptor); 937 int focusedStackId = getFocusedStackId(); 938 reply.writeNoException(); 939 reply.writeInt(focusedStackId); 940 return true; 941 } 942 943 case SET_FOCUSED_TASK_TRANSACTION: { 944 data.enforceInterface(IActivityManager.descriptor); 945 int taskId = data.readInt(); 946 setFocusedTask(taskId); 947 reply.writeNoException(); 948 return true; 949 } 950 951 case REGISTER_TASK_STACK_LISTENER_TRANSACTION: { 952 data.enforceInterface(IActivityManager.descriptor); 953 IBinder token = data.readStrongBinder(); 954 registerTaskStackListener(ITaskStackListener.Stub.asInterface(token)); 955 reply.writeNoException(); 956 return true; 957 } 958 959 case GET_TASK_FOR_ACTIVITY_TRANSACTION: { 960 data.enforceInterface(IActivityManager.descriptor); 961 IBinder token = data.readStrongBinder(); 962 boolean onlyRoot = data.readInt() != 0; 963 int res = token != null 964 ? getTaskForActivity(token, onlyRoot) : -1; 965 reply.writeNoException(); 966 reply.writeInt(res); 967 return true; 968 } 969 970 case GET_CONTENT_PROVIDER_TRANSACTION: { 971 data.enforceInterface(IActivityManager.descriptor); 972 IBinder b = data.readStrongBinder(); 973 IApplicationThread app = ApplicationThreadNative.asInterface(b); 974 String name = data.readString(); 975 int userId = data.readInt(); 976 boolean stable = data.readInt() != 0; 977 ContentProviderHolder cph = getContentProvider(app, name, userId, stable); 978 reply.writeNoException(); 979 if (cph != null) { 980 reply.writeInt(1); 981 cph.writeToParcel(reply, 0); 982 } else { 983 reply.writeInt(0); 984 } 985 return true; 986 } 987 988 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { 989 data.enforceInterface(IActivityManager.descriptor); 990 String name = data.readString(); 991 int userId = data.readInt(); 992 IBinder token = data.readStrongBinder(); 993 ContentProviderHolder cph = getContentProviderExternal(name, userId, token); 994 reply.writeNoException(); 995 if (cph != null) { 996 reply.writeInt(1); 997 cph.writeToParcel(reply, 0); 998 } else { 999 reply.writeInt(0); 1000 } 1001 return true; 1002 } 1003 1004 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: { 1005 data.enforceInterface(IActivityManager.descriptor); 1006 IBinder b = data.readStrongBinder(); 1007 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1008 ArrayList<ContentProviderHolder> providers = 1009 data.createTypedArrayList(ContentProviderHolder.CREATOR); 1010 publishContentProviders(app, providers); 1011 reply.writeNoException(); 1012 return true; 1013 } 1014 1015 case REF_CONTENT_PROVIDER_TRANSACTION: { 1016 data.enforceInterface(IActivityManager.descriptor); 1017 IBinder b = data.readStrongBinder(); 1018 int stable = data.readInt(); 1019 int unstable = data.readInt(); 1020 boolean res = refContentProvider(b, stable, unstable); 1021 reply.writeNoException(); 1022 reply.writeInt(res ? 1 : 0); 1023 return true; 1024 } 1025 1026 case UNSTABLE_PROVIDER_DIED_TRANSACTION: { 1027 data.enforceInterface(IActivityManager.descriptor); 1028 IBinder b = data.readStrongBinder(); 1029 unstableProviderDied(b); 1030 reply.writeNoException(); 1031 return true; 1032 } 1033 1034 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: { 1035 data.enforceInterface(IActivityManager.descriptor); 1036 IBinder b = data.readStrongBinder(); 1037 appNotRespondingViaProvider(b); 1038 reply.writeNoException(); 1039 return true; 1040 } 1041 1042 case REMOVE_CONTENT_PROVIDER_TRANSACTION: { 1043 data.enforceInterface(IActivityManager.descriptor); 1044 IBinder b = data.readStrongBinder(); 1045 boolean stable = data.readInt() != 0; 1046 removeContentProvider(b, stable); 1047 reply.writeNoException(); 1048 return true; 1049 } 1050 1051 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: { 1052 data.enforceInterface(IActivityManager.descriptor); 1053 String name = data.readString(); 1054 IBinder token = data.readStrongBinder(); 1055 removeContentProviderExternal(name, token); 1056 reply.writeNoException(); 1057 return true; 1058 } 1059 1060 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: { 1061 data.enforceInterface(IActivityManager.descriptor); 1062 ComponentName comp = ComponentName.CREATOR.createFromParcel(data); 1063 PendingIntent pi = getRunningServiceControlPanel(comp); 1064 reply.writeNoException(); 1065 PendingIntent.writePendingIntentOrNullToParcel(pi, reply); 1066 return true; 1067 } 1068 1069 case START_SERVICE_TRANSACTION: { 1070 data.enforceInterface(IActivityManager.descriptor); 1071 IBinder b = data.readStrongBinder(); 1072 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1073 Intent service = Intent.CREATOR.createFromParcel(data); 1074 String resolvedType = data.readString(); 1075 String callingPackage = data.readString(); 1076 int userId = data.readInt(); 1077 ComponentName cn = startService(app, service, resolvedType, callingPackage, userId); 1078 reply.writeNoException(); 1079 ComponentName.writeToParcel(cn, reply); 1080 return true; 1081 } 1082 1083 case STOP_SERVICE_TRANSACTION: { 1084 data.enforceInterface(IActivityManager.descriptor); 1085 IBinder b = data.readStrongBinder(); 1086 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1087 Intent service = Intent.CREATOR.createFromParcel(data); 1088 String resolvedType = data.readString(); 1089 int userId = data.readInt(); 1090 int res = stopService(app, service, resolvedType, userId); 1091 reply.writeNoException(); 1092 reply.writeInt(res); 1093 return true; 1094 } 1095 1096 case STOP_SERVICE_TOKEN_TRANSACTION: { 1097 data.enforceInterface(IActivityManager.descriptor); 1098 ComponentName className = ComponentName.readFromParcel(data); 1099 IBinder token = data.readStrongBinder(); 1100 int startId = data.readInt(); 1101 boolean res = stopServiceToken(className, token, startId); 1102 reply.writeNoException(); 1103 reply.writeInt(res ? 1 : 0); 1104 return true; 1105 } 1106 1107 case SET_SERVICE_FOREGROUND_TRANSACTION: { 1108 data.enforceInterface(IActivityManager.descriptor); 1109 ComponentName className = ComponentName.readFromParcel(data); 1110 IBinder token = data.readStrongBinder(); 1111 int id = data.readInt(); 1112 Notification notification = null; 1113 if (data.readInt() != 0) { 1114 notification = Notification.CREATOR.createFromParcel(data); 1115 } 1116 int sflags = data.readInt(); 1117 setServiceForeground(className, token, id, notification, sflags); 1118 reply.writeNoException(); 1119 return true; 1120 } 1121 1122 case BIND_SERVICE_TRANSACTION: { 1123 data.enforceInterface(IActivityManager.descriptor); 1124 IBinder b = data.readStrongBinder(); 1125 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1126 IBinder token = data.readStrongBinder(); 1127 Intent service = Intent.CREATOR.createFromParcel(data); 1128 String resolvedType = data.readString(); 1129 b = data.readStrongBinder(); 1130 int fl = data.readInt(); 1131 String callingPackage = data.readString(); 1132 int userId = data.readInt(); 1133 IServiceConnection conn = IServiceConnection.Stub.asInterface(b); 1134 int res = bindService(app, token, service, resolvedType, conn, fl, 1135 callingPackage, userId); 1136 reply.writeNoException(); 1137 reply.writeInt(res); 1138 return true; 1139 } 1140 1141 case UNBIND_SERVICE_TRANSACTION: { 1142 data.enforceInterface(IActivityManager.descriptor); 1143 IBinder b = data.readStrongBinder(); 1144 IServiceConnection conn = IServiceConnection.Stub.asInterface(b); 1145 boolean res = unbindService(conn); 1146 reply.writeNoException(); 1147 reply.writeInt(res ? 1 : 0); 1148 return true; 1149 } 1150 1151 case PUBLISH_SERVICE_TRANSACTION: { 1152 data.enforceInterface(IActivityManager.descriptor); 1153 IBinder token = data.readStrongBinder(); 1154 Intent intent = Intent.CREATOR.createFromParcel(data); 1155 IBinder service = data.readStrongBinder(); 1156 publishService(token, intent, service); 1157 reply.writeNoException(); 1158 return true; 1159 } 1160 1161 case UNBIND_FINISHED_TRANSACTION: { 1162 data.enforceInterface(IActivityManager.descriptor); 1163 IBinder token = data.readStrongBinder(); 1164 Intent intent = Intent.CREATOR.createFromParcel(data); 1165 boolean doRebind = data.readInt() != 0; 1166 unbindFinished(token, intent, doRebind); 1167 reply.writeNoException(); 1168 return true; 1169 } 1170 1171 case SERVICE_DONE_EXECUTING_TRANSACTION: { 1172 data.enforceInterface(IActivityManager.descriptor); 1173 IBinder token = data.readStrongBinder(); 1174 int type = data.readInt(); 1175 int startId = data.readInt(); 1176 int res = data.readInt(); 1177 serviceDoneExecuting(token, type, startId, res); 1178 reply.writeNoException(); 1179 return true; 1180 } 1181 1182 case START_INSTRUMENTATION_TRANSACTION: { 1183 data.enforceInterface(IActivityManager.descriptor); 1184 ComponentName className = ComponentName.readFromParcel(data); 1185 String profileFile = data.readString(); 1186 int fl = data.readInt(); 1187 Bundle arguments = data.readBundle(); 1188 IBinder b = data.readStrongBinder(); 1189 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b); 1190 b = data.readStrongBinder(); 1191 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b); 1192 int userId = data.readInt(); 1193 String abiOverride = data.readString(); 1194 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId, 1195 abiOverride); 1196 reply.writeNoException(); 1197 reply.writeInt(res ? 1 : 0); 1198 return true; 1199 } 1200 1201 1202 case FINISH_INSTRUMENTATION_TRANSACTION: { 1203 data.enforceInterface(IActivityManager.descriptor); 1204 IBinder b = data.readStrongBinder(); 1205 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1206 int resultCode = data.readInt(); 1207 Bundle results = data.readBundle(); 1208 finishInstrumentation(app, resultCode, results); 1209 reply.writeNoException(); 1210 return true; 1211 } 1212 1213 case GET_CONFIGURATION_TRANSACTION: { 1214 data.enforceInterface(IActivityManager.descriptor); 1215 Configuration config = getConfiguration(); 1216 reply.writeNoException(); 1217 config.writeToParcel(reply, 0); 1218 return true; 1219 } 1220 1221 case UPDATE_CONFIGURATION_TRANSACTION: { 1222 data.enforceInterface(IActivityManager.descriptor); 1223 Configuration config = Configuration.CREATOR.createFromParcel(data); 1224 updateConfiguration(config); 1225 reply.writeNoException(); 1226 return true; 1227 } 1228 1229 case SET_REQUESTED_ORIENTATION_TRANSACTION: { 1230 data.enforceInterface(IActivityManager.descriptor); 1231 IBinder token = data.readStrongBinder(); 1232 int requestedOrientation = data.readInt(); 1233 setRequestedOrientation(token, requestedOrientation); 1234 reply.writeNoException(); 1235 return true; 1236 } 1237 1238 case GET_REQUESTED_ORIENTATION_TRANSACTION: { 1239 data.enforceInterface(IActivityManager.descriptor); 1240 IBinder token = data.readStrongBinder(); 1241 int req = getRequestedOrientation(token); 1242 reply.writeNoException(); 1243 reply.writeInt(req); 1244 return true; 1245 } 1246 1247 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: { 1248 data.enforceInterface(IActivityManager.descriptor); 1249 IBinder token = data.readStrongBinder(); 1250 ComponentName cn = getActivityClassForToken(token); 1251 reply.writeNoException(); 1252 ComponentName.writeToParcel(cn, reply); 1253 return true; 1254 } 1255 1256 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: { 1257 data.enforceInterface(IActivityManager.descriptor); 1258 IBinder token = data.readStrongBinder(); 1259 reply.writeNoException(); 1260 reply.writeString(getPackageForToken(token)); 1261 return true; 1262 } 1263 1264 case GET_INTENT_SENDER_TRANSACTION: { 1265 data.enforceInterface(IActivityManager.descriptor); 1266 int type = data.readInt(); 1267 String packageName = data.readString(); 1268 IBinder token = data.readStrongBinder(); 1269 String resultWho = data.readString(); 1270 int requestCode = data.readInt(); 1271 Intent[] requestIntents; 1272 String[] requestResolvedTypes; 1273 if (data.readInt() != 0) { 1274 requestIntents = data.createTypedArray(Intent.CREATOR); 1275 requestResolvedTypes = data.createStringArray(); 1276 } else { 1277 requestIntents = null; 1278 requestResolvedTypes = null; 1279 } 1280 int fl = data.readInt(); 1281 Bundle options = data.readInt() != 0 1282 ? Bundle.CREATOR.createFromParcel(data) : null; 1283 int userId = data.readInt(); 1284 IIntentSender res = getIntentSender(type, packageName, token, 1285 resultWho, requestCode, requestIntents, 1286 requestResolvedTypes, fl, options, userId); 1287 reply.writeNoException(); 1288 reply.writeStrongBinder(res != null ? res.asBinder() : null); 1289 return true; 1290 } 1291 1292 case CANCEL_INTENT_SENDER_TRANSACTION: { 1293 data.enforceInterface(IActivityManager.descriptor); 1294 IIntentSender r = IIntentSender.Stub.asInterface( 1295 data.readStrongBinder()); 1296 cancelIntentSender(r); 1297 reply.writeNoException(); 1298 return true; 1299 } 1300 1301 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: { 1302 data.enforceInterface(IActivityManager.descriptor); 1303 IIntentSender r = IIntentSender.Stub.asInterface( 1304 data.readStrongBinder()); 1305 String res = getPackageForIntentSender(r); 1306 reply.writeNoException(); 1307 reply.writeString(res); 1308 return true; 1309 } 1310 1311 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: { 1312 data.enforceInterface(IActivityManager.descriptor); 1313 IIntentSender r = IIntentSender.Stub.asInterface( 1314 data.readStrongBinder()); 1315 int res = getUidForIntentSender(r); 1316 reply.writeNoException(); 1317 reply.writeInt(res); 1318 return true; 1319 } 1320 1321 case HANDLE_INCOMING_USER_TRANSACTION: { 1322 data.enforceInterface(IActivityManager.descriptor); 1323 int callingPid = data.readInt(); 1324 int callingUid = data.readInt(); 1325 int userId = data.readInt(); 1326 boolean allowAll = data.readInt() != 0 ; 1327 boolean requireFull = data.readInt() != 0; 1328 String name = data.readString(); 1329 String callerPackage = data.readString(); 1330 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll, 1331 requireFull, name, callerPackage); 1332 reply.writeNoException(); 1333 reply.writeInt(res); 1334 return true; 1335 } 1336 1337 case SET_PROCESS_LIMIT_TRANSACTION: { 1338 data.enforceInterface(IActivityManager.descriptor); 1339 int max = data.readInt(); 1340 setProcessLimit(max); 1341 reply.writeNoException(); 1342 return true; 1343 } 1344 1345 case GET_PROCESS_LIMIT_TRANSACTION: { 1346 data.enforceInterface(IActivityManager.descriptor); 1347 int limit = getProcessLimit(); 1348 reply.writeNoException(); 1349 reply.writeInt(limit); 1350 return true; 1351 } 1352 1353 case SET_PROCESS_FOREGROUND_TRANSACTION: { 1354 data.enforceInterface(IActivityManager.descriptor); 1355 IBinder token = data.readStrongBinder(); 1356 int pid = data.readInt(); 1357 boolean isForeground = data.readInt() != 0; 1358 setProcessForeground(token, pid, isForeground); 1359 reply.writeNoException(); 1360 return true; 1361 } 1362 1363 case CHECK_PERMISSION_TRANSACTION: { 1364 data.enforceInterface(IActivityManager.descriptor); 1365 String perm = data.readString(); 1366 int pid = data.readInt(); 1367 int uid = data.readInt(); 1368 int res = checkPermission(perm, pid, uid); 1369 reply.writeNoException(); 1370 reply.writeInt(res); 1371 return true; 1372 } 1373 1374 case CHECK_PERMISSION_WITH_TOKEN_TRANSACTION: { 1375 data.enforceInterface(IActivityManager.descriptor); 1376 String perm = data.readString(); 1377 int pid = data.readInt(); 1378 int uid = data.readInt(); 1379 IBinder token = data.readStrongBinder(); 1380 int res = checkPermissionWithToken(perm, pid, uid, token); 1381 reply.writeNoException(); 1382 reply.writeInt(res); 1383 return true; 1384 } 1385 1386 case CHECK_URI_PERMISSION_TRANSACTION: { 1387 data.enforceInterface(IActivityManager.descriptor); 1388 Uri uri = Uri.CREATOR.createFromParcel(data); 1389 int pid = data.readInt(); 1390 int uid = data.readInt(); 1391 int mode = data.readInt(); 1392 int userId = data.readInt(); 1393 IBinder callerToken = data.readStrongBinder(); 1394 int res = checkUriPermission(uri, pid, uid, mode, userId, callerToken); 1395 reply.writeNoException(); 1396 reply.writeInt(res); 1397 return true; 1398 } 1399 1400 case CLEAR_APP_DATA_TRANSACTION: { 1401 data.enforceInterface(IActivityManager.descriptor); 1402 String packageName = data.readString(); 1403 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface( 1404 data.readStrongBinder()); 1405 int userId = data.readInt(); 1406 boolean res = clearApplicationUserData(packageName, observer, userId); 1407 reply.writeNoException(); 1408 reply.writeInt(res ? 1 : 0); 1409 return true; 1410 } 1411 1412 case GRANT_URI_PERMISSION_TRANSACTION: { 1413 data.enforceInterface(IActivityManager.descriptor); 1414 IBinder b = data.readStrongBinder(); 1415 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1416 String targetPkg = data.readString(); 1417 Uri uri = Uri.CREATOR.createFromParcel(data); 1418 int mode = data.readInt(); 1419 int userId = data.readInt(); 1420 grantUriPermission(app, targetPkg, uri, mode, userId); 1421 reply.writeNoException(); 1422 return true; 1423 } 1424 1425 case REVOKE_URI_PERMISSION_TRANSACTION: { 1426 data.enforceInterface(IActivityManager.descriptor); 1427 IBinder b = data.readStrongBinder(); 1428 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1429 Uri uri = Uri.CREATOR.createFromParcel(data); 1430 int mode = data.readInt(); 1431 int userId = data.readInt(); 1432 revokeUriPermission(app, uri, mode, userId); 1433 reply.writeNoException(); 1434 return true; 1435 } 1436 1437 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: { 1438 data.enforceInterface(IActivityManager.descriptor); 1439 Uri uri = Uri.CREATOR.createFromParcel(data); 1440 int mode = data.readInt(); 1441 int userId = data.readInt(); 1442 takePersistableUriPermission(uri, mode, userId); 1443 reply.writeNoException(); 1444 return true; 1445 } 1446 1447 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: { 1448 data.enforceInterface(IActivityManager.descriptor); 1449 Uri uri = Uri.CREATOR.createFromParcel(data); 1450 int mode = data.readInt(); 1451 int userId = data.readInt(); 1452 releasePersistableUriPermission(uri, mode, userId); 1453 reply.writeNoException(); 1454 return true; 1455 } 1456 1457 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: { 1458 data.enforceInterface(IActivityManager.descriptor); 1459 final String packageName = data.readString(); 1460 final boolean incoming = data.readInt() != 0; 1461 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions( 1462 packageName, incoming); 1463 reply.writeNoException(); 1464 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1465 return true; 1466 } 1467 1468 case GET_GRANTED_URI_PERMISSIONS_TRANSACTION: { 1469 data.enforceInterface(IActivityManager.descriptor); 1470 final String packageName = data.readString(); 1471 final int userId = data.readInt(); 1472 final ParceledListSlice<UriPermission> perms = getGrantedUriPermissions(packageName, 1473 userId); 1474 reply.writeNoException(); 1475 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1476 return true; 1477 } 1478 1479 case CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION: { 1480 data.enforceInterface(IActivityManager.descriptor); 1481 final String packageName = data.readString(); 1482 final int userId = data.readInt(); 1483 clearGrantedUriPermissions(packageName, userId); 1484 reply.writeNoException(); 1485 return true; 1486 } 1487 1488 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: { 1489 data.enforceInterface(IActivityManager.descriptor); 1490 IBinder b = data.readStrongBinder(); 1491 IApplicationThread app = ApplicationThreadNative.asInterface(b); 1492 boolean waiting = data.readInt() != 0; 1493 showWaitingForDebugger(app, waiting); 1494 reply.writeNoException(); 1495 return true; 1496 } 1497 1498 case GET_MEMORY_INFO_TRANSACTION: { 1499 data.enforceInterface(IActivityManager.descriptor); 1500 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); 1501 getMemoryInfo(mi); 1502 reply.writeNoException(); 1503 mi.writeToParcel(reply, 0); 1504 return true; 1505 } 1506 1507 case UNHANDLED_BACK_TRANSACTION: { 1508 data.enforceInterface(IActivityManager.descriptor); 1509 unhandledBack(); 1510 reply.writeNoException(); 1511 return true; 1512 } 1513 1514 case OPEN_CONTENT_URI_TRANSACTION: { 1515 data.enforceInterface(IActivityManager.descriptor); 1516 Uri uri = Uri.parse(data.readString()); 1517 ParcelFileDescriptor pfd = openContentUri(uri); 1518 reply.writeNoException(); 1519 if (pfd != null) { 1520 reply.writeInt(1); 1521 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1522 } else { 1523 reply.writeInt(0); 1524 } 1525 return true; 1526 } 1527 1528 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: { 1529 data.enforceInterface(IActivityManager.descriptor); 1530 final boolean showing = data.readInt() != 0; 1531 final boolean occluded = data.readInt() != 0; 1532 setLockScreenShown(showing, occluded); 1533 reply.writeNoException(); 1534 return true; 1535 } 1536 1537 case SET_DEBUG_APP_TRANSACTION: { 1538 data.enforceInterface(IActivityManager.descriptor); 1539 String pn = data.readString(); 1540 boolean wfd = data.readInt() != 0; 1541 boolean per = data.readInt() != 0; 1542 setDebugApp(pn, wfd, per); 1543 reply.writeNoException(); 1544 return true; 1545 } 1546 1547 case SET_ALWAYS_FINISH_TRANSACTION: { 1548 data.enforceInterface(IActivityManager.descriptor); 1549 boolean enabled = data.readInt() != 0; 1550 setAlwaysFinish(enabled); 1551 reply.writeNoException(); 1552 return true; 1553 } 1554 1555 case SET_ACTIVITY_CONTROLLER_TRANSACTION: { 1556 data.enforceInterface(IActivityManager.descriptor); 1557 IActivityController watcher = IActivityController.Stub.asInterface( 1558 data.readStrongBinder()); 1559 boolean imAMonkey = data.readInt() != 0; 1560 setActivityController(watcher, imAMonkey); 1561 reply.writeNoException(); 1562 return true; 1563 } 1564 1565 case SET_LENIENT_BACKGROUND_CHECK_TRANSACTION: { 1566 data.enforceInterface(IActivityManager.descriptor); 1567 boolean enabled = data.readInt() != 0; 1568 setLenientBackgroundCheck(enabled); 1569 reply.writeNoException(); 1570 return true; 1571 } 1572 1573 case GET_MEMORY_TRIM_LEVEL_TRANSACTION: { 1574 data.enforceInterface(IActivityManager.descriptor); 1575 int level = getMemoryTrimLevel(); 1576 reply.writeNoException(); 1577 reply.writeInt(level); 1578 return true; 1579 } 1580 1581 case ENTER_SAFE_MODE_TRANSACTION: { 1582 data.enforceInterface(IActivityManager.descriptor); 1583 enterSafeMode(); 1584 reply.writeNoException(); 1585 return true; 1586 } 1587 1588 case NOTE_WAKEUP_ALARM_TRANSACTION: { 1589 data.enforceInterface(IActivityManager.descriptor); 1590 IIntentSender is = IIntentSender.Stub.asInterface( 1591 data.readStrongBinder()); 1592 int sourceUid = data.readInt(); 1593 String sourcePkg = data.readString(); 1594 String tag = data.readString(); 1595 noteWakeupAlarm(is, sourceUid, sourcePkg, tag); 1596 reply.writeNoException(); 1597 return true; 1598 } 1599 1600 case NOTE_ALARM_START_TRANSACTION: { 1601 data.enforceInterface(IActivityManager.descriptor); 1602 IIntentSender is = IIntentSender.Stub.asInterface( 1603 data.readStrongBinder()); 1604 int sourceUid = data.readInt(); 1605 String tag = data.readString(); 1606 noteAlarmStart(is, sourceUid, tag); 1607 reply.writeNoException(); 1608 return true; 1609 } 1610 1611 case NOTE_ALARM_FINISH_TRANSACTION: { 1612 data.enforceInterface(IActivityManager.descriptor); 1613 IIntentSender is = IIntentSender.Stub.asInterface( 1614 data.readStrongBinder()); 1615 int sourceUid = data.readInt(); 1616 String tag = data.readString(); 1617 noteAlarmFinish(is, sourceUid, tag); 1618 reply.writeNoException(); 1619 return true; 1620 } 1621 1622 case KILL_PIDS_TRANSACTION: { 1623 data.enforceInterface(IActivityManager.descriptor); 1624 int[] pids = data.createIntArray(); 1625 String reason = data.readString(); 1626 boolean secure = data.readInt() != 0; 1627 boolean res = killPids(pids, reason, secure); 1628 reply.writeNoException(); 1629 reply.writeInt(res ? 1 : 0); 1630 return true; 1631 } 1632 1633 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: { 1634 data.enforceInterface(IActivityManager.descriptor); 1635 String reason = data.readString(); 1636 boolean res = killProcessesBelowForeground(reason); 1637 reply.writeNoException(); 1638 reply.writeInt(res ? 1 : 0); 1639 return true; 1640 } 1641 1642 case HANDLE_APPLICATION_CRASH_TRANSACTION: { 1643 data.enforceInterface(IActivityManager.descriptor); 1644 IBinder app = data.readStrongBinder(); 1645 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); 1646 handleApplicationCrash(app, ci); 1647 reply.writeNoException(); 1648 return true; 1649 } 1650 1651 case HANDLE_APPLICATION_WTF_TRANSACTION: { 1652 data.enforceInterface(IActivityManager.descriptor); 1653 IBinder app = data.readStrongBinder(); 1654 String tag = data.readString(); 1655 boolean system = data.readInt() != 0; 1656 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data); 1657 boolean res = handleApplicationWtf(app, tag, system, ci); 1658 reply.writeNoException(); 1659 reply.writeInt(res ? 1 : 0); 1660 return true; 1661 } 1662 1663 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: { 1664 data.enforceInterface(IActivityManager.descriptor); 1665 IBinder app = data.readStrongBinder(); 1666 int violationMask = data.readInt(); 1667 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data); 1668 handleApplicationStrictModeViolation(app, violationMask, info); 1669 reply.writeNoException(); 1670 return true; 1671 } 1672 1673 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: { 1674 data.enforceInterface(IActivityManager.descriptor); 1675 int sig = data.readInt(); 1676 signalPersistentProcesses(sig); 1677 reply.writeNoException(); 1678 return true; 1679 } 1680 1681 case KILL_BACKGROUND_PROCESSES_TRANSACTION: { 1682 data.enforceInterface(IActivityManager.descriptor); 1683 String packageName = data.readString(); 1684 int userId = data.readInt(); 1685 killBackgroundProcesses(packageName, userId); 1686 reply.writeNoException(); 1687 return true; 1688 } 1689 1690 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: { 1691 data.enforceInterface(IActivityManager.descriptor); 1692 killAllBackgroundProcesses(); 1693 reply.writeNoException(); 1694 return true; 1695 } 1696 1697 case KILL_PACKAGE_DEPENDENTS_TRANSACTION: { 1698 data.enforceInterface(IActivityManager.descriptor); 1699 String packageName = data.readString(); 1700 int userId = data.readInt(); 1701 killPackageDependents(packageName, userId); 1702 reply.writeNoException(); 1703 return true; 1704 } 1705 1706 case FORCE_STOP_PACKAGE_TRANSACTION: { 1707 data.enforceInterface(IActivityManager.descriptor); 1708 String packageName = data.readString(); 1709 int userId = data.readInt(); 1710 forceStopPackage(packageName, userId); 1711 reply.writeNoException(); 1712 return true; 1713 } 1714 1715 case GET_MY_MEMORY_STATE_TRANSACTION: { 1716 data.enforceInterface(IActivityManager.descriptor); 1717 ActivityManager.RunningAppProcessInfo info = 1718 new ActivityManager.RunningAppProcessInfo(); 1719 getMyMemoryState(info); 1720 reply.writeNoException(); 1721 info.writeToParcel(reply, 0); 1722 return true; 1723 } 1724 1725 case GET_DEVICE_CONFIGURATION_TRANSACTION: { 1726 data.enforceInterface(IActivityManager.descriptor); 1727 ConfigurationInfo config = getDeviceConfigurationInfo(); 1728 reply.writeNoException(); 1729 config.writeToParcel(reply, 0); 1730 return true; 1731 } 1732 1733 case PROFILE_CONTROL_TRANSACTION: { 1734 data.enforceInterface(IActivityManager.descriptor); 1735 String process = data.readString(); 1736 int userId = data.readInt(); 1737 boolean start = data.readInt() != 0; 1738 int profileType = data.readInt(); 1739 ProfilerInfo profilerInfo = data.readInt() != 0 1740 ? ProfilerInfo.CREATOR.createFromParcel(data) : null; 1741 boolean res = profileControl(process, userId, start, profilerInfo, profileType); 1742 reply.writeNoException(); 1743 reply.writeInt(res ? 1 : 0); 1744 return true; 1745 } 1746 1747 case SHUTDOWN_TRANSACTION: { 1748 data.enforceInterface(IActivityManager.descriptor); 1749 boolean res = shutdown(data.readInt()); 1750 reply.writeNoException(); 1751 reply.writeInt(res ? 1 : 0); 1752 return true; 1753 } 1754 1755 case STOP_APP_SWITCHES_TRANSACTION: { 1756 data.enforceInterface(IActivityManager.descriptor); 1757 stopAppSwitches(); 1758 reply.writeNoException(); 1759 return true; 1760 } 1761 1762 case RESUME_APP_SWITCHES_TRANSACTION: { 1763 data.enforceInterface(IActivityManager.descriptor); 1764 resumeAppSwitches(); 1765 reply.writeNoException(); 1766 return true; 1767 } 1768 1769 case PEEK_SERVICE_TRANSACTION: { 1770 data.enforceInterface(IActivityManager.descriptor); 1771 Intent service = Intent.CREATOR.createFromParcel(data); 1772 String resolvedType = data.readString(); 1773 String callingPackage = data.readString(); 1774 IBinder binder = peekService(service, resolvedType, callingPackage); 1775 reply.writeNoException(); 1776 reply.writeStrongBinder(binder); 1777 return true; 1778 } 1779 1780 case START_BACKUP_AGENT_TRANSACTION: { 1781 data.enforceInterface(IActivityManager.descriptor); 1782 String packageName = data.readString(); 1783 int backupRestoreMode = data.readInt(); 1784 int userId = data.readInt(); 1785 boolean success = bindBackupAgent(packageName, backupRestoreMode, userId); 1786 reply.writeNoException(); 1787 reply.writeInt(success ? 1 : 0); 1788 return true; 1789 } 1790 1791 case BACKUP_AGENT_CREATED_TRANSACTION: { 1792 data.enforceInterface(IActivityManager.descriptor); 1793 String packageName = data.readString(); 1794 IBinder agent = data.readStrongBinder(); 1795 backupAgentCreated(packageName, agent); 1796 reply.writeNoException(); 1797 return true; 1798 } 1799 1800 case UNBIND_BACKUP_AGENT_TRANSACTION: { 1801 data.enforceInterface(IActivityManager.descriptor); 1802 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data); 1803 unbindBackupAgent(info); 1804 reply.writeNoException(); 1805 return true; 1806 } 1807 1808 case ADD_PACKAGE_DEPENDENCY_TRANSACTION: { 1809 data.enforceInterface(IActivityManager.descriptor); 1810 String packageName = data.readString(); 1811 addPackageDependency(packageName); 1812 reply.writeNoException(); 1813 return true; 1814 } 1815 1816 case KILL_APPLICATION_TRANSACTION: { 1817 data.enforceInterface(IActivityManager.descriptor); 1818 String pkg = data.readString(); 1819 int appId = data.readInt(); 1820 int userId = data.readInt(); 1821 String reason = data.readString(); 1822 killApplication(pkg, appId, userId, reason); 1823 reply.writeNoException(); 1824 return true; 1825 } 1826 1827 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: { 1828 data.enforceInterface(IActivityManager.descriptor); 1829 String reason = data.readString(); 1830 closeSystemDialogs(reason); 1831 reply.writeNoException(); 1832 return true; 1833 } 1834 1835 case GET_PROCESS_MEMORY_INFO_TRANSACTION: { 1836 data.enforceInterface(IActivityManager.descriptor); 1837 int[] pids = data.createIntArray(); 1838 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids); 1839 reply.writeNoException(); 1840 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 1841 return true; 1842 } 1843 1844 case KILL_APPLICATION_PROCESS_TRANSACTION: { 1845 data.enforceInterface(IActivityManager.descriptor); 1846 String processName = data.readString(); 1847 int uid = data.readInt(); 1848 killApplicationProcess(processName, uid); 1849 reply.writeNoException(); 1850 return true; 1851 } 1852 1853 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: { 1854 data.enforceInterface(IActivityManager.descriptor); 1855 IBinder token = data.readStrongBinder(); 1856 String packageName = data.readString(); 1857 int enterAnim = data.readInt(); 1858 int exitAnim = data.readInt(); 1859 overridePendingTransition(token, packageName, enterAnim, exitAnim); 1860 reply.writeNoException(); 1861 return true; 1862 } 1863 1864 case IS_USER_A_MONKEY_TRANSACTION: { 1865 data.enforceInterface(IActivityManager.descriptor); 1866 boolean areThey = isUserAMonkey(); 1867 reply.writeNoException(); 1868 reply.writeInt(areThey ? 1 : 0); 1869 return true; 1870 } 1871 1872 case SET_USER_IS_MONKEY_TRANSACTION: { 1873 data.enforceInterface(IActivityManager.descriptor); 1874 final boolean monkey = (data.readInt() == 1); 1875 setUserIsMonkey(monkey); 1876 reply.writeNoException(); 1877 return true; 1878 } 1879 1880 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: { 1881 data.enforceInterface(IActivityManager.descriptor); 1882 finishHeavyWeightApp(); 1883 reply.writeNoException(); 1884 return true; 1885 } 1886 1887 case IS_IMMERSIVE_TRANSACTION: { 1888 data.enforceInterface(IActivityManager.descriptor); 1889 IBinder token = data.readStrongBinder(); 1890 boolean isit = isImmersive(token); 1891 reply.writeNoException(); 1892 reply.writeInt(isit ? 1 : 0); 1893 return true; 1894 } 1895 1896 case IS_TOP_OF_TASK_TRANSACTION: { 1897 data.enforceInterface(IActivityManager.descriptor); 1898 IBinder token = data.readStrongBinder(); 1899 final boolean isTopOfTask = isTopOfTask(token); 1900 reply.writeNoException(); 1901 reply.writeInt(isTopOfTask ? 1 : 0); 1902 return true; 1903 } 1904 1905 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: { 1906 data.enforceInterface(IActivityManager.descriptor); 1907 IBinder token = data.readStrongBinder(); 1908 boolean converted = convertFromTranslucent(token); 1909 reply.writeNoException(); 1910 reply.writeInt(converted ? 1 : 0); 1911 return true; 1912 } 1913 1914 case CONVERT_TO_TRANSLUCENT_TRANSACTION: { 1915 data.enforceInterface(IActivityManager.descriptor); 1916 IBinder token = data.readStrongBinder(); 1917 final Bundle bundle; 1918 if (data.readInt() == 0) { 1919 bundle = null; 1920 } else { 1921 bundle = data.readBundle(); 1922 } 1923 final ActivityOptions options = ActivityOptions.fromBundle(bundle); 1924 boolean converted = convertToTranslucent(token, options); 1925 reply.writeNoException(); 1926 reply.writeInt(converted ? 1 : 0); 1927 return true; 1928 } 1929 1930 case GET_ACTIVITY_OPTIONS_TRANSACTION: { 1931 data.enforceInterface(IActivityManager.descriptor); 1932 IBinder token = data.readStrongBinder(); 1933 final ActivityOptions options = getActivityOptions(token); 1934 reply.writeNoException(); 1935 reply.writeBundle(options == null ? null : options.toBundle()); 1936 return true; 1937 } 1938 1939 case SET_IMMERSIVE_TRANSACTION: { 1940 data.enforceInterface(IActivityManager.descriptor); 1941 IBinder token = data.readStrongBinder(); 1942 boolean imm = data.readInt() == 1; 1943 setImmersive(token, imm); 1944 reply.writeNoException(); 1945 return true; 1946 } 1947 1948 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: { 1949 data.enforceInterface(IActivityManager.descriptor); 1950 boolean isit = isTopActivityImmersive(); 1951 reply.writeNoException(); 1952 reply.writeInt(isit ? 1 : 0); 1953 return true; 1954 } 1955 1956 case CRASH_APPLICATION_TRANSACTION: { 1957 data.enforceInterface(IActivityManager.descriptor); 1958 int uid = data.readInt(); 1959 int initialPid = data.readInt(); 1960 String packageName = data.readString(); 1961 String message = data.readString(); 1962 crashApplication(uid, initialPid, packageName, message); 1963 reply.writeNoException(); 1964 return true; 1965 } 1966 1967 case GET_PROVIDER_MIME_TYPE_TRANSACTION: { 1968 data.enforceInterface(IActivityManager.descriptor); 1969 Uri uri = Uri.CREATOR.createFromParcel(data); 1970 int userId = data.readInt(); 1971 String type = getProviderMimeType(uri, userId); 1972 reply.writeNoException(); 1973 reply.writeString(type); 1974 return true; 1975 } 1976 1977 case NEW_URI_PERMISSION_OWNER_TRANSACTION: { 1978 data.enforceInterface(IActivityManager.descriptor); 1979 String name = data.readString(); 1980 IBinder perm = newUriPermissionOwner(name); 1981 reply.writeNoException(); 1982 reply.writeStrongBinder(perm); 1983 return true; 1984 } 1985 1986 case GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION: { 1987 data.enforceInterface(IActivityManager.descriptor); 1988 IBinder activityToken = data.readStrongBinder(); 1989 IBinder perm = getUriPermissionOwnerForActivity(activityToken); 1990 reply.writeNoException(); 1991 reply.writeStrongBinder(perm); 1992 return true; 1993 } 1994 1995 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: { 1996 data.enforceInterface(IActivityManager.descriptor); 1997 IBinder owner = data.readStrongBinder(); 1998 int fromUid = data.readInt(); 1999 String targetPkg = data.readString(); 2000 Uri uri = Uri.CREATOR.createFromParcel(data); 2001 int mode = data.readInt(); 2002 int sourceUserId = data.readInt(); 2003 int targetUserId = data.readInt(); 2004 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, sourceUserId, 2005 targetUserId); 2006 reply.writeNoException(); 2007 return true; 2008 } 2009 2010 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: { 2011 data.enforceInterface(IActivityManager.descriptor); 2012 IBinder owner = data.readStrongBinder(); 2013 Uri uri = null; 2014 if (data.readInt() != 0) { 2015 uri = Uri.CREATOR.createFromParcel(data); 2016 } 2017 int mode = data.readInt(); 2018 int userId = data.readInt(); 2019 revokeUriPermissionFromOwner(owner, uri, mode, userId); 2020 reply.writeNoException(); 2021 return true; 2022 } 2023 2024 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: { 2025 data.enforceInterface(IActivityManager.descriptor); 2026 int callingUid = data.readInt(); 2027 String targetPkg = data.readString(); 2028 Uri uri = Uri.CREATOR.createFromParcel(data); 2029 int modeFlags = data.readInt(); 2030 int userId = data.readInt(); 2031 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId); 2032 reply.writeNoException(); 2033 reply.writeInt(res); 2034 return true; 2035 } 2036 2037 case DUMP_HEAP_TRANSACTION: { 2038 data.enforceInterface(IActivityManager.descriptor); 2039 String process = data.readString(); 2040 int userId = data.readInt(); 2041 boolean managed = data.readInt() != 0; 2042 String path = data.readString(); 2043 ParcelFileDescriptor fd = data.readInt() != 0 2044 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null; 2045 boolean res = dumpHeap(process, userId, managed, path, fd); 2046 reply.writeNoException(); 2047 reply.writeInt(res ? 1 : 0); 2048 return true; 2049 } 2050 2051 case START_ACTIVITIES_TRANSACTION: 2052 { 2053 data.enforceInterface(IActivityManager.descriptor); 2054 IBinder b = data.readStrongBinder(); 2055 IApplicationThread app = ApplicationThreadNative.asInterface(b); 2056 String callingPackage = data.readString(); 2057 Intent[] intents = data.createTypedArray(Intent.CREATOR); 2058 String[] resolvedTypes = data.createStringArray(); 2059 IBinder resultTo = data.readStrongBinder(); 2060 Bundle options = data.readInt() != 0 2061 ? Bundle.CREATOR.createFromParcel(data) : null; 2062 int userId = data.readInt(); 2063 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo, 2064 options, userId); 2065 reply.writeNoException(); 2066 reply.writeInt(result); 2067 return true; 2068 } 2069 2070 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION: 2071 { 2072 data.enforceInterface(IActivityManager.descriptor); 2073 int mode = getFrontActivityScreenCompatMode(); 2074 reply.writeNoException(); 2075 reply.writeInt(mode); 2076 return true; 2077 } 2078 2079 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION: 2080 { 2081 data.enforceInterface(IActivityManager.descriptor); 2082 int mode = data.readInt(); 2083 setFrontActivityScreenCompatMode(mode); 2084 reply.writeNoException(); 2085 reply.writeInt(mode); 2086 return true; 2087 } 2088 2089 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION: 2090 { 2091 data.enforceInterface(IActivityManager.descriptor); 2092 String pkg = data.readString(); 2093 int mode = getPackageScreenCompatMode(pkg); 2094 reply.writeNoException(); 2095 reply.writeInt(mode); 2096 return true; 2097 } 2098 2099 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION: 2100 { 2101 data.enforceInterface(IActivityManager.descriptor); 2102 String pkg = data.readString(); 2103 int mode = data.readInt(); 2104 setPackageScreenCompatMode(pkg, mode); 2105 reply.writeNoException(); 2106 return true; 2107 } 2108 2109 case SWITCH_USER_TRANSACTION: { 2110 data.enforceInterface(IActivityManager.descriptor); 2111 int userid = data.readInt(); 2112 boolean result = switchUser(userid); 2113 reply.writeNoException(); 2114 reply.writeInt(result ? 1 : 0); 2115 return true; 2116 } 2117 2118 case START_USER_IN_BACKGROUND_TRANSACTION: { 2119 data.enforceInterface(IActivityManager.descriptor); 2120 int userid = data.readInt(); 2121 boolean result = startUserInBackground(userid); 2122 reply.writeNoException(); 2123 reply.writeInt(result ? 1 : 0); 2124 return true; 2125 } 2126 2127 case UNLOCK_USER_TRANSACTION: { 2128 data.enforceInterface(IActivityManager.descriptor); 2129 int userId = data.readInt(); 2130 byte[] token = data.createByteArray(); 2131 byte[] secret = data.createByteArray(); 2132 IProgressListener listener = IProgressListener.Stub 2133 .asInterface(data.readStrongBinder()); 2134 boolean result = unlockUser(userId, token, secret, listener); 2135 reply.writeNoException(); 2136 reply.writeInt(result ? 1 : 0); 2137 return true; 2138 } 2139 2140 case STOP_USER_TRANSACTION: { 2141 data.enforceInterface(IActivityManager.descriptor); 2142 int userid = data.readInt(); 2143 boolean force = data.readInt() != 0; 2144 IStopUserCallback callback = IStopUserCallback.Stub.asInterface( 2145 data.readStrongBinder()); 2146 int result = stopUser(userid, force, callback); 2147 reply.writeNoException(); 2148 reply.writeInt(result); 2149 return true; 2150 } 2151 2152 case GET_CURRENT_USER_TRANSACTION: { 2153 data.enforceInterface(IActivityManager.descriptor); 2154 UserInfo userInfo = getCurrentUser(); 2155 reply.writeNoException(); 2156 userInfo.writeToParcel(reply, 0); 2157 return true; 2158 } 2159 2160 case IS_USER_RUNNING_TRANSACTION: { 2161 data.enforceInterface(IActivityManager.descriptor); 2162 int userid = data.readInt(); 2163 int _flags = data.readInt(); 2164 boolean result = isUserRunning(userid, _flags); 2165 reply.writeNoException(); 2166 reply.writeInt(result ? 1 : 0); 2167 return true; 2168 } 2169 2170 case GET_RUNNING_USER_IDS_TRANSACTION: { 2171 data.enforceInterface(IActivityManager.descriptor); 2172 int[] result = getRunningUserIds(); 2173 reply.writeNoException(); 2174 reply.writeIntArray(result); 2175 return true; 2176 } 2177 2178 case REMOVE_TASK_TRANSACTION: 2179 { 2180 data.enforceInterface(IActivityManager.descriptor); 2181 int taskId = data.readInt(); 2182 boolean result = removeTask(taskId); 2183 reply.writeNoException(); 2184 reply.writeInt(result ? 1 : 0); 2185 return true; 2186 } 2187 2188 case REGISTER_PROCESS_OBSERVER_TRANSACTION: { 2189 data.enforceInterface(IActivityManager.descriptor); 2190 IProcessObserver observer = IProcessObserver.Stub.asInterface( 2191 data.readStrongBinder()); 2192 registerProcessObserver(observer); 2193 return true; 2194 } 2195 2196 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: { 2197 data.enforceInterface(IActivityManager.descriptor); 2198 IProcessObserver observer = IProcessObserver.Stub.asInterface( 2199 data.readStrongBinder()); 2200 unregisterProcessObserver(observer); 2201 return true; 2202 } 2203 2204 case REGISTER_UID_OBSERVER_TRANSACTION: { 2205 data.enforceInterface(IActivityManager.descriptor); 2206 IUidObserver observer = IUidObserver.Stub.asInterface( 2207 data.readStrongBinder()); 2208 int which = data.readInt(); 2209 registerUidObserver(observer, which); 2210 return true; 2211 } 2212 2213 case UNREGISTER_UID_OBSERVER_TRANSACTION: { 2214 data.enforceInterface(IActivityManager.descriptor); 2215 IUidObserver observer = IUidObserver.Stub.asInterface( 2216 data.readStrongBinder()); 2217 unregisterUidObserver(observer); 2218 return true; 2219 } 2220 2221 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: 2222 { 2223 data.enforceInterface(IActivityManager.descriptor); 2224 String pkg = data.readString(); 2225 boolean ask = getPackageAskScreenCompat(pkg); 2226 reply.writeNoException(); 2227 reply.writeInt(ask ? 1 : 0); 2228 return true; 2229 } 2230 2231 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION: 2232 { 2233 data.enforceInterface(IActivityManager.descriptor); 2234 String pkg = data.readString(); 2235 boolean ask = data.readInt() != 0; 2236 setPackageAskScreenCompat(pkg, ask); 2237 reply.writeNoException(); 2238 return true; 2239 } 2240 2241 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: { 2242 data.enforceInterface(IActivityManager.descriptor); 2243 IIntentSender r = IIntentSender.Stub.asInterface( 2244 data.readStrongBinder()); 2245 boolean res = isIntentSenderTargetedToPackage(r); 2246 reply.writeNoException(); 2247 reply.writeInt(res ? 1 : 0); 2248 return true; 2249 } 2250 2251 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: { 2252 data.enforceInterface(IActivityManager.descriptor); 2253 IIntentSender r = IIntentSender.Stub.asInterface( 2254 data.readStrongBinder()); 2255 boolean res = isIntentSenderAnActivity(r); 2256 reply.writeNoException(); 2257 reply.writeInt(res ? 1 : 0); 2258 return true; 2259 } 2260 2261 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: { 2262 data.enforceInterface(IActivityManager.descriptor); 2263 IIntentSender r = IIntentSender.Stub.asInterface( 2264 data.readStrongBinder()); 2265 Intent intent = getIntentForIntentSender(r); 2266 reply.writeNoException(); 2267 if (intent != null) { 2268 reply.writeInt(1); 2269 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 2270 } else { 2271 reply.writeInt(0); 2272 } 2273 return true; 2274 } 2275 2276 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: { 2277 data.enforceInterface(IActivityManager.descriptor); 2278 IIntentSender r = IIntentSender.Stub.asInterface( 2279 data.readStrongBinder()); 2280 String prefix = data.readString(); 2281 String tag = getTagForIntentSender(r, prefix); 2282 reply.writeNoException(); 2283 reply.writeString(tag); 2284 return true; 2285 } 2286 2287 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: { 2288 data.enforceInterface(IActivityManager.descriptor); 2289 Configuration config = Configuration.CREATOR.createFromParcel(data); 2290 updatePersistentConfiguration(config); 2291 reply.writeNoException(); 2292 return true; 2293 } 2294 2295 case GET_PROCESS_PSS_TRANSACTION: { 2296 data.enforceInterface(IActivityManager.descriptor); 2297 int[] pids = data.createIntArray(); 2298 long[] pss = getProcessPss(pids); 2299 reply.writeNoException(); 2300 reply.writeLongArray(pss); 2301 return true; 2302 } 2303 2304 case SHOW_BOOT_MESSAGE_TRANSACTION: { 2305 data.enforceInterface(IActivityManager.descriptor); 2306 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data); 2307 boolean always = data.readInt() != 0; 2308 showBootMessage(msg, always); 2309 reply.writeNoException(); 2310 return true; 2311 } 2312 2313 case KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION: { 2314 data.enforceInterface(IActivityManager.descriptor); 2315 keyguardWaitingForActivityDrawn(); 2316 reply.writeNoException(); 2317 return true; 2318 } 2319 2320 case KEYGUARD_GOING_AWAY_TRANSACTION: { 2321 data.enforceInterface(IActivityManager.descriptor); 2322 keyguardGoingAway(data.readInt()); 2323 reply.writeNoException(); 2324 return true; 2325 } 2326 2327 case SHOULD_UP_RECREATE_TASK_TRANSACTION: { 2328 data.enforceInterface(IActivityManager.descriptor); 2329 IBinder token = data.readStrongBinder(); 2330 String destAffinity = data.readString(); 2331 boolean res = shouldUpRecreateTask(token, destAffinity); 2332 reply.writeNoException(); 2333 reply.writeInt(res ? 1 : 0); 2334 return true; 2335 } 2336 2337 case NAVIGATE_UP_TO_TRANSACTION: { 2338 data.enforceInterface(IActivityManager.descriptor); 2339 IBinder token = data.readStrongBinder(); 2340 Intent target = Intent.CREATOR.createFromParcel(data); 2341 int resultCode = data.readInt(); 2342 Intent resultData = null; 2343 if (data.readInt() != 0) { 2344 resultData = Intent.CREATOR.createFromParcel(data); 2345 } 2346 boolean res = navigateUpTo(token, target, resultCode, resultData); 2347 reply.writeNoException(); 2348 reply.writeInt(res ? 1 : 0); 2349 return true; 2350 } 2351 2352 case GET_LAUNCHED_FROM_UID_TRANSACTION: { 2353 data.enforceInterface(IActivityManager.descriptor); 2354 IBinder token = data.readStrongBinder(); 2355 int res = getLaunchedFromUid(token); 2356 reply.writeNoException(); 2357 reply.writeInt(res); 2358 return true; 2359 } 2360 2361 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: { 2362 data.enforceInterface(IActivityManager.descriptor); 2363 IBinder token = data.readStrongBinder(); 2364 String res = getLaunchedFromPackage(token); 2365 reply.writeNoException(); 2366 reply.writeString(res); 2367 return true; 2368 } 2369 2370 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { 2371 data.enforceInterface(IActivityManager.descriptor); 2372 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( 2373 data.readStrongBinder()); 2374 registerUserSwitchObserver(observer); 2375 reply.writeNoException(); 2376 return true; 2377 } 2378 2379 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: { 2380 data.enforceInterface(IActivityManager.descriptor); 2381 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface( 2382 data.readStrongBinder()); 2383 unregisterUserSwitchObserver(observer); 2384 reply.writeNoException(); 2385 return true; 2386 } 2387 2388 case REQUEST_BUG_REPORT_TRANSACTION: { 2389 data.enforceInterface(IActivityManager.descriptor); 2390 int bugreportType = data.readInt(); 2391 requestBugReport(bugreportType); 2392 reply.writeNoException(); 2393 return true; 2394 } 2395 2396 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: { 2397 data.enforceInterface(IActivityManager.descriptor); 2398 int pid = data.readInt(); 2399 boolean aboveSystem = data.readInt() != 0; 2400 String reason = data.readString(); 2401 long res = inputDispatchingTimedOut(pid, aboveSystem, reason); 2402 reply.writeNoException(); 2403 reply.writeLong(res); 2404 return true; 2405 } 2406 2407 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: { 2408 data.enforceInterface(IActivityManager.descriptor); 2409 int requestType = data.readInt(); 2410 Bundle res = getAssistContextExtras(requestType); 2411 reply.writeNoException(); 2412 reply.writeBundle(res); 2413 return true; 2414 } 2415 2416 case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION: { 2417 data.enforceInterface(IActivityManager.descriptor); 2418 int requestType = data.readInt(); 2419 IResultReceiver receiver = IResultReceiver.Stub.asInterface(data.readStrongBinder()); 2420 Bundle receiverExtras = data.readBundle(); 2421 IBinder activityToken = data.readStrongBinder(); 2422 boolean focused = data.readInt() == 1; 2423 boolean newSessionId = data.readInt() == 1; 2424 boolean res = requestAssistContextExtras(requestType, receiver, receiverExtras, 2425 activityToken, focused, newSessionId); 2426 reply.writeNoException(); 2427 reply.writeInt(res ? 1 : 0); 2428 return true; 2429 } 2430 2431 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: { 2432 data.enforceInterface(IActivityManager.descriptor); 2433 IBinder token = data.readStrongBinder(); 2434 Bundle extras = data.readBundle(); 2435 AssistStructure structure = AssistStructure.CREATOR.createFromParcel(data); 2436 AssistContent content = AssistContent.CREATOR.createFromParcel(data); 2437 Uri referrer = data.readInt() != 0 ? Uri.CREATOR.createFromParcel(data) : null; 2438 reportAssistContextExtras(token, extras, structure, content, referrer); 2439 reply.writeNoException(); 2440 return true; 2441 } 2442 2443 case LAUNCH_ASSIST_INTENT_TRANSACTION: { 2444 data.enforceInterface(IActivityManager.descriptor); 2445 Intent intent = Intent.CREATOR.createFromParcel(data); 2446 int requestType = data.readInt(); 2447 String hint = data.readString(); 2448 int userHandle = data.readInt(); 2449 Bundle args = data.readBundle(); 2450 boolean res = launchAssistIntent(intent, requestType, hint, userHandle, args); 2451 reply.writeNoException(); 2452 reply.writeInt(res ? 1 : 0); 2453 return true; 2454 } 2455 2456 case IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION: { 2457 data.enforceInterface(IActivityManager.descriptor); 2458 boolean res = isAssistDataAllowedOnCurrentActivity(); 2459 reply.writeNoException(); 2460 reply.writeInt(res ? 1 : 0); 2461 return true; 2462 } 2463 2464 case SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION: { 2465 data.enforceInterface(IActivityManager.descriptor); 2466 IBinder token = data.readStrongBinder(); 2467 Bundle args = data.readBundle(); 2468 boolean res = showAssistFromActivity(token, args); 2469 reply.writeNoException(); 2470 reply.writeInt(res ? 1 : 0); 2471 return true; 2472 } 2473 2474 case KILL_UID_TRANSACTION: { 2475 data.enforceInterface(IActivityManager.descriptor); 2476 int appId = data.readInt(); 2477 int userId = data.readInt(); 2478 String reason = data.readString(); 2479 killUid(appId, userId, reason); 2480 reply.writeNoException(); 2481 return true; 2482 } 2483 2484 case HANG_TRANSACTION: { 2485 data.enforceInterface(IActivityManager.descriptor); 2486 IBinder who = data.readStrongBinder(); 2487 boolean allowRestart = data.readInt() != 0; 2488 hang(who, allowRestart); 2489 reply.writeNoException(); 2490 return true; 2491 } 2492 2493 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: { 2494 data.enforceInterface(IActivityManager.descriptor); 2495 IBinder token = data.readStrongBinder(); 2496 reportActivityFullyDrawn(token); 2497 reply.writeNoException(); 2498 return true; 2499 } 2500 2501 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: { 2502 data.enforceInterface(IActivityManager.descriptor); 2503 IBinder token = data.readStrongBinder(); 2504 notifyActivityDrawn(token); 2505 reply.writeNoException(); 2506 return true; 2507 } 2508 2509 case RESTART_TRANSACTION: { 2510 data.enforceInterface(IActivityManager.descriptor); 2511 restart(); 2512 reply.writeNoException(); 2513 return true; 2514 } 2515 2516 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: { 2517 data.enforceInterface(IActivityManager.descriptor); 2518 performIdleMaintenance(); 2519 reply.writeNoException(); 2520 return true; 2521 } 2522 2523 case CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION: { 2524 data.enforceInterface(IActivityManager.descriptor); 2525 IBinder parentActivityToken = data.readStrongBinder(); 2526 IActivityContainerCallback callback = 2527 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder()); 2528 IActivityContainer activityContainer = 2529 createVirtualActivityContainer(parentActivityToken, callback); 2530 reply.writeNoException(); 2531 if (activityContainer != null) { 2532 reply.writeInt(1); 2533 reply.writeStrongBinder(activityContainer.asBinder()); 2534 } else { 2535 reply.writeInt(0); 2536 } 2537 return true; 2538 } 2539 2540 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: { 2541 data.enforceInterface(IActivityManager.descriptor); 2542 IActivityContainer activityContainer = 2543 IActivityContainer.Stub.asInterface(data.readStrongBinder()); 2544 deleteActivityContainer(activityContainer); 2545 reply.writeNoException(); 2546 return true; 2547 } 2548 2549 case CREATE_STACK_ON_DISPLAY: { 2550 data.enforceInterface(IActivityManager.descriptor); 2551 int displayId = data.readInt(); 2552 IActivityContainer activityContainer = createStackOnDisplay(displayId); 2553 reply.writeNoException(); 2554 if (activityContainer != null) { 2555 reply.writeInt(1); 2556 reply.writeStrongBinder(activityContainer.asBinder()); 2557 } else { 2558 reply.writeInt(0); 2559 } 2560 return true; 2561 } 2562 2563 case GET_ACTIVITY_DISPLAY_ID_TRANSACTION: { 2564 data.enforceInterface(IActivityManager.descriptor); 2565 IBinder activityToken = data.readStrongBinder(); 2566 int displayId = getActivityDisplayId(activityToken); 2567 reply.writeNoException(); 2568 reply.writeInt(displayId); 2569 return true; 2570 } 2571 2572 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: { 2573 data.enforceInterface(IActivityManager.descriptor); 2574 final int taskId = data.readInt(); 2575 startLockTaskMode(taskId); 2576 reply.writeNoException(); 2577 return true; 2578 } 2579 2580 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: { 2581 data.enforceInterface(IActivityManager.descriptor); 2582 IBinder token = data.readStrongBinder(); 2583 startLockTaskMode(token); 2584 reply.writeNoException(); 2585 return true; 2586 } 2587 2588 case START_SYSTEM_LOCK_TASK_TRANSACTION: { 2589 data.enforceInterface(IActivityManager.descriptor); 2590 int taskId = data.readInt(); 2591 startSystemLockTaskMode(taskId); 2592 reply.writeNoException(); 2593 return true; 2594 } 2595 2596 case STOP_LOCK_TASK_MODE_TRANSACTION: { 2597 data.enforceInterface(IActivityManager.descriptor); 2598 stopLockTaskMode(); 2599 reply.writeNoException(); 2600 return true; 2601 } 2602 2603 case STOP_SYSTEM_LOCK_TASK_TRANSACTION: { 2604 data.enforceInterface(IActivityManager.descriptor); 2605 stopSystemLockTaskMode(); 2606 reply.writeNoException(); 2607 return true; 2608 } 2609 2610 case IS_IN_LOCK_TASK_MODE_TRANSACTION: { 2611 data.enforceInterface(IActivityManager.descriptor); 2612 final boolean isInLockTaskMode = isInLockTaskMode(); 2613 reply.writeNoException(); 2614 reply.writeInt(isInLockTaskMode ? 1 : 0); 2615 return true; 2616 } 2617 2618 case GET_LOCK_TASK_MODE_STATE_TRANSACTION: { 2619 data.enforceInterface(IActivityManager.descriptor); 2620 final int lockTaskModeState = getLockTaskModeState(); 2621 reply.writeNoException(); 2622 reply.writeInt(lockTaskModeState); 2623 return true; 2624 } 2625 2626 case SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION: { 2627 data.enforceInterface(IActivityManager.descriptor); 2628 final IBinder token = data.readStrongBinder(); 2629 showLockTaskEscapeMessage(token); 2630 reply.writeNoException(); 2631 return true; 2632 } 2633 2634 case SET_TASK_DESCRIPTION_TRANSACTION: { 2635 data.enforceInterface(IActivityManager.descriptor); 2636 IBinder token = data.readStrongBinder(); 2637 ActivityManager.TaskDescription values = 2638 ActivityManager.TaskDescription.CREATOR.createFromParcel(data); 2639 setTaskDescription(token, values); 2640 reply.writeNoException(); 2641 return true; 2642 } 2643 2644 case SET_TASK_RESIZEABLE_TRANSACTION: { 2645 data.enforceInterface(IActivityManager.descriptor); 2646 final int taskId = data.readInt(); 2647 final int resizeableMode = data.readInt(); 2648 setTaskResizeable(taskId, resizeableMode); 2649 reply.writeNoException(); 2650 return true; 2651 } 2652 2653 case RESIZE_TASK_TRANSACTION: { 2654 data.enforceInterface(IActivityManager.descriptor); 2655 int taskId = data.readInt(); 2656 int resizeMode = data.readInt(); 2657 Rect r = Rect.CREATOR.createFromParcel(data); 2658 resizeTask(taskId, r, resizeMode); 2659 reply.writeNoException(); 2660 return true; 2661 } 2662 2663 case GET_TASK_BOUNDS_TRANSACTION: { 2664 data.enforceInterface(IActivityManager.descriptor); 2665 int taskId = data.readInt(); 2666 Rect r = getTaskBounds(taskId); 2667 reply.writeNoException(); 2668 r.writeToParcel(reply, 0); 2669 return true; 2670 } 2671 2672 case GET_TASK_DESCRIPTION_ICON_TRANSACTION: { 2673 data.enforceInterface(IActivityManager.descriptor); 2674 String filename = data.readString(); 2675 int userId = data.readInt(); 2676 Bitmap icon = getTaskDescriptionIcon(filename, userId); 2677 reply.writeNoException(); 2678 if (icon == null) { 2679 reply.writeInt(0); 2680 } else { 2681 reply.writeInt(1); 2682 icon.writeToParcel(reply, 0); 2683 } 2684 return true; 2685 } 2686 2687 case START_IN_PLACE_ANIMATION_TRANSACTION: { 2688 data.enforceInterface(IActivityManager.descriptor); 2689 final Bundle bundle; 2690 if (data.readInt() == 0) { 2691 bundle = null; 2692 } else { 2693 bundle = data.readBundle(); 2694 } 2695 final ActivityOptions options = ActivityOptions.fromBundle(bundle); 2696 startInPlaceAnimationOnFrontMostApplication(options); 2697 reply.writeNoException(); 2698 return true; 2699 } 2700 2701 case REQUEST_VISIBLE_BEHIND_TRANSACTION: { 2702 data.enforceInterface(IActivityManager.descriptor); 2703 IBinder token = data.readStrongBinder(); 2704 boolean enable = data.readInt() > 0; 2705 boolean success = requestVisibleBehind(token, enable); 2706 reply.writeNoException(); 2707 reply.writeInt(success ? 1 : 0); 2708 return true; 2709 } 2710 2711 case IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION: { 2712 data.enforceInterface(IActivityManager.descriptor); 2713 IBinder token = data.readStrongBinder(); 2714 final boolean enabled = isBackgroundVisibleBehind(token); 2715 reply.writeNoException(); 2716 reply.writeInt(enabled ? 1 : 0); 2717 return true; 2718 } 2719 2720 case BACKGROUND_RESOURCES_RELEASED_TRANSACTION: { 2721 data.enforceInterface(IActivityManager.descriptor); 2722 IBinder token = data.readStrongBinder(); 2723 backgroundResourcesReleased(token); 2724 reply.writeNoException(); 2725 return true; 2726 } 2727 2728 case NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION: { 2729 data.enforceInterface(IActivityManager.descriptor); 2730 IBinder token = data.readStrongBinder(); 2731 notifyLaunchTaskBehindComplete(token); 2732 reply.writeNoException(); 2733 return true; 2734 } 2735 2736 case NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION: { 2737 data.enforceInterface(IActivityManager.descriptor); 2738 IBinder token = data.readStrongBinder(); 2739 notifyEnterAnimationComplete(token); 2740 reply.writeNoException(); 2741 return true; 2742 } 2743 2744 case BOOT_ANIMATION_COMPLETE_TRANSACTION: { 2745 data.enforceInterface(IActivityManager.descriptor); 2746 bootAnimationComplete(); 2747 reply.writeNoException(); 2748 return true; 2749 } 2750 2751 case NOTIFY_CLEARTEXT_NETWORK_TRANSACTION: { 2752 data.enforceInterface(IActivityManager.descriptor); 2753 final int uid = data.readInt(); 2754 final byte[] firstPacket = data.createByteArray(); 2755 notifyCleartextNetwork(uid, firstPacket); 2756 reply.writeNoException(); 2757 return true; 2758 } 2759 2760 case SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION: { 2761 data.enforceInterface(IActivityManager.descriptor); 2762 String procName = data.readString(); 2763 int uid = data.readInt(); 2764 long maxMemSize = data.readLong(); 2765 String reportPackage = data.readString(); 2766 setDumpHeapDebugLimit(procName, uid, maxMemSize, reportPackage); 2767 reply.writeNoException(); 2768 return true; 2769 } 2770 2771 case DUMP_HEAP_FINISHED_TRANSACTION: { 2772 data.enforceInterface(IActivityManager.descriptor); 2773 String path = data.readString(); 2774 dumpHeapFinished(path); 2775 reply.writeNoException(); 2776 return true; 2777 } 2778 2779 case SET_VOICE_KEEP_AWAKE_TRANSACTION: { 2780 data.enforceInterface(IActivityManager.descriptor); 2781 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface( 2782 data.readStrongBinder()); 2783 boolean keepAwake = data.readInt() != 0; 2784 setVoiceKeepAwake(session, keepAwake); 2785 reply.writeNoException(); 2786 return true; 2787 } 2788 2789 case UPDATE_LOCK_TASK_PACKAGES_TRANSACTION: { 2790 data.enforceInterface(IActivityManager.descriptor); 2791 int userId = data.readInt(); 2792 String[] packages = data.readStringArray(); 2793 updateLockTaskPackages(userId, packages); 2794 reply.writeNoException(); 2795 return true; 2796 } 2797 2798 case UPDATE_DEVICE_OWNER_TRANSACTION: { 2799 data.enforceInterface(IActivityManager.descriptor); 2800 String packageName = data.readString(); 2801 updateDeviceOwner(packageName); 2802 reply.writeNoException(); 2803 return true; 2804 } 2805 2806 case GET_PACKAGE_PROCESS_STATE_TRANSACTION: { 2807 data.enforceInterface(IActivityManager.descriptor); 2808 String pkg = data.readString(); 2809 String callingPackage = data.readString(); 2810 int res = getPackageProcessState(pkg, callingPackage); 2811 reply.writeNoException(); 2812 reply.writeInt(res); 2813 return true; 2814 } 2815 2816 case SET_PROCESS_MEMORY_TRIM_TRANSACTION: { 2817 data.enforceInterface(IActivityManager.descriptor); 2818 String process = data.readString(); 2819 int userId = data.readInt(); 2820 int level = data.readInt(); 2821 boolean res = setProcessMemoryTrimLevel(process, userId, level); 2822 reply.writeNoException(); 2823 reply.writeInt(res ? 1 : 0); 2824 return true; 2825 } 2826 2827 case IS_ROOT_VOICE_INTERACTION_TRANSACTION: { 2828 data.enforceInterface(IActivityManager.descriptor); 2829 IBinder token = data.readStrongBinder(); 2830 boolean res = isRootVoiceInteraction(token); 2831 reply.writeNoException(); 2832 reply.writeInt(res ? 1 : 0); 2833 return true; 2834 } 2835 2836 case START_BINDER_TRACKING_TRANSACTION: { 2837 data.enforceInterface(IActivityManager.descriptor); 2838 boolean res = startBinderTracking(); 2839 reply.writeNoException(); 2840 reply.writeInt(res ? 1 : 0); 2841 return true; 2842 } 2843 2844 case STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION: { 2845 data.enforceInterface(IActivityManager.descriptor); 2846 ParcelFileDescriptor fd = data.readInt() != 0 2847 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null; 2848 boolean res = stopBinderTrackingAndDump(fd); 2849 reply.writeNoException(); 2850 reply.writeInt(res ? 1 : 0); 2851 return true; 2852 } 2853 case GET_ACTIVITY_STACK_ID_TRANSACTION: { 2854 data.enforceInterface(IActivityManager.descriptor); 2855 IBinder token = data.readStrongBinder(); 2856 int stackId = getActivityStackId(token); 2857 reply.writeNoException(); 2858 reply.writeInt(stackId); 2859 return true; 2860 } 2861 case EXIT_FREEFORM_MODE_TRANSACTION: { 2862 data.enforceInterface(IActivityManager.descriptor); 2863 IBinder token = data.readStrongBinder(); 2864 exitFreeformMode(token); 2865 reply.writeNoException(); 2866 return true; 2867 } 2868 case REPORT_SIZE_CONFIGURATIONS: { 2869 data.enforceInterface(IActivityManager.descriptor); 2870 IBinder token = data.readStrongBinder(); 2871 int[] horizontal = readIntArray(data); 2872 int[] vertical = readIntArray(data); 2873 int[] smallest = readIntArray(data); 2874 reportSizeConfigurations(token, horizontal, vertical, smallest); 2875 return true; 2876 } 2877 case SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION: { 2878 data.enforceInterface(IActivityManager.descriptor); 2879 final boolean suppress = data.readInt() == 1; 2880 suppressResizeConfigChanges(suppress); 2881 reply.writeNoException(); 2882 return true; 2883 } 2884 case MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION: { 2885 data.enforceInterface(IActivityManager.descriptor); 2886 final int stackId = data.readInt(); 2887 final boolean onTop = data.readInt() == 1; 2888 moveTasksToFullscreenStack(stackId, onTop); 2889 reply.writeNoException(); 2890 return true; 2891 } 2892 case GET_APP_START_MODE_TRANSACTION: { 2893 data.enforceInterface(IActivityManager.descriptor); 2894 final int uid = data.readInt(); 2895 final String pkg = data.readString(); 2896 int res = getAppStartMode(uid, pkg); 2897 reply.writeNoException(); 2898 reply.writeInt(res); 2899 return true; 2900 } 2901 case IN_MULTI_WINDOW_TRANSACTION: { 2902 data.enforceInterface(IActivityManager.descriptor); 2903 final IBinder token = data.readStrongBinder(); 2904 final boolean inMultiWindow = isInMultiWindowMode(token); 2905 reply.writeNoException(); 2906 reply.writeInt(inMultiWindow ? 1 : 0); 2907 return true; 2908 } 2909 case IN_PICTURE_IN_PICTURE_TRANSACTION: { 2910 data.enforceInterface(IActivityManager.descriptor); 2911 final IBinder token = data.readStrongBinder(); 2912 final boolean inPip = isInPictureInPictureMode(token); 2913 reply.writeNoException(); 2914 reply.writeInt(inPip ? 1 : 0); 2915 return true; 2916 } 2917 case ENTER_PICTURE_IN_PICTURE_TRANSACTION: { 2918 data.enforceInterface(IActivityManager.descriptor); 2919 final IBinder token = data.readStrongBinder(); 2920 enterPictureInPictureMode(token); 2921 reply.writeNoException(); 2922 return true; 2923 } 2924 case SET_VR_MODE_TRANSACTION: { 2925 data.enforceInterface(IActivityManager.descriptor); 2926 final IBinder token = data.readStrongBinder(); 2927 final boolean enable = data.readInt() == 1; 2928 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data); 2929 int res = setVrMode(token, enable, packageName); 2930 reply.writeNoException(); 2931 reply.writeInt(res); 2932 return true; 2933 } 2934 case IS_VR_PACKAGE_ENABLED_TRANSACTION: { 2935 data.enforceInterface(IActivityManager.descriptor); 2936 final ComponentName packageName = ComponentName.CREATOR.createFromParcel(data); 2937 boolean res = isVrModePackageEnabled(packageName); 2938 reply.writeNoException(); 2939 reply.writeInt(res ? 1 : 0); 2940 return true; 2941 } 2942 case IS_APP_FOREGROUND_TRANSACTION: { 2943 data.enforceInterface(IActivityManager.descriptor); 2944 final int userHandle = data.readInt(); 2945 final boolean isForeground = isAppForeground(userHandle); 2946 reply.writeNoException(); 2947 reply.writeInt(isForeground ? 1 : 0); 2948 return true; 2949 } 2950 case NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION: { 2951 data.enforceInterface(IActivityManager.descriptor); 2952 reply.writeNoException(); 2953 return true; 2954 } 2955 case REMOVE_STACK: { 2956 data.enforceInterface(IActivityManager.descriptor); 2957 final int stackId = data.readInt(); 2958 removeStack(stackId); 2959 reply.writeNoException(); 2960 return true; 2961 } 2962 case NOTIFY_LOCKED_PROFILE: { 2963 data.enforceInterface(IActivityManager.descriptor); 2964 final int userId = data.readInt(); 2965 notifyLockedProfile(userId); 2966 reply.writeNoException(); 2967 return true; 2968 } 2969 case START_CONFIRM_DEVICE_CREDENTIAL_INTENT: { 2970 data.enforceInterface(IActivityManager.descriptor); 2971 final Intent intent = Intent.CREATOR.createFromParcel(data); 2972 startConfirmDeviceCredentialIntent(intent); 2973 reply.writeNoException(); 2974 return true; 2975 } 2976 case SEND_IDLE_JOB_TRIGGER_TRANSACTION: { 2977 data.enforceInterface(IActivityManager.descriptor); 2978 sendIdleJobTrigger(); 2979 reply.writeNoException(); 2980 return true; 2981 } 2982 case SEND_INTENT_SENDER_TRANSACTION: { 2983 data.enforceInterface(IActivityManager.descriptor); 2984 IIntentSender sender = IIntentSender.Stub.asInterface(data.readStrongBinder()); 2985 int scode = data.readInt(); 2986 Intent intent = data.readInt() != 0 ? Intent.CREATOR.createFromParcel(data) : null; 2987 String resolvedType = data.readString(); 2988 IIntentReceiver finishedReceiver = IIntentReceiver.Stub.asInterface( 2989 data.readStrongBinder()); 2990 String requiredPermission = data.readString(); 2991 Bundle options = data.readInt() != 0 ? Bundle.CREATOR.createFromParcel(data) : null; 2992 int result = sendIntentSender(sender, scode, intent, resolvedType, finishedReceiver, 2993 requiredPermission, options); 2994 reply.writeNoException(); 2995 reply.writeInt(result); 2996 return true; 2997 } 2998 } 2999 3000 return super.onTransact(code, data, reply, flags); 3001 } 3002 readIntArray(Parcel data)3003 private int[] readIntArray(Parcel data) { 3004 int[] smallest = null; 3005 int smallestSize = data.readInt(); 3006 if (smallestSize > 0) { 3007 smallest = new int[smallestSize]; 3008 data.readIntArray(smallest); 3009 } 3010 return smallest; 3011 } 3012 asBinder()3013 public IBinder asBinder() { 3014 return this; 3015 } 3016 3017 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() { 3018 protected IActivityManager create() { 3019 IBinder b = ServiceManager.getService("activity"); 3020 if (false) { 3021 Log.v("ActivityManager", "default service binder = " + b); 3022 } 3023 IActivityManager am = asInterface(b); 3024 if (false) { 3025 Log.v("ActivityManager", "default service = " + am); 3026 } 3027 return am; 3028 } 3029 }; 3030 } 3031 3032 class ActivityManagerProxy implements IActivityManager 3033 { ActivityManagerProxy(IBinder remote)3034 public ActivityManagerProxy(IBinder remote) 3035 { 3036 mRemote = remote; 3037 } 3038 asBinder()3039 public IBinder asBinder() 3040 { 3041 return mRemote; 3042 } 3043 startActivity(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options)3044 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent, 3045 String resolvedType, IBinder resultTo, String resultWho, int requestCode, 3046 int startFlags, ProfilerInfo profilerInfo, Bundle options) throws RemoteException { 3047 Parcel data = Parcel.obtain(); 3048 Parcel reply = Parcel.obtain(); 3049 data.writeInterfaceToken(IActivityManager.descriptor); 3050 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3051 data.writeString(callingPackage); 3052 intent.writeToParcel(data, 0); 3053 data.writeString(resolvedType); 3054 data.writeStrongBinder(resultTo); 3055 data.writeString(resultWho); 3056 data.writeInt(requestCode); 3057 data.writeInt(startFlags); 3058 if (profilerInfo != null) { 3059 data.writeInt(1); 3060 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 3061 } else { 3062 data.writeInt(0); 3063 } 3064 if (options != null) { 3065 data.writeInt(1); 3066 options.writeToParcel(data, 0); 3067 } else { 3068 data.writeInt(0); 3069 } 3070 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); 3071 reply.readException(); 3072 int result = reply.readInt(); 3073 reply.recycle(); 3074 data.recycle(); 3075 return result; 3076 } 3077 startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId)3078 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent, 3079 String resolvedType, IBinder resultTo, String resultWho, int requestCode, 3080 int startFlags, ProfilerInfo profilerInfo, Bundle options, 3081 int userId) throws RemoteException { 3082 Parcel data = Parcel.obtain(); 3083 Parcel reply = Parcel.obtain(); 3084 data.writeInterfaceToken(IActivityManager.descriptor); 3085 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3086 data.writeString(callingPackage); 3087 intent.writeToParcel(data, 0); 3088 data.writeString(resolvedType); 3089 data.writeStrongBinder(resultTo); 3090 data.writeString(resultWho); 3091 data.writeInt(requestCode); 3092 data.writeInt(startFlags); 3093 if (profilerInfo != null) { 3094 data.writeInt(1); 3095 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 3096 } else { 3097 data.writeInt(0); 3098 } 3099 if (options != null) { 3100 data.writeInt(1); 3101 options.writeToParcel(data, 0); 3102 } else { 3103 data.writeInt(0); 3104 } 3105 data.writeInt(userId); 3106 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0); 3107 reply.readException(); 3108 int result = reply.readInt(); 3109 reply.recycle(); 3110 data.recycle(); 3111 return result; 3112 } startActivityAsCaller(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity, int userId)3113 public int startActivityAsCaller(IApplicationThread caller, String callingPackage, 3114 Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, 3115 int startFlags, ProfilerInfo profilerInfo, Bundle options, boolean ignoreTargetSecurity, 3116 int userId) throws RemoteException { 3117 Parcel data = Parcel.obtain(); 3118 Parcel reply = Parcel.obtain(); 3119 data.writeInterfaceToken(IActivityManager.descriptor); 3120 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3121 data.writeString(callingPackage); 3122 intent.writeToParcel(data, 0); 3123 data.writeString(resolvedType); 3124 data.writeStrongBinder(resultTo); 3125 data.writeString(resultWho); 3126 data.writeInt(requestCode); 3127 data.writeInt(startFlags); 3128 if (profilerInfo != null) { 3129 data.writeInt(1); 3130 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 3131 } else { 3132 data.writeInt(0); 3133 } 3134 if (options != null) { 3135 data.writeInt(1); 3136 options.writeToParcel(data, 0); 3137 } else { 3138 data.writeInt(0); 3139 } 3140 data.writeInt(ignoreTargetSecurity ? 1 : 0); 3141 data.writeInt(userId); 3142 mRemote.transact(START_ACTIVITY_AS_CALLER_TRANSACTION, data, reply, 0); 3143 reply.readException(); 3144 int result = reply.readInt(); 3145 reply.recycle(); 3146 data.recycle(); 3147 return result; 3148 } startActivityAndWait(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId)3149 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage, 3150 Intent intent, String resolvedType, IBinder resultTo, String resultWho, 3151 int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle options, 3152 int userId) throws RemoteException { 3153 Parcel data = Parcel.obtain(); 3154 Parcel reply = Parcel.obtain(); 3155 data.writeInterfaceToken(IActivityManager.descriptor); 3156 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3157 data.writeString(callingPackage); 3158 intent.writeToParcel(data, 0); 3159 data.writeString(resolvedType); 3160 data.writeStrongBinder(resultTo); 3161 data.writeString(resultWho); 3162 data.writeInt(requestCode); 3163 data.writeInt(startFlags); 3164 if (profilerInfo != null) { 3165 data.writeInt(1); 3166 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 3167 } else { 3168 data.writeInt(0); 3169 } 3170 if (options != null) { 3171 data.writeInt(1); 3172 options.writeToParcel(data, 0); 3173 } else { 3174 data.writeInt(0); 3175 } 3176 data.writeInt(userId); 3177 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0); 3178 reply.readException(); 3179 WaitResult result = WaitResult.CREATOR.createFromParcel(reply); 3180 reply.recycle(); 3181 data.recycle(); 3182 return result; 3183 } startActivityWithConfig(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, Configuration config, Bundle options, int userId)3184 public int startActivityWithConfig(IApplicationThread caller, String callingPackage, 3185 Intent intent, String resolvedType, IBinder resultTo, String resultWho, 3186 int requestCode, int startFlags, Configuration config, 3187 Bundle options, int userId) throws RemoteException { 3188 Parcel data = Parcel.obtain(); 3189 Parcel reply = Parcel.obtain(); 3190 data.writeInterfaceToken(IActivityManager.descriptor); 3191 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3192 data.writeString(callingPackage); 3193 intent.writeToParcel(data, 0); 3194 data.writeString(resolvedType); 3195 data.writeStrongBinder(resultTo); 3196 data.writeString(resultWho); 3197 data.writeInt(requestCode); 3198 data.writeInt(startFlags); 3199 config.writeToParcel(data, 0); 3200 if (options != null) { 3201 data.writeInt(1); 3202 options.writeToParcel(data, 0); 3203 } else { 3204 data.writeInt(0); 3205 } 3206 data.writeInt(userId); 3207 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0); 3208 reply.readException(); 3209 int result = reply.readInt(); 3210 reply.recycle(); 3211 data.recycle(); 3212 return result; 3213 } startActivityIntentSender(IApplicationThread caller, IntentSender intent, Intent fillInIntent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int flagsMask, int flagsValues, Bundle options)3214 public int startActivityIntentSender(IApplicationThread caller, 3215 IntentSender intent, Intent fillInIntent, String resolvedType, 3216 IBinder resultTo, String resultWho, int requestCode, 3217 int flagsMask, int flagsValues, Bundle options) throws RemoteException { 3218 Parcel data = Parcel.obtain(); 3219 Parcel reply = Parcel.obtain(); 3220 data.writeInterfaceToken(IActivityManager.descriptor); 3221 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3222 intent.writeToParcel(data, 0); 3223 if (fillInIntent != null) { 3224 data.writeInt(1); 3225 fillInIntent.writeToParcel(data, 0); 3226 } else { 3227 data.writeInt(0); 3228 } 3229 data.writeString(resolvedType); 3230 data.writeStrongBinder(resultTo); 3231 data.writeString(resultWho); 3232 data.writeInt(requestCode); 3233 data.writeInt(flagsMask); 3234 data.writeInt(flagsValues); 3235 if (options != null) { 3236 data.writeInt(1); 3237 options.writeToParcel(data, 0); 3238 } else { 3239 data.writeInt(0); 3240 } 3241 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0); 3242 reply.readException(); 3243 int result = reply.readInt(); 3244 reply.recycle(); 3245 data.recycle(); 3246 return result; 3247 } startVoiceActivity(String callingPackage, int callingPid, int callingUid, Intent intent, String resolvedType, IVoiceInteractionSession session, IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo, Bundle options, int userId)3248 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid, 3249 Intent intent, String resolvedType, IVoiceInteractionSession session, 3250 IVoiceInteractor interactor, int startFlags, ProfilerInfo profilerInfo, 3251 Bundle options, int userId) throws RemoteException { 3252 Parcel data = Parcel.obtain(); 3253 Parcel reply = Parcel.obtain(); 3254 data.writeInterfaceToken(IActivityManager.descriptor); 3255 data.writeString(callingPackage); 3256 data.writeInt(callingPid); 3257 data.writeInt(callingUid); 3258 intent.writeToParcel(data, 0); 3259 data.writeString(resolvedType); 3260 data.writeStrongBinder(session.asBinder()); 3261 data.writeStrongBinder(interactor.asBinder()); 3262 data.writeInt(startFlags); 3263 if (profilerInfo != null) { 3264 data.writeInt(1); 3265 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 3266 } else { 3267 data.writeInt(0); 3268 } 3269 if (options != null) { 3270 data.writeInt(1); 3271 options.writeToParcel(data, 0); 3272 } else { 3273 data.writeInt(0); 3274 } 3275 data.writeInt(userId); 3276 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0); 3277 reply.readException(); 3278 int result = reply.readInt(); 3279 reply.recycle(); 3280 data.recycle(); 3281 return result; 3282 } 3283 startLocalVoiceInteraction(IBinder callingActivity, Bundle options)3284 public void startLocalVoiceInteraction(IBinder callingActivity, Bundle options) 3285 throws RemoteException { 3286 Parcel data = Parcel.obtain(); 3287 Parcel reply = Parcel.obtain(); 3288 data.writeInterfaceToken(IActivityManager.descriptor); 3289 data.writeStrongBinder(callingActivity); 3290 data.writeBundle(options); 3291 mRemote.transact(START_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0); 3292 reply.readException(); 3293 reply.recycle(); 3294 data.recycle(); 3295 } 3296 stopLocalVoiceInteraction(IBinder callingActivity)3297 public void stopLocalVoiceInteraction(IBinder callingActivity) throws RemoteException { 3298 Parcel data = Parcel.obtain(); 3299 Parcel reply = Parcel.obtain(); 3300 data.writeInterfaceToken(IActivityManager.descriptor); 3301 data.writeStrongBinder(callingActivity); 3302 mRemote.transact(STOP_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0); 3303 reply.readException(); 3304 reply.recycle(); 3305 data.recycle(); 3306 } 3307 supportsLocalVoiceInteraction()3308 public boolean supportsLocalVoiceInteraction() throws RemoteException { 3309 Parcel data = Parcel.obtain(); 3310 Parcel reply = Parcel.obtain(); 3311 data.writeInterfaceToken(IActivityManager.descriptor); 3312 mRemote.transact(SUPPORTS_LOCAL_VOICE_INTERACTION_TRANSACTION, data, reply, 0); 3313 reply.readException(); 3314 int result = reply.readInt(); 3315 reply.recycle(); 3316 data.recycle(); 3317 return result != 0; 3318 } 3319 startNextMatchingActivity(IBinder callingActivity, Intent intent, Bundle options)3320 public boolean startNextMatchingActivity(IBinder callingActivity, 3321 Intent intent, Bundle options) throws RemoteException { 3322 Parcel data = Parcel.obtain(); 3323 Parcel reply = Parcel.obtain(); 3324 data.writeInterfaceToken(IActivityManager.descriptor); 3325 data.writeStrongBinder(callingActivity); 3326 intent.writeToParcel(data, 0); 3327 if (options != null) { 3328 data.writeInt(1); 3329 options.writeToParcel(data, 0); 3330 } else { 3331 data.writeInt(0); 3332 } 3333 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0); 3334 reply.readException(); 3335 int result = reply.readInt(); 3336 reply.recycle(); 3337 data.recycle(); 3338 return result != 0; 3339 } startActivityFromRecents(int taskId, Bundle options)3340 public int startActivityFromRecents(int taskId, Bundle options) 3341 throws RemoteException { 3342 Parcel data = Parcel.obtain(); 3343 Parcel reply = Parcel.obtain(); 3344 data.writeInterfaceToken(IActivityManager.descriptor); 3345 data.writeInt(taskId); 3346 if (options == null) { 3347 data.writeInt(0); 3348 } else { 3349 data.writeInt(1); 3350 options.writeToParcel(data, 0); 3351 } 3352 mRemote.transact(START_ACTIVITY_FROM_RECENTS_TRANSACTION, data, reply, 0); 3353 reply.readException(); 3354 int result = reply.readInt(); 3355 reply.recycle(); 3356 data.recycle(); 3357 return result; 3358 } finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask)3359 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, int finishTask) 3360 throws RemoteException { 3361 Parcel data = Parcel.obtain(); 3362 Parcel reply = Parcel.obtain(); 3363 data.writeInterfaceToken(IActivityManager.descriptor); 3364 data.writeStrongBinder(token); 3365 data.writeInt(resultCode); 3366 if (resultData != null) { 3367 data.writeInt(1); 3368 resultData.writeToParcel(data, 0); 3369 } else { 3370 data.writeInt(0); 3371 } 3372 data.writeInt(finishTask); 3373 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0); 3374 reply.readException(); 3375 boolean res = reply.readInt() != 0; 3376 data.recycle(); 3377 reply.recycle(); 3378 return res; 3379 } finishSubActivity(IBinder token, String resultWho, int requestCode)3380 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException 3381 { 3382 Parcel data = Parcel.obtain(); 3383 Parcel reply = Parcel.obtain(); 3384 data.writeInterfaceToken(IActivityManager.descriptor); 3385 data.writeStrongBinder(token); 3386 data.writeString(resultWho); 3387 data.writeInt(requestCode); 3388 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0); 3389 reply.readException(); 3390 data.recycle(); 3391 reply.recycle(); 3392 } finishActivityAffinity(IBinder token)3393 public boolean finishActivityAffinity(IBinder token) throws RemoteException { 3394 Parcel data = Parcel.obtain(); 3395 Parcel reply = Parcel.obtain(); 3396 data.writeInterfaceToken(IActivityManager.descriptor); 3397 data.writeStrongBinder(token); 3398 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0); 3399 reply.readException(); 3400 boolean res = reply.readInt() != 0; 3401 data.recycle(); 3402 reply.recycle(); 3403 return res; 3404 } finishVoiceTask(IVoiceInteractionSession session)3405 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException { 3406 Parcel data = Parcel.obtain(); 3407 Parcel reply = Parcel.obtain(); 3408 data.writeInterfaceToken(IActivityManager.descriptor); 3409 data.writeStrongBinder(session.asBinder()); 3410 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0); 3411 reply.readException(); 3412 data.recycle(); 3413 reply.recycle(); 3414 } releaseActivityInstance(IBinder token)3415 public boolean releaseActivityInstance(IBinder token) throws RemoteException { 3416 Parcel data = Parcel.obtain(); 3417 Parcel reply = Parcel.obtain(); 3418 data.writeInterfaceToken(IActivityManager.descriptor); 3419 data.writeStrongBinder(token); 3420 mRemote.transact(RELEASE_ACTIVITY_INSTANCE_TRANSACTION, data, reply, 0); 3421 reply.readException(); 3422 boolean res = reply.readInt() != 0; 3423 data.recycle(); 3424 reply.recycle(); 3425 return res; 3426 } releaseSomeActivities(IApplicationThread app)3427 public void releaseSomeActivities(IApplicationThread app) throws RemoteException { 3428 Parcel data = Parcel.obtain(); 3429 Parcel reply = Parcel.obtain(); 3430 data.writeInterfaceToken(IActivityManager.descriptor); 3431 data.writeStrongBinder(app.asBinder()); 3432 mRemote.transact(RELEASE_SOME_ACTIVITIES_TRANSACTION, data, reply, 0); 3433 reply.readException(); 3434 data.recycle(); 3435 reply.recycle(); 3436 } willActivityBeVisible(IBinder token)3437 public boolean willActivityBeVisible(IBinder token) throws RemoteException { 3438 Parcel data = Parcel.obtain(); 3439 Parcel reply = Parcel.obtain(); 3440 data.writeInterfaceToken(IActivityManager.descriptor); 3441 data.writeStrongBinder(token); 3442 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0); 3443 reply.readException(); 3444 boolean res = reply.readInt() != 0; 3445 data.recycle(); 3446 reply.recycle(); 3447 return res; 3448 } registerReceiver(IApplicationThread caller, String packageName, IIntentReceiver receiver, IntentFilter filter, String perm, int userId)3449 public Intent registerReceiver(IApplicationThread caller, String packageName, 3450 IIntentReceiver receiver, 3451 IntentFilter filter, String perm, int userId) throws RemoteException 3452 { 3453 Parcel data = Parcel.obtain(); 3454 Parcel reply = Parcel.obtain(); 3455 data.writeInterfaceToken(IActivityManager.descriptor); 3456 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3457 data.writeString(packageName); 3458 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null); 3459 filter.writeToParcel(data, 0); 3460 data.writeString(perm); 3461 data.writeInt(userId); 3462 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0); 3463 reply.readException(); 3464 Intent intent = null; 3465 int haveIntent = reply.readInt(); 3466 if (haveIntent != 0) { 3467 intent = Intent.CREATOR.createFromParcel(reply); 3468 } 3469 reply.recycle(); 3470 data.recycle(); 3471 return intent; 3472 } unregisterReceiver(IIntentReceiver receiver)3473 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException 3474 { 3475 Parcel data = Parcel.obtain(); 3476 Parcel reply = Parcel.obtain(); 3477 data.writeInterfaceToken(IActivityManager.descriptor); 3478 data.writeStrongBinder(receiver.asBinder()); 3479 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0); 3480 reply.readException(); 3481 data.recycle(); 3482 reply.recycle(); 3483 } broadcastIntent(IApplicationThread caller, Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode, String resultData, Bundle map, String[] requiredPermissions, int appOp, Bundle options, boolean serialized, boolean sticky, int userId)3484 public int broadcastIntent(IApplicationThread caller, 3485 Intent intent, String resolvedType, IIntentReceiver resultTo, 3486 int resultCode, String resultData, Bundle map, 3487 String[] requiredPermissions, int appOp, Bundle options, boolean serialized, 3488 boolean sticky, int userId) throws RemoteException 3489 { 3490 Parcel data = Parcel.obtain(); 3491 Parcel reply = Parcel.obtain(); 3492 data.writeInterfaceToken(IActivityManager.descriptor); 3493 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3494 intent.writeToParcel(data, 0); 3495 data.writeString(resolvedType); 3496 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null); 3497 data.writeInt(resultCode); 3498 data.writeString(resultData); 3499 data.writeBundle(map); 3500 data.writeStringArray(requiredPermissions); 3501 data.writeInt(appOp); 3502 data.writeBundle(options); 3503 data.writeInt(serialized ? 1 : 0); 3504 data.writeInt(sticky ? 1 : 0); 3505 data.writeInt(userId); 3506 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0); 3507 reply.readException(); 3508 int res = reply.readInt(); 3509 reply.recycle(); 3510 data.recycle(); 3511 return res; 3512 } unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)3513 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId) 3514 throws RemoteException 3515 { 3516 Parcel data = Parcel.obtain(); 3517 Parcel reply = Parcel.obtain(); 3518 data.writeInterfaceToken(IActivityManager.descriptor); 3519 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 3520 intent.writeToParcel(data, 0); 3521 data.writeInt(userId); 3522 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0); 3523 reply.readException(); 3524 data.recycle(); 3525 reply.recycle(); 3526 } finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast, int flags)3527 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, 3528 boolean abortBroadcast, int flags) throws RemoteException 3529 { 3530 Parcel data = Parcel.obtain(); 3531 Parcel reply = Parcel.obtain(); 3532 data.writeInterfaceToken(IActivityManager.descriptor); 3533 data.writeStrongBinder(who); 3534 data.writeInt(resultCode); 3535 data.writeString(resultData); 3536 data.writeBundle(map); 3537 data.writeInt(abortBroadcast ? 1 : 0); 3538 data.writeInt(flags); 3539 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3540 reply.readException(); 3541 data.recycle(); 3542 reply.recycle(); 3543 } attachApplication(IApplicationThread app)3544 public void attachApplication(IApplicationThread app) throws RemoteException 3545 { 3546 Parcel data = Parcel.obtain(); 3547 Parcel reply = Parcel.obtain(); 3548 data.writeInterfaceToken(IActivityManager.descriptor); 3549 data.writeStrongBinder(app.asBinder()); 3550 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0); 3551 reply.readException(); 3552 data.recycle(); 3553 reply.recycle(); 3554 } activityIdle(IBinder token, Configuration config, boolean stopProfiling)3555 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling) 3556 throws RemoteException 3557 { 3558 Parcel data = Parcel.obtain(); 3559 Parcel reply = Parcel.obtain(); 3560 data.writeInterfaceToken(IActivityManager.descriptor); 3561 data.writeStrongBinder(token); 3562 if (config != null) { 3563 data.writeInt(1); 3564 config.writeToParcel(data, 0); 3565 } else { 3566 data.writeInt(0); 3567 } 3568 data.writeInt(stopProfiling ? 1 : 0); 3569 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3570 reply.readException(); 3571 data.recycle(); 3572 reply.recycle(); 3573 } activityResumed(IBinder token)3574 public void activityResumed(IBinder token) throws RemoteException 3575 { 3576 Parcel data = Parcel.obtain(); 3577 Parcel reply = Parcel.obtain(); 3578 data.writeInterfaceToken(IActivityManager.descriptor); 3579 data.writeStrongBinder(token); 3580 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0); 3581 reply.readException(); 3582 data.recycle(); 3583 reply.recycle(); 3584 } activityPaused(IBinder token)3585 public void activityPaused(IBinder token) throws RemoteException 3586 { 3587 Parcel data = Parcel.obtain(); 3588 Parcel reply = Parcel.obtain(); 3589 data.writeInterfaceToken(IActivityManager.descriptor); 3590 data.writeStrongBinder(token); 3591 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0); 3592 reply.readException(); 3593 data.recycle(); 3594 reply.recycle(); 3595 } activityStopped(IBinder token, Bundle state, PersistableBundle persistentState, CharSequence description)3596 public void activityStopped(IBinder token, Bundle state, 3597 PersistableBundle persistentState, CharSequence description) throws RemoteException 3598 { 3599 Parcel data = Parcel.obtain(); 3600 Parcel reply = Parcel.obtain(); 3601 data.writeInterfaceToken(IActivityManager.descriptor); 3602 data.writeStrongBinder(token); 3603 data.writeBundle(state); 3604 data.writePersistableBundle(persistentState); 3605 TextUtils.writeToParcel(description, data, 0); 3606 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3607 reply.readException(); 3608 data.recycle(); 3609 reply.recycle(); 3610 } activitySlept(IBinder token)3611 public void activitySlept(IBinder token) throws RemoteException 3612 { 3613 Parcel data = Parcel.obtain(); 3614 Parcel reply = Parcel.obtain(); 3615 data.writeInterfaceToken(IActivityManager.descriptor); 3616 data.writeStrongBinder(token); 3617 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3618 reply.readException(); 3619 data.recycle(); 3620 reply.recycle(); 3621 } activityDestroyed(IBinder token)3622 public void activityDestroyed(IBinder token) throws RemoteException 3623 { 3624 Parcel data = Parcel.obtain(); 3625 Parcel reply = Parcel.obtain(); 3626 data.writeInterfaceToken(IActivityManager.descriptor); 3627 data.writeStrongBinder(token); 3628 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 3629 reply.readException(); 3630 data.recycle(); 3631 reply.recycle(); 3632 } activityRelaunched(IBinder token)3633 public void activityRelaunched(IBinder token) throws RemoteException 3634 { 3635 Parcel data = Parcel.obtain(); 3636 Parcel reply = Parcel.obtain(); 3637 data.writeInterfaceToken(IActivityManager.descriptor); 3638 data.writeStrongBinder(token); 3639 mRemote.transact(ACTIVITY_RELAUNCHED_TRANSACTION, data, reply, 0); 3640 reply.readException(); 3641 data.recycle(); 3642 reply.recycle(); 3643 } getCallingPackage(IBinder token)3644 public String getCallingPackage(IBinder token) throws RemoteException 3645 { 3646 Parcel data = Parcel.obtain(); 3647 Parcel reply = Parcel.obtain(); 3648 data.writeInterfaceToken(IActivityManager.descriptor); 3649 data.writeStrongBinder(token); 3650 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0); 3651 reply.readException(); 3652 String res = reply.readString(); 3653 data.recycle(); 3654 reply.recycle(); 3655 return res; 3656 } getCallingActivity(IBinder token)3657 public ComponentName getCallingActivity(IBinder token) 3658 throws RemoteException { 3659 Parcel data = Parcel.obtain(); 3660 Parcel reply = Parcel.obtain(); 3661 data.writeInterfaceToken(IActivityManager.descriptor); 3662 data.writeStrongBinder(token); 3663 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0); 3664 reply.readException(); 3665 ComponentName res = ComponentName.readFromParcel(reply); 3666 data.recycle(); 3667 reply.recycle(); 3668 return res; 3669 } getAppTasks(String callingPackage)3670 public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException { 3671 Parcel data = Parcel.obtain(); 3672 Parcel reply = Parcel.obtain(); 3673 data.writeInterfaceToken(IActivityManager.descriptor); 3674 data.writeString(callingPackage); 3675 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0); 3676 reply.readException(); 3677 ArrayList<IAppTask> list = null; 3678 int N = reply.readInt(); 3679 if (N >= 0) { 3680 list = new ArrayList<>(); 3681 while (N > 0) { 3682 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder()); 3683 list.add(task); 3684 N--; 3685 } 3686 } 3687 data.recycle(); 3688 reply.recycle(); 3689 return list; 3690 } addAppTask(IBinder activityToken, Intent intent, ActivityManager.TaskDescription description, Bitmap thumbnail)3691 public int addAppTask(IBinder activityToken, Intent intent, 3692 ActivityManager.TaskDescription description, Bitmap thumbnail) throws RemoteException { 3693 Parcel data = Parcel.obtain(); 3694 Parcel reply = Parcel.obtain(); 3695 data.writeInterfaceToken(IActivityManager.descriptor); 3696 data.writeStrongBinder(activityToken); 3697 intent.writeToParcel(data, 0); 3698 description.writeToParcel(data, 0); 3699 thumbnail.writeToParcel(data, 0); 3700 mRemote.transact(ADD_APP_TASK_TRANSACTION, data, reply, 0); 3701 reply.readException(); 3702 int res = reply.readInt(); 3703 data.recycle(); 3704 reply.recycle(); 3705 return res; 3706 } getAppTaskThumbnailSize()3707 public Point getAppTaskThumbnailSize() throws RemoteException { 3708 Parcel data = Parcel.obtain(); 3709 Parcel reply = Parcel.obtain(); 3710 data.writeInterfaceToken(IActivityManager.descriptor); 3711 mRemote.transact(GET_APP_TASK_THUMBNAIL_SIZE_TRANSACTION, data, reply, 0); 3712 reply.readException(); 3713 Point size = Point.CREATOR.createFromParcel(reply); 3714 data.recycle(); 3715 reply.recycle(); 3716 return size; 3717 } getTasks(int maxNum, int flags)3718 public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum, int flags) 3719 throws RemoteException { 3720 Parcel data = Parcel.obtain(); 3721 Parcel reply = Parcel.obtain(); 3722 data.writeInterfaceToken(IActivityManager.descriptor); 3723 data.writeInt(maxNum); 3724 data.writeInt(flags); 3725 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0); 3726 reply.readException(); 3727 ArrayList<ActivityManager.RunningTaskInfo> list = null; 3728 int N = reply.readInt(); 3729 if (N >= 0) { 3730 list = new ArrayList<>(); 3731 while (N > 0) { 3732 ActivityManager.RunningTaskInfo info = 3733 ActivityManager.RunningTaskInfo.CREATOR 3734 .createFromParcel(reply); 3735 list.add(info); 3736 N--; 3737 } 3738 } 3739 data.recycle(); 3740 reply.recycle(); 3741 return list; 3742 } getRecentTasks(int maxNum, int flags, int userId)3743 public ParceledListSlice<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum, 3744 int flags, int userId) throws RemoteException { 3745 Parcel data = Parcel.obtain(); 3746 Parcel reply = Parcel.obtain(); 3747 data.writeInterfaceToken(IActivityManager.descriptor); 3748 data.writeInt(maxNum); 3749 data.writeInt(flags); 3750 data.writeInt(userId); 3751 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0); 3752 reply.readException(); 3753 final ParceledListSlice<ActivityManager.RecentTaskInfo> list = ParceledListSlice.CREATOR 3754 .createFromParcel(reply); 3755 data.recycle(); 3756 reply.recycle(); 3757 return list; 3758 } getTaskThumbnail(int id)3759 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException { 3760 Parcel data = Parcel.obtain(); 3761 Parcel reply = Parcel.obtain(); 3762 data.writeInterfaceToken(IActivityManager.descriptor); 3763 data.writeInt(id); 3764 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0); 3765 reply.readException(); 3766 ActivityManager.TaskThumbnail taskThumbnail = null; 3767 if (reply.readInt() != 0) { 3768 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply); 3769 } 3770 data.recycle(); 3771 reply.recycle(); 3772 return taskThumbnail; 3773 } getServices(int maxNum, int flags)3774 public List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags) 3775 throws RemoteException { 3776 Parcel data = Parcel.obtain(); 3777 Parcel reply = Parcel.obtain(); 3778 data.writeInterfaceToken(IActivityManager.descriptor); 3779 data.writeInt(maxNum); 3780 data.writeInt(flags); 3781 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0); 3782 reply.readException(); 3783 ArrayList<ActivityManager.RunningServiceInfo> list = null; 3784 int N = reply.readInt(); 3785 if (N >= 0) { 3786 list = new ArrayList<>(); 3787 while (N > 0) { 3788 ActivityManager.RunningServiceInfo info = 3789 ActivityManager.RunningServiceInfo.CREATOR 3790 .createFromParcel(reply); 3791 list.add(info); 3792 N--; 3793 } 3794 } 3795 data.recycle(); 3796 reply.recycle(); 3797 return list; 3798 } getProcessesInErrorState()3799 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState() 3800 throws RemoteException { 3801 Parcel data = Parcel.obtain(); 3802 Parcel reply = Parcel.obtain(); 3803 data.writeInterfaceToken(IActivityManager.descriptor); 3804 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0); 3805 reply.readException(); 3806 ArrayList<ActivityManager.ProcessErrorStateInfo> list 3807 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR); 3808 data.recycle(); 3809 reply.recycle(); 3810 return list; 3811 } getRunningAppProcesses()3812 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() 3813 throws RemoteException { 3814 Parcel data = Parcel.obtain(); 3815 Parcel reply = Parcel.obtain(); 3816 data.writeInterfaceToken(IActivityManager.descriptor); 3817 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0); 3818 reply.readException(); 3819 ArrayList<ActivityManager.RunningAppProcessInfo> list 3820 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR); 3821 data.recycle(); 3822 reply.recycle(); 3823 return list; 3824 } getRunningExternalApplications()3825 public List<ApplicationInfo> getRunningExternalApplications() 3826 throws RemoteException { 3827 Parcel data = Parcel.obtain(); 3828 Parcel reply = Parcel.obtain(); 3829 data.writeInterfaceToken(IActivityManager.descriptor); 3830 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0); 3831 reply.readException(); 3832 ArrayList<ApplicationInfo> list 3833 = reply.createTypedArrayList(ApplicationInfo.CREATOR); 3834 data.recycle(); 3835 reply.recycle(); 3836 return list; 3837 } moveTaskToFront(int task, int flags, Bundle options)3838 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException 3839 { 3840 Parcel data = Parcel.obtain(); 3841 Parcel reply = Parcel.obtain(); 3842 data.writeInterfaceToken(IActivityManager.descriptor); 3843 data.writeInt(task); 3844 data.writeInt(flags); 3845 if (options != null) { 3846 data.writeInt(1); 3847 options.writeToParcel(data, 0); 3848 } else { 3849 data.writeInt(0); 3850 } 3851 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0); 3852 reply.readException(); 3853 data.recycle(); 3854 reply.recycle(); 3855 } moveActivityTaskToBack(IBinder token, boolean nonRoot)3856 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) 3857 throws RemoteException { 3858 Parcel data = Parcel.obtain(); 3859 Parcel reply = Parcel.obtain(); 3860 data.writeInterfaceToken(IActivityManager.descriptor); 3861 data.writeStrongBinder(token); 3862 data.writeInt(nonRoot ? 1 : 0); 3863 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0); 3864 reply.readException(); 3865 boolean res = reply.readInt() != 0; 3866 data.recycle(); 3867 reply.recycle(); 3868 return res; 3869 } moveTaskBackwards(int task)3870 public void moveTaskBackwards(int task) throws RemoteException 3871 { 3872 Parcel data = Parcel.obtain(); 3873 Parcel reply = Parcel.obtain(); 3874 data.writeInterfaceToken(IActivityManager.descriptor); 3875 data.writeInt(task); 3876 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0); 3877 reply.readException(); 3878 data.recycle(); 3879 reply.recycle(); 3880 } 3881 @Override moveTaskToStack(int taskId, int stackId, boolean toTop)3882 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException 3883 { 3884 Parcel data = Parcel.obtain(); 3885 Parcel reply = Parcel.obtain(); 3886 data.writeInterfaceToken(IActivityManager.descriptor); 3887 data.writeInt(taskId); 3888 data.writeInt(stackId); 3889 data.writeInt(toTop ? 1 : 0); 3890 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0); 3891 reply.readException(); 3892 data.recycle(); 3893 reply.recycle(); 3894 } 3895 @Override moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, Rect initialBounds, boolean moveHomeStackFront)3896 public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, 3897 Rect initialBounds, boolean moveHomeStackFront) throws RemoteException 3898 { 3899 Parcel data = Parcel.obtain(); 3900 Parcel reply = Parcel.obtain(); 3901 data.writeInterfaceToken(IActivityManager.descriptor); 3902 data.writeInt(taskId); 3903 data.writeInt(createMode); 3904 data.writeInt(toTop ? 1 : 0); 3905 data.writeInt(animate ? 1 : 0); 3906 if (initialBounds != null) { 3907 data.writeInt(1); 3908 initialBounds.writeToParcel(data, 0); 3909 } else { 3910 data.writeInt(0); 3911 } 3912 data.writeInt(moveHomeStackFront ? 1 : 0); 3913 mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0); 3914 reply.readException(); 3915 boolean res = reply.readInt() > 0; 3916 data.recycle(); 3917 reply.recycle(); 3918 return res; 3919 } 3920 @Override moveTopActivityToPinnedStack(int stackId, Rect r)3921 public boolean moveTopActivityToPinnedStack(int stackId, Rect r) 3922 throws RemoteException 3923 { 3924 Parcel data = Parcel.obtain(); 3925 Parcel reply = Parcel.obtain(); 3926 data.writeInterfaceToken(IActivityManager.descriptor); 3927 data.writeInt(stackId); 3928 r.writeToParcel(data, 0); 3929 mRemote.transact(MOVE_TOP_ACTIVITY_TO_PINNED_STACK_TRANSACTION, data, reply, 0); 3930 reply.readException(); 3931 final boolean res = reply.readInt() != 0; 3932 data.recycle(); 3933 reply.recycle(); 3934 return res; 3935 } 3936 @Override resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode, boolean preserveWindows, boolean animate, int animationDuration)3937 public void resizeStack(int stackId, Rect r, boolean allowResizeInDockedMode, 3938 boolean preserveWindows, boolean animate, int animationDuration) 3939 throws RemoteException { 3940 Parcel data = Parcel.obtain(); 3941 Parcel reply = Parcel.obtain(); 3942 data.writeInterfaceToken(IActivityManager.descriptor); 3943 data.writeInt(stackId); 3944 if (r != null) { 3945 data.writeInt(1); 3946 r.writeToParcel(data, 0); 3947 } else { 3948 data.writeInt(0); 3949 } 3950 data.writeInt(allowResizeInDockedMode ? 1 : 0); 3951 data.writeInt(preserveWindows ? 1 : 0); 3952 data.writeInt(animate ? 1 : 0); 3953 data.writeInt(animationDuration); 3954 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0); 3955 reply.readException(); 3956 data.recycle(); 3957 reply.recycle(); 3958 } 3959 @Override swapDockedAndFullscreenStack()3960 public void swapDockedAndFullscreenStack() throws RemoteException 3961 { 3962 Parcel data = Parcel.obtain(); 3963 Parcel reply = Parcel.obtain(); 3964 data.writeInterfaceToken(IActivityManager.descriptor); 3965 mRemote.transact(SWAP_DOCKED_AND_FULLSCREEN_STACK, data, reply, 0); 3966 reply.readException(); 3967 data.recycle(); 3968 reply.recycle(); 3969 } 3970 @Override resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds, Rect tempDockedTaskInsetBounds, Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds)3971 public void resizeDockedStack(Rect dockedBounds, Rect tempDockedTaskBounds, 3972 Rect tempDockedTaskInsetBounds, 3973 Rect tempOtherTaskBounds, Rect tempOtherTaskInsetBounds) 3974 throws RemoteException 3975 { 3976 Parcel data = Parcel.obtain(); 3977 Parcel reply = Parcel.obtain(); 3978 data.writeInterfaceToken(IActivityManager.descriptor); 3979 if (dockedBounds != null) { 3980 data.writeInt(1); 3981 dockedBounds.writeToParcel(data, 0); 3982 } else { 3983 data.writeInt(0); 3984 } 3985 if (tempDockedTaskBounds != null) { 3986 data.writeInt(1); 3987 tempDockedTaskBounds.writeToParcel(data, 0); 3988 } else { 3989 data.writeInt(0); 3990 } 3991 if (tempDockedTaskInsetBounds != null) { 3992 data.writeInt(1); 3993 tempDockedTaskInsetBounds.writeToParcel(data, 0); 3994 } else { 3995 data.writeInt(0); 3996 } 3997 if (tempOtherTaskBounds != null) { 3998 data.writeInt(1); 3999 tempOtherTaskBounds.writeToParcel(data, 0); 4000 } else { 4001 data.writeInt(0); 4002 } 4003 if (tempOtherTaskInsetBounds != null) { 4004 data.writeInt(1); 4005 tempOtherTaskInsetBounds.writeToParcel(data, 0); 4006 } else { 4007 data.writeInt(0); 4008 } 4009 mRemote.transact(RESIZE_DOCKED_STACK_TRANSACTION, data, reply, 0); 4010 reply.readException(); 4011 data.recycle(); 4012 reply.recycle(); 4013 } 4014 4015 @Override resizePinnedStack(Rect pinnedBounds, Rect tempPinnedTaskBounds)4016 public void resizePinnedStack(Rect pinnedBounds, Rect tempPinnedTaskBounds) throws RemoteException 4017 { 4018 Parcel data = Parcel.obtain(); 4019 Parcel reply = Parcel.obtain(); 4020 data.writeInterfaceToken(IActivityManager.descriptor); 4021 if (pinnedBounds != null) { 4022 data.writeInt(1); 4023 pinnedBounds.writeToParcel(data, 0); 4024 } else { 4025 data.writeInt(0); 4026 } 4027 if (tempPinnedTaskBounds != null) { 4028 data.writeInt(1); 4029 tempPinnedTaskBounds.writeToParcel(data, 0); 4030 } else { 4031 data.writeInt(0); 4032 } 4033 mRemote.transact(RESIZE_PINNED_STACK_TRANSACTION, data, reply, 0); 4034 reply.readException(); 4035 data.recycle(); 4036 reply.recycle(); 4037 } 4038 4039 @Override positionTaskInStack(int taskId, int stackId, int position)4040 public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException 4041 { 4042 Parcel data = Parcel.obtain(); 4043 Parcel reply = Parcel.obtain(); 4044 data.writeInterfaceToken(IActivityManager.descriptor); 4045 data.writeInt(taskId); 4046 data.writeInt(stackId); 4047 data.writeInt(position); 4048 mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0); 4049 reply.readException(); 4050 data.recycle(); 4051 reply.recycle(); 4052 } 4053 @Override getAllStackInfos()4054 public List<StackInfo> getAllStackInfos() throws RemoteException 4055 { 4056 Parcel data = Parcel.obtain(); 4057 Parcel reply = Parcel.obtain(); 4058 data.writeInterfaceToken(IActivityManager.descriptor); 4059 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0); 4060 reply.readException(); 4061 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR); 4062 data.recycle(); 4063 reply.recycle(); 4064 return list; 4065 } 4066 @Override getStackInfo(int stackId)4067 public StackInfo getStackInfo(int stackId) throws RemoteException 4068 { 4069 Parcel data = Parcel.obtain(); 4070 Parcel reply = Parcel.obtain(); 4071 data.writeInterfaceToken(IActivityManager.descriptor); 4072 data.writeInt(stackId); 4073 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0); 4074 reply.readException(); 4075 int res = reply.readInt(); 4076 StackInfo info = null; 4077 if (res != 0) { 4078 info = StackInfo.CREATOR.createFromParcel(reply); 4079 } 4080 data.recycle(); 4081 reply.recycle(); 4082 return info; 4083 } 4084 @Override isInHomeStack(int taskId)4085 public boolean isInHomeStack(int taskId) throws RemoteException { 4086 Parcel data = Parcel.obtain(); 4087 Parcel reply = Parcel.obtain(); 4088 data.writeInterfaceToken(IActivityManager.descriptor); 4089 data.writeInt(taskId); 4090 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0); 4091 reply.readException(); 4092 boolean isInHomeStack = reply.readInt() > 0; 4093 data.recycle(); 4094 reply.recycle(); 4095 return isInHomeStack; 4096 } 4097 @Override setFocusedStack(int stackId)4098 public void setFocusedStack(int stackId) throws RemoteException 4099 { 4100 Parcel data = Parcel.obtain(); 4101 Parcel reply = Parcel.obtain(); 4102 data.writeInterfaceToken(IActivityManager.descriptor); 4103 data.writeInt(stackId); 4104 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, 0); 4105 reply.readException(); 4106 data.recycle(); 4107 reply.recycle(); 4108 } 4109 @Override getFocusedStackId()4110 public int getFocusedStackId() throws RemoteException { 4111 Parcel data = Parcel.obtain(); 4112 Parcel reply = Parcel.obtain(); 4113 data.writeInterfaceToken(IActivityManager.descriptor); 4114 mRemote.transact(GET_FOCUSED_STACK_ID_TRANSACTION, data, reply, 0); 4115 reply.readException(); 4116 int focusedStackId = reply.readInt(); 4117 data.recycle(); 4118 reply.recycle(); 4119 return focusedStackId; 4120 } 4121 @Override setFocusedTask(int taskId)4122 public void setFocusedTask(int taskId) throws RemoteException 4123 { 4124 Parcel data = Parcel.obtain(); 4125 Parcel reply = Parcel.obtain(); 4126 data.writeInterfaceToken(IActivityManager.descriptor); 4127 data.writeInt(taskId); 4128 mRemote.transact(SET_FOCUSED_TASK_TRANSACTION, data, reply, 0); 4129 reply.readException(); 4130 data.recycle(); 4131 reply.recycle(); 4132 } 4133 @Override registerTaskStackListener(ITaskStackListener listener)4134 public void registerTaskStackListener(ITaskStackListener listener) throws RemoteException 4135 { 4136 Parcel data = Parcel.obtain(); 4137 Parcel reply = Parcel.obtain(); 4138 data.writeInterfaceToken(IActivityManager.descriptor); 4139 data.writeStrongBinder(listener.asBinder()); 4140 mRemote.transact(REGISTER_TASK_STACK_LISTENER_TRANSACTION, data, reply, 0); 4141 reply.readException(); 4142 data.recycle(); 4143 reply.recycle(); 4144 } getTaskForActivity(IBinder token, boolean onlyRoot)4145 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException 4146 { 4147 Parcel data = Parcel.obtain(); 4148 Parcel reply = Parcel.obtain(); 4149 data.writeInterfaceToken(IActivityManager.descriptor); 4150 data.writeStrongBinder(token); 4151 data.writeInt(onlyRoot ? 1 : 0); 4152 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0); 4153 reply.readException(); 4154 int res = reply.readInt(); 4155 data.recycle(); 4156 reply.recycle(); 4157 return res; 4158 } getContentProvider(IApplicationThread caller, String name, int userId, boolean stable)4159 public ContentProviderHolder getContentProvider(IApplicationThread caller, 4160 String name, int userId, boolean stable) throws RemoteException { 4161 Parcel data = Parcel.obtain(); 4162 Parcel reply = Parcel.obtain(); 4163 data.writeInterfaceToken(IActivityManager.descriptor); 4164 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 4165 data.writeString(name); 4166 data.writeInt(userId); 4167 data.writeInt(stable ? 1 : 0); 4168 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 4169 reply.readException(); 4170 int res = reply.readInt(); 4171 ContentProviderHolder cph = null; 4172 if (res != 0) { 4173 cph = ContentProviderHolder.CREATOR.createFromParcel(reply); 4174 } 4175 data.recycle(); 4176 reply.recycle(); 4177 return cph; 4178 } getContentProviderExternal(String name, int userId, IBinder token)4179 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token) 4180 throws RemoteException { 4181 Parcel data = Parcel.obtain(); 4182 Parcel reply = Parcel.obtain(); 4183 data.writeInterfaceToken(IActivityManager.descriptor); 4184 data.writeString(name); 4185 data.writeInt(userId); 4186 data.writeStrongBinder(token); 4187 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); 4188 reply.readException(); 4189 int res = reply.readInt(); 4190 ContentProviderHolder cph = null; 4191 if (res != 0) { 4192 cph = ContentProviderHolder.CREATOR.createFromParcel(reply); 4193 } 4194 data.recycle(); 4195 reply.recycle(); 4196 return cph; 4197 } publishContentProviders(IApplicationThread caller, List<ContentProviderHolder> providers)4198 public void publishContentProviders(IApplicationThread caller, 4199 List<ContentProviderHolder> providers) throws RemoteException 4200 { 4201 Parcel data = Parcel.obtain(); 4202 Parcel reply = Parcel.obtain(); 4203 data.writeInterfaceToken(IActivityManager.descriptor); 4204 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 4205 data.writeTypedList(providers); 4206 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0); 4207 reply.readException(); 4208 data.recycle(); 4209 reply.recycle(); 4210 } refContentProvider(IBinder connection, int stable, int unstable)4211 public boolean refContentProvider(IBinder connection, int stable, int unstable) 4212 throws RemoteException { 4213 Parcel data = Parcel.obtain(); 4214 Parcel reply = Parcel.obtain(); 4215 data.writeInterfaceToken(IActivityManager.descriptor); 4216 data.writeStrongBinder(connection); 4217 data.writeInt(stable); 4218 data.writeInt(unstable); 4219 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 4220 reply.readException(); 4221 boolean res = reply.readInt() != 0; 4222 data.recycle(); 4223 reply.recycle(); 4224 return res; 4225 } 4226 unstableProviderDied(IBinder connection)4227 public void unstableProviderDied(IBinder connection) throws RemoteException { 4228 Parcel data = Parcel.obtain(); 4229 Parcel reply = Parcel.obtain(); 4230 data.writeInterfaceToken(IActivityManager.descriptor); 4231 data.writeStrongBinder(connection); 4232 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0); 4233 reply.readException(); 4234 data.recycle(); 4235 reply.recycle(); 4236 } 4237 4238 @Override appNotRespondingViaProvider(IBinder connection)4239 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException { 4240 Parcel data = Parcel.obtain(); 4241 Parcel reply = Parcel.obtain(); 4242 data.writeInterfaceToken(IActivityManager.descriptor); 4243 data.writeStrongBinder(connection); 4244 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0); 4245 reply.readException(); 4246 data.recycle(); 4247 reply.recycle(); 4248 } 4249 removeContentProvider(IBinder connection, boolean stable)4250 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException { 4251 Parcel data = Parcel.obtain(); 4252 Parcel reply = Parcel.obtain(); 4253 data.writeInterfaceToken(IActivityManager.descriptor); 4254 data.writeStrongBinder(connection); 4255 data.writeInt(stable ? 1 : 0); 4256 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0); 4257 reply.readException(); 4258 data.recycle(); 4259 reply.recycle(); 4260 } 4261 removeContentProviderExternal(String name, IBinder token)4262 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException { 4263 Parcel data = Parcel.obtain(); 4264 Parcel reply = Parcel.obtain(); 4265 data.writeInterfaceToken(IActivityManager.descriptor); 4266 data.writeString(name); 4267 data.writeStrongBinder(token); 4268 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0); 4269 reply.readException(); 4270 data.recycle(); 4271 reply.recycle(); 4272 } 4273 getRunningServiceControlPanel(ComponentName service)4274 public PendingIntent getRunningServiceControlPanel(ComponentName service) 4275 throws RemoteException 4276 { 4277 Parcel data = Parcel.obtain(); 4278 Parcel reply = Parcel.obtain(); 4279 data.writeInterfaceToken(IActivityManager.descriptor); 4280 service.writeToParcel(data, 0); 4281 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0); 4282 reply.readException(); 4283 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply); 4284 data.recycle(); 4285 reply.recycle(); 4286 return res; 4287 } 4288 startService(IApplicationThread caller, Intent service, String resolvedType, String callingPackage, int userId)4289 public ComponentName startService(IApplicationThread caller, Intent service, 4290 String resolvedType, String callingPackage, int userId) throws RemoteException 4291 { 4292 Parcel data = Parcel.obtain(); 4293 Parcel reply = Parcel.obtain(); 4294 data.writeInterfaceToken(IActivityManager.descriptor); 4295 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 4296 service.writeToParcel(data, 0); 4297 data.writeString(resolvedType); 4298 data.writeString(callingPackage); 4299 data.writeInt(userId); 4300 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0); 4301 reply.readException(); 4302 ComponentName res = ComponentName.readFromParcel(reply); 4303 data.recycle(); 4304 reply.recycle(); 4305 return res; 4306 } stopService(IApplicationThread caller, Intent service, String resolvedType, int userId)4307 public int stopService(IApplicationThread caller, Intent service, 4308 String resolvedType, int userId) throws RemoteException 4309 { 4310 Parcel data = Parcel.obtain(); 4311 Parcel reply = Parcel.obtain(); 4312 data.writeInterfaceToken(IActivityManager.descriptor); 4313 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 4314 service.writeToParcel(data, 0); 4315 data.writeString(resolvedType); 4316 data.writeInt(userId); 4317 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0); 4318 reply.readException(); 4319 int res = reply.readInt(); 4320 reply.recycle(); 4321 data.recycle(); 4322 return res; 4323 } stopServiceToken(ComponentName className, IBinder token, int startId)4324 public boolean stopServiceToken(ComponentName className, IBinder token, 4325 int startId) throws RemoteException { 4326 Parcel data = Parcel.obtain(); 4327 Parcel reply = Parcel.obtain(); 4328 data.writeInterfaceToken(IActivityManager.descriptor); 4329 ComponentName.writeToParcel(className, data); 4330 data.writeStrongBinder(token); 4331 data.writeInt(startId); 4332 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0); 4333 reply.readException(); 4334 boolean res = reply.readInt() != 0; 4335 data.recycle(); 4336 reply.recycle(); 4337 return res; 4338 } setServiceForeground(ComponentName className, IBinder token, int id, Notification notification, int flags)4339 public void setServiceForeground(ComponentName className, IBinder token, 4340 int id, Notification notification, int flags) throws RemoteException { 4341 Parcel data = Parcel.obtain(); 4342 Parcel reply = Parcel.obtain(); 4343 data.writeInterfaceToken(IActivityManager.descriptor); 4344 ComponentName.writeToParcel(className, data); 4345 data.writeStrongBinder(token); 4346 data.writeInt(id); 4347 if (notification != null) { 4348 data.writeInt(1); 4349 notification.writeToParcel(data, 0); 4350 } else { 4351 data.writeInt(0); 4352 } 4353 data.writeInt(flags); 4354 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0); 4355 reply.readException(); 4356 data.recycle(); 4357 reply.recycle(); 4358 } bindService(IApplicationThread caller, IBinder token, Intent service, String resolvedType, IServiceConnection connection, int flags, String callingPackage, int userId)4359 public int bindService(IApplicationThread caller, IBinder token, 4360 Intent service, String resolvedType, IServiceConnection connection, 4361 int flags, String callingPackage, int userId) throws RemoteException { 4362 Parcel data = Parcel.obtain(); 4363 Parcel reply = Parcel.obtain(); 4364 data.writeInterfaceToken(IActivityManager.descriptor); 4365 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 4366 data.writeStrongBinder(token); 4367 service.writeToParcel(data, 0); 4368 data.writeString(resolvedType); 4369 data.writeStrongBinder(connection.asBinder()); 4370 data.writeInt(flags); 4371 data.writeString(callingPackage); 4372 data.writeInt(userId); 4373 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0); 4374 reply.readException(); 4375 int res = reply.readInt(); 4376 data.recycle(); 4377 reply.recycle(); 4378 return res; 4379 } unbindService(IServiceConnection connection)4380 public boolean unbindService(IServiceConnection connection) throws RemoteException 4381 { 4382 Parcel data = Parcel.obtain(); 4383 Parcel reply = Parcel.obtain(); 4384 data.writeInterfaceToken(IActivityManager.descriptor); 4385 data.writeStrongBinder(connection.asBinder()); 4386 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0); 4387 reply.readException(); 4388 boolean res = reply.readInt() != 0; 4389 data.recycle(); 4390 reply.recycle(); 4391 return res; 4392 } 4393 publishService(IBinder token, Intent intent, IBinder service)4394 public void publishService(IBinder token, 4395 Intent intent, IBinder service) throws RemoteException { 4396 Parcel data = Parcel.obtain(); 4397 Parcel reply = Parcel.obtain(); 4398 data.writeInterfaceToken(IActivityManager.descriptor); 4399 data.writeStrongBinder(token); 4400 intent.writeToParcel(data, 0); 4401 data.writeStrongBinder(service); 4402 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0); 4403 reply.readException(); 4404 data.recycle(); 4405 reply.recycle(); 4406 } 4407 unbindFinished(IBinder token, Intent intent, boolean doRebind)4408 public void unbindFinished(IBinder token, Intent intent, boolean doRebind) 4409 throws RemoteException { 4410 Parcel data = Parcel.obtain(); 4411 Parcel reply = Parcel.obtain(); 4412 data.writeInterfaceToken(IActivityManager.descriptor); 4413 data.writeStrongBinder(token); 4414 intent.writeToParcel(data, 0); 4415 data.writeInt(doRebind ? 1 : 0); 4416 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0); 4417 reply.readException(); 4418 data.recycle(); 4419 reply.recycle(); 4420 } 4421 serviceDoneExecuting(IBinder token, int type, int startId, int res)4422 public void serviceDoneExecuting(IBinder token, int type, int startId, 4423 int res) throws RemoteException { 4424 Parcel data = Parcel.obtain(); 4425 Parcel reply = Parcel.obtain(); 4426 data.writeInterfaceToken(IActivityManager.descriptor); 4427 data.writeStrongBinder(token); 4428 data.writeInt(type); 4429 data.writeInt(startId); 4430 data.writeInt(res); 4431 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); 4432 reply.readException(); 4433 data.recycle(); 4434 reply.recycle(); 4435 } 4436 peekService(Intent service, String resolvedType, String callingPackage)4437 public IBinder peekService(Intent service, String resolvedType, String callingPackage) 4438 throws RemoteException { 4439 Parcel data = Parcel.obtain(); 4440 Parcel reply = Parcel.obtain(); 4441 data.writeInterfaceToken(IActivityManager.descriptor); 4442 service.writeToParcel(data, 0); 4443 data.writeString(resolvedType); 4444 data.writeString(callingPackage); 4445 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0); 4446 reply.readException(); 4447 IBinder binder = reply.readStrongBinder(); 4448 reply.recycle(); 4449 data.recycle(); 4450 return binder; 4451 } 4452 bindBackupAgent(String packageName, int backupRestoreMode, int userId)4453 public boolean bindBackupAgent(String packageName, int backupRestoreMode, int userId) 4454 throws RemoteException { 4455 Parcel data = Parcel.obtain(); 4456 Parcel reply = Parcel.obtain(); 4457 data.writeInterfaceToken(IActivityManager.descriptor); 4458 data.writeString(packageName); 4459 data.writeInt(backupRestoreMode); 4460 data.writeInt(userId); 4461 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0); 4462 reply.readException(); 4463 boolean success = reply.readInt() != 0; 4464 reply.recycle(); 4465 data.recycle(); 4466 return success; 4467 } 4468 clearPendingBackup()4469 public void clearPendingBackup() throws RemoteException { 4470 Parcel data = Parcel.obtain(); 4471 Parcel reply = Parcel.obtain(); 4472 data.writeInterfaceToken(IActivityManager.descriptor); 4473 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0); 4474 reply.recycle(); 4475 data.recycle(); 4476 } 4477 backupAgentCreated(String packageName, IBinder agent)4478 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException { 4479 Parcel data = Parcel.obtain(); 4480 Parcel reply = Parcel.obtain(); 4481 data.writeInterfaceToken(IActivityManager.descriptor); 4482 data.writeString(packageName); 4483 data.writeStrongBinder(agent); 4484 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0); 4485 reply.recycle(); 4486 data.recycle(); 4487 } 4488 unbindBackupAgent(ApplicationInfo app)4489 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException { 4490 Parcel data = Parcel.obtain(); 4491 Parcel reply = Parcel.obtain(); 4492 data.writeInterfaceToken(IActivityManager.descriptor); 4493 app.writeToParcel(data, 0); 4494 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0); 4495 reply.readException(); 4496 reply.recycle(); 4497 data.recycle(); 4498 } 4499 startInstrumentation(ComponentName className, String profileFile, int flags, Bundle arguments, IInstrumentationWatcher watcher, IUiAutomationConnection connection, int userId, String instructionSet)4500 public boolean startInstrumentation(ComponentName className, String profileFile, 4501 int flags, Bundle arguments, IInstrumentationWatcher watcher, 4502 IUiAutomationConnection connection, int userId, String instructionSet) 4503 throws RemoteException { 4504 Parcel data = Parcel.obtain(); 4505 Parcel reply = Parcel.obtain(); 4506 data.writeInterfaceToken(IActivityManager.descriptor); 4507 ComponentName.writeToParcel(className, data); 4508 data.writeString(profileFile); 4509 data.writeInt(flags); 4510 data.writeBundle(arguments); 4511 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); 4512 data.writeStrongBinder(connection != null ? connection.asBinder() : null); 4513 data.writeInt(userId); 4514 data.writeString(instructionSet); 4515 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0); 4516 reply.readException(); 4517 boolean res = reply.readInt() != 0; 4518 reply.recycle(); 4519 data.recycle(); 4520 return res; 4521 } 4522 finishInstrumentation(IApplicationThread target, int resultCode, Bundle results)4523 public void finishInstrumentation(IApplicationThread target, 4524 int resultCode, Bundle results) throws RemoteException { 4525 Parcel data = Parcel.obtain(); 4526 Parcel reply = Parcel.obtain(); 4527 data.writeInterfaceToken(IActivityManager.descriptor); 4528 data.writeStrongBinder(target != null ? target.asBinder() : null); 4529 data.writeInt(resultCode); 4530 data.writeBundle(results); 4531 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0); 4532 reply.readException(); 4533 data.recycle(); 4534 reply.recycle(); 4535 } getConfiguration()4536 public Configuration getConfiguration() throws RemoteException 4537 { 4538 Parcel data = Parcel.obtain(); 4539 Parcel reply = Parcel.obtain(); 4540 data.writeInterfaceToken(IActivityManager.descriptor); 4541 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0); 4542 reply.readException(); 4543 Configuration res = Configuration.CREATOR.createFromParcel(reply); 4544 reply.recycle(); 4545 data.recycle(); 4546 return res; 4547 } updateConfiguration(Configuration values)4548 public void updateConfiguration(Configuration values) throws RemoteException 4549 { 4550 Parcel data = Parcel.obtain(); 4551 Parcel reply = Parcel.obtain(); 4552 data.writeInterfaceToken(IActivityManager.descriptor); 4553 values.writeToParcel(data, 0); 4554 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0); 4555 reply.readException(); 4556 data.recycle(); 4557 reply.recycle(); 4558 } setRequestedOrientation(IBinder token, int requestedOrientation)4559 public void setRequestedOrientation(IBinder token, int requestedOrientation) 4560 throws RemoteException { 4561 Parcel data = Parcel.obtain(); 4562 Parcel reply = Parcel.obtain(); 4563 data.writeInterfaceToken(IActivityManager.descriptor); 4564 data.writeStrongBinder(token); 4565 data.writeInt(requestedOrientation); 4566 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); 4567 reply.readException(); 4568 data.recycle(); 4569 reply.recycle(); 4570 } getRequestedOrientation(IBinder token)4571 public int getRequestedOrientation(IBinder token) throws RemoteException { 4572 Parcel data = Parcel.obtain(); 4573 Parcel reply = Parcel.obtain(); 4574 data.writeInterfaceToken(IActivityManager.descriptor); 4575 data.writeStrongBinder(token); 4576 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0); 4577 reply.readException(); 4578 int res = reply.readInt(); 4579 data.recycle(); 4580 reply.recycle(); 4581 return res; 4582 } getActivityClassForToken(IBinder token)4583 public ComponentName getActivityClassForToken(IBinder token) 4584 throws RemoteException { 4585 Parcel data = Parcel.obtain(); 4586 Parcel reply = Parcel.obtain(); 4587 data.writeInterfaceToken(IActivityManager.descriptor); 4588 data.writeStrongBinder(token); 4589 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0); 4590 reply.readException(); 4591 ComponentName res = ComponentName.readFromParcel(reply); 4592 data.recycle(); 4593 reply.recycle(); 4594 return res; 4595 } getPackageForToken(IBinder token)4596 public String getPackageForToken(IBinder token) throws RemoteException 4597 { 4598 Parcel data = Parcel.obtain(); 4599 Parcel reply = Parcel.obtain(); 4600 data.writeInterfaceToken(IActivityManager.descriptor); 4601 data.writeStrongBinder(token); 4602 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0); 4603 reply.readException(); 4604 String res = reply.readString(); 4605 data.recycle(); 4606 reply.recycle(); 4607 return res; 4608 } getIntentSender(int type, String packageName, IBinder token, String resultWho, int requestCode, Intent[] intents, String[] resolvedTypes, int flags, Bundle options, int userId)4609 public IIntentSender getIntentSender(int type, 4610 String packageName, IBinder token, String resultWho, 4611 int requestCode, Intent[] intents, String[] resolvedTypes, int flags, 4612 Bundle options, int userId) throws RemoteException { 4613 Parcel data = Parcel.obtain(); 4614 Parcel reply = Parcel.obtain(); 4615 data.writeInterfaceToken(IActivityManager.descriptor); 4616 data.writeInt(type); 4617 data.writeString(packageName); 4618 data.writeStrongBinder(token); 4619 data.writeString(resultWho); 4620 data.writeInt(requestCode); 4621 if (intents != null) { 4622 data.writeInt(1); 4623 data.writeTypedArray(intents, 0); 4624 data.writeStringArray(resolvedTypes); 4625 } else { 4626 data.writeInt(0); 4627 } 4628 data.writeInt(flags); 4629 if (options != null) { 4630 data.writeInt(1); 4631 options.writeToParcel(data, 0); 4632 } else { 4633 data.writeInt(0); 4634 } 4635 data.writeInt(userId); 4636 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0); 4637 reply.readException(); 4638 IIntentSender res = IIntentSender.Stub.asInterface( 4639 reply.readStrongBinder()); 4640 data.recycle(); 4641 reply.recycle(); 4642 return res; 4643 } cancelIntentSender(IIntentSender sender)4644 public void cancelIntentSender(IIntentSender sender) throws RemoteException { 4645 Parcel data = Parcel.obtain(); 4646 Parcel reply = Parcel.obtain(); 4647 data.writeInterfaceToken(IActivityManager.descriptor); 4648 data.writeStrongBinder(sender.asBinder()); 4649 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0); 4650 reply.readException(); 4651 data.recycle(); 4652 reply.recycle(); 4653 } getPackageForIntentSender(IIntentSender sender)4654 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException { 4655 Parcel data = Parcel.obtain(); 4656 Parcel reply = Parcel.obtain(); 4657 data.writeInterfaceToken(IActivityManager.descriptor); 4658 data.writeStrongBinder(sender.asBinder()); 4659 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 4660 reply.readException(); 4661 String res = reply.readString(); 4662 data.recycle(); 4663 reply.recycle(); 4664 return res; 4665 } getUidForIntentSender(IIntentSender sender)4666 public int getUidForIntentSender(IIntentSender sender) throws RemoteException { 4667 Parcel data = Parcel.obtain(); 4668 Parcel reply = Parcel.obtain(); 4669 data.writeInterfaceToken(IActivityManager.descriptor); 4670 data.writeStrongBinder(sender.asBinder()); 4671 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 4672 reply.readException(); 4673 int res = reply.readInt(); 4674 data.recycle(); 4675 reply.recycle(); 4676 return res; 4677 } handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, boolean requireFull, String name, String callerPackage)4678 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll, 4679 boolean requireFull, String name, String callerPackage) throws RemoteException { 4680 Parcel data = Parcel.obtain(); 4681 Parcel reply = Parcel.obtain(); 4682 data.writeInterfaceToken(IActivityManager.descriptor); 4683 data.writeInt(callingPid); 4684 data.writeInt(callingUid); 4685 data.writeInt(userId); 4686 data.writeInt(allowAll ? 1 : 0); 4687 data.writeInt(requireFull ? 1 : 0); 4688 data.writeString(name); 4689 data.writeString(callerPackage); 4690 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0); 4691 reply.readException(); 4692 int res = reply.readInt(); 4693 data.recycle(); 4694 reply.recycle(); 4695 return res; 4696 } setProcessLimit(int max)4697 public void setProcessLimit(int max) throws RemoteException 4698 { 4699 Parcel data = Parcel.obtain(); 4700 Parcel reply = Parcel.obtain(); 4701 data.writeInterfaceToken(IActivityManager.descriptor); 4702 data.writeInt(max); 4703 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); 4704 reply.readException(); 4705 data.recycle(); 4706 reply.recycle(); 4707 } getProcessLimit()4708 public int getProcessLimit() throws RemoteException 4709 { 4710 Parcel data = Parcel.obtain(); 4711 Parcel reply = Parcel.obtain(); 4712 data.writeInterfaceToken(IActivityManager.descriptor); 4713 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0); 4714 reply.readException(); 4715 int res = reply.readInt(); 4716 data.recycle(); 4717 reply.recycle(); 4718 return res; 4719 } setProcessForeground(IBinder token, int pid, boolean isForeground)4720 public void setProcessForeground(IBinder token, int pid, 4721 boolean isForeground) throws RemoteException { 4722 Parcel data = Parcel.obtain(); 4723 Parcel reply = Parcel.obtain(); 4724 data.writeInterfaceToken(IActivityManager.descriptor); 4725 data.writeStrongBinder(token); 4726 data.writeInt(pid); 4727 data.writeInt(isForeground ? 1 : 0); 4728 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0); 4729 reply.readException(); 4730 data.recycle(); 4731 reply.recycle(); 4732 } checkPermission(String permission, int pid, int uid)4733 public int checkPermission(String permission, int pid, int uid) 4734 throws RemoteException { 4735 Parcel data = Parcel.obtain(); 4736 Parcel reply = Parcel.obtain(); 4737 data.writeInterfaceToken(IActivityManager.descriptor); 4738 data.writeString(permission); 4739 data.writeInt(pid); 4740 data.writeInt(uid); 4741 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0); 4742 reply.readException(); 4743 int res = reply.readInt(); 4744 data.recycle(); 4745 reply.recycle(); 4746 return res; 4747 } checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken)4748 public int checkPermissionWithToken(String permission, int pid, int uid, IBinder callerToken) 4749 throws RemoteException { 4750 Parcel data = Parcel.obtain(); 4751 Parcel reply = Parcel.obtain(); 4752 data.writeInterfaceToken(IActivityManager.descriptor); 4753 data.writeString(permission); 4754 data.writeInt(pid); 4755 data.writeInt(uid); 4756 data.writeStrongBinder(callerToken); 4757 mRemote.transact(CHECK_PERMISSION_WITH_TOKEN_TRANSACTION, data, reply, 0); 4758 reply.readException(); 4759 int res = reply.readInt(); 4760 data.recycle(); 4761 reply.recycle(); 4762 return res; 4763 } clearApplicationUserData(final String packageName, final IPackageDataObserver observer, final int userId)4764 public boolean clearApplicationUserData(final String packageName, 4765 final IPackageDataObserver observer, final int userId) throws RemoteException { 4766 Parcel data = Parcel.obtain(); 4767 Parcel reply = Parcel.obtain(); 4768 data.writeInterfaceToken(IActivityManager.descriptor); 4769 data.writeString(packageName); 4770 data.writeStrongBinder((observer != null) ? observer.asBinder() : null); 4771 data.writeInt(userId); 4772 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0); 4773 reply.readException(); 4774 boolean res = reply.readInt() != 0; 4775 data.recycle(); 4776 reply.recycle(); 4777 return res; 4778 } checkUriPermission(Uri uri, int pid, int uid, int mode, int userId, IBinder callerToken)4779 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId, 4780 IBinder callerToken) throws RemoteException { 4781 Parcel data = Parcel.obtain(); 4782 Parcel reply = Parcel.obtain(); 4783 data.writeInterfaceToken(IActivityManager.descriptor); 4784 uri.writeToParcel(data, 0); 4785 data.writeInt(pid); 4786 data.writeInt(uid); 4787 data.writeInt(mode); 4788 data.writeInt(userId); 4789 data.writeStrongBinder(callerToken); 4790 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0); 4791 reply.readException(); 4792 int res = reply.readInt(); 4793 data.recycle(); 4794 reply.recycle(); 4795 return res; 4796 } grantUriPermission(IApplicationThread caller, String targetPkg, Uri uri, int mode, int userId)4797 public void grantUriPermission(IApplicationThread caller, String targetPkg, 4798 Uri uri, int mode, int userId) throws RemoteException { 4799 Parcel data = Parcel.obtain(); 4800 Parcel reply = Parcel.obtain(); 4801 data.writeInterfaceToken(IActivityManager.descriptor); 4802 data.writeStrongBinder(caller.asBinder()); 4803 data.writeString(targetPkg); 4804 uri.writeToParcel(data, 0); 4805 data.writeInt(mode); 4806 data.writeInt(userId); 4807 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 4808 reply.readException(); 4809 data.recycle(); 4810 reply.recycle(); 4811 } revokeUriPermission(IApplicationThread caller, Uri uri, int mode, int userId)4812 public void revokeUriPermission(IApplicationThread caller, Uri uri, 4813 int mode, int userId) throws RemoteException { 4814 Parcel data = Parcel.obtain(); 4815 Parcel reply = Parcel.obtain(); 4816 data.writeInterfaceToken(IActivityManager.descriptor); 4817 data.writeStrongBinder(caller.asBinder()); 4818 uri.writeToParcel(data, 0); 4819 data.writeInt(mode); 4820 data.writeInt(userId); 4821 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); 4822 reply.readException(); 4823 data.recycle(); 4824 reply.recycle(); 4825 } 4826 4827 @Override takePersistableUriPermission(Uri uri, int mode, int userId)4828 public void takePersistableUriPermission(Uri uri, int mode, int userId) 4829 throws RemoteException { 4830 Parcel data = Parcel.obtain(); 4831 Parcel reply = Parcel.obtain(); 4832 data.writeInterfaceToken(IActivityManager.descriptor); 4833 uri.writeToParcel(data, 0); 4834 data.writeInt(mode); 4835 data.writeInt(userId); 4836 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0); 4837 reply.readException(); 4838 data.recycle(); 4839 reply.recycle(); 4840 } 4841 4842 @Override releasePersistableUriPermission(Uri uri, int mode, int userId)4843 public void releasePersistableUriPermission(Uri uri, int mode, int userId) 4844 throws RemoteException { 4845 Parcel data = Parcel.obtain(); 4846 Parcel reply = Parcel.obtain(); 4847 data.writeInterfaceToken(IActivityManager.descriptor); 4848 uri.writeToParcel(data, 0); 4849 data.writeInt(mode); 4850 data.writeInt(userId); 4851 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0); 4852 reply.readException(); 4853 data.recycle(); 4854 reply.recycle(); 4855 } 4856 4857 @Override getPersistedUriPermissions( String packageName, boolean incoming)4858 public ParceledListSlice<UriPermission> getPersistedUriPermissions( 4859 String packageName, boolean incoming) throws RemoteException { 4860 Parcel data = Parcel.obtain(); 4861 Parcel reply = Parcel.obtain(); 4862 data.writeInterfaceToken(IActivityManager.descriptor); 4863 data.writeString(packageName); 4864 data.writeInt(incoming ? 1 : 0); 4865 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0); 4866 reply.readException(); 4867 @SuppressWarnings("unchecked") 4868 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel( 4869 reply); 4870 data.recycle(); 4871 reply.recycle(); 4872 return perms; 4873 } 4874 4875 @Override getGrantedUriPermissions(String packageName, int userId)4876 public ParceledListSlice<UriPermission> getGrantedUriPermissions(String packageName, int userId) 4877 throws RemoteException { 4878 Parcel data = Parcel.obtain(); 4879 Parcel reply = Parcel.obtain(); 4880 data.writeInterfaceToken(IActivityManager.descriptor); 4881 data.writeString(packageName); 4882 data.writeInt(userId); 4883 mRemote.transact(GET_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0); 4884 reply.readException(); 4885 @SuppressWarnings("unchecked") 4886 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel( 4887 reply); 4888 data.recycle(); 4889 reply.recycle(); 4890 return perms; 4891 } 4892 4893 @Override clearGrantedUriPermissions(String packageName, int userId)4894 public void clearGrantedUriPermissions(String packageName, int userId) throws RemoteException { 4895 Parcel data = Parcel.obtain(); 4896 Parcel reply = Parcel.obtain(); 4897 data.writeInterfaceToken(IActivityManager.descriptor); 4898 data.writeString(packageName); 4899 data.writeInt(userId); 4900 mRemote.transact(CLEAR_GRANTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0); 4901 reply.readException(); 4902 data.recycle(); 4903 reply.recycle(); 4904 } 4905 showWaitingForDebugger(IApplicationThread who, boolean waiting)4906 public void showWaitingForDebugger(IApplicationThread who, boolean waiting) 4907 throws RemoteException { 4908 Parcel data = Parcel.obtain(); 4909 Parcel reply = Parcel.obtain(); 4910 data.writeInterfaceToken(IActivityManager.descriptor); 4911 data.writeStrongBinder(who.asBinder()); 4912 data.writeInt(waiting ? 1 : 0); 4913 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0); 4914 reply.readException(); 4915 data.recycle(); 4916 reply.recycle(); 4917 } getMemoryInfo(ActivityManager.MemoryInfo outInfo)4918 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException { 4919 Parcel data = Parcel.obtain(); 4920 Parcel reply = Parcel.obtain(); 4921 data.writeInterfaceToken(IActivityManager.descriptor); 4922 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0); 4923 reply.readException(); 4924 outInfo.readFromParcel(reply); 4925 data.recycle(); 4926 reply.recycle(); 4927 } unhandledBack()4928 public void unhandledBack() throws RemoteException 4929 { 4930 Parcel data = Parcel.obtain(); 4931 Parcel reply = Parcel.obtain(); 4932 data.writeInterfaceToken(IActivityManager.descriptor); 4933 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0); 4934 reply.readException(); 4935 data.recycle(); 4936 reply.recycle(); 4937 } openContentUri(Uri uri)4938 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException 4939 { 4940 Parcel data = Parcel.obtain(); 4941 Parcel reply = Parcel.obtain(); 4942 data.writeInterfaceToken(IActivityManager.descriptor); 4943 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0); 4944 reply.readException(); 4945 ParcelFileDescriptor pfd = null; 4946 if (reply.readInt() != 0) { 4947 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply); 4948 } 4949 data.recycle(); 4950 reply.recycle(); 4951 return pfd; 4952 } setLockScreenShown(boolean showing, boolean occluded)4953 public void setLockScreenShown(boolean showing, boolean occluded) throws RemoteException 4954 { 4955 Parcel data = Parcel.obtain(); 4956 Parcel reply = Parcel.obtain(); 4957 data.writeInterfaceToken(IActivityManager.descriptor); 4958 data.writeInt(showing ? 1 : 0); 4959 data.writeInt(occluded ? 1 : 0); 4960 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0); 4961 reply.readException(); 4962 data.recycle(); 4963 reply.recycle(); 4964 } setDebugApp( String packageName, boolean waitForDebugger, boolean persistent)4965 public void setDebugApp( 4966 String packageName, boolean waitForDebugger, boolean persistent) 4967 throws RemoteException 4968 { 4969 Parcel data = Parcel.obtain(); 4970 Parcel reply = Parcel.obtain(); 4971 data.writeInterfaceToken(IActivityManager.descriptor); 4972 data.writeString(packageName); 4973 data.writeInt(waitForDebugger ? 1 : 0); 4974 data.writeInt(persistent ? 1 : 0); 4975 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0); 4976 reply.readException(); 4977 data.recycle(); 4978 reply.recycle(); 4979 } setAlwaysFinish(boolean enabled)4980 public void setAlwaysFinish(boolean enabled) throws RemoteException 4981 { 4982 Parcel data = Parcel.obtain(); 4983 Parcel reply = Parcel.obtain(); 4984 data.writeInterfaceToken(IActivityManager.descriptor); 4985 data.writeInt(enabled ? 1 : 0); 4986 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0); 4987 reply.readException(); 4988 data.recycle(); 4989 reply.recycle(); 4990 } setActivityController(IActivityController watcher, boolean imAMonkey)4991 public void setActivityController(IActivityController watcher, boolean imAMonkey) 4992 throws RemoteException 4993 { 4994 Parcel data = Parcel.obtain(); 4995 Parcel reply = Parcel.obtain(); 4996 data.writeInterfaceToken(IActivityManager.descriptor); 4997 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null); 4998 data.writeInt(imAMonkey ? 1 : 0); 4999 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0); 5000 reply.readException(); 5001 data.recycle(); 5002 reply.recycle(); 5003 } setLenientBackgroundCheck(boolean enabled)5004 public void setLenientBackgroundCheck(boolean enabled) throws RemoteException 5005 { 5006 Parcel data = Parcel.obtain(); 5007 Parcel reply = Parcel.obtain(); 5008 data.writeInterfaceToken(IActivityManager.descriptor); 5009 data.writeInt(enabled ? 1 : 0); 5010 mRemote.transact(SET_LENIENT_BACKGROUND_CHECK_TRANSACTION, data, reply, 0); 5011 reply.readException(); 5012 data.recycle(); 5013 reply.recycle(); 5014 } getMemoryTrimLevel()5015 public int getMemoryTrimLevel() throws RemoteException 5016 { 5017 Parcel data = Parcel.obtain(); 5018 Parcel reply = Parcel.obtain(); 5019 data.writeInterfaceToken(IActivityManager.descriptor); 5020 mRemote.transact(GET_MEMORY_TRIM_LEVEL_TRANSACTION, data, reply, 0); 5021 reply.readException(); 5022 int level = reply.readInt(); 5023 data.recycle(); 5024 reply.recycle(); 5025 return level; 5026 } enterSafeMode()5027 public void enterSafeMode() throws RemoteException { 5028 Parcel data = Parcel.obtain(); 5029 data.writeInterfaceToken(IActivityManager.descriptor); 5030 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0); 5031 data.recycle(); 5032 } noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag)5033 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg, String tag) 5034 throws RemoteException { 5035 Parcel data = Parcel.obtain(); 5036 data.writeInterfaceToken(IActivityManager.descriptor); 5037 data.writeStrongBinder(sender.asBinder()); 5038 data.writeInt(sourceUid); 5039 data.writeString(sourcePkg); 5040 data.writeString(tag); 5041 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0); 5042 data.recycle(); 5043 } noteAlarmStart(IIntentSender sender, int sourceUid, String tag)5044 public void noteAlarmStart(IIntentSender sender, int sourceUid, String tag) 5045 throws RemoteException { 5046 Parcel data = Parcel.obtain(); 5047 data.writeInterfaceToken(IActivityManager.descriptor); 5048 data.writeStrongBinder(sender.asBinder()); 5049 data.writeInt(sourceUid); 5050 data.writeString(tag); 5051 mRemote.transact(NOTE_ALARM_START_TRANSACTION, data, null, 0); 5052 data.recycle(); 5053 } noteAlarmFinish(IIntentSender sender, int sourceUid, String tag)5054 public void noteAlarmFinish(IIntentSender sender, int sourceUid, String tag) 5055 throws RemoteException { 5056 Parcel data = Parcel.obtain(); 5057 data.writeInterfaceToken(IActivityManager.descriptor); 5058 data.writeStrongBinder(sender.asBinder()); 5059 data.writeInt(sourceUid); 5060 data.writeString(tag); 5061 mRemote.transact(NOTE_ALARM_FINISH_TRANSACTION, data, null, 0); 5062 data.recycle(); 5063 } killPids(int[] pids, String reason, boolean secure)5064 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException { 5065 Parcel data = Parcel.obtain(); 5066 Parcel reply = Parcel.obtain(); 5067 data.writeInterfaceToken(IActivityManager.descriptor); 5068 data.writeIntArray(pids); 5069 data.writeString(reason); 5070 data.writeInt(secure ? 1 : 0); 5071 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0); 5072 reply.readException(); 5073 boolean res = reply.readInt() != 0; 5074 data.recycle(); 5075 reply.recycle(); 5076 return res; 5077 } 5078 @Override killProcessesBelowForeground(String reason)5079 public boolean killProcessesBelowForeground(String reason) throws RemoteException { 5080 Parcel data = Parcel.obtain(); 5081 Parcel reply = Parcel.obtain(); 5082 data.writeInterfaceToken(IActivityManager.descriptor); 5083 data.writeString(reason); 5084 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0); 5085 boolean res = reply.readInt() != 0; 5086 data.recycle(); 5087 reply.recycle(); 5088 return res; 5089 } testIsSystemReady()5090 public boolean testIsSystemReady() 5091 { 5092 /* this base class version is never called */ 5093 return true; 5094 } handleApplicationCrash(IBinder app, ApplicationErrorReport.CrashInfo crashInfo)5095 public void handleApplicationCrash(IBinder app, 5096 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException 5097 { 5098 Parcel data = Parcel.obtain(); 5099 Parcel reply = Parcel.obtain(); 5100 data.writeInterfaceToken(IActivityManager.descriptor); 5101 data.writeStrongBinder(app); 5102 crashInfo.writeToParcel(data, 0); 5103 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0); 5104 reply.readException(); 5105 reply.recycle(); 5106 data.recycle(); 5107 } 5108 handleApplicationWtf(IBinder app, String tag, boolean system, ApplicationErrorReport.CrashInfo crashInfo)5109 public boolean handleApplicationWtf(IBinder app, String tag, boolean system, 5110 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException 5111 { 5112 Parcel data = Parcel.obtain(); 5113 Parcel reply = Parcel.obtain(); 5114 data.writeInterfaceToken(IActivityManager.descriptor); 5115 data.writeStrongBinder(app); 5116 data.writeString(tag); 5117 data.writeInt(system ? 1 : 0); 5118 crashInfo.writeToParcel(data, 0); 5119 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0); 5120 reply.readException(); 5121 boolean res = reply.readInt() != 0; 5122 reply.recycle(); 5123 data.recycle(); 5124 return res; 5125 } 5126 handleApplicationStrictModeViolation(IBinder app, int violationMask, StrictMode.ViolationInfo info)5127 public void handleApplicationStrictModeViolation(IBinder app, 5128 int violationMask, 5129 StrictMode.ViolationInfo info) throws RemoteException 5130 { 5131 Parcel data = Parcel.obtain(); 5132 Parcel reply = Parcel.obtain(); 5133 data.writeInterfaceToken(IActivityManager.descriptor); 5134 data.writeStrongBinder(app); 5135 data.writeInt(violationMask); 5136 info.writeToParcel(data, 0); 5137 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0); 5138 reply.readException(); 5139 reply.recycle(); 5140 data.recycle(); 5141 } 5142 signalPersistentProcesses(int sig)5143 public void signalPersistentProcesses(int sig) throws RemoteException { 5144 Parcel data = Parcel.obtain(); 5145 Parcel reply = Parcel.obtain(); 5146 data.writeInterfaceToken(IActivityManager.descriptor); 5147 data.writeInt(sig); 5148 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0); 5149 reply.readException(); 5150 data.recycle(); 5151 reply.recycle(); 5152 } 5153 killBackgroundProcesses(String packageName, int userId)5154 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException { 5155 Parcel data = Parcel.obtain(); 5156 Parcel reply = Parcel.obtain(); 5157 data.writeInterfaceToken(IActivityManager.descriptor); 5158 data.writeString(packageName); 5159 data.writeInt(userId); 5160 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); 5161 reply.readException(); 5162 data.recycle(); 5163 reply.recycle(); 5164 } 5165 killAllBackgroundProcesses()5166 public void killAllBackgroundProcesses() throws RemoteException { 5167 Parcel data = Parcel.obtain(); 5168 Parcel reply = Parcel.obtain(); 5169 data.writeInterfaceToken(IActivityManager.descriptor); 5170 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0); 5171 reply.readException(); 5172 data.recycle(); 5173 reply.recycle(); 5174 } 5175 killPackageDependents(String packageName, int userId)5176 public void killPackageDependents(String packageName, int userId) throws RemoteException { 5177 Parcel data = Parcel.obtain(); 5178 Parcel reply = Parcel.obtain(); 5179 data.writeInterfaceToken(IActivityManager.descriptor); 5180 data.writeString(packageName); 5181 data.writeInt(userId); 5182 mRemote.transact(KILL_PACKAGE_DEPENDENTS_TRANSACTION, data, reply, 0); 5183 reply.readException(); 5184 data.recycle(); 5185 reply.recycle(); 5186 } 5187 forceStopPackage(String packageName, int userId)5188 public void forceStopPackage(String packageName, int userId) throws RemoteException { 5189 Parcel data = Parcel.obtain(); 5190 Parcel reply = Parcel.obtain(); 5191 data.writeInterfaceToken(IActivityManager.descriptor); 5192 data.writeString(packageName); 5193 data.writeInt(userId); 5194 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0); 5195 reply.readException(); 5196 data.recycle(); 5197 reply.recycle(); 5198 } 5199 getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)5200 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo) 5201 throws RemoteException 5202 { 5203 Parcel data = Parcel.obtain(); 5204 Parcel reply = Parcel.obtain(); 5205 data.writeInterfaceToken(IActivityManager.descriptor); 5206 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0); 5207 reply.readException(); 5208 outInfo.readFromParcel(reply); 5209 reply.recycle(); 5210 data.recycle(); 5211 } 5212 getDeviceConfigurationInfo()5213 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException 5214 { 5215 Parcel data = Parcel.obtain(); 5216 Parcel reply = Parcel.obtain(); 5217 data.writeInterfaceToken(IActivityManager.descriptor); 5218 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0); 5219 reply.readException(); 5220 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply); 5221 reply.recycle(); 5222 data.recycle(); 5223 return res; 5224 } 5225 profileControl(String process, int userId, boolean start, ProfilerInfo profilerInfo, int profileType)5226 public boolean profileControl(String process, int userId, boolean start, 5227 ProfilerInfo profilerInfo, int profileType) throws RemoteException 5228 { 5229 Parcel data = Parcel.obtain(); 5230 Parcel reply = Parcel.obtain(); 5231 data.writeInterfaceToken(IActivityManager.descriptor); 5232 data.writeString(process); 5233 data.writeInt(userId); 5234 data.writeInt(start ? 1 : 0); 5235 data.writeInt(profileType); 5236 if (profilerInfo != null) { 5237 data.writeInt(1); 5238 profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 5239 } else { 5240 data.writeInt(0); 5241 } 5242 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0); 5243 reply.readException(); 5244 boolean res = reply.readInt() != 0; 5245 reply.recycle(); 5246 data.recycle(); 5247 return res; 5248 } 5249 shutdown(int timeout)5250 public boolean shutdown(int timeout) throws RemoteException 5251 { 5252 Parcel data = Parcel.obtain(); 5253 Parcel reply = Parcel.obtain(); 5254 data.writeInterfaceToken(IActivityManager.descriptor); 5255 data.writeInt(timeout); 5256 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0); 5257 reply.readException(); 5258 boolean res = reply.readInt() != 0; 5259 reply.recycle(); 5260 data.recycle(); 5261 return res; 5262 } 5263 stopAppSwitches()5264 public void stopAppSwitches() throws RemoteException { 5265 Parcel data = Parcel.obtain(); 5266 Parcel reply = Parcel.obtain(); 5267 data.writeInterfaceToken(IActivityManager.descriptor); 5268 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0); 5269 reply.readException(); 5270 reply.recycle(); 5271 data.recycle(); 5272 } 5273 resumeAppSwitches()5274 public void resumeAppSwitches() throws RemoteException { 5275 Parcel data = Parcel.obtain(); 5276 Parcel reply = Parcel.obtain(); 5277 data.writeInterfaceToken(IActivityManager.descriptor); 5278 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0); 5279 reply.readException(); 5280 reply.recycle(); 5281 data.recycle(); 5282 } 5283 addPackageDependency(String packageName)5284 public void addPackageDependency(String packageName) throws RemoteException { 5285 Parcel data = Parcel.obtain(); 5286 Parcel reply = Parcel.obtain(); 5287 data.writeInterfaceToken(IActivityManager.descriptor); 5288 data.writeString(packageName); 5289 mRemote.transact(ADD_PACKAGE_DEPENDENCY_TRANSACTION, data, reply, 0); 5290 reply.readException(); 5291 data.recycle(); 5292 reply.recycle(); 5293 } 5294 killApplication(String pkg, int appId, int userId, String reason)5295 public void killApplication(String pkg, int appId, int userId, String reason) 5296 throws RemoteException { 5297 Parcel data = Parcel.obtain(); 5298 Parcel reply = Parcel.obtain(); 5299 data.writeInterfaceToken(IActivityManager.descriptor); 5300 data.writeString(pkg); 5301 data.writeInt(appId); 5302 data.writeInt(userId); 5303 data.writeString(reason); 5304 mRemote.transact(KILL_APPLICATION_TRANSACTION, data, reply, 0); 5305 reply.readException(); 5306 data.recycle(); 5307 reply.recycle(); 5308 } 5309 closeSystemDialogs(String reason)5310 public void closeSystemDialogs(String reason) throws RemoteException { 5311 Parcel data = Parcel.obtain(); 5312 Parcel reply = Parcel.obtain(); 5313 data.writeInterfaceToken(IActivityManager.descriptor); 5314 data.writeString(reason); 5315 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0); 5316 reply.readException(); 5317 data.recycle(); 5318 reply.recycle(); 5319 } 5320 getProcessMemoryInfo(int[] pids)5321 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids) 5322 throws RemoteException { 5323 Parcel data = Parcel.obtain(); 5324 Parcel reply = Parcel.obtain(); 5325 data.writeInterfaceToken(IActivityManager.descriptor); 5326 data.writeIntArray(pids); 5327 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0); 5328 reply.readException(); 5329 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR); 5330 data.recycle(); 5331 reply.recycle(); 5332 return res; 5333 } 5334 killApplicationProcess(String processName, int uid)5335 public void killApplicationProcess(String processName, int uid) throws RemoteException { 5336 Parcel data = Parcel.obtain(); 5337 Parcel reply = Parcel.obtain(); 5338 data.writeInterfaceToken(IActivityManager.descriptor); 5339 data.writeString(processName); 5340 data.writeInt(uid); 5341 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0); 5342 reply.readException(); 5343 data.recycle(); 5344 reply.recycle(); 5345 } 5346 overridePendingTransition(IBinder token, String packageName, int enterAnim, int exitAnim)5347 public void overridePendingTransition(IBinder token, String packageName, 5348 int enterAnim, int exitAnim) throws RemoteException { 5349 Parcel data = Parcel.obtain(); 5350 Parcel reply = Parcel.obtain(); 5351 data.writeInterfaceToken(IActivityManager.descriptor); 5352 data.writeStrongBinder(token); 5353 data.writeString(packageName); 5354 data.writeInt(enterAnim); 5355 data.writeInt(exitAnim); 5356 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0); 5357 reply.readException(); 5358 data.recycle(); 5359 reply.recycle(); 5360 } 5361 isUserAMonkey()5362 public boolean isUserAMonkey() throws RemoteException { 5363 Parcel data = Parcel.obtain(); 5364 Parcel reply = Parcel.obtain(); 5365 data.writeInterfaceToken(IActivityManager.descriptor); 5366 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0); 5367 reply.readException(); 5368 boolean res = reply.readInt() != 0; 5369 data.recycle(); 5370 reply.recycle(); 5371 return res; 5372 } 5373 setUserIsMonkey(boolean monkey)5374 public void setUserIsMonkey(boolean monkey) throws RemoteException { 5375 Parcel data = Parcel.obtain(); 5376 Parcel reply = Parcel.obtain(); 5377 data.writeInterfaceToken(IActivityManager.descriptor); 5378 data.writeInt(monkey ? 1 : 0); 5379 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0); 5380 reply.readException(); 5381 data.recycle(); 5382 reply.recycle(); 5383 } 5384 finishHeavyWeightApp()5385 public void finishHeavyWeightApp() throws RemoteException { 5386 Parcel data = Parcel.obtain(); 5387 Parcel reply = Parcel.obtain(); 5388 data.writeInterfaceToken(IActivityManager.descriptor); 5389 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0); 5390 reply.readException(); 5391 data.recycle(); 5392 reply.recycle(); 5393 } 5394 convertFromTranslucent(IBinder token)5395 public boolean convertFromTranslucent(IBinder token) 5396 throws RemoteException { 5397 Parcel data = Parcel.obtain(); 5398 Parcel reply = Parcel.obtain(); 5399 data.writeInterfaceToken(IActivityManager.descriptor); 5400 data.writeStrongBinder(token); 5401 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0); 5402 reply.readException(); 5403 boolean res = reply.readInt() != 0; 5404 data.recycle(); 5405 reply.recycle(); 5406 return res; 5407 } 5408 convertToTranslucent(IBinder token, ActivityOptions options)5409 public boolean convertToTranslucent(IBinder token, ActivityOptions options) 5410 throws RemoteException { 5411 Parcel data = Parcel.obtain(); 5412 Parcel reply = Parcel.obtain(); 5413 data.writeInterfaceToken(IActivityManager.descriptor); 5414 data.writeStrongBinder(token); 5415 if (options == null) { 5416 data.writeInt(0); 5417 } else { 5418 data.writeInt(1); 5419 data.writeBundle(options.toBundle()); 5420 } 5421 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0); 5422 reply.readException(); 5423 boolean res = reply.readInt() != 0; 5424 data.recycle(); 5425 reply.recycle(); 5426 return res; 5427 } 5428 getActivityOptions(IBinder token)5429 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException { 5430 Parcel data = Parcel.obtain(); 5431 Parcel reply = Parcel.obtain(); 5432 data.writeInterfaceToken(IActivityManager.descriptor); 5433 data.writeStrongBinder(token); 5434 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0); 5435 reply.readException(); 5436 ActivityOptions options = ActivityOptions.fromBundle(reply.readBundle()); 5437 data.recycle(); 5438 reply.recycle(); 5439 return options; 5440 } 5441 setImmersive(IBinder token, boolean immersive)5442 public void setImmersive(IBinder token, boolean immersive) 5443 throws RemoteException { 5444 Parcel data = Parcel.obtain(); 5445 Parcel reply = Parcel.obtain(); 5446 data.writeInterfaceToken(IActivityManager.descriptor); 5447 data.writeStrongBinder(token); 5448 data.writeInt(immersive ? 1 : 0); 5449 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0); 5450 reply.readException(); 5451 data.recycle(); 5452 reply.recycle(); 5453 } 5454 isImmersive(IBinder token)5455 public boolean isImmersive(IBinder token) 5456 throws RemoteException { 5457 Parcel data = Parcel.obtain(); 5458 Parcel reply = Parcel.obtain(); 5459 data.writeInterfaceToken(IActivityManager.descriptor); 5460 data.writeStrongBinder(token); 5461 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0); 5462 reply.readException(); 5463 boolean res = reply.readInt() == 1; 5464 data.recycle(); 5465 reply.recycle(); 5466 return res; 5467 } 5468 isTopOfTask(IBinder token)5469 public boolean isTopOfTask(IBinder token) throws RemoteException { 5470 Parcel data = Parcel.obtain(); 5471 Parcel reply = Parcel.obtain(); 5472 data.writeInterfaceToken(IActivityManager.descriptor); 5473 data.writeStrongBinder(token); 5474 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0); 5475 reply.readException(); 5476 boolean res = reply.readInt() == 1; 5477 data.recycle(); 5478 reply.recycle(); 5479 return res; 5480 } 5481 isTopActivityImmersive()5482 public boolean isTopActivityImmersive() 5483 throws RemoteException { 5484 Parcel data = Parcel.obtain(); 5485 Parcel reply = Parcel.obtain(); 5486 data.writeInterfaceToken(IActivityManager.descriptor); 5487 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0); 5488 reply.readException(); 5489 boolean res = reply.readInt() == 1; 5490 data.recycle(); 5491 reply.recycle(); 5492 return res; 5493 } 5494 crashApplication(int uid, int initialPid, String packageName, String message)5495 public void crashApplication(int uid, int initialPid, String packageName, 5496 String message) throws RemoteException { 5497 Parcel data = Parcel.obtain(); 5498 Parcel reply = Parcel.obtain(); 5499 data.writeInterfaceToken(IActivityManager.descriptor); 5500 data.writeInt(uid); 5501 data.writeInt(initialPid); 5502 data.writeString(packageName); 5503 data.writeString(message); 5504 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0); 5505 reply.readException(); 5506 data.recycle(); 5507 reply.recycle(); 5508 } 5509 getProviderMimeType(Uri uri, int userId)5510 public String getProviderMimeType(Uri uri, int userId) throws RemoteException { 5511 Parcel data = Parcel.obtain(); 5512 Parcel reply = Parcel.obtain(); 5513 data.writeInterfaceToken(IActivityManager.descriptor); 5514 uri.writeToParcel(data, 0); 5515 data.writeInt(userId); 5516 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0); 5517 reply.readException(); 5518 String res = reply.readString(); 5519 data.recycle(); 5520 reply.recycle(); 5521 return res; 5522 } 5523 newUriPermissionOwner(String name)5524 public IBinder newUriPermissionOwner(String name) 5525 throws RemoteException { 5526 Parcel data = Parcel.obtain(); 5527 Parcel reply = Parcel.obtain(); 5528 data.writeInterfaceToken(IActivityManager.descriptor); 5529 data.writeString(name); 5530 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0); 5531 reply.readException(); 5532 IBinder res = reply.readStrongBinder(); 5533 data.recycle(); 5534 reply.recycle(); 5535 return res; 5536 } 5537 getUriPermissionOwnerForActivity(IBinder activityToken)5538 public IBinder getUriPermissionOwnerForActivity(IBinder activityToken) throws RemoteException { 5539 Parcel data = Parcel.obtain(); 5540 Parcel reply = Parcel.obtain(); 5541 data.writeInterfaceToken(IActivityManager.descriptor); 5542 data.writeStrongBinder(activityToken); 5543 mRemote.transact(GET_URI_PERMISSION_OWNER_FOR_ACTIVITY_TRANSACTION, data, reply, 0); 5544 reply.readException(); 5545 IBinder res = reply.readStrongBinder(); 5546 data.recycle(); 5547 reply.recycle(); 5548 return res; 5549 } 5550 grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, Uri uri, int mode, int sourceUserId, int targetUserId)5551 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg, 5552 Uri uri, int mode, int sourceUserId, int targetUserId) throws RemoteException { 5553 Parcel data = Parcel.obtain(); 5554 Parcel reply = Parcel.obtain(); 5555 data.writeInterfaceToken(IActivityManager.descriptor); 5556 data.writeStrongBinder(owner); 5557 data.writeInt(fromUid); 5558 data.writeString(targetPkg); 5559 uri.writeToParcel(data, 0); 5560 data.writeInt(mode); 5561 data.writeInt(sourceUserId); 5562 data.writeInt(targetUserId); 5563 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 5564 reply.readException(); 5565 data.recycle(); 5566 reply.recycle(); 5567 } 5568 revokeUriPermissionFromOwner(IBinder owner, Uri uri, int mode, int userId)5569 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri, 5570 int mode, int userId) throws RemoteException { 5571 Parcel data = Parcel.obtain(); 5572 Parcel reply = Parcel.obtain(); 5573 data.writeInterfaceToken(IActivityManager.descriptor); 5574 data.writeStrongBinder(owner); 5575 if (uri != null) { 5576 data.writeInt(1); 5577 uri.writeToParcel(data, 0); 5578 } else { 5579 data.writeInt(0); 5580 } 5581 data.writeInt(mode); 5582 data.writeInt(userId); 5583 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0); 5584 reply.readException(); 5585 data.recycle(); 5586 reply.recycle(); 5587 } 5588 checkGrantUriPermission(int callingUid, String targetPkg, Uri uri, int modeFlags, int userId)5589 public int checkGrantUriPermission(int callingUid, String targetPkg, 5590 Uri uri, int modeFlags, int userId) throws RemoteException { 5591 Parcel data = Parcel.obtain(); 5592 Parcel reply = Parcel.obtain(); 5593 data.writeInterfaceToken(IActivityManager.descriptor); 5594 data.writeInt(callingUid); 5595 data.writeString(targetPkg); 5596 uri.writeToParcel(data, 0); 5597 data.writeInt(modeFlags); 5598 data.writeInt(userId); 5599 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0); 5600 reply.readException(); 5601 int res = reply.readInt(); 5602 data.recycle(); 5603 reply.recycle(); 5604 return res; 5605 } 5606 dumpHeap(String process, int userId, boolean managed, String path, ParcelFileDescriptor fd)5607 public boolean dumpHeap(String process, int userId, boolean managed, 5608 String path, ParcelFileDescriptor fd) throws RemoteException { 5609 Parcel data = Parcel.obtain(); 5610 Parcel reply = Parcel.obtain(); 5611 data.writeInterfaceToken(IActivityManager.descriptor); 5612 data.writeString(process); 5613 data.writeInt(userId); 5614 data.writeInt(managed ? 1 : 0); 5615 data.writeString(path); 5616 if (fd != null) { 5617 data.writeInt(1); 5618 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 5619 } else { 5620 data.writeInt(0); 5621 } 5622 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0); 5623 reply.readException(); 5624 boolean res = reply.readInt() != 0; 5625 reply.recycle(); 5626 data.recycle(); 5627 return res; 5628 } 5629 startActivities(IApplicationThread caller, String callingPackage, Intent[] intents, String[] resolvedTypes, IBinder resultTo, Bundle options, int userId)5630 public int startActivities(IApplicationThread caller, String callingPackage, 5631 Intent[] intents, String[] resolvedTypes, IBinder resultTo, 5632 Bundle options, int userId) throws RemoteException { 5633 Parcel data = Parcel.obtain(); 5634 Parcel reply = Parcel.obtain(); 5635 data.writeInterfaceToken(IActivityManager.descriptor); 5636 data.writeStrongBinder(caller != null ? caller.asBinder() : null); 5637 data.writeString(callingPackage); 5638 data.writeTypedArray(intents, 0); 5639 data.writeStringArray(resolvedTypes); 5640 data.writeStrongBinder(resultTo); 5641 if (options != null) { 5642 data.writeInt(1); 5643 options.writeToParcel(data, 0); 5644 } else { 5645 data.writeInt(0); 5646 } 5647 data.writeInt(userId); 5648 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0); 5649 reply.readException(); 5650 int result = reply.readInt(); 5651 reply.recycle(); 5652 data.recycle(); 5653 return result; 5654 } 5655 getFrontActivityScreenCompatMode()5656 public int getFrontActivityScreenCompatMode() throws RemoteException { 5657 Parcel data = Parcel.obtain(); 5658 Parcel reply = Parcel.obtain(); 5659 data.writeInterfaceToken(IActivityManager.descriptor); 5660 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 5661 reply.readException(); 5662 int mode = reply.readInt(); 5663 reply.recycle(); 5664 data.recycle(); 5665 return mode; 5666 } 5667 setFrontActivityScreenCompatMode(int mode)5668 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException { 5669 Parcel data = Parcel.obtain(); 5670 Parcel reply = Parcel.obtain(); 5671 data.writeInterfaceToken(IActivityManager.descriptor); 5672 data.writeInt(mode); 5673 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 5674 reply.readException(); 5675 reply.recycle(); 5676 data.recycle(); 5677 } 5678 getPackageScreenCompatMode(String packageName)5679 public int getPackageScreenCompatMode(String packageName) throws RemoteException { 5680 Parcel data = Parcel.obtain(); 5681 Parcel reply = Parcel.obtain(); 5682 data.writeInterfaceToken(IActivityManager.descriptor); 5683 data.writeString(packageName); 5684 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 5685 reply.readException(); 5686 int mode = reply.readInt(); 5687 reply.recycle(); 5688 data.recycle(); 5689 return mode; 5690 } 5691 setPackageScreenCompatMode(String packageName, int mode)5692 public void setPackageScreenCompatMode(String packageName, int mode) 5693 throws RemoteException { 5694 Parcel data = Parcel.obtain(); 5695 Parcel reply = Parcel.obtain(); 5696 data.writeInterfaceToken(IActivityManager.descriptor); 5697 data.writeString(packageName); 5698 data.writeInt(mode); 5699 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0); 5700 reply.readException(); 5701 reply.recycle(); 5702 data.recycle(); 5703 } 5704 getPackageAskScreenCompat(String packageName)5705 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException { 5706 Parcel data = Parcel.obtain(); 5707 Parcel reply = Parcel.obtain(); 5708 data.writeInterfaceToken(IActivityManager.descriptor); 5709 data.writeString(packageName); 5710 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); 5711 reply.readException(); 5712 boolean ask = reply.readInt() != 0; 5713 reply.recycle(); 5714 data.recycle(); 5715 return ask; 5716 } 5717 setPackageAskScreenCompat(String packageName, boolean ask)5718 public void setPackageAskScreenCompat(String packageName, boolean ask) 5719 throws RemoteException { 5720 Parcel data = Parcel.obtain(); 5721 Parcel reply = Parcel.obtain(); 5722 data.writeInterfaceToken(IActivityManager.descriptor); 5723 data.writeString(packageName); 5724 data.writeInt(ask ? 1 : 0); 5725 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0); 5726 reply.readException(); 5727 reply.recycle(); 5728 data.recycle(); 5729 } 5730 switchUser(int userid)5731 public boolean switchUser(int userid) throws RemoteException { 5732 Parcel data = Parcel.obtain(); 5733 Parcel reply = Parcel.obtain(); 5734 data.writeInterfaceToken(IActivityManager.descriptor); 5735 data.writeInt(userid); 5736 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0); 5737 reply.readException(); 5738 boolean result = reply.readInt() != 0; 5739 reply.recycle(); 5740 data.recycle(); 5741 return result; 5742 } 5743 startUserInBackground(int userid)5744 public boolean startUserInBackground(int userid) throws RemoteException { 5745 Parcel data = Parcel.obtain(); 5746 Parcel reply = Parcel.obtain(); 5747 data.writeInterfaceToken(IActivityManager.descriptor); 5748 data.writeInt(userid); 5749 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0); 5750 reply.readException(); 5751 boolean result = reply.readInt() != 0; 5752 reply.recycle(); 5753 data.recycle(); 5754 return result; 5755 } 5756 unlockUser(int userId, byte[] token, byte[] secret, IProgressListener listener)5757 public boolean unlockUser(int userId, byte[] token, byte[] secret, IProgressListener listener) 5758 throws RemoteException { 5759 Parcel data = Parcel.obtain(); 5760 Parcel reply = Parcel.obtain(); 5761 data.writeInterfaceToken(IActivityManager.descriptor); 5762 data.writeInt(userId); 5763 data.writeByteArray(token); 5764 data.writeByteArray(secret); 5765 data.writeStrongInterface(listener); 5766 mRemote.transact(IActivityManager.UNLOCK_USER_TRANSACTION, data, reply, 0); 5767 reply.readException(); 5768 boolean result = reply.readInt() != 0; 5769 reply.recycle(); 5770 data.recycle(); 5771 return result; 5772 } 5773 stopUser(int userid, boolean force, IStopUserCallback callback)5774 public int stopUser(int userid, boolean force, IStopUserCallback callback) 5775 throws RemoteException { 5776 Parcel data = Parcel.obtain(); 5777 Parcel reply = Parcel.obtain(); 5778 data.writeInterfaceToken(IActivityManager.descriptor); 5779 data.writeInt(userid); 5780 data.writeInt(force ? 1 : 0); 5781 data.writeStrongInterface(callback); 5782 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0); 5783 reply.readException(); 5784 int result = reply.readInt(); 5785 reply.recycle(); 5786 data.recycle(); 5787 return result; 5788 } 5789 getCurrentUser()5790 public UserInfo getCurrentUser() throws RemoteException { 5791 Parcel data = Parcel.obtain(); 5792 Parcel reply = Parcel.obtain(); 5793 data.writeInterfaceToken(IActivityManager.descriptor); 5794 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0); 5795 reply.readException(); 5796 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply); 5797 reply.recycle(); 5798 data.recycle(); 5799 return userInfo; 5800 } 5801 isUserRunning(int userid, int flags)5802 public boolean isUserRunning(int userid, int flags) throws RemoteException { 5803 Parcel data = Parcel.obtain(); 5804 Parcel reply = Parcel.obtain(); 5805 data.writeInterfaceToken(IActivityManager.descriptor); 5806 data.writeInt(userid); 5807 data.writeInt(flags); 5808 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0); 5809 reply.readException(); 5810 boolean result = reply.readInt() != 0; 5811 reply.recycle(); 5812 data.recycle(); 5813 return result; 5814 } 5815 getRunningUserIds()5816 public int[] getRunningUserIds() throws RemoteException { 5817 Parcel data = Parcel.obtain(); 5818 Parcel reply = Parcel.obtain(); 5819 data.writeInterfaceToken(IActivityManager.descriptor); 5820 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0); 5821 reply.readException(); 5822 int[] result = reply.createIntArray(); 5823 reply.recycle(); 5824 data.recycle(); 5825 return result; 5826 } 5827 removeTask(int taskId)5828 public boolean removeTask(int taskId) throws RemoteException { 5829 Parcel data = Parcel.obtain(); 5830 Parcel reply = Parcel.obtain(); 5831 data.writeInterfaceToken(IActivityManager.descriptor); 5832 data.writeInt(taskId); 5833 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0); 5834 reply.readException(); 5835 boolean result = reply.readInt() != 0; 5836 reply.recycle(); 5837 data.recycle(); 5838 return result; 5839 } 5840 registerProcessObserver(IProcessObserver observer)5841 public void registerProcessObserver(IProcessObserver observer) throws RemoteException { 5842 Parcel data = Parcel.obtain(); 5843 Parcel reply = Parcel.obtain(); 5844 data.writeInterfaceToken(IActivityManager.descriptor); 5845 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 5846 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0); 5847 reply.readException(); 5848 data.recycle(); 5849 reply.recycle(); 5850 } 5851 unregisterProcessObserver(IProcessObserver observer)5852 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException { 5853 Parcel data = Parcel.obtain(); 5854 Parcel reply = Parcel.obtain(); 5855 data.writeInterfaceToken(IActivityManager.descriptor); 5856 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 5857 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0); 5858 reply.readException(); 5859 data.recycle(); 5860 reply.recycle(); 5861 } 5862 registerUidObserver(IUidObserver observer, int which)5863 public void registerUidObserver(IUidObserver observer, int which) throws RemoteException { 5864 Parcel data = Parcel.obtain(); 5865 Parcel reply = Parcel.obtain(); 5866 data.writeInterfaceToken(IActivityManager.descriptor); 5867 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 5868 data.writeInt(which); 5869 mRemote.transact(REGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0); 5870 reply.readException(); 5871 data.recycle(); 5872 reply.recycle(); 5873 } 5874 unregisterUidObserver(IUidObserver observer)5875 public void unregisterUidObserver(IUidObserver observer) throws RemoteException { 5876 Parcel data = Parcel.obtain(); 5877 Parcel reply = Parcel.obtain(); 5878 data.writeInterfaceToken(IActivityManager.descriptor); 5879 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 5880 mRemote.transact(UNREGISTER_UID_OBSERVER_TRANSACTION, data, reply, 0); 5881 reply.readException(); 5882 data.recycle(); 5883 reply.recycle(); 5884 } 5885 isIntentSenderTargetedToPackage(IIntentSender sender)5886 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException { 5887 Parcel data = Parcel.obtain(); 5888 Parcel reply = Parcel.obtain(); 5889 data.writeInterfaceToken(IActivityManager.descriptor); 5890 data.writeStrongBinder(sender.asBinder()); 5891 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0); 5892 reply.readException(); 5893 boolean res = reply.readInt() != 0; 5894 data.recycle(); 5895 reply.recycle(); 5896 return res; 5897 } 5898 isIntentSenderAnActivity(IIntentSender sender)5899 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException { 5900 Parcel data = Parcel.obtain(); 5901 Parcel reply = Parcel.obtain(); 5902 data.writeInterfaceToken(IActivityManager.descriptor); 5903 data.writeStrongBinder(sender.asBinder()); 5904 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0); 5905 reply.readException(); 5906 boolean res = reply.readInt() != 0; 5907 data.recycle(); 5908 reply.recycle(); 5909 return res; 5910 } 5911 getIntentForIntentSender(IIntentSender sender)5912 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException { 5913 Parcel data = Parcel.obtain(); 5914 Parcel reply = Parcel.obtain(); 5915 data.writeInterfaceToken(IActivityManager.descriptor); 5916 data.writeStrongBinder(sender.asBinder()); 5917 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 5918 reply.readException(); 5919 Intent res = reply.readInt() != 0 5920 ? Intent.CREATOR.createFromParcel(reply) : null; 5921 data.recycle(); 5922 reply.recycle(); 5923 return res; 5924 } 5925 getTagForIntentSender(IIntentSender sender, String prefix)5926 public String getTagForIntentSender(IIntentSender sender, String prefix) 5927 throws RemoteException { 5928 Parcel data = Parcel.obtain(); 5929 Parcel reply = Parcel.obtain(); 5930 data.writeInterfaceToken(IActivityManager.descriptor); 5931 data.writeStrongBinder(sender.asBinder()); 5932 data.writeString(prefix); 5933 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0); 5934 reply.readException(); 5935 String res = reply.readString(); 5936 data.recycle(); 5937 reply.recycle(); 5938 return res; 5939 } 5940 updatePersistentConfiguration(Configuration values)5941 public void updatePersistentConfiguration(Configuration values) throws RemoteException 5942 { 5943 Parcel data = Parcel.obtain(); 5944 Parcel reply = Parcel.obtain(); 5945 data.writeInterfaceToken(IActivityManager.descriptor); 5946 values.writeToParcel(data, 0); 5947 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0); 5948 reply.readException(); 5949 data.recycle(); 5950 reply.recycle(); 5951 } 5952 getProcessPss(int[] pids)5953 public long[] getProcessPss(int[] pids) throws RemoteException { 5954 Parcel data = Parcel.obtain(); 5955 Parcel reply = Parcel.obtain(); 5956 data.writeInterfaceToken(IActivityManager.descriptor); 5957 data.writeIntArray(pids); 5958 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0); 5959 reply.readException(); 5960 long[] res = reply.createLongArray(); 5961 data.recycle(); 5962 reply.recycle(); 5963 return res; 5964 } 5965 showBootMessage(CharSequence msg, boolean always)5966 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException { 5967 Parcel data = Parcel.obtain(); 5968 Parcel reply = Parcel.obtain(); 5969 data.writeInterfaceToken(IActivityManager.descriptor); 5970 TextUtils.writeToParcel(msg, data, 0); 5971 data.writeInt(always ? 1 : 0); 5972 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0); 5973 reply.readException(); 5974 data.recycle(); 5975 reply.recycle(); 5976 } 5977 keyguardWaitingForActivityDrawn()5978 public void keyguardWaitingForActivityDrawn() throws RemoteException { 5979 Parcel data = Parcel.obtain(); 5980 Parcel reply = Parcel.obtain(); 5981 data.writeInterfaceToken(IActivityManager.descriptor); 5982 mRemote.transact(KEYGUARD_WAITING_FOR_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0); 5983 reply.readException(); 5984 data.recycle(); 5985 reply.recycle(); 5986 } 5987 keyguardGoingAway(int flags)5988 public void keyguardGoingAway(int flags) 5989 throws RemoteException { 5990 Parcel data = Parcel.obtain(); 5991 Parcel reply = Parcel.obtain(); 5992 data.writeInterfaceToken(IActivityManager.descriptor); 5993 data.writeInt(flags); 5994 mRemote.transact(KEYGUARD_GOING_AWAY_TRANSACTION, data, reply, 0); 5995 reply.readException(); 5996 data.recycle(); 5997 reply.recycle(); 5998 } 5999 shouldUpRecreateTask(IBinder token, String destAffinity)6000 public boolean shouldUpRecreateTask(IBinder token, String destAffinity) 6001 throws RemoteException { 6002 Parcel data = Parcel.obtain(); 6003 Parcel reply = Parcel.obtain(); 6004 data.writeInterfaceToken(IActivityManager.descriptor); 6005 data.writeStrongBinder(token); 6006 data.writeString(destAffinity); 6007 mRemote.transact(SHOULD_UP_RECREATE_TASK_TRANSACTION, data, reply, 0); 6008 reply.readException(); 6009 boolean result = reply.readInt() != 0; 6010 data.recycle(); 6011 reply.recycle(); 6012 return result; 6013 } 6014 navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)6015 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData) 6016 throws RemoteException { 6017 Parcel data = Parcel.obtain(); 6018 Parcel reply = Parcel.obtain(); 6019 data.writeInterfaceToken(IActivityManager.descriptor); 6020 data.writeStrongBinder(token); 6021 target.writeToParcel(data, 0); 6022 data.writeInt(resultCode); 6023 if (resultData != null) { 6024 data.writeInt(1); 6025 resultData.writeToParcel(data, 0); 6026 } else { 6027 data.writeInt(0); 6028 } 6029 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0); 6030 reply.readException(); 6031 boolean result = reply.readInt() != 0; 6032 data.recycle(); 6033 reply.recycle(); 6034 return result; 6035 } 6036 getLaunchedFromUid(IBinder activityToken)6037 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException { 6038 Parcel data = Parcel.obtain(); 6039 Parcel reply = Parcel.obtain(); 6040 data.writeInterfaceToken(IActivityManager.descriptor); 6041 data.writeStrongBinder(activityToken); 6042 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0); 6043 reply.readException(); 6044 int result = reply.readInt(); 6045 data.recycle(); 6046 reply.recycle(); 6047 return result; 6048 } 6049 getLaunchedFromPackage(IBinder activityToken)6050 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException { 6051 Parcel data = Parcel.obtain(); 6052 Parcel reply = Parcel.obtain(); 6053 data.writeInterfaceToken(IActivityManager.descriptor); 6054 data.writeStrongBinder(activityToken); 6055 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0); 6056 reply.readException(); 6057 String result = reply.readString(); 6058 data.recycle(); 6059 reply.recycle(); 6060 return result; 6061 } 6062 registerUserSwitchObserver(IUserSwitchObserver observer)6063 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { 6064 Parcel data = Parcel.obtain(); 6065 Parcel reply = Parcel.obtain(); 6066 data.writeInterfaceToken(IActivityManager.descriptor); 6067 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 6068 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); 6069 reply.readException(); 6070 data.recycle(); 6071 reply.recycle(); 6072 } 6073 unregisterUserSwitchObserver(IUserSwitchObserver observer)6074 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException { 6075 Parcel data = Parcel.obtain(); 6076 Parcel reply = Parcel.obtain(); 6077 data.writeInterfaceToken(IActivityManager.descriptor); 6078 data.writeStrongBinder(observer != null ? observer.asBinder() : null); 6079 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0); 6080 reply.readException(); 6081 data.recycle(); 6082 reply.recycle(); 6083 } 6084 requestBugReport(@ctivityManager.BugreportMode int bugreportType)6085 public void requestBugReport(@ActivityManager.BugreportMode int bugreportType) 6086 throws RemoteException { 6087 Parcel data = Parcel.obtain(); 6088 Parcel reply = Parcel.obtain(); 6089 data.writeInterfaceToken(IActivityManager.descriptor); 6090 data.writeInt(bugreportType); 6091 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0); 6092 reply.readException(); 6093 data.recycle(); 6094 reply.recycle(); 6095 } 6096 inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)6097 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason) 6098 throws RemoteException { 6099 Parcel data = Parcel.obtain(); 6100 Parcel reply = Parcel.obtain(); 6101 data.writeInterfaceToken(IActivityManager.descriptor); 6102 data.writeInt(pid); 6103 data.writeInt(aboveSystem ? 1 : 0); 6104 data.writeString(reason); 6105 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0); 6106 reply.readException(); 6107 long res = reply.readInt(); 6108 data.recycle(); 6109 reply.recycle(); 6110 return res; 6111 } 6112 getAssistContextExtras(int requestType)6113 public Bundle getAssistContextExtras(int requestType) throws RemoteException { 6114 Parcel data = Parcel.obtain(); 6115 Parcel reply = Parcel.obtain(); 6116 data.writeInterfaceToken(IActivityManager.descriptor); 6117 data.writeInt(requestType); 6118 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0); 6119 reply.readException(); 6120 Bundle res = reply.readBundle(); 6121 data.recycle(); 6122 reply.recycle(); 6123 return res; 6124 } 6125 requestAssistContextExtras(int requestType, IResultReceiver receiver, Bundle receiverExtras, IBinder activityToken, boolean focused, boolean newSessionId)6126 public boolean requestAssistContextExtras(int requestType, IResultReceiver receiver, 6127 Bundle receiverExtras, 6128 IBinder activityToken, boolean focused, boolean newSessionId) throws RemoteException { 6129 Parcel data = Parcel.obtain(); 6130 Parcel reply = Parcel.obtain(); 6131 data.writeInterfaceToken(IActivityManager.descriptor); 6132 data.writeInt(requestType); 6133 data.writeStrongBinder(receiver.asBinder()); 6134 data.writeBundle(receiverExtras); 6135 data.writeStrongBinder(activityToken); 6136 data.writeInt(focused ? 1 : 0); 6137 data.writeInt(newSessionId ? 1 : 0); 6138 mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0); 6139 reply.readException(); 6140 boolean res = reply.readInt() != 0; 6141 data.recycle(); 6142 reply.recycle(); 6143 return res; 6144 } 6145 reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure, AssistContent content, Uri referrer)6146 public void reportAssistContextExtras(IBinder token, Bundle extras, AssistStructure structure, 6147 AssistContent content, Uri referrer) throws RemoteException { 6148 Parcel data = Parcel.obtain(); 6149 Parcel reply = Parcel.obtain(); 6150 data.writeInterfaceToken(IActivityManager.descriptor); 6151 data.writeStrongBinder(token); 6152 data.writeBundle(extras); 6153 structure.writeToParcel(data, 0); 6154 content.writeToParcel(data, 0); 6155 if (referrer != null) { 6156 data.writeInt(1); 6157 referrer.writeToParcel(data, 0); 6158 } else { 6159 data.writeInt(0); 6160 } 6161 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0); 6162 reply.readException(); 6163 data.recycle(); 6164 reply.recycle(); 6165 } 6166 launchAssistIntent(Intent intent, int requestType, String hint, int userHandle, Bundle args)6167 public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle, 6168 Bundle args) throws RemoteException { 6169 Parcel data = Parcel.obtain(); 6170 Parcel reply = Parcel.obtain(); 6171 data.writeInterfaceToken(IActivityManager.descriptor); 6172 intent.writeToParcel(data, 0); 6173 data.writeInt(requestType); 6174 data.writeString(hint); 6175 data.writeInt(userHandle); 6176 data.writeBundle(args); 6177 mRemote.transact(LAUNCH_ASSIST_INTENT_TRANSACTION, data, reply, 0); 6178 reply.readException(); 6179 boolean res = reply.readInt() != 0; 6180 data.recycle(); 6181 reply.recycle(); 6182 return res; 6183 } 6184 isAssistDataAllowedOnCurrentActivity()6185 public boolean isAssistDataAllowedOnCurrentActivity() throws RemoteException { 6186 Parcel data = Parcel.obtain(); 6187 Parcel reply = Parcel.obtain(); 6188 data.writeInterfaceToken(IActivityManager.descriptor); 6189 mRemote.transact(IS_SCREEN_CAPTURE_ALLOWED_ON_CURRENT_ACTIVITY_TRANSACTION, data, reply, 0); 6190 reply.readException(); 6191 boolean res = reply.readInt() != 0; 6192 data.recycle(); 6193 reply.recycle(); 6194 return res; 6195 } 6196 showAssistFromActivity(IBinder token, Bundle args)6197 public boolean showAssistFromActivity(IBinder token, Bundle args) throws RemoteException { 6198 Parcel data = Parcel.obtain(); 6199 Parcel reply = Parcel.obtain(); 6200 data.writeInterfaceToken(IActivityManager.descriptor); 6201 data.writeStrongBinder(token); 6202 data.writeBundle(args); 6203 mRemote.transact(SHOW_ASSIST_FROM_ACTIVITY_TRANSACTION, data, reply, 0); 6204 reply.readException(); 6205 boolean res = reply.readInt() != 0; 6206 data.recycle(); 6207 reply.recycle(); 6208 return res; 6209 } 6210 killUid(int appId, int userId, String reason)6211 public void killUid(int appId, int userId, String reason) throws RemoteException { 6212 Parcel data = Parcel.obtain(); 6213 Parcel reply = Parcel.obtain(); 6214 data.writeInterfaceToken(IActivityManager.descriptor); 6215 data.writeInt(appId); 6216 data.writeInt(userId); 6217 data.writeString(reason); 6218 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0); 6219 reply.readException(); 6220 data.recycle(); 6221 reply.recycle(); 6222 } 6223 hang(IBinder who, boolean allowRestart)6224 public void hang(IBinder who, boolean allowRestart) throws RemoteException { 6225 Parcel data = Parcel.obtain(); 6226 Parcel reply = Parcel.obtain(); 6227 data.writeInterfaceToken(IActivityManager.descriptor); 6228 data.writeStrongBinder(who); 6229 data.writeInt(allowRestart ? 1 : 0); 6230 mRemote.transact(HANG_TRANSACTION, data, reply, 0); 6231 reply.readException(); 6232 data.recycle(); 6233 reply.recycle(); 6234 } 6235 reportActivityFullyDrawn(IBinder token)6236 public void reportActivityFullyDrawn(IBinder token) throws RemoteException { 6237 Parcel data = Parcel.obtain(); 6238 Parcel reply = Parcel.obtain(); 6239 data.writeInterfaceToken(IActivityManager.descriptor); 6240 data.writeStrongBinder(token); 6241 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0); 6242 reply.readException(); 6243 data.recycle(); 6244 reply.recycle(); 6245 } 6246 notifyActivityDrawn(IBinder token)6247 public void notifyActivityDrawn(IBinder token) throws RemoteException { 6248 Parcel data = Parcel.obtain(); 6249 Parcel reply = Parcel.obtain(); 6250 data.writeInterfaceToken(IActivityManager.descriptor); 6251 data.writeStrongBinder(token); 6252 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0); 6253 reply.readException(); 6254 data.recycle(); 6255 reply.recycle(); 6256 } 6257 restart()6258 public void restart() throws RemoteException { 6259 Parcel data = Parcel.obtain(); 6260 Parcel reply = Parcel.obtain(); 6261 data.writeInterfaceToken(IActivityManager.descriptor); 6262 mRemote.transact(RESTART_TRANSACTION, data, reply, 0); 6263 reply.readException(); 6264 data.recycle(); 6265 reply.recycle(); 6266 } 6267 performIdleMaintenance()6268 public void performIdleMaintenance() throws RemoteException { 6269 Parcel data = Parcel.obtain(); 6270 Parcel reply = Parcel.obtain(); 6271 data.writeInterfaceToken(IActivityManager.descriptor); 6272 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0); 6273 reply.readException(); 6274 data.recycle(); 6275 reply.recycle(); 6276 } 6277 sendIdleJobTrigger()6278 public void sendIdleJobTrigger() throws RemoteException { 6279 Parcel data = Parcel.obtain(); 6280 Parcel reply = Parcel.obtain(); 6281 data.writeInterfaceToken(IActivityManager.descriptor); 6282 mRemote.transact(SEND_IDLE_JOB_TRIGGER_TRANSACTION, data, reply, 0); 6283 reply.readException(); 6284 data.recycle(); 6285 reply.recycle(); 6286 } 6287 createVirtualActivityContainer(IBinder parentActivityToken, IActivityContainerCallback callback)6288 public IActivityContainer createVirtualActivityContainer(IBinder parentActivityToken, 6289 IActivityContainerCallback callback) throws RemoteException { 6290 Parcel data = Parcel.obtain(); 6291 Parcel reply = Parcel.obtain(); 6292 data.writeInterfaceToken(IActivityManager.descriptor); 6293 data.writeStrongBinder(parentActivityToken); 6294 data.writeStrongBinder(callback == null ? null : callback.asBinder()); 6295 mRemote.transact(CREATE_VIRTUAL_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0); 6296 reply.readException(); 6297 final int result = reply.readInt(); 6298 final IActivityContainer res; 6299 if (result == 1) { 6300 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder()); 6301 } else { 6302 res = null; 6303 } 6304 data.recycle(); 6305 reply.recycle(); 6306 return res; 6307 } 6308 deleteActivityContainer(IActivityContainer activityContainer)6309 public void deleteActivityContainer(IActivityContainer activityContainer) 6310 throws RemoteException { 6311 Parcel data = Parcel.obtain(); 6312 Parcel reply = Parcel.obtain(); 6313 data.writeInterfaceToken(IActivityManager.descriptor); 6314 data.writeStrongBinder(activityContainer.asBinder()); 6315 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0); 6316 reply.readException(); 6317 data.recycle(); 6318 reply.recycle(); 6319 } 6320 startBinderTracking()6321 public boolean startBinderTracking() throws RemoteException { 6322 Parcel data = Parcel.obtain(); 6323 Parcel reply = Parcel.obtain(); 6324 data.writeInterfaceToken(IActivityManager.descriptor); 6325 mRemote.transact(START_BINDER_TRACKING_TRANSACTION, data, reply, 0); 6326 reply.readException(); 6327 boolean res = reply.readInt() != 0; 6328 reply.recycle(); 6329 data.recycle(); 6330 return res; 6331 } 6332 stopBinderTrackingAndDump(ParcelFileDescriptor fd)6333 public boolean stopBinderTrackingAndDump(ParcelFileDescriptor fd) throws RemoteException { 6334 Parcel data = Parcel.obtain(); 6335 Parcel reply = Parcel.obtain(); 6336 data.writeInterfaceToken(IActivityManager.descriptor); 6337 if (fd != null) { 6338 data.writeInt(1); 6339 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); 6340 } else { 6341 data.writeInt(0); 6342 } 6343 mRemote.transact(STOP_BINDER_TRACKING_AND_DUMP_TRANSACTION, data, reply, 0); 6344 reply.readException(); 6345 boolean res = reply.readInt() != 0; 6346 reply.recycle(); 6347 data.recycle(); 6348 return res; 6349 } 6350 setVrMode(IBinder token, boolean enabled, ComponentName packageName)6351 public int setVrMode(IBinder token, boolean enabled, ComponentName packageName) 6352 throws RemoteException { 6353 Parcel data = Parcel.obtain(); 6354 Parcel reply = Parcel.obtain(); 6355 data.writeInterfaceToken(IActivityManager.descriptor); 6356 data.writeStrongBinder(token); 6357 data.writeInt(enabled ? 1 : 0); 6358 packageName.writeToParcel(data, 0); 6359 mRemote.transact(SET_VR_MODE_TRANSACTION, data, reply, 0); 6360 reply.readException(); 6361 int res = reply.readInt(); 6362 data.recycle(); 6363 reply.recycle(); 6364 return res; 6365 } 6366 isVrModePackageEnabled(ComponentName packageName)6367 public boolean isVrModePackageEnabled(ComponentName packageName) 6368 throws RemoteException { 6369 Parcel data = Parcel.obtain(); 6370 Parcel reply = Parcel.obtain(); 6371 data.writeInterfaceToken(IActivityManager.descriptor); 6372 packageName.writeToParcel(data, 0); 6373 mRemote.transact(IS_VR_PACKAGE_ENABLED_TRANSACTION, data, reply, 0); 6374 reply.readException(); 6375 int res = reply.readInt(); 6376 data.recycle(); 6377 reply.recycle(); 6378 return res == 1; 6379 } 6380 6381 @Override createStackOnDisplay(int displayId)6382 public IActivityContainer createStackOnDisplay(int displayId) throws RemoteException { 6383 Parcel data = Parcel.obtain(); 6384 Parcel reply = Parcel.obtain(); 6385 data.writeInterfaceToken(IActivityManager.descriptor); 6386 data.writeInt(displayId); 6387 mRemote.transact(CREATE_STACK_ON_DISPLAY, data, reply, 0); 6388 reply.readException(); 6389 final int result = reply.readInt(); 6390 final IActivityContainer res; 6391 if (result == 1) { 6392 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder()); 6393 } else { 6394 res = null; 6395 } 6396 data.recycle(); 6397 reply.recycle(); 6398 return res; 6399 } 6400 6401 @Override getActivityDisplayId(IBinder activityToken)6402 public int getActivityDisplayId(IBinder activityToken) 6403 throws RemoteException { 6404 Parcel data = Parcel.obtain(); 6405 Parcel reply = Parcel.obtain(); 6406 data.writeInterfaceToken(IActivityManager.descriptor); 6407 data.writeStrongBinder(activityToken); 6408 mRemote.transact(GET_ACTIVITY_DISPLAY_ID_TRANSACTION, data, reply, 0); 6409 reply.readException(); 6410 final int displayId = reply.readInt(); 6411 data.recycle(); 6412 reply.recycle(); 6413 return displayId; 6414 } 6415 6416 @Override startLockTaskMode(int taskId)6417 public void startLockTaskMode(int taskId) throws RemoteException { 6418 Parcel data = Parcel.obtain(); 6419 Parcel reply = Parcel.obtain(); 6420 data.writeInterfaceToken(IActivityManager.descriptor); 6421 data.writeInt(taskId); 6422 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0); 6423 reply.readException(); 6424 data.recycle(); 6425 reply.recycle(); 6426 } 6427 6428 @Override startLockTaskMode(IBinder token)6429 public void startLockTaskMode(IBinder token) throws RemoteException { 6430 Parcel data = Parcel.obtain(); 6431 Parcel reply = Parcel.obtain(); 6432 data.writeInterfaceToken(IActivityManager.descriptor); 6433 data.writeStrongBinder(token); 6434 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0); 6435 reply.readException(); 6436 data.recycle(); 6437 reply.recycle(); 6438 } 6439 6440 @Override startSystemLockTaskMode(int taskId)6441 public void startSystemLockTaskMode(int taskId) throws RemoteException { 6442 Parcel data = Parcel.obtain(); 6443 Parcel reply = Parcel.obtain(); 6444 data.writeInterfaceToken(IActivityManager.descriptor); 6445 data.writeInt(taskId); 6446 mRemote.transact(START_SYSTEM_LOCK_TASK_TRANSACTION, data, reply, 0); 6447 reply.readException(); 6448 data.recycle(); 6449 reply.recycle(); 6450 } 6451 6452 @Override stopLockTaskMode()6453 public void stopLockTaskMode() throws RemoteException { 6454 Parcel data = Parcel.obtain(); 6455 Parcel reply = Parcel.obtain(); 6456 data.writeInterfaceToken(IActivityManager.descriptor); 6457 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0); 6458 reply.readException(); 6459 data.recycle(); 6460 reply.recycle(); 6461 } 6462 6463 @Override stopSystemLockTaskMode()6464 public void stopSystemLockTaskMode() throws RemoteException { 6465 Parcel data = Parcel.obtain(); 6466 Parcel reply = Parcel.obtain(); 6467 data.writeInterfaceToken(IActivityManager.descriptor); 6468 mRemote.transact(STOP_SYSTEM_LOCK_TASK_TRANSACTION, data, reply, 0); 6469 reply.readException(); 6470 data.recycle(); 6471 reply.recycle(); 6472 } 6473 6474 @Override isInLockTaskMode()6475 public boolean isInLockTaskMode() throws RemoteException { 6476 Parcel data = Parcel.obtain(); 6477 Parcel reply = Parcel.obtain(); 6478 data.writeInterfaceToken(IActivityManager.descriptor); 6479 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0); 6480 reply.readException(); 6481 boolean isInLockTaskMode = reply.readInt() == 1; 6482 data.recycle(); 6483 reply.recycle(); 6484 return isInLockTaskMode; 6485 } 6486 6487 @Override getLockTaskModeState()6488 public int getLockTaskModeState() throws RemoteException { 6489 Parcel data = Parcel.obtain(); 6490 Parcel reply = Parcel.obtain(); 6491 data.writeInterfaceToken(IActivityManager.descriptor); 6492 mRemote.transact(GET_LOCK_TASK_MODE_STATE_TRANSACTION, data, reply, 0); 6493 reply.readException(); 6494 int lockTaskModeState = reply.readInt(); 6495 data.recycle(); 6496 reply.recycle(); 6497 return lockTaskModeState; 6498 } 6499 6500 @Override showLockTaskEscapeMessage(IBinder token)6501 public void showLockTaskEscapeMessage(IBinder token) throws RemoteException { 6502 Parcel data = Parcel.obtain(); 6503 Parcel reply = Parcel.obtain(); 6504 data.writeInterfaceToken(IActivityManager.descriptor); 6505 data.writeStrongBinder(token); 6506 mRemote.transact(SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION, data, reply, 6507 IBinder.FLAG_ONEWAY); 6508 reply.readException(); 6509 data.recycle(); 6510 reply.recycle(); 6511 } 6512 6513 @Override setTaskDescription(IBinder token, ActivityManager.TaskDescription values)6514 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values) 6515 throws RemoteException { 6516 Parcel data = Parcel.obtain(); 6517 Parcel reply = Parcel.obtain(); 6518 data.writeInterfaceToken(IActivityManager.descriptor); 6519 data.writeStrongBinder(token); 6520 values.writeToParcel(data, 0); 6521 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, 0); 6522 reply.readException(); 6523 data.recycle(); 6524 reply.recycle(); 6525 } 6526 6527 @Override setTaskResizeable(int taskId, int resizeableMode)6528 public void setTaskResizeable(int taskId, int resizeableMode) throws RemoteException { 6529 Parcel data = Parcel.obtain(); 6530 Parcel reply = Parcel.obtain(); 6531 data.writeInterfaceToken(IActivityManager.descriptor); 6532 data.writeInt(taskId); 6533 data.writeInt(resizeableMode); 6534 mRemote.transact(SET_TASK_RESIZEABLE_TRANSACTION, data, reply, 0); 6535 reply.readException(); 6536 data.recycle(); 6537 reply.recycle(); 6538 } 6539 6540 @Override resizeTask(int taskId, Rect r, int resizeMode)6541 public void resizeTask(int taskId, Rect r, int resizeMode) throws RemoteException 6542 { 6543 Parcel data = Parcel.obtain(); 6544 Parcel reply = Parcel.obtain(); 6545 data.writeInterfaceToken(IActivityManager.descriptor); 6546 data.writeInt(taskId); 6547 data.writeInt(resizeMode); 6548 r.writeToParcel(data, 0); 6549 mRemote.transact(RESIZE_TASK_TRANSACTION, data, reply, 0); 6550 reply.readException(); 6551 data.recycle(); 6552 reply.recycle(); 6553 } 6554 6555 @Override getTaskBounds(int taskId)6556 public Rect getTaskBounds(int taskId) throws RemoteException 6557 { 6558 Parcel data = Parcel.obtain(); 6559 Parcel reply = Parcel.obtain(); 6560 data.writeInterfaceToken(IActivityManager.descriptor); 6561 data.writeInt(taskId); 6562 mRemote.transact(GET_TASK_BOUNDS_TRANSACTION, data, reply, 0); 6563 reply.readException(); 6564 Rect rect = Rect.CREATOR.createFromParcel(reply); 6565 data.recycle(); 6566 reply.recycle(); 6567 return rect; 6568 } 6569 6570 @Override getTaskDescriptionIcon(String filename, int userId)6571 public Bitmap getTaskDescriptionIcon(String filename, int userId) throws RemoteException { 6572 Parcel data = Parcel.obtain(); 6573 Parcel reply = Parcel.obtain(); 6574 data.writeInterfaceToken(IActivityManager.descriptor); 6575 data.writeString(filename); 6576 data.writeInt(userId); 6577 mRemote.transact(GET_TASK_DESCRIPTION_ICON_TRANSACTION, data, reply, 0); 6578 reply.readException(); 6579 final Bitmap icon = reply.readInt() == 0 ? null : Bitmap.CREATOR.createFromParcel(reply); 6580 data.recycle(); 6581 reply.recycle(); 6582 return icon; 6583 } 6584 6585 @Override startInPlaceAnimationOnFrontMostApplication(ActivityOptions options)6586 public void startInPlaceAnimationOnFrontMostApplication(ActivityOptions options) 6587 throws RemoteException { 6588 Parcel data = Parcel.obtain(); 6589 Parcel reply = Parcel.obtain(); 6590 data.writeInterfaceToken(IActivityManager.descriptor); 6591 if (options == null) { 6592 data.writeInt(0); 6593 } else { 6594 data.writeInt(1); 6595 data.writeBundle(options.toBundle()); 6596 } 6597 mRemote.transact(START_IN_PLACE_ANIMATION_TRANSACTION, data, reply, 0); 6598 reply.readException(); 6599 data.recycle(); 6600 reply.recycle(); 6601 } 6602 6603 @Override requestVisibleBehind(IBinder token, boolean visible)6604 public boolean requestVisibleBehind(IBinder token, boolean visible) throws RemoteException { 6605 Parcel data = Parcel.obtain(); 6606 Parcel reply = Parcel.obtain(); 6607 data.writeInterfaceToken(IActivityManager.descriptor); 6608 data.writeStrongBinder(token); 6609 data.writeInt(visible ? 1 : 0); 6610 mRemote.transact(REQUEST_VISIBLE_BEHIND_TRANSACTION, data, reply, 0); 6611 reply.readException(); 6612 boolean success = reply.readInt() > 0; 6613 data.recycle(); 6614 reply.recycle(); 6615 return success; 6616 } 6617 6618 @Override isBackgroundVisibleBehind(IBinder token)6619 public boolean isBackgroundVisibleBehind(IBinder token) throws RemoteException { 6620 Parcel data = Parcel.obtain(); 6621 Parcel reply = Parcel.obtain(); 6622 data.writeInterfaceToken(IActivityManager.descriptor); 6623 data.writeStrongBinder(token); 6624 mRemote.transact(IS_BACKGROUND_VISIBLE_BEHIND_TRANSACTION, data, reply, 0); 6625 reply.readException(); 6626 final boolean visible = reply.readInt() > 0; 6627 data.recycle(); 6628 reply.recycle(); 6629 return visible; 6630 } 6631 6632 @Override backgroundResourcesReleased(IBinder token)6633 public void backgroundResourcesReleased(IBinder token) throws RemoteException { 6634 Parcel data = Parcel.obtain(); 6635 Parcel reply = Parcel.obtain(); 6636 data.writeInterfaceToken(IActivityManager.descriptor); 6637 data.writeStrongBinder(token); 6638 mRemote.transact(BACKGROUND_RESOURCES_RELEASED_TRANSACTION, data, reply, 0); 6639 reply.readException(); 6640 data.recycle(); 6641 reply.recycle(); 6642 } 6643 6644 @Override notifyLaunchTaskBehindComplete(IBinder token)6645 public void notifyLaunchTaskBehindComplete(IBinder token) throws RemoteException { 6646 Parcel data = Parcel.obtain(); 6647 Parcel reply = Parcel.obtain(); 6648 data.writeInterfaceToken(IActivityManager.descriptor); 6649 data.writeStrongBinder(token); 6650 mRemote.transact(NOTIFY_LAUNCH_TASK_BEHIND_COMPLETE_TRANSACTION, data, reply, 0); 6651 reply.readException(); 6652 data.recycle(); 6653 reply.recycle(); 6654 } 6655 6656 @Override notifyEnterAnimationComplete(IBinder token)6657 public void notifyEnterAnimationComplete(IBinder token) throws RemoteException { 6658 Parcel data = Parcel.obtain(); 6659 Parcel reply = Parcel.obtain(); 6660 data.writeInterfaceToken(IActivityManager.descriptor); 6661 data.writeStrongBinder(token); 6662 mRemote.transact(NOTIFY_ENTER_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0); 6663 reply.readException(); 6664 data.recycle(); 6665 reply.recycle(); 6666 } 6667 6668 @Override bootAnimationComplete()6669 public void bootAnimationComplete() throws RemoteException { 6670 Parcel data = Parcel.obtain(); 6671 Parcel reply = Parcel.obtain(); 6672 data.writeInterfaceToken(IActivityManager.descriptor); 6673 mRemote.transact(BOOT_ANIMATION_COMPLETE_TRANSACTION, data, reply, 0); 6674 reply.readException(); 6675 data.recycle(); 6676 reply.recycle(); 6677 } 6678 6679 @Override notifyCleartextNetwork(int uid, byte[] firstPacket)6680 public void notifyCleartextNetwork(int uid, byte[] firstPacket) throws RemoteException { 6681 Parcel data = Parcel.obtain(); 6682 Parcel reply = Parcel.obtain(); 6683 data.writeInterfaceToken(IActivityManager.descriptor); 6684 data.writeInt(uid); 6685 data.writeByteArray(firstPacket); 6686 mRemote.transact(NOTIFY_CLEARTEXT_NETWORK_TRANSACTION, data, reply, 0); 6687 reply.readException(); 6688 data.recycle(); 6689 reply.recycle(); 6690 } 6691 6692 @Override setDumpHeapDebugLimit(String processName, int uid, long maxMemSize, String reportPackage)6693 public void setDumpHeapDebugLimit(String processName, int uid, long maxMemSize, 6694 String reportPackage) throws RemoteException { 6695 Parcel data = Parcel.obtain(); 6696 Parcel reply = Parcel.obtain(); 6697 data.writeInterfaceToken(IActivityManager.descriptor); 6698 data.writeString(processName); 6699 data.writeInt(uid); 6700 data.writeLong(maxMemSize); 6701 data.writeString(reportPackage); 6702 mRemote.transact(SET_DUMP_HEAP_DEBUG_LIMIT_TRANSACTION, data, reply, 0); 6703 reply.readException(); 6704 data.recycle(); 6705 reply.recycle(); 6706 } 6707 6708 @Override dumpHeapFinished(String path)6709 public void dumpHeapFinished(String path) throws RemoteException { 6710 Parcel data = Parcel.obtain(); 6711 Parcel reply = Parcel.obtain(); 6712 data.writeInterfaceToken(IActivityManager.descriptor); 6713 data.writeString(path); 6714 mRemote.transact(DUMP_HEAP_FINISHED_TRANSACTION, data, reply, 0); 6715 reply.readException(); 6716 data.recycle(); 6717 reply.recycle(); 6718 } 6719 6720 @Override setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake)6721 public void setVoiceKeepAwake(IVoiceInteractionSession session, boolean keepAwake) 6722 throws RemoteException { 6723 Parcel data = Parcel.obtain(); 6724 Parcel reply = Parcel.obtain(); 6725 data.writeInterfaceToken(IActivityManager.descriptor); 6726 data.writeStrongBinder(session.asBinder()); 6727 data.writeInt(keepAwake ? 1 : 0); 6728 mRemote.transact(SET_VOICE_KEEP_AWAKE_TRANSACTION, data, reply, 0); 6729 reply.readException(); 6730 data.recycle(); 6731 reply.recycle(); 6732 } 6733 6734 @Override updateLockTaskPackages(int userId, String[] packages)6735 public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException { 6736 Parcel data = Parcel.obtain(); 6737 Parcel reply = Parcel.obtain(); 6738 data.writeInterfaceToken(IActivityManager.descriptor); 6739 data.writeInt(userId); 6740 data.writeStringArray(packages); 6741 mRemote.transact(UPDATE_LOCK_TASK_PACKAGES_TRANSACTION, data, reply, 0); 6742 reply.readException(); 6743 data.recycle(); 6744 reply.recycle(); 6745 } 6746 6747 @Override updateDeviceOwner(String packageName)6748 public void updateDeviceOwner(String packageName) throws RemoteException { 6749 Parcel data = Parcel.obtain(); 6750 Parcel reply = Parcel.obtain(); 6751 data.writeInterfaceToken(IActivityManager.descriptor); 6752 data.writeString(packageName); 6753 mRemote.transact(UPDATE_DEVICE_OWNER_TRANSACTION, data, reply, 0); 6754 reply.readException(); 6755 data.recycle(); 6756 reply.recycle(); 6757 } 6758 6759 @Override getPackageProcessState(String packageName, String callingPackage)6760 public int getPackageProcessState(String packageName, String callingPackage) 6761 throws RemoteException { 6762 Parcel data = Parcel.obtain(); 6763 Parcel reply = Parcel.obtain(); 6764 data.writeInterfaceToken(IActivityManager.descriptor); 6765 data.writeString(packageName); 6766 data.writeString(callingPackage); 6767 mRemote.transact(GET_PACKAGE_PROCESS_STATE_TRANSACTION, data, reply, 0); 6768 reply.readException(); 6769 int res = reply.readInt(); 6770 data.recycle(); 6771 reply.recycle(); 6772 return res; 6773 } 6774 6775 @Override setProcessMemoryTrimLevel(String process, int userId, int level)6776 public boolean setProcessMemoryTrimLevel(String process, int userId, int level) 6777 throws RemoteException { 6778 Parcel data = Parcel.obtain(); 6779 Parcel reply = Parcel.obtain(); 6780 data.writeInterfaceToken(IActivityManager.descriptor); 6781 data.writeString(process); 6782 data.writeInt(userId); 6783 data.writeInt(level); 6784 mRemote.transact(SET_PROCESS_MEMORY_TRIM_TRANSACTION, data, reply, 0); 6785 reply.readException(); 6786 int res = reply.readInt(); 6787 data.recycle(); 6788 reply.recycle(); 6789 return res != 0; 6790 } 6791 6792 @Override isRootVoiceInteraction(IBinder token)6793 public boolean isRootVoiceInteraction(IBinder token) throws RemoteException { 6794 Parcel data = Parcel.obtain(); 6795 Parcel reply = Parcel.obtain(); 6796 data.writeInterfaceToken(IActivityManager.descriptor); 6797 data.writeStrongBinder(token); 6798 mRemote.transact(IS_ROOT_VOICE_INTERACTION_TRANSACTION, data, reply, 0); 6799 reply.readException(); 6800 int res = reply.readInt(); 6801 data.recycle(); 6802 reply.recycle(); 6803 return res != 0; 6804 } 6805 6806 @Override exitFreeformMode(IBinder token)6807 public void exitFreeformMode(IBinder token) throws RemoteException { 6808 Parcel data = Parcel.obtain(); 6809 Parcel reply = Parcel.obtain(); 6810 data.writeInterfaceToken(IActivityManager.descriptor); 6811 data.writeStrongBinder(token); 6812 mRemote.transact(EXIT_FREEFORM_MODE_TRANSACTION, data, reply, 0); 6813 reply.readException(); 6814 data.recycle(); 6815 reply.recycle(); 6816 } 6817 6818 @Override getActivityStackId(IBinder token)6819 public int getActivityStackId(IBinder token) throws RemoteException { 6820 Parcel data = Parcel.obtain(); 6821 Parcel reply = Parcel.obtain(); 6822 data.writeInterfaceToken(IActivityManager.descriptor); 6823 data.writeStrongBinder(token); 6824 mRemote.transact(GET_ACTIVITY_STACK_ID_TRANSACTION, data, reply, 0); 6825 reply.readException(); 6826 int stackId = reply.readInt(); 6827 data.recycle(); 6828 reply.recycle(); 6829 return stackId; 6830 } 6831 6832 @Override reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration, int[] verticalSizeConfigurations, int[] smallestSizeConfigurations)6833 public void reportSizeConfigurations(IBinder token, int[] horizontalSizeConfiguration, 6834 int[] verticalSizeConfigurations, int[] smallestSizeConfigurations) 6835 throws RemoteException { 6836 Parcel data = Parcel.obtain(); 6837 Parcel reply = Parcel.obtain(); 6838 data.writeInterfaceToken(IActivityManager.descriptor); 6839 data.writeStrongBinder(token); 6840 writeIntArray(horizontalSizeConfiguration, data); 6841 writeIntArray(verticalSizeConfigurations, data); 6842 writeIntArray(smallestSizeConfigurations, data); 6843 mRemote.transact(REPORT_SIZE_CONFIGURATIONS, data, reply, 0); 6844 reply.readException(); 6845 data.recycle(); 6846 reply.recycle(); 6847 } 6848 writeIntArray(int[] array, Parcel data)6849 private static void writeIntArray(int[] array, Parcel data) { 6850 if (array == null) { 6851 data.writeInt(0); 6852 } else { 6853 data.writeInt(array.length); 6854 data.writeIntArray(array); 6855 } 6856 } 6857 6858 @Override suppressResizeConfigChanges(boolean suppress)6859 public void suppressResizeConfigChanges(boolean suppress) throws RemoteException { 6860 Parcel data = Parcel.obtain(); 6861 Parcel reply = Parcel.obtain(); 6862 data.writeInterfaceToken(IActivityManager.descriptor); 6863 data.writeInt(suppress ? 1 : 0); 6864 mRemote.transact(SUPPRESS_RESIZE_CONFIG_CHANGES_TRANSACTION, data, reply, 0); 6865 reply.readException(); 6866 data.recycle(); 6867 reply.recycle(); 6868 } 6869 6870 @Override moveTasksToFullscreenStack(int fromStackId, boolean onTop)6871 public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) throws RemoteException { 6872 Parcel data = Parcel.obtain(); 6873 Parcel reply = Parcel.obtain(); 6874 data.writeInterfaceToken(IActivityManager.descriptor); 6875 data.writeInt(fromStackId); 6876 data.writeInt(onTop ? 1 : 0); 6877 mRemote.transact(MOVE_TASKS_TO_FULLSCREEN_STACK_TRANSACTION, data, reply, 0); 6878 reply.readException(); 6879 data.recycle(); 6880 reply.recycle(); 6881 } 6882 6883 @Override getAppStartMode(int uid, String packageName)6884 public int getAppStartMode(int uid, String packageName) throws RemoteException { 6885 Parcel data = Parcel.obtain(); 6886 Parcel reply = Parcel.obtain(); 6887 data.writeInterfaceToken(IActivityManager.descriptor); 6888 data.writeInt(uid); 6889 data.writeString(packageName); 6890 mRemote.transact(GET_APP_START_MODE_TRANSACTION, data, reply, 0); 6891 reply.readException(); 6892 int res = reply.readInt(); 6893 data.recycle(); 6894 reply.recycle(); 6895 return res; 6896 } 6897 6898 @Override isInMultiWindowMode(IBinder token)6899 public boolean isInMultiWindowMode(IBinder token) throws RemoteException { 6900 Parcel data = Parcel.obtain(); 6901 Parcel reply = Parcel.obtain(); 6902 data.writeInterfaceToken(IActivityManager.descriptor); 6903 data.writeStrongBinder(token); 6904 mRemote.transact(IN_MULTI_WINDOW_TRANSACTION, data, reply, 0); 6905 reply.readException(); 6906 final boolean multiWindowMode = reply.readInt() == 1 ? true : false; 6907 data.recycle(); 6908 reply.recycle(); 6909 return multiWindowMode; 6910 } 6911 6912 @Override isInPictureInPictureMode(IBinder token)6913 public boolean isInPictureInPictureMode(IBinder token) throws RemoteException { 6914 Parcel data = Parcel.obtain(); 6915 Parcel reply = Parcel.obtain(); 6916 data.writeInterfaceToken(IActivityManager.descriptor); 6917 data.writeStrongBinder(token); 6918 mRemote.transact(IN_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0); 6919 reply.readException(); 6920 final boolean pipMode = reply.readInt() == 1 ? true : false; 6921 data.recycle(); 6922 reply.recycle(); 6923 return pipMode; 6924 } 6925 6926 @Override enterPictureInPictureMode(IBinder token)6927 public void enterPictureInPictureMode(IBinder token) throws RemoteException { 6928 Parcel data = Parcel.obtain(); 6929 Parcel reply = Parcel.obtain(); 6930 data.writeInterfaceToken(IActivityManager.descriptor); 6931 data.writeStrongBinder(token); 6932 mRemote.transact(ENTER_PICTURE_IN_PICTURE_TRANSACTION, data, reply, 0); 6933 reply.readException(); 6934 data.recycle(); 6935 reply.recycle(); 6936 } 6937 6938 @Override isAppForeground(int uid)6939 public boolean isAppForeground(int uid) throws RemoteException { 6940 Parcel data = Parcel.obtain(); 6941 Parcel reply = Parcel.obtain(); 6942 data.writeInterfaceToken(IActivityManager.descriptor); 6943 data.writeInt(uid); 6944 mRemote.transact(IS_APP_FOREGROUND_TRANSACTION, data, reply, 0); 6945 final boolean isForeground = reply.readInt() == 1 ? true : false; 6946 data.recycle(); 6947 reply.recycle(); 6948 return isForeground; 6949 }; 6950 6951 @Override notifyPinnedStackAnimationEnded()6952 public void notifyPinnedStackAnimationEnded() throws RemoteException { 6953 Parcel data = Parcel.obtain(); 6954 Parcel reply = Parcel.obtain(); 6955 data.writeInterfaceToken(IActivityManager.descriptor); 6956 mRemote.transact(NOTIFY_PINNED_STACK_ANIMATION_ENDED_TRANSACTION, data, reply, 0); 6957 data.recycle(); 6958 reply.recycle(); 6959 }; 6960 6961 @Override removeStack(int stackId)6962 public void removeStack(int stackId) throws RemoteException { 6963 Parcel data = Parcel.obtain(); 6964 Parcel reply = Parcel.obtain(); 6965 data.writeInterfaceToken(IActivityManager.descriptor); 6966 data.writeInt(stackId); 6967 mRemote.transact(REMOVE_STACK, data, reply, 0); 6968 reply.readException(); 6969 data.recycle(); 6970 reply.recycle(); 6971 } 6972 6973 @Override notifyLockedProfile(@serIdInt int userId)6974 public void notifyLockedProfile(@UserIdInt int userId) throws RemoteException { 6975 Parcel data = Parcel.obtain(); 6976 Parcel reply = Parcel.obtain(); 6977 data.writeInterfaceToken(IActivityManager.descriptor); 6978 data.writeInt(userId); 6979 mRemote.transact(NOTIFY_LOCKED_PROFILE, data, reply, 0); 6980 reply.readException(); 6981 data.recycle(); 6982 reply.recycle(); 6983 } 6984 6985 @Override startConfirmDeviceCredentialIntent(Intent intent)6986 public void startConfirmDeviceCredentialIntent(Intent intent) throws RemoteException { 6987 Parcel data = Parcel.obtain(); 6988 Parcel reply = Parcel.obtain(); 6989 data.writeInterfaceToken(IActivityManager.descriptor); 6990 intent.writeToParcel(data, 0); 6991 mRemote.transact(START_CONFIRM_DEVICE_CREDENTIAL_INTENT, data, reply, 0); 6992 reply.readException(); 6993 data.recycle(); 6994 reply.recycle(); 6995 } 6996 6997 @Override sendIntentSender(IIntentSender target, int code, Intent intent, String resolvedType, IIntentReceiver finishedReceiver, String requiredPermission, Bundle options)6998 public int sendIntentSender(IIntentSender target, int code, Intent intent, String resolvedType, 6999 IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) 7000 throws RemoteException { 7001 Parcel data = Parcel.obtain(); 7002 Parcel reply = Parcel.obtain(); 7003 data.writeInterfaceToken(IActivityManager.descriptor); 7004 data.writeStrongBinder(target.asBinder()); 7005 data.writeInt(code); 7006 if ((intent!=null)) { 7007 data.writeInt(1); 7008 intent.writeToParcel(data, 0); 7009 } 7010 else { 7011 data.writeInt(0); 7012 } 7013 data.writeString(resolvedType); 7014 data.writeStrongBinder((((finishedReceiver!=null))?(finishedReceiver.asBinder()):(null))); 7015 data.writeString(requiredPermission); 7016 if ((options!=null)) { 7017 data.writeInt(1); 7018 options.writeToParcel(data, 0); 7019 } 7020 else { 7021 data.writeInt(0); 7022 } 7023 mRemote.transact(SEND_INTENT_SENDER_TRANSACTION, data, reply, 0); 7024 reply.readException(); 7025 final int res = reply.readInt(); 7026 data.recycle(); 7027 reply.recycle(); 7028 return res; 7029 } 7030 7031 private IBinder mRemote; 7032 } 7033