ApplicationThreadNative.java revision 8746a478abcfb3b0d73b156232051af1e8d21ce2
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        case STOP_MEDIA_PLAYING_TRANSACTION:
652        {
653            data.enforceInterface(IApplicationThread.descriptor);
654            IBinder token = data.readStrongBinder();
655            scheduleStopMediaPlaying(token);
656            reply.writeNoException();
657            return true;
658        }
659
660        case BACKGROUND_MEDIA_PLAYING_CHANGED_TRANSACTION:
661        {
662            data.enforceInterface(IApplicationThread.descriptor);
663            IBinder token = data.readStrongBinder();
664            boolean enabled = data.readInt() > 0;
665            scheduleBackgroundMediaPlayingChanged(token, enabled);
666            reply.writeNoException();
667            return true;
668        }
669
670        case ENTER_ANIMATION_COMPLETE_TRANSACTION:
671        {
672            data.enforceInterface(IApplicationThread.descriptor);
673            IBinder token = data.readStrongBinder();
674            scheduleEnterAnimationComplete(token);
675            reply.writeNoException();
676            return true;
677        }
678        }
679
680        return super.onTransact(code, data, reply, flags);
681    }
682
683    public IBinder asBinder()
684    {
685        return this;
686    }
687}
688
689class ApplicationThreadProxy implements IApplicationThread {
690    private final IBinder mRemote;
691
692    public ApplicationThreadProxy(IBinder remote) {
693        mRemote = remote;
694    }
695
696    public final IBinder asBinder() {
697        return mRemote;
698    }
699
700    public final void schedulePauseActivity(IBinder token, boolean finished,
701            boolean userLeaving, int configChanges) throws RemoteException {
702        Parcel data = Parcel.obtain();
703        data.writeInterfaceToken(IApplicationThread.descriptor);
704        data.writeStrongBinder(token);
705        data.writeInt(finished ? 1 : 0);
706        data.writeInt(userLeaving ? 1 :0);
707        data.writeInt(configChanges);
708        mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
709                IBinder.FLAG_ONEWAY);
710        data.recycle();
711    }
712
713    public final void scheduleStopActivity(IBinder token, boolean showWindow,
714            int configChanges) throws RemoteException {
715        Parcel data = Parcel.obtain();
716        data.writeInterfaceToken(IApplicationThread.descriptor);
717        data.writeStrongBinder(token);
718        data.writeInt(showWindow ? 1 : 0);
719        data.writeInt(configChanges);
720        mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
721                IBinder.FLAG_ONEWAY);
722        data.recycle();
723    }
724
725    public final void scheduleWindowVisibility(IBinder token,
726            boolean showWindow) throws RemoteException {
727        Parcel data = Parcel.obtain();
728        data.writeInterfaceToken(IApplicationThread.descriptor);
729        data.writeStrongBinder(token);
730        data.writeInt(showWindow ? 1 : 0);
731        mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
732                IBinder.FLAG_ONEWAY);
733        data.recycle();
734    }
735
736    public final void scheduleSleeping(IBinder token,
737            boolean sleeping) throws RemoteException {
738        Parcel data = Parcel.obtain();
739        data.writeInterfaceToken(IApplicationThread.descriptor);
740        data.writeStrongBinder(token);
741        data.writeInt(sleeping ? 1 : 0);
742        mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
743                IBinder.FLAG_ONEWAY);
744        data.recycle();
745    }
746
747    public final void scheduleResumeActivity(IBinder token, int procState, boolean isForward,
748            Bundle resumeArgs)
749            throws RemoteException {
750        Parcel data = Parcel.obtain();
751        data.writeInterfaceToken(IApplicationThread.descriptor);
752        data.writeStrongBinder(token);
753        data.writeInt(procState);
754        data.writeInt(isForward ? 1 : 0);
755        data.writeBundle(resumeArgs);
756        mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
757                IBinder.FLAG_ONEWAY);
758        data.recycle();
759    }
760
761    public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
762            throws RemoteException {
763        Parcel data = Parcel.obtain();
764        data.writeInterfaceToken(IApplicationThread.descriptor);
765        data.writeStrongBinder(token);
766        data.writeTypedList(results);
767        mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
768                IBinder.FLAG_ONEWAY);
769        data.recycle();
770    }
771
772    public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
773            ActivityInfo info, Configuration curConfig, CompatibilityInfo compatInfo,
774            IVoiceInteractor voiceInteractor, int procState, Bundle state,
775            PersistableBundle persistentState, List<ResultInfo> pendingResults,
776            List<Intent> pendingNewIntents, boolean notResumed, boolean isForward,
777            String profileName, ParcelFileDescriptor profileFd, boolean autoStopProfiler)
778            throws RemoteException {
779        Parcel data = Parcel.obtain();
780        data.writeInterfaceToken(IApplicationThread.descriptor);
781        intent.writeToParcel(data, 0);
782        data.writeStrongBinder(token);
783        data.writeInt(ident);
784        info.writeToParcel(data, 0);
785        curConfig.writeToParcel(data, 0);
786        compatInfo.writeToParcel(data, 0);
787        data.writeStrongBinder(voiceInteractor != null ? voiceInteractor.asBinder() : null);
788        data.writeInt(procState);
789        data.writeBundle(state);
790        data.writePersistableBundle(persistentState);
791        data.writeTypedList(pendingResults);
792        data.writeTypedList(pendingNewIntents);
793        data.writeInt(notResumed ? 1 : 0);
794        data.writeInt(isForward ? 1 : 0);
795        data.writeString(profileName);
796        if (profileFd != null) {
797            data.writeInt(1);
798            profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
799        } else {
800            data.writeInt(0);
801        }
802        data.writeInt(autoStopProfiler ? 1 : 0);
803        mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
804                IBinder.FLAG_ONEWAY);
805        data.recycle();
806    }
807
808    public final void scheduleRelaunchActivity(IBinder token,
809            List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
810            int configChanges, boolean notResumed, Configuration config)
811            throws RemoteException {
812        Parcel data = Parcel.obtain();
813        data.writeInterfaceToken(IApplicationThread.descriptor);
814        data.writeStrongBinder(token);
815        data.writeTypedList(pendingResults);
816        data.writeTypedList(pendingNewIntents);
817        data.writeInt(configChanges);
818        data.writeInt(notResumed ? 1 : 0);
819        if (config != null) {
820            data.writeInt(1);
821            config.writeToParcel(data, 0);
822        } else {
823            data.writeInt(0);
824        }
825        mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
826                IBinder.FLAG_ONEWAY);
827        data.recycle();
828    }
829
830    public void scheduleNewIntent(List<Intent> intents, IBinder token)
831            throws RemoteException {
832        Parcel data = Parcel.obtain();
833        data.writeInterfaceToken(IApplicationThread.descriptor);
834        data.writeTypedList(intents);
835        data.writeStrongBinder(token);
836        mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
837                IBinder.FLAG_ONEWAY);
838        data.recycle();
839    }
840
841    public final void scheduleDestroyActivity(IBinder token, boolean finishing,
842            int configChanges) throws RemoteException {
843        Parcel data = Parcel.obtain();
844        data.writeInterfaceToken(IApplicationThread.descriptor);
845        data.writeStrongBinder(token);
846        data.writeInt(finishing ? 1 : 0);
847        data.writeInt(configChanges);
848        mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
849                IBinder.FLAG_ONEWAY);
850        data.recycle();
851    }
852
853    public final void scheduleReceiver(Intent intent, ActivityInfo info,
854            CompatibilityInfo compatInfo, int resultCode, String resultData,
855            Bundle map, boolean sync, int sendingUser, int processState) throws RemoteException {
856        Parcel data = Parcel.obtain();
857        data.writeInterfaceToken(IApplicationThread.descriptor);
858        intent.writeToParcel(data, 0);
859        info.writeToParcel(data, 0);
860        compatInfo.writeToParcel(data, 0);
861        data.writeInt(resultCode);
862        data.writeString(resultData);
863        data.writeBundle(map);
864        data.writeInt(sync ? 1 : 0);
865        data.writeInt(sendingUser);
866        data.writeInt(processState);
867        mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
868                IBinder.FLAG_ONEWAY);
869        data.recycle();
870    }
871
872    public final void scheduleCreateBackupAgent(ApplicationInfo app,
873            CompatibilityInfo compatInfo, int backupMode) throws RemoteException {
874        Parcel data = Parcel.obtain();
875        data.writeInterfaceToken(IApplicationThread.descriptor);
876        app.writeToParcel(data, 0);
877        compatInfo.writeToParcel(data, 0);
878        data.writeInt(backupMode);
879        mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
880                IBinder.FLAG_ONEWAY);
881        data.recycle();
882    }
883
884    public final void scheduleDestroyBackupAgent(ApplicationInfo app,
885            CompatibilityInfo compatInfo) throws RemoteException {
886        Parcel data = Parcel.obtain();
887        data.writeInterfaceToken(IApplicationThread.descriptor);
888        app.writeToParcel(data, 0);
889        compatInfo.writeToParcel(data, 0);
890        mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
891                IBinder.FLAG_ONEWAY);
892        data.recycle();
893    }
894
895    public final void scheduleCreateService(IBinder token, ServiceInfo info,
896            CompatibilityInfo compatInfo, int processState) throws RemoteException {
897        Parcel data = Parcel.obtain();
898        data.writeInterfaceToken(IApplicationThread.descriptor);
899        data.writeStrongBinder(token);
900        info.writeToParcel(data, 0);
901        compatInfo.writeToParcel(data, 0);
902        data.writeInt(processState);
903        mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
904                IBinder.FLAG_ONEWAY);
905        data.recycle();
906    }
907
908    public final void scheduleBindService(IBinder token, Intent intent, boolean rebind,
909            int processState) throws RemoteException {
910        Parcel data = Parcel.obtain();
911        data.writeInterfaceToken(IApplicationThread.descriptor);
912        data.writeStrongBinder(token);
913        intent.writeToParcel(data, 0);
914        data.writeInt(rebind ? 1 : 0);
915        data.writeInt(processState);
916        mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
917                IBinder.FLAG_ONEWAY);
918        data.recycle();
919    }
920
921    public final void scheduleUnbindService(IBinder token, Intent intent)
922            throws RemoteException {
923        Parcel data = Parcel.obtain();
924        data.writeInterfaceToken(IApplicationThread.descriptor);
925        data.writeStrongBinder(token);
926        intent.writeToParcel(data, 0);
927        mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
928                IBinder.FLAG_ONEWAY);
929        data.recycle();
930    }
931
932    public final void scheduleServiceArgs(IBinder token, boolean taskRemoved, int startId,
933            int flags, Intent args) throws RemoteException {
934        Parcel data = Parcel.obtain();
935        data.writeInterfaceToken(IApplicationThread.descriptor);
936        data.writeStrongBinder(token);
937        data.writeInt(taskRemoved ? 1 : 0);
938        data.writeInt(startId);
939        data.writeInt(flags);
940        if (args != null) {
941            data.writeInt(1);
942            args.writeToParcel(data, 0);
943        } else {
944            data.writeInt(0);
945        }
946        mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
947                IBinder.FLAG_ONEWAY);
948        data.recycle();
949    }
950
951    public final void scheduleStopService(IBinder token)
952            throws RemoteException {
953        Parcel data = Parcel.obtain();
954        data.writeInterfaceToken(IApplicationThread.descriptor);
955        data.writeStrongBinder(token);
956        mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
957                IBinder.FLAG_ONEWAY);
958        data.recycle();
959    }
960
961    public final void bindApplication(String packageName, ApplicationInfo info,
962            List<ProviderInfo> providers, ComponentName testName, String profileName,
963            ParcelFileDescriptor profileFd, boolean autoStopProfiler, Bundle testArgs,
964            IInstrumentationWatcher testWatcher,
965            IUiAutomationConnection uiAutomationConnection, int debugMode,
966            boolean openGlTrace, boolean restrictedBackupMode, boolean persistent,
967            Configuration config, CompatibilityInfo compatInfo, Map<String, IBinder> services,
968            Bundle coreSettings) throws RemoteException {
969        Parcel data = Parcel.obtain();
970        data.writeInterfaceToken(IApplicationThread.descriptor);
971        data.writeString(packageName);
972        info.writeToParcel(data, 0);
973        data.writeTypedList(providers);
974        if (testName == null) {
975            data.writeInt(0);
976        } else {
977            data.writeInt(1);
978            testName.writeToParcel(data, 0);
979        }
980        data.writeString(profileName);
981        if (profileFd != null) {
982            data.writeInt(1);
983            profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
984        } else {
985            data.writeInt(0);
986        }
987        data.writeInt(autoStopProfiler ? 1 : 0);
988        data.writeBundle(testArgs);
989        data.writeStrongInterface(testWatcher);
990        data.writeStrongInterface(uiAutomationConnection);
991        data.writeInt(debugMode);
992        data.writeInt(openGlTrace ? 1 : 0);
993        data.writeInt(restrictedBackupMode ? 1 : 0);
994        data.writeInt(persistent ? 1 : 0);
995        config.writeToParcel(data, 0);
996        compatInfo.writeToParcel(data, 0);
997        data.writeMap(services);
998        data.writeBundle(coreSettings);
999        mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
1000                IBinder.FLAG_ONEWAY);
1001        data.recycle();
1002    }
1003
1004    public final void scheduleExit() throws RemoteException {
1005        Parcel data = Parcel.obtain();
1006        data.writeInterfaceToken(IApplicationThread.descriptor);
1007        mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
1008                IBinder.FLAG_ONEWAY);
1009        data.recycle();
1010    }
1011
1012    public final void scheduleSuicide() throws RemoteException {
1013        Parcel data = Parcel.obtain();
1014        data.writeInterfaceToken(IApplicationThread.descriptor);
1015        mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
1016                IBinder.FLAG_ONEWAY);
1017        data.recycle();
1018    }
1019
1020    public final void scheduleConfigurationChanged(Configuration config)
1021            throws RemoteException {
1022        Parcel data = Parcel.obtain();
1023        data.writeInterfaceToken(IApplicationThread.descriptor);
1024        config.writeToParcel(data, 0);
1025        mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1026                IBinder.FLAG_ONEWAY);
1027        data.recycle();
1028    }
1029
1030    public void updateTimeZone() throws RemoteException {
1031        Parcel data = Parcel.obtain();
1032        data.writeInterfaceToken(IApplicationThread.descriptor);
1033        mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
1034                IBinder.FLAG_ONEWAY);
1035        data.recycle();
1036    }
1037
1038    public void clearDnsCache() throws RemoteException {
1039        Parcel data = Parcel.obtain();
1040        data.writeInterfaceToken(IApplicationThread.descriptor);
1041        mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
1042                IBinder.FLAG_ONEWAY);
1043        data.recycle();
1044    }
1045
1046    public void setHttpProxy(String proxy, String port, String exclList,
1047            Uri pacFileUrl) throws RemoteException {
1048        Parcel data = Parcel.obtain();
1049        data.writeInterfaceToken(IApplicationThread.descriptor);
1050        data.writeString(proxy);
1051        data.writeString(port);
1052        data.writeString(exclList);
1053        pacFileUrl.writeToParcel(data, 0);
1054        mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1055        data.recycle();
1056    }
1057
1058    public void processInBackground() throws RemoteException {
1059        Parcel data = Parcel.obtain();
1060        data.writeInterfaceToken(IApplicationThread.descriptor);
1061        mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
1062                IBinder.FLAG_ONEWAY);
1063        data.recycle();
1064    }
1065
1066    public void dumpService(FileDescriptor fd, IBinder token, String[] args)
1067            throws RemoteException {
1068        Parcel data = Parcel.obtain();
1069        data.writeInterfaceToken(IApplicationThread.descriptor);
1070        data.writeFileDescriptor(fd);
1071        data.writeStrongBinder(token);
1072        data.writeStringArray(args);
1073        mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1074        data.recycle();
1075    }
1076
1077    public void dumpProvider(FileDescriptor fd, IBinder token, String[] args)
1078            throws RemoteException {
1079        Parcel data = Parcel.obtain();
1080        data.writeInterfaceToken(IApplicationThread.descriptor);
1081        data.writeFileDescriptor(fd);
1082        data.writeStrongBinder(token);
1083        data.writeStringArray(args);
1084        mRemote.transact(DUMP_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1085        data.recycle();
1086    }
1087
1088    public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
1089            int resultCode, String dataStr, Bundle extras, boolean ordered,
1090            boolean sticky, int sendingUser, int processState) throws RemoteException {
1091        Parcel data = Parcel.obtain();
1092        data.writeInterfaceToken(IApplicationThread.descriptor);
1093        data.writeStrongBinder(receiver.asBinder());
1094        intent.writeToParcel(data, 0);
1095        data.writeInt(resultCode);
1096        data.writeString(dataStr);
1097        data.writeBundle(extras);
1098        data.writeInt(ordered ? 1 : 0);
1099        data.writeInt(sticky ? 1 : 0);
1100        data.writeInt(sendingUser);
1101        data.writeInt(processState);
1102        mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
1103                IBinder.FLAG_ONEWAY);
1104        data.recycle();
1105    }
1106
1107    public final void scheduleLowMemory() throws RemoteException {
1108        Parcel data = Parcel.obtain();
1109        data.writeInterfaceToken(IApplicationThread.descriptor);
1110        mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
1111                IBinder.FLAG_ONEWAY);
1112        data.recycle();
1113    }
1114
1115    public final void scheduleActivityConfigurationChanged(
1116            IBinder token) throws RemoteException {
1117        Parcel data = Parcel.obtain();
1118        data.writeInterfaceToken(IApplicationThread.descriptor);
1119        data.writeStrongBinder(token);
1120        mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
1121                IBinder.FLAG_ONEWAY);
1122        data.recycle();
1123    }
1124
1125    public void profilerControl(boolean start, String path,
1126            ParcelFileDescriptor fd, int profileType) throws RemoteException {
1127        Parcel data = Parcel.obtain();
1128        data.writeInterfaceToken(IApplicationThread.descriptor);
1129        data.writeInt(start ? 1 : 0);
1130        data.writeInt(profileType);
1131        data.writeString(path);
1132        if (fd != null) {
1133            data.writeInt(1);
1134            fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1135        } else {
1136            data.writeInt(0);
1137        }
1138        mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
1139                IBinder.FLAG_ONEWAY);
1140        data.recycle();
1141    }
1142
1143    public void setSchedulingGroup(int group) throws RemoteException {
1144        Parcel data = Parcel.obtain();
1145        data.writeInterfaceToken(IApplicationThread.descriptor);
1146        data.writeInt(group);
1147        mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
1148                IBinder.FLAG_ONEWAY);
1149        data.recycle();
1150    }
1151
1152    public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
1153        Parcel data = Parcel.obtain();
1154        data.writeInterfaceToken(IApplicationThread.descriptor);
1155        data.writeInt(cmd);
1156        data.writeStringArray(packages);
1157        mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
1158                IBinder.FLAG_ONEWAY);
1159        data.recycle();
1160
1161    }
1162
1163    public void scheduleCrash(String msg) throws RemoteException {
1164        Parcel data = Parcel.obtain();
1165        data.writeInterfaceToken(IApplicationThread.descriptor);
1166        data.writeString(msg);
1167        mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
1168                IBinder.FLAG_ONEWAY);
1169        data.recycle();
1170
1171    }
1172
1173    public void dumpHeap(boolean managed, String path,
1174            ParcelFileDescriptor fd) throws RemoteException {
1175        Parcel data = Parcel.obtain();
1176        data.writeInterfaceToken(IApplicationThread.descriptor);
1177        data.writeInt(managed ? 1 : 0);
1178        data.writeString(path);
1179        if (fd != null) {
1180            data.writeInt(1);
1181            fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1182        } else {
1183            data.writeInt(0);
1184        }
1185        mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
1186                IBinder.FLAG_ONEWAY);
1187        data.recycle();
1188    }
1189
1190    public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
1191            throws RemoteException {
1192        Parcel data = Parcel.obtain();
1193        data.writeInterfaceToken(IApplicationThread.descriptor);
1194        data.writeFileDescriptor(fd);
1195        data.writeStrongBinder(token);
1196        data.writeString(prefix);
1197        data.writeStringArray(args);
1198        mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1199        data.recycle();
1200    }
1201
1202    public void setCoreSettings(Bundle coreSettings) throws RemoteException {
1203        Parcel data = Parcel.obtain();
1204        data.writeInterfaceToken(IApplicationThread.descriptor);
1205        data.writeBundle(coreSettings);
1206        mRemote.transact(SET_CORE_SETTINGS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1207    }
1208
1209    public void updatePackageCompatibilityInfo(String pkg, CompatibilityInfo info)
1210            throws RemoteException {
1211        Parcel data = Parcel.obtain();
1212        data.writeInterfaceToken(IApplicationThread.descriptor);
1213        data.writeString(pkg);
1214        info.writeToParcel(data, 0);
1215        mRemote.transact(UPDATE_PACKAGE_COMPATIBILITY_INFO_TRANSACTION, data, null,
1216                IBinder.FLAG_ONEWAY);
1217    }
1218
1219    public void scheduleTrimMemory(int level) throws RemoteException {
1220        Parcel data = Parcel.obtain();
1221        data.writeInterfaceToken(IApplicationThread.descriptor);
1222        data.writeInt(level);
1223        mRemote.transact(SCHEDULE_TRIM_MEMORY_TRANSACTION, data, null,
1224                IBinder.FLAG_ONEWAY);
1225        data.recycle();
1226    }
1227
1228    public void dumpMemInfo(FileDescriptor fd, Debug.MemoryInfo mem, boolean checkin,
1229            boolean dumpInfo, boolean dumpDalvik, String[] args) throws RemoteException {
1230        Parcel data = Parcel.obtain();
1231        Parcel reply = Parcel.obtain();
1232        data.writeInterfaceToken(IApplicationThread.descriptor);
1233        data.writeFileDescriptor(fd);
1234        mem.writeToParcel(data, 0);
1235        data.writeInt(checkin ? 1 : 0);
1236        data.writeInt(dumpInfo ? 1 : 0);
1237        data.writeInt(dumpDalvik ? 1 : 0);
1238        data.writeStringArray(args);
1239        mRemote.transact(DUMP_MEM_INFO_TRANSACTION, data, reply, 0);
1240        reply.readException();
1241        data.recycle();
1242        reply.recycle();
1243    }
1244
1245    public void dumpGfxInfo(FileDescriptor fd, String[] args) throws RemoteException {
1246        Parcel data = Parcel.obtain();
1247        data.writeInterfaceToken(IApplicationThread.descriptor);
1248        data.writeFileDescriptor(fd);
1249        data.writeStringArray(args);
1250        mRemote.transact(DUMP_GFX_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1251        data.recycle();
1252    }
1253
1254    public void dumpDbInfo(FileDescriptor fd, String[] args) throws RemoteException {
1255        Parcel data = Parcel.obtain();
1256        data.writeInterfaceToken(IApplicationThread.descriptor);
1257        data.writeFileDescriptor(fd);
1258        data.writeStringArray(args);
1259        mRemote.transact(DUMP_DB_INFO_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1260        data.recycle();
1261    }
1262
1263    @Override
1264    public void unstableProviderDied(IBinder provider) throws RemoteException {
1265        Parcel data = Parcel.obtain();
1266        data.writeInterfaceToken(IApplicationThread.descriptor);
1267        data.writeStrongBinder(provider);
1268        mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1269        data.recycle();
1270    }
1271
1272    @Override
1273    public void requestAssistContextExtras(IBinder activityToken, IBinder requestToken,
1274            int requestType) throws RemoteException {
1275        Parcel data = Parcel.obtain();
1276        data.writeInterfaceToken(IApplicationThread.descriptor);
1277        data.writeStrongBinder(activityToken);
1278        data.writeStrongBinder(requestToken);
1279        data.writeInt(requestType);
1280        mRemote.transact(REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, null,
1281                IBinder.FLAG_ONEWAY);
1282        data.recycle();
1283    }
1284
1285    @Override
1286    public void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
1287            throws RemoteException {
1288        Parcel data = Parcel.obtain();
1289        data.writeInterfaceToken(IApplicationThread.descriptor);
1290        data.writeStrongBinder(token);
1291        data.writeInt(timeout ? 1 : 0);
1292        mRemote.transact(SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION, data, null,
1293                IBinder.FLAG_ONEWAY);
1294        data.recycle();
1295    }
1296
1297    @Override
1298    public void scheduleOnNewActivityOptions(IBinder token, ActivityOptions options)
1299            throws RemoteException {
1300        Parcel data = Parcel.obtain();
1301        data.writeInterfaceToken(IApplicationThread.descriptor);
1302        data.writeStrongBinder(token);
1303        data.writeBundle(options == null ? null : options.toBundle());
1304        mRemote.transact(SCHEDULE_ON_NEW_ACTIVITY_OPTIONS_TRANSACTION, data, null,
1305                IBinder.FLAG_ONEWAY);
1306        data.recycle();
1307    }
1308
1309    @Override
1310    public void setProcessState(int state) throws RemoteException {
1311        Parcel data = Parcel.obtain();
1312        data.writeInterfaceToken(IApplicationThread.descriptor);
1313        data.writeInt(state);
1314        mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1315        data.recycle();
1316    }
1317
1318    @Override
1319    public void scheduleInstallProvider(ProviderInfo provider) throws RemoteException {
1320        Parcel data = Parcel.obtain();
1321        data.writeInterfaceToken(IApplicationThread.descriptor);
1322        provider.writeToParcel(data, 0);
1323        mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1324        data.recycle();
1325    }
1326
1327    @Override
1328    public void updateTimePrefs(boolean is24Hour) throws RemoteException {
1329        Parcel data = Parcel.obtain();
1330        data.writeInterfaceToken(IApplicationThread.descriptor);
1331        data.writeByte(is24Hour ? (byte) 1 : (byte) 0);
1332        mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1333        data.recycle();
1334    }
1335
1336    @Override
1337    public void scheduleStopMediaPlaying(IBinder token) throws RemoteException {
1338        Parcel data = Parcel.obtain();
1339        data.writeInterfaceToken(IApplicationThread.descriptor);
1340        data.writeStrongBinder(token);
1341        mRemote.transact(STOP_MEDIA_PLAYING_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1342        data.recycle();
1343    }
1344
1345    @Override
1346    public void scheduleBackgroundMediaPlayingChanged(IBinder token, boolean enabled) throws RemoteException {
1347        Parcel data = Parcel.obtain();
1348        data.writeInterfaceToken(IApplicationThread.descriptor);
1349        data.writeStrongBinder(token);
1350        data.writeInt(enabled ? 1 : 0);
1351        mRemote.transact(BACKGROUND_MEDIA_PLAYING_CHANGED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1352        data.recycle();
1353    }
1354
1355    @Override
1356    public void scheduleEnterAnimationComplete(IBinder token) throws RemoteException {
1357        Parcel data = Parcel.obtain();
1358        data.writeInterfaceToken(IApplicationThread.descriptor);
1359        data.writeStrongBinder(token);
1360        mRemote.transact(ENTER_ANIMATION_COMPLETE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
1361        data.recycle();
1362    }
1363}
1364