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