ApplicationThreadNative.java revision 1ccac75e1f1b97eccb916a8de04fc1012b30f6e5
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.Configuration;
27import android.os.Binder;
28import android.os.Bundle;
29import android.os.RemoteException;
30import android.os.IBinder;
31import android.os.Parcel;
32import android.os.ParcelFileDescriptor;
33
34import java.io.FileDescriptor;
35import java.io.IOException;
36import java.util.HashMap;
37import java.util.List;
38import java.util.Map;
39
40/** {@hide} */
41public abstract class ApplicationThreadNative extends Binder
42        implements IApplicationThread {
43    /**
44     * Cast a Binder object into an application thread interface, generating
45     * a proxy if needed.
46     */
47    static public IApplicationThread asInterface(IBinder obj) {
48        if (obj == null) {
49            return null;
50        }
51        IApplicationThread in =
52            (IApplicationThread)obj.queryLocalInterface(descriptor);
53        if (in != null) {
54            return in;
55        }
56
57        return new ApplicationThreadProxy(obj);
58    }
59
60    public ApplicationThreadNative() {
61        attachInterface(this, descriptor);
62    }
63
64    @Override
65    public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
66            throws RemoteException {
67        switch (code) {
68        case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION:
69        {
70            data.enforceInterface(IApplicationThread.descriptor);
71            IBinder b = data.readStrongBinder();
72            boolean finished = data.readInt() != 0;
73            boolean userLeaving = data.readInt() != 0;
74            int configChanges = data.readInt();
75            schedulePauseActivity(b, finished, userLeaving, configChanges);
76            return true;
77        }
78
79        case SCHEDULE_STOP_ACTIVITY_TRANSACTION:
80        {
81            data.enforceInterface(IApplicationThread.descriptor);
82            IBinder b = data.readStrongBinder();
83            boolean show = data.readInt() != 0;
84            int configChanges = data.readInt();
85            scheduleStopActivity(b, show, configChanges);
86            return true;
87        }
88
89        case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION:
90        {
91            data.enforceInterface(IApplicationThread.descriptor);
92            IBinder b = data.readStrongBinder();
93            boolean show = data.readInt() != 0;
94            scheduleWindowVisibility(b, show);
95            return true;
96        }
97
98        case SCHEDULE_RESUME_ACTIVITY_TRANSACTION:
99        {
100            data.enforceInterface(IApplicationThread.descriptor);
101            IBinder b = data.readStrongBinder();
102            boolean isForward = data.readInt() != 0;
103            scheduleResumeActivity(b, isForward);
104            return true;
105        }
106
107        case SCHEDULE_SEND_RESULT_TRANSACTION:
108        {
109            data.enforceInterface(IApplicationThread.descriptor);
110            IBinder b = data.readStrongBinder();
111            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
112            scheduleSendResult(b, ri);
113            return true;
114        }
115
116        case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
117        {
118            data.enforceInterface(IApplicationThread.descriptor);
119            Intent intent = Intent.CREATOR.createFromParcel(data);
120            IBinder b = data.readStrongBinder();
121            ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
122            Bundle state = data.readBundle();
123            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
124            List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
125            boolean notResumed = data.readInt() != 0;
126            boolean isForward = data.readInt() != 0;
127            scheduleLaunchActivity(intent, b, info, state, ri, pi, notResumed, isForward);
128            return true;
129        }
130
131        case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
132        {
133            data.enforceInterface(IApplicationThread.descriptor);
134            IBinder b = data.readStrongBinder();
135            List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
136            List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
137            int configChanges = data.readInt();
138            boolean notResumed = data.readInt() != 0;
139            scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed);
140            return true;
141        }
142
143        case SCHEDULE_NEW_INTENT_TRANSACTION:
144        {
145            data.enforceInterface(IApplicationThread.descriptor);
146            List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
147            IBinder b = data.readStrongBinder();
148            scheduleNewIntent(pi, b);
149            return true;
150        }
151
152        case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
153        {
154            data.enforceInterface(IApplicationThread.descriptor);
155            IBinder b = data.readStrongBinder();
156            boolean finishing = data.readInt() != 0;
157            int configChanges = data.readInt();
158            scheduleDestroyActivity(b, finishing, configChanges);
159            return true;
160        }
161
162        case SCHEDULE_RECEIVER_TRANSACTION:
163        {
164            data.enforceInterface(IApplicationThread.descriptor);
165            Intent intent = Intent.CREATOR.createFromParcel(data);
166            ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
167            int resultCode = data.readInt();
168            String resultData = data.readString();
169            Bundle resultExtras = data.readBundle();
170            boolean sync = data.readInt() != 0;
171            scheduleReceiver(intent, info, resultCode, resultData,
172                    resultExtras, sync);
173            return true;
174        }
175
176        case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
177            data.enforceInterface(IApplicationThread.descriptor);
178            IBinder token = data.readStrongBinder();
179            ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
180            scheduleCreateService(token, info);
181            return true;
182        }
183
184        case SCHEDULE_BIND_SERVICE_TRANSACTION: {
185            data.enforceInterface(IApplicationThread.descriptor);
186            IBinder token = data.readStrongBinder();
187            Intent intent = Intent.CREATOR.createFromParcel(data);
188            boolean rebind = data.readInt() != 0;
189            scheduleBindService(token, intent, rebind);
190            return true;
191        }
192
193        case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
194            data.enforceInterface(IApplicationThread.descriptor);
195            IBinder token = data.readStrongBinder();
196            Intent intent = Intent.CREATOR.createFromParcel(data);
197            scheduleUnbindService(token, intent);
198            return true;
199        }
200
201        case SCHEDULE_SERVICE_ARGS_TRANSACTION:
202        {
203            data.enforceInterface(IApplicationThread.descriptor);
204            IBinder token = data.readStrongBinder();
205            int startId = data.readInt();
206            Intent args = Intent.CREATOR.createFromParcel(data);
207            scheduleServiceArgs(token, startId, args);
208            return true;
209        }
210
211        case SCHEDULE_STOP_SERVICE_TRANSACTION:
212        {
213            data.enforceInterface(IApplicationThread.descriptor);
214            IBinder token = data.readStrongBinder();
215            scheduleStopService(token);
216            return true;
217        }
218
219        case BIND_APPLICATION_TRANSACTION:
220        {
221            data.enforceInterface(IApplicationThread.descriptor);
222            String packageName = data.readString();
223            ApplicationInfo info =
224                ApplicationInfo.CREATOR.createFromParcel(data);
225            List<ProviderInfo> providers =
226                data.createTypedArrayList(ProviderInfo.CREATOR);
227            ComponentName testName = (data.readInt() != 0)
228                ? new ComponentName(data) : null;
229            String profileName = data.readString();
230            Bundle testArgs = data.readBundle();
231            IBinder binder = data.readStrongBinder();
232            IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
233            int testMode = data.readInt();
234            boolean restrictedBackupMode = (data.readInt() != 0);
235            Configuration config = Configuration.CREATOR.createFromParcel(data);
236            HashMap<String, IBinder> services = data.readHashMap(null);
237            bindApplication(packageName, info,
238                            providers, testName, profileName,
239                            testArgs, testWatcher, testMode, restrictedBackupMode,
240                            config, services);
241            return true;
242        }
243
244        case SCHEDULE_EXIT_TRANSACTION:
245        {
246            data.enforceInterface(IApplicationThread.descriptor);
247            scheduleExit();
248            return true;
249        }
250
251        case REQUEST_THUMBNAIL_TRANSACTION:
252        {
253            data.enforceInterface(IApplicationThread.descriptor);
254            IBinder b = data.readStrongBinder();
255            requestThumbnail(b);
256            return true;
257        }
258
259        case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
260        {
261            data.enforceInterface(IApplicationThread.descriptor);
262            Configuration config = Configuration.CREATOR.createFromParcel(data);
263            scheduleConfigurationChanged(config);
264            return true;
265        }
266
267        case UPDATE_TIME_ZONE_TRANSACTION: {
268            data.enforceInterface(IApplicationThread.descriptor);
269            updateTimeZone();
270            return true;
271        }
272
273        case PROCESS_IN_BACKGROUND_TRANSACTION: {
274            data.enforceInterface(IApplicationThread.descriptor);
275            processInBackground();
276            return true;
277        }
278
279        case DUMP_SERVICE_TRANSACTION: {
280            data.enforceInterface(IApplicationThread.descriptor);
281            ParcelFileDescriptor fd = data.readFileDescriptor();
282            final IBinder service = data.readStrongBinder();
283            final String[] args = data.readStringArray();
284            if (fd != null) {
285                dumpService(fd.getFileDescriptor(), service, args);
286                try {
287                    fd.close();
288                } catch (IOException e) {
289                }
290            }
291            return true;
292        }
293
294        case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
295            data.enforceInterface(IApplicationThread.descriptor);
296            IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
297                    data.readStrongBinder());
298            Intent intent = Intent.CREATOR.createFromParcel(data);
299            int resultCode = data.readInt();
300            String dataStr = data.readString();
301            Bundle extras = data.readBundle();
302            boolean ordered = data.readInt() != 0;
303            scheduleRegisteredReceiver(receiver, intent,
304                    resultCode, dataStr, extras, ordered);
305            return true;
306        }
307
308        case SCHEDULE_LOW_MEMORY_TRANSACTION:
309        {
310            scheduleLowMemory();
311            return true;
312        }
313
314        case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
315        {
316            data.enforceInterface(IApplicationThread.descriptor);
317            IBinder b = data.readStrongBinder();
318            scheduleActivityConfigurationChanged(b);
319            return true;
320        }
321
322        case REQUEST_PSS_TRANSACTION:
323        {
324            data.enforceInterface(IApplicationThread.descriptor);
325            requestPss();
326            return true;
327        }
328
329        case PROFILER_CONTROL_TRANSACTION:
330        {
331            data.enforceInterface(IApplicationThread.descriptor);
332            boolean start = data.readInt() != 0;
333            String path = data.readString();
334            profilerControl(start, path);
335            return true;
336        }
337
338        case SET_SCHEDULING_GROUP_TRANSACTION:
339        {
340            data.enforceInterface(IApplicationThread.descriptor);
341            int group = data.readInt();
342            setSchedulingGroup(group);
343            return true;
344        }
345
346        case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
347        {
348            data.enforceInterface(IApplicationThread.descriptor);
349            ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
350            int backupMode = data.readInt();
351            scheduleCreateBackupAgent(appInfo, backupMode);
352            return true;
353        }
354
355        case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
356        {
357            data.enforceInterface(IApplicationThread.descriptor);
358            ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
359            scheduleDestroyBackupAgent(appInfo);
360            return true;
361        }
362        }
363
364        return super.onTransact(code, data, reply, flags);
365    }
366
367    public IBinder asBinder()
368    {
369        return this;
370    }
371}
372
373class ApplicationThreadProxy implements IApplicationThread {
374    private final IBinder mRemote;
375
376    public ApplicationThreadProxy(IBinder remote) {
377        mRemote = remote;
378    }
379
380    public final IBinder asBinder() {
381        return mRemote;
382    }
383
384    public final void schedulePauseActivity(IBinder token, boolean finished,
385            boolean userLeaving, int configChanges) throws RemoteException {
386        Parcel data = Parcel.obtain();
387        data.writeInterfaceToken(IApplicationThread.descriptor);
388        data.writeStrongBinder(token);
389        data.writeInt(finished ? 1 : 0);
390        data.writeInt(userLeaving ? 1 :0);
391        data.writeInt(configChanges);
392        mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
393                IBinder.FLAG_ONEWAY);
394        data.recycle();
395    }
396
397    public final void scheduleStopActivity(IBinder token, boolean showWindow,
398            int configChanges) throws RemoteException {
399        Parcel data = Parcel.obtain();
400        data.writeInterfaceToken(IApplicationThread.descriptor);
401        data.writeStrongBinder(token);
402        data.writeInt(showWindow ? 1 : 0);
403        data.writeInt(configChanges);
404        mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
405                IBinder.FLAG_ONEWAY);
406        data.recycle();
407    }
408
409    public final void scheduleWindowVisibility(IBinder token,
410            boolean showWindow) throws RemoteException {
411        Parcel data = Parcel.obtain();
412        data.writeInterfaceToken(IApplicationThread.descriptor);
413        data.writeStrongBinder(token);
414        data.writeInt(showWindow ? 1 : 0);
415        mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
416                IBinder.FLAG_ONEWAY);
417        data.recycle();
418    }
419
420    public final void scheduleResumeActivity(IBinder token, boolean isForward)
421            throws RemoteException {
422        Parcel data = Parcel.obtain();
423        data.writeInterfaceToken(IApplicationThread.descriptor);
424        data.writeStrongBinder(token);
425        data.writeInt(isForward ? 1 : 0);
426        mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
427                IBinder.FLAG_ONEWAY);
428        data.recycle();
429    }
430
431    public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
432    		throws RemoteException {
433        Parcel data = Parcel.obtain();
434        data.writeInterfaceToken(IApplicationThread.descriptor);
435        data.writeStrongBinder(token);
436        data.writeTypedList(results);
437        mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
438                IBinder.FLAG_ONEWAY);
439        data.recycle();
440    }
441
442    public final void scheduleLaunchActivity(Intent intent, IBinder token,
443            ActivityInfo info, Bundle state, List<ResultInfo> pendingResults,
444    		List<Intent> pendingNewIntents, boolean notResumed, boolean isForward)
445    		throws RemoteException {
446        Parcel data = Parcel.obtain();
447        data.writeInterfaceToken(IApplicationThread.descriptor);
448        intent.writeToParcel(data, 0);
449        data.writeStrongBinder(token);
450        info.writeToParcel(data, 0);
451        data.writeBundle(state);
452        data.writeTypedList(pendingResults);
453        data.writeTypedList(pendingNewIntents);
454        data.writeInt(notResumed ? 1 : 0);
455        data.writeInt(isForward ? 1 : 0);
456        mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
457                IBinder.FLAG_ONEWAY);
458        data.recycle();
459    }
460
461    public final void scheduleRelaunchActivity(IBinder token,
462            List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
463            int configChanges, boolean notResumed) throws RemoteException {
464        Parcel data = Parcel.obtain();
465        data.writeInterfaceToken(IApplicationThread.descriptor);
466        data.writeStrongBinder(token);
467        data.writeTypedList(pendingResults);
468        data.writeTypedList(pendingNewIntents);
469        data.writeInt(configChanges);
470        data.writeInt(notResumed ? 1 : 0);
471        mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
472                IBinder.FLAG_ONEWAY);
473        data.recycle();
474    }
475
476    public void scheduleNewIntent(List<Intent> intents, IBinder token)
477            throws RemoteException {
478        Parcel data = Parcel.obtain();
479        data.writeInterfaceToken(IApplicationThread.descriptor);
480        data.writeTypedList(intents);
481        data.writeStrongBinder(token);
482        mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
483                IBinder.FLAG_ONEWAY);
484        data.recycle();
485    }
486
487    public final void scheduleDestroyActivity(IBinder token, boolean finishing,
488            int configChanges) throws RemoteException {
489        Parcel data = Parcel.obtain();
490        data.writeInterfaceToken(IApplicationThread.descriptor);
491        data.writeStrongBinder(token);
492        data.writeInt(finishing ? 1 : 0);
493        data.writeInt(configChanges);
494        mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
495                IBinder.FLAG_ONEWAY);
496        data.recycle();
497    }
498
499    public final void scheduleReceiver(Intent intent, ActivityInfo info,
500            int resultCode, String resultData,
501            Bundle map, boolean sync) throws RemoteException {
502        Parcel data = Parcel.obtain();
503        data.writeInterfaceToken(IApplicationThread.descriptor);
504        intent.writeToParcel(data, 0);
505        info.writeToParcel(data, 0);
506        data.writeInt(resultCode);
507        data.writeString(resultData);
508        data.writeBundle(map);
509        data.writeInt(sync ? 1 : 0);
510        mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
511                IBinder.FLAG_ONEWAY);
512        data.recycle();
513    }
514
515    public final void scheduleCreateBackupAgent(ApplicationInfo app, int backupMode)
516            throws RemoteException {
517        Parcel data = Parcel.obtain();
518        data.writeInterfaceToken(IApplicationThread.descriptor);
519        app.writeToParcel(data, 0);
520        data.writeInt(backupMode);
521        mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null, 0);
522        data.recycle();
523    }
524
525    public final void scheduleDestroyBackupAgent(ApplicationInfo app) throws RemoteException {
526        Parcel data = Parcel.obtain();
527        data.writeInterfaceToken(IApplicationThread.descriptor);
528        app.writeToParcel(data, 0);
529        mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null, 0);
530        data.recycle();
531    }
532
533    public final void scheduleCreateService(IBinder token, ServiceInfo info)
534            throws RemoteException {
535        Parcel data = Parcel.obtain();
536        data.writeInterfaceToken(IApplicationThread.descriptor);
537        data.writeStrongBinder(token);
538        info.writeToParcel(data, 0);
539        mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
540                IBinder.FLAG_ONEWAY);
541        data.recycle();
542    }
543
544    public final void scheduleBindService(IBinder token, Intent intent, boolean rebind)
545            throws RemoteException {
546        Parcel data = Parcel.obtain();
547        data.writeInterfaceToken(IApplicationThread.descriptor);
548        data.writeStrongBinder(token);
549        intent.writeToParcel(data, 0);
550        data.writeInt(rebind ? 1 : 0);
551        mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
552                IBinder.FLAG_ONEWAY);
553        data.recycle();
554    }
555
556    public final void scheduleUnbindService(IBinder token, Intent intent)
557            throws RemoteException {
558        Parcel data = Parcel.obtain();
559        data.writeInterfaceToken(IApplicationThread.descriptor);
560        data.writeStrongBinder(token);
561        intent.writeToParcel(data, 0);
562        mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
563                IBinder.FLAG_ONEWAY);
564        data.recycle();
565    }
566
567    public final void scheduleServiceArgs(IBinder token, int startId,
568	    Intent args) throws RemoteException {
569        Parcel data = Parcel.obtain();
570        data.writeInterfaceToken(IApplicationThread.descriptor);
571        data.writeStrongBinder(token);
572        data.writeInt(startId);
573        args.writeToParcel(data, 0);
574        mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
575                IBinder.FLAG_ONEWAY);
576        data.recycle();
577    }
578
579    public final void scheduleStopService(IBinder token)
580            throws RemoteException {
581        Parcel data = Parcel.obtain();
582        data.writeInterfaceToken(IApplicationThread.descriptor);
583        data.writeStrongBinder(token);
584        mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
585                IBinder.FLAG_ONEWAY);
586        data.recycle();
587    }
588
589    public final void bindApplication(String packageName, ApplicationInfo info,
590            List<ProviderInfo> providers, ComponentName testName,
591            String profileName, Bundle testArgs, IInstrumentationWatcher testWatcher, int debugMode,
592            boolean restrictedBackupMode, Configuration config,
593            Map<String, IBinder> services) throws RemoteException {
594        Parcel data = Parcel.obtain();
595        data.writeInterfaceToken(IApplicationThread.descriptor);
596        data.writeString(packageName);
597        info.writeToParcel(data, 0);
598        data.writeTypedList(providers);
599        if (testName == null) {
600            data.writeInt(0);
601        } else {
602            data.writeInt(1);
603            testName.writeToParcel(data, 0);
604        }
605        data.writeString(profileName);
606        data.writeBundle(testArgs);
607        data.writeStrongInterface(testWatcher);
608        data.writeInt(debugMode);
609        data.writeInt(restrictedBackupMode ? 1 : 0);
610        config.writeToParcel(data, 0);
611        data.writeMap(services);
612        mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
613                IBinder.FLAG_ONEWAY);
614        data.recycle();
615    }
616
617    public final void scheduleExit() throws RemoteException {
618        Parcel data = Parcel.obtain();
619        data.writeInterfaceToken(IApplicationThread.descriptor);
620        mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
621                IBinder.FLAG_ONEWAY);
622        data.recycle();
623    }
624
625    public final void requestThumbnail(IBinder token)
626            throws RemoteException {
627        Parcel data = Parcel.obtain();
628        data.writeInterfaceToken(IApplicationThread.descriptor);
629        data.writeStrongBinder(token);
630        mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
631                IBinder.FLAG_ONEWAY);
632        data.recycle();
633    }
634
635    public final void scheduleConfigurationChanged(Configuration config)
636            throws RemoteException {
637        Parcel data = Parcel.obtain();
638        data.writeInterfaceToken(IApplicationThread.descriptor);
639        config.writeToParcel(data, 0);
640        mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
641                IBinder.FLAG_ONEWAY);
642        data.recycle();
643    }
644
645    public void updateTimeZone() throws RemoteException {
646        Parcel data = Parcel.obtain();
647        data.writeInterfaceToken(IApplicationThread.descriptor);
648        mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
649                IBinder.FLAG_ONEWAY);
650        data.recycle();
651    }
652
653    public void processInBackground() throws RemoteException {
654        Parcel data = Parcel.obtain();
655        data.writeInterfaceToken(IApplicationThread.descriptor);
656        mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
657                IBinder.FLAG_ONEWAY);
658        data.recycle();
659    }
660
661    public void dumpService(FileDescriptor fd, IBinder token, String[] args)
662            throws RemoteException {
663        Parcel data = Parcel.obtain();
664        data.writeInterfaceToken(IApplicationThread.descriptor);
665        data.writeFileDescriptor(fd);
666        data.writeStrongBinder(token);
667        data.writeStringArray(args);
668        mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, 0);
669        data.recycle();
670    }
671
672    public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
673            int resultCode, String dataStr, Bundle extras, boolean ordered)
674            throws RemoteException {
675        Parcel data = Parcel.obtain();
676        data.writeInterfaceToken(IApplicationThread.descriptor);
677        data.writeStrongBinder(receiver.asBinder());
678        intent.writeToParcel(data, 0);
679        data.writeInt(resultCode);
680        data.writeString(dataStr);
681        data.writeBundle(extras);
682        data.writeInt(ordered ? 1 : 0);
683        mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
684                IBinder.FLAG_ONEWAY);
685        data.recycle();
686    }
687
688    public final void scheduleLowMemory() throws RemoteException {
689        Parcel data = Parcel.obtain();
690        data.writeInterfaceToken(IApplicationThread.descriptor);
691        mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
692                IBinder.FLAG_ONEWAY);
693        data.recycle();
694    }
695
696    public final void scheduleActivityConfigurationChanged(
697            IBinder token) throws RemoteException {
698        Parcel data = Parcel.obtain();
699        data.writeInterfaceToken(IApplicationThread.descriptor);
700        data.writeStrongBinder(token);
701        mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
702                IBinder.FLAG_ONEWAY);
703        data.recycle();
704    }
705
706    public final void requestPss() throws RemoteException {
707        Parcel data = Parcel.obtain();
708        data.writeInterfaceToken(IApplicationThread.descriptor);
709        mRemote.transact(REQUEST_PSS_TRANSACTION, data, null,
710                IBinder.FLAG_ONEWAY);
711        data.recycle();
712    }
713
714    public void profilerControl(boolean start, String path) throws RemoteException {
715        Parcel data = Parcel.obtain();
716        data.writeInterfaceToken(IApplicationThread.descriptor);
717        data.writeInt(start ? 1 : 0);
718        data.writeString(path);
719        mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
720                IBinder.FLAG_ONEWAY);
721        data.recycle();
722    }
723
724    public void setSchedulingGroup(int group) throws RemoteException {
725        Parcel data = Parcel.obtain();
726        data.writeInterfaceToken(IApplicationThread.descriptor);
727        data.writeInt(group);
728        mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
729                IBinder.FLAG_ONEWAY);
730        data.recycle();
731    }
732}
733
734