blob: 63b2f08e28fa5fbc0cb5b3198a625d42e2049f82 [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();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001068 int violationMask = data.readInt();
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001069 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001070 handleApplicationStrictModeViolation(app, violationMask, ci);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001071 reply.writeNoException();
1072 return true;
1073 }
1074
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 int sig = data.readInt();
1078 signalPersistentProcesses(sig);
1079 reply.writeNoException();
1080 return true;
1081 }
1082
Dianne Hackborn03abb812010-01-04 18:43:19 -08001083 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1084 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001085 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001086 killBackgroundProcesses(packageName);
1087 reply.writeNoException();
1088 return true;
1089 }
1090
1091 case FORCE_STOP_PACKAGE_TRANSACTION: {
1092 data.enforceInterface(IActivityManager.descriptor);
1093 String packageName = data.readString();
1094 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001095 reply.writeNoException();
1096 return true;
1097 }
1098
1099 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 ConfigurationInfo config = getDeviceConfigurationInfo();
1102 reply.writeNoException();
1103 config.writeToParcel(reply, 0);
1104 return true;
1105 }
1106
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001107 case PROFILE_CONTROL_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 String process = data.readString();
1110 boolean start = data.readInt() != 0;
1111 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001112 ParcelFileDescriptor fd = data.readInt() != 0
1113 ? data.readFileDescriptor() : null;
1114 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001115 reply.writeNoException();
1116 reply.writeInt(res ? 1 : 0);
1117 return true;
1118 }
1119
Dianne Hackborn55280a92009-05-07 15:53:46 -07001120 case SHUTDOWN_TRANSACTION: {
1121 data.enforceInterface(IActivityManager.descriptor);
1122 boolean res = shutdown(data.readInt());
1123 reply.writeNoException();
1124 reply.writeInt(res ? 1 : 0);
1125 return true;
1126 }
1127
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001128 case STOP_APP_SWITCHES_TRANSACTION: {
1129 data.enforceInterface(IActivityManager.descriptor);
1130 stopAppSwitches();
1131 reply.writeNoException();
1132 return true;
1133 }
1134
1135 case RESUME_APP_SWITCHES_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 resumeAppSwitches();
1138 reply.writeNoException();
1139 return true;
1140 }
1141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 case PEEK_SERVICE_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 Intent service = Intent.CREATOR.createFromParcel(data);
1145 String resolvedType = data.readString();
1146 IBinder binder = peekService(service, resolvedType);
1147 reply.writeNoException();
1148 reply.writeStrongBinder(binder);
1149 return true;
1150 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001151
1152 case START_BACKUP_AGENT_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1155 int backupRestoreMode = data.readInt();
1156 boolean success = bindBackupAgent(info, backupRestoreMode);
1157 reply.writeNoException();
1158 reply.writeInt(success ? 1 : 0);
1159 return true;
1160 }
1161
1162 case BACKUP_AGENT_CREATED_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 String packageName = data.readString();
1165 IBinder agent = data.readStrongBinder();
1166 backupAgentCreated(packageName, agent);
1167 reply.writeNoException();
1168 return true;
1169 }
1170
1171 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1174 unbindBackupAgent(info);
1175 reply.writeNoException();
1176 return true;
1177 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001178
1179 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1180 data.enforceInterface(IActivityManager.descriptor);
1181 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1182 data.readStrongBinder());
1183 registerActivityWatcher(watcher);
1184 return true;
1185 }
1186
1187 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1190 data.readStrongBinder());
1191 unregisterActivityWatcher(watcher);
1192 return true;
1193 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001194
1195 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1196 {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 int uid = data.readInt();
1199 Intent intent = Intent.CREATOR.createFromParcel(data);
1200 String resolvedType = data.readString();
1201 IBinder resultTo = data.readStrongBinder();
1202 String resultWho = data.readString();
1203 int requestCode = data.readInt();
1204 boolean onlyIfNeeded = data.readInt() != 0;
1205 int result = startActivityInPackage(uid, intent, resolvedType,
1206 resultTo, resultWho, requestCode, onlyIfNeeded);
1207 reply.writeNoException();
1208 reply.writeInt(result);
1209 return true;
1210 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001211
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001212 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1213 data.enforceInterface(IActivityManager.descriptor);
1214 String pkg = data.readString();
1215 int uid = data.readInt();
1216 killApplicationWithUid(pkg, uid);
1217 reply.writeNoException();
1218 return true;
1219 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001220
1221 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 String reason = data.readString();
1224 closeSystemDialogs(reason);
1225 reply.writeNoException();
1226 return true;
1227 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001228
1229 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1230 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001231 int[] pids = data.createIntArray();
1232 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001233 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001234 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001235 return true;
1236 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001237
1238 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
1240 String processName = data.readString();
1241 int uid = data.readInt();
1242 killApplicationProcess(processName, uid);
1243 reply.writeNoException();
1244 return true;
1245 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001246
1247 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1248 data.enforceInterface(IActivityManager.descriptor);
1249 IBinder token = data.readStrongBinder();
1250 String packageName = data.readString();
1251 int enterAnim = data.readInt();
1252 int exitAnim = data.readInt();
1253 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001254 reply.writeNoException();
1255 return true;
1256 }
1257
1258 case IS_USER_A_MONKEY_TRANSACTION: {
1259 data.enforceInterface(IActivityManager.descriptor);
1260 reply.writeInt(isUserAMonkey() ? 1 : 0);
1261 reply.writeNoException();
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001262 return true;
1263 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001264
1265 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 finishHeavyWeightApp();
1268 reply.writeNoException();
1269 return true;
1270 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001271
1272 case IS_IMMERSIVE_TRANSACTION: {
1273 data.enforceInterface(IActivityManager.descriptor);
1274 IBinder token = data.readStrongBinder();
1275 reply.writeInt(isImmersive(token) ? 1 : 0);
1276 reply.writeNoException();
1277 return true;
1278 }
1279
1280 case SET_IMMERSIVE_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 IBinder token = data.readStrongBinder();
1283 boolean imm = data.readInt() == 1;
1284 setImmersive(token, imm);
1285 reply.writeNoException();
1286 return true;
1287 }
1288
1289 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 reply.writeInt(isTopActivityImmersive() ? 1 : 0);
1292 reply.writeNoException();
1293 return true;
1294 }
1295
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 }
1297
1298 return super.onTransact(code, data, reply, flags);
1299 }
1300
1301 public IBinder asBinder()
1302 {
1303 return this;
1304 }
1305
1306 private static IActivityManager gDefault;
1307}
1308
1309class ActivityManagerProxy implements IActivityManager
1310{
1311 public ActivityManagerProxy(IBinder remote)
1312 {
1313 mRemote = remote;
1314 }
1315
1316 public IBinder asBinder()
1317 {
1318 return mRemote;
1319 }
1320
1321 public int startActivity(IApplicationThread caller, Intent intent,
1322 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1323 IBinder resultTo, String resultWho,
1324 int requestCode, boolean onlyIfNeeded,
1325 boolean debug) throws RemoteException {
1326 Parcel data = Parcel.obtain();
1327 Parcel reply = Parcel.obtain();
1328 data.writeInterfaceToken(IActivityManager.descriptor);
1329 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1330 intent.writeToParcel(data, 0);
1331 data.writeString(resolvedType);
1332 data.writeTypedArray(grantedUriPermissions, 0);
1333 data.writeInt(grantedMode);
1334 data.writeStrongBinder(resultTo);
1335 data.writeString(resultWho);
1336 data.writeInt(requestCode);
1337 data.writeInt(onlyIfNeeded ? 1 : 0);
1338 data.writeInt(debug ? 1 : 0);
1339 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1340 reply.readException();
1341 int result = reply.readInt();
1342 reply.recycle();
1343 data.recycle();
1344 return result;
1345 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001346 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1347 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1348 IBinder resultTo, String resultWho,
1349 int requestCode, boolean onlyIfNeeded,
1350 boolean debug) throws RemoteException {
1351 Parcel data = Parcel.obtain();
1352 Parcel reply = Parcel.obtain();
1353 data.writeInterfaceToken(IActivityManager.descriptor);
1354 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1355 intent.writeToParcel(data, 0);
1356 data.writeString(resolvedType);
1357 data.writeTypedArray(grantedUriPermissions, 0);
1358 data.writeInt(grantedMode);
1359 data.writeStrongBinder(resultTo);
1360 data.writeString(resultWho);
1361 data.writeInt(requestCode);
1362 data.writeInt(onlyIfNeeded ? 1 : 0);
1363 data.writeInt(debug ? 1 : 0);
1364 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1365 reply.readException();
1366 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1367 reply.recycle();
1368 data.recycle();
1369 return result;
1370 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001371 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1372 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1373 IBinder resultTo, String resultWho,
1374 int requestCode, boolean onlyIfNeeded,
1375 boolean debug, Configuration config) throws RemoteException {
1376 Parcel data = Parcel.obtain();
1377 Parcel reply = Parcel.obtain();
1378 data.writeInterfaceToken(IActivityManager.descriptor);
1379 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1380 intent.writeToParcel(data, 0);
1381 data.writeString(resolvedType);
1382 data.writeTypedArray(grantedUriPermissions, 0);
1383 data.writeInt(grantedMode);
1384 data.writeStrongBinder(resultTo);
1385 data.writeString(resultWho);
1386 data.writeInt(requestCode);
1387 data.writeInt(onlyIfNeeded ? 1 : 0);
1388 data.writeInt(debug ? 1 : 0);
1389 config.writeToParcel(data, 0);
1390 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1391 reply.readException();
1392 int result = reply.readInt();
1393 reply.recycle();
1394 data.recycle();
1395 return result;
1396 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001397 public int startActivityIntentSender(IApplicationThread caller,
1398 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001399 IBinder resultTo, String resultWho, int requestCode,
1400 int flagsMask, int flagsValues) throws RemoteException {
1401 Parcel data = Parcel.obtain();
1402 Parcel reply = Parcel.obtain();
1403 data.writeInterfaceToken(IActivityManager.descriptor);
1404 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1405 intent.writeToParcel(data, 0);
1406 if (fillInIntent != null) {
1407 data.writeInt(1);
1408 fillInIntent.writeToParcel(data, 0);
1409 } else {
1410 data.writeInt(0);
1411 }
1412 data.writeString(resolvedType);
1413 data.writeStrongBinder(resultTo);
1414 data.writeString(resultWho);
1415 data.writeInt(requestCode);
1416 data.writeInt(flagsMask);
1417 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001418 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001419 reply.readException();
1420 int result = reply.readInt();
1421 reply.recycle();
1422 data.recycle();
1423 return result;
1424 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001425 public boolean startNextMatchingActivity(IBinder callingActivity,
1426 Intent intent) throws RemoteException {
1427 Parcel data = Parcel.obtain();
1428 Parcel reply = Parcel.obtain();
1429 data.writeInterfaceToken(IActivityManager.descriptor);
1430 data.writeStrongBinder(callingActivity);
1431 intent.writeToParcel(data, 0);
1432 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1433 reply.readException();
1434 int result = reply.readInt();
1435 reply.recycle();
1436 data.recycle();
1437 return result != 0;
1438 }
1439 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1440 throws RemoteException {
1441 Parcel data = Parcel.obtain();
1442 Parcel reply = Parcel.obtain();
1443 data.writeInterfaceToken(IActivityManager.descriptor);
1444 data.writeStrongBinder(token);
1445 data.writeInt(resultCode);
1446 if (resultData != null) {
1447 data.writeInt(1);
1448 resultData.writeToParcel(data, 0);
1449 } else {
1450 data.writeInt(0);
1451 }
1452 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1453 reply.readException();
1454 boolean res = reply.readInt() != 0;
1455 data.recycle();
1456 reply.recycle();
1457 return res;
1458 }
1459 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1460 {
1461 Parcel data = Parcel.obtain();
1462 Parcel reply = Parcel.obtain();
1463 data.writeInterfaceToken(IActivityManager.descriptor);
1464 data.writeStrongBinder(token);
1465 data.writeString(resultWho);
1466 data.writeInt(requestCode);
1467 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1468 reply.readException();
1469 data.recycle();
1470 reply.recycle();
1471 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001472 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1473 Parcel data = Parcel.obtain();
1474 Parcel reply = Parcel.obtain();
1475 data.writeInterfaceToken(IActivityManager.descriptor);
1476 data.writeStrongBinder(token);
1477 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1478 reply.readException();
1479 boolean res = reply.readInt() != 0;
1480 data.recycle();
1481 reply.recycle();
1482 return res;
1483 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001484 public Intent registerReceiver(IApplicationThread caller,
1485 IIntentReceiver receiver,
1486 IntentFilter filter, String perm) throws RemoteException
1487 {
1488 Parcel data = Parcel.obtain();
1489 Parcel reply = Parcel.obtain();
1490 data.writeInterfaceToken(IActivityManager.descriptor);
1491 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1492 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1493 filter.writeToParcel(data, 0);
1494 data.writeString(perm);
1495 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1496 reply.readException();
1497 Intent intent = null;
1498 int haveIntent = reply.readInt();
1499 if (haveIntent != 0) {
1500 intent = Intent.CREATOR.createFromParcel(reply);
1501 }
1502 reply.recycle();
1503 data.recycle();
1504 return intent;
1505 }
1506 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1507 {
1508 Parcel data = Parcel.obtain();
1509 Parcel reply = Parcel.obtain();
1510 data.writeInterfaceToken(IActivityManager.descriptor);
1511 data.writeStrongBinder(receiver.asBinder());
1512 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1513 reply.readException();
1514 data.recycle();
1515 reply.recycle();
1516 }
1517 public int broadcastIntent(IApplicationThread caller,
1518 Intent intent, String resolvedType, IIntentReceiver resultTo,
1519 int resultCode, String resultData, Bundle map,
1520 String requiredPermission, boolean serialized,
1521 boolean sticky) throws RemoteException
1522 {
1523 Parcel data = Parcel.obtain();
1524 Parcel reply = Parcel.obtain();
1525 data.writeInterfaceToken(IActivityManager.descriptor);
1526 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1527 intent.writeToParcel(data, 0);
1528 data.writeString(resolvedType);
1529 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1530 data.writeInt(resultCode);
1531 data.writeString(resultData);
1532 data.writeBundle(map);
1533 data.writeString(requiredPermission);
1534 data.writeInt(serialized ? 1 : 0);
1535 data.writeInt(sticky ? 1 : 0);
1536 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1537 reply.readException();
1538 int res = reply.readInt();
1539 reply.recycle();
1540 data.recycle();
1541 return res;
1542 }
1543 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1544 {
1545 Parcel data = Parcel.obtain();
1546 Parcel reply = Parcel.obtain();
1547 data.writeInterfaceToken(IActivityManager.descriptor);
1548 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1549 intent.writeToParcel(data, 0);
1550 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1551 reply.readException();
1552 data.recycle();
1553 reply.recycle();
1554 }
1555 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1556 {
1557 Parcel data = Parcel.obtain();
1558 Parcel reply = Parcel.obtain();
1559 data.writeInterfaceToken(IActivityManager.descriptor);
1560 data.writeStrongBinder(who);
1561 data.writeInt(resultCode);
1562 data.writeString(resultData);
1563 data.writeBundle(map);
1564 data.writeInt(abortBroadcast ? 1 : 0);
1565 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1566 reply.readException();
1567 data.recycle();
1568 reply.recycle();
1569 }
1570 public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException
1571 {
1572 Parcel data = Parcel.obtain();
1573 Parcel reply = Parcel.obtain();
1574 data.writeInterfaceToken(IActivityManager.descriptor);
1575 data.writeStrongBinder(token);
1576 data.writeInt(isPersistent ? 1 : 0);
1577 mRemote.transact(SET_PERSISTENT_TRANSACTION, data, reply, 0);
1578 reply.readException();
1579 data.recycle();
1580 reply.recycle();
1581 }
1582 public void attachApplication(IApplicationThread app) throws RemoteException
1583 {
1584 Parcel data = Parcel.obtain();
1585 Parcel reply = Parcel.obtain();
1586 data.writeInterfaceToken(IActivityManager.descriptor);
1587 data.writeStrongBinder(app.asBinder());
1588 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1589 reply.readException();
1590 data.recycle();
1591 reply.recycle();
1592 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001593 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001594 {
1595 Parcel data = Parcel.obtain();
1596 Parcel reply = Parcel.obtain();
1597 data.writeInterfaceToken(IActivityManager.descriptor);
1598 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001599 if (config != null) {
1600 data.writeInt(1);
1601 config.writeToParcel(data, 0);
1602 } else {
1603 data.writeInt(0);
1604 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001605 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1606 reply.readException();
1607 data.recycle();
1608 reply.recycle();
1609 }
1610 public void activityPaused(IBinder token, Bundle state) throws RemoteException
1611 {
1612 Parcel data = Parcel.obtain();
1613 Parcel reply = Parcel.obtain();
1614 data.writeInterfaceToken(IActivityManager.descriptor);
1615 data.writeStrongBinder(token);
1616 data.writeBundle(state);
1617 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1618 reply.readException();
1619 data.recycle();
1620 reply.recycle();
1621 }
1622 public void activityStopped(IBinder token,
1623 Bitmap thumbnail, CharSequence description) throws RemoteException
1624 {
1625 Parcel data = Parcel.obtain();
1626 Parcel reply = Parcel.obtain();
1627 data.writeInterfaceToken(IActivityManager.descriptor);
1628 data.writeStrongBinder(token);
1629 if (thumbnail != null) {
1630 data.writeInt(1);
1631 thumbnail.writeToParcel(data, 0);
1632 } else {
1633 data.writeInt(0);
1634 }
1635 TextUtils.writeToParcel(description, data, 0);
1636 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1637 reply.readException();
1638 data.recycle();
1639 reply.recycle();
1640 }
1641 public void activityDestroyed(IBinder token) throws RemoteException
1642 {
1643 Parcel data = Parcel.obtain();
1644 Parcel reply = Parcel.obtain();
1645 data.writeInterfaceToken(IActivityManager.descriptor);
1646 data.writeStrongBinder(token);
1647 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1648 reply.readException();
1649 data.recycle();
1650 reply.recycle();
1651 }
1652 public String getCallingPackage(IBinder token) throws RemoteException
1653 {
1654 Parcel data = Parcel.obtain();
1655 Parcel reply = Parcel.obtain();
1656 data.writeInterfaceToken(IActivityManager.descriptor);
1657 data.writeStrongBinder(token);
1658 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1659 reply.readException();
1660 String res = reply.readString();
1661 data.recycle();
1662 reply.recycle();
1663 return res;
1664 }
1665 public ComponentName getCallingActivity(IBinder token)
1666 throws RemoteException {
1667 Parcel data = Parcel.obtain();
1668 Parcel reply = Parcel.obtain();
1669 data.writeInterfaceToken(IActivityManager.descriptor);
1670 data.writeStrongBinder(token);
1671 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1672 reply.readException();
1673 ComponentName res = ComponentName.readFromParcel(reply);
1674 data.recycle();
1675 reply.recycle();
1676 return res;
1677 }
1678 public List getTasks(int maxNum, int flags,
1679 IThumbnailReceiver receiver) 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 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1686 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1687 reply.readException();
1688 ArrayList list = null;
1689 int N = reply.readInt();
1690 if (N >= 0) {
1691 list = new ArrayList();
1692 while (N > 0) {
1693 ActivityManager.RunningTaskInfo info =
1694 ActivityManager.RunningTaskInfo.CREATOR
1695 .createFromParcel(reply);
1696 list.add(info);
1697 N--;
1698 }
1699 }
1700 data.recycle();
1701 reply.recycle();
1702 return list;
1703 }
1704 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1705 int flags) throws RemoteException {
1706 Parcel data = Parcel.obtain();
1707 Parcel reply = Parcel.obtain();
1708 data.writeInterfaceToken(IActivityManager.descriptor);
1709 data.writeInt(maxNum);
1710 data.writeInt(flags);
1711 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1712 reply.readException();
1713 ArrayList<ActivityManager.RecentTaskInfo> list
1714 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1715 data.recycle();
1716 reply.recycle();
1717 return list;
1718 }
1719 public List getServices(int maxNum, int flags) throws RemoteException {
1720 Parcel data = Parcel.obtain();
1721 Parcel reply = Parcel.obtain();
1722 data.writeInterfaceToken(IActivityManager.descriptor);
1723 data.writeInt(maxNum);
1724 data.writeInt(flags);
1725 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1726 reply.readException();
1727 ArrayList list = null;
1728 int N = reply.readInt();
1729 if (N >= 0) {
1730 list = new ArrayList();
1731 while (N > 0) {
1732 ActivityManager.RunningServiceInfo info =
1733 ActivityManager.RunningServiceInfo.CREATOR
1734 .createFromParcel(reply);
1735 list.add(info);
1736 N--;
1737 }
1738 }
1739 data.recycle();
1740 reply.recycle();
1741 return list;
1742 }
1743 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1744 throws RemoteException {
1745 Parcel data = Parcel.obtain();
1746 Parcel reply = Parcel.obtain();
1747 data.writeInterfaceToken(IActivityManager.descriptor);
1748 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1749 reply.readException();
1750 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1751 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1752 data.recycle();
1753 reply.recycle();
1754 return list;
1755 }
1756 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1757 throws RemoteException {
1758 Parcel data = Parcel.obtain();
1759 Parcel reply = Parcel.obtain();
1760 data.writeInterfaceToken(IActivityManager.descriptor);
1761 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1762 reply.readException();
1763 ArrayList<ActivityManager.RunningAppProcessInfo> list
1764 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1765 data.recycle();
1766 reply.recycle();
1767 return list;
1768 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07001769 public List<ApplicationInfo> getRunningExternalApplications()
1770 throws RemoteException {
1771 Parcel data = Parcel.obtain();
1772 Parcel reply = Parcel.obtain();
1773 data.writeInterfaceToken(IActivityManager.descriptor);
1774 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
1775 reply.readException();
1776 ArrayList<ApplicationInfo> list
1777 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
1778 data.recycle();
1779 reply.recycle();
1780 return list;
1781 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001782 public void moveTaskToFront(int task) throws RemoteException
1783 {
1784 Parcel data = Parcel.obtain();
1785 Parcel reply = Parcel.obtain();
1786 data.writeInterfaceToken(IActivityManager.descriptor);
1787 data.writeInt(task);
1788 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1789 reply.readException();
1790 data.recycle();
1791 reply.recycle();
1792 }
1793 public void moveTaskToBack(int task) throws RemoteException
1794 {
1795 Parcel data = Parcel.obtain();
1796 Parcel reply = Parcel.obtain();
1797 data.writeInterfaceToken(IActivityManager.descriptor);
1798 data.writeInt(task);
1799 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1800 reply.readException();
1801 data.recycle();
1802 reply.recycle();
1803 }
1804 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1805 throws RemoteException {
1806 Parcel data = Parcel.obtain();
1807 Parcel reply = Parcel.obtain();
1808 data.writeInterfaceToken(IActivityManager.descriptor);
1809 data.writeStrongBinder(token);
1810 data.writeInt(nonRoot ? 1 : 0);
1811 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1812 reply.readException();
1813 boolean res = reply.readInt() != 0;
1814 data.recycle();
1815 reply.recycle();
1816 return res;
1817 }
1818 public void moveTaskBackwards(int task) throws RemoteException
1819 {
1820 Parcel data = Parcel.obtain();
1821 Parcel reply = Parcel.obtain();
1822 data.writeInterfaceToken(IActivityManager.descriptor);
1823 data.writeInt(task);
1824 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1825 reply.readException();
1826 data.recycle();
1827 reply.recycle();
1828 }
1829 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
1830 {
1831 Parcel data = Parcel.obtain();
1832 Parcel reply = Parcel.obtain();
1833 data.writeInterfaceToken(IActivityManager.descriptor);
1834 data.writeStrongBinder(token);
1835 data.writeInt(onlyRoot ? 1 : 0);
1836 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
1837 reply.readException();
1838 int res = reply.readInt();
1839 data.recycle();
1840 reply.recycle();
1841 return res;
1842 }
1843 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
1844 {
1845 Parcel data = Parcel.obtain();
1846 Parcel reply = Parcel.obtain();
1847 data.writeInterfaceToken(IActivityManager.descriptor);
1848 data.writeStrongBinder(token);
1849 ComponentName.writeToParcel(className, data);
1850 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
1851 reply.readException();
1852 data.recycle();
1853 reply.recycle();
1854 }
1855 public void reportThumbnail(IBinder token,
1856 Bitmap thumbnail, CharSequence description) throws RemoteException
1857 {
1858 Parcel data = Parcel.obtain();
1859 Parcel reply = Parcel.obtain();
1860 data.writeInterfaceToken(IActivityManager.descriptor);
1861 data.writeStrongBinder(token);
1862 if (thumbnail != null) {
1863 data.writeInt(1);
1864 thumbnail.writeToParcel(data, 0);
1865 } else {
1866 data.writeInt(0);
1867 }
1868 TextUtils.writeToParcel(description, data, 0);
1869 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1870 reply.readException();
1871 data.recycle();
1872 reply.recycle();
1873 }
1874 public ContentProviderHolder getContentProvider(IApplicationThread caller,
1875 String name) throws RemoteException
1876 {
1877 Parcel data = Parcel.obtain();
1878 Parcel reply = Parcel.obtain();
1879 data.writeInterfaceToken(IActivityManager.descriptor);
1880 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1881 data.writeString(name);
1882 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1883 reply.readException();
1884 int res = reply.readInt();
1885 ContentProviderHolder cph = null;
1886 if (res != 0) {
1887 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
1888 }
1889 data.recycle();
1890 reply.recycle();
1891 return cph;
1892 }
1893 public void publishContentProviders(IApplicationThread caller,
1894 List<ContentProviderHolder> providers) throws RemoteException
1895 {
1896 Parcel data = Parcel.obtain();
1897 Parcel reply = Parcel.obtain();
1898 data.writeInterfaceToken(IActivityManager.descriptor);
1899 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1900 data.writeTypedList(providers);
1901 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
1902 reply.readException();
1903 data.recycle();
1904 reply.recycle();
1905 }
1906
1907 public void removeContentProvider(IApplicationThread caller,
1908 String name) throws RemoteException {
1909 Parcel data = Parcel.obtain();
1910 Parcel reply = Parcel.obtain();
1911 data.writeInterfaceToken(IActivityManager.descriptor);
1912 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1913 data.writeString(name);
1914 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1915 reply.readException();
1916 data.recycle();
1917 reply.recycle();
1918 }
1919
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001920 public PendingIntent getRunningServiceControlPanel(ComponentName service)
1921 throws RemoteException
1922 {
1923 Parcel data = Parcel.obtain();
1924 Parcel reply = Parcel.obtain();
1925 data.writeInterfaceToken(IActivityManager.descriptor);
1926 service.writeToParcel(data, 0);
1927 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
1928 reply.readException();
1929 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
1930 data.recycle();
1931 reply.recycle();
1932 return res;
1933 }
1934
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001935 public ComponentName startService(IApplicationThread caller, Intent service,
1936 String resolvedType) throws RemoteException
1937 {
1938 Parcel data = Parcel.obtain();
1939 Parcel reply = Parcel.obtain();
1940 data.writeInterfaceToken(IActivityManager.descriptor);
1941 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1942 service.writeToParcel(data, 0);
1943 data.writeString(resolvedType);
1944 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
1945 reply.readException();
1946 ComponentName res = ComponentName.readFromParcel(reply);
1947 data.recycle();
1948 reply.recycle();
1949 return res;
1950 }
1951 public int stopService(IApplicationThread caller, Intent service,
1952 String resolvedType) throws RemoteException
1953 {
1954 Parcel data = Parcel.obtain();
1955 Parcel reply = Parcel.obtain();
1956 data.writeInterfaceToken(IActivityManager.descriptor);
1957 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1958 service.writeToParcel(data, 0);
1959 data.writeString(resolvedType);
1960 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
1961 reply.readException();
1962 int res = reply.readInt();
1963 reply.recycle();
1964 data.recycle();
1965 return res;
1966 }
1967 public boolean stopServiceToken(ComponentName className, IBinder token,
1968 int startId) throws RemoteException {
1969 Parcel data = Parcel.obtain();
1970 Parcel reply = Parcel.obtain();
1971 data.writeInterfaceToken(IActivityManager.descriptor);
1972 ComponentName.writeToParcel(className, data);
1973 data.writeStrongBinder(token);
1974 data.writeInt(startId);
1975 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
1976 reply.readException();
1977 boolean res = reply.readInt() != 0;
1978 data.recycle();
1979 reply.recycle();
1980 return res;
1981 }
1982 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001983 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001984 Parcel data = Parcel.obtain();
1985 Parcel reply = Parcel.obtain();
1986 data.writeInterfaceToken(IActivityManager.descriptor);
1987 ComponentName.writeToParcel(className, data);
1988 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001989 data.writeInt(id);
1990 if (notification != null) {
1991 data.writeInt(1);
1992 notification.writeToParcel(data, 0);
1993 } else {
1994 data.writeInt(0);
1995 }
1996 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001997 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
1998 reply.readException();
1999 data.recycle();
2000 reply.recycle();
2001 }
2002 public int bindService(IApplicationThread caller, IBinder token,
2003 Intent service, String resolvedType, IServiceConnection connection,
2004 int flags) throws RemoteException {
2005 Parcel data = Parcel.obtain();
2006 Parcel reply = Parcel.obtain();
2007 data.writeInterfaceToken(IActivityManager.descriptor);
2008 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2009 data.writeStrongBinder(token);
2010 service.writeToParcel(data, 0);
2011 data.writeString(resolvedType);
2012 data.writeStrongBinder(connection.asBinder());
2013 data.writeInt(flags);
2014 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2015 reply.readException();
2016 int res = reply.readInt();
2017 data.recycle();
2018 reply.recycle();
2019 return res;
2020 }
2021 public boolean unbindService(IServiceConnection connection) throws RemoteException
2022 {
2023 Parcel data = Parcel.obtain();
2024 Parcel reply = Parcel.obtain();
2025 data.writeInterfaceToken(IActivityManager.descriptor);
2026 data.writeStrongBinder(connection.asBinder());
2027 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2028 reply.readException();
2029 boolean res = reply.readInt() != 0;
2030 data.recycle();
2031 reply.recycle();
2032 return res;
2033 }
2034
2035 public void publishService(IBinder token,
2036 Intent intent, IBinder service) throws RemoteException {
2037 Parcel data = Parcel.obtain();
2038 Parcel reply = Parcel.obtain();
2039 data.writeInterfaceToken(IActivityManager.descriptor);
2040 data.writeStrongBinder(token);
2041 intent.writeToParcel(data, 0);
2042 data.writeStrongBinder(service);
2043 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2044 reply.readException();
2045 data.recycle();
2046 reply.recycle();
2047 }
2048
2049 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2050 throws RemoteException {
2051 Parcel data = Parcel.obtain();
2052 Parcel reply = Parcel.obtain();
2053 data.writeInterfaceToken(IActivityManager.descriptor);
2054 data.writeStrongBinder(token);
2055 intent.writeToParcel(data, 0);
2056 data.writeInt(doRebind ? 1 : 0);
2057 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2058 reply.readException();
2059 data.recycle();
2060 reply.recycle();
2061 }
2062
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002063 public void serviceDoneExecuting(IBinder token, int type, int startId,
2064 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 Parcel data = Parcel.obtain();
2066 Parcel reply = Parcel.obtain();
2067 data.writeInterfaceToken(IActivityManager.descriptor);
2068 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002069 data.writeInt(type);
2070 data.writeInt(startId);
2071 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002072 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2073 reply.readException();
2074 data.recycle();
2075 reply.recycle();
2076 }
2077
2078 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2079 Parcel data = Parcel.obtain();
2080 Parcel reply = Parcel.obtain();
2081 data.writeInterfaceToken(IActivityManager.descriptor);
2082 service.writeToParcel(data, 0);
2083 data.writeString(resolvedType);
2084 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2085 reply.readException();
2086 IBinder binder = reply.readStrongBinder();
2087 reply.recycle();
2088 data.recycle();
2089 return binder;
2090 }
2091
Christopher Tate181fafa2009-05-14 11:12:14 -07002092 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2093 throws RemoteException {
2094 Parcel data = Parcel.obtain();
2095 Parcel reply = Parcel.obtain();
2096 data.writeInterfaceToken(IActivityManager.descriptor);
2097 app.writeToParcel(data, 0);
2098 data.writeInt(backupRestoreMode);
2099 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2100 reply.readException();
2101 boolean success = reply.readInt() != 0;
2102 reply.recycle();
2103 data.recycle();
2104 return success;
2105 }
2106
2107 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2108 Parcel data = Parcel.obtain();
2109 Parcel reply = Parcel.obtain();
2110 data.writeInterfaceToken(IActivityManager.descriptor);
2111 data.writeString(packageName);
2112 data.writeStrongBinder(agent);
2113 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2114 reply.recycle();
2115 data.recycle();
2116 }
2117
2118 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2119 Parcel data = Parcel.obtain();
2120 Parcel reply = Parcel.obtain();
2121 data.writeInterfaceToken(IActivityManager.descriptor);
2122 app.writeToParcel(data, 0);
2123 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2124 reply.readException();
2125 reply.recycle();
2126 data.recycle();
2127 }
2128
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002129 public boolean startInstrumentation(ComponentName className, String profileFile,
2130 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2131 throws RemoteException {
2132 Parcel data = Parcel.obtain();
2133 Parcel reply = Parcel.obtain();
2134 data.writeInterfaceToken(IActivityManager.descriptor);
2135 ComponentName.writeToParcel(className, data);
2136 data.writeString(profileFile);
2137 data.writeInt(flags);
2138 data.writeBundle(arguments);
2139 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2140 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2141 reply.readException();
2142 boolean res = reply.readInt() != 0;
2143 reply.recycle();
2144 data.recycle();
2145 return res;
2146 }
2147
2148 public void finishInstrumentation(IApplicationThread target,
2149 int resultCode, Bundle results) throws RemoteException {
2150 Parcel data = Parcel.obtain();
2151 Parcel reply = Parcel.obtain();
2152 data.writeInterfaceToken(IActivityManager.descriptor);
2153 data.writeStrongBinder(target != null ? target.asBinder() : null);
2154 data.writeInt(resultCode);
2155 data.writeBundle(results);
2156 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2157 reply.readException();
2158 data.recycle();
2159 reply.recycle();
2160 }
2161 public Configuration getConfiguration() throws RemoteException
2162 {
2163 Parcel data = Parcel.obtain();
2164 Parcel reply = Parcel.obtain();
2165 data.writeInterfaceToken(IActivityManager.descriptor);
2166 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2167 reply.readException();
2168 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2169 reply.recycle();
2170 data.recycle();
2171 return res;
2172 }
2173 public void updateConfiguration(Configuration values) throws RemoteException
2174 {
2175 Parcel data = Parcel.obtain();
2176 Parcel reply = Parcel.obtain();
2177 data.writeInterfaceToken(IActivityManager.descriptor);
2178 values.writeToParcel(data, 0);
2179 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2180 reply.readException();
2181 data.recycle();
2182 reply.recycle();
2183 }
2184 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2185 throws RemoteException {
2186 Parcel data = Parcel.obtain();
2187 Parcel reply = Parcel.obtain();
2188 data.writeInterfaceToken(IActivityManager.descriptor);
2189 data.writeStrongBinder(token);
2190 data.writeInt(requestedOrientation);
2191 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2192 reply.readException();
2193 data.recycle();
2194 reply.recycle();
2195 }
2196 public int getRequestedOrientation(IBinder token) throws RemoteException {
2197 Parcel data = Parcel.obtain();
2198 Parcel reply = Parcel.obtain();
2199 data.writeInterfaceToken(IActivityManager.descriptor);
2200 data.writeStrongBinder(token);
2201 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2202 reply.readException();
2203 int res = reply.readInt();
2204 data.recycle();
2205 reply.recycle();
2206 return res;
2207 }
2208 public ComponentName getActivityClassForToken(IBinder token)
2209 throws RemoteException {
2210 Parcel data = Parcel.obtain();
2211 Parcel reply = Parcel.obtain();
2212 data.writeInterfaceToken(IActivityManager.descriptor);
2213 data.writeStrongBinder(token);
2214 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 ComponentName res = ComponentName.readFromParcel(reply);
2217 data.recycle();
2218 reply.recycle();
2219 return res;
2220 }
2221 public String getPackageForToken(IBinder token) throws RemoteException
2222 {
2223 Parcel data = Parcel.obtain();
2224 Parcel reply = Parcel.obtain();
2225 data.writeInterfaceToken(IActivityManager.descriptor);
2226 data.writeStrongBinder(token);
2227 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2228 reply.readException();
2229 String res = reply.readString();
2230 data.recycle();
2231 reply.recycle();
2232 return res;
2233 }
2234 public IIntentSender getIntentSender(int type,
2235 String packageName, IBinder token, String resultWho,
2236 int requestCode, Intent intent, String resolvedType, int flags)
2237 throws RemoteException {
2238 Parcel data = Parcel.obtain();
2239 Parcel reply = Parcel.obtain();
2240 data.writeInterfaceToken(IActivityManager.descriptor);
2241 data.writeInt(type);
2242 data.writeString(packageName);
2243 data.writeStrongBinder(token);
2244 data.writeString(resultWho);
2245 data.writeInt(requestCode);
2246 if (intent != null) {
2247 data.writeInt(1);
2248 intent.writeToParcel(data, 0);
2249 } else {
2250 data.writeInt(0);
2251 }
2252 data.writeString(resolvedType);
2253 data.writeInt(flags);
2254 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2255 reply.readException();
2256 IIntentSender res = IIntentSender.Stub.asInterface(
2257 reply.readStrongBinder());
2258 data.recycle();
2259 reply.recycle();
2260 return res;
2261 }
2262 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2263 Parcel data = Parcel.obtain();
2264 Parcel reply = Parcel.obtain();
2265 data.writeInterfaceToken(IActivityManager.descriptor);
2266 data.writeStrongBinder(sender.asBinder());
2267 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2268 reply.readException();
2269 data.recycle();
2270 reply.recycle();
2271 }
2272 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2273 Parcel data = Parcel.obtain();
2274 Parcel reply = Parcel.obtain();
2275 data.writeInterfaceToken(IActivityManager.descriptor);
2276 data.writeStrongBinder(sender.asBinder());
2277 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2278 reply.readException();
2279 String res = reply.readString();
2280 data.recycle();
2281 reply.recycle();
2282 return res;
2283 }
2284 public void setProcessLimit(int max) throws RemoteException
2285 {
2286 Parcel data = Parcel.obtain();
2287 Parcel reply = Parcel.obtain();
2288 data.writeInterfaceToken(IActivityManager.descriptor);
2289 data.writeInt(max);
2290 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2291 reply.readException();
2292 data.recycle();
2293 reply.recycle();
2294 }
2295 public int getProcessLimit() throws RemoteException
2296 {
2297 Parcel data = Parcel.obtain();
2298 Parcel reply = Parcel.obtain();
2299 data.writeInterfaceToken(IActivityManager.descriptor);
2300 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2301 reply.readException();
2302 int res = reply.readInt();
2303 data.recycle();
2304 reply.recycle();
2305 return res;
2306 }
2307 public void setProcessForeground(IBinder token, int pid,
2308 boolean isForeground) throws RemoteException {
2309 Parcel data = Parcel.obtain();
2310 Parcel reply = Parcel.obtain();
2311 data.writeInterfaceToken(IActivityManager.descriptor);
2312 data.writeStrongBinder(token);
2313 data.writeInt(pid);
2314 data.writeInt(isForeground ? 1 : 0);
2315 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2316 reply.readException();
2317 data.recycle();
2318 reply.recycle();
2319 }
2320 public int checkPermission(String permission, int pid, int uid)
2321 throws RemoteException {
2322 Parcel data = Parcel.obtain();
2323 Parcel reply = Parcel.obtain();
2324 data.writeInterfaceToken(IActivityManager.descriptor);
2325 data.writeString(permission);
2326 data.writeInt(pid);
2327 data.writeInt(uid);
2328 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2329 reply.readException();
2330 int res = reply.readInt();
2331 data.recycle();
2332 reply.recycle();
2333 return res;
2334 }
2335 public boolean clearApplicationUserData(final String packageName,
2336 final IPackageDataObserver observer) throws RemoteException {
2337 Parcel data = Parcel.obtain();
2338 Parcel reply = Parcel.obtain();
2339 data.writeInterfaceToken(IActivityManager.descriptor);
2340 data.writeString(packageName);
2341 data.writeStrongBinder(observer.asBinder());
2342 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2343 reply.readException();
2344 boolean res = reply.readInt() != 0;
2345 data.recycle();
2346 reply.recycle();
2347 return res;
2348 }
2349 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2350 throws RemoteException {
2351 Parcel data = Parcel.obtain();
2352 Parcel reply = Parcel.obtain();
2353 data.writeInterfaceToken(IActivityManager.descriptor);
2354 uri.writeToParcel(data, 0);
2355 data.writeInt(pid);
2356 data.writeInt(uid);
2357 data.writeInt(mode);
2358 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2359 reply.readException();
2360 int res = reply.readInt();
2361 data.recycle();
2362 reply.recycle();
2363 return res;
2364 }
2365 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2366 Uri uri, int mode) throws RemoteException {
2367 Parcel data = Parcel.obtain();
2368 Parcel reply = Parcel.obtain();
2369 data.writeInterfaceToken(IActivityManager.descriptor);
2370 data.writeStrongBinder(caller.asBinder());
2371 data.writeString(targetPkg);
2372 uri.writeToParcel(data, 0);
2373 data.writeInt(mode);
2374 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2375 reply.readException();
2376 data.recycle();
2377 reply.recycle();
2378 }
2379 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2380 int mode) throws RemoteException {
2381 Parcel data = Parcel.obtain();
2382 Parcel reply = Parcel.obtain();
2383 data.writeInterfaceToken(IActivityManager.descriptor);
2384 data.writeStrongBinder(caller.asBinder());
2385 uri.writeToParcel(data, 0);
2386 data.writeInt(mode);
2387 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2388 reply.readException();
2389 data.recycle();
2390 reply.recycle();
2391 }
2392 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2393 throws RemoteException {
2394 Parcel data = Parcel.obtain();
2395 Parcel reply = Parcel.obtain();
2396 data.writeInterfaceToken(IActivityManager.descriptor);
2397 data.writeStrongBinder(who.asBinder());
2398 data.writeInt(waiting ? 1 : 0);
2399 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2400 reply.readException();
2401 data.recycle();
2402 reply.recycle();
2403 }
2404 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2405 Parcel data = Parcel.obtain();
2406 Parcel reply = Parcel.obtain();
2407 data.writeInterfaceToken(IActivityManager.descriptor);
2408 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2409 reply.readException();
2410 outInfo.readFromParcel(reply);
2411 data.recycle();
2412 reply.recycle();
2413 }
2414 public void unhandledBack() throws RemoteException
2415 {
2416 Parcel data = Parcel.obtain();
2417 Parcel reply = Parcel.obtain();
2418 data.writeInterfaceToken(IActivityManager.descriptor);
2419 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2420 reply.readException();
2421 data.recycle();
2422 reply.recycle();
2423 }
2424 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2425 {
2426 Parcel data = Parcel.obtain();
2427 Parcel reply = Parcel.obtain();
2428 data.writeInterfaceToken(IActivityManager.descriptor);
2429 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2430 reply.readException();
2431 ParcelFileDescriptor pfd = null;
2432 if (reply.readInt() != 0) {
2433 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2434 }
2435 data.recycle();
2436 reply.recycle();
2437 return pfd;
2438 }
2439 public void goingToSleep() throws RemoteException
2440 {
2441 Parcel data = Parcel.obtain();
2442 Parcel reply = Parcel.obtain();
2443 data.writeInterfaceToken(IActivityManager.descriptor);
2444 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2445 reply.readException();
2446 data.recycle();
2447 reply.recycle();
2448 }
2449 public void wakingUp() throws RemoteException
2450 {
2451 Parcel data = Parcel.obtain();
2452 Parcel reply = Parcel.obtain();
2453 data.writeInterfaceToken(IActivityManager.descriptor);
2454 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2455 reply.readException();
2456 data.recycle();
2457 reply.recycle();
2458 }
2459 public void setDebugApp(
2460 String packageName, boolean waitForDebugger, boolean persistent)
2461 throws RemoteException
2462 {
2463 Parcel data = Parcel.obtain();
2464 Parcel reply = Parcel.obtain();
2465 data.writeInterfaceToken(IActivityManager.descriptor);
2466 data.writeString(packageName);
2467 data.writeInt(waitForDebugger ? 1 : 0);
2468 data.writeInt(persistent ? 1 : 0);
2469 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2470 reply.readException();
2471 data.recycle();
2472 reply.recycle();
2473 }
2474 public void setAlwaysFinish(boolean enabled) throws RemoteException
2475 {
2476 Parcel data = Parcel.obtain();
2477 Parcel reply = Parcel.obtain();
2478 data.writeInterfaceToken(IActivityManager.descriptor);
2479 data.writeInt(enabled ? 1 : 0);
2480 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2481 reply.readException();
2482 data.recycle();
2483 reply.recycle();
2484 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002485 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002486 {
2487 Parcel data = Parcel.obtain();
2488 Parcel reply = Parcel.obtain();
2489 data.writeInterfaceToken(IActivityManager.descriptor);
2490 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002491 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002492 reply.readException();
2493 data.recycle();
2494 reply.recycle();
2495 }
2496 public void enterSafeMode() throws RemoteException {
2497 Parcel data = Parcel.obtain();
2498 data.writeInterfaceToken(IActivityManager.descriptor);
2499 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2500 data.recycle();
2501 }
2502 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2503 Parcel data = Parcel.obtain();
2504 data.writeStrongBinder(sender.asBinder());
2505 data.writeInterfaceToken(IActivityManager.descriptor);
2506 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2507 data.recycle();
2508 }
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002509 public boolean killPids(int[] pids, String reason) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002510 Parcel data = Parcel.obtain();
2511 Parcel reply = Parcel.obtain();
2512 data.writeInterfaceToken(IActivityManager.descriptor);
2513 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002514 data.writeString(reason);
2515 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002516 boolean res = reply.readInt() != 0;
2517 data.recycle();
2518 reply.recycle();
2519 return res;
2520 }
2521 public void reportPss(IApplicationThread caller, int pss) throws RemoteException {
2522 Parcel data = Parcel.obtain();
2523 data.writeInterfaceToken(IActivityManager.descriptor);
2524 data.writeStrongBinder(caller.asBinder());
2525 data.writeInt(pss);
2526 mRemote.transact(REPORT_PSS_TRANSACTION, data, null, 0);
2527 data.recycle();
2528 }
2529 public void startRunning(String pkg, String cls, String action,
2530 String indata) throws RemoteException {
2531 Parcel data = Parcel.obtain();
2532 Parcel reply = Parcel.obtain();
2533 data.writeInterfaceToken(IActivityManager.descriptor);
2534 data.writeString(pkg);
2535 data.writeString(cls);
2536 data.writeString(action);
2537 data.writeString(indata);
2538 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 data.recycle();
2541 reply.recycle();
2542 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002543 public boolean testIsSystemReady()
2544 {
2545 /* this base class version is never called */
2546 return true;
2547 }
Dan Egnor60d87622009-12-16 16:32:58 -08002548 public void handleApplicationCrash(IBinder app,
2549 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2550 {
2551 Parcel data = Parcel.obtain();
2552 Parcel reply = Parcel.obtain();
2553 data.writeInterfaceToken(IActivityManager.descriptor);
2554 data.writeStrongBinder(app);
2555 crashInfo.writeToParcel(data, 0);
2556 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2557 reply.readException();
2558 reply.recycle();
2559 data.recycle();
2560 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002561
Dan Egnor60d87622009-12-16 16:32:58 -08002562 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002563 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002564 {
2565 Parcel data = Parcel.obtain();
2566 Parcel reply = Parcel.obtain();
2567 data.writeInterfaceToken(IActivityManager.descriptor);
2568 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002569 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002570 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002571 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002572 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002573 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002574 reply.recycle();
2575 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002576 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002578
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002579 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002580 int violationMask,
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002581 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2582 {
2583 Parcel data = Parcel.obtain();
2584 Parcel reply = Parcel.obtain();
2585 data.writeInterfaceToken(IActivityManager.descriptor);
2586 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002587 data.writeInt(violationMask);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002588 crashInfo.writeToParcel(data, 0);
2589 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2590 reply.readException();
2591 reply.recycle();
2592 data.recycle();
2593 }
2594
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002595 public void signalPersistentProcesses(int sig) throws RemoteException {
2596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeInt(sig);
2600 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2601 reply.readException();
2602 data.recycle();
2603 reply.recycle();
2604 }
2605
Dianne Hackborn03abb812010-01-04 18:43:19 -08002606 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002607 Parcel data = Parcel.obtain();
2608 Parcel reply = Parcel.obtain();
2609 data.writeInterfaceToken(IActivityManager.descriptor);
2610 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002611 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2612 reply.readException();
2613 data.recycle();
2614 reply.recycle();
2615 }
2616
2617 public void forceStopPackage(String packageName) throws RemoteException {
2618 Parcel data = Parcel.obtain();
2619 Parcel reply = Parcel.obtain();
2620 data.writeInterfaceToken(IActivityManager.descriptor);
2621 data.writeString(packageName);
2622 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002623 reply.readException();
2624 data.recycle();
2625 reply.recycle();
2626 }
2627
2628 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2629 {
2630 Parcel data = Parcel.obtain();
2631 Parcel reply = Parcel.obtain();
2632 data.writeInterfaceToken(IActivityManager.descriptor);
2633 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2634 reply.readException();
2635 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2636 reply.recycle();
2637 data.recycle();
2638 return res;
2639 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002640
2641 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002642 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002643 {
2644 Parcel data = Parcel.obtain();
2645 Parcel reply = Parcel.obtain();
2646 data.writeInterfaceToken(IActivityManager.descriptor);
2647 data.writeString(process);
2648 data.writeInt(start ? 1 : 0);
2649 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002650 if (fd != null) {
2651 data.writeInt(1);
2652 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2653 } else {
2654 data.writeInt(0);
2655 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002656 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2657 reply.readException();
2658 boolean res = reply.readInt() != 0;
2659 reply.recycle();
2660 data.recycle();
2661 return res;
2662 }
2663
Dianne Hackborn55280a92009-05-07 15:53:46 -07002664 public boolean shutdown(int timeout) throws RemoteException
2665 {
2666 Parcel data = Parcel.obtain();
2667 Parcel reply = Parcel.obtain();
2668 data.writeInterfaceToken(IActivityManager.descriptor);
2669 data.writeInt(timeout);
2670 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2671 reply.readException();
2672 boolean res = reply.readInt() != 0;
2673 reply.recycle();
2674 data.recycle();
2675 return res;
2676 }
2677
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002678 public void stopAppSwitches() throws RemoteException {
2679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 reply.recycle();
2685 data.recycle();
2686 }
2687
2688 public void resumeAppSwitches() throws RemoteException {
2689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 reply.recycle();
2695 data.recycle();
2696 }
2697
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002698 public void registerActivityWatcher(IActivityWatcher watcher)
2699 throws RemoteException {
2700 Parcel data = Parcel.obtain();
2701 Parcel reply = Parcel.obtain();
2702 data.writeInterfaceToken(IActivityManager.descriptor);
2703 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2704 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2705 reply.readException();
2706 data.recycle();
2707 reply.recycle();
2708 }
2709
2710 public void unregisterActivityWatcher(IActivityWatcher watcher)
2711 throws RemoteException {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2716 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2717 reply.readException();
2718 data.recycle();
2719 reply.recycle();
2720 }
2721
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002722 public int startActivityInPackage(int uid,
2723 Intent intent, String resolvedType, IBinder resultTo,
2724 String resultWho, int requestCode, boolean onlyIfNeeded)
2725 throws RemoteException {
2726 Parcel data = Parcel.obtain();
2727 Parcel reply = Parcel.obtain();
2728 data.writeInterfaceToken(IActivityManager.descriptor);
2729 data.writeInt(uid);
2730 intent.writeToParcel(data, 0);
2731 data.writeString(resolvedType);
2732 data.writeStrongBinder(resultTo);
2733 data.writeString(resultWho);
2734 data.writeInt(requestCode);
2735 data.writeInt(onlyIfNeeded ? 1 : 0);
2736 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2737 reply.readException();
2738 int result = reply.readInt();
2739 reply.recycle();
2740 data.recycle();
2741 return result;
2742 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002743
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002744 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 data.writeString(pkg);
2749 data.writeInt(uid);
2750 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2751 reply.readException();
2752 data.recycle();
2753 reply.recycle();
2754 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002755
2756 public void closeSystemDialogs(String reason) throws RemoteException {
2757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 data.writeString(reason);
2761 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 data.recycle();
2764 reply.recycle();
2765 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002766
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002767 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002768 throws RemoteException {
2769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002772 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002773 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
2774 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002775 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002776 data.recycle();
2777 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002778 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002779 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07002780
2781 public void killApplicationProcess(String processName, int uid) throws RemoteException {
2782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 data.writeString(processName);
2786 data.writeInt(uid);
2787 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 data.recycle();
2790 reply.recycle();
2791 }
2792
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07002793 public void overridePendingTransition(IBinder token, String packageName,
2794 int enterAnim, int exitAnim) throws RemoteException {
2795 Parcel data = Parcel.obtain();
2796 Parcel reply = Parcel.obtain();
2797 data.writeInterfaceToken(IActivityManager.descriptor);
2798 data.writeStrongBinder(token);
2799 data.writeString(packageName);
2800 data.writeInt(enterAnim);
2801 data.writeInt(exitAnim);
2802 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
2803 reply.readException();
2804 data.recycle();
2805 reply.recycle();
2806 }
2807
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08002808 public boolean isUserAMonkey() throws RemoteException {
2809 Parcel data = Parcel.obtain();
2810 Parcel reply = Parcel.obtain();
2811 data.writeInterfaceToken(IActivityManager.descriptor);
2812 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
2813 reply.readException();
2814 boolean res = reply.readInt() != 0;
2815 data.recycle();
2816 reply.recycle();
2817 return res;
2818 }
2819
Dianne Hackborn860755f2010-06-03 18:47:52 -07002820 public void finishHeavyWeightApp() throws RemoteException {
2821 Parcel data = Parcel.obtain();
2822 Parcel reply = Parcel.obtain();
2823 data.writeInterfaceToken(IActivityManager.descriptor);
2824 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
2825 reply.readException();
2826 data.recycle();
2827 reply.recycle();
2828 }
2829
Daniel Sandler69a48172010-06-23 16:29:36 -04002830 public void setImmersive(IBinder token, boolean immersive)
2831 throws RemoteException {
2832 Parcel data = Parcel.obtain();
2833 Parcel reply = Parcel.obtain();
2834 data.writeInterfaceToken(IActivityManager.descriptor);
2835 data.writeStrongBinder(token);
2836 data.writeInt(immersive ? 1 : 0);
2837 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 data.recycle();
2840 reply.recycle();
2841 }
2842
2843 public boolean isImmersive(IBinder token)
2844 throws RemoteException {
2845 Parcel data = Parcel.obtain();
2846 Parcel reply = Parcel.obtain();
2847 data.writeInterfaceToken(IActivityManager.descriptor);
2848 data.writeStrongBinder(token);
2849 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
2850 boolean res = reply.readInt() == 1;
2851 reply.readException();
2852 data.recycle();
2853 reply.recycle();
2854 return res;
2855 }
2856
2857 public boolean isTopActivityImmersive()
2858 throws RemoteException {
2859 Parcel data = Parcel.obtain();
2860 Parcel reply = Parcel.obtain();
2861 data.writeInterfaceToken(IActivityManager.descriptor);
2862 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
2863 boolean res = reply.readInt() == 1;
2864 reply.readException();
2865 data.recycle();
2866 reply.recycle();
2867 return res;
2868 }
2869
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002870 private IBinder mRemote;
2871}