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