ApplicationThreadNative.java revision 06de2ea752171f52a4e6e6872cb3a0689e591dcb
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            Configuration config = Configuration.CREATOR.createFromParcel(data);
234            HashMap<String, IBinder> services = data.readHashMap(null);
235            bindApplication(packageName, info,
236                            providers, testName, profileName,
237                            testArgs, testWatcher, testMode, config, services);
238            return true;
239        }
240
241        case SCHEDULE_EXIT_TRANSACTION:
242        {
243            data.enforceInterface(IApplicationThread.descriptor);
244            scheduleExit();
245            return true;
246        }
247
248        case REQUEST_THUMBNAIL_TRANSACTION:
249        {
250            data.enforceInterface(IApplicationThread.descriptor);
251            IBinder b = data.readStrongBinder();
252            requestThumbnail(b);
253            return true;
254        }
255
256        case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
257        {
258            data.enforceInterface(IApplicationThread.descriptor);
259            Configuration config = Configuration.CREATOR.createFromParcel(data);
260            scheduleConfigurationChanged(config);
261            return true;
262        }
263
264        case UPDATE_TIME_ZONE_TRANSACTION: {
265            data.enforceInterface(IApplicationThread.descriptor);
266            updateTimeZone();
267            return true;
268        }
269
270        case PROCESS_IN_BACKGROUND_TRANSACTION: {
271            data.enforceInterface(IApplicationThread.descriptor);
272            processInBackground();
273            return true;
274        }
275
276        case DUMP_SERVICE_TRANSACTION: {
277            data.enforceInterface(IApplicationThread.descriptor);
278            ParcelFileDescriptor fd = data.readFileDescriptor();
279            final IBinder service = data.readStrongBinder();
280            final String[] args = data.readStringArray();
281            if (fd != null) {
282                dumpService(fd.getFileDescriptor(), service, args);
283                try {
284                    fd.close();
285                } catch (IOException e) {
286                }
287            }
288            return true;
289        }
290
291        case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
292            data.enforceInterface(IApplicationThread.descriptor);
293            IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
294                    data.readStrongBinder());
295            Intent intent = Intent.CREATOR.createFromParcel(data);
296            int resultCode = data.readInt();
297            String dataStr = data.readString();
298            Bundle extras = data.readBundle();
299            boolean ordered = data.readInt() != 0;
300            scheduleRegisteredReceiver(receiver, intent,
301                    resultCode, dataStr, extras, ordered);
302            return true;
303        }
304
305        case SCHEDULE_LOW_MEMORY_TRANSACTION:
306        {
307            scheduleLowMemory();
308            return true;
309        }
310
311        case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
312        {
313            data.enforceInterface(IApplicationThread.descriptor);
314            IBinder b = data.readStrongBinder();
315            scheduleActivityConfigurationChanged(b);
316            return true;
317        }
318
319        case REQUEST_PSS_TRANSACTION:
320        {
321            data.enforceInterface(IApplicationThread.descriptor);
322            requestPss();
323            return true;
324        }
325
326        case PROFILER_CONTROL_TRANSACTION:
327        {
328            data.enforceInterface(IApplicationThread.descriptor);
329            boolean start = data.readInt() != 0;
330            String path = data.readString();
331            profilerControl(start, path);
332            return true;
333        }
334
335        case SET_SCHEDULING_GROUP_TRANSACTION:
336        {
337            data.enforceInterface(IApplicationThread.descriptor);
338            int group = data.readInt();
339            setSchedulingGroup(group);
340            return true;
341        }
342        }
343
344        return super.onTransact(code, data, reply, flags);
345    }
346
347    public IBinder asBinder()
348    {
349        return this;
350    }
351}
352
353class ApplicationThreadProxy implements IApplicationThread {
354    private final IBinder mRemote;
355
356    public ApplicationThreadProxy(IBinder remote) {
357        mRemote = remote;
358    }
359
360    public final IBinder asBinder() {
361        return mRemote;
362    }
363
364    public final void schedulePauseActivity(IBinder token, boolean finished,
365            boolean userLeaving, int configChanges) throws RemoteException {
366        Parcel data = Parcel.obtain();
367        data.writeInterfaceToken(IApplicationThread.descriptor);
368        data.writeStrongBinder(token);
369        data.writeInt(finished ? 1 : 0);
370        data.writeInt(userLeaving ? 1 :0);
371        data.writeInt(configChanges);
372        mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
373                IBinder.FLAG_ONEWAY);
374        data.recycle();
375    }
376
377    public final void scheduleStopActivity(IBinder token, boolean showWindow,
378            int configChanges) throws RemoteException {
379        Parcel data = Parcel.obtain();
380        data.writeInterfaceToken(IApplicationThread.descriptor);
381        data.writeStrongBinder(token);
382        data.writeInt(showWindow ? 1 : 0);
383        data.writeInt(configChanges);
384        mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
385                IBinder.FLAG_ONEWAY);
386        data.recycle();
387    }
388
389    public final void scheduleWindowVisibility(IBinder token,
390            boolean showWindow) throws RemoteException {
391        Parcel data = Parcel.obtain();
392        data.writeInterfaceToken(IApplicationThread.descriptor);
393        data.writeStrongBinder(token);
394        data.writeInt(showWindow ? 1 : 0);
395        mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
396                IBinder.FLAG_ONEWAY);
397        data.recycle();
398    }
399
400    public final void scheduleResumeActivity(IBinder token, boolean isForward)
401            throws RemoteException {
402        Parcel data = Parcel.obtain();
403        data.writeInterfaceToken(IApplicationThread.descriptor);
404        data.writeStrongBinder(token);
405        data.writeInt(isForward ? 1 : 0);
406        mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
407                IBinder.FLAG_ONEWAY);
408        data.recycle();
409    }
410
411    public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
412    		throws RemoteException {
413        Parcel data = Parcel.obtain();
414        data.writeInterfaceToken(IApplicationThread.descriptor);
415        data.writeStrongBinder(token);
416        data.writeTypedList(results);
417        mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
418                IBinder.FLAG_ONEWAY);
419        data.recycle();
420    }
421
422    public final void scheduleLaunchActivity(Intent intent, IBinder token,
423            ActivityInfo info, Bundle state, List<ResultInfo> pendingResults,
424    		List<Intent> pendingNewIntents, boolean notResumed, boolean isForward)
425    		throws RemoteException {
426        Parcel data = Parcel.obtain();
427        data.writeInterfaceToken(IApplicationThread.descriptor);
428        intent.writeToParcel(data, 0);
429        data.writeStrongBinder(token);
430        info.writeToParcel(data, 0);
431        data.writeBundle(state);
432        data.writeTypedList(pendingResults);
433        data.writeTypedList(pendingNewIntents);
434        data.writeInt(notResumed ? 1 : 0);
435        data.writeInt(isForward ? 1 : 0);
436        mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
437                IBinder.FLAG_ONEWAY);
438        data.recycle();
439    }
440
441    public final void scheduleRelaunchActivity(IBinder token,
442            List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
443            int configChanges, boolean notResumed) throws RemoteException {
444        Parcel data = Parcel.obtain();
445        data.writeInterfaceToken(IApplicationThread.descriptor);
446        data.writeStrongBinder(token);
447        data.writeTypedList(pendingResults);
448        data.writeTypedList(pendingNewIntents);
449        data.writeInt(configChanges);
450        data.writeInt(notResumed ? 1 : 0);
451        mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
452                IBinder.FLAG_ONEWAY);
453        data.recycle();
454    }
455
456    public void scheduleNewIntent(List<Intent> intents, IBinder token)
457            throws RemoteException {
458        Parcel data = Parcel.obtain();
459        data.writeInterfaceToken(IApplicationThread.descriptor);
460        data.writeTypedList(intents);
461        data.writeStrongBinder(token);
462        mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
463                IBinder.FLAG_ONEWAY);
464        data.recycle();
465    }
466
467    public final void scheduleDestroyActivity(IBinder token, boolean finishing,
468            int configChanges) throws RemoteException {
469        Parcel data = Parcel.obtain();
470        data.writeInterfaceToken(IApplicationThread.descriptor);
471        data.writeStrongBinder(token);
472        data.writeInt(finishing ? 1 : 0);
473        data.writeInt(configChanges);
474        mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
475                IBinder.FLAG_ONEWAY);
476        data.recycle();
477    }
478
479    public final void scheduleReceiver(Intent intent, ActivityInfo info,
480            int resultCode, String resultData,
481            Bundle map, boolean sync) throws RemoteException {
482        Parcel data = Parcel.obtain();
483        data.writeInterfaceToken(IApplicationThread.descriptor);
484        intent.writeToParcel(data, 0);
485        info.writeToParcel(data, 0);
486        data.writeInt(resultCode);
487        data.writeString(resultData);
488        data.writeBundle(map);
489        data.writeInt(sync ? 1 : 0);
490        mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
491                IBinder.FLAG_ONEWAY);
492        data.recycle();
493    }
494
495    public final void scheduleCreateService(IBinder token, ServiceInfo info)
496            throws RemoteException {
497        Parcel data = Parcel.obtain();
498        data.writeInterfaceToken(IApplicationThread.descriptor);
499        data.writeStrongBinder(token);
500        info.writeToParcel(data, 0);
501        mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
502                IBinder.FLAG_ONEWAY);
503        data.recycle();
504    }
505
506    public final void scheduleBindService(IBinder token, Intent intent, boolean rebind)
507            throws RemoteException {
508        Parcel data = Parcel.obtain();
509        data.writeInterfaceToken(IApplicationThread.descriptor);
510        data.writeStrongBinder(token);
511        intent.writeToParcel(data, 0);
512        data.writeInt(rebind ? 1 : 0);
513        mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
514                IBinder.FLAG_ONEWAY);
515        data.recycle();
516    }
517
518    public final void scheduleUnbindService(IBinder token, Intent intent)
519            throws RemoteException {
520        Parcel data = Parcel.obtain();
521        data.writeInterfaceToken(IApplicationThread.descriptor);
522        data.writeStrongBinder(token);
523        intent.writeToParcel(data, 0);
524        mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
525                IBinder.FLAG_ONEWAY);
526        data.recycle();
527    }
528
529    public final void scheduleServiceArgs(IBinder token, int startId,
530	    Intent args) throws RemoteException {
531        Parcel data = Parcel.obtain();
532        data.writeInterfaceToken(IApplicationThread.descriptor);
533        data.writeStrongBinder(token);
534        data.writeInt(startId);
535        args.writeToParcel(data, 0);
536        mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
537                IBinder.FLAG_ONEWAY);
538        data.recycle();
539    }
540
541    public final void scheduleStopService(IBinder token)
542            throws RemoteException {
543        Parcel data = Parcel.obtain();
544        data.writeInterfaceToken(IApplicationThread.descriptor);
545        data.writeStrongBinder(token);
546        mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
547                IBinder.FLAG_ONEWAY);
548        data.recycle();
549    }
550
551    public final void bindApplication(String packageName, ApplicationInfo info,
552            List<ProviderInfo> providers, ComponentName testName,
553            String profileName, Bundle testArgs, IInstrumentationWatcher testWatcher, int debugMode,
554            Configuration config, Map<String, IBinder> services) throws RemoteException {
555        Parcel data = Parcel.obtain();
556        data.writeInterfaceToken(IApplicationThread.descriptor);
557        data.writeString(packageName);
558        info.writeToParcel(data, 0);
559        data.writeTypedList(providers);
560        if (testName == null) {
561            data.writeInt(0);
562        } else {
563            data.writeInt(1);
564            testName.writeToParcel(data, 0);
565        }
566        data.writeString(profileName);
567        data.writeBundle(testArgs);
568        data.writeStrongInterface(testWatcher);
569        data.writeInt(debugMode);
570        config.writeToParcel(data, 0);
571        data.writeMap(services);
572        mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
573                IBinder.FLAG_ONEWAY);
574        data.recycle();
575    }
576
577    public final void scheduleExit() throws RemoteException {
578        Parcel data = Parcel.obtain();
579        data.writeInterfaceToken(IApplicationThread.descriptor);
580        mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
581                IBinder.FLAG_ONEWAY);
582        data.recycle();
583    }
584
585    public final void requestThumbnail(IBinder token)
586            throws RemoteException {
587        Parcel data = Parcel.obtain();
588        data.writeInterfaceToken(IApplicationThread.descriptor);
589        data.writeStrongBinder(token);
590        mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
591                IBinder.FLAG_ONEWAY);
592        data.recycle();
593    }
594
595    public final void scheduleConfigurationChanged(Configuration config)
596            throws RemoteException {
597        Parcel data = Parcel.obtain();
598        data.writeInterfaceToken(IApplicationThread.descriptor);
599        config.writeToParcel(data, 0);
600        mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
601                IBinder.FLAG_ONEWAY);
602        data.recycle();
603    }
604
605    public void updateTimeZone() throws RemoteException {
606        Parcel data = Parcel.obtain();
607        data.writeInterfaceToken(IApplicationThread.descriptor);
608        mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
609                IBinder.FLAG_ONEWAY);
610        data.recycle();
611    }
612
613    public void processInBackground() throws RemoteException {
614        Parcel data = Parcel.obtain();
615        data.writeInterfaceToken(IApplicationThread.descriptor);
616        mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
617                IBinder.FLAG_ONEWAY);
618        data.recycle();
619    }
620
621    public void dumpService(FileDescriptor fd, IBinder token, String[] args)
622            throws RemoteException {
623        Parcel data = Parcel.obtain();
624        data.writeInterfaceToken(IApplicationThread.descriptor);
625        data.writeFileDescriptor(fd);
626        data.writeStrongBinder(token);
627        data.writeStringArray(args);
628        mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, 0);
629        data.recycle();
630    }
631
632    public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
633            int resultCode, String dataStr, Bundle extras, boolean ordered)
634            throws RemoteException {
635        Parcel data = Parcel.obtain();
636        data.writeInterfaceToken(IApplicationThread.descriptor);
637        data.writeStrongBinder(receiver.asBinder());
638        intent.writeToParcel(data, 0);
639        data.writeInt(resultCode);
640        data.writeString(dataStr);
641        data.writeBundle(extras);
642        data.writeInt(ordered ? 1 : 0);
643        mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
644                IBinder.FLAG_ONEWAY);
645        data.recycle();
646    }
647
648    public final void scheduleLowMemory() throws RemoteException {
649        Parcel data = Parcel.obtain();
650        data.writeInterfaceToken(IApplicationThread.descriptor);
651        mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
652                IBinder.FLAG_ONEWAY);
653        data.recycle();
654    }
655
656    public final void scheduleActivityConfigurationChanged(
657            IBinder token) throws RemoteException {
658        Parcel data = Parcel.obtain();
659        data.writeInterfaceToken(IApplicationThread.descriptor);
660        data.writeStrongBinder(token);
661        mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
662                IBinder.FLAG_ONEWAY);
663        data.recycle();
664    }
665
666    public final void requestPss() throws RemoteException {
667        Parcel data = Parcel.obtain();
668        data.writeInterfaceToken(IApplicationThread.descriptor);
669        mRemote.transact(REQUEST_PSS_TRANSACTION, data, null,
670                IBinder.FLAG_ONEWAY);
671        data.recycle();
672    }
673
674    public void profilerControl(boolean start, String path) throws RemoteException {
675        Parcel data = Parcel.obtain();
676        data.writeInterfaceToken(IApplicationThread.descriptor);
677        data.writeInt(start ? 1 : 0);
678        data.writeString(path);
679        mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
680                IBinder.FLAG_ONEWAY);
681        data.recycle();
682    }
683
684    public void setSchedulingGroup(int group) throws RemoteException {
685        Parcel data = Parcel.obtain();
686        data.writeInterfaceToken(IApplicationThread.descriptor);
687        data.writeInt(group);
688        mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
689                IBinder.FLAG_ONEWAY);
690        data.recycle();
691    }
692}
693
694