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