blob: b4c7edc71ba90e37fa579cc3978a698e629b5bf3 [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;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
28import android.content.res.Configuration;
29import android.graphics.Bitmap;
30import android.net.Uri;
31import android.os.Binder;
32import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070033import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.os.Parcelable;
35import android.os.ParcelFileDescriptor;
36import android.os.RemoteException;
37import android.os.IBinder;
38import android.os.Parcel;
39import android.os.ServiceManager;
40import android.text.TextUtils;
41import android.util.Config;
42import android.util.Log;
43
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import java.util.ArrayList;
45import java.util.List;
46
47/** {@hide} */
48public abstract class ActivityManagerNative extends Binder implements IActivityManager
49{
50 /**
51 * Cast a Binder object into an activity manager interface, generating
52 * a proxy if needed.
53 */
54 static public IActivityManager asInterface(IBinder obj)
55 {
56 if (obj == null) {
57 return null;
58 }
59 IActivityManager in =
60 (IActivityManager)obj.queryLocalInterface(descriptor);
61 if (in != null) {
62 return in;
63 }
64
65 return new ActivityManagerProxy(obj);
66 }
67
68 /**
69 * Retrieve the system's default/global activity manager.
70 */
71 static public IActivityManager getDefault()
72 {
73 if (gDefault != null) {
74 //if (Config.LOGV) Log.v(
75 // "ActivityManager", "returning cur default = " + gDefault);
76 return gDefault;
77 }
78 IBinder b = ServiceManager.getService("activity");
79 if (Config.LOGV) Log.v(
80 "ActivityManager", "default service binder = " + b);
81 gDefault = asInterface(b);
82 if (Config.LOGV) Log.v(
83 "ActivityManager", "default service = " + gDefault);
84 return gDefault;
85 }
86
87 /**
88 * Convenience for checking whether the system is ready. For internal use only.
89 */
90 static public boolean isSystemReady() {
91 if (!sSystemReady) {
92 sSystemReady = getDefault().testIsSystemReady();
93 }
94 return sSystemReady;
95 }
96 static boolean sSystemReady = false;
97
98 /**
99 * Convenience for sending a sticky broadcast. For internal use only.
100 * If you don't care about permission, use null.
101 */
102 static public void broadcastStickyIntent(Intent intent, String permission)
103 {
104 try {
105 getDefault().broadcastIntent(
106 null, intent, null, null, Activity.RESULT_OK, null, null,
107 null /*permission*/, false, true);
108 } catch (RemoteException ex) {
109 }
110 }
111
112 static public void noteWakeupAlarm(PendingIntent ps) {
113 try {
114 getDefault().noteWakeupAlarm(ps.getTarget());
115 } catch (RemoteException ex) {
116 }
117 }
118
119 public ActivityManagerNative()
120 {
121 attachInterface(this, descriptor);
122 }
123
124 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
125 throws RemoteException {
126 switch (code) {
127 case START_ACTIVITY_TRANSACTION:
128 {
129 data.enforceInterface(IActivityManager.descriptor);
130 IBinder b = data.readStrongBinder();
131 IApplicationThread app = ApplicationThreadNative.asInterface(b);
132 Intent intent = Intent.CREATOR.createFromParcel(data);
133 String resolvedType = data.readString();
134 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
135 int grantedMode = data.readInt();
136 IBinder resultTo = data.readStrongBinder();
137 String resultWho = data.readString();
138 int requestCode = data.readInt();
139 boolean onlyIfNeeded = data.readInt() != 0;
140 boolean debug = data.readInt() != 0;
141 int result = startActivity(app, intent, resolvedType,
142 grantedUriPermissions, grantedMode, resultTo, resultWho,
143 requestCode, onlyIfNeeded, debug);
144 reply.writeNoException();
145 reply.writeInt(result);
146 return true;
147 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700148
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800149 case START_ACTIVITY_AND_WAIT_TRANSACTION:
150 {
151 data.enforceInterface(IActivityManager.descriptor);
152 IBinder b = data.readStrongBinder();
153 IApplicationThread app = ApplicationThreadNative.asInterface(b);
154 Intent intent = Intent.CREATOR.createFromParcel(data);
155 String resolvedType = data.readString();
156 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
157 int grantedMode = data.readInt();
158 IBinder resultTo = data.readStrongBinder();
159 String resultWho = data.readString();
160 int requestCode = data.readInt();
161 boolean onlyIfNeeded = data.readInt() != 0;
162 boolean debug = data.readInt() != 0;
163 WaitResult result = startActivityAndWait(app, intent, resolvedType,
164 grantedUriPermissions, grantedMode, resultTo, resultWho,
165 requestCode, onlyIfNeeded, debug);
166 reply.writeNoException();
167 result.writeToParcel(reply, 0);
168 return true;
169 }
170
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700171 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
172 {
173 data.enforceInterface(IActivityManager.descriptor);
174 IBinder b = data.readStrongBinder();
175 IApplicationThread app = ApplicationThreadNative.asInterface(b);
176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
178 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
179 int grantedMode = data.readInt();
180 IBinder resultTo = data.readStrongBinder();
181 String resultWho = data.readString();
182 int requestCode = data.readInt();
183 boolean onlyIfNeeded = data.readInt() != 0;
184 boolean debug = data.readInt() != 0;
185 Configuration config = Configuration.CREATOR.createFromParcel(data);
186 int result = startActivityWithConfig(app, intent, resolvedType,
187 grantedUriPermissions, grantedMode, resultTo, resultWho,
188 requestCode, onlyIfNeeded, debug, config);
189 reply.writeNoException();
190 reply.writeInt(result);
191 return true;
192 }
193
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700194 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700195 {
196 data.enforceInterface(IActivityManager.descriptor);
197 IBinder b = data.readStrongBinder();
198 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700199 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700200 Intent fillInIntent = null;
201 if (data.readInt() != 0) {
202 fillInIntent = Intent.CREATOR.createFromParcel(data);
203 }
204 String resolvedType = data.readString();
205 IBinder resultTo = data.readStrongBinder();
206 String resultWho = data.readString();
207 int requestCode = data.readInt();
208 int flagsMask = data.readInt();
209 int flagsValues = data.readInt();
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700210 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700211 fillInIntent, resolvedType, resultTo, resultWho,
212 requestCode, flagsMask, flagsValues);
213 reply.writeNoException();
214 reply.writeInt(result);
215 return true;
216 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800217
218 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
219 {
220 data.enforceInterface(IActivityManager.descriptor);
221 IBinder callingActivity = data.readStrongBinder();
222 Intent intent = Intent.CREATOR.createFromParcel(data);
223 boolean result = startNextMatchingActivity(callingActivity, intent);
224 reply.writeNoException();
225 reply.writeInt(result ? 1 : 0);
226 return true;
227 }
228
229 case FINISH_ACTIVITY_TRANSACTION: {
230 data.enforceInterface(IActivityManager.descriptor);
231 IBinder token = data.readStrongBinder();
232 Intent resultData = null;
233 int resultCode = data.readInt();
234 if (data.readInt() != 0) {
235 resultData = Intent.CREATOR.createFromParcel(data);
236 }
237 boolean res = finishActivity(token, resultCode, resultData);
238 reply.writeNoException();
239 reply.writeInt(res ? 1 : 0);
240 return true;
241 }
242
243 case FINISH_SUB_ACTIVITY_TRANSACTION: {
244 data.enforceInterface(IActivityManager.descriptor);
245 IBinder token = data.readStrongBinder();
246 String resultWho = data.readString();
247 int requestCode = data.readInt();
248 finishSubActivity(token, resultWho, requestCode);
249 reply.writeNoException();
250 return true;
251 }
252
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800253 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
254 data.enforceInterface(IActivityManager.descriptor);
255 IBinder token = data.readStrongBinder();
256 boolean res = willActivityBeVisible(token);
257 reply.writeNoException();
258 reply.writeInt(res ? 1 : 0);
259 return true;
260 }
261
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800262 case REGISTER_RECEIVER_TRANSACTION:
263 {
264 data.enforceInterface(IActivityManager.descriptor);
265 IBinder b = data.readStrongBinder();
266 IApplicationThread app =
267 b != null ? ApplicationThreadNative.asInterface(b) : null;
268 b = data.readStrongBinder();
269 IIntentReceiver rec
270 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
271 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
272 String perm = data.readString();
273 Intent intent = registerReceiver(app, rec, filter, perm);
274 reply.writeNoException();
275 if (intent != null) {
276 reply.writeInt(1);
277 intent.writeToParcel(reply, 0);
278 } else {
279 reply.writeInt(0);
280 }
281 return true;
282 }
283
284 case UNREGISTER_RECEIVER_TRANSACTION:
285 {
286 data.enforceInterface(IActivityManager.descriptor);
287 IBinder b = data.readStrongBinder();
288 if (b == null) {
289 return true;
290 }
291 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
292 unregisterReceiver(rec);
293 reply.writeNoException();
294 return true;
295 }
296
297 case BROADCAST_INTENT_TRANSACTION:
298 {
299 data.enforceInterface(IActivityManager.descriptor);
300 IBinder b = data.readStrongBinder();
301 IApplicationThread app =
302 b != null ? ApplicationThreadNative.asInterface(b) : null;
303 Intent intent = Intent.CREATOR.createFromParcel(data);
304 String resolvedType = data.readString();
305 b = data.readStrongBinder();
306 IIntentReceiver resultTo =
307 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
308 int resultCode = data.readInt();
309 String resultData = data.readString();
310 Bundle resultExtras = data.readBundle();
311 String perm = data.readString();
312 boolean serialized = data.readInt() != 0;
313 boolean sticky = data.readInt() != 0;
314 int res = broadcastIntent(app, intent, resolvedType, resultTo,
315 resultCode, resultData, resultExtras, perm,
316 serialized, sticky);
317 reply.writeNoException();
318 reply.writeInt(res);
319 return true;
320 }
321
322 case UNBROADCAST_INTENT_TRANSACTION:
323 {
324 data.enforceInterface(IActivityManager.descriptor);
325 IBinder b = data.readStrongBinder();
326 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
327 Intent intent = Intent.CREATOR.createFromParcel(data);
328 unbroadcastIntent(app, intent);
329 reply.writeNoException();
330 return true;
331 }
332
333 case FINISH_RECEIVER_TRANSACTION: {
334 data.enforceInterface(IActivityManager.descriptor);
335 IBinder who = data.readStrongBinder();
336 int resultCode = data.readInt();
337 String resultData = data.readString();
338 Bundle resultExtras = data.readBundle();
339 boolean resultAbort = data.readInt() != 0;
340 if (who != null) {
341 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
342 }
343 reply.writeNoException();
344 return true;
345 }
346
347 case SET_PERSISTENT_TRANSACTION: {
348 data.enforceInterface(IActivityManager.descriptor);
349 IBinder token = data.readStrongBinder();
350 boolean isPersistent = data.readInt() != 0;
351 if (token != null) {
352 setPersistent(token, isPersistent);
353 }
354 reply.writeNoException();
355 return true;
356 }
357
358 case ATTACH_APPLICATION_TRANSACTION: {
359 data.enforceInterface(IActivityManager.descriptor);
360 IApplicationThread app = ApplicationThreadNative.asInterface(
361 data.readStrongBinder());
362 if (app != null) {
363 attachApplication(app);
364 }
365 reply.writeNoException();
366 return true;
367 }
368
369 case ACTIVITY_IDLE_TRANSACTION: {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700372 Configuration config = null;
373 if (data.readInt() != 0) {
374 config = Configuration.CREATOR.createFromParcel(data);
375 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 if (token != null) {
Dianne Hackborne88846e2009-09-30 21:34:25 -0700377 activityIdle(token, config);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800378 }
379 reply.writeNoException();
380 return true;
381 }
382
383 case ACTIVITY_PAUSED_TRANSACTION: {
384 data.enforceInterface(IActivityManager.descriptor);
385 IBinder token = data.readStrongBinder();
386 Bundle map = data.readBundle();
387 activityPaused(token, map);
388 reply.writeNoException();
389 return true;
390 }
391
392 case ACTIVITY_STOPPED_TRANSACTION: {
393 data.enforceInterface(IActivityManager.descriptor);
394 IBinder token = data.readStrongBinder();
395 Bitmap thumbnail = data.readInt() != 0
396 ? Bitmap.CREATOR.createFromParcel(data) : null;
397 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
398 activityStopped(token, thumbnail, description);
399 reply.writeNoException();
400 return true;
401 }
402
403 case ACTIVITY_DESTROYED_TRANSACTION: {
404 data.enforceInterface(IActivityManager.descriptor);
405 IBinder token = data.readStrongBinder();
406 activityDestroyed(token);
407 reply.writeNoException();
408 return true;
409 }
410
411 case GET_CALLING_PACKAGE_TRANSACTION: {
412 data.enforceInterface(IActivityManager.descriptor);
413 IBinder token = data.readStrongBinder();
414 String res = token != null ? getCallingPackage(token) : null;
415 reply.writeNoException();
416 reply.writeString(res);
417 return true;
418 }
419
420 case GET_CALLING_ACTIVITY_TRANSACTION: {
421 data.enforceInterface(IActivityManager.descriptor);
422 IBinder token = data.readStrongBinder();
423 ComponentName cn = getCallingActivity(token);
424 reply.writeNoException();
425 ComponentName.writeToParcel(cn, reply);
426 return true;
427 }
428
429 case GET_TASKS_TRANSACTION: {
430 data.enforceInterface(IActivityManager.descriptor);
431 int maxNum = data.readInt();
432 int fl = data.readInt();
433 IBinder receiverBinder = data.readStrongBinder();
434 IThumbnailReceiver receiver = receiverBinder != null
435 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
436 : null;
437 List list = getTasks(maxNum, fl, receiver);
438 reply.writeNoException();
439 int N = list != null ? list.size() : -1;
440 reply.writeInt(N);
441 int i;
442 for (i=0; i<N; i++) {
443 ActivityManager.RunningTaskInfo info =
444 (ActivityManager.RunningTaskInfo)list.get(i);
445 info.writeToParcel(reply, 0);
446 }
447 return true;
448 }
449
450 case GET_RECENT_TASKS_TRANSACTION: {
451 data.enforceInterface(IActivityManager.descriptor);
452 int maxNum = data.readInt();
453 int fl = data.readInt();
454 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
455 fl);
456 reply.writeNoException();
457 reply.writeTypedList(list);
458 return true;
459 }
460
461 case GET_SERVICES_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 int maxNum = data.readInt();
464 int fl = data.readInt();
465 List list = getServices(maxNum, fl);
466 reply.writeNoException();
467 int N = list != null ? list.size() : -1;
468 reply.writeInt(N);
469 int i;
470 for (i=0; i<N; i++) {
471 ActivityManager.RunningServiceInfo info =
472 (ActivityManager.RunningServiceInfo)list.get(i);
473 info.writeToParcel(reply, 0);
474 }
475 return true;
476 }
477
478 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
481 reply.writeNoException();
482 reply.writeTypedList(list);
483 return true;
484 }
485
486 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
487 data.enforceInterface(IActivityManager.descriptor);
488 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
489 reply.writeNoException();
490 reply.writeTypedList(list);
491 return true;
492 }
493
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700494 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
495 data.enforceInterface(IActivityManager.descriptor);
496 List<ApplicationInfo> list = getRunningExternalApplications();
497 reply.writeNoException();
498 reply.writeTypedList(list);
499 return true;
500 }
501
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 case MOVE_TASK_TO_FRONT_TRANSACTION: {
503 data.enforceInterface(IActivityManager.descriptor);
504 int task = data.readInt();
505 moveTaskToFront(task);
506 reply.writeNoException();
507 return true;
508 }
509
510 case MOVE_TASK_TO_BACK_TRANSACTION: {
511 data.enforceInterface(IActivityManager.descriptor);
512 int task = data.readInt();
513 moveTaskToBack(task);
514 reply.writeNoException();
515 return true;
516 }
517
518 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 IBinder token = data.readStrongBinder();
521 boolean nonRoot = data.readInt() != 0;
522 boolean res = moveActivityTaskToBack(token, nonRoot);
523 reply.writeNoException();
524 reply.writeInt(res ? 1 : 0);
525 return true;
526 }
527
528 case MOVE_TASK_BACKWARDS_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 int task = data.readInt();
531 moveTaskBackwards(task);
532 reply.writeNoException();
533 return true;
534 }
535
536 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 IBinder token = data.readStrongBinder();
539 boolean onlyRoot = data.readInt() != 0;
540 int res = token != null
541 ? getTaskForActivity(token, onlyRoot) : -1;
542 reply.writeNoException();
543 reply.writeInt(res);
544 return true;
545 }
546
547 case FINISH_OTHER_INSTANCES_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 IBinder token = data.readStrongBinder();
550 ComponentName className = ComponentName.readFromParcel(data);
551 finishOtherInstances(token, className);
552 reply.writeNoException();
553 return true;
554 }
555
556 case REPORT_THUMBNAIL_TRANSACTION: {
557 data.enforceInterface(IActivityManager.descriptor);
558 IBinder token = data.readStrongBinder();
559 Bitmap thumbnail = data.readInt() != 0
560 ? Bitmap.CREATOR.createFromParcel(data) : null;
561 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
562 reportThumbnail(token, thumbnail, description);
563 reply.writeNoException();
564 return true;
565 }
566
567 case GET_CONTENT_PROVIDER_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 IBinder b = data.readStrongBinder();
570 IApplicationThread app = ApplicationThreadNative.asInterface(b);
571 String name = data.readString();
572 ContentProviderHolder cph = getContentProvider(app, name);
573 reply.writeNoException();
574 if (cph != null) {
575 reply.writeInt(1);
576 cph.writeToParcel(reply, 0);
577 } else {
578 reply.writeInt(0);
579 }
580 return true;
581 }
582
583 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
584 data.enforceInterface(IActivityManager.descriptor);
585 IBinder b = data.readStrongBinder();
586 IApplicationThread app = ApplicationThreadNative.asInterface(b);
587 ArrayList<ContentProviderHolder> providers =
588 data.createTypedArrayList(ContentProviderHolder.CREATOR);
589 publishContentProviders(app, providers);
590 reply.writeNoException();
591 return true;
592 }
593
594 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder b = data.readStrongBinder();
597 IApplicationThread app = ApplicationThreadNative.asInterface(b);
598 String name = data.readString();
599 removeContentProvider(app, name);
600 reply.writeNoException();
601 return true;
602 }
603
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700604 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
605 data.enforceInterface(IActivityManager.descriptor);
606 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
607 PendingIntent pi = getRunningServiceControlPanel(comp);
608 reply.writeNoException();
609 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
610 return true;
611 }
612
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 case START_SERVICE_TRANSACTION: {
614 data.enforceInterface(IActivityManager.descriptor);
615 IBinder b = data.readStrongBinder();
616 IApplicationThread app = ApplicationThreadNative.asInterface(b);
617 Intent service = Intent.CREATOR.createFromParcel(data);
618 String resolvedType = data.readString();
619 ComponentName cn = startService(app, service, resolvedType);
620 reply.writeNoException();
621 ComponentName.writeToParcel(cn, reply);
622 return true;
623 }
624
625 case STOP_SERVICE_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 IBinder b = data.readStrongBinder();
628 IApplicationThread app = ApplicationThreadNative.asInterface(b);
629 Intent service = Intent.CREATOR.createFromParcel(data);
630 String resolvedType = data.readString();
631 int res = stopService(app, service, resolvedType);
632 reply.writeNoException();
633 reply.writeInt(res);
634 return true;
635 }
636
637 case STOP_SERVICE_TOKEN_TRANSACTION: {
638 data.enforceInterface(IActivityManager.descriptor);
639 ComponentName className = ComponentName.readFromParcel(data);
640 IBinder token = data.readStrongBinder();
641 int startId = data.readInt();
642 boolean res = stopServiceToken(className, token, startId);
643 reply.writeNoException();
644 reply.writeInt(res ? 1 : 0);
645 return true;
646 }
647
648 case SET_SERVICE_FOREGROUND_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 ComponentName className = ComponentName.readFromParcel(data);
651 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700652 int id = data.readInt();
653 Notification notification = null;
654 if (data.readInt() != 0) {
655 notification = Notification.CREATOR.createFromParcel(data);
656 }
657 boolean removeNotification = data.readInt() != 0;
658 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800659 reply.writeNoException();
660 return true;
661 }
662
663 case BIND_SERVICE_TRANSACTION: {
664 data.enforceInterface(IActivityManager.descriptor);
665 IBinder b = data.readStrongBinder();
666 IApplicationThread app = ApplicationThreadNative.asInterface(b);
667 IBinder token = data.readStrongBinder();
668 Intent service = Intent.CREATOR.createFromParcel(data);
669 String resolvedType = data.readString();
670 b = data.readStrongBinder();
671 int fl = data.readInt();
672 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
673 int res = bindService(app, token, service, resolvedType, conn, fl);
674 reply.writeNoException();
675 reply.writeInt(res);
676 return true;
677 }
678
679 case UNBIND_SERVICE_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 IBinder b = data.readStrongBinder();
682 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
683 boolean res = unbindService(conn);
684 reply.writeNoException();
685 reply.writeInt(res ? 1 : 0);
686 return true;
687 }
688
689 case PUBLISH_SERVICE_TRANSACTION: {
690 data.enforceInterface(IActivityManager.descriptor);
691 IBinder token = data.readStrongBinder();
692 Intent intent = Intent.CREATOR.createFromParcel(data);
693 IBinder service = data.readStrongBinder();
694 publishService(token, intent, service);
695 reply.writeNoException();
696 return true;
697 }
698
699 case UNBIND_FINISHED_TRANSACTION: {
700 data.enforceInterface(IActivityManager.descriptor);
701 IBinder token = data.readStrongBinder();
702 Intent intent = Intent.CREATOR.createFromParcel(data);
703 boolean doRebind = data.readInt() != 0;
704 unbindFinished(token, intent, doRebind);
705 reply.writeNoException();
706 return true;
707 }
708
709 case SERVICE_DONE_EXECUTING_TRANSACTION: {
710 data.enforceInterface(IActivityManager.descriptor);
711 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700712 int type = data.readInt();
713 int startId = data.readInt();
714 int res = data.readInt();
715 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 reply.writeNoException();
717 return true;
718 }
719
720 case START_INSTRUMENTATION_TRANSACTION: {
721 data.enforceInterface(IActivityManager.descriptor);
722 ComponentName className = ComponentName.readFromParcel(data);
723 String profileFile = data.readString();
724 int fl = data.readInt();
725 Bundle arguments = data.readBundle();
726 IBinder b = data.readStrongBinder();
727 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
728 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
729 reply.writeNoException();
730 reply.writeInt(res ? 1 : 0);
731 return true;
732 }
733
734
735 case FINISH_INSTRUMENTATION_TRANSACTION: {
736 data.enforceInterface(IActivityManager.descriptor);
737 IBinder b = data.readStrongBinder();
738 IApplicationThread app = ApplicationThreadNative.asInterface(b);
739 int resultCode = data.readInt();
740 Bundle results = data.readBundle();
741 finishInstrumentation(app, resultCode, results);
742 reply.writeNoException();
743 return true;
744 }
745
746 case GET_CONFIGURATION_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 Configuration config = getConfiguration();
749 reply.writeNoException();
750 config.writeToParcel(reply, 0);
751 return true;
752 }
753
754 case UPDATE_CONFIGURATION_TRANSACTION: {
755 data.enforceInterface(IActivityManager.descriptor);
756 Configuration config = Configuration.CREATOR.createFromParcel(data);
757 updateConfiguration(config);
758 reply.writeNoException();
759 return true;
760 }
761
762 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
763 data.enforceInterface(IActivityManager.descriptor);
764 IBinder token = data.readStrongBinder();
765 int requestedOrientation = data.readInt();
766 setRequestedOrientation(token, requestedOrientation);
767 reply.writeNoException();
768 return true;
769 }
770
771 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
772 data.enforceInterface(IActivityManager.descriptor);
773 IBinder token = data.readStrongBinder();
774 int req = getRequestedOrientation(token);
775 reply.writeNoException();
776 reply.writeInt(req);
777 return true;
778 }
779
780 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
781 data.enforceInterface(IActivityManager.descriptor);
782 IBinder token = data.readStrongBinder();
783 ComponentName cn = getActivityClassForToken(token);
784 reply.writeNoException();
785 ComponentName.writeToParcel(cn, reply);
786 return true;
787 }
788
789 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
790 data.enforceInterface(IActivityManager.descriptor);
791 IBinder token = data.readStrongBinder();
792 reply.writeNoException();
793 reply.writeString(getPackageForToken(token));
794 return true;
795 }
796
797 case GET_INTENT_SENDER_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 int type = data.readInt();
800 String packageName = data.readString();
801 IBinder token = data.readStrongBinder();
802 String resultWho = data.readString();
803 int requestCode = data.readInt();
804 Intent requestIntent = data.readInt() != 0
805 ? Intent.CREATOR.createFromParcel(data) : null;
806 String requestResolvedType = data.readString();
807 int fl = data.readInt();
808 IIntentSender res = getIntentSender(type, packageName, token,
809 resultWho, requestCode, requestIntent,
810 requestResolvedType, fl);
811 reply.writeNoException();
812 reply.writeStrongBinder(res != null ? res.asBinder() : null);
813 return true;
814 }
815
816 case CANCEL_INTENT_SENDER_TRANSACTION: {
817 data.enforceInterface(IActivityManager.descriptor);
818 IIntentSender r = IIntentSender.Stub.asInterface(
819 data.readStrongBinder());
820 cancelIntentSender(r);
821 reply.writeNoException();
822 return true;
823 }
824
825 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
826 data.enforceInterface(IActivityManager.descriptor);
827 IIntentSender r = IIntentSender.Stub.asInterface(
828 data.readStrongBinder());
829 String res = getPackageForIntentSender(r);
830 reply.writeNoException();
831 reply.writeString(res);
832 return true;
833 }
834
835 case SET_PROCESS_LIMIT_TRANSACTION: {
836 data.enforceInterface(IActivityManager.descriptor);
837 int max = data.readInt();
838 setProcessLimit(max);
839 reply.writeNoException();
840 return true;
841 }
842
843 case GET_PROCESS_LIMIT_TRANSACTION: {
844 data.enforceInterface(IActivityManager.descriptor);
845 int limit = getProcessLimit();
846 reply.writeNoException();
847 reply.writeInt(limit);
848 return true;
849 }
850
851 case SET_PROCESS_FOREGROUND_TRANSACTION: {
852 data.enforceInterface(IActivityManager.descriptor);
853 IBinder token = data.readStrongBinder();
854 int pid = data.readInt();
855 boolean isForeground = data.readInt() != 0;
856 setProcessForeground(token, pid, isForeground);
857 reply.writeNoException();
858 return true;
859 }
860
861 case CHECK_PERMISSION_TRANSACTION: {
862 data.enforceInterface(IActivityManager.descriptor);
863 String perm = data.readString();
864 int pid = data.readInt();
865 int uid = data.readInt();
866 int res = checkPermission(perm, pid, uid);
867 reply.writeNoException();
868 reply.writeInt(res);
869 return true;
870 }
871
872 case CHECK_URI_PERMISSION_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 Uri uri = Uri.CREATOR.createFromParcel(data);
875 int pid = data.readInt();
876 int uid = data.readInt();
877 int mode = data.readInt();
878 int res = checkUriPermission(uri, pid, uid, mode);
879 reply.writeNoException();
880 reply.writeInt(res);
881 return true;
882 }
883
884 case CLEAR_APP_DATA_TRANSACTION: {
885 data.enforceInterface(IActivityManager.descriptor);
886 String packageName = data.readString();
887 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
888 data.readStrongBinder());
889 boolean res = clearApplicationUserData(packageName, observer);
890 reply.writeNoException();
891 reply.writeInt(res ? 1 : 0);
892 return true;
893 }
894
895 case GRANT_URI_PERMISSION_TRANSACTION: {
896 data.enforceInterface(IActivityManager.descriptor);
897 IBinder b = data.readStrongBinder();
898 IApplicationThread app = ApplicationThreadNative.asInterface(b);
899 String targetPkg = data.readString();
900 Uri uri = Uri.CREATOR.createFromParcel(data);
901 int mode = data.readInt();
902 grantUriPermission(app, targetPkg, uri, mode);
903 reply.writeNoException();
904 return true;
905 }
906
907 case REVOKE_URI_PERMISSION_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 IBinder b = data.readStrongBinder();
910 IApplicationThread app = ApplicationThreadNative.asInterface(b);
911 Uri uri = Uri.CREATOR.createFromParcel(data);
912 int mode = data.readInt();
913 revokeUriPermission(app, uri, mode);
914 reply.writeNoException();
915 return true;
916 }
917
918 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 IBinder b = data.readStrongBinder();
921 IApplicationThread app = ApplicationThreadNative.asInterface(b);
922 boolean waiting = data.readInt() != 0;
923 showWaitingForDebugger(app, waiting);
924 reply.writeNoException();
925 return true;
926 }
927
928 case GET_MEMORY_INFO_TRANSACTION: {
929 data.enforceInterface(IActivityManager.descriptor);
930 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
931 getMemoryInfo(mi);
932 reply.writeNoException();
933 mi.writeToParcel(reply, 0);
934 return true;
935 }
936
937 case UNHANDLED_BACK_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 unhandledBack();
940 reply.writeNoException();
941 return true;
942 }
943
944 case OPEN_CONTENT_URI_TRANSACTION: {
945 data.enforceInterface(IActivityManager.descriptor);
946 Uri uri = Uri.parse(data.readString());
947 ParcelFileDescriptor pfd = openContentUri(uri);
948 reply.writeNoException();
949 if (pfd != null) {
950 reply.writeInt(1);
951 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
952 } else {
953 reply.writeInt(0);
954 }
955 return true;
956 }
957
958 case GOING_TO_SLEEP_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 goingToSleep();
961 reply.writeNoException();
962 return true;
963 }
964
965 case WAKING_UP_TRANSACTION: {
966 data.enforceInterface(IActivityManager.descriptor);
967 wakingUp();
968 reply.writeNoException();
969 return true;
970 }
971
972 case SET_DEBUG_APP_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 String pn = data.readString();
975 boolean wfd = data.readInt() != 0;
976 boolean per = data.readInt() != 0;
977 setDebugApp(pn, wfd, per);
978 reply.writeNoException();
979 return true;
980 }
981
982 case SET_ALWAYS_FINISH_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 boolean enabled = data.readInt() != 0;
985 setAlwaysFinish(enabled);
986 reply.writeNoException();
987 return true;
988 }
989
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700990 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800991 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700992 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700994 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800995 return true;
996 }
997
998 case ENTER_SAFE_MODE_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 enterSafeMode();
1001 reply.writeNoException();
1002 return true;
1003 }
1004
1005 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 IIntentSender is = IIntentSender.Stub.asInterface(
1008 data.readStrongBinder());
1009 noteWakeupAlarm(is);
1010 reply.writeNoException();
1011 return true;
1012 }
1013
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001014 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001015 data.enforceInterface(IActivityManager.descriptor);
1016 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001017 String reason = data.readString();
1018 boolean res = killPids(pids, reason);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 reply.writeNoException();
1020 reply.writeInt(res ? 1 : 0);
1021 return true;
1022 }
1023
1024 case REPORT_PSS_TRANSACTION: {
1025 data.enforceInterface(IActivityManager.descriptor);
1026 IBinder b = data.readStrongBinder();
1027 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1028 int pss = data.readInt();
1029 reportPss(app, pss);
1030 reply.writeNoException();
1031 return true;
1032 }
1033
1034 case START_RUNNING_TRANSACTION: {
1035 data.enforceInterface(IActivityManager.descriptor);
1036 String pkg = data.readString();
1037 String cls = data.readString();
1038 String action = data.readString();
1039 String indata = data.readString();
1040 startRunning(pkg, cls, action, indata);
1041 reply.writeNoException();
1042 return true;
1043 }
1044
Dan Egnor60d87622009-12-16 16:32:58 -08001045 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1046 data.enforceInterface(IActivityManager.descriptor);
1047 IBinder app = data.readStrongBinder();
1048 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1049 handleApplicationCrash(app, ci);
1050 reply.writeNoException();
1051 return true;
1052 }
1053
1054 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 data.enforceInterface(IActivityManager.descriptor);
1056 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001057 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001058 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001059 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001060 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001061 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001062 return true;
1063 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001064
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001065 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder app = data.readStrongBinder();
1068 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1069 handleApplicationStrictModeViolation(app, ci);
1070 reply.writeNoException();
1071 return true;
1072 }
1073
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001074 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 int sig = data.readInt();
1077 signalPersistentProcesses(sig);
1078 reply.writeNoException();
1079 return true;
1080 }
1081
Dianne Hackborn03abb812010-01-04 18:43:19 -08001082 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001084 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001085 killBackgroundProcesses(packageName);
1086 reply.writeNoException();
1087 return true;
1088 }
1089
1090 case FORCE_STOP_PACKAGE_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 String packageName = data.readString();
1093 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 reply.writeNoException();
1095 return true;
1096 }
1097
1098 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1099 data.enforceInterface(IActivityManager.descriptor);
1100 ConfigurationInfo config = getDeviceConfigurationInfo();
1101 reply.writeNoException();
1102 config.writeToParcel(reply, 0);
1103 return true;
1104 }
1105
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001106 case PROFILE_CONTROL_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 String process = data.readString();
1109 boolean start = data.readInt() != 0;
1110 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001111 ParcelFileDescriptor fd = data.readInt() != 0
1112 ? data.readFileDescriptor() : null;
1113 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001114 reply.writeNoException();
1115 reply.writeInt(res ? 1 : 0);
1116 return true;
1117 }
1118
Dianne Hackborn55280a92009-05-07 15:53:46 -07001119 case SHUTDOWN_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 boolean res = shutdown(data.readInt());
1122 reply.writeNoException();
1123 reply.writeInt(res ? 1 : 0);
1124 return true;
1125 }
1126
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001127 case STOP_APP_SWITCHES_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 stopAppSwitches();
1130 reply.writeNoException();
1131 return true;
1132 }
1133
1134 case RESUME_APP_SWITCHES_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 resumeAppSwitches();
1137 reply.writeNoException();
1138 return true;
1139 }
1140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001141 case PEEK_SERVICE_TRANSACTION: {
1142 data.enforceInterface(IActivityManager.descriptor);
1143 Intent service = Intent.CREATOR.createFromParcel(data);
1144 String resolvedType = data.readString();
1145 IBinder binder = peekService(service, resolvedType);
1146 reply.writeNoException();
1147 reply.writeStrongBinder(binder);
1148 return true;
1149 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001150
1151 case START_BACKUP_AGENT_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1154 int backupRestoreMode = data.readInt();
1155 boolean success = bindBackupAgent(info, backupRestoreMode);
1156 reply.writeNoException();
1157 reply.writeInt(success ? 1 : 0);
1158 return true;
1159 }
1160
1161 case BACKUP_AGENT_CREATED_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 String packageName = data.readString();
1164 IBinder agent = data.readStrongBinder();
1165 backupAgentCreated(packageName, agent);
1166 reply.writeNoException();
1167 return true;
1168 }
1169
1170 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1173 unbindBackupAgent(info);
1174 reply.writeNoException();
1175 return true;
1176 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001177
1178 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1179 data.enforceInterface(IActivityManager.descriptor);
1180 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1181 data.readStrongBinder());
1182 registerActivityWatcher(watcher);
1183 return true;
1184 }
1185
1186 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1189 data.readStrongBinder());
1190 unregisterActivityWatcher(watcher);
1191 return true;
1192 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001193
1194 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1195 {
1196 data.enforceInterface(IActivityManager.descriptor);
1197 int uid = data.readInt();
1198 Intent intent = Intent.CREATOR.createFromParcel(data);
1199 String resolvedType = data.readString();
1200 IBinder resultTo = data.readStrongBinder();
1201 String resultWho = data.readString();
1202 int requestCode = data.readInt();
1203 boolean onlyIfNeeded = data.readInt() != 0;
1204 int result = startActivityInPackage(uid, intent, resolvedType,
1205 resultTo, resultWho, requestCode, onlyIfNeeded);
1206 reply.writeNoException();
1207 reply.writeInt(result);
1208 return true;
1209 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001210
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001211 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 String pkg = data.readString();
1214 int uid = data.readInt();
1215 killApplicationWithUid(pkg, uid);
1216 reply.writeNoException();
1217 return true;
1218 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001219
1220 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 String reason = data.readString();
1223 closeSystemDialogs(reason);
1224 reply.writeNoException();
1225 return true;
1226 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001227
1228 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001230 int[] pids = data.createIntArray();
1231 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001232 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001233 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001234 return true;
1235 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001236
1237 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 String processName = data.readString();
1240 int uid = data.readInt();
1241 killApplicationProcess(processName, uid);
1242 reply.writeNoException();
1243 return true;
1244 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001245
1246 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1247 data.enforceInterface(IActivityManager.descriptor);
1248 IBinder token = data.readStrongBinder();
1249 String packageName = data.readString();
1250 int enterAnim = data.readInt();
1251 int exitAnim = data.readInt();
1252 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001253 reply.writeNoException();
1254 return true;
1255 }
1256
1257 case IS_USER_A_MONKEY_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 reply.writeInt(isUserAMonkey() ? 1 : 0);
1260 reply.writeNoException();
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001261 return true;
1262 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001263
1264 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1265 data.enforceInterface(IActivityManager.descriptor);
1266 finishHeavyWeightApp();
1267 reply.writeNoException();
1268 return true;
1269 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001270 }
1271
1272 return super.onTransact(code, data, reply, flags);
1273 }
1274
1275 public IBinder asBinder()
1276 {
1277 return this;
1278 }
1279
1280 private static IActivityManager gDefault;
1281}
1282
1283class ActivityManagerProxy implements IActivityManager
1284{
1285 public ActivityManagerProxy(IBinder remote)
1286 {
1287 mRemote = remote;
1288 }
1289
1290 public IBinder asBinder()
1291 {
1292 return mRemote;
1293 }
1294
1295 public int startActivity(IApplicationThread caller, Intent intent,
1296 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1297 IBinder resultTo, String resultWho,
1298 int requestCode, boolean onlyIfNeeded,
1299 boolean debug) throws RemoteException {
1300 Parcel data = Parcel.obtain();
1301 Parcel reply = Parcel.obtain();
1302 data.writeInterfaceToken(IActivityManager.descriptor);
1303 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1304 intent.writeToParcel(data, 0);
1305 data.writeString(resolvedType);
1306 data.writeTypedArray(grantedUriPermissions, 0);
1307 data.writeInt(grantedMode);
1308 data.writeStrongBinder(resultTo);
1309 data.writeString(resultWho);
1310 data.writeInt(requestCode);
1311 data.writeInt(onlyIfNeeded ? 1 : 0);
1312 data.writeInt(debug ? 1 : 0);
1313 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1314 reply.readException();
1315 int result = reply.readInt();
1316 reply.recycle();
1317 data.recycle();
1318 return result;
1319 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001320 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1321 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1322 IBinder resultTo, String resultWho,
1323 int requestCode, boolean onlyIfNeeded,
1324 boolean debug) throws RemoteException {
1325 Parcel data = Parcel.obtain();
1326 Parcel reply = Parcel.obtain();
1327 data.writeInterfaceToken(IActivityManager.descriptor);
1328 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1329 intent.writeToParcel(data, 0);
1330 data.writeString(resolvedType);
1331 data.writeTypedArray(grantedUriPermissions, 0);
1332 data.writeInt(grantedMode);
1333 data.writeStrongBinder(resultTo);
1334 data.writeString(resultWho);
1335 data.writeInt(requestCode);
1336 data.writeInt(onlyIfNeeded ? 1 : 0);
1337 data.writeInt(debug ? 1 : 0);
1338 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1339 reply.readException();
1340 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1341 reply.recycle();
1342 data.recycle();
1343 return result;
1344 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001345 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1346 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1347 IBinder resultTo, String resultWho,
1348 int requestCode, boolean onlyIfNeeded,
1349 boolean debug, Configuration config) throws RemoteException {
1350 Parcel data = Parcel.obtain();
1351 Parcel reply = Parcel.obtain();
1352 data.writeInterfaceToken(IActivityManager.descriptor);
1353 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1354 intent.writeToParcel(data, 0);
1355 data.writeString(resolvedType);
1356 data.writeTypedArray(grantedUriPermissions, 0);
1357 data.writeInt(grantedMode);
1358 data.writeStrongBinder(resultTo);
1359 data.writeString(resultWho);
1360 data.writeInt(requestCode);
1361 data.writeInt(onlyIfNeeded ? 1 : 0);
1362 data.writeInt(debug ? 1 : 0);
1363 config.writeToParcel(data, 0);
1364 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1365 reply.readException();
1366 int result = reply.readInt();
1367 reply.recycle();
1368 data.recycle();
1369 return result;
1370 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001371 public int startActivityIntentSender(IApplicationThread caller,
1372 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001373 IBinder resultTo, String resultWho, int requestCode,
1374 int flagsMask, int flagsValues) throws RemoteException {
1375 Parcel data = Parcel.obtain();
1376 Parcel reply = Parcel.obtain();
1377 data.writeInterfaceToken(IActivityManager.descriptor);
1378 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1379 intent.writeToParcel(data, 0);
1380 if (fillInIntent != null) {
1381 data.writeInt(1);
1382 fillInIntent.writeToParcel(data, 0);
1383 } else {
1384 data.writeInt(0);
1385 }
1386 data.writeString(resolvedType);
1387 data.writeStrongBinder(resultTo);
1388 data.writeString(resultWho);
1389 data.writeInt(requestCode);
1390 data.writeInt(flagsMask);
1391 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001392 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001393 reply.readException();
1394 int result = reply.readInt();
1395 reply.recycle();
1396 data.recycle();
1397 return result;
1398 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001399 public boolean startNextMatchingActivity(IBinder callingActivity,
1400 Intent intent) throws RemoteException {
1401 Parcel data = Parcel.obtain();
1402 Parcel reply = Parcel.obtain();
1403 data.writeInterfaceToken(IActivityManager.descriptor);
1404 data.writeStrongBinder(callingActivity);
1405 intent.writeToParcel(data, 0);
1406 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1407 reply.readException();
1408 int result = reply.readInt();
1409 reply.recycle();
1410 data.recycle();
1411 return result != 0;
1412 }
1413 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1414 throws RemoteException {
1415 Parcel data = Parcel.obtain();
1416 Parcel reply = Parcel.obtain();
1417 data.writeInterfaceToken(IActivityManager.descriptor);
1418 data.writeStrongBinder(token);
1419 data.writeInt(resultCode);
1420 if (resultData != null) {
1421 data.writeInt(1);
1422 resultData.writeToParcel(data, 0);
1423 } else {
1424 data.writeInt(0);
1425 }
1426 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1427 reply.readException();
1428 boolean res = reply.readInt() != 0;
1429 data.recycle();
1430 reply.recycle();
1431 return res;
1432 }
1433 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1434 {
1435 Parcel data = Parcel.obtain();
1436 Parcel reply = Parcel.obtain();
1437 data.writeInterfaceToken(IActivityManager.descriptor);
1438 data.writeStrongBinder(token);
1439 data.writeString(resultWho);
1440 data.writeInt(requestCode);
1441 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1442 reply.readException();
1443 data.recycle();
1444 reply.recycle();
1445 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001446 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1447 Parcel data = Parcel.obtain();
1448 Parcel reply = Parcel.obtain();
1449 data.writeInterfaceToken(IActivityManager.descriptor);
1450 data.writeStrongBinder(token);
1451 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1452 reply.readException();
1453 boolean res = reply.readInt() != 0;
1454 data.recycle();
1455 reply.recycle();
1456 return res;
1457 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 public Intent registerReceiver(IApplicationThread caller,
1459 IIntentReceiver receiver,
1460 IntentFilter filter, String perm) throws RemoteException
1461 {
1462 Parcel data = Parcel.obtain();
1463 Parcel reply = Parcel.obtain();
1464 data.writeInterfaceToken(IActivityManager.descriptor);
1465 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1466 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1467 filter.writeToParcel(data, 0);
1468 data.writeString(perm);
1469 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1470 reply.readException();
1471 Intent intent = null;
1472 int haveIntent = reply.readInt();
1473 if (haveIntent != 0) {
1474 intent = Intent.CREATOR.createFromParcel(reply);
1475 }
1476 reply.recycle();
1477 data.recycle();
1478 return intent;
1479 }
1480 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1481 {
1482 Parcel data = Parcel.obtain();
1483 Parcel reply = Parcel.obtain();
1484 data.writeInterfaceToken(IActivityManager.descriptor);
1485 data.writeStrongBinder(receiver.asBinder());
1486 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1487 reply.readException();
1488 data.recycle();
1489 reply.recycle();
1490 }
1491 public int broadcastIntent(IApplicationThread caller,
1492 Intent intent, String resolvedType, IIntentReceiver resultTo,
1493 int resultCode, String resultData, Bundle map,
1494 String requiredPermission, boolean serialized,
1495 boolean sticky) throws RemoteException
1496 {
1497 Parcel data = Parcel.obtain();
1498 Parcel reply = Parcel.obtain();
1499 data.writeInterfaceToken(IActivityManager.descriptor);
1500 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1501 intent.writeToParcel(data, 0);
1502 data.writeString(resolvedType);
1503 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1504 data.writeInt(resultCode);
1505 data.writeString(resultData);
1506 data.writeBundle(map);
1507 data.writeString(requiredPermission);
1508 data.writeInt(serialized ? 1 : 0);
1509 data.writeInt(sticky ? 1 : 0);
1510 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1511 reply.readException();
1512 int res = reply.readInt();
1513 reply.recycle();
1514 data.recycle();
1515 return res;
1516 }
1517 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1518 {
1519 Parcel data = Parcel.obtain();
1520 Parcel reply = Parcel.obtain();
1521 data.writeInterfaceToken(IActivityManager.descriptor);
1522 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1523 intent.writeToParcel(data, 0);
1524 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1525 reply.readException();
1526 data.recycle();
1527 reply.recycle();
1528 }
1529 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1530 {
1531 Parcel data = Parcel.obtain();
1532 Parcel reply = Parcel.obtain();
1533 data.writeInterfaceToken(IActivityManager.descriptor);
1534 data.writeStrongBinder(who);
1535 data.writeInt(resultCode);
1536 data.writeString(resultData);
1537 data.writeBundle(map);
1538 data.writeInt(abortBroadcast ? 1 : 0);
1539 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1540 reply.readException();
1541 data.recycle();
1542 reply.recycle();
1543 }
1544 public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException
1545 {
1546 Parcel data = Parcel.obtain();
1547 Parcel reply = Parcel.obtain();
1548 data.writeInterfaceToken(IActivityManager.descriptor);
1549 data.writeStrongBinder(token);
1550 data.writeInt(isPersistent ? 1 : 0);
1551 mRemote.transact(SET_PERSISTENT_TRANSACTION, data, reply, 0);
1552 reply.readException();
1553 data.recycle();
1554 reply.recycle();
1555 }
1556 public void attachApplication(IApplicationThread app) throws RemoteException
1557 {
1558 Parcel data = Parcel.obtain();
1559 Parcel reply = Parcel.obtain();
1560 data.writeInterfaceToken(IActivityManager.descriptor);
1561 data.writeStrongBinder(app.asBinder());
1562 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1563 reply.readException();
1564 data.recycle();
1565 reply.recycle();
1566 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001567 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001568 {
1569 Parcel data = Parcel.obtain();
1570 Parcel reply = Parcel.obtain();
1571 data.writeInterfaceToken(IActivityManager.descriptor);
1572 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001573 if (config != null) {
1574 data.writeInt(1);
1575 config.writeToParcel(data, 0);
1576 } else {
1577 data.writeInt(0);
1578 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001579 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1580 reply.readException();
1581 data.recycle();
1582 reply.recycle();
1583 }
1584 public void activityPaused(IBinder token, Bundle state) throws RemoteException
1585 {
1586 Parcel data = Parcel.obtain();
1587 Parcel reply = Parcel.obtain();
1588 data.writeInterfaceToken(IActivityManager.descriptor);
1589 data.writeStrongBinder(token);
1590 data.writeBundle(state);
1591 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1592 reply.readException();
1593 data.recycle();
1594 reply.recycle();
1595 }
1596 public void activityStopped(IBinder token,
1597 Bitmap thumbnail, CharSequence description) throws RemoteException
1598 {
1599 Parcel data = Parcel.obtain();
1600 Parcel reply = Parcel.obtain();
1601 data.writeInterfaceToken(IActivityManager.descriptor);
1602 data.writeStrongBinder(token);
1603 if (thumbnail != null) {
1604 data.writeInt(1);
1605 thumbnail.writeToParcel(data, 0);
1606 } else {
1607 data.writeInt(0);
1608 }
1609 TextUtils.writeToParcel(description, data, 0);
1610 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1611 reply.readException();
1612 data.recycle();
1613 reply.recycle();
1614 }
1615 public void activityDestroyed(IBinder token) throws RemoteException
1616 {
1617 Parcel data = Parcel.obtain();
1618 Parcel reply = Parcel.obtain();
1619 data.writeInterfaceToken(IActivityManager.descriptor);
1620 data.writeStrongBinder(token);
1621 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1622 reply.readException();
1623 data.recycle();
1624 reply.recycle();
1625 }
1626 public String getCallingPackage(IBinder token) throws RemoteException
1627 {
1628 Parcel data = Parcel.obtain();
1629 Parcel reply = Parcel.obtain();
1630 data.writeInterfaceToken(IActivityManager.descriptor);
1631 data.writeStrongBinder(token);
1632 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1633 reply.readException();
1634 String res = reply.readString();
1635 data.recycle();
1636 reply.recycle();
1637 return res;
1638 }
1639 public ComponentName getCallingActivity(IBinder token)
1640 throws RemoteException {
1641 Parcel data = Parcel.obtain();
1642 Parcel reply = Parcel.obtain();
1643 data.writeInterfaceToken(IActivityManager.descriptor);
1644 data.writeStrongBinder(token);
1645 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1646 reply.readException();
1647 ComponentName res = ComponentName.readFromParcel(reply);
1648 data.recycle();
1649 reply.recycle();
1650 return res;
1651 }
1652 public List getTasks(int maxNum, int flags,
1653 IThumbnailReceiver receiver) throws RemoteException {
1654 Parcel data = Parcel.obtain();
1655 Parcel reply = Parcel.obtain();
1656 data.writeInterfaceToken(IActivityManager.descriptor);
1657 data.writeInt(maxNum);
1658 data.writeInt(flags);
1659 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1660 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1661 reply.readException();
1662 ArrayList list = null;
1663 int N = reply.readInt();
1664 if (N >= 0) {
1665 list = new ArrayList();
1666 while (N > 0) {
1667 ActivityManager.RunningTaskInfo info =
1668 ActivityManager.RunningTaskInfo.CREATOR
1669 .createFromParcel(reply);
1670 list.add(info);
1671 N--;
1672 }
1673 }
1674 data.recycle();
1675 reply.recycle();
1676 return list;
1677 }
1678 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1679 int flags) throws RemoteException {
1680 Parcel data = Parcel.obtain();
1681 Parcel reply = Parcel.obtain();
1682 data.writeInterfaceToken(IActivityManager.descriptor);
1683 data.writeInt(maxNum);
1684 data.writeInt(flags);
1685 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1686 reply.readException();
1687 ArrayList<ActivityManager.RecentTaskInfo> list
1688 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1689 data.recycle();
1690 reply.recycle();
1691 return list;
1692 }
1693 public List getServices(int maxNum, int flags) throws RemoteException {
1694 Parcel data = Parcel.obtain();
1695 Parcel reply = Parcel.obtain();
1696 data.writeInterfaceToken(IActivityManager.descriptor);
1697 data.writeInt(maxNum);
1698 data.writeInt(flags);
1699 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1700 reply.readException();
1701 ArrayList list = null;
1702 int N = reply.readInt();
1703 if (N >= 0) {
1704 list = new ArrayList();
1705 while (N > 0) {
1706 ActivityManager.RunningServiceInfo info =
1707 ActivityManager.RunningServiceInfo.CREATOR
1708 .createFromParcel(reply);
1709 list.add(info);
1710 N--;
1711 }
1712 }
1713 data.recycle();
1714 reply.recycle();
1715 return list;
1716 }
1717 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1718 throws RemoteException {
1719 Parcel data = Parcel.obtain();
1720 Parcel reply = Parcel.obtain();
1721 data.writeInterfaceToken(IActivityManager.descriptor);
1722 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1723 reply.readException();
1724 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1725 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1726 data.recycle();
1727 reply.recycle();
1728 return list;
1729 }
1730 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1731 throws RemoteException {
1732 Parcel data = Parcel.obtain();
1733 Parcel reply = Parcel.obtain();
1734 data.writeInterfaceToken(IActivityManager.descriptor);
1735 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1736 reply.readException();
1737 ArrayList<ActivityManager.RunningAppProcessInfo> list
1738 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1739 data.recycle();
1740 reply.recycle();
1741 return list;
1742 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07001743 public List<ApplicationInfo> getRunningExternalApplications()
1744 throws RemoteException {
1745 Parcel data = Parcel.obtain();
1746 Parcel reply = Parcel.obtain();
1747 data.writeInterfaceToken(IActivityManager.descriptor);
1748 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
1749 reply.readException();
1750 ArrayList<ApplicationInfo> list
1751 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
1752 data.recycle();
1753 reply.recycle();
1754 return list;
1755 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001756 public void moveTaskToFront(int task) throws RemoteException
1757 {
1758 Parcel data = Parcel.obtain();
1759 Parcel reply = Parcel.obtain();
1760 data.writeInterfaceToken(IActivityManager.descriptor);
1761 data.writeInt(task);
1762 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1763 reply.readException();
1764 data.recycle();
1765 reply.recycle();
1766 }
1767 public void moveTaskToBack(int task) throws RemoteException
1768 {
1769 Parcel data = Parcel.obtain();
1770 Parcel reply = Parcel.obtain();
1771 data.writeInterfaceToken(IActivityManager.descriptor);
1772 data.writeInt(task);
1773 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1774 reply.readException();
1775 data.recycle();
1776 reply.recycle();
1777 }
1778 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1779 throws RemoteException {
1780 Parcel data = Parcel.obtain();
1781 Parcel reply = Parcel.obtain();
1782 data.writeInterfaceToken(IActivityManager.descriptor);
1783 data.writeStrongBinder(token);
1784 data.writeInt(nonRoot ? 1 : 0);
1785 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1786 reply.readException();
1787 boolean res = reply.readInt() != 0;
1788 data.recycle();
1789 reply.recycle();
1790 return res;
1791 }
1792 public void moveTaskBackwards(int task) throws RemoteException
1793 {
1794 Parcel data = Parcel.obtain();
1795 Parcel reply = Parcel.obtain();
1796 data.writeInterfaceToken(IActivityManager.descriptor);
1797 data.writeInt(task);
1798 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1799 reply.readException();
1800 data.recycle();
1801 reply.recycle();
1802 }
1803 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
1804 {
1805 Parcel data = Parcel.obtain();
1806 Parcel reply = Parcel.obtain();
1807 data.writeInterfaceToken(IActivityManager.descriptor);
1808 data.writeStrongBinder(token);
1809 data.writeInt(onlyRoot ? 1 : 0);
1810 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
1811 reply.readException();
1812 int res = reply.readInt();
1813 data.recycle();
1814 reply.recycle();
1815 return res;
1816 }
1817 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
1818 {
1819 Parcel data = Parcel.obtain();
1820 Parcel reply = Parcel.obtain();
1821 data.writeInterfaceToken(IActivityManager.descriptor);
1822 data.writeStrongBinder(token);
1823 ComponentName.writeToParcel(className, data);
1824 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
1825 reply.readException();
1826 data.recycle();
1827 reply.recycle();
1828 }
1829 public void reportThumbnail(IBinder token,
1830 Bitmap thumbnail, CharSequence description) throws RemoteException
1831 {
1832 Parcel data = Parcel.obtain();
1833 Parcel reply = Parcel.obtain();
1834 data.writeInterfaceToken(IActivityManager.descriptor);
1835 data.writeStrongBinder(token);
1836 if (thumbnail != null) {
1837 data.writeInt(1);
1838 thumbnail.writeToParcel(data, 0);
1839 } else {
1840 data.writeInt(0);
1841 }
1842 TextUtils.writeToParcel(description, data, 0);
1843 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1844 reply.readException();
1845 data.recycle();
1846 reply.recycle();
1847 }
1848 public ContentProviderHolder getContentProvider(IApplicationThread caller,
1849 String name) throws RemoteException
1850 {
1851 Parcel data = Parcel.obtain();
1852 Parcel reply = Parcel.obtain();
1853 data.writeInterfaceToken(IActivityManager.descriptor);
1854 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1855 data.writeString(name);
1856 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1857 reply.readException();
1858 int res = reply.readInt();
1859 ContentProviderHolder cph = null;
1860 if (res != 0) {
1861 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
1862 }
1863 data.recycle();
1864 reply.recycle();
1865 return cph;
1866 }
1867 public void publishContentProviders(IApplicationThread caller,
1868 List<ContentProviderHolder> providers) throws RemoteException
1869 {
1870 Parcel data = Parcel.obtain();
1871 Parcel reply = Parcel.obtain();
1872 data.writeInterfaceToken(IActivityManager.descriptor);
1873 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1874 data.writeTypedList(providers);
1875 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
1876 reply.readException();
1877 data.recycle();
1878 reply.recycle();
1879 }
1880
1881 public void removeContentProvider(IApplicationThread caller,
1882 String name) throws RemoteException {
1883 Parcel data = Parcel.obtain();
1884 Parcel reply = Parcel.obtain();
1885 data.writeInterfaceToken(IActivityManager.descriptor);
1886 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1887 data.writeString(name);
1888 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1889 reply.readException();
1890 data.recycle();
1891 reply.recycle();
1892 }
1893
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001894 public PendingIntent getRunningServiceControlPanel(ComponentName service)
1895 throws RemoteException
1896 {
1897 Parcel data = Parcel.obtain();
1898 Parcel reply = Parcel.obtain();
1899 data.writeInterfaceToken(IActivityManager.descriptor);
1900 service.writeToParcel(data, 0);
1901 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
1902 reply.readException();
1903 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
1904 data.recycle();
1905 reply.recycle();
1906 return res;
1907 }
1908
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001909 public ComponentName startService(IApplicationThread caller, Intent service,
1910 String resolvedType) throws RemoteException
1911 {
1912 Parcel data = Parcel.obtain();
1913 Parcel reply = Parcel.obtain();
1914 data.writeInterfaceToken(IActivityManager.descriptor);
1915 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1916 service.writeToParcel(data, 0);
1917 data.writeString(resolvedType);
1918 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
1919 reply.readException();
1920 ComponentName res = ComponentName.readFromParcel(reply);
1921 data.recycle();
1922 reply.recycle();
1923 return res;
1924 }
1925 public int stopService(IApplicationThread caller, Intent service,
1926 String resolvedType) throws RemoteException
1927 {
1928 Parcel data = Parcel.obtain();
1929 Parcel reply = Parcel.obtain();
1930 data.writeInterfaceToken(IActivityManager.descriptor);
1931 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1932 service.writeToParcel(data, 0);
1933 data.writeString(resolvedType);
1934 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
1935 reply.readException();
1936 int res = reply.readInt();
1937 reply.recycle();
1938 data.recycle();
1939 return res;
1940 }
1941 public boolean stopServiceToken(ComponentName className, IBinder token,
1942 int startId) throws RemoteException {
1943 Parcel data = Parcel.obtain();
1944 Parcel reply = Parcel.obtain();
1945 data.writeInterfaceToken(IActivityManager.descriptor);
1946 ComponentName.writeToParcel(className, data);
1947 data.writeStrongBinder(token);
1948 data.writeInt(startId);
1949 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
1950 reply.readException();
1951 boolean res = reply.readInt() != 0;
1952 data.recycle();
1953 reply.recycle();
1954 return res;
1955 }
1956 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001957 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001958 Parcel data = Parcel.obtain();
1959 Parcel reply = Parcel.obtain();
1960 data.writeInterfaceToken(IActivityManager.descriptor);
1961 ComponentName.writeToParcel(className, data);
1962 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001963 data.writeInt(id);
1964 if (notification != null) {
1965 data.writeInt(1);
1966 notification.writeToParcel(data, 0);
1967 } else {
1968 data.writeInt(0);
1969 }
1970 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001971 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
1972 reply.readException();
1973 data.recycle();
1974 reply.recycle();
1975 }
1976 public int bindService(IApplicationThread caller, IBinder token,
1977 Intent service, String resolvedType, IServiceConnection connection,
1978 int flags) throws RemoteException {
1979 Parcel data = Parcel.obtain();
1980 Parcel reply = Parcel.obtain();
1981 data.writeInterfaceToken(IActivityManager.descriptor);
1982 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1983 data.writeStrongBinder(token);
1984 service.writeToParcel(data, 0);
1985 data.writeString(resolvedType);
1986 data.writeStrongBinder(connection.asBinder());
1987 data.writeInt(flags);
1988 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
1989 reply.readException();
1990 int res = reply.readInt();
1991 data.recycle();
1992 reply.recycle();
1993 return res;
1994 }
1995 public boolean unbindService(IServiceConnection connection) throws RemoteException
1996 {
1997 Parcel data = Parcel.obtain();
1998 Parcel reply = Parcel.obtain();
1999 data.writeInterfaceToken(IActivityManager.descriptor);
2000 data.writeStrongBinder(connection.asBinder());
2001 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2002 reply.readException();
2003 boolean res = reply.readInt() != 0;
2004 data.recycle();
2005 reply.recycle();
2006 return res;
2007 }
2008
2009 public void publishService(IBinder token,
2010 Intent intent, IBinder service) throws RemoteException {
2011 Parcel data = Parcel.obtain();
2012 Parcel reply = Parcel.obtain();
2013 data.writeInterfaceToken(IActivityManager.descriptor);
2014 data.writeStrongBinder(token);
2015 intent.writeToParcel(data, 0);
2016 data.writeStrongBinder(service);
2017 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2018 reply.readException();
2019 data.recycle();
2020 reply.recycle();
2021 }
2022
2023 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2024 throws RemoteException {
2025 Parcel data = Parcel.obtain();
2026 Parcel reply = Parcel.obtain();
2027 data.writeInterfaceToken(IActivityManager.descriptor);
2028 data.writeStrongBinder(token);
2029 intent.writeToParcel(data, 0);
2030 data.writeInt(doRebind ? 1 : 0);
2031 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2032 reply.readException();
2033 data.recycle();
2034 reply.recycle();
2035 }
2036
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002037 public void serviceDoneExecuting(IBinder token, int type, int startId,
2038 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002039 Parcel data = Parcel.obtain();
2040 Parcel reply = Parcel.obtain();
2041 data.writeInterfaceToken(IActivityManager.descriptor);
2042 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002043 data.writeInt(type);
2044 data.writeInt(startId);
2045 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002046 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2047 reply.readException();
2048 data.recycle();
2049 reply.recycle();
2050 }
2051
2052 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2053 Parcel data = Parcel.obtain();
2054 Parcel reply = Parcel.obtain();
2055 data.writeInterfaceToken(IActivityManager.descriptor);
2056 service.writeToParcel(data, 0);
2057 data.writeString(resolvedType);
2058 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2059 reply.readException();
2060 IBinder binder = reply.readStrongBinder();
2061 reply.recycle();
2062 data.recycle();
2063 return binder;
2064 }
2065
Christopher Tate181fafa2009-05-14 11:12:14 -07002066 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2067 throws RemoteException {
2068 Parcel data = Parcel.obtain();
2069 Parcel reply = Parcel.obtain();
2070 data.writeInterfaceToken(IActivityManager.descriptor);
2071 app.writeToParcel(data, 0);
2072 data.writeInt(backupRestoreMode);
2073 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2074 reply.readException();
2075 boolean success = reply.readInt() != 0;
2076 reply.recycle();
2077 data.recycle();
2078 return success;
2079 }
2080
2081 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2082 Parcel data = Parcel.obtain();
2083 Parcel reply = Parcel.obtain();
2084 data.writeInterfaceToken(IActivityManager.descriptor);
2085 data.writeString(packageName);
2086 data.writeStrongBinder(agent);
2087 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2088 reply.recycle();
2089 data.recycle();
2090 }
2091
2092 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2093 Parcel data = Parcel.obtain();
2094 Parcel reply = Parcel.obtain();
2095 data.writeInterfaceToken(IActivityManager.descriptor);
2096 app.writeToParcel(data, 0);
2097 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2098 reply.readException();
2099 reply.recycle();
2100 data.recycle();
2101 }
2102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002103 public boolean startInstrumentation(ComponentName className, String profileFile,
2104 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2105 throws RemoteException {
2106 Parcel data = Parcel.obtain();
2107 Parcel reply = Parcel.obtain();
2108 data.writeInterfaceToken(IActivityManager.descriptor);
2109 ComponentName.writeToParcel(className, data);
2110 data.writeString(profileFile);
2111 data.writeInt(flags);
2112 data.writeBundle(arguments);
2113 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2114 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2115 reply.readException();
2116 boolean res = reply.readInt() != 0;
2117 reply.recycle();
2118 data.recycle();
2119 return res;
2120 }
2121
2122 public void finishInstrumentation(IApplicationThread target,
2123 int resultCode, Bundle results) throws RemoteException {
2124 Parcel data = Parcel.obtain();
2125 Parcel reply = Parcel.obtain();
2126 data.writeInterfaceToken(IActivityManager.descriptor);
2127 data.writeStrongBinder(target != null ? target.asBinder() : null);
2128 data.writeInt(resultCode);
2129 data.writeBundle(results);
2130 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2131 reply.readException();
2132 data.recycle();
2133 reply.recycle();
2134 }
2135 public Configuration getConfiguration() throws RemoteException
2136 {
2137 Parcel data = Parcel.obtain();
2138 Parcel reply = Parcel.obtain();
2139 data.writeInterfaceToken(IActivityManager.descriptor);
2140 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2141 reply.readException();
2142 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2143 reply.recycle();
2144 data.recycle();
2145 return res;
2146 }
2147 public void updateConfiguration(Configuration values) throws RemoteException
2148 {
2149 Parcel data = Parcel.obtain();
2150 Parcel reply = Parcel.obtain();
2151 data.writeInterfaceToken(IActivityManager.descriptor);
2152 values.writeToParcel(data, 0);
2153 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2154 reply.readException();
2155 data.recycle();
2156 reply.recycle();
2157 }
2158 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2159 throws RemoteException {
2160 Parcel data = Parcel.obtain();
2161 Parcel reply = Parcel.obtain();
2162 data.writeInterfaceToken(IActivityManager.descriptor);
2163 data.writeStrongBinder(token);
2164 data.writeInt(requestedOrientation);
2165 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2166 reply.readException();
2167 data.recycle();
2168 reply.recycle();
2169 }
2170 public int getRequestedOrientation(IBinder token) throws RemoteException {
2171 Parcel data = Parcel.obtain();
2172 Parcel reply = Parcel.obtain();
2173 data.writeInterfaceToken(IActivityManager.descriptor);
2174 data.writeStrongBinder(token);
2175 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2176 reply.readException();
2177 int res = reply.readInt();
2178 data.recycle();
2179 reply.recycle();
2180 return res;
2181 }
2182 public ComponentName getActivityClassForToken(IBinder token)
2183 throws RemoteException {
2184 Parcel data = Parcel.obtain();
2185 Parcel reply = Parcel.obtain();
2186 data.writeInterfaceToken(IActivityManager.descriptor);
2187 data.writeStrongBinder(token);
2188 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2189 reply.readException();
2190 ComponentName res = ComponentName.readFromParcel(reply);
2191 data.recycle();
2192 reply.recycle();
2193 return res;
2194 }
2195 public String getPackageForToken(IBinder token) throws RemoteException
2196 {
2197 Parcel data = Parcel.obtain();
2198 Parcel reply = Parcel.obtain();
2199 data.writeInterfaceToken(IActivityManager.descriptor);
2200 data.writeStrongBinder(token);
2201 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2202 reply.readException();
2203 String res = reply.readString();
2204 data.recycle();
2205 reply.recycle();
2206 return res;
2207 }
2208 public IIntentSender getIntentSender(int type,
2209 String packageName, IBinder token, String resultWho,
2210 int requestCode, Intent intent, String resolvedType, int flags)
2211 throws RemoteException {
2212 Parcel data = Parcel.obtain();
2213 Parcel reply = Parcel.obtain();
2214 data.writeInterfaceToken(IActivityManager.descriptor);
2215 data.writeInt(type);
2216 data.writeString(packageName);
2217 data.writeStrongBinder(token);
2218 data.writeString(resultWho);
2219 data.writeInt(requestCode);
2220 if (intent != null) {
2221 data.writeInt(1);
2222 intent.writeToParcel(data, 0);
2223 } else {
2224 data.writeInt(0);
2225 }
2226 data.writeString(resolvedType);
2227 data.writeInt(flags);
2228 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2229 reply.readException();
2230 IIntentSender res = IIntentSender.Stub.asInterface(
2231 reply.readStrongBinder());
2232 data.recycle();
2233 reply.recycle();
2234 return res;
2235 }
2236 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(sender.asBinder());
2241 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2242 reply.readException();
2243 data.recycle();
2244 reply.recycle();
2245 }
2246 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2247 Parcel data = Parcel.obtain();
2248 Parcel reply = Parcel.obtain();
2249 data.writeInterfaceToken(IActivityManager.descriptor);
2250 data.writeStrongBinder(sender.asBinder());
2251 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2252 reply.readException();
2253 String res = reply.readString();
2254 data.recycle();
2255 reply.recycle();
2256 return res;
2257 }
2258 public void setProcessLimit(int max) throws RemoteException
2259 {
2260 Parcel data = Parcel.obtain();
2261 Parcel reply = Parcel.obtain();
2262 data.writeInterfaceToken(IActivityManager.descriptor);
2263 data.writeInt(max);
2264 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2265 reply.readException();
2266 data.recycle();
2267 reply.recycle();
2268 }
2269 public int getProcessLimit() throws RemoteException
2270 {
2271 Parcel data = Parcel.obtain();
2272 Parcel reply = Parcel.obtain();
2273 data.writeInterfaceToken(IActivityManager.descriptor);
2274 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2275 reply.readException();
2276 int res = reply.readInt();
2277 data.recycle();
2278 reply.recycle();
2279 return res;
2280 }
2281 public void setProcessForeground(IBinder token, int pid,
2282 boolean isForeground) throws RemoteException {
2283 Parcel data = Parcel.obtain();
2284 Parcel reply = Parcel.obtain();
2285 data.writeInterfaceToken(IActivityManager.descriptor);
2286 data.writeStrongBinder(token);
2287 data.writeInt(pid);
2288 data.writeInt(isForeground ? 1 : 0);
2289 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2290 reply.readException();
2291 data.recycle();
2292 reply.recycle();
2293 }
2294 public int checkPermission(String permission, int pid, int uid)
2295 throws RemoteException {
2296 Parcel data = Parcel.obtain();
2297 Parcel reply = Parcel.obtain();
2298 data.writeInterfaceToken(IActivityManager.descriptor);
2299 data.writeString(permission);
2300 data.writeInt(pid);
2301 data.writeInt(uid);
2302 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2303 reply.readException();
2304 int res = reply.readInt();
2305 data.recycle();
2306 reply.recycle();
2307 return res;
2308 }
2309 public boolean clearApplicationUserData(final String packageName,
2310 final IPackageDataObserver observer) throws RemoteException {
2311 Parcel data = Parcel.obtain();
2312 Parcel reply = Parcel.obtain();
2313 data.writeInterfaceToken(IActivityManager.descriptor);
2314 data.writeString(packageName);
2315 data.writeStrongBinder(observer.asBinder());
2316 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2317 reply.readException();
2318 boolean res = reply.readInt() != 0;
2319 data.recycle();
2320 reply.recycle();
2321 return res;
2322 }
2323 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2324 throws RemoteException {
2325 Parcel data = Parcel.obtain();
2326 Parcel reply = Parcel.obtain();
2327 data.writeInterfaceToken(IActivityManager.descriptor);
2328 uri.writeToParcel(data, 0);
2329 data.writeInt(pid);
2330 data.writeInt(uid);
2331 data.writeInt(mode);
2332 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 int res = reply.readInt();
2335 data.recycle();
2336 reply.recycle();
2337 return res;
2338 }
2339 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2340 Uri uri, int mode) throws RemoteException {
2341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeStrongBinder(caller.asBinder());
2345 data.writeString(targetPkg);
2346 uri.writeToParcel(data, 0);
2347 data.writeInt(mode);
2348 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2349 reply.readException();
2350 data.recycle();
2351 reply.recycle();
2352 }
2353 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2354 int mode) throws RemoteException {
2355 Parcel data = Parcel.obtain();
2356 Parcel reply = Parcel.obtain();
2357 data.writeInterfaceToken(IActivityManager.descriptor);
2358 data.writeStrongBinder(caller.asBinder());
2359 uri.writeToParcel(data, 0);
2360 data.writeInt(mode);
2361 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 data.recycle();
2364 reply.recycle();
2365 }
2366 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2367 throws RemoteException {
2368 Parcel data = Parcel.obtain();
2369 Parcel reply = Parcel.obtain();
2370 data.writeInterfaceToken(IActivityManager.descriptor);
2371 data.writeStrongBinder(who.asBinder());
2372 data.writeInt(waiting ? 1 : 0);
2373 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2374 reply.readException();
2375 data.recycle();
2376 reply.recycle();
2377 }
2378 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2379 Parcel data = Parcel.obtain();
2380 Parcel reply = Parcel.obtain();
2381 data.writeInterfaceToken(IActivityManager.descriptor);
2382 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2383 reply.readException();
2384 outInfo.readFromParcel(reply);
2385 data.recycle();
2386 reply.recycle();
2387 }
2388 public void unhandledBack() throws RemoteException
2389 {
2390 Parcel data = Parcel.obtain();
2391 Parcel reply = Parcel.obtain();
2392 data.writeInterfaceToken(IActivityManager.descriptor);
2393 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2394 reply.readException();
2395 data.recycle();
2396 reply.recycle();
2397 }
2398 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2399 {
2400 Parcel data = Parcel.obtain();
2401 Parcel reply = Parcel.obtain();
2402 data.writeInterfaceToken(IActivityManager.descriptor);
2403 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2404 reply.readException();
2405 ParcelFileDescriptor pfd = null;
2406 if (reply.readInt() != 0) {
2407 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2408 }
2409 data.recycle();
2410 reply.recycle();
2411 return pfd;
2412 }
2413 public void goingToSleep() throws RemoteException
2414 {
2415 Parcel data = Parcel.obtain();
2416 Parcel reply = Parcel.obtain();
2417 data.writeInterfaceToken(IActivityManager.descriptor);
2418 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2419 reply.readException();
2420 data.recycle();
2421 reply.recycle();
2422 }
2423 public void wakingUp() throws RemoteException
2424 {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2429 reply.readException();
2430 data.recycle();
2431 reply.recycle();
2432 }
2433 public void setDebugApp(
2434 String packageName, boolean waitForDebugger, boolean persistent)
2435 throws RemoteException
2436 {
2437 Parcel data = Parcel.obtain();
2438 Parcel reply = Parcel.obtain();
2439 data.writeInterfaceToken(IActivityManager.descriptor);
2440 data.writeString(packageName);
2441 data.writeInt(waitForDebugger ? 1 : 0);
2442 data.writeInt(persistent ? 1 : 0);
2443 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 data.recycle();
2446 reply.recycle();
2447 }
2448 public void setAlwaysFinish(boolean enabled) throws RemoteException
2449 {
2450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 data.writeInt(enabled ? 1 : 0);
2454 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2455 reply.readException();
2456 data.recycle();
2457 reply.recycle();
2458 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002459 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002460 {
2461 Parcel data = Parcel.obtain();
2462 Parcel reply = Parcel.obtain();
2463 data.writeInterfaceToken(IActivityManager.descriptor);
2464 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002465 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002466 reply.readException();
2467 data.recycle();
2468 reply.recycle();
2469 }
2470 public void enterSafeMode() throws RemoteException {
2471 Parcel data = Parcel.obtain();
2472 data.writeInterfaceToken(IActivityManager.descriptor);
2473 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2474 data.recycle();
2475 }
2476 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2477 Parcel data = Parcel.obtain();
2478 data.writeStrongBinder(sender.asBinder());
2479 data.writeInterfaceToken(IActivityManager.descriptor);
2480 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2481 data.recycle();
2482 }
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002483 public boolean killPids(int[] pids, String reason) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002484 Parcel data = Parcel.obtain();
2485 Parcel reply = Parcel.obtain();
2486 data.writeInterfaceToken(IActivityManager.descriptor);
2487 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002488 data.writeString(reason);
2489 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002490 boolean res = reply.readInt() != 0;
2491 data.recycle();
2492 reply.recycle();
2493 return res;
2494 }
2495 public void reportPss(IApplicationThread caller, int pss) throws RemoteException {
2496 Parcel data = Parcel.obtain();
2497 data.writeInterfaceToken(IActivityManager.descriptor);
2498 data.writeStrongBinder(caller.asBinder());
2499 data.writeInt(pss);
2500 mRemote.transact(REPORT_PSS_TRANSACTION, data, null, 0);
2501 data.recycle();
2502 }
2503 public void startRunning(String pkg, String cls, String action,
2504 String indata) throws RemoteException {
2505 Parcel data = Parcel.obtain();
2506 Parcel reply = Parcel.obtain();
2507 data.writeInterfaceToken(IActivityManager.descriptor);
2508 data.writeString(pkg);
2509 data.writeString(cls);
2510 data.writeString(action);
2511 data.writeString(indata);
2512 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2513 reply.readException();
2514 data.recycle();
2515 reply.recycle();
2516 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 public boolean testIsSystemReady()
2518 {
2519 /* this base class version is never called */
2520 return true;
2521 }
Dan Egnor60d87622009-12-16 16:32:58 -08002522 public void handleApplicationCrash(IBinder app,
2523 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2524 {
2525 Parcel data = Parcel.obtain();
2526 Parcel reply = Parcel.obtain();
2527 data.writeInterfaceToken(IActivityManager.descriptor);
2528 data.writeStrongBinder(app);
2529 crashInfo.writeToParcel(data, 0);
2530 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2531 reply.readException();
2532 reply.recycle();
2533 data.recycle();
2534 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002535
Dan Egnor60d87622009-12-16 16:32:58 -08002536 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002537 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002538 {
2539 Parcel data = Parcel.obtain();
2540 Parcel reply = Parcel.obtain();
2541 data.writeInterfaceToken(IActivityManager.descriptor);
2542 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002543 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002544 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002545 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002546 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002547 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002548 reply.recycle();
2549 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002550 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002552
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002553 public void handleApplicationStrictModeViolation(IBinder app,
2554 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2555 {
2556 Parcel data = Parcel.obtain();
2557 Parcel reply = Parcel.obtain();
2558 data.writeInterfaceToken(IActivityManager.descriptor);
2559 data.writeStrongBinder(app);
2560 crashInfo.writeToParcel(data, 0);
2561 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2562 reply.readException();
2563 reply.recycle();
2564 data.recycle();
2565 }
2566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002567 public void signalPersistentProcesses(int sig) throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 data.writeInt(sig);
2572 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2573 reply.readException();
2574 data.recycle();
2575 reply.recycle();
2576 }
2577
Dianne Hackborn03abb812010-01-04 18:43:19 -08002578 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002579 Parcel data = Parcel.obtain();
2580 Parcel reply = Parcel.obtain();
2581 data.writeInterfaceToken(IActivityManager.descriptor);
2582 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002583 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 data.recycle();
2586 reply.recycle();
2587 }
2588
2589 public void forceStopPackage(String packageName) throws RemoteException {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeString(packageName);
2594 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002595 reply.readException();
2596 data.recycle();
2597 reply.recycle();
2598 }
2599
2600 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2601 {
2602 Parcel data = Parcel.obtain();
2603 Parcel reply = Parcel.obtain();
2604 data.writeInterfaceToken(IActivityManager.descriptor);
2605 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2606 reply.readException();
2607 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2608 reply.recycle();
2609 data.recycle();
2610 return res;
2611 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002612
2613 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002614 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002615 {
2616 Parcel data = Parcel.obtain();
2617 Parcel reply = Parcel.obtain();
2618 data.writeInterfaceToken(IActivityManager.descriptor);
2619 data.writeString(process);
2620 data.writeInt(start ? 1 : 0);
2621 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002622 if (fd != null) {
2623 data.writeInt(1);
2624 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2625 } else {
2626 data.writeInt(0);
2627 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002628 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2629 reply.readException();
2630 boolean res = reply.readInt() != 0;
2631 reply.recycle();
2632 data.recycle();
2633 return res;
2634 }
2635
Dianne Hackborn55280a92009-05-07 15:53:46 -07002636 public boolean shutdown(int timeout) throws RemoteException
2637 {
2638 Parcel data = Parcel.obtain();
2639 Parcel reply = Parcel.obtain();
2640 data.writeInterfaceToken(IActivityManager.descriptor);
2641 data.writeInt(timeout);
2642 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2643 reply.readException();
2644 boolean res = reply.readInt() != 0;
2645 reply.recycle();
2646 data.recycle();
2647 return res;
2648 }
2649
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002650 public void stopAppSwitches() throws RemoteException {
2651 Parcel data = Parcel.obtain();
2652 Parcel reply = Parcel.obtain();
2653 data.writeInterfaceToken(IActivityManager.descriptor);
2654 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2655 reply.readException();
2656 reply.recycle();
2657 data.recycle();
2658 }
2659
2660 public void resumeAppSwitches() throws RemoteException {
2661 Parcel data = Parcel.obtain();
2662 Parcel reply = Parcel.obtain();
2663 data.writeInterfaceToken(IActivityManager.descriptor);
2664 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2665 reply.readException();
2666 reply.recycle();
2667 data.recycle();
2668 }
2669
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002670 public void registerActivityWatcher(IActivityWatcher watcher)
2671 throws RemoteException {
2672 Parcel data = Parcel.obtain();
2673 Parcel reply = Parcel.obtain();
2674 data.writeInterfaceToken(IActivityManager.descriptor);
2675 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2676 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2677 reply.readException();
2678 data.recycle();
2679 reply.recycle();
2680 }
2681
2682 public void unregisterActivityWatcher(IActivityWatcher watcher)
2683 throws RemoteException {
2684 Parcel data = Parcel.obtain();
2685 Parcel reply = Parcel.obtain();
2686 data.writeInterfaceToken(IActivityManager.descriptor);
2687 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2688 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 data.recycle();
2691 reply.recycle();
2692 }
2693
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002694 public int startActivityInPackage(int uid,
2695 Intent intent, String resolvedType, IBinder resultTo,
2696 String resultWho, int requestCode, boolean onlyIfNeeded)
2697 throws RemoteException {
2698 Parcel data = Parcel.obtain();
2699 Parcel reply = Parcel.obtain();
2700 data.writeInterfaceToken(IActivityManager.descriptor);
2701 data.writeInt(uid);
2702 intent.writeToParcel(data, 0);
2703 data.writeString(resolvedType);
2704 data.writeStrongBinder(resultTo);
2705 data.writeString(resultWho);
2706 data.writeInt(requestCode);
2707 data.writeInt(onlyIfNeeded ? 1 : 0);
2708 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2709 reply.readException();
2710 int result = reply.readInt();
2711 reply.recycle();
2712 data.recycle();
2713 return result;
2714 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002715
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002716 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 data.writeString(pkg);
2721 data.writeInt(uid);
2722 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2723 reply.readException();
2724 data.recycle();
2725 reply.recycle();
2726 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002727
2728 public void closeSystemDialogs(String reason) throws RemoteException {
2729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeString(reason);
2733 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 data.recycle();
2736 reply.recycle();
2737 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002738
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002739 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002740 throws RemoteException {
2741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
2743 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002744 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002745 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
2746 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002747 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002748 data.recycle();
2749 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002750 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002751 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07002752
2753 public void killApplicationProcess(String processName, int uid) throws RemoteException {
2754 Parcel data = Parcel.obtain();
2755 Parcel reply = Parcel.obtain();
2756 data.writeInterfaceToken(IActivityManager.descriptor);
2757 data.writeString(processName);
2758 data.writeInt(uid);
2759 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
2760 reply.readException();
2761 data.recycle();
2762 reply.recycle();
2763 }
2764
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07002765 public void overridePendingTransition(IBinder token, String packageName,
2766 int enterAnim, int exitAnim) throws RemoteException {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeStrongBinder(token);
2771 data.writeString(packageName);
2772 data.writeInt(enterAnim);
2773 data.writeInt(exitAnim);
2774 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
2775 reply.readException();
2776 data.recycle();
2777 reply.recycle();
2778 }
2779
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08002780 public boolean isUserAMonkey() throws RemoteException {
2781 Parcel data = Parcel.obtain();
2782 Parcel reply = Parcel.obtain();
2783 data.writeInterfaceToken(IActivityManager.descriptor);
2784 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
2785 reply.readException();
2786 boolean res = reply.readInt() != 0;
2787 data.recycle();
2788 reply.recycle();
2789 return res;
2790 }
2791
Dianne Hackborn860755f2010-06-03 18:47:52 -07002792 public void finishHeavyWeightApp() throws RemoteException {
2793 Parcel data = Parcel.obtain();
2794 Parcel reply = Parcel.obtain();
2795 data.writeInterfaceToken(IActivityManager.descriptor);
2796 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 data.recycle();
2799 reply.recycle();
2800 }
2801
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 private IBinder mRemote;
2803}