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