ApplicationThreadNative.java revision a4e102ee580282dc7abeb22f4a025813e53b9431
1/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
20import android.content.Intent;
21import android.content.IIntentReceiver;
22import android.content.pm.ActivityInfo;
23import android.content.pm.ApplicationInfo;
24import android.content.pm.ProviderInfo;
25import android.content.pm.ServiceInfo;
26import android.content.res.CompatibilityInfo;
27import android.content.res.Configuration;
28import android.net.Uri;
29import android.os.Binder;
30import android.os.Bundle;
31import android.os.Debug;
32import android.os.Parcelable;
33import android.os.PersistableBundle;
34import android.os.RemoteException;
35import android.os.IBinder;
36import android.os.Parcel;
37import android.os.ParcelFileDescriptor;
38import com.android.internal.app.IVoiceInteractor;
39
40import java.io.FileDescriptor;
41import java.io.IOException;
42import java.util.HashMap;
43import java.util.List;
44import java.util.Map;
45
46/** {@hide} */
47public abstract class ApplicationThreadNative extends Binder
48        implements IApplicationThread {
49    /**
50     * Cast a Binder object into an application thread interface, generating
51     * a proxy if needed.
52     */
53    static public IApplicationThread asInterface(IBinder obj) {
54        if (obj == null) {
55            return null;
56        }
57        IApplicationThread in =
58            (IApplicationThread)obj.queryLocalInterface(descriptor);
59        if (in != null) {
60            return in;
61        }
62
63        return new ApplicationThreadProxy(obj);
64    }
65
66    public ApplicationThreadNative() {
67        attachInterface(this, descriptor);
68    }
69
70    @Override
71    public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
72            throws RemoteException {
73        switch (code) {
74        case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION:
75        {
76            data.enforceInterface(IApplicationThread.descriptor);
77            IBinder b = data.readStrongBinder();
78            boolean finished = data.readInt() != 0;
79            boolean userLeaving = data.readInt() != 0;
80            int configChanges = data.readInt();
81            boolean dontReport = data.readInt() != 0;
82            schedulePauseActivity(b, finished, userLeaving, configChanges, dontReport);
83            return true;
84        }
85
86        case SCHEDULE_STOP_ACTIVITY_TRANSACTION:
87        {
88            data.enforceInterface(IApplicationThread.descriptor);
89            IBinder b = data.readStrongBinder();
90            boolean show = data.readInt() != 0;
91            int configChanges = data.readInt();
92            scheduleStopActivity(b, show, configChanges);
93            return true;
94        }
95
96        case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION:
97        {
98            data.enforceInterface(IApplicationThread.descriptor);
99            IBinder b = data.readStrongBinder();
100            boolean show = data.readInt() != 0;
101            scheduleWindowVisibility(b, show);
102            return true;
103        }
104
105        case SCHEDULE_SLEEPING_TRANSACTION:
106        {
107            data.enforceInterface(IApplicationThread.descriptor);
108            IBinder b = data.readStrongBinder();
109            boolean sleeping = data.readInt() != 0;
110            scheduleSleeping(b, sleeping);
111            return true;
112        }
113
114        case SCHEDULE_RESUME_ACTIVITY_TRANSACTION:
115        {
116            data.enforceInterface(IApplicationThread.descriptor);
117            IBinder b = data.readStrongBinder();
118            int procState = data.readInt();
119            boolean isForward = data.readInt() != 0;
120            Bundle resumeArgs = data.readBundle();
121            scheduleResumeActivity(b, procState, isForward, resumeArgs);
122            return true;
123        }
124
125        case SCHEDULE_SEND_RESULT_TRANSACTION:
126        {
127            data.enforceInterface(IApplicationThread.descriptor);
128            IBinder b = data.readStrongBinder();
129            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
130            scheduleSendResult(b, ri);
131            return true;
132        }
133
134        case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
135        {
136            data.enforceInterface(IApplicationThread.descriptor);
137            Intent intent = Intent.CREATOR.createFromParcel(data);
138            IBinder b = data.readStrongBinder();
139            int ident = data.readInt();
140            ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
141            Configuration curConfig = Configuration.CREATOR.createFromParcel(data);
142            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
143            IVoiceInteractor voiceInteractor = IVoiceInteractor.Stub.asInterface(
144                    data.readStrongBinder());
145            int procState = data.readInt();
146            Bundle state = data.readBundle();
147            PersistableBundle persistentState = data.readPersistableBundle();
148            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
149            List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
150            boolean notResumed = data.readInt() != 0;
151            boolean isForward = data.readInt() != 0;
152            ProfilerInfo profilerInfo = data.readInt() != 0
153                    ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
154            scheduleLaunchActivity(intent, b, ident, info, curConfig, compatInfo, voiceInteractor,
155                    procState, state, persistentState, ri, pi, notResumed, isForward, profilerInfo);
156            return true;
157        }
158
159        case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
160        {
161            data.enforceInterface(IApplicationThread.descriptor);
162            IBinder b = data.readStrongBinder();
163            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
164            List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
165            int configChanges = data.readInt();
166            boolean notResumed = data.readInt() != 0;
167            Configuration config = null;
168            if (data.readInt() != 0) {
169                config = Configuration.CREATOR.createFromParcel(data);
170            }
171            scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config);
172            return true;
173        }
174
175        case SCHEDULE_NEW_INTENT_TRANSACTION:
176        {
177            data.enforceInterface(IApplicationThread.descriptor);
178            List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
179            IBinder b = data.readStrongBinder();
180            scheduleNewIntent(pi, b);
181            return true;
182        }
183
184        case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
185        {
186            data.enforceInterface(IApplicationThread.descriptor);
187            IBinder b = data.readStrongBinder();
188            boolean finishing = data.readInt() != 0;
189            int configChanges = data.readInt();
190            scheduleDestroyActivity(b, finishing, configChanges);
191            return true;
192        }
193
194        case SCHEDULE_RECEIVER_TRANSACTION:
195        {
196            data.enforceInterface(IApplicationThread.descriptor);
197            Intent intent = Intent.CREATOR.createFromParcel(data);
198            ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
199            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
200            int resultCode = data.readInt();
201            String resultData = data.readString();
202            Bundle resultExtras = data.readBundle();
203            boolean sync = data.readInt() != 0;
204            int sendingUser = data.readInt();
205            int processState = data.readInt();
206            scheduleReceiver(intent, info, compatInfo, resultCode, resultData,
207                    resultExtras, sync, sendingUser, processState);
208            return true;
209        }
210
211        case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
212            data.enforceInterface(IApplicationThread.descriptor);
213            IBinder token = data.readStrongBinder();
214            ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
215            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
216            int processState = data.readInt();
217            scheduleCreateService(token, info, compatInfo, processState);
218            return true;
219        }
220
221        case SCHEDULE_BIND_SERVICE_TRANSACTION: {
222            data.enforceInterface(IApplicationThread.descriptor);
223            IBinder token = data.readStrongBinder();
224            Intent intent = Intent.CREATOR.createFromParcel(data);
225            boolean rebind = data.readInt() != 0;
226            int processState = data.readInt();
227            scheduleBindService(token, intent, rebind, processState);
228            return true;
229        }
230
231        case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
232            data.enforceInterface(IApplicationThread.descriptor);
233            IBinder token = data.readStrongBinder();
234            Intent intent = Intent.CREATOR.createFromParcel(data);
235            scheduleUnbindService(token, intent);
236            return true;
237        }
238
239        case SCHEDULE_SERVICE_ARGS_TRANSACTION:
240        {
241            data.enforceInterface(IApplicationThread.descriptor);
242            IBinder token = data.readStrongBinder();
243            boolean taskRemoved = data.readInt() != 0;
244            int startId = data.readInt();
245            int fl = data.readInt();
246            Intent args;
247            if (data.readInt() != 0) {
248                args = Intent.CREATOR.createFromParcel(data);
249            } else {
250                args = null;
251            }
252            scheduleServiceArgs(token, taskRemoved, startId, fl, args);
253            return true;
254        }
255
256        case SCHEDULE_STOP_SERVICE_TRANSACTION:
257        {
258            data.enforceInterface(IApplicationThread.descriptor);
259            IBinder token = data.readStrongBinder();
260            scheduleStopService(token);
261            return true;
262        }
263
264        case BIND_APPLICATION_TRANSACTION:
265        {
266            data.enforceInterface(IApplicationThread.descriptor);
267            String packageName = data.readString();
268            ApplicationInfo info =
269                ApplicationInfo.CREATOR.createFromParcel(data);
270            List<ProviderInfo> providers =
271                data.createTypedArrayList(ProviderInfo.CREATOR);
272            ComponentName testName = (data.readInt() != 0)
273                ? new ComponentName(data) : null;
274            ProfilerInfo profilerInfo = data.readInt() != 0
275                    ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
276            Bundle testArgs = data.readBundle();
277            IBinder binder = data.readStrongBinder();
278            IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
279            binder = data.readStrongBinder();
280            IUiAutomationConnection uiAutomationConnection =
281                    IUiAutomationConnection.Stub.asInterface(binder);
282            int testMode = data.readInt();
283            boolean openGlTrace = data.readInt() != 0;
284            boolean restrictedBackupMode = (data.readInt() != 0);
285            boolean persistent = (data.readInt() != 0);
286            Configuration config = Configuration.CREATOR.createFromParcel(data);
287            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
288            HashMap<String, IBinder> services = data.readHashMap(null);
289            Bundle coreSettings = data.readBundle();
290            bindApplication(packageName, info, providers, testName, profilerInfo, testArgs,
291                    testWatcher, uiAutomationConnection, testMode, openGlTrace,
292                    restrictedBackupMode, persistent, config, compatInfo, services, coreSettings);
293            return true;
294        }
295
296        case SCHEDULE_EXIT_TRANSACTION:
297        {
298            data.enforceInterface(IApplicationThread.descriptor);
299            scheduleExit();
300            return true;
301        }
302
303        case SCHEDULE_SUICIDE_TRANSACTION:
304        {
305            data.enforceInterface(IApplicationThread.descriptor);
306            scheduleSuicide();
307            return true;
308        }
309
310        case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
311        {
312            data.enforceInterface(IApplicationThread.descriptor);
313            Configuration config = Configuration.CREATOR.createFromParcel(data);
314            scheduleConfigurationChanged(config);
315            return true;
316        }
317
318        case UPDATE_TIME_ZONE_TRANSACTION: {
319            data.enforceInterface(IApplicationThread.descriptor);
320            updateTimeZone();
321            return true;
322        }
323
324        case CLEAR_DNS_CACHE_TRANSACTION: {
325            data.enforceInterface(IApplicationThread.descriptor);
326            clearDnsCache();
327            return true;
328        }
329
330        case SET_HTTP_PROXY_TRANSACTION: {
331            data.enforceInterface(IApplicationThread.descriptor);
332            final String proxy = data.readString();
333            final String port = data.readString();
334            final String exclList = data.readString();
335            final Uri pacFileUrl = Uri.CREATOR.createFromParcel(data);
336            setHttpProxy(proxy, port, exclList, pacFileUrl);
337            return true;
338        }
339
340        case PROCESS_IN_BACKGROUND_TRANSACTION: {
341            data.enforceInterface(IApplicationThread.descriptor);
342            processInBackground();
343            return true;
344        }
345
346        case DUMP_SERVICE_TRANSACTION: {
347            data.enforceInterface(IApplicationThread.descriptor);
348            ParcelFileDescriptor fd = data.readFileDescriptor();
349            final IBinder service = data.readStrongBinder();
350            final String[] args = data.readStringArray();
351            if (fd != null) {
352                dumpService(fd.getFileDescriptor(), service, args);
353                try {
354                    fd.close();
355                } catch (IOException e) {
356                }
357            }
358            return true;
359        }
360
361        case DUMP_PROVIDER_TRANSACTION: {
362            data.enforceInterface(IApplicationThread.descriptor);
363            ParcelFileDescriptor fd = data.readFileDescriptor();
364            final IBinder service = data.readStrongBinder();
365            final String[] args = data.readStringArray();
366            if (fd != null) {
367                dumpProvider(fd.getFileDescriptor(), service, args);
368                try {
369                    fd.close();
370                } catch (IOException e) {
371                }
372            }
373            return true;
374        }
375
376        case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
377            data.enforceInterface(IApplicationThread.descriptor);
378            IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
379                    data.readStrongBinder());
380            Intent intent = Intent.CREATOR.createFromParcel(data);
381            int resultCode = data.readInt();
382            String dataStr = data.readString();
383            Bundle extras = data.readBundle();
384            boolean ordered = data.readInt() != 0;
385            boolean sticky = data.readInt() != 0;
386            int sendingUser = data.readInt();
387            int processState = data.readInt();
388            scheduleRegisteredReceiver(receiver, intent,
389                    resultCode, dataStr, extras, ordered, sticky, sendingUser, processState);
390            return true;
391        }
392
393        case SCHEDULE_LOW_MEMORY_TRANSACTION:
394        {
395            data.enforceInterface(IApplicationThread.descriptor);
396            scheduleLowMemory();
397            return true;
398        }
399
400        case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
401        {
402            data.enforceInterface(IApplicationThread.descriptor);
403            IBinder b = data.readStrongBinder();
404            scheduleActivityConfigurationChanged(b);
405            return true;
406        }
407
408        case PROFILER_CONTROL_TRANSACTION:
409        {
410            data.enforceInterface(IApplicationThread.descriptor);
411            boolean start = data.readInt() != 0;
412            int profileType = data.readInt();
413            ProfilerInfo profilerInfo = data.readInt() != 0
414                    ? ProfilerInfo.CREATOR.createFromParcel(data) : null;
415            profilerControl(start, profilerInfo, profileType);
416            return true;
417        }
418
419        case SET_SCHEDULING_GROUP_TRANSACTION:
420        {
421            data.enforceInterface(IApplicationThread.descriptor);
422            int group = data.readInt();
423            setSchedulingGroup(group);
424            return true;
425        }
426
427        case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
428        {
429            data.enforceInterface(IApplicationThread.descriptor);
430            ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
431            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
432            int backupMode = data.readInt();
433            scheduleCreateBackupAgent(appInfo, compatInfo, backupMode);
434            return true;
435        }
436
437        case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
438        {
439            data.enforceInterface(IApplicationThread.descriptor);
440            ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
441            CompatibilityInfo compatInfo = CompatibilityInfo.CREATOR.createFromParcel(data);
442            scheduleDestroyBackupAgent(appInfo, compatInfo);
443            return true;
444        }
445
446        case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
447        {
448            data.enforceInterface(IApplicationThread.descriptor);
449            int cmd = data.readInt();
450            String[] packages = data.readStringArray();
451            dispatchPackageBroadcast(cmd, packages);
452            return true;
453        }
454
455        case SCHEDULE_CRASH_TRANSACTION:
456        {
457            data.enforceInterface(IApplicationThread.descriptor);
458            String msg = data.readString();
459            scheduleCrash(msg);
460            return true;
461        }
462
463        case DUMP_HEAP_TRANSACTION:
464        {
465            data.enforceInterface(IApplicationThread.descriptor);
466            boolean managed = data.readInt() != 0;
467            String path = data.readString();
468            ParcelFileDescriptor fd = data.readInt() != 0
469                    ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
470            dumpHeap(managed, path, fd);
471            return true;
472        }
473
474        case DUMP_ACTIVITY_TRANSACTION: {
475            data.enforceInterface(IApplicationThread.descriptor);
476            ParcelFileDescriptor fd = data.readFileDescriptor();
477            final IBinder activity = data.readStrongBinder();
478            final String prefix = data.readString();
479            final String[] args = data.readStringArray();
480            if (fd != null) {
481                dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
482                try {
483                    fd.close();
484                } catch (IOException e) {
485                }
486            }
487            return true;
488        }
489
490        case SET_CORE_SETTINGS_TRANSACTION: {
491            data.enforceInterface(IApplicationThread.descriptor);
492            Bundle settings = data.readBundle();
493            setCoreSettings(settings);
494            return true;
495        }
496
497        case UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION: {
498            data.enforceInterface(IApplicationThread.descriptor);
499            String pkg = data.readString();
500            CompatibilityInfo compat = CompatibilityInfo.CREATOR.createFromParcel(data);
501            updatePackageCompatibilityInfo(pkg, compat);
502            return true;
503        }
504
505        case SCHEDULE_TRIM_MEMORY_TRANSACTION: {
506            data.enforceInterface(IApplicationThread.descriptor);
507            int level = data.readInt();
508            scheduleTrimMemory(level);
509            return true;
510        }
511
512        case DUMP_MEM_INFO_TRANSACTION:
513        {
514            data.enforceInterface(IApplicationThread.descriptor);
515            ParcelFileDescriptor fd = data.readFileDescriptor();
516            Debug.MemoryInfo mi = Debug.MemoryInfo.CREATOR.createFromParcel(data);
517            boolean checkin = data.readInt() != 0;
518            boolean dumpInfo = data.readInt() != 0;
519            boolean dumpDalvik = data.readInt() != 0;
520            String[] args = data.readStringArray();
521            if (fd != null) {
522                try {
523                    dumpMemInfo(fd.getFileDescriptor(), mi, checkin, dumpInfo, dumpDalvik, args);
524                } finally {
525                    try {
526                        fd.close();
527                    } catch (IOException e) {
528                        // swallowed, not propagated back to the caller
529                    }
530                }
531            }
532            reply.writeNoException();
533            return true;
534        }
535
536        case DUMP_GFX_INFO_TRANSACTION:
537        {
538            data.enforceInterface(IApplicationThread.descriptor);
539            ParcelFileDescriptor fd = data.readFileDescriptor();
540            String[] args = data.readStringArray();
541            if (fd != null) {
542                try {
543                    dumpGfxInfo(fd.getFileDescriptor(), args);
544                } finally {
545                    try {
546                        fd.close();
547                    } catch (IOException e) {
548                        // swallowed, not propagated back to the caller
549                    }
550                }
551            }
552            reply.writeNoException();
553            return true;
554        }
555
556        case DUMP_DB_INFO_TRANSACTION:
557        {
558            data.enforceInterface(IApplicationThread.descriptor);
559            ParcelFileDescriptor fd = data.readFileDescriptor();
560            String[] args = data.readStringArray();
561            if (fd != null) {
562                try {
563                    dumpDbInfo(fd.getFileDescriptor(), args);
564                } finally {
565                    try {
566                        fd.close();
567                    } catch (IOException e) {
568                        // swallowed, not propagated back to the caller
569                    }
570                }
571            }
572            reply.writeNoException();
573            return true;
574        }
575
576        case UNSTABLE_PROVIDER_DIED_TRANSACTION:
577        {
578            data.enforceInterface(IApplicationThread.descriptor);
579            IBinder provider = data.readStrongBinder();
580            unstableProviderDied(provider);
581            reply.writeNoException();
582            return true;
583        }
584
585        case REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION:
586        {
587            data.enforceInterface(IApplicationThread.descriptor);
588            IBinder activityToken = data.readStrongBinder();
589            IBinder requestToken = data.readStrongBinder();
590            int requestType = data.readInt();
591            requestAssistContextExtras(activityToken, requestToken, requestType);
592            reply.writeNoException();
593            return true;
594        }
595
596        case SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION:
597        {
598            data.enforceInterface(IApplicationThread.descriptor);
599            IBinder token = data.readStrongBinder();
600            boolean timeout = data.readInt() == 1;
601            scheduleTranslucentConversionComplete(token, timeout);
602            reply.writeNoException();
603            return true;
604        }
605
606        case SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION:
607        {
608            data.enforceInterface(IApplicationThread.descriptor);
609            IBinder token = data.readStrongBinder();
610            ActivityOptions options = new ActivityOptions(data.readBundle());
611            scheduleOnNewActivityOptions(token, options);
612            reply.writeNoException();
613            return true;
614        }
615
616        case SET_PROCESS_STATE_TRANSACTION:
617        {
618            data.enforceInterface(IApplicationThread.descriptor);
619            int state = data.readInt();
620            setProcessState(state);
621            reply.writeNoException();
622            return true;
623        }
624
625        case SCHEDULE_INSTALL_PROVIDER_TRANSACTION:
626        {
627            data.enforceInterface(IApplicationThread.descriptor);
628            ProviderInfo provider = ProviderInfo.CREATOR.createFromParcel(data);
629            scheduleInstallProvider(provider);
630            reply.writeNoException();
631            return true;
632        }
633
634        case UPDATE_TIME_PREFS_TRANSACTION:
635        {
636            data.enforceInterface(IApplicationThread.descriptor);
637            byte is24Hour = data.readByte();
638            updateTimePrefs(is24Hour == (byte) 1);
639            reply.writeNoException();
640            return true;
641        }
642
643        case CANCEL_VISIBLE_BEHIND_TRANSACTION:
644        {
645            data.enforceInterface(IApplicationThread.descriptor);
646            IBinder token = data.readStrongBinder();
647            scheduleCancelVisibleBehind(token);
648            reply.writeNoException();
649            return true;
650        }
651
652        case BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION:
653        {
654            data.enforceInterface(IApplicationThread.descriptor);
655            IBinder token = data.readStrongBinder();
656            boolean enabled = data.readInt() > 0;
657            scheduleBackgroundVisibleBehindChanged(token, enabled);
658            reply.writeNoException();
659            return true;
660        }
661
662        case ENTER_ANIMATION_COMPLETE_TRANSACTION:
663        {
664            data.enforceInterface(IApplicationThread.descriptor);
665            IBinder token = data.readStrongBinder();
666            scheduleEnterAnimationComplete(token);
667            reply.writeNoException();
668            return true;
669        }
670        }
671
672        return super.onTransact(code, data, reply, flags);
673    }
674
675    public IBinder asBinder()
676    {
677        return this;
678    }
679}
680
681class ApplicationThreadProxy implements IApplicationThread {
682    private final IBinder mRemote;
683
684    public ApplicationThreadProxy(IBinder remote) {
685        mRemote = remote;
686    }
687
688    public final IBinder asBinder() {
689        return mRemote;
690    }
691
692    public final void schedulePauseActivity(IBinder token, boolean finished,
693            boolean userLeaving, int configChanges, boolean dontReport) throws RemoteException {
694        Parcel data = Parcel.obtain();
695        data.writeInterfaceToken(IApplicationThread.descriptor);
696        data.writeStrongBinder(token);
697        data.writeInt(finished ? 1 : 0);
698        data.writeInt(userLeaving ? 1 :0);
699        data.writeInt(configChanges);
700        data.writeInt(dontReport ? 1 : 0);
701        mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
702                IBinder.FLAG_ONEWAY);
703        data.recycle();
704    }
705
706    public final void scheduleStopActivity(IBinder token, boolean showWindow,
707            int configChanges) throws RemoteException {
708        Parcel data = Parcel.obtain();
709        data.writeInterfaceToken(IApplicationThread.descriptor);
710        data.writeStrongBinder(token);
711        data.writeInt(showWindow ? 1 : 0);
712        data.writeInt(configChanges);
713        mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
714                IBinder.FLAG_ONEWAY);
715        data.recycle();
716    }
717
718    public final void scheduleWindowVisibility(IBinder token,
719            boolean showWindow) throws RemoteException {
720        Parcel data = Parcel.obtain();
721        data.writeInterfaceToken(IApplicationThread.descriptor);
722        data.writeStrongBinder(token);
723        data.writeInt(showWindow ? 1 : 0);
724        mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
725                IBinder.FLAG_ONEWAY);
726        data.recycle();
727    }
728
729    public final void scheduleSleeping(IBinder token,
730            boolean sleeping) throws RemoteException {
731        Parcel data = Parcel.obtain();
732        data.writeInterfaceToken(IApplicationThread.descriptor);
733        data.writeStrongBinder(token);
734        data.writeInt(sleeping ? 1 : 0);
735        mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
736                IBinder.FLAG_ONEWAY);
737        data.recycle();
738    }
739
740    public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward,
741            Bundle resumeArgs)
742            throws RemoteException {
743        Parcel data = Parcel.obtain();
744        data.writeInterfaceToken(IApplicationThread.descriptor);
745        data.writeStrongBinder(token);
746        data.writeInt(procState);
747        data.writeInt(isForward ? 1 : 0);
748        data.writeBundle(resumeArgs);
749        mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
750                IBinder.FLAG_ONEWAY);
751        data.recycle();
752    }
753
754    public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
755            throws RemoteException {
756        Parcel data = Parcel.obtain();
757        data.writeInterfaceToken(IApplicationThread.descriptor);
758        data.writeStrongBinder(token);
759        data.writeTypedList(results);
760        mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
761                IBinder.FLAG_ONEWAY);
762        data.recycle();
763    }
764
765    public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
766            ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo,
767            IVoiceInteractor voiceInteractor, int procState, Bundle state,
768            PersistableBundle persistentState, List<ResultInfo> pendingResults,
769            List<Intent> pendingNewIntents, boolean notResumed, boolean isForward,
770            ProfilerInfo profilerInfo) throws RemoteException {
771        Parcel data = Parcel.obtain();
772        data.writeInterfaceToken(IApplicationThread.descriptor);
773        intent.writeToParcel(data, 0);
774        data.writeStrongBinder(token);
775        data.writeInt(ident);
776        info.writeToParcel(data, 0);
777        curConfig.writeToParcel(data, 0);
778        compatInfo.writeToParcel(data, 0);
779        data.writeStrongBinder(voiceInteractor != null ? voiceInteractor.asBinder() : null);
780        data.writeInt(procState);
781        data.writeBundle(state);
782        data.writePersistableBundle(persistentState);
783        data.writeTypedList(pendingResults);
784        data.writeTypedList(pendingNewIntents);
785        data.writeInt(notResumed ? 1 : 0);
786        data.writeInt(isForward ? 1 : 0);
787        if (profilerInfo != null) {
788            data.writeInt(1);
789            profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
790        } else {
791            data.writeInt(0);
792        }
793        mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
794                IBinder.FLAG_ONEWAY);
795        data.recycle();
796    }
797
798    public final void scheduleRelaunchActivity(IBinder token,
799            List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
800            int configChanges, boolean notResumed, Configuration config)
801            throws RemoteException {
802        Parcel data = Parcel.obtain();
803        data.writeInterfaceToken(IApplicationThread.descriptor);
804        data.writeStrongBinder(token);
805        data.writeTypedList(pendingResults);
806        data.writeTypedList(pendingNewIntents);
807        data.writeInt(configChanges);
808        data.writeInt(notResumed ? 1 : 0);
809        if (config != null) {
810            data.writeInt(1);
811            config.writeToParcel(data, 0);
812        } else {
813            data.writeInt(0);
814        }
815        mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
816                IBinder.FLAG_ONEWAY);
817        data.recycle();
818    }
819
820    public void scheduleNewIntent(List<Intent> intents, IBinder token)
821            throws RemoteException {
822        Parcel data = Parcel.obtain();
823        data.writeInterfaceToken(IApplicationThread.descriptor);
824        data.writeTypedList(intents);
825        data.writeStrongBinder(token);
826        mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
827                IBinder.FLAG_ONEWAY);
828        data.recycle();
829    }
830
831    public final void scheduleDestroyActivity(IBinder token, boolean finishing,
832            int configChanges) throws RemoteException {
833        Parcel data = Parcel.obtain();
834        data.writeInterfaceToken(IApplicationThread.descriptor);
835        data.writeStrongBinder(token);
836        data.writeInt(finishing ? 1 : 0);
837        data.writeInt(configChanges);
838        mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
839                IBinder.FLAG_ONEWAY);
840        data.recycle();
841    }
842
843    public final void scheduleReceiver(Intent intent, ActivityInfo info,
844            CompatibilityInfo compatInfo, int resultCode, String resultData,
845            Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException {
846        Parcel data = Parcel.obtain();
847        data.writeInterfaceToken(IApplicationThread.descriptor);
848        intent.writeToParcel(data, 0);
849        info.writeToParcel(data, 0);
850        compatInfo.writeToParcel(data, 0);
851        data.writeInt(resultCode);
852        data.writeString(resultData);
853        data.writeBundle(map);
854        data.writeInt(sync ? 1 : 0);
855        data.writeInt(sendingUser);
856        data.writeInt(processState);
857        mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
858                IBinder.FLAG_ONEWAY);
859        data.recycle();
860    }
861
862    public final void scheduleCreateBackupAgent(ApplicationInfo app,
863            CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
864        Parcel data = Parcel.obtain();
865        data.writeInterfaceToken(IApplicationThread.descriptor);
866        app.writeToParcel(data, 0);
867        compatInfo.writeToParcel(data, 0);
868        data.writeInt(backupMode);
869        mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
870                IBinder.FLAG_ONEWAY);
871        data.recycle();
872    }
873
874    public final void scheduleDestroyBackupAgent(ApplicationInfo app,
875            CompatibilityInfo compatInfo) throws RemoteException {
876        Parcel data = Parcel.obtain();
877        data.writeInterfaceToken(IApplicationThread.descriptor);
878        app.writeToParcel(data, 0);
879        compatInfo.writeToParcel(data, 0);
880        mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
881                IBinder.FLAG_ONEWAY);
882        data.recycle();
883    }
884
885    public final void scheduleCreateService(IBinder token, ServiceInfo info,
886            CompatibilityInfo compatInfo, int processState) throws RemoteException {
887        Parcel data = Parcel.obtain();
888        data.writeInterfaceToken(IApplicationThread.descriptor);
889        data.writeStrongBinder(token);
890        info.writeToParcel(data, 0);
891        compatInfo.writeToParcel(data, 0);
892        data.writeInt(processState);
893        mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
894                IBinder.FLAG_ONEWAY);
895        data.recycle();
896    }
897
898    public final void scheduleBindService(IBinder token, Intent intent, boolean rebind,
899            int processState) throws RemoteException {
900        Parcel data = Parcel.obtain();
901        data.writeInterfaceToken(IApplicationThread.descriptor);
902        data.writeStrongBinder(token);
903        intent.writeToParcel(data, 0);
904        data.writeInt(rebind ? 1 : 0);
905        data.writeInt(processState);
906        mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
907                IBinder.FLAG_ONEWAY);
908        data.recycle();
909    }
910
911    public final void scheduleUnbindService(IBinder token, Intent intent)
912            throws RemoteException {
913        Parcel data = Parcel.obtain();
914        data.writeInterfaceToken(IApplicationThread.descriptor);
915        data.writeStrongBinder(token);
916        intent.writeToParcel(data, 0);
917        mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
918                IBinder.FLAG_ONEWAY);
919        data.recycle();
920    }
921
922    public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
923            int flags, Intent args) throws RemoteException {
924        Parcel data = Parcel.obtain();
925        data.writeInterfaceToken(IApplicationThread.descriptor);
926        data.writeStrongBinder(token);
927        data.writeInt(taskRemoved ? 1 : 0);
928        data.writeInt(startId);
929        data.writeInt(flags);
930        if (args != null) {
931            data.writeInt(1);
932            args.writeToParcel(data, 0);
933        } else {
934            data.writeInt(0);
935        }
936        mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
937                IBinder.FLAG_ONEWAY);
938        data.recycle();
939    }
940
941    public final void scheduleStopService(IBinder token)
942            throws RemoteException {
943        Parcel data = Parcel.obtain();
944        data.writeInterfaceToken(IApplicationThread.descriptor);
945        data.writeStrongBinder(token);
946        mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
947                IBinder.FLAG_ONEWAY);
948        data.recycle();
949    }
950
951    public final void bindApplication(String packageName, ApplicationInfo info,
952            List<ProviderInfo> providers, ComponentName testName, ProfilerInfo profilerInfo,
953            Bundle testArgs, IInstrumentationWatcher testWatcher,
954            IUiAutomationConnection uiAutomationConnection, int debugMode,
955            boolean openGlTrace, boolean restrictedBackupMode, boolean persistent,
956            Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services,
957            Bundle coreSettings) throws RemoteException {
958        Parcel data = Parcel.obtain();
959        data.writeInterfaceToken(IApplicationThread.descriptor);
960        data.writeString(packageName);
961        info.writeToParcel(data, 0);
962        data.writeTypedList(providers);
963        if (testName == null) {
964            data.writeInt(0);
965        } else {
966            data.writeInt(1);
967            testName.writeToParcel(data, 0);
968        }
969        if (profilerInfo != null) {
970            data.writeInt(1);
971            profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
972        } else {
973            data.writeInt(0);
974        }
975        data.writeBundle(testArgs);
976        data.writeStrongInterface(testWatcher);
977        data.writeStrongInterface(uiAutomationConnection);
978        data.writeInt(debugMode);
979        data.writeInt(openGlTrace ? 1 : 0);
980        data.writeInt(restrictedBackupMode ? 1 : 0);
981        data.writeInt(persistent ? 1 : 0);
982        config.writeToParcel(data, 0);
983        compatInfo.writeToParcel(data, 0);
984        data.writeMap(services);
985        data.writeBundle(coreSettings);
986        mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
987                IBinder.FLAG_ONEWAY);
988        data.recycle();
989    }
990
991    public final void scheduleExit() throws RemoteException {
992        Parcel data = Parcel.obtain();
993        data.writeInterfaceToken(IApplicationThread.descriptor);
994        mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
995                IBinder.FLAG_ONEWAY);
996        data.recycle();
997    }
998
999    public final void scheduleSuicide() throws RemoteException {
1000        Parcel data = Parcel.obtain();
1001        data.writeInterfaceToken(IApplicationThread.descriptor);
1002        mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
1003                IBinder.FLAG_ONEWAY);
1004        data.recycle();
1005    }
1006
1007    public final void scheduleConfigurationChanged(Configuration config)
1008            throws RemoteException {
1009        Parcel data = Parcel.obtain();
1010        data.writeInterfaceToken(IApplicationThread.descriptor);
1011        config.writeToParcel(data, 0);
1012        mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1013                IBinder.FLAG_ONEWAY);
1014        data.recycle();
1015    }
1016
1017    public void updateTimeZone() throws RemoteException {
1018        Parcel data = Parcel.obtain();
1019        data.writeInterfaceToken(IApplicationThread.descriptor);
1020        mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
1021                IBinder.FLAG_ONEWAY);
1022        data.recycle();
1023    }
1024
1025    public void clearDnsCache() throws RemoteException {
1026        Parcel data = Parcel.obtain();
1027        data.writeInterfaceToken(IApplicationThread.descriptor);
1028        mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
1029                IBinder.FLAG_ONEWAY);
1030        data.recycle();
1031    }
1032
1033    public void setHttpProxy(String proxy, String port, String exclList,
1034            Uri pacFileUrl) throws RemoteException {
1035        Parcel data = Parcel.obtain();
1036        data.writeInterfaceToken(IApplicationThread.descriptor);
1037        data.writeString(proxy);
1038        data.writeString(port);
1039        data.writeString(exclList);
1040        pacFileUrl.writeToParcel(data, 0);
1041        mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1042        data.recycle();
1043    }
1044
1045    public void processInBackground() throws RemoteException {
1046        Parcel data = Parcel.obtain();
1047        data.writeInterfaceToken(IApplicationThread.descriptor);
1048        mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
1049                IBinder.FLAG_ONEWAY);
1050        data.recycle();
1051    }
1052
1053    public void dumpService(FileDescriptor fd, IBinder token, String[] args)
1054            throws RemoteException {
1055        Parcel data = Parcel.obtain();
1056        data.writeInterfaceToken(IApplicationThread.descriptor);
1057        data.writeFileDescriptor(fd);
1058        data.writeStrongBinder(token);
1059        data.writeStringArray(args);
1060        mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1061        data.recycle();
1062    }
1063
1064    public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
1065            throws RemoteException {
1066        Parcel data = Parcel.obtain();
1067        data.writeInterfaceToken(IApplicationThread.descriptor);
1068        data.writeFileDescriptor(fd);
1069        data.writeStrongBinder(token);
1070        data.writeStringArray(args);
1071        mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1072        data.recycle();
1073    }
1074
1075    public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
1076            int resultCode, String dataStr, Bundle extras, boolean ordered,
1077            boolean sticky, int sendingUser, int processState) throws RemoteException {
1078        Parcel data = Parcel.obtain();
1079        data.writeInterfaceToken(IApplicationThread.descriptor);
1080        data.writeStrongBinder(receiver.asBinder());
1081        intent.writeToParcel(data, 0);
1082        data.writeInt(resultCode);
1083        data.writeString(dataStr);
1084        data.writeBundle(extras);
1085        data.writeInt(ordered ? 1 : 0);
1086        data.writeInt(sticky ? 1 : 0);
1087        data.writeInt(sendingUser);
1088        data.writeInt(processState);
1089        mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
1090                IBinder.FLAG_ONEWAY);
1091        data.recycle();
1092    }
1093
1094    public final void scheduleLowMemory() throws RemoteException {
1095        Parcel data = Parcel.obtain();
1096        data.writeInterfaceToken(IApplicationThread.descriptor);
1097        mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
1098                IBinder.FLAG_ONEWAY);
1099        data.recycle();
1100    }
1101
1102    public final void scheduleActivityConfigurationChanged(
1103            IBinder token) throws RemoteException {
1104        Parcel data = Parcel.obtain();
1105        data.writeInterfaceToken(IApplicationThread.descriptor);
1106        data.writeStrongBinder(token);
1107        mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1108                IBinder.FLAG_ONEWAY);
1109        data.recycle();
1110    }
1111
1112    public void profilerControl(boolean start, ProfilerInfo profilerInfo, int profileType)
1113            throws RemoteException {
1114        Parcel data = Parcel.obtain();
1115        data.writeInterfaceToken(IApplicationThread.descriptor);
1116        data.writeInt(start ? 1 : 0);
1117        data.writeInt(profileType);
1118        if (profilerInfo != null) {
1119            data.writeInt(1);
1120            profilerInfo.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1121        } else {
1122            data.writeInt(0);
1123        }
1124        mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
1125                IBinder.FLAG_ONEWAY);
1126        data.recycle();
1127    }
1128
1129    public void setSchedulingGroup(int group) throws RemoteException {
1130        Parcel data = Parcel.obtain();
1131        data.writeInterfaceToken(IApplicationThread.descriptor);
1132        data.writeInt(group);
1133        mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
1134                IBinder.FLAG_ONEWAY);
1135        data.recycle();
1136    }
1137
1138    public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1139        Parcel data = Parcel.obtain();
1140        data.writeInterfaceToken(IApplicationThread.descriptor);
1141        data.writeInt(cmd);
1142        data.writeStringArray(packages);
1143        mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1144                IBinder.FLAG_ONEWAY);
1145        data.recycle();
1146    }
1147
1148    public void scheduleCrash(String msg) throws RemoteException {
1149        Parcel data = Parcel.obtain();
1150        data.writeInterfaceToken(IApplicationThread.descriptor);
1151        data.writeString(msg);
1152        mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1153                IBinder.FLAG_ONEWAY);
1154        data.recycle();
1155    }
1156
1157    public void dumpHeap(boolean managed, String path,
1158            ParcelFileDescriptor fd) throws RemoteException {
1159        Parcel data = Parcel.obtain();
1160        data.writeInterfaceToken(IApplicationThread.descriptor);
1161        data.writeInt(managed ? 1 : 0);
1162        data.writeString(path);
1163        if (fd != null) {
1164            data.writeInt(1);
1165            fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1166        } else {
1167            data.writeInt(0);
1168        }
1169        mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1170                IBinder.FLAG_ONEWAY);
1171        data.recycle();
1172    }
1173
1174    public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
1175            throws RemoteException {
1176        Parcel data = Parcel.obtain();
1177        data.writeInterfaceToken(IApplicationThread.descriptor);
1178        data.writeFileDescriptor(fd);
1179        data.writeStrongBinder(token);
1180        data.writeString(prefix);
1181        data.writeStringArray(args);
1182        mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1183        data.recycle();
1184    }
1185
1186    public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1187        Parcel data = Parcel.obtain();
1188        data.writeInterfaceToken(IApplicationThread.descriptor);
1189        data.writeBundle(coreSettings);
1190        mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1191    }
1192
1193    public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1194            throws RemoteException {
1195        Parcel data = Parcel.obtain();
1196        data.writeInterfaceToken(IApplicationThread.descriptor);
1197        data.writeString(pkg);
1198        info.writeToParcel(data, 0);
1199        mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1200                IBinder.FLAG_ONEWAY);
1201    }
1202
1203    public void scheduleTrimMemory(int level) throws RemoteException {
1204        Parcel data = Parcel.obtain();
1205        data.writeInterfaceToken(IApplicationThread.descriptor);
1206        data.writeInt(level);
1207        mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1208                IBinder.FLAG_ONEWAY);
1209        data.recycle();
1210    }
1211
1212    public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
1213            boolean dumpInfo, boolean dumpDalvik, String[] args) throws RemoteException {
1214        Parcel data = Parcel.obtain();
1215        Parcel reply = Parcel.obtain();
1216        data.writeInterfaceToken(IApplicationThread.descriptor);
1217        data.writeFileDescriptor(fd);
1218        mem.writeToParcel(data, 0);
1219        data.writeInt(checkin ? 1 : 0);
1220        data.writeInt(dumpInfo ? 1 : 0);
1221        data.writeInt(dumpDalvik ? 1 : 0);
1222        data.writeStringArray(args);
1223        mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1224        reply.readException();
1225        data.recycle();
1226        reply.recycle();
1227    }
1228
1229    public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1230        Parcel data = Parcel.obtain();
1231        data.writeInterfaceToken(IApplicationThread.descriptor);
1232        data.writeFileDescriptor(fd);
1233        data.writeStringArray(args);
1234        mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1235        data.recycle();
1236    }
1237
1238    public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
1239        Parcel data = Parcel.obtain();
1240        data.writeInterfaceToken(IApplicationThread.descriptor);
1241        data.writeFileDescriptor(fd);
1242        data.writeStringArray(args);
1243        mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1244        data.recycle();
1245    }
1246
1247    @Override
1248    public void unstableProviderDied(IBinder provider) throws RemoteException {
1249        Parcel data = Parcel.obtain();
1250        data.writeInterfaceToken(IApplicationThread.descriptor);
1251        data.writeStrongBinder(provider);
1252        mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1253        data.recycle();
1254    }
1255
1256    @Override
1257    public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken,
1258            int requestType) throws RemoteException {
1259        Parcel data = Parcel.obtain();
1260        data.writeInterfaceToken(IApplicationThread.descriptor);
1261        data.writeStrongBinder(activityToken);
1262        data.writeStrongBinder(requestToken);
1263        data.writeInt(requestType);
1264        mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, null,
1265                IBinder.FLAG_ONEWAY);
1266        data.recycle();
1267    }
1268
1269    @Override
1270    public void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
1271            throws RemoteException {
1272        Parcel data = Parcel.obtain();
1273        data.writeInterfaceToken(IApplicationThread.descriptor);
1274        data.writeStrongBinder(token);
1275        data.writeInt(timeout ? 1 : 0);
1276        mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null,
1277                IBinder.FLAG_ONEWAY);
1278        data.recycle();
1279    }
1280
1281    @Override
1282    public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
1283            throws RemoteException {
1284        Parcel data = Parcel.obtain();
1285        data.writeInterfaceToken(IApplicationThread.descriptor);
1286        data.writeStrongBinder(token);
1287        data.writeBundle(options == null ? null : options.toBundle());
1288        mRemote.transact(SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION, data, null,
1289                IBinder.FLAG_ONEWAY);
1290        data.recycle();
1291    }
1292
1293    @Override
1294    public void setProcessState(int state) throws RemoteException {
1295        Parcel data = Parcel.obtain();
1296        data.writeInterfaceToken(IApplicationThread.descriptor);
1297        data.writeInt(state);
1298        mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1299        data.recycle();
1300    }
1301
1302    @Override
1303    public void scheduleInstallProvider(ProviderInfo provider) throws RemoteException {
1304        Parcel data = Parcel.obtain();
1305        data.writeInterfaceToken(IApplicationThread.descriptor);
1306        provider.writeToParcel(data, 0);
1307        mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1308        data.recycle();
1309    }
1310
1311    @Override
1312    public void updateTimePrefs(boolean is24Hour) throws RemoteException {
1313        Parcel data = Parcel.obtain();
1314        data.writeInterfaceToken(IApplicationThread.descriptor);
1315        data.writeByte(is24Hour ? (byte) 1 : (byte) 0);
1316        mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1317        data.recycle();
1318    }
1319
1320    @Override
1321    public void scheduleCancelVisibleBehind(IBinder token) throws RemoteException {
1322        Parcel data = Parcel.obtain();
1323        data.writeInterfaceToken(IApplicationThread.descriptor);
1324        data.writeStrongBinder(token);
1325        mRemote.transact(CANCEL_VISIBLE_BEHIND_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1326        data.recycle();
1327    }
1328
1329    @Override
1330    public void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled)
1331            throws RemoteException {
1332        Parcel data = Parcel.obtain();
1333        data.writeInterfaceToken(IApplicationThread.descriptor);
1334        data.writeStrongBinder(token);
1335        data.writeInt(enabled ? 1 : 0);
1336        mRemote.transact(BACKGROUND_VISIBLE_BEHIND_CHANGED_TRANSACTION, data, null,
1337                IBinder.FLAG_ONEWAY);
1338        data.recycle();
1339    }
1340
1341    @Override
1342    public void scheduleEnterAnimationComplete(IBinder token) throws RemoteException {
1343        Parcel data = Parcel.obtain();
1344        data.writeInterfaceToken(IApplicationThread.descriptor);
1345        data.writeStrongBinder(token);
1346        mRemote.transact(ENTER_ANIMATION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1347        data.recycle();
1348    }
1349}
1350