blob: 447512a01d10395331d7c62d9ed08790a6382188 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.Intent;
21import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070022import android.content.IIntentSender;
23import android.content.IIntentReceiver;
Christopher Tate181fafa2009-05-14 11:12:14 -070024import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.content.pm.ConfigurationInfo;
26import android.content.pm.IPackageDataObserver;
27import android.content.res.Configuration;
28import android.graphics.Bitmap;
29import android.net.Uri;
30import android.os.Binder;
31import android.os.Bundle;
32import android.os.Parcelable;
33import android.os.ParcelFileDescriptor;
34import android.os.RemoteException;
35import android.os.IBinder;
36import android.os.Parcel;
37import android.os.ServiceManager;
38import android.text.TextUtils;
39import android.util.Config;
40import android.util.Log;
41
42import java.io.FileNotFoundException;
43import java.io.FileDescriptor;
44import java.io.IOException;
45import java.util.ArrayList;
46import java.util.List;
47
48/** {@hide} */
49public abstract class ActivityManagerNative extends Binder implements IActivityManager
50{
51 /**
52 * Cast a Binder object into an activity manager interface, generating
53 * a proxy if needed.
54 */
55 static public IActivityManager asInterface(IBinder obj)
56 {
57 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
65
66 return new ActivityManagerProxy(obj);
67 }
68
69 /**
70 * Retrieve the system's default/global activity manager.
71 */
72 static public IActivityManager getDefault()
73 {
74 if (gDefault != null) {
75 //if (Config.LOGV) Log.v(
76 // "ActivityManager", "returning cur default = " + gDefault);
77 return gDefault;
78 }
79 IBinder b = ServiceManager.getService("activity");
80 if (Config.LOGV) Log.v(
81 "ActivityManager", "default service binder = " + b);
82 gDefault = asInterface(b);
83 if (Config.LOGV) Log.v(
84 "ActivityManager", "default service = " + gDefault);
85 return gDefault;
86 }
87
88 /**
89 * Convenience for checking whether the system is ready. For internal use only.
90 */
91 static public boolean isSystemReady() {
92 if (!sSystemReady) {
93 sSystemReady = getDefault().testIsSystemReady();
94 }
95 return sSystemReady;
96 }
97 static boolean sSystemReady = false;
98
99 /**
100 * Convenience for sending a sticky broadcast. For internal use only.
101 * If you don't care about permission, use null.
102 */
103 static public void broadcastStickyIntent(Intent intent, String permission)
104 {
105 try {
106 getDefault().broadcastIntent(
107 null, intent, null, null, Activity.RESULT_OK, null, null,
108 null /*permission*/, false, true);
109 } catch (RemoteException ex) {
110 }
111 }
112
113 static public void noteWakeupAlarm(PendingIntent ps) {
114 try {
115 getDefault().noteWakeupAlarm(ps.getTarget());
116 } catch (RemoteException ex) {
117 }
118 }
119
120 public ActivityManagerNative()
121 {
122 attachInterface(this, descriptor);
123 }
124
125 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
126 throws RemoteException {
127 switch (code) {
128 case START_ACTIVITY_TRANSACTION:
129 {
130 data.enforceInterface(IActivityManager.descriptor);
131 IBinder b = data.readStrongBinder();
132 IApplicationThread app = ApplicationThreadNative.asInterface(b);
133 Intent intent = Intent.CREATOR.createFromParcel(data);
134 String resolvedType = data.readString();
135 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
136 int grantedMode = data.readInt();
137 IBinder resultTo = data.readStrongBinder();
138 String resultWho = data.readString();
139 int requestCode = data.readInt();
140 boolean onlyIfNeeded = data.readInt() != 0;
141 boolean debug = data.readInt() != 0;
142 int result = startActivity(app, intent, resolvedType,
143 grantedUriPermissions, grantedMode, resultTo, resultWho,
144 requestCode, onlyIfNeeded, debug);
145 reply.writeNoException();
146 reply.writeInt(result);
147 return true;
148 }
149
150 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
151 {
152 data.enforceInterface(IActivityManager.descriptor);
153 IBinder callingActivity = data.readStrongBinder();
154 Intent intent = Intent.CREATOR.createFromParcel(data);
155 boolean result = startNextMatchingActivity(callingActivity, intent);
156 reply.writeNoException();
157 reply.writeInt(result ? 1 : 0);
158 return true;
159 }
160
161 case FINISH_ACTIVITY_TRANSACTION: {
162 data.enforceInterface(IActivityManager.descriptor);
163 IBinder token = data.readStrongBinder();
164 Intent resultData = null;
165 int resultCode = data.readInt();
166 if (data.readInt() != 0) {
167 resultData = Intent.CREATOR.createFromParcel(data);
168 }
169 boolean res = finishActivity(token, resultCode, resultData);
170 reply.writeNoException();
171 reply.writeInt(res ? 1 : 0);
172 return true;
173 }
174
175 case FINISH_SUB_ACTIVITY_TRANSACTION: {
176 data.enforceInterface(IActivityManager.descriptor);
177 IBinder token = data.readStrongBinder();
178 String resultWho = data.readString();
179 int requestCode = data.readInt();
180 finishSubActivity(token, resultWho, requestCode);
181 reply.writeNoException();
182 return true;
183 }
184
185 case REGISTER_RECEIVER_TRANSACTION:
186 {
187 data.enforceInterface(IActivityManager.descriptor);
188 IBinder b = data.readStrongBinder();
189 IApplicationThread app =
190 b != null ? ApplicationThreadNative.asInterface(b) : null;
191 b = data.readStrongBinder();
192 IIntentReceiver rec
193 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
194 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
195 String perm = data.readString();
196 Intent intent = registerReceiver(app, rec, filter, perm);
197 reply.writeNoException();
198 if (intent != null) {
199 reply.writeInt(1);
200 intent.writeToParcel(reply, 0);
201 } else {
202 reply.writeInt(0);
203 }
204 return true;
205 }
206
207 case UNREGISTER_RECEIVER_TRANSACTION:
208 {
209 data.enforceInterface(IActivityManager.descriptor);
210 IBinder b = data.readStrongBinder();
211 if (b == null) {
212 return true;
213 }
214 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
215 unregisterReceiver(rec);
216 reply.writeNoException();
217 return true;
218 }
219
220 case BROADCAST_INTENT_TRANSACTION:
221 {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder b = data.readStrongBinder();
224 IApplicationThread app =
225 b != null ? ApplicationThreadNative.asInterface(b) : null;
226 Intent intent = Intent.CREATOR.createFromParcel(data);
227 String resolvedType = data.readString();
228 b = data.readStrongBinder();
229 IIntentReceiver resultTo =
230 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
231 int resultCode = data.readInt();
232 String resultData = data.readString();
233 Bundle resultExtras = data.readBundle();
234 String perm = data.readString();
235 boolean serialized = data.readInt() != 0;
236 boolean sticky = data.readInt() != 0;
237 int res = broadcastIntent(app, intent, resolvedType, resultTo,
238 resultCode, resultData, resultExtras, perm,
239 serialized, sticky);
240 reply.writeNoException();
241 reply.writeInt(res);
242 return true;
243 }
244
245 case UNBROADCAST_INTENT_TRANSACTION:
246 {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder b = data.readStrongBinder();
249 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
250 Intent intent = Intent.CREATOR.createFromParcel(data);
251 unbroadcastIntent(app, intent);
252 reply.writeNoException();
253 return true;
254 }
255
256 case FINISH_RECEIVER_TRANSACTION: {
257 data.enforceInterface(IActivityManager.descriptor);
258 IBinder who = data.readStrongBinder();
259 int resultCode = data.readInt();
260 String resultData = data.readString();
261 Bundle resultExtras = data.readBundle();
262 boolean resultAbort = data.readInt() != 0;
263 if (who != null) {
264 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
265 }
266 reply.writeNoException();
267 return true;
268 }
269
270 case SET_PERSISTENT_TRANSACTION: {
271 data.enforceInterface(IActivityManager.descriptor);
272 IBinder token = data.readStrongBinder();
273 boolean isPersistent = data.readInt() != 0;
274 if (token != null) {
275 setPersistent(token, isPersistent);
276 }
277 reply.writeNoException();
278 return true;
279 }
280
281 case ATTACH_APPLICATION_TRANSACTION: {
282 data.enforceInterface(IActivityManager.descriptor);
283 IApplicationThread app = ApplicationThreadNative.asInterface(
284 data.readStrongBinder());
285 if (app != null) {
286 attachApplication(app);
287 }
288 reply.writeNoException();
289 return true;
290 }
291
292 case ACTIVITY_IDLE_TRANSACTION: {
293 data.enforceInterface(IActivityManager.descriptor);
294 IBinder token = data.readStrongBinder();
295 if (token != null) {
296 activityIdle(token);
297 }
298 reply.writeNoException();
299 return true;
300 }
301
302 case ACTIVITY_PAUSED_TRANSACTION: {
303 data.enforceInterface(IActivityManager.descriptor);
304 IBinder token = data.readStrongBinder();
305 Bundle map = data.readBundle();
306 activityPaused(token, map);
307 reply.writeNoException();
308 return true;
309 }
310
311 case ACTIVITY_STOPPED_TRANSACTION: {
312 data.enforceInterface(IActivityManager.descriptor);
313 IBinder token = data.readStrongBinder();
314 Bitmap thumbnail = data.readInt() != 0
315 ? Bitmap.CREATOR.createFromParcel(data) : null;
316 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
317 activityStopped(token, thumbnail, description);
318 reply.writeNoException();
319 return true;
320 }
321
322 case ACTIVITY_DESTROYED_TRANSACTION: {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder token = data.readStrongBinder();
325 activityDestroyed(token);
326 reply.writeNoException();
327 return true;
328 }
329
330 case GET_CALLING_PACKAGE_TRANSACTION: {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder token = data.readStrongBinder();
333 String res = token != null ? getCallingPackage(token) : null;
334 reply.writeNoException();
335 reply.writeString(res);
336 return true;
337 }
338
339 case GET_CALLING_ACTIVITY_TRANSACTION: {
340 data.enforceInterface(IActivityManager.descriptor);
341 IBinder token = data.readStrongBinder();
342 ComponentName cn = getCallingActivity(token);
343 reply.writeNoException();
344 ComponentName.writeToParcel(cn, reply);
345 return true;
346 }
347
348 case GET_TASKS_TRANSACTION: {
349 data.enforceInterface(IActivityManager.descriptor);
350 int maxNum = data.readInt();
351 int fl = data.readInt();
352 IBinder receiverBinder = data.readStrongBinder();
353 IThumbnailReceiver receiver = receiverBinder != null
354 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
355 : null;
356 List list = getTasks(maxNum, fl, receiver);
357 reply.writeNoException();
358 int N = list != null ? list.size() : -1;
359 reply.writeInt(N);
360 int i;
361 for (i=0; i<N; i++) {
362 ActivityManager.RunningTaskInfo info =
363 (ActivityManager.RunningTaskInfo)list.get(i);
364 info.writeToParcel(reply, 0);
365 }
366 return true;
367 }
368
369 case GET_RECENT_TASKS_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 int maxNum = data.readInt();
372 int fl = data.readInt();
373 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
374 fl);
375 reply.writeNoException();
376 reply.writeTypedList(list);
377 return true;
378 }
379
380 case GET_SERVICES_TRANSACTION: {
381 data.enforceInterface(IActivityManager.descriptor);
382 int maxNum = data.readInt();
383 int fl = data.readInt();
384 List list = getServices(maxNum, fl);
385 reply.writeNoException();
386 int N = list != null ? list.size() : -1;
387 reply.writeInt(N);
388 int i;
389 for (i=0; i<N; i++) {
390 ActivityManager.RunningServiceInfo info =
391 (ActivityManager.RunningServiceInfo)list.get(i);
392 info.writeToParcel(reply, 0);
393 }
394 return true;
395 }
396
397 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
398 data.enforceInterface(IActivityManager.descriptor);
399 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
400 reply.writeNoException();
401 reply.writeTypedList(list);
402 return true;
403 }
404
405 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
406 data.enforceInterface(IActivityManager.descriptor);
407 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
408 reply.writeNoException();
409 reply.writeTypedList(list);
410 return true;
411 }
412
413 case MOVE_TASK_TO_FRONT_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 int task = data.readInt();
416 moveTaskToFront(task);
417 reply.writeNoException();
418 return true;
419 }
420
421 case MOVE_TASK_TO_BACK_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 int task = data.readInt();
424 moveTaskToBack(task);
425 reply.writeNoException();
426 return true;
427 }
428
429 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
430 data.enforceInterface(IActivityManager.descriptor);
431 IBinder token = data.readStrongBinder();
432 boolean nonRoot = data.readInt() != 0;
433 boolean res = moveActivityTaskToBack(token, nonRoot);
434 reply.writeNoException();
435 reply.writeInt(res ? 1 : 0);
436 return true;
437 }
438
439 case MOVE_TASK_BACKWARDS_TRANSACTION: {
440 data.enforceInterface(IActivityManager.descriptor);
441 int task = data.readInt();
442 moveTaskBackwards(task);
443 reply.writeNoException();
444 return true;
445 }
446
447 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 boolean onlyRoot = data.readInt() != 0;
451 int res = token != null
452 ? getTaskForActivity(token, onlyRoot) : -1;
453 reply.writeNoException();
454 reply.writeInt(res);
455 return true;
456 }
457
458 case FINISH_OTHER_INSTANCES_TRANSACTION: {
459 data.enforceInterface(IActivityManager.descriptor);
460 IBinder token = data.readStrongBinder();
461 ComponentName className = ComponentName.readFromParcel(data);
462 finishOtherInstances(token, className);
463 reply.writeNoException();
464 return true;
465 }
466
467 case REPORT_THUMBNAIL_TRANSACTION: {
468 data.enforceInterface(IActivityManager.descriptor);
469 IBinder token = data.readStrongBinder();
470 Bitmap thumbnail = data.readInt() != 0
471 ? Bitmap.CREATOR.createFromParcel(data) : null;
472 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
473 reportThumbnail(token, thumbnail, description);
474 reply.writeNoException();
475 return true;
476 }
477
478 case GET_CONTENT_PROVIDER_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 IBinder b = data.readStrongBinder();
481 IApplicationThread app = ApplicationThreadNative.asInterface(b);
482 String name = data.readString();
483 ContentProviderHolder cph = getContentProvider(app, name);
484 reply.writeNoException();
485 if (cph != null) {
486 reply.writeInt(1);
487 cph.writeToParcel(reply, 0);
488 } else {
489 reply.writeInt(0);
490 }
491 return true;
492 }
493
494 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 IBinder b = data.readStrongBinder();
497 IApplicationThread app = ApplicationThreadNative.asInterface(b);
498 ArrayList<ContentProviderHolder> providers =
499 data.createTypedArrayList(ContentProviderHolder.CREATOR);
500 publishContentProviders(app, providers);
501 reply.writeNoException();
502 return true;
503 }
504
505 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
506 data.enforceInterface(IActivityManager.descriptor);
507 IBinder b = data.readStrongBinder();
508 IApplicationThread app = ApplicationThreadNative.asInterface(b);
509 String name = data.readString();
510 removeContentProvider(app, name);
511 reply.writeNoException();
512 return true;
513 }
514
515 case START_SERVICE_TRANSACTION: {
516 data.enforceInterface(IActivityManager.descriptor);
517 IBinder b = data.readStrongBinder();
518 IApplicationThread app = ApplicationThreadNative.asInterface(b);
519 Intent service = Intent.CREATOR.createFromParcel(data);
520 String resolvedType = data.readString();
521 ComponentName cn = startService(app, service, resolvedType);
522 reply.writeNoException();
523 ComponentName.writeToParcel(cn, reply);
524 return true;
525 }
526
527 case STOP_SERVICE_TRANSACTION: {
528 data.enforceInterface(IActivityManager.descriptor);
529 IBinder b = data.readStrongBinder();
530 IApplicationThread app = ApplicationThreadNative.asInterface(b);
531 Intent service = Intent.CREATOR.createFromParcel(data);
532 String resolvedType = data.readString();
533 int res = stopService(app, service, resolvedType);
534 reply.writeNoException();
535 reply.writeInt(res);
536 return true;
537 }
538
539 case STOP_SERVICE_TOKEN_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 ComponentName className = ComponentName.readFromParcel(data);
542 IBinder token = data.readStrongBinder();
543 int startId = data.readInt();
544 boolean res = stopServiceToken(className, token, startId);
545 reply.writeNoException();
546 reply.writeInt(res ? 1 : 0);
547 return true;
548 }
549
550 case SET_SERVICE_FOREGROUND_TRANSACTION: {
551 data.enforceInterface(IActivityManager.descriptor);
552 ComponentName className = ComponentName.readFromParcel(data);
553 IBinder token = data.readStrongBinder();
554 boolean isForeground = data.readInt() != 0;
555 setServiceForeground(className, token, isForeground);
556 reply.writeNoException();
557 return true;
558 }
559
560 case BIND_SERVICE_TRANSACTION: {
561 data.enforceInterface(IActivityManager.descriptor);
562 IBinder b = data.readStrongBinder();
563 IApplicationThread app = ApplicationThreadNative.asInterface(b);
564 IBinder token = data.readStrongBinder();
565 Intent service = Intent.CREATOR.createFromParcel(data);
566 String resolvedType = data.readString();
567 b = data.readStrongBinder();
568 int fl = data.readInt();
569 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
570 int res = bindService(app, token, service, resolvedType, conn, fl);
571 reply.writeNoException();
572 reply.writeInt(res);
573 return true;
574 }
575
576 case UNBIND_SERVICE_TRANSACTION: {
577 data.enforceInterface(IActivityManager.descriptor);
578 IBinder b = data.readStrongBinder();
579 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
580 boolean res = unbindService(conn);
581 reply.writeNoException();
582 reply.writeInt(res ? 1 : 0);
583 return true;
584 }
585
586 case PUBLISH_SERVICE_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 IBinder token = data.readStrongBinder();
589 Intent intent = Intent.CREATOR.createFromParcel(data);
590 IBinder service = data.readStrongBinder();
591 publishService(token, intent, service);
592 reply.writeNoException();
593 return true;
594 }
595
596 case UNBIND_FINISHED_TRANSACTION: {
597 data.enforceInterface(IActivityManager.descriptor);
598 IBinder token = data.readStrongBinder();
599 Intent intent = Intent.CREATOR.createFromParcel(data);
600 boolean doRebind = data.readInt() != 0;
601 unbindFinished(token, intent, doRebind);
602 reply.writeNoException();
603 return true;
604 }
605
606 case SERVICE_DONE_EXECUTING_TRANSACTION: {
607 data.enforceInterface(IActivityManager.descriptor);
608 IBinder token = data.readStrongBinder();
609 serviceDoneExecuting(token);
610 reply.writeNoException();
611 return true;
612 }
613
614 case START_INSTRUMENTATION_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 ComponentName className = ComponentName.readFromParcel(data);
617 String profileFile = data.readString();
618 int fl = data.readInt();
619 Bundle arguments = data.readBundle();
620 IBinder b = data.readStrongBinder();
621 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
622 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
623 reply.writeNoException();
624 reply.writeInt(res ? 1 : 0);
625 return true;
626 }
627
628
629 case FINISH_INSTRUMENTATION_TRANSACTION: {
630 data.enforceInterface(IActivityManager.descriptor);
631 IBinder b = data.readStrongBinder();
632 IApplicationThread app = ApplicationThreadNative.asInterface(b);
633 int resultCode = data.readInt();
634 Bundle results = data.readBundle();
635 finishInstrumentation(app, resultCode, results);
636 reply.writeNoException();
637 return true;
638 }
639
640 case GET_CONFIGURATION_TRANSACTION: {
641 data.enforceInterface(IActivityManager.descriptor);
642 Configuration config = getConfiguration();
643 reply.writeNoException();
644 config.writeToParcel(reply, 0);
645 return true;
646 }
647
648 case UPDATE_CONFIGURATION_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 Configuration config = Configuration.CREATOR.createFromParcel(data);
651 updateConfiguration(config);
652 reply.writeNoException();
653 return true;
654 }
655
656 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 IBinder token = data.readStrongBinder();
659 int requestedOrientation = data.readInt();
660 setRequestedOrientation(token, requestedOrientation);
661 reply.writeNoException();
662 return true;
663 }
664
665 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 IBinder token = data.readStrongBinder();
668 int req = getRequestedOrientation(token);
669 reply.writeNoException();
670 reply.writeInt(req);
671 return true;
672 }
673
674 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 IBinder token = data.readStrongBinder();
677 ComponentName cn = getActivityClassForToken(token);
678 reply.writeNoException();
679 ComponentName.writeToParcel(cn, reply);
680 return true;
681 }
682
683 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 IBinder token = data.readStrongBinder();
686 reply.writeNoException();
687 reply.writeString(getPackageForToken(token));
688 return true;
689 }
690
691 case GET_INTENT_SENDER_TRANSACTION: {
692 data.enforceInterface(IActivityManager.descriptor);
693 int type = data.readInt();
694 String packageName = data.readString();
695 IBinder token = data.readStrongBinder();
696 String resultWho = data.readString();
697 int requestCode = data.readInt();
698 Intent requestIntent = data.readInt() != 0
699 ? Intent.CREATOR.createFromParcel(data) : null;
700 String requestResolvedType = data.readString();
701 int fl = data.readInt();
702 IIntentSender res = getIntentSender(type, packageName, token,
703 resultWho, requestCode, requestIntent,
704 requestResolvedType, fl);
705 reply.writeNoException();
706 reply.writeStrongBinder(res != null ? res.asBinder() : null);
707 return true;
708 }
709
710 case CANCEL_INTENT_SENDER_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 IIntentSender r = IIntentSender.Stub.asInterface(
713 data.readStrongBinder());
714 cancelIntentSender(r);
715 reply.writeNoException();
716 return true;
717 }
718
719 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
720 data.enforceInterface(IActivityManager.descriptor);
721 IIntentSender r = IIntentSender.Stub.asInterface(
722 data.readStrongBinder());
723 String res = getPackageForIntentSender(r);
724 reply.writeNoException();
725 reply.writeString(res);
726 return true;
727 }
728
729 case SET_PROCESS_LIMIT_TRANSACTION: {
730 data.enforceInterface(IActivityManager.descriptor);
731 int max = data.readInt();
732 setProcessLimit(max);
733 reply.writeNoException();
734 return true;
735 }
736
737 case GET_PROCESS_LIMIT_TRANSACTION: {
738 data.enforceInterface(IActivityManager.descriptor);
739 int limit = getProcessLimit();
740 reply.writeNoException();
741 reply.writeInt(limit);
742 return true;
743 }
744
745 case SET_PROCESS_FOREGROUND_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 IBinder token = data.readStrongBinder();
748 int pid = data.readInt();
749 boolean isForeground = data.readInt() != 0;
750 setProcessForeground(token, pid, isForeground);
751 reply.writeNoException();
752 return true;
753 }
754
755 case CHECK_PERMISSION_TRANSACTION: {
756 data.enforceInterface(IActivityManager.descriptor);
757 String perm = data.readString();
758 int pid = data.readInt();
759 int uid = data.readInt();
760 int res = checkPermission(perm, pid, uid);
761 reply.writeNoException();
762 reply.writeInt(res);
763 return true;
764 }
765
766 case CHECK_URI_PERMISSION_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 Uri uri = Uri.CREATOR.createFromParcel(data);
769 int pid = data.readInt();
770 int uid = data.readInt();
771 int mode = data.readInt();
772 int res = checkUriPermission(uri, pid, uid, mode);
773 reply.writeNoException();
774 reply.writeInt(res);
775 return true;
776 }
777
778 case CLEAR_APP_DATA_TRANSACTION: {
779 data.enforceInterface(IActivityManager.descriptor);
780 String packageName = data.readString();
781 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
782 data.readStrongBinder());
783 boolean res = clearApplicationUserData(packageName, observer);
784 reply.writeNoException();
785 reply.writeInt(res ? 1 : 0);
786 return true;
787 }
788
789 case GRANT_URI_PERMISSION_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 IBinder b = data.readStrongBinder();
792 IApplicationThread app = ApplicationThreadNative.asInterface(b);
793 String targetPkg = data.readString();
794 Uri uri = Uri.CREATOR.createFromParcel(data);
795 int mode = data.readInt();
796 grantUriPermission(app, targetPkg, uri, mode);
797 reply.writeNoException();
798 return true;
799 }
800
801 case REVOKE_URI_PERMISSION_TRANSACTION: {
802 data.enforceInterface(IActivityManager.descriptor);
803 IBinder b = data.readStrongBinder();
804 IApplicationThread app = ApplicationThreadNative.asInterface(b);
805 Uri uri = Uri.CREATOR.createFromParcel(data);
806 int mode = data.readInt();
807 revokeUriPermission(app, uri, mode);
808 reply.writeNoException();
809 return true;
810 }
811
812 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 IBinder b = data.readStrongBinder();
815 IApplicationThread app = ApplicationThreadNative.asInterface(b);
816 boolean waiting = data.readInt() != 0;
817 showWaitingForDebugger(app, waiting);
818 reply.writeNoException();
819 return true;
820 }
821
822 case GET_MEMORY_INFO_TRANSACTION: {
823 data.enforceInterface(IActivityManager.descriptor);
824 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
825 getMemoryInfo(mi);
826 reply.writeNoException();
827 mi.writeToParcel(reply, 0);
828 return true;
829 }
830
831 case UNHANDLED_BACK_TRANSACTION: {
832 data.enforceInterface(IActivityManager.descriptor);
833 unhandledBack();
834 reply.writeNoException();
835 return true;
836 }
837
838 case OPEN_CONTENT_URI_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 Uri uri = Uri.parse(data.readString());
841 ParcelFileDescriptor pfd = openContentUri(uri);
842 reply.writeNoException();
843 if (pfd != null) {
844 reply.writeInt(1);
845 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
846 } else {
847 reply.writeInt(0);
848 }
849 return true;
850 }
851
852 case GOING_TO_SLEEP_TRANSACTION: {
853 data.enforceInterface(IActivityManager.descriptor);
854 goingToSleep();
855 reply.writeNoException();
856 return true;
857 }
858
859 case WAKING_UP_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 wakingUp();
862 reply.writeNoException();
863 return true;
864 }
865
866 case SET_DEBUG_APP_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 String pn = data.readString();
869 boolean wfd = data.readInt() != 0;
870 boolean per = data.readInt() != 0;
871 setDebugApp(pn, wfd, per);
872 reply.writeNoException();
873 return true;
874 }
875
876 case SET_ALWAYS_FINISH_TRANSACTION: {
877 data.enforceInterface(IActivityManager.descriptor);
878 boolean enabled = data.readInt() != 0;
879 setAlwaysFinish(enabled);
880 reply.writeNoException();
881 return true;
882 }
883
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700884 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800885 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700886 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800887 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700888 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800889 return true;
890 }
891
892 case ENTER_SAFE_MODE_TRANSACTION: {
893 data.enforceInterface(IActivityManager.descriptor);
894 enterSafeMode();
895 reply.writeNoException();
896 return true;
897 }
898
899 case NOTE_WAKEUP_ALARM_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IIntentSender is = IIntentSender.Stub.asInterface(
902 data.readStrongBinder());
903 noteWakeupAlarm(is);
904 reply.writeNoException();
905 return true;
906 }
907
908 case KILL_PIDS_FOR_MEMORY_TRANSACTION: {
909 data.enforceInterface(IActivityManager.descriptor);
910 int[] pids = data.createIntArray();
911 boolean res = killPidsForMemory(pids);
912 reply.writeNoException();
913 reply.writeInt(res ? 1 : 0);
914 return true;
915 }
916
917 case REPORT_PSS_TRANSACTION: {
918 data.enforceInterface(IActivityManager.descriptor);
919 IBinder b = data.readStrongBinder();
920 IApplicationThread app = ApplicationThreadNative.asInterface(b);
921 int pss = data.readInt();
922 reportPss(app, pss);
923 reply.writeNoException();
924 return true;
925 }
926
927 case START_RUNNING_TRANSACTION: {
928 data.enforceInterface(IActivityManager.descriptor);
929 String pkg = data.readString();
930 String cls = data.readString();
931 String action = data.readString();
932 String indata = data.readString();
933 startRunning(pkg, cls, action, indata);
934 reply.writeNoException();
935 return true;
936 }
937
938 case SYSTEM_READY_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 systemReady();
941 reply.writeNoException();
942 return true;
943 }
944
945 case HANDLE_APPLICATION_ERROR_TRANSACTION: {
946 data.enforceInterface(IActivityManager.descriptor);
947 IBinder app = data.readStrongBinder();
948 int fl = data.readInt();
949 String tag = data.readString();
950 String shortMsg = data.readString();
951 String longMsg = data.readString();
952 byte[] crashData = data.createByteArray();
953 int res = handleApplicationError(app, fl, tag, shortMsg, longMsg,
954 crashData);
955 reply.writeNoException();
956 reply.writeInt(res);
957 return true;
958 }
959
960 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
961 data.enforceInterface(IActivityManager.descriptor);
962 int sig = data.readInt();
963 signalPersistentProcesses(sig);
964 reply.writeNoException();
965 return true;
966 }
967
968 case RESTART_PACKAGE_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 String packageName = data.readString();
971 restartPackage(packageName);
972 reply.writeNoException();
973 return true;
974 }
975
976 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 ConfigurationInfo config = getDeviceConfigurationInfo();
979 reply.writeNoException();
980 config.writeToParcel(reply, 0);
981 return true;
982 }
983
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800984 case PROFILE_CONTROL_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 String process = data.readString();
987 boolean start = data.readInt() != 0;
988 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -0700989 ParcelFileDescriptor fd = data.readInt() != 0
990 ? data.readFileDescriptor() : null;
991 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -0800992 reply.writeNoException();
993 reply.writeInt(res ? 1 : 0);
994 return true;
995 }
996
Dianne Hackborn55280a92009-05-07 15:53:46 -0700997 case SHUTDOWN_TRANSACTION: {
998 data.enforceInterface(IActivityManager.descriptor);
999 boolean res = shutdown(data.readInt());
1000 reply.writeNoException();
1001 reply.writeInt(res ? 1 : 0);
1002 return true;
1003 }
1004
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001005 case STOP_APP_SWITCHES_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 stopAppSwitches();
1008 reply.writeNoException();
1009 return true;
1010 }
1011
1012 case RESUME_APP_SWITCHES_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 resumeAppSwitches();
1015 reply.writeNoException();
1016 return true;
1017 }
1018
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 case PEEK_SERVICE_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 Intent service = Intent.CREATOR.createFromParcel(data);
1022 String resolvedType = data.readString();
1023 IBinder binder = peekService(service, resolvedType);
1024 reply.writeNoException();
1025 reply.writeStrongBinder(binder);
1026 return true;
1027 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001028
1029 case START_BACKUP_AGENT_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1032 int backupRestoreMode = data.readInt();
1033 boolean success = bindBackupAgent(info, backupRestoreMode);
1034 reply.writeNoException();
1035 reply.writeInt(success ? 1 : 0);
1036 return true;
1037 }
1038
1039 case BACKUP_AGENT_CREATED_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 String packageName = data.readString();
1042 IBinder agent = data.readStrongBinder();
1043 backupAgentCreated(packageName, agent);
1044 reply.writeNoException();
1045 return true;
1046 }
1047
1048 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1049 data.enforceInterface(IActivityManager.descriptor);
1050 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1051 unbindBackupAgent(info);
1052 reply.writeNoException();
1053 return true;
1054 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001055
1056 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1057 data.enforceInterface(IActivityManager.descriptor);
1058 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1059 data.readStrongBinder());
1060 registerActivityWatcher(watcher);
1061 return true;
1062 }
1063
1064 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1067 data.readStrongBinder());
1068 unregisterActivityWatcher(watcher);
1069 return true;
1070 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001071
1072 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1073 {
1074 data.enforceInterface(IActivityManager.descriptor);
1075 int uid = data.readInt();
1076 Intent intent = Intent.CREATOR.createFromParcel(data);
1077 String resolvedType = data.readString();
1078 IBinder resultTo = data.readStrongBinder();
1079 String resultWho = data.readString();
1080 int requestCode = data.readInt();
1081 boolean onlyIfNeeded = data.readInt() != 0;
1082 int result = startActivityInPackage(uid, intent, resolvedType,
1083 resultTo, resultWho, requestCode, onlyIfNeeded);
1084 reply.writeNoException();
1085 reply.writeInt(result);
1086 return true;
1087 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001088
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001089 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 String pkg = data.readString();
1092 int uid = data.readInt();
1093 killApplicationWithUid(pkg, uid);
1094 reply.writeNoException();
1095 return true;
1096 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001097
1098 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 String reason = data.readString();
1101 closeSystemDialogs(reason);
1102 reply.writeNoException();
1103 return true;
1104 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001105 }
1106
1107 return super.onTransact(code, data, reply, flags);
1108 }
1109
1110 public IBinder asBinder()
1111 {
1112 return this;
1113 }
1114
1115 private static IActivityManager gDefault;
1116}
1117
1118class ActivityManagerProxy implements IActivityManager
1119{
1120 public ActivityManagerProxy(IBinder remote)
1121 {
1122 mRemote = remote;
1123 }
1124
1125 public IBinder asBinder()
1126 {
1127 return mRemote;
1128 }
1129
1130 public int startActivity(IApplicationThread caller, Intent intent,
1131 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1132 IBinder resultTo, String resultWho,
1133 int requestCode, boolean onlyIfNeeded,
1134 boolean debug) throws RemoteException {
1135 Parcel data = Parcel.obtain();
1136 Parcel reply = Parcel.obtain();
1137 data.writeInterfaceToken(IActivityManager.descriptor);
1138 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1139 intent.writeToParcel(data, 0);
1140 data.writeString(resolvedType);
1141 data.writeTypedArray(grantedUriPermissions, 0);
1142 data.writeInt(grantedMode);
1143 data.writeStrongBinder(resultTo);
1144 data.writeString(resultWho);
1145 data.writeInt(requestCode);
1146 data.writeInt(onlyIfNeeded ? 1 : 0);
1147 data.writeInt(debug ? 1 : 0);
1148 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1149 reply.readException();
1150 int result = reply.readInt();
1151 reply.recycle();
1152 data.recycle();
1153 return result;
1154 }
1155 public boolean startNextMatchingActivity(IBinder callingActivity,
1156 Intent intent) throws RemoteException {
1157 Parcel data = Parcel.obtain();
1158 Parcel reply = Parcel.obtain();
1159 data.writeInterfaceToken(IActivityManager.descriptor);
1160 data.writeStrongBinder(callingActivity);
1161 intent.writeToParcel(data, 0);
1162 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1163 reply.readException();
1164 int result = reply.readInt();
1165 reply.recycle();
1166 data.recycle();
1167 return result != 0;
1168 }
1169 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1170 throws RemoteException {
1171 Parcel data = Parcel.obtain();
1172 Parcel reply = Parcel.obtain();
1173 data.writeInterfaceToken(IActivityManager.descriptor);
1174 data.writeStrongBinder(token);
1175 data.writeInt(resultCode);
1176 if (resultData != null) {
1177 data.writeInt(1);
1178 resultData.writeToParcel(data, 0);
1179 } else {
1180 data.writeInt(0);
1181 }
1182 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1183 reply.readException();
1184 boolean res = reply.readInt() != 0;
1185 data.recycle();
1186 reply.recycle();
1187 return res;
1188 }
1189 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1190 {
1191 Parcel data = Parcel.obtain();
1192 Parcel reply = Parcel.obtain();
1193 data.writeInterfaceToken(IActivityManager.descriptor);
1194 data.writeStrongBinder(token);
1195 data.writeString(resultWho);
1196 data.writeInt(requestCode);
1197 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1198 reply.readException();
1199 data.recycle();
1200 reply.recycle();
1201 }
1202 public Intent registerReceiver(IApplicationThread caller,
1203 IIntentReceiver receiver,
1204 IntentFilter filter, String perm) throws RemoteException
1205 {
1206 Parcel data = Parcel.obtain();
1207 Parcel reply = Parcel.obtain();
1208 data.writeInterfaceToken(IActivityManager.descriptor);
1209 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1210 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1211 filter.writeToParcel(data, 0);
1212 data.writeString(perm);
1213 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1214 reply.readException();
1215 Intent intent = null;
1216 int haveIntent = reply.readInt();
1217 if (haveIntent != 0) {
1218 intent = Intent.CREATOR.createFromParcel(reply);
1219 }
1220 reply.recycle();
1221 data.recycle();
1222 return intent;
1223 }
1224 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1225 {
1226 Parcel data = Parcel.obtain();
1227 Parcel reply = Parcel.obtain();
1228 data.writeInterfaceToken(IActivityManager.descriptor);
1229 data.writeStrongBinder(receiver.asBinder());
1230 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1231 reply.readException();
1232 data.recycle();
1233 reply.recycle();
1234 }
1235 public int broadcastIntent(IApplicationThread caller,
1236 Intent intent, String resolvedType, IIntentReceiver resultTo,
1237 int resultCode, String resultData, Bundle map,
1238 String requiredPermission, boolean serialized,
1239 boolean sticky) throws RemoteException
1240 {
1241 Parcel data = Parcel.obtain();
1242 Parcel reply = Parcel.obtain();
1243 data.writeInterfaceToken(IActivityManager.descriptor);
1244 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1245 intent.writeToParcel(data, 0);
1246 data.writeString(resolvedType);
1247 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1248 data.writeInt(resultCode);
1249 data.writeString(resultData);
1250 data.writeBundle(map);
1251 data.writeString(requiredPermission);
1252 data.writeInt(serialized ? 1 : 0);
1253 data.writeInt(sticky ? 1 : 0);
1254 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1255 reply.readException();
1256 int res = reply.readInt();
1257 reply.recycle();
1258 data.recycle();
1259 return res;
1260 }
1261 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1262 {
1263 Parcel data = Parcel.obtain();
1264 Parcel reply = Parcel.obtain();
1265 data.writeInterfaceToken(IActivityManager.descriptor);
1266 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1267 intent.writeToParcel(data, 0);
1268 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1269 reply.readException();
1270 data.recycle();
1271 reply.recycle();
1272 }
1273 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1274 {
1275 Parcel data = Parcel.obtain();
1276 Parcel reply = Parcel.obtain();
1277 data.writeInterfaceToken(IActivityManager.descriptor);
1278 data.writeStrongBinder(who);
1279 data.writeInt(resultCode);
1280 data.writeString(resultData);
1281 data.writeBundle(map);
1282 data.writeInt(abortBroadcast ? 1 : 0);
1283 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1284 reply.readException();
1285 data.recycle();
1286 reply.recycle();
1287 }
1288 public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException
1289 {
1290 Parcel data = Parcel.obtain();
1291 Parcel reply = Parcel.obtain();
1292 data.writeInterfaceToken(IActivityManager.descriptor);
1293 data.writeStrongBinder(token);
1294 data.writeInt(isPersistent ? 1 : 0);
1295 mRemote.transact(SET_PERSISTENT_TRANSACTION, data, reply, 0);
1296 reply.readException();
1297 data.recycle();
1298 reply.recycle();
1299 }
1300 public void attachApplication(IApplicationThread app) throws RemoteException
1301 {
1302 Parcel data = Parcel.obtain();
1303 Parcel reply = Parcel.obtain();
1304 data.writeInterfaceToken(IActivityManager.descriptor);
1305 data.writeStrongBinder(app.asBinder());
1306 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1307 reply.readException();
1308 data.recycle();
1309 reply.recycle();
1310 }
1311 public void activityIdle(IBinder token) throws RemoteException
1312 {
1313 Parcel data = Parcel.obtain();
1314 Parcel reply = Parcel.obtain();
1315 data.writeInterfaceToken(IActivityManager.descriptor);
1316 data.writeStrongBinder(token);
1317 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1318 reply.readException();
1319 data.recycle();
1320 reply.recycle();
1321 }
1322 public void activityPaused(IBinder token, Bundle state) throws RemoteException
1323 {
1324 Parcel data = Parcel.obtain();
1325 Parcel reply = Parcel.obtain();
1326 data.writeInterfaceToken(IActivityManager.descriptor);
1327 data.writeStrongBinder(token);
1328 data.writeBundle(state);
1329 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1330 reply.readException();
1331 data.recycle();
1332 reply.recycle();
1333 }
1334 public void activityStopped(IBinder token,
1335 Bitmap thumbnail, CharSequence description) throws RemoteException
1336 {
1337 Parcel data = Parcel.obtain();
1338 Parcel reply = Parcel.obtain();
1339 data.writeInterfaceToken(IActivityManager.descriptor);
1340 data.writeStrongBinder(token);
1341 if (thumbnail != null) {
1342 data.writeInt(1);
1343 thumbnail.writeToParcel(data, 0);
1344 } else {
1345 data.writeInt(0);
1346 }
1347 TextUtils.writeToParcel(description, data, 0);
1348 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1349 reply.readException();
1350 data.recycle();
1351 reply.recycle();
1352 }
1353 public void activityDestroyed(IBinder token) throws RemoteException
1354 {
1355 Parcel data = Parcel.obtain();
1356 Parcel reply = Parcel.obtain();
1357 data.writeInterfaceToken(IActivityManager.descriptor);
1358 data.writeStrongBinder(token);
1359 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1360 reply.readException();
1361 data.recycle();
1362 reply.recycle();
1363 }
1364 public String getCallingPackage(IBinder token) throws RemoteException
1365 {
1366 Parcel data = Parcel.obtain();
1367 Parcel reply = Parcel.obtain();
1368 data.writeInterfaceToken(IActivityManager.descriptor);
1369 data.writeStrongBinder(token);
1370 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1371 reply.readException();
1372 String res = reply.readString();
1373 data.recycle();
1374 reply.recycle();
1375 return res;
1376 }
1377 public ComponentName getCallingActivity(IBinder token)
1378 throws RemoteException {
1379 Parcel data = Parcel.obtain();
1380 Parcel reply = Parcel.obtain();
1381 data.writeInterfaceToken(IActivityManager.descriptor);
1382 data.writeStrongBinder(token);
1383 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1384 reply.readException();
1385 ComponentName res = ComponentName.readFromParcel(reply);
1386 data.recycle();
1387 reply.recycle();
1388 return res;
1389 }
1390 public List getTasks(int maxNum, int flags,
1391 IThumbnailReceiver receiver) throws RemoteException {
1392 Parcel data = Parcel.obtain();
1393 Parcel reply = Parcel.obtain();
1394 data.writeInterfaceToken(IActivityManager.descriptor);
1395 data.writeInt(maxNum);
1396 data.writeInt(flags);
1397 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1398 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1399 reply.readException();
1400 ArrayList list = null;
1401 int N = reply.readInt();
1402 if (N >= 0) {
1403 list = new ArrayList();
1404 while (N > 0) {
1405 ActivityManager.RunningTaskInfo info =
1406 ActivityManager.RunningTaskInfo.CREATOR
1407 .createFromParcel(reply);
1408 list.add(info);
1409 N--;
1410 }
1411 }
1412 data.recycle();
1413 reply.recycle();
1414 return list;
1415 }
1416 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1417 int flags) throws RemoteException {
1418 Parcel data = Parcel.obtain();
1419 Parcel reply = Parcel.obtain();
1420 data.writeInterfaceToken(IActivityManager.descriptor);
1421 data.writeInt(maxNum);
1422 data.writeInt(flags);
1423 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1424 reply.readException();
1425 ArrayList<ActivityManager.RecentTaskInfo> list
1426 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1427 data.recycle();
1428 reply.recycle();
1429 return list;
1430 }
1431 public List getServices(int maxNum, int flags) throws RemoteException {
1432 Parcel data = Parcel.obtain();
1433 Parcel reply = Parcel.obtain();
1434 data.writeInterfaceToken(IActivityManager.descriptor);
1435 data.writeInt(maxNum);
1436 data.writeInt(flags);
1437 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1438 reply.readException();
1439 ArrayList list = null;
1440 int N = reply.readInt();
1441 if (N >= 0) {
1442 list = new ArrayList();
1443 while (N > 0) {
1444 ActivityManager.RunningServiceInfo info =
1445 ActivityManager.RunningServiceInfo.CREATOR
1446 .createFromParcel(reply);
1447 list.add(info);
1448 N--;
1449 }
1450 }
1451 data.recycle();
1452 reply.recycle();
1453 return list;
1454 }
1455 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1456 throws RemoteException {
1457 Parcel data = Parcel.obtain();
1458 Parcel reply = Parcel.obtain();
1459 data.writeInterfaceToken(IActivityManager.descriptor);
1460 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1461 reply.readException();
1462 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1463 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1464 data.recycle();
1465 reply.recycle();
1466 return list;
1467 }
1468 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1469 throws RemoteException {
1470 Parcel data = Parcel.obtain();
1471 Parcel reply = Parcel.obtain();
1472 data.writeInterfaceToken(IActivityManager.descriptor);
1473 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1474 reply.readException();
1475 ArrayList<ActivityManager.RunningAppProcessInfo> list
1476 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1477 data.recycle();
1478 reply.recycle();
1479 return list;
1480 }
1481 public void moveTaskToFront(int task) throws RemoteException
1482 {
1483 Parcel data = Parcel.obtain();
1484 Parcel reply = Parcel.obtain();
1485 data.writeInterfaceToken(IActivityManager.descriptor);
1486 data.writeInt(task);
1487 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1488 reply.readException();
1489 data.recycle();
1490 reply.recycle();
1491 }
1492 public void moveTaskToBack(int task) throws RemoteException
1493 {
1494 Parcel data = Parcel.obtain();
1495 Parcel reply = Parcel.obtain();
1496 data.writeInterfaceToken(IActivityManager.descriptor);
1497 data.writeInt(task);
1498 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1499 reply.readException();
1500 data.recycle();
1501 reply.recycle();
1502 }
1503 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1504 throws RemoteException {
1505 Parcel data = Parcel.obtain();
1506 Parcel reply = Parcel.obtain();
1507 data.writeInterfaceToken(IActivityManager.descriptor);
1508 data.writeStrongBinder(token);
1509 data.writeInt(nonRoot ? 1 : 0);
1510 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1511 reply.readException();
1512 boolean res = reply.readInt() != 0;
1513 data.recycle();
1514 reply.recycle();
1515 return res;
1516 }
1517 public void moveTaskBackwards(int task) throws RemoteException
1518 {
1519 Parcel data = Parcel.obtain();
1520 Parcel reply = Parcel.obtain();
1521 data.writeInterfaceToken(IActivityManager.descriptor);
1522 data.writeInt(task);
1523 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1524 reply.readException();
1525 data.recycle();
1526 reply.recycle();
1527 }
1528 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
1529 {
1530 Parcel data = Parcel.obtain();
1531 Parcel reply = Parcel.obtain();
1532 data.writeInterfaceToken(IActivityManager.descriptor);
1533 data.writeStrongBinder(token);
1534 data.writeInt(onlyRoot ? 1 : 0);
1535 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
1536 reply.readException();
1537 int res = reply.readInt();
1538 data.recycle();
1539 reply.recycle();
1540 return res;
1541 }
1542 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
1543 {
1544 Parcel data = Parcel.obtain();
1545 Parcel reply = Parcel.obtain();
1546 data.writeInterfaceToken(IActivityManager.descriptor);
1547 data.writeStrongBinder(token);
1548 ComponentName.writeToParcel(className, data);
1549 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
1550 reply.readException();
1551 data.recycle();
1552 reply.recycle();
1553 }
1554 public void reportThumbnail(IBinder token,
1555 Bitmap thumbnail, CharSequence description) throws RemoteException
1556 {
1557 Parcel data = Parcel.obtain();
1558 Parcel reply = Parcel.obtain();
1559 data.writeInterfaceToken(IActivityManager.descriptor);
1560 data.writeStrongBinder(token);
1561 if (thumbnail != null) {
1562 data.writeInt(1);
1563 thumbnail.writeToParcel(data, 0);
1564 } else {
1565 data.writeInt(0);
1566 }
1567 TextUtils.writeToParcel(description, data, 0);
1568 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1569 reply.readException();
1570 data.recycle();
1571 reply.recycle();
1572 }
1573 public ContentProviderHolder getContentProvider(IApplicationThread caller,
1574 String name) throws RemoteException
1575 {
1576 Parcel data = Parcel.obtain();
1577 Parcel reply = Parcel.obtain();
1578 data.writeInterfaceToken(IActivityManager.descriptor);
1579 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1580 data.writeString(name);
1581 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1582 reply.readException();
1583 int res = reply.readInt();
1584 ContentProviderHolder cph = null;
1585 if (res != 0) {
1586 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
1587 }
1588 data.recycle();
1589 reply.recycle();
1590 return cph;
1591 }
1592 public void publishContentProviders(IApplicationThread caller,
1593 List<ContentProviderHolder> providers) throws RemoteException
1594 {
1595 Parcel data = Parcel.obtain();
1596 Parcel reply = Parcel.obtain();
1597 data.writeInterfaceToken(IActivityManager.descriptor);
1598 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1599 data.writeTypedList(providers);
1600 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
1601 reply.readException();
1602 data.recycle();
1603 reply.recycle();
1604 }
1605
1606 public void removeContentProvider(IApplicationThread caller,
1607 String name) throws RemoteException {
1608 Parcel data = Parcel.obtain();
1609 Parcel reply = Parcel.obtain();
1610 data.writeInterfaceToken(IActivityManager.descriptor);
1611 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1612 data.writeString(name);
1613 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1614 reply.readException();
1615 data.recycle();
1616 reply.recycle();
1617 }
1618
1619 public ComponentName startService(IApplicationThread caller, Intent service,
1620 String resolvedType) throws RemoteException
1621 {
1622 Parcel data = Parcel.obtain();
1623 Parcel reply = Parcel.obtain();
1624 data.writeInterfaceToken(IActivityManager.descriptor);
1625 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1626 service.writeToParcel(data, 0);
1627 data.writeString(resolvedType);
1628 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
1629 reply.readException();
1630 ComponentName res = ComponentName.readFromParcel(reply);
1631 data.recycle();
1632 reply.recycle();
1633 return res;
1634 }
1635 public int stopService(IApplicationThread caller, Intent service,
1636 String resolvedType) throws RemoteException
1637 {
1638 Parcel data = Parcel.obtain();
1639 Parcel reply = Parcel.obtain();
1640 data.writeInterfaceToken(IActivityManager.descriptor);
1641 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1642 service.writeToParcel(data, 0);
1643 data.writeString(resolvedType);
1644 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
1645 reply.readException();
1646 int res = reply.readInt();
1647 reply.recycle();
1648 data.recycle();
1649 return res;
1650 }
1651 public boolean stopServiceToken(ComponentName className, IBinder token,
1652 int startId) throws RemoteException {
1653 Parcel data = Parcel.obtain();
1654 Parcel reply = Parcel.obtain();
1655 data.writeInterfaceToken(IActivityManager.descriptor);
1656 ComponentName.writeToParcel(className, data);
1657 data.writeStrongBinder(token);
1658 data.writeInt(startId);
1659 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
1660 reply.readException();
1661 boolean res = reply.readInt() != 0;
1662 data.recycle();
1663 reply.recycle();
1664 return res;
1665 }
1666 public void setServiceForeground(ComponentName className, IBinder token,
1667 boolean isForeground) throws RemoteException {
1668 Parcel data = Parcel.obtain();
1669 Parcel reply = Parcel.obtain();
1670 data.writeInterfaceToken(IActivityManager.descriptor);
1671 ComponentName.writeToParcel(className, data);
1672 data.writeStrongBinder(token);
1673 data.writeInt(isForeground ? 1 : 0);
1674 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
1675 reply.readException();
1676 data.recycle();
1677 reply.recycle();
1678 }
1679 public int bindService(IApplicationThread caller, IBinder token,
1680 Intent service, String resolvedType, IServiceConnection connection,
1681 int flags) throws RemoteException {
1682 Parcel data = Parcel.obtain();
1683 Parcel reply = Parcel.obtain();
1684 data.writeInterfaceToken(IActivityManager.descriptor);
1685 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1686 data.writeStrongBinder(token);
1687 service.writeToParcel(data, 0);
1688 data.writeString(resolvedType);
1689 data.writeStrongBinder(connection.asBinder());
1690 data.writeInt(flags);
1691 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
1692 reply.readException();
1693 int res = reply.readInt();
1694 data.recycle();
1695 reply.recycle();
1696 return res;
1697 }
1698 public boolean unbindService(IServiceConnection connection) throws RemoteException
1699 {
1700 Parcel data = Parcel.obtain();
1701 Parcel reply = Parcel.obtain();
1702 data.writeInterfaceToken(IActivityManager.descriptor);
1703 data.writeStrongBinder(connection.asBinder());
1704 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
1705 reply.readException();
1706 boolean res = reply.readInt() != 0;
1707 data.recycle();
1708 reply.recycle();
1709 return res;
1710 }
1711
1712 public void publishService(IBinder token,
1713 Intent intent, IBinder service) throws RemoteException {
1714 Parcel data = Parcel.obtain();
1715 Parcel reply = Parcel.obtain();
1716 data.writeInterfaceToken(IActivityManager.descriptor);
1717 data.writeStrongBinder(token);
1718 intent.writeToParcel(data, 0);
1719 data.writeStrongBinder(service);
1720 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
1721 reply.readException();
1722 data.recycle();
1723 reply.recycle();
1724 }
1725
1726 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
1727 throws RemoteException {
1728 Parcel data = Parcel.obtain();
1729 Parcel reply = Parcel.obtain();
1730 data.writeInterfaceToken(IActivityManager.descriptor);
1731 data.writeStrongBinder(token);
1732 intent.writeToParcel(data, 0);
1733 data.writeInt(doRebind ? 1 : 0);
1734 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
1735 reply.readException();
1736 data.recycle();
1737 reply.recycle();
1738 }
1739
1740 public void serviceDoneExecuting(IBinder token) throws RemoteException {
1741 Parcel data = Parcel.obtain();
1742 Parcel reply = Parcel.obtain();
1743 data.writeInterfaceToken(IActivityManager.descriptor);
1744 data.writeStrongBinder(token);
1745 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1746 reply.readException();
1747 data.recycle();
1748 reply.recycle();
1749 }
1750
1751 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
1752 Parcel data = Parcel.obtain();
1753 Parcel reply = Parcel.obtain();
1754 data.writeInterfaceToken(IActivityManager.descriptor);
1755 service.writeToParcel(data, 0);
1756 data.writeString(resolvedType);
1757 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
1758 reply.readException();
1759 IBinder binder = reply.readStrongBinder();
1760 reply.recycle();
1761 data.recycle();
1762 return binder;
1763 }
1764
Christopher Tate181fafa2009-05-14 11:12:14 -07001765 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
1766 throws RemoteException {
1767 Parcel data = Parcel.obtain();
1768 Parcel reply = Parcel.obtain();
1769 data.writeInterfaceToken(IActivityManager.descriptor);
1770 app.writeToParcel(data, 0);
1771 data.writeInt(backupRestoreMode);
1772 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
1773 reply.readException();
1774 boolean success = reply.readInt() != 0;
1775 reply.recycle();
1776 data.recycle();
1777 return success;
1778 }
1779
1780 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
1781 Parcel data = Parcel.obtain();
1782 Parcel reply = Parcel.obtain();
1783 data.writeInterfaceToken(IActivityManager.descriptor);
1784 data.writeString(packageName);
1785 data.writeStrongBinder(agent);
1786 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
1787 reply.recycle();
1788 data.recycle();
1789 }
1790
1791 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
1792 Parcel data = Parcel.obtain();
1793 Parcel reply = Parcel.obtain();
1794 data.writeInterfaceToken(IActivityManager.descriptor);
1795 app.writeToParcel(data, 0);
1796 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
1797 reply.readException();
1798 reply.recycle();
1799 data.recycle();
1800 }
1801
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001802 public boolean startInstrumentation(ComponentName className, String profileFile,
1803 int flags, Bundle arguments, IInstrumentationWatcher watcher)
1804 throws RemoteException {
1805 Parcel data = Parcel.obtain();
1806 Parcel reply = Parcel.obtain();
1807 data.writeInterfaceToken(IActivityManager.descriptor);
1808 ComponentName.writeToParcel(className, data);
1809 data.writeString(profileFile);
1810 data.writeInt(flags);
1811 data.writeBundle(arguments);
1812 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
1813 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
1814 reply.readException();
1815 boolean res = reply.readInt() != 0;
1816 reply.recycle();
1817 data.recycle();
1818 return res;
1819 }
1820
1821 public void finishInstrumentation(IApplicationThread target,
1822 int resultCode, Bundle results) throws RemoteException {
1823 Parcel data = Parcel.obtain();
1824 Parcel reply = Parcel.obtain();
1825 data.writeInterfaceToken(IActivityManager.descriptor);
1826 data.writeStrongBinder(target != null ? target.asBinder() : null);
1827 data.writeInt(resultCode);
1828 data.writeBundle(results);
1829 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
1830 reply.readException();
1831 data.recycle();
1832 reply.recycle();
1833 }
1834 public Configuration getConfiguration() throws RemoteException
1835 {
1836 Parcel data = Parcel.obtain();
1837 Parcel reply = Parcel.obtain();
1838 data.writeInterfaceToken(IActivityManager.descriptor);
1839 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
1840 reply.readException();
1841 Configuration res = Configuration.CREATOR.createFromParcel(reply);
1842 reply.recycle();
1843 data.recycle();
1844 return res;
1845 }
1846 public void updateConfiguration(Configuration values) throws RemoteException
1847 {
1848 Parcel data = Parcel.obtain();
1849 Parcel reply = Parcel.obtain();
1850 data.writeInterfaceToken(IActivityManager.descriptor);
1851 values.writeToParcel(data, 0);
1852 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
1853 reply.readException();
1854 data.recycle();
1855 reply.recycle();
1856 }
1857 public void setRequestedOrientation(IBinder token, int requestedOrientation)
1858 throws RemoteException {
1859 Parcel data = Parcel.obtain();
1860 Parcel reply = Parcel.obtain();
1861 data.writeInterfaceToken(IActivityManager.descriptor);
1862 data.writeStrongBinder(token);
1863 data.writeInt(requestedOrientation);
1864 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
1865 reply.readException();
1866 data.recycle();
1867 reply.recycle();
1868 }
1869 public int getRequestedOrientation(IBinder token) throws RemoteException {
1870 Parcel data = Parcel.obtain();
1871 Parcel reply = Parcel.obtain();
1872 data.writeInterfaceToken(IActivityManager.descriptor);
1873 data.writeStrongBinder(token);
1874 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
1875 reply.readException();
1876 int res = reply.readInt();
1877 data.recycle();
1878 reply.recycle();
1879 return res;
1880 }
1881 public ComponentName getActivityClassForToken(IBinder token)
1882 throws RemoteException {
1883 Parcel data = Parcel.obtain();
1884 Parcel reply = Parcel.obtain();
1885 data.writeInterfaceToken(IActivityManager.descriptor);
1886 data.writeStrongBinder(token);
1887 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
1888 reply.readException();
1889 ComponentName res = ComponentName.readFromParcel(reply);
1890 data.recycle();
1891 reply.recycle();
1892 return res;
1893 }
1894 public String getPackageForToken(IBinder token) throws RemoteException
1895 {
1896 Parcel data = Parcel.obtain();
1897 Parcel reply = Parcel.obtain();
1898 data.writeInterfaceToken(IActivityManager.descriptor);
1899 data.writeStrongBinder(token);
1900 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
1901 reply.readException();
1902 String res = reply.readString();
1903 data.recycle();
1904 reply.recycle();
1905 return res;
1906 }
1907 public IIntentSender getIntentSender(int type,
1908 String packageName, IBinder token, String resultWho,
1909 int requestCode, Intent intent, String resolvedType, int flags)
1910 throws RemoteException {
1911 Parcel data = Parcel.obtain();
1912 Parcel reply = Parcel.obtain();
1913 data.writeInterfaceToken(IActivityManager.descriptor);
1914 data.writeInt(type);
1915 data.writeString(packageName);
1916 data.writeStrongBinder(token);
1917 data.writeString(resultWho);
1918 data.writeInt(requestCode);
1919 if (intent != null) {
1920 data.writeInt(1);
1921 intent.writeToParcel(data, 0);
1922 } else {
1923 data.writeInt(0);
1924 }
1925 data.writeString(resolvedType);
1926 data.writeInt(flags);
1927 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
1928 reply.readException();
1929 IIntentSender res = IIntentSender.Stub.asInterface(
1930 reply.readStrongBinder());
1931 data.recycle();
1932 reply.recycle();
1933 return res;
1934 }
1935 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
1936 Parcel data = Parcel.obtain();
1937 Parcel reply = Parcel.obtain();
1938 data.writeInterfaceToken(IActivityManager.descriptor);
1939 data.writeStrongBinder(sender.asBinder());
1940 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
1941 reply.readException();
1942 data.recycle();
1943 reply.recycle();
1944 }
1945 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
1946 Parcel data = Parcel.obtain();
1947 Parcel reply = Parcel.obtain();
1948 data.writeInterfaceToken(IActivityManager.descriptor);
1949 data.writeStrongBinder(sender.asBinder());
1950 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
1951 reply.readException();
1952 String res = reply.readString();
1953 data.recycle();
1954 reply.recycle();
1955 return res;
1956 }
1957 public void setProcessLimit(int max) throws RemoteException
1958 {
1959 Parcel data = Parcel.obtain();
1960 Parcel reply = Parcel.obtain();
1961 data.writeInterfaceToken(IActivityManager.descriptor);
1962 data.writeInt(max);
1963 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
1964 reply.readException();
1965 data.recycle();
1966 reply.recycle();
1967 }
1968 public int getProcessLimit() throws RemoteException
1969 {
1970 Parcel data = Parcel.obtain();
1971 Parcel reply = Parcel.obtain();
1972 data.writeInterfaceToken(IActivityManager.descriptor);
1973 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
1974 reply.readException();
1975 int res = reply.readInt();
1976 data.recycle();
1977 reply.recycle();
1978 return res;
1979 }
1980 public void setProcessForeground(IBinder token, int pid,
1981 boolean isForeground) throws RemoteException {
1982 Parcel data = Parcel.obtain();
1983 Parcel reply = Parcel.obtain();
1984 data.writeInterfaceToken(IActivityManager.descriptor);
1985 data.writeStrongBinder(token);
1986 data.writeInt(pid);
1987 data.writeInt(isForeground ? 1 : 0);
1988 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
1989 reply.readException();
1990 data.recycle();
1991 reply.recycle();
1992 }
1993 public int checkPermission(String permission, int pid, int uid)
1994 throws RemoteException {
1995 Parcel data = Parcel.obtain();
1996 Parcel reply = Parcel.obtain();
1997 data.writeInterfaceToken(IActivityManager.descriptor);
1998 data.writeString(permission);
1999 data.writeInt(pid);
2000 data.writeInt(uid);
2001 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2002 reply.readException();
2003 int res = reply.readInt();
2004 data.recycle();
2005 reply.recycle();
2006 return res;
2007 }
2008 public boolean clearApplicationUserData(final String packageName,
2009 final IPackageDataObserver observer) throws RemoteException {
2010 Parcel data = Parcel.obtain();
2011 Parcel reply = Parcel.obtain();
2012 data.writeInterfaceToken(IActivityManager.descriptor);
2013 data.writeString(packageName);
2014 data.writeStrongBinder(observer.asBinder());
2015 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2016 reply.readException();
2017 boolean res = reply.readInt() != 0;
2018 data.recycle();
2019 reply.recycle();
2020 return res;
2021 }
2022 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2023 throws RemoteException {
2024 Parcel data = Parcel.obtain();
2025 Parcel reply = Parcel.obtain();
2026 data.writeInterfaceToken(IActivityManager.descriptor);
2027 uri.writeToParcel(data, 0);
2028 data.writeInt(pid);
2029 data.writeInt(uid);
2030 data.writeInt(mode);
2031 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2032 reply.readException();
2033 int res = reply.readInt();
2034 data.recycle();
2035 reply.recycle();
2036 return res;
2037 }
2038 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2039 Uri uri, int mode) throws RemoteException {
2040 Parcel data = Parcel.obtain();
2041 Parcel reply = Parcel.obtain();
2042 data.writeInterfaceToken(IActivityManager.descriptor);
2043 data.writeStrongBinder(caller.asBinder());
2044 data.writeString(targetPkg);
2045 uri.writeToParcel(data, 0);
2046 data.writeInt(mode);
2047 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2048 reply.readException();
2049 data.recycle();
2050 reply.recycle();
2051 }
2052 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2053 int mode) throws RemoteException {
2054 Parcel data = Parcel.obtain();
2055 Parcel reply = Parcel.obtain();
2056 data.writeInterfaceToken(IActivityManager.descriptor);
2057 data.writeStrongBinder(caller.asBinder());
2058 uri.writeToParcel(data, 0);
2059 data.writeInt(mode);
2060 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2061 reply.readException();
2062 data.recycle();
2063 reply.recycle();
2064 }
2065 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2066 throws RemoteException {
2067 Parcel data = Parcel.obtain();
2068 Parcel reply = Parcel.obtain();
2069 data.writeInterfaceToken(IActivityManager.descriptor);
2070 data.writeStrongBinder(who.asBinder());
2071 data.writeInt(waiting ? 1 : 0);
2072 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2073 reply.readException();
2074 data.recycle();
2075 reply.recycle();
2076 }
2077 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2078 Parcel data = Parcel.obtain();
2079 Parcel reply = Parcel.obtain();
2080 data.writeInterfaceToken(IActivityManager.descriptor);
2081 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2082 reply.readException();
2083 outInfo.readFromParcel(reply);
2084 data.recycle();
2085 reply.recycle();
2086 }
2087 public void unhandledBack() throws RemoteException
2088 {
2089 Parcel data = Parcel.obtain();
2090 Parcel reply = Parcel.obtain();
2091 data.writeInterfaceToken(IActivityManager.descriptor);
2092 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2093 reply.readException();
2094 data.recycle();
2095 reply.recycle();
2096 }
2097 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2098 {
2099 Parcel data = Parcel.obtain();
2100 Parcel reply = Parcel.obtain();
2101 data.writeInterfaceToken(IActivityManager.descriptor);
2102 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2103 reply.readException();
2104 ParcelFileDescriptor pfd = null;
2105 if (reply.readInt() != 0) {
2106 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2107 }
2108 data.recycle();
2109 reply.recycle();
2110 return pfd;
2111 }
2112 public void goingToSleep() throws RemoteException
2113 {
2114 Parcel data = Parcel.obtain();
2115 Parcel reply = Parcel.obtain();
2116 data.writeInterfaceToken(IActivityManager.descriptor);
2117 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2118 reply.readException();
2119 data.recycle();
2120 reply.recycle();
2121 }
2122 public void wakingUp() throws RemoteException
2123 {
2124 Parcel data = Parcel.obtain();
2125 Parcel reply = Parcel.obtain();
2126 data.writeInterfaceToken(IActivityManager.descriptor);
2127 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2128 reply.readException();
2129 data.recycle();
2130 reply.recycle();
2131 }
2132 public void setDebugApp(
2133 String packageName, boolean waitForDebugger, boolean persistent)
2134 throws RemoteException
2135 {
2136 Parcel data = Parcel.obtain();
2137 Parcel reply = Parcel.obtain();
2138 data.writeInterfaceToken(IActivityManager.descriptor);
2139 data.writeString(packageName);
2140 data.writeInt(waitForDebugger ? 1 : 0);
2141 data.writeInt(persistent ? 1 : 0);
2142 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2143 reply.readException();
2144 data.recycle();
2145 reply.recycle();
2146 }
2147 public void setAlwaysFinish(boolean enabled) throws RemoteException
2148 {
2149 Parcel data = Parcel.obtain();
2150 Parcel reply = Parcel.obtain();
2151 data.writeInterfaceToken(IActivityManager.descriptor);
2152 data.writeInt(enabled ? 1 : 0);
2153 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2154 reply.readException();
2155 data.recycle();
2156 reply.recycle();
2157 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002158 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002159 {
2160 Parcel data = Parcel.obtain();
2161 Parcel reply = Parcel.obtain();
2162 data.writeInterfaceToken(IActivityManager.descriptor);
2163 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002164 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002165 reply.readException();
2166 data.recycle();
2167 reply.recycle();
2168 }
2169 public void enterSafeMode() throws RemoteException {
2170 Parcel data = Parcel.obtain();
2171 data.writeInterfaceToken(IActivityManager.descriptor);
2172 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2173 data.recycle();
2174 }
2175 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2176 Parcel data = Parcel.obtain();
2177 data.writeStrongBinder(sender.asBinder());
2178 data.writeInterfaceToken(IActivityManager.descriptor);
2179 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2180 data.recycle();
2181 }
2182 public boolean killPidsForMemory(int[] pids) throws RemoteException {
2183 Parcel data = Parcel.obtain();
2184 Parcel reply = Parcel.obtain();
2185 data.writeInterfaceToken(IActivityManager.descriptor);
2186 data.writeIntArray(pids);
2187 mRemote.transact(KILL_PIDS_FOR_MEMORY_TRANSACTION, data, reply, 0);
2188 boolean res = reply.readInt() != 0;
2189 data.recycle();
2190 reply.recycle();
2191 return res;
2192 }
2193 public void reportPss(IApplicationThread caller, int pss) throws RemoteException {
2194 Parcel data = Parcel.obtain();
2195 data.writeInterfaceToken(IActivityManager.descriptor);
2196 data.writeStrongBinder(caller.asBinder());
2197 data.writeInt(pss);
2198 mRemote.transact(REPORT_PSS_TRANSACTION, data, null, 0);
2199 data.recycle();
2200 }
2201 public void startRunning(String pkg, String cls, String action,
2202 String indata) throws RemoteException {
2203 Parcel data = Parcel.obtain();
2204 Parcel reply = Parcel.obtain();
2205 data.writeInterfaceToken(IActivityManager.descriptor);
2206 data.writeString(pkg);
2207 data.writeString(cls);
2208 data.writeString(action);
2209 data.writeString(indata);
2210 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2211 reply.readException();
2212 data.recycle();
2213 reply.recycle();
2214 }
2215 public void systemReady() throws RemoteException
2216 {
2217 Parcel data = Parcel.obtain();
2218 Parcel reply = Parcel.obtain();
2219 data.writeInterfaceToken(IActivityManager.descriptor);
2220 mRemote.transact(SYSTEM_READY_TRANSACTION, data, reply, 0);
2221 reply.readException();
2222 data.recycle();
2223 reply.recycle();
2224 }
2225 public boolean testIsSystemReady()
2226 {
2227 /* this base class version is never called */
2228 return true;
2229 }
2230 public int handleApplicationError(IBinder app, int flags,
2231 String tag, String shortMsg, String longMsg,
2232 byte[] crashData) throws RemoteException
2233 {
2234 Parcel data = Parcel.obtain();
2235 Parcel reply = Parcel.obtain();
2236 data.writeInterfaceToken(IActivityManager.descriptor);
2237 data.writeStrongBinder(app);
2238 data.writeInt(flags);
2239 data.writeString(tag);
2240 data.writeString(shortMsg);
2241 data.writeString(longMsg);
2242 data.writeByteArray(crashData);
2243 mRemote.transact(HANDLE_APPLICATION_ERROR_TRANSACTION, data, reply, 0);
2244 reply.readException();
2245 int res = reply.readInt();
2246 reply.recycle();
2247 data.recycle();
2248 return res;
2249 }
2250
2251 public void signalPersistentProcesses(int sig) throws RemoteException {
2252 Parcel data = Parcel.obtain();
2253 Parcel reply = Parcel.obtain();
2254 data.writeInterfaceToken(IActivityManager.descriptor);
2255 data.writeInt(sig);
2256 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2257 reply.readException();
2258 data.recycle();
2259 reply.recycle();
2260 }
2261
2262 public void restartPackage(String packageName) throws RemoteException {
2263 Parcel data = Parcel.obtain();
2264 Parcel reply = Parcel.obtain();
2265 data.writeInterfaceToken(IActivityManager.descriptor);
2266 data.writeString(packageName);
2267 mRemote.transact(RESTART_PACKAGE_TRANSACTION, data, reply, 0);
2268 reply.readException();
2269 data.recycle();
2270 reply.recycle();
2271 }
2272
2273 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2274 {
2275 Parcel data = Parcel.obtain();
2276 Parcel reply = Parcel.obtain();
2277 data.writeInterfaceToken(IActivityManager.descriptor);
2278 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2279 reply.readException();
2280 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2281 reply.recycle();
2282 data.recycle();
2283 return res;
2284 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002285
2286 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002287 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002288 {
2289 Parcel data = Parcel.obtain();
2290 Parcel reply = Parcel.obtain();
2291 data.writeInterfaceToken(IActivityManager.descriptor);
2292 data.writeString(process);
2293 data.writeInt(start ? 1 : 0);
2294 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002295 if (fd != null) {
2296 data.writeInt(1);
2297 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2298 } else {
2299 data.writeInt(0);
2300 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002301 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2302 reply.readException();
2303 boolean res = reply.readInt() != 0;
2304 reply.recycle();
2305 data.recycle();
2306 return res;
2307 }
2308
Dianne Hackborn55280a92009-05-07 15:53:46 -07002309 public boolean shutdown(int timeout) throws RemoteException
2310 {
2311 Parcel data = Parcel.obtain();
2312 Parcel reply = Parcel.obtain();
2313 data.writeInterfaceToken(IActivityManager.descriptor);
2314 data.writeInt(timeout);
2315 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2316 reply.readException();
2317 boolean res = reply.readInt() != 0;
2318 reply.recycle();
2319 data.recycle();
2320 return res;
2321 }
2322
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002323 public void stopAppSwitches() throws RemoteException {
2324 Parcel data = Parcel.obtain();
2325 Parcel reply = Parcel.obtain();
2326 data.writeInterfaceToken(IActivityManager.descriptor);
2327 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2328 reply.readException();
2329 reply.recycle();
2330 data.recycle();
2331 }
2332
2333 public void resumeAppSwitches() throws RemoteException {
2334 Parcel data = Parcel.obtain();
2335 Parcel reply = Parcel.obtain();
2336 data.writeInterfaceToken(IActivityManager.descriptor);
2337 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2338 reply.readException();
2339 reply.recycle();
2340 data.recycle();
2341 }
2342
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002343 public void registerActivityWatcher(IActivityWatcher watcher)
2344 throws RemoteException {
2345 Parcel data = Parcel.obtain();
2346 Parcel reply = Parcel.obtain();
2347 data.writeInterfaceToken(IActivityManager.descriptor);
2348 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2349 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2350 reply.readException();
2351 data.recycle();
2352 reply.recycle();
2353 }
2354
2355 public void unregisterActivityWatcher(IActivityWatcher watcher)
2356 throws RemoteException {
2357 Parcel data = Parcel.obtain();
2358 Parcel reply = Parcel.obtain();
2359 data.writeInterfaceToken(IActivityManager.descriptor);
2360 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2361 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 data.recycle();
2364 reply.recycle();
2365 }
2366
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002367 public int startActivityInPackage(int uid,
2368 Intent intent, String resolvedType, IBinder resultTo,
2369 String resultWho, int requestCode, boolean onlyIfNeeded)
2370 throws RemoteException {
2371 Parcel data = Parcel.obtain();
2372 Parcel reply = Parcel.obtain();
2373 data.writeInterfaceToken(IActivityManager.descriptor);
2374 data.writeInt(uid);
2375 intent.writeToParcel(data, 0);
2376 data.writeString(resolvedType);
2377 data.writeStrongBinder(resultTo);
2378 data.writeString(resultWho);
2379 data.writeInt(requestCode);
2380 data.writeInt(onlyIfNeeded ? 1 : 0);
2381 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2382 reply.readException();
2383 int result = reply.readInt();
2384 reply.recycle();
2385 data.recycle();
2386 return result;
2387 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002388
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002389 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2390 Parcel data = Parcel.obtain();
2391 Parcel reply = Parcel.obtain();
2392 data.writeInterfaceToken(IActivityManager.descriptor);
2393 data.writeString(pkg);
2394 data.writeInt(uid);
2395 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2396 reply.readException();
2397 data.recycle();
2398 reply.recycle();
2399 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002400
2401 public void closeSystemDialogs(String reason) throws RemoteException {
2402 Parcel data = Parcel.obtain();
2403 Parcel reply = Parcel.obtain();
2404 data.writeInterfaceToken(IActivityManager.descriptor);
2405 data.writeString(reason);
2406 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2407 reply.readException();
2408 data.recycle();
2409 reply.recycle();
2410 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002412 private IBinder mRemote;
2413}