2 * Copyright (C) 2006 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 import android.content.ComponentName;
20 import android.content.Intent;
21 import android.content.IIntentReceiver;
22 import android.content.pm.ActivityInfo;
23 import android.content.pm.ApplicationInfo;
24 import android.content.pm.ProviderInfo;
25 import android.content.pm.ServiceInfo;
26 import android.content.res.Configuration;
27 import android.os.Binder;
28 import android.os.Bundle;
29 import android.os.Debug;
30 import android.os.Parcelable;
31 import android.os.RemoteException;
32 import android.os.IBinder;
33 import android.os.Parcel;
34 import android.os.ParcelFileDescriptor;
36 import java.io.FileDescriptor;
37 import java.io.IOException;
38 import java.util.HashMap;
39 import java.util.List;
43 public abstract class ApplicationThreadNative extends Binder
44 implements IApplicationThread {
46 * Cast a Binder object into an application thread interface, generating
49 static public IApplicationThread asInterface(IBinder obj) {
53 IApplicationThread in =
54 (IApplicationThread)obj.queryLocalInterface(descriptor);
59 return new ApplicationThreadProxy(obj);
62 public ApplicationThreadNative() {
63 attachInterface(this, descriptor);
67 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
68 throws RemoteException {
70 case SCHEDULE_PAUSE_ACTIVITY_TRANSACTION:
72 data.enforceInterface(IApplicationThread.descriptor);
73 IBinder b = data.readStrongBinder();
74 boolean finished = data.readInt() != 0;
75 boolean userLeaving = data.readInt() != 0;
76 int configChanges = data.readInt();
77 schedulePauseActivity(b, finished, userLeaving, configChanges);
81 case SCHEDULE_STOP_ACTIVITY_TRANSACTION:
83 data.enforceInterface(IApplicationThread.descriptor);
84 IBinder b = data.readStrongBinder();
85 boolean show = data.readInt() != 0;
86 int configChanges = data.readInt();
87 scheduleStopActivity(b, show, configChanges);
91 case SCHEDULE_WINDOW_VISIBILITY_TRANSACTION:
93 data.enforceInterface(IApplicationThread.descriptor);
94 IBinder b = data.readStrongBinder();
95 boolean show = data.readInt() != 0;
96 scheduleWindowVisibility(b, show);
100 case SCHEDULE_SLEEPING_TRANSACTION:
102 data.enforceInterface(IApplicationThread.descriptor);
103 IBinder b = data.readStrongBinder();
104 boolean sleeping = data.readInt() != 0;
105 scheduleSleeping(b, sleeping);
109 case SCHEDULE_RESUME_ACTIVITY_TRANSACTION:
111 data.enforceInterface(IApplicationThread.descriptor);
112 IBinder b = data.readStrongBinder();
113 boolean isForward = data.readInt() != 0;
114 scheduleResumeActivity(b, isForward);
118 case SCHEDULE_SEND_RESULT_TRANSACTION:
120 data.enforceInterface(IApplicationThread.descriptor);
121 IBinder b = data.readStrongBinder();
122 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
123 scheduleSendResult(b, ri);
127 case SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION:
129 data.enforceInterface(IApplicationThread.descriptor);
130 Intent intent = Intent.CREATOR.createFromParcel(data);
131 IBinder b = data.readStrongBinder();
132 int ident = data.readInt();
133 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
134 Bundle state = data.readBundle();
135 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
136 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
137 boolean notResumed = data.readInt() != 0;
138 boolean isForward = data.readInt() != 0;
139 scheduleLaunchActivity(intent, b, ident, info, state, ri, pi,
140 notResumed, isForward);
144 case SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION:
146 data.enforceInterface(IApplicationThread.descriptor);
147 IBinder b = data.readStrongBinder();
148 List<ResultInfo> ri = data.createTypedArrayList(ResultInfo.CREATOR);
149 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
150 int configChanges = data.readInt();
151 boolean notResumed = data.readInt() != 0;
152 Configuration config = null;
153 if (data.readInt() != 0) {
154 config = Configuration.CREATOR.createFromParcel(data);
156 scheduleRelaunchActivity(b, ri, pi, configChanges, notResumed, config);
160 case SCHEDULE_NEW_INTENT_TRANSACTION:
162 data.enforceInterface(IApplicationThread.descriptor);
163 List<Intent> pi = data.createTypedArrayList(Intent.CREATOR);
164 IBinder b = data.readStrongBinder();
165 scheduleNewIntent(pi, b);
169 case SCHEDULE_FINISH_ACTIVITY_TRANSACTION:
171 data.enforceInterface(IApplicationThread.descriptor);
172 IBinder b = data.readStrongBinder();
173 boolean finishing = data.readInt() != 0;
174 int configChanges = data.readInt();
175 scheduleDestroyActivity(b, finishing, configChanges);
179 case SCHEDULE_RECEIVER_TRANSACTION:
181 data.enforceInterface(IApplicationThread.descriptor);
182 Intent intent = Intent.CREATOR.createFromParcel(data);
183 ActivityInfo info = ActivityInfo.CREATOR.createFromParcel(data);
184 int resultCode = data.readInt();
185 String resultData = data.readString();
186 Bundle resultExtras = data.readBundle();
187 boolean sync = data.readInt() != 0;
188 scheduleReceiver(intent, info, resultCode, resultData,
193 case SCHEDULE_CREATE_SERVICE_TRANSACTION: {
194 data.enforceInterface(IApplicationThread.descriptor);
195 IBinder token = data.readStrongBinder();
196 ServiceInfo info = ServiceInfo.CREATOR.createFromParcel(data);
197 scheduleCreateService(token, info);
201 case SCHEDULE_BIND_SERVICE_TRANSACTION: {
202 data.enforceInterface(IApplicationThread.descriptor);
203 IBinder token = data.readStrongBinder();
204 Intent intent = Intent.CREATOR.createFromParcel(data);
205 boolean rebind = data.readInt() != 0;
206 scheduleBindService(token, intent, rebind);
210 case SCHEDULE_UNBIND_SERVICE_TRANSACTION: {
211 data.enforceInterface(IApplicationThread.descriptor);
212 IBinder token = data.readStrongBinder();
213 Intent intent = Intent.CREATOR.createFromParcel(data);
214 scheduleUnbindService(token, intent);
218 case SCHEDULE_SERVICE_ARGS_TRANSACTION:
220 data.enforceInterface(IApplicationThread.descriptor);
221 IBinder token = data.readStrongBinder();
222 int startId = data.readInt();
223 int fl = data.readInt();
225 if (data.readInt() != 0) {
226 args = Intent.CREATOR.createFromParcel(data);
230 scheduleServiceArgs(token, startId, fl, args);
234 case SCHEDULE_STOP_SERVICE_TRANSACTION:
236 data.enforceInterface(IApplicationThread.descriptor);
237 IBinder token = data.readStrongBinder();
238 scheduleStopService(token);
242 case BIND_APPLICATION_TRANSACTION:
244 data.enforceInterface(IApplicationThread.descriptor);
245 String packageName = data.readString();
246 ApplicationInfo info =
247 ApplicationInfo.CREATOR.createFromParcel(data);
248 List<ProviderInfo> providers =
249 data.createTypedArrayList(ProviderInfo.CREATOR);
250 ComponentName testName = (data.readInt() != 0)
251 ? new ComponentName(data) : null;
252 String profileName = data.readString();
253 Bundle testArgs = data.readBundle();
254 IBinder binder = data.readStrongBinder();
255 IInstrumentationWatcher testWatcher = IInstrumentationWatcher.Stub.asInterface(binder);
256 int testMode = data.readInt();
257 boolean restrictedBackupMode = (data.readInt() != 0);
258 Configuration config = Configuration.CREATOR.createFromParcel(data);
259 HashMap<String, IBinder> services = data.readHashMap(null);
260 Bundle coreSettings = data.readBundle();
261 bindApplication(packageName, info,
262 providers, testName, profileName,
263 testArgs, testWatcher, testMode, restrictedBackupMode,
264 config, services, coreSettings);
268 case SCHEDULE_EXIT_TRANSACTION:
270 data.enforceInterface(IApplicationThread.descriptor);
275 case SCHEDULE_SUICIDE_TRANSACTION:
277 data.enforceInterface(IApplicationThread.descriptor);
282 case REQUEST_THUMBNAIL_TRANSACTION:
284 data.enforceInterface(IApplicationThread.descriptor);
285 IBinder b = data.readStrongBinder();
290 case SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION:
292 data.enforceInterface(IApplicationThread.descriptor);
293 Configuration config = Configuration.CREATOR.createFromParcel(data);
294 scheduleConfigurationChanged(config);
298 case UPDATE_TIME_ZONE_TRANSACTION: {
299 data.enforceInterface(IApplicationThread.descriptor);
304 case CLEAR_DNS_CACHE_TRANSACTION: {
305 data.enforceInterface(IApplicationThread.descriptor);
310 case SET_HTTP_PROXY_TRANSACTION: {
311 data.enforceInterface(IApplicationThread.descriptor);
312 final String proxy = data.readString();
313 final String port = data.readString();
314 final String exclList = data.readString();
315 setHttpProxy(proxy, port, exclList);
319 case PROCESS_IN_BACKGROUND_TRANSACTION: {
320 data.enforceInterface(IApplicationThread.descriptor);
321 processInBackground();
325 case DUMP_SERVICE_TRANSACTION: {
326 data.enforceInterface(IApplicationThread.descriptor);
327 ParcelFileDescriptor fd = data.readFileDescriptor();
328 final IBinder service = data.readStrongBinder();
329 final String[] args = data.readStringArray();
331 dumpService(fd.getFileDescriptor(), service, args);
334 } catch (IOException e) {
340 case SCHEDULE_REGISTERED_RECEIVER_TRANSACTION: {
341 data.enforceInterface(IApplicationThread.descriptor);
342 IIntentReceiver receiver = IIntentReceiver.Stub.asInterface(
343 data.readStrongBinder());
344 Intent intent = Intent.CREATOR.createFromParcel(data);
345 int resultCode = data.readInt();
346 String dataStr = data.readString();
347 Bundle extras = data.readBundle();
348 boolean ordered = data.readInt() != 0;
349 boolean sticky = data.readInt() != 0;
350 scheduleRegisteredReceiver(receiver, intent,
351 resultCode, dataStr, extras, ordered, sticky);
355 case SCHEDULE_LOW_MEMORY_TRANSACTION:
361 case SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION:
363 data.enforceInterface(IApplicationThread.descriptor);
364 IBinder b = data.readStrongBinder();
365 scheduleActivityConfigurationChanged(b);
369 case PROFILER_CONTROL_TRANSACTION:
371 data.enforceInterface(IApplicationThread.descriptor);
372 boolean start = data.readInt() != 0;
373 String path = data.readString();
374 ParcelFileDescriptor fd = data.readInt() != 0
375 ? data.readFileDescriptor() : null;
376 profilerControl(start, path, fd);
380 case SET_SCHEDULING_GROUP_TRANSACTION:
382 data.enforceInterface(IApplicationThread.descriptor);
383 int group = data.readInt();
384 setSchedulingGroup(group);
388 case SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION:
390 data.enforceInterface(IApplicationThread.descriptor);
391 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
392 int backupMode = data.readInt();
393 scheduleCreateBackupAgent(appInfo, backupMode);
397 case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
399 data.enforceInterface(IApplicationThread.descriptor);
400 ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
401 scheduleDestroyBackupAgent(appInfo);
405 case GET_MEMORY_INFO_TRANSACTION:
407 data.enforceInterface(IApplicationThread.descriptor);
408 Debug.MemoryInfo mi = new Debug.MemoryInfo();
410 reply.writeNoException();
411 mi.writeToParcel(reply, 0);
415 case DISPATCH_PACKAGE_BROADCAST_TRANSACTION:
417 data.enforceInterface(IApplicationThread.descriptor);
418 int cmd = data.readInt();
419 String[] packages = data.readStringArray();
420 dispatchPackageBroadcast(cmd, packages);
424 case SCHEDULE_CRASH_TRANSACTION:
426 data.enforceInterface(IApplicationThread.descriptor);
427 String msg = data.readString();
432 case DUMP_HEAP_TRANSACTION:
434 data.enforceInterface(IApplicationThread.descriptor);
435 boolean managed = data.readInt() != 0;
436 String path = data.readString();
437 ParcelFileDescriptor fd = data.readInt() != 0
438 ? data.readFileDescriptor() : null;
439 dumpHeap(managed, path, fd);
443 case DUMP_ACTIVITY_TRANSACTION: {
444 data.enforceInterface(IApplicationThread.descriptor);
445 ParcelFileDescriptor fd = data.readFileDescriptor();
446 final IBinder activity = data.readStrongBinder();
447 final String prefix = data.readString();
448 final String[] args = data.readStringArray();
450 dumpActivity(fd.getFileDescriptor(), activity, prefix, args);
453 } catch (IOException e) {
459 case SET_CORE_SETTINGS: {
460 data.enforceInterface(IApplicationThread.descriptor);
461 Bundle settings = data.readBundle();
462 setCoreSettings(settings);
467 return super.onTransact(code, data, reply, flags);
470 public IBinder asBinder()
476 class ApplicationThreadProxy implements IApplicationThread {
477 private final IBinder mRemote;
479 public ApplicationThreadProxy(IBinder remote) {
483 public final IBinder asBinder() {
487 public final void schedulePauseActivity(IBinder token, boolean finished,
488 boolean userLeaving, int configChanges) throws RemoteException {
489 Parcel data = Parcel.obtain();
490 data.writeInterfaceToken(IApplicationThread.descriptor);
491 data.writeStrongBinder(token);
492 data.writeInt(finished ? 1 : 0);
493 data.writeInt(userLeaving ? 1 :0);
494 data.writeInt(configChanges);
495 mRemote.transact(SCHEDULE_PAUSE_ACTIVITY_TRANSACTION, data, null,
496 IBinder.FLAG_ONEWAY);
500 public final void scheduleStopActivity(IBinder token, boolean showWindow,
501 int configChanges) throws RemoteException {
502 Parcel data = Parcel.obtain();
503 data.writeInterfaceToken(IApplicationThread.descriptor);
504 data.writeStrongBinder(token);
505 data.writeInt(showWindow ? 1 : 0);
506 data.writeInt(configChanges);
507 mRemote.transact(SCHEDULE_STOP_ACTIVITY_TRANSACTION, data, null,
508 IBinder.FLAG_ONEWAY);
512 public final void scheduleWindowVisibility(IBinder token,
513 boolean showWindow) throws RemoteException {
514 Parcel data = Parcel.obtain();
515 data.writeInterfaceToken(IApplicationThread.descriptor);
516 data.writeStrongBinder(token);
517 data.writeInt(showWindow ? 1 : 0);
518 mRemote.transact(SCHEDULE_WINDOW_VISIBILITY_TRANSACTION, data, null,
519 IBinder.FLAG_ONEWAY);
523 public final void scheduleSleeping(IBinder token,
524 boolean sleeping) throws RemoteException {
525 Parcel data = Parcel.obtain();
526 data.writeInterfaceToken(IApplicationThread.descriptor);
527 data.writeStrongBinder(token);
528 data.writeInt(sleeping ? 1 : 0);
529 mRemote.transact(SCHEDULE_SLEEPING_TRANSACTION, data, null,
530 IBinder.FLAG_ONEWAY);
534 public final void scheduleResumeActivity(IBinder token, boolean isForward)
535 throws RemoteException {
536 Parcel data = Parcel.obtain();
537 data.writeInterfaceToken(IApplicationThread.descriptor);
538 data.writeStrongBinder(token);
539 data.writeInt(isForward ? 1 : 0);
540 mRemote.transact(SCHEDULE_RESUME_ACTIVITY_TRANSACTION, data, null,
541 IBinder.FLAG_ONEWAY);
545 public final void scheduleSendResult(IBinder token, List<ResultInfo> results)
546 throws RemoteException {
547 Parcel data = Parcel.obtain();
548 data.writeInterfaceToken(IApplicationThread.descriptor);
549 data.writeStrongBinder(token);
550 data.writeTypedList(results);
551 mRemote.transact(SCHEDULE_SEND_RESULT_TRANSACTION, data, null,
552 IBinder.FLAG_ONEWAY);
556 public final void scheduleLaunchActivity(Intent intent, IBinder token, int ident,
557 ActivityInfo info, Bundle state, List<ResultInfo> pendingResults,
558 List<Intent> pendingNewIntents, boolean notResumed, boolean isForward)
559 throws RemoteException {
560 Parcel data = Parcel.obtain();
561 data.writeInterfaceToken(IApplicationThread.descriptor);
562 intent.writeToParcel(data, 0);
563 data.writeStrongBinder(token);
564 data.writeInt(ident);
565 info.writeToParcel(data, 0);
566 data.writeBundle(state);
567 data.writeTypedList(pendingResults);
568 data.writeTypedList(pendingNewIntents);
569 data.writeInt(notResumed ? 1 : 0);
570 data.writeInt(isForward ? 1 : 0);
571 mRemote.transact(SCHEDULE_LAUNCH_ACTIVITY_TRANSACTION, data, null,
572 IBinder.FLAG_ONEWAY);
576 public final void scheduleRelaunchActivity(IBinder token,
577 List<ResultInfo> pendingResults, List<Intent> pendingNewIntents,
578 int configChanges, boolean notResumed, Configuration config)
579 throws RemoteException {
580 Parcel data = Parcel.obtain();
581 data.writeInterfaceToken(IApplicationThread.descriptor);
582 data.writeStrongBinder(token);
583 data.writeTypedList(pendingResults);
584 data.writeTypedList(pendingNewIntents);
585 data.writeInt(configChanges);
586 data.writeInt(notResumed ? 1 : 0);
587 if (config != null) {
589 config.writeToParcel(data, 0);
593 mRemote.transact(SCHEDULE_RELAUNCH_ACTIVITY_TRANSACTION, data, null,
594 IBinder.FLAG_ONEWAY);
598 public void scheduleNewIntent(List<Intent> intents, IBinder token)
599 throws RemoteException {
600 Parcel data = Parcel.obtain();
601 data.writeInterfaceToken(IApplicationThread.descriptor);
602 data.writeTypedList(intents);
603 data.writeStrongBinder(token);
604 mRemote.transact(SCHEDULE_NEW_INTENT_TRANSACTION, data, null,
605 IBinder.FLAG_ONEWAY);
609 public final void scheduleDestroyActivity(IBinder token, boolean finishing,
610 int configChanges) throws RemoteException {
611 Parcel data = Parcel.obtain();
612 data.writeInterfaceToken(IApplicationThread.descriptor);
613 data.writeStrongBinder(token);
614 data.writeInt(finishing ? 1 : 0);
615 data.writeInt(configChanges);
616 mRemote.transact(SCHEDULE_FINISH_ACTIVITY_TRANSACTION, data, null,
617 IBinder.FLAG_ONEWAY);
621 public final void scheduleReceiver(Intent intent, ActivityInfo info,
622 int resultCode, String resultData,
623 Bundle map, boolean sync) throws RemoteException {
624 Parcel data = Parcel.obtain();
625 data.writeInterfaceToken(IApplicationThread.descriptor);
626 intent.writeToParcel(data, 0);
627 info.writeToParcel(data, 0);
628 data.writeInt(resultCode);
629 data.writeString(resultData);
630 data.writeBundle(map);
631 data.writeInt(sync ? 1 : 0);
632 mRemote.transact(SCHEDULE_RECEIVER_TRANSACTION, data, null,
633 IBinder.FLAG_ONEWAY);
637 public final void scheduleCreateBackupAgent(ApplicationInfo app, int backupMode)
638 throws RemoteException {
639 Parcel data = Parcel.obtain();
640 data.writeInterfaceToken(IApplicationThread.descriptor);
641 app.writeToParcel(data, 0);
642 data.writeInt(backupMode);
643 mRemote.transact(SCHEDULE_CREATE_BACKUP_AGENT_TRANSACTION, data, null,
644 IBinder.FLAG_ONEWAY);
648 public final void scheduleDestroyBackupAgent(ApplicationInfo app) throws RemoteException {
649 Parcel data = Parcel.obtain();
650 data.writeInterfaceToken(IApplicationThread.descriptor);
651 app.writeToParcel(data, 0);
652 mRemote.transact(SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION, data, null,
653 IBinder.FLAG_ONEWAY);
657 public final void scheduleCreateService(IBinder token, ServiceInfo info)
658 throws RemoteException {
659 Parcel data = Parcel.obtain();
660 data.writeInterfaceToken(IApplicationThread.descriptor);
661 data.writeStrongBinder(token);
662 info.writeToParcel(data, 0);
663 mRemote.transact(SCHEDULE_CREATE_SERVICE_TRANSACTION, data, null,
664 IBinder.FLAG_ONEWAY);
668 public final void scheduleBindService(IBinder token, Intent intent, boolean rebind)
669 throws RemoteException {
670 Parcel data = Parcel.obtain();
671 data.writeInterfaceToken(IApplicationThread.descriptor);
672 data.writeStrongBinder(token);
673 intent.writeToParcel(data, 0);
674 data.writeInt(rebind ? 1 : 0);
675 mRemote.transact(SCHEDULE_BIND_SERVICE_TRANSACTION, data, null,
676 IBinder.FLAG_ONEWAY);
680 public final void scheduleUnbindService(IBinder token, Intent intent)
681 throws RemoteException {
682 Parcel data = Parcel.obtain();
683 data.writeInterfaceToken(IApplicationThread.descriptor);
684 data.writeStrongBinder(token);
685 intent.writeToParcel(data, 0);
686 mRemote.transact(SCHEDULE_UNBIND_SERVICE_TRANSACTION, data, null,
687 IBinder.FLAG_ONEWAY);
691 public final void scheduleServiceArgs(IBinder token, int startId,
692 int flags, Intent args) throws RemoteException {
693 Parcel data = Parcel.obtain();
694 data.writeInterfaceToken(IApplicationThread.descriptor);
695 data.writeStrongBinder(token);
696 data.writeInt(startId);
697 data.writeInt(flags);
700 args.writeToParcel(data, 0);
704 mRemote.transact(SCHEDULE_SERVICE_ARGS_TRANSACTION, data, null,
705 IBinder.FLAG_ONEWAY);
709 public final void scheduleStopService(IBinder token)
710 throws RemoteException {
711 Parcel data = Parcel.obtain();
712 data.writeInterfaceToken(IApplicationThread.descriptor);
713 data.writeStrongBinder(token);
714 mRemote.transact(SCHEDULE_STOP_SERVICE_TRANSACTION, data, null,
715 IBinder.FLAG_ONEWAY);
719 public final void bindApplication(String packageName, ApplicationInfo info,
720 List<ProviderInfo> providers, ComponentName testName,
721 String profileName, Bundle testArgs, IInstrumentationWatcher testWatcher, int debugMode,
722 boolean restrictedBackupMode, Configuration config,
723 Map<String, IBinder> services, Bundle coreSettings) throws RemoteException {
724 Parcel data = Parcel.obtain();
725 data.writeInterfaceToken(IApplicationThread.descriptor);
726 data.writeString(packageName);
727 info.writeToParcel(data, 0);
728 data.writeTypedList(providers);
729 if (testName == null) {
733 testName.writeToParcel(data, 0);
735 data.writeString(profileName);
736 data.writeBundle(testArgs);
737 data.writeStrongInterface(testWatcher);
738 data.writeInt(debugMode);
739 data.writeInt(restrictedBackupMode ? 1 : 0);
740 config.writeToParcel(data, 0);
741 data.writeMap(services);
742 data.writeBundle(coreSettings);
743 mRemote.transact(BIND_APPLICATION_TRANSACTION, data, null,
744 IBinder.FLAG_ONEWAY);
748 public final void scheduleExit() throws RemoteException {
749 Parcel data = Parcel.obtain();
750 data.writeInterfaceToken(IApplicationThread.descriptor);
751 mRemote.transact(SCHEDULE_EXIT_TRANSACTION, data, null,
752 IBinder.FLAG_ONEWAY);
756 public final void scheduleSuicide() throws RemoteException {
757 Parcel data = Parcel.obtain();
758 data.writeInterfaceToken(IApplicationThread.descriptor);
759 mRemote.transact(SCHEDULE_SUICIDE_TRANSACTION, data, null,
760 IBinder.FLAG_ONEWAY);
764 public final void requestThumbnail(IBinder token)
765 throws RemoteException {
766 Parcel data = Parcel.obtain();
767 data.writeInterfaceToken(IApplicationThread.descriptor);
768 data.writeStrongBinder(token);
769 mRemote.transact(REQUEST_THUMBNAIL_TRANSACTION, data, null,
770 IBinder.FLAG_ONEWAY);
774 public final void scheduleConfigurationChanged(Configuration config)
775 throws RemoteException {
776 Parcel data = Parcel.obtain();
777 data.writeInterfaceToken(IApplicationThread.descriptor);
778 config.writeToParcel(data, 0);
779 mRemote.transact(SCHEDULE_CONFIGURATION_CHANGED_TRANSACTION, data, null,
780 IBinder.FLAG_ONEWAY);
784 public void updateTimeZone() throws RemoteException {
785 Parcel data = Parcel.obtain();
786 data.writeInterfaceToken(IApplicationThread.descriptor);
787 mRemote.transact(UPDATE_TIME_ZONE_TRANSACTION, data, null,
788 IBinder.FLAG_ONEWAY);
792 public void clearDnsCache() throws RemoteException {
793 Parcel data = Parcel.obtain();
794 data.writeInterfaceToken(IApplicationThread.descriptor);
795 mRemote.transact(CLEAR_DNS_CACHE_TRANSACTION, data, null,
796 IBinder.FLAG_ONEWAY);
800 public void setHttpProxy(String proxy, String port, String exclList) throws RemoteException {
801 Parcel data = Parcel.obtain();
802 data.writeInterfaceToken(IApplicationThread.descriptor);
803 data.writeString(proxy);
804 data.writeString(port);
805 data.writeString(exclList);
806 mRemote.transact(SET_HTTP_PROXY_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
810 public void processInBackground() throws RemoteException {
811 Parcel data = Parcel.obtain();
812 data.writeInterfaceToken(IApplicationThread.descriptor);
813 mRemote.transact(PROCESS_IN_BACKGROUND_TRANSACTION, data, null,
814 IBinder.FLAG_ONEWAY);
818 public void dumpService(FileDescriptor fd, IBinder token, String[] args)
819 throws RemoteException {
820 Parcel data = Parcel.obtain();
821 data.writeInterfaceToken(IApplicationThread.descriptor);
822 data.writeFileDescriptor(fd);
823 data.writeStrongBinder(token);
824 data.writeStringArray(args);
825 mRemote.transact(DUMP_SERVICE_TRANSACTION, data, null, 0);
829 public void scheduleRegisteredReceiver(IIntentReceiver receiver, Intent intent,
830 int resultCode, String dataStr, Bundle extras, boolean ordered, boolean sticky)
831 throws RemoteException {
832 Parcel data = Parcel.obtain();
833 data.writeInterfaceToken(IApplicationThread.descriptor);
834 data.writeStrongBinder(receiver.asBinder());
835 intent.writeToParcel(data, 0);
836 data.writeInt(resultCode);
837 data.writeString(dataStr);
838 data.writeBundle(extras);
839 data.writeInt(ordered ? 1 : 0);
840 data.writeInt(sticky ? 1 : 0);
841 mRemote.transact(SCHEDULE_REGISTERED_RECEIVER_TRANSACTION, data, null,
842 IBinder.FLAG_ONEWAY);
846 public final void scheduleLowMemory() throws RemoteException {
847 Parcel data = Parcel.obtain();
848 data.writeInterfaceToken(IApplicationThread.descriptor);
849 mRemote.transact(SCHEDULE_LOW_MEMORY_TRANSACTION, data, null,
850 IBinder.FLAG_ONEWAY);
854 public final void scheduleActivityConfigurationChanged(
855 IBinder token) throws RemoteException {
856 Parcel data = Parcel.obtain();
857 data.writeInterfaceToken(IApplicationThread.descriptor);
858 data.writeStrongBinder(token);
859 mRemote.transact(SCHEDULE_ACTIVITY_CONFIGURATION_CHANGED_TRANSACTION, data, null,
860 IBinder.FLAG_ONEWAY);
864 public void profilerControl(boolean start, String path,
865 ParcelFileDescriptor fd) throws RemoteException {
866 Parcel data = Parcel.obtain();
867 data.writeInterfaceToken(IApplicationThread.descriptor);
868 data.writeInt(start ? 1 : 0);
869 data.writeString(path);
872 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
876 mRemote.transact(PROFILER_CONTROL_TRANSACTION, data, null,
877 IBinder.FLAG_ONEWAY);
881 public void setSchedulingGroup(int group) throws RemoteException {
882 Parcel data = Parcel.obtain();
883 data.writeInterfaceToken(IApplicationThread.descriptor);
884 data.writeInt(group);
885 mRemote.transact(SET_SCHEDULING_GROUP_TRANSACTION, data, null,
886 IBinder.FLAG_ONEWAY);
890 public void getMemoryInfo(Debug.MemoryInfo outInfo) throws RemoteException {
891 Parcel data = Parcel.obtain();
892 Parcel reply = Parcel.obtain();
893 data.writeInterfaceToken(IApplicationThread.descriptor);
894 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
895 reply.readException();
896 outInfo.readFromParcel(reply);
901 public void dispatchPackageBroadcast(int cmd, String[] packages) throws RemoteException {
902 Parcel data = Parcel.obtain();
903 data.writeInterfaceToken(IApplicationThread.descriptor);
905 data.writeStringArray(packages);
906 mRemote.transact(DISPATCH_PACKAGE_BROADCAST_TRANSACTION, data, null,
907 IBinder.FLAG_ONEWAY);
912 public void scheduleCrash(String msg) throws RemoteException {
913 Parcel data = Parcel.obtain();
914 data.writeInterfaceToken(IApplicationThread.descriptor);
915 data.writeString(msg);
916 mRemote.transact(SCHEDULE_CRASH_TRANSACTION, data, null,
917 IBinder.FLAG_ONEWAY);
922 public void dumpHeap(boolean managed, String path,
923 ParcelFileDescriptor fd) throws RemoteException {
924 Parcel data = Parcel.obtain();
925 data.writeInterfaceToken(IApplicationThread.descriptor);
926 data.writeInt(managed ? 1 : 0);
927 data.writeString(path);
930 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
934 mRemote.transact(DUMP_HEAP_TRANSACTION, data, null,
935 IBinder.FLAG_ONEWAY);
939 public void dumpActivity(FileDescriptor fd, IBinder token, String prefix, String[] args)
940 throws RemoteException {
941 Parcel data = Parcel.obtain();
942 data.writeInterfaceToken(IApplicationThread.descriptor);
943 data.writeFileDescriptor(fd);
944 data.writeStrongBinder(token);
945 data.writeString(prefix);
946 data.writeStringArray(args);
947 mRemote.transact(DUMP_ACTIVITY_TRANSACTION, data, null, 0);
951 public void setCoreSettings(Bundle coreSettings) throws RemoteException {
952 Parcel data = Parcel.obtain();
953 data.writeInterfaceToken(IApplicationThread.descriptor);
954 data.writeBundle(coreSettings);
955 mRemote.transact(SET_CORE_SETTINGS, data, null, IBinder.FLAG_ONEWAY);