ApplicationThreadNative.java revision f5b4b98fada53d91c4c2ebeb5a1d33ccc95c94d2
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
336        return super.onTransact(code, data, reply, flags);
337    }
338
339    public IBinder asBinder()
340    {
341        return this;
342    }
343}
344
345class ApplicationThreadProxy implements IApplicationThread {
346    private final IBinder mRemote;
347
348    public ApplicationThreadProxy(IBinder remote) {
349        mRemote = remote;
350    }
351
352    public final IBinder asBinder() {
353        return mRemote;
354    }
355
356    public final void schedulePauseActivity(IBinder token, boolean finished,
357            boolean userLeaving, int configChanges) throws RemoteException {
358        Parcel data = Parcel.obtain();
359        data.writeInterfaceToken(IApplicationThread.descriptor);
360        data.writeStrongBinder(token);
361        data.writeInt(finished ? 1 : 0);
362        data.writeInt(userLeaving ? 1 :0);
363        data.writeInt(configChanges);
364        mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
365                IBinder.FLAG_ONEWAY);
366        data.recycle();
367    }
368
369    public final void scheduleStopActivity(IBinder token, boolean showWindow,
370            int configChanges) throws RemoteException {
371        Parcel data = Parcel.obtain();
372        data.writeInterfaceToken(IApplicationThread.descriptor);
373        data.writeStrongBinder(token);
374        data.writeInt(showWindow ? 1 : 0);
375        data.writeInt(configChanges);
376        mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
377                IBinder.FLAG_ONEWAY);
378        data.recycle();
379    }
380
381    public final void scheduleWindowVisibility(IBinder token,
382            boolean showWindow) throws RemoteException {
383        Parcel data = Parcel.obtain();
384        data.writeInterfaceToken(IApplicationThread.descriptor);
385        data.writeStrongBinder(token);
386        data.writeInt(showWindow ? 1 : 0);
387        mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
388                IBinder.FLAG_ONEWAY);
389        data.recycle();
390    }
391
392    public final void scheduleResumeActivity(IBinder token, boolean isForward)
393            throws RemoteException {
394        Parcel data = Parcel.obtain();
395        data.writeInterfaceToken(IApplicationThread.descriptor);
396        data.writeStrongBinder(token);
397        data.writeInt(isForward ? 1 : 0);
398        mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
399                IBinder.FLAG_ONEWAY);
400        data.recycle();
401    }
402
403    public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
404    		throws RemoteException {
405        Parcel data = Parcel.obtain();
406        data.writeInterfaceToken(IApplicationThread.descriptor);
407        data.writeStrongBinder(token);
408        data.writeTypedList(results);
409        mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
410                IBinder.FLAG_ONEWAY);
411        data.recycle();
412    }
413
414    public final void scheduleLaunchActivity(Intent intent, IBinder token,
415            ActivityInfo info, Bundle state, List<ResultInfo> pendingResults,
416    		List<Intent> pendingNewIntents, boolean notResumed, boolean isForward)
417    		throws RemoteException {
418        Parcel data = Parcel.obtain();
419        data.writeInterfaceToken(IApplicationThread.descriptor);
420        intent.writeToParcel(data, 0);
421        data.writeStrongBinder(token);
422        info.writeToParcel(data, 0);
423        data.writeBundle(state);
424        data.writeTypedList(pendingResults);
425        data.writeTypedList(pendingNewIntents);
426        data.writeInt(notResumed ? 1 : 0);
427        data.writeInt(isForward ? 1 : 0);
428        mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
429                IBinder.FLAG_ONEWAY);
430        data.recycle();
431    }
432
433    public final void scheduleRelaunchActivity(IBinder token,
434            List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
435            int configChanges, boolean notResumed) throws RemoteException {
436        Parcel data = Parcel.obtain();
437        data.writeInterfaceToken(IApplicationThread.descriptor);
438        data.writeStrongBinder(token);
439        data.writeTypedList(pendingResults);
440        data.writeTypedList(pendingNewIntents);
441        data.writeInt(configChanges);
442        data.writeInt(notResumed ? 1 : 0);
443        mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
444                IBinder.FLAG_ONEWAY);
445        data.recycle();
446    }
447
448    public void scheduleNewIntent(List<Intent> intents, IBinder token)
449            throws RemoteException {
450        Parcel data = Parcel.obtain();
451        data.writeInterfaceToken(IApplicationThread.descriptor);
452        data.writeTypedList(intents);
453        data.writeStrongBinder(token);
454        mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
455                IBinder.FLAG_ONEWAY);
456        data.recycle();
457    }
458
459    public final void scheduleDestroyActivity(IBinder token, boolean finishing,
460            int configChanges) throws RemoteException {
461        Parcel data = Parcel.obtain();
462        data.writeInterfaceToken(IApplicationThread.descriptor);
463        data.writeStrongBinder(token);
464        data.writeInt(finishing ? 1 : 0);
465        data.writeInt(configChanges);
466        mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
467                IBinder.FLAG_ONEWAY);
468        data.recycle();
469    }
470
471    public final void scheduleReceiver(Intent intent, ActivityInfo info,
472            int resultCode, String resultData,
473            Bundle map, boolean sync) throws RemoteException {
474        Parcel data = Parcel.obtain();
475        data.writeInterfaceToken(IApplicationThread.descriptor);
476        intent.writeToParcel(data, 0);
477        info.writeToParcel(data, 0);
478        data.writeInt(resultCode);
479        data.writeString(resultData);
480        data.writeBundle(map);
481        data.writeInt(sync ? 1 : 0);
482        mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
483                IBinder.FLAG_ONEWAY);
484        data.recycle();
485    }
486
487    public final void scheduleCreateService(IBinder token, ServiceInfo info)
488            throws RemoteException {
489        Parcel data = Parcel.obtain();
490        data.writeInterfaceToken(IApplicationThread.descriptor);
491        data.writeStrongBinder(token);
492        info.writeToParcel(data, 0);
493        mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
494                IBinder.FLAG_ONEWAY);
495        data.recycle();
496    }
497
498    public final void scheduleBindService(IBinder token, Intent intent, boolean rebind)
499            throws RemoteException {
500        Parcel data = Parcel.obtain();
501        data.writeInterfaceToken(IApplicationThread.descriptor);
502        data.writeStrongBinder(token);
503        intent.writeToParcel(data, 0);
504        data.writeInt(rebind ? 1 : 0);
505        mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
506                IBinder.FLAG_ONEWAY);
507        data.recycle();
508    }
509
510    public final void scheduleUnbindService(IBinder token, Intent intent)
511            throws RemoteException {
512        Parcel data = Parcel.obtain();
513        data.writeInterfaceToken(IApplicationThread.descriptor);
514        data.writeStrongBinder(token);
515        intent.writeToParcel(data, 0);
516        mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
517                IBinder.FLAG_ONEWAY);
518        data.recycle();
519    }
520
521    public final void scheduleServiceArgs(IBinder token, int startId,
522	    Intent args) throws RemoteException {
523        Parcel data = Parcel.obtain();
524        data.writeInterfaceToken(IApplicationThread.descriptor);
525        data.writeStrongBinder(token);
526        data.writeInt(startId);
527        args.writeToParcel(data, 0);
528        mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
529                IBinder.FLAG_ONEWAY);
530        data.recycle();
531    }
532
533    public final void scheduleStopService(IBinder token)
534            throws RemoteException {
535        Parcel data = Parcel.obtain();
536        data.writeInterfaceToken(IApplicationThread.descriptor);
537        data.writeStrongBinder(token);
538        mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
539                IBinder.FLAG_ONEWAY);
540        data.recycle();
541    }
542
543    public final void bindApplication(String packageName, ApplicationInfo info,
544            List<ProviderInfo> providers, ComponentName testName,
545            String profileName, Bundle testArgs, IInstrumentationWatcher testWatcher, int debugMode,
546            Configuration config, Map<String, IBinder> services) throws RemoteException {
547        Parcel data = Parcel.obtain();
548        data.writeInterfaceToken(IApplicationThread.descriptor);
549        data.writeString(packageName);
550        info.writeToParcel(data, 0);
551        data.writeTypedList(providers);
552        if (testName == null) {
553            data.writeInt(0);
554        } else {
555            data.writeInt(1);
556            testName.writeToParcel(data, 0);
557        }
558        data.writeString(profileName);
559        data.writeBundle(testArgs);
560        data.writeStrongInterface(testWatcher);
561        data.writeInt(debugMode);
562        config.writeToParcel(data, 0);
563        data.writeMap(services);
564        mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
565                IBinder.FLAG_ONEWAY);
566        data.recycle();
567    }
568
569    public final void scheduleExit() throws RemoteException {
570        Parcel data = Parcel.obtain();
571        data.writeInterfaceToken(IApplicationThread.descriptor);
572        mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
573                IBinder.FLAG_ONEWAY);
574        data.recycle();
575    }
576
577    public final void requestThumbnail(IBinder token)
578            throws RemoteException {
579        Parcel data = Parcel.obtain();
580        data.writeInterfaceToken(IApplicationThread.descriptor);
581        data.writeStrongBinder(token);
582        mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
583                IBinder.FLAG_ONEWAY);
584        data.recycle();
585    }
586
587    public final void scheduleConfigurationChanged(Configuration config)
588            throws RemoteException {
589        Parcel data = Parcel.obtain();
590        data.writeInterfaceToken(IApplicationThread.descriptor);
591        config.writeToParcel(data, 0);
592        mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
593                IBinder.FLAG_ONEWAY);
594        data.recycle();
595    }
596
597    public void updateTimeZone() throws RemoteException {
598        Parcel data = Parcel.obtain();
599        data.writeInterfaceToken(IApplicationThread.descriptor);
600        mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
601                IBinder.FLAG_ONEWAY);
602        data.recycle();
603    }
604
605    public void processInBackground() throws RemoteException {
606        Parcel data = Parcel.obtain();
607        data.writeInterfaceToken(IApplicationThread.descriptor);
608        mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
609                IBinder.FLAG_ONEWAY);
610        data.recycle();
611    }
612
613    public void dumpService(FileDescriptor fd, IBinder token, String[] args)
614            throws RemoteException {
615        Parcel data = Parcel.obtain();
616        data.writeInterfaceToken(IApplicationThread.descriptor);
617        data.writeFileDescriptor(fd);
618        data.writeStrongBinder(token);
619        data.writeStringArray(args);
620        mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, 0);
621        data.recycle();
622    }
623
624    public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
625            int resultCode, String dataStr, Bundle extras, boolean ordered)
626            throws RemoteException {
627        Parcel data = Parcel.obtain();
628        data.writeInterfaceToken(IApplicationThread.descriptor);
629        data.writeStrongBinder(receiver.asBinder());
630        intent.writeToParcel(data, 0);
631        data.writeInt(resultCode);
632        data.writeString(dataStr);
633        data.writeBundle(extras);
634        data.writeInt(ordered ? 1 : 0);
635        mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
636                IBinder.FLAG_ONEWAY);
637        data.recycle();
638    }
639
640    public final void scheduleLowMemory() throws RemoteException {
641        Parcel data = Parcel.obtain();
642        data.writeInterfaceToken(IApplicationThread.descriptor);
643        mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
644                IBinder.FLAG_ONEWAY);
645        data.recycle();
646    }
647
648    public final void scheduleActivityConfigurationChanged(
649            IBinder token) throws RemoteException {
650        Parcel data = Parcel.obtain();
651        data.writeInterfaceToken(IApplicationThread.descriptor);
652        data.writeStrongBinder(token);
653        mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
654                IBinder.FLAG_ONEWAY);
655        data.recycle();
656    }
657
658    public final void requestPss() throws RemoteException {
659        Parcel data = Parcel.obtain();
660        data.writeInterfaceToken(IApplicationThread.descriptor);
661        mRemote.transact(REQUEST_PSS_TRANSACTION, data, null,
662                IBinder.FLAG_ONEWAY);
663        data.recycle();
664    }
665
666    public void profilerControl(boolean start, String path) throws RemoteException {
667        Parcel data = Parcel.obtain();
668        data.writeInterfaceToken(IApplicationThread.descriptor);
669        data.writeInt(start ? 1 : 0);
670        data.writeString(path);
671        mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
672                IBinder.FLAG_ONEWAY);
673        data.recycle();
674    }
675}
676
677