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