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