blob: 43a08b5f56d5147f4805b22b9824d83499f7675d [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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 case START_RUNNING_TRANSACTION: {
1025 data.enforceInterface(IActivityManager.descriptor);
1026 String pkg = data.readString();
1027 String cls = data.readString();
1028 String action = data.readString();
1029 String indata = data.readString();
1030 startRunning(pkg, cls, action, indata);
1031 reply.writeNoException();
1032 return true;
1033 }
1034
Dan Egnor60d87622009-12-16 16:32:58 -08001035 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1036 data.enforceInterface(IActivityManager.descriptor);
1037 IBinder app = data.readStrongBinder();
1038 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1039 handleApplicationCrash(app, ci);
1040 reply.writeNoException();
1041 return true;
1042 }
1043
1044 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001045 data.enforceInterface(IActivityManager.descriptor);
1046 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001047 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001048 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001049 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001050 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001051 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001052 return true;
1053 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001054
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001055 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1056 data.enforceInterface(IActivityManager.descriptor);
1057 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001058 int violationMask = data.readInt();
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001059 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001060 handleApplicationStrictModeViolation(app, violationMask, ci);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001061 reply.writeNoException();
1062 return true;
1063 }
1064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001065 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 int sig = data.readInt();
1068 signalPersistentProcesses(sig);
1069 reply.writeNoException();
1070 return true;
1071 }
1072
Dianne Hackborn03abb812010-01-04 18:43:19 -08001073 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1074 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001075 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001076 killBackgroundProcesses(packageName);
1077 reply.writeNoException();
1078 return true;
1079 }
1080
1081 case FORCE_STOP_PACKAGE_TRANSACTION: {
1082 data.enforceInterface(IActivityManager.descriptor);
1083 String packageName = data.readString();
1084 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001085 reply.writeNoException();
1086 return true;
1087 }
1088
1089 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 ConfigurationInfo config = getDeviceConfigurationInfo();
1092 reply.writeNoException();
1093 config.writeToParcel(reply, 0);
1094 return true;
1095 }
1096
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001097 case PROFILE_CONTROL_TRANSACTION: {
1098 data.enforceInterface(IActivityManager.descriptor);
1099 String process = data.readString();
1100 boolean start = data.readInt() != 0;
1101 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001102 ParcelFileDescriptor fd = data.readInt() != 0
1103 ? data.readFileDescriptor() : null;
1104 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001105 reply.writeNoException();
1106 reply.writeInt(res ? 1 : 0);
1107 return true;
1108 }
1109
Dianne Hackborn55280a92009-05-07 15:53:46 -07001110 case SHUTDOWN_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 boolean res = shutdown(data.readInt());
1113 reply.writeNoException();
1114 reply.writeInt(res ? 1 : 0);
1115 return true;
1116 }
1117
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001118 case STOP_APP_SWITCHES_TRANSACTION: {
1119 data.enforceInterface(IActivityManager.descriptor);
1120 stopAppSwitches();
1121 reply.writeNoException();
1122 return true;
1123 }
1124
1125 case RESUME_APP_SWITCHES_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 resumeAppSwitches();
1128 reply.writeNoException();
1129 return true;
1130 }
1131
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 case PEEK_SERVICE_TRANSACTION: {
1133 data.enforceInterface(IActivityManager.descriptor);
1134 Intent service = Intent.CREATOR.createFromParcel(data);
1135 String resolvedType = data.readString();
1136 IBinder binder = peekService(service, resolvedType);
1137 reply.writeNoException();
1138 reply.writeStrongBinder(binder);
1139 return true;
1140 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001141
1142 case START_BACKUP_AGENT_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1145 int backupRestoreMode = data.readInt();
1146 boolean success = bindBackupAgent(info, backupRestoreMode);
1147 reply.writeNoException();
1148 reply.writeInt(success ? 1 : 0);
1149 return true;
1150 }
1151
1152 case BACKUP_AGENT_CREATED_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 String packageName = data.readString();
1155 IBinder agent = data.readStrongBinder();
1156 backupAgentCreated(packageName, agent);
1157 reply.writeNoException();
1158 return true;
1159 }
1160
1161 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1164 unbindBackupAgent(info);
1165 reply.writeNoException();
1166 return true;
1167 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001168
1169 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1170 data.enforceInterface(IActivityManager.descriptor);
1171 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1172 data.readStrongBinder());
1173 registerActivityWatcher(watcher);
1174 return true;
1175 }
1176
1177 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1180 data.readStrongBinder());
1181 unregisterActivityWatcher(watcher);
1182 return true;
1183 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001184
1185 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1186 {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 int uid = data.readInt();
1189 Intent intent = Intent.CREATOR.createFromParcel(data);
1190 String resolvedType = data.readString();
1191 IBinder resultTo = data.readStrongBinder();
1192 String resultWho = data.readString();
1193 int requestCode = data.readInt();
1194 boolean onlyIfNeeded = data.readInt() != 0;
1195 int result = startActivityInPackage(uid, intent, resolvedType,
1196 resultTo, resultWho, requestCode, onlyIfNeeded);
1197 reply.writeNoException();
1198 reply.writeInt(result);
1199 return true;
1200 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001201
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001202 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 String pkg = data.readString();
1205 int uid = data.readInt();
1206 killApplicationWithUid(pkg, uid);
1207 reply.writeNoException();
1208 return true;
1209 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001210
1211 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 String reason = data.readString();
1214 closeSystemDialogs(reason);
1215 reply.writeNoException();
1216 return true;
1217 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001218
1219 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001221 int[] pids = data.createIntArray();
1222 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001223 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001224 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001225 return true;
1226 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001227
1228 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 String processName = data.readString();
1231 int uid = data.readInt();
1232 killApplicationProcess(processName, uid);
1233 reply.writeNoException();
1234 return true;
1235 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001236
1237 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 IBinder token = data.readStrongBinder();
1240 String packageName = data.readString();
1241 int enterAnim = data.readInt();
1242 int exitAnim = data.readInt();
1243 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001244 reply.writeNoException();
1245 return true;
1246 }
1247
1248 case IS_USER_A_MONKEY_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 reply.writeInt(isUserAMonkey() ? 1 : 0);
1251 reply.writeNoException();
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001252 return true;
1253 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001254
1255 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1256 data.enforceInterface(IActivityManager.descriptor);
1257 finishHeavyWeightApp();
1258 reply.writeNoException();
1259 return true;
1260 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001261
1262 case IS_IMMERSIVE_TRANSACTION: {
1263 data.enforceInterface(IActivityManager.descriptor);
1264 IBinder token = data.readStrongBinder();
1265 reply.writeInt(isImmersive(token) ? 1 : 0);
1266 reply.writeNoException();
1267 return true;
1268 }
1269
1270 case SET_IMMERSIVE_TRANSACTION: {
1271 data.enforceInterface(IActivityManager.descriptor);
1272 IBinder token = data.readStrongBinder();
1273 boolean imm = data.readInt() == 1;
1274 setImmersive(token, imm);
1275 reply.writeNoException();
1276 return true;
1277 }
1278
1279 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 reply.writeInt(isTopActivityImmersive() ? 1 : 0);
1282 reply.writeNoException();
1283 return true;
1284 }
1285
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001286 case CRASH_APPLICATION_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
1288 int uid = data.readInt();
1289 int initialPid = data.readInt();
1290 String packageName = data.readString();
1291 String message = data.readString();
1292 crashApplication(uid, initialPid, packageName, message);
1293 reply.writeNoException();
1294 return true;
1295 }
1296
Andy McFadden824c5102010-07-09 16:26:57 -07001297 case DUMP_HEAP_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 String process = data.readString();
1300 boolean managed = data.readInt() != 0;
1301 String path = data.readString();
1302 ParcelFileDescriptor fd = data.readInt() != 0
1303 ? data.readFileDescriptor() : null;
1304 boolean res = dumpHeap(process, managed, path, fd);
1305 reply.writeNoException();
1306 reply.writeInt(res ? 1 : 0);
1307 return true;
1308 }
1309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001310 }
1311
1312 return super.onTransact(code, data, reply, flags);
1313 }
1314
1315 public IBinder asBinder()
1316 {
1317 return this;
1318 }
1319
1320 private static IActivityManager gDefault;
1321}
1322
1323class ActivityManagerProxy implements IActivityManager
1324{
1325 public ActivityManagerProxy(IBinder remote)
1326 {
1327 mRemote = remote;
1328 }
1329
1330 public IBinder asBinder()
1331 {
1332 return mRemote;
1333 }
1334
1335 public int startActivity(IApplicationThread caller, Intent intent,
1336 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1337 IBinder resultTo, String resultWho,
1338 int requestCode, boolean onlyIfNeeded,
1339 boolean debug) throws RemoteException {
1340 Parcel data = Parcel.obtain();
1341 Parcel reply = Parcel.obtain();
1342 data.writeInterfaceToken(IActivityManager.descriptor);
1343 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1344 intent.writeToParcel(data, 0);
1345 data.writeString(resolvedType);
1346 data.writeTypedArray(grantedUriPermissions, 0);
1347 data.writeInt(grantedMode);
1348 data.writeStrongBinder(resultTo);
1349 data.writeString(resultWho);
1350 data.writeInt(requestCode);
1351 data.writeInt(onlyIfNeeded ? 1 : 0);
1352 data.writeInt(debug ? 1 : 0);
1353 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1354 reply.readException();
1355 int result = reply.readInt();
1356 reply.recycle();
1357 data.recycle();
1358 return result;
1359 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001360 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1361 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1362 IBinder resultTo, String resultWho,
1363 int requestCode, boolean onlyIfNeeded,
1364 boolean debug) throws RemoteException {
1365 Parcel data = Parcel.obtain();
1366 Parcel reply = Parcel.obtain();
1367 data.writeInterfaceToken(IActivityManager.descriptor);
1368 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1369 intent.writeToParcel(data, 0);
1370 data.writeString(resolvedType);
1371 data.writeTypedArray(grantedUriPermissions, 0);
1372 data.writeInt(grantedMode);
1373 data.writeStrongBinder(resultTo);
1374 data.writeString(resultWho);
1375 data.writeInt(requestCode);
1376 data.writeInt(onlyIfNeeded ? 1 : 0);
1377 data.writeInt(debug ? 1 : 0);
1378 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1379 reply.readException();
1380 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1381 reply.recycle();
1382 data.recycle();
1383 return result;
1384 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001385 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1386 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1387 IBinder resultTo, String resultWho,
1388 int requestCode, boolean onlyIfNeeded,
1389 boolean debug, Configuration config) throws RemoteException {
1390 Parcel data = Parcel.obtain();
1391 Parcel reply = Parcel.obtain();
1392 data.writeInterfaceToken(IActivityManager.descriptor);
1393 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1394 intent.writeToParcel(data, 0);
1395 data.writeString(resolvedType);
1396 data.writeTypedArray(grantedUriPermissions, 0);
1397 data.writeInt(grantedMode);
1398 data.writeStrongBinder(resultTo);
1399 data.writeString(resultWho);
1400 data.writeInt(requestCode);
1401 data.writeInt(onlyIfNeeded ? 1 : 0);
1402 data.writeInt(debug ? 1 : 0);
1403 config.writeToParcel(data, 0);
1404 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1405 reply.readException();
1406 int result = reply.readInt();
1407 reply.recycle();
1408 data.recycle();
1409 return result;
1410 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001411 public int startActivityIntentSender(IApplicationThread caller,
1412 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001413 IBinder resultTo, String resultWho, int requestCode,
1414 int flagsMask, int flagsValues) throws RemoteException {
1415 Parcel data = Parcel.obtain();
1416 Parcel reply = Parcel.obtain();
1417 data.writeInterfaceToken(IActivityManager.descriptor);
1418 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1419 intent.writeToParcel(data, 0);
1420 if (fillInIntent != null) {
1421 data.writeInt(1);
1422 fillInIntent.writeToParcel(data, 0);
1423 } else {
1424 data.writeInt(0);
1425 }
1426 data.writeString(resolvedType);
1427 data.writeStrongBinder(resultTo);
1428 data.writeString(resultWho);
1429 data.writeInt(requestCode);
1430 data.writeInt(flagsMask);
1431 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001432 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001433 reply.readException();
1434 int result = reply.readInt();
1435 reply.recycle();
1436 data.recycle();
1437 return result;
1438 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001439 public boolean startNextMatchingActivity(IBinder callingActivity,
1440 Intent intent) throws RemoteException {
1441 Parcel data = Parcel.obtain();
1442 Parcel reply = Parcel.obtain();
1443 data.writeInterfaceToken(IActivityManager.descriptor);
1444 data.writeStrongBinder(callingActivity);
1445 intent.writeToParcel(data, 0);
1446 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1447 reply.readException();
1448 int result = reply.readInt();
1449 reply.recycle();
1450 data.recycle();
1451 return result != 0;
1452 }
1453 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1454 throws RemoteException {
1455 Parcel data = Parcel.obtain();
1456 Parcel reply = Parcel.obtain();
1457 data.writeInterfaceToken(IActivityManager.descriptor);
1458 data.writeStrongBinder(token);
1459 data.writeInt(resultCode);
1460 if (resultData != null) {
1461 data.writeInt(1);
1462 resultData.writeToParcel(data, 0);
1463 } else {
1464 data.writeInt(0);
1465 }
1466 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1467 reply.readException();
1468 boolean res = reply.readInt() != 0;
1469 data.recycle();
1470 reply.recycle();
1471 return res;
1472 }
1473 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1474 {
1475 Parcel data = Parcel.obtain();
1476 Parcel reply = Parcel.obtain();
1477 data.writeInterfaceToken(IActivityManager.descriptor);
1478 data.writeStrongBinder(token);
1479 data.writeString(resultWho);
1480 data.writeInt(requestCode);
1481 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1482 reply.readException();
1483 data.recycle();
1484 reply.recycle();
1485 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001486 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1487 Parcel data = Parcel.obtain();
1488 Parcel reply = Parcel.obtain();
1489 data.writeInterfaceToken(IActivityManager.descriptor);
1490 data.writeStrongBinder(token);
1491 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1492 reply.readException();
1493 boolean res = reply.readInt() != 0;
1494 data.recycle();
1495 reply.recycle();
1496 return res;
1497 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001498 public Intent registerReceiver(IApplicationThread caller,
1499 IIntentReceiver receiver,
1500 IntentFilter filter, String perm) throws RemoteException
1501 {
1502 Parcel data = Parcel.obtain();
1503 Parcel reply = Parcel.obtain();
1504 data.writeInterfaceToken(IActivityManager.descriptor);
1505 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1506 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1507 filter.writeToParcel(data, 0);
1508 data.writeString(perm);
1509 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1510 reply.readException();
1511 Intent intent = null;
1512 int haveIntent = reply.readInt();
1513 if (haveIntent != 0) {
1514 intent = Intent.CREATOR.createFromParcel(reply);
1515 }
1516 reply.recycle();
1517 data.recycle();
1518 return intent;
1519 }
1520 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1521 {
1522 Parcel data = Parcel.obtain();
1523 Parcel reply = Parcel.obtain();
1524 data.writeInterfaceToken(IActivityManager.descriptor);
1525 data.writeStrongBinder(receiver.asBinder());
1526 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1527 reply.readException();
1528 data.recycle();
1529 reply.recycle();
1530 }
1531 public int broadcastIntent(IApplicationThread caller,
1532 Intent intent, String resolvedType, IIntentReceiver resultTo,
1533 int resultCode, String resultData, Bundle map,
1534 String requiredPermission, boolean serialized,
1535 boolean sticky) throws RemoteException
1536 {
1537 Parcel data = Parcel.obtain();
1538 Parcel reply = Parcel.obtain();
1539 data.writeInterfaceToken(IActivityManager.descriptor);
1540 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1541 intent.writeToParcel(data, 0);
1542 data.writeString(resolvedType);
1543 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1544 data.writeInt(resultCode);
1545 data.writeString(resultData);
1546 data.writeBundle(map);
1547 data.writeString(requiredPermission);
1548 data.writeInt(serialized ? 1 : 0);
1549 data.writeInt(sticky ? 1 : 0);
1550 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1551 reply.readException();
1552 int res = reply.readInt();
1553 reply.recycle();
1554 data.recycle();
1555 return res;
1556 }
1557 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1558 {
1559 Parcel data = Parcel.obtain();
1560 Parcel reply = Parcel.obtain();
1561 data.writeInterfaceToken(IActivityManager.descriptor);
1562 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1563 intent.writeToParcel(data, 0);
1564 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1565 reply.readException();
1566 data.recycle();
1567 reply.recycle();
1568 }
1569 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1570 {
1571 Parcel data = Parcel.obtain();
1572 Parcel reply = Parcel.obtain();
1573 data.writeInterfaceToken(IActivityManager.descriptor);
1574 data.writeStrongBinder(who);
1575 data.writeInt(resultCode);
1576 data.writeString(resultData);
1577 data.writeBundle(map);
1578 data.writeInt(abortBroadcast ? 1 : 0);
1579 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1580 reply.readException();
1581 data.recycle();
1582 reply.recycle();
1583 }
1584 public void setPersistent(IBinder token, boolean isPersistent) throws RemoteException
1585 {
1586 Parcel data = Parcel.obtain();
1587 Parcel reply = Parcel.obtain();
1588 data.writeInterfaceToken(IActivityManager.descriptor);
1589 data.writeStrongBinder(token);
1590 data.writeInt(isPersistent ? 1 : 0);
1591 mRemote.transact(SET_PERSISTENT_TRANSACTION, data, reply, 0);
1592 reply.readException();
1593 data.recycle();
1594 reply.recycle();
1595 }
1596 public void attachApplication(IApplicationThread app) throws RemoteException
1597 {
1598 Parcel data = Parcel.obtain();
1599 Parcel reply = Parcel.obtain();
1600 data.writeInterfaceToken(IActivityManager.descriptor);
1601 data.writeStrongBinder(app.asBinder());
1602 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1603 reply.readException();
1604 data.recycle();
1605 reply.recycle();
1606 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001607 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001608 {
1609 Parcel data = Parcel.obtain();
1610 Parcel reply = Parcel.obtain();
1611 data.writeInterfaceToken(IActivityManager.descriptor);
1612 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001613 if (config != null) {
1614 data.writeInt(1);
1615 config.writeToParcel(data, 0);
1616 } else {
1617 data.writeInt(0);
1618 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1620 reply.readException();
1621 data.recycle();
1622 reply.recycle();
1623 }
1624 public void activityPaused(IBinder token, Bundle state) throws RemoteException
1625 {
1626 Parcel data = Parcel.obtain();
1627 Parcel reply = Parcel.obtain();
1628 data.writeInterfaceToken(IActivityManager.descriptor);
1629 data.writeStrongBinder(token);
1630 data.writeBundle(state);
1631 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1632 reply.readException();
1633 data.recycle();
1634 reply.recycle();
1635 }
1636 public void activityStopped(IBinder token,
1637 Bitmap thumbnail, CharSequence description) throws RemoteException
1638 {
1639 Parcel data = Parcel.obtain();
1640 Parcel reply = Parcel.obtain();
1641 data.writeInterfaceToken(IActivityManager.descriptor);
1642 data.writeStrongBinder(token);
1643 if (thumbnail != null) {
1644 data.writeInt(1);
1645 thumbnail.writeToParcel(data, 0);
1646 } else {
1647 data.writeInt(0);
1648 }
1649 TextUtils.writeToParcel(description, data, 0);
1650 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1651 reply.readException();
1652 data.recycle();
1653 reply.recycle();
1654 }
1655 public void activityDestroyed(IBinder token) throws RemoteException
1656 {
1657 Parcel data = Parcel.obtain();
1658 Parcel reply = Parcel.obtain();
1659 data.writeInterfaceToken(IActivityManager.descriptor);
1660 data.writeStrongBinder(token);
1661 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1662 reply.readException();
1663 data.recycle();
1664 reply.recycle();
1665 }
1666 public String getCallingPackage(IBinder token) throws RemoteException
1667 {
1668 Parcel data = Parcel.obtain();
1669 Parcel reply = Parcel.obtain();
1670 data.writeInterfaceToken(IActivityManager.descriptor);
1671 data.writeStrongBinder(token);
1672 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1673 reply.readException();
1674 String res = reply.readString();
1675 data.recycle();
1676 reply.recycle();
1677 return res;
1678 }
1679 public ComponentName getCallingActivity(IBinder token)
1680 throws RemoteException {
1681 Parcel data = Parcel.obtain();
1682 Parcel reply = Parcel.obtain();
1683 data.writeInterfaceToken(IActivityManager.descriptor);
1684 data.writeStrongBinder(token);
1685 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1686 reply.readException();
1687 ComponentName res = ComponentName.readFromParcel(reply);
1688 data.recycle();
1689 reply.recycle();
1690 return res;
1691 }
1692 public List getTasks(int maxNum, int flags,
1693 IThumbnailReceiver receiver) throws RemoteException {
1694 Parcel data = Parcel.obtain();
1695 Parcel reply = Parcel.obtain();
1696 data.writeInterfaceToken(IActivityManager.descriptor);
1697 data.writeInt(maxNum);
1698 data.writeInt(flags);
1699 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1700 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1701 reply.readException();
1702 ArrayList list = null;
1703 int N = reply.readInt();
1704 if (N >= 0) {
1705 list = new ArrayList();
1706 while (N > 0) {
1707 ActivityManager.RunningTaskInfo info =
1708 ActivityManager.RunningTaskInfo.CREATOR
1709 .createFromParcel(reply);
1710 list.add(info);
1711 N--;
1712 }
1713 }
1714 data.recycle();
1715 reply.recycle();
1716 return list;
1717 }
1718 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1719 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_RECENT_TASKS_TRANSACTION, data, reply, 0);
1726 reply.readException();
1727 ArrayList<ActivityManager.RecentTaskInfo> list
1728 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1729 data.recycle();
1730 reply.recycle();
1731 return list;
1732 }
1733 public List getServices(int maxNum, int flags) throws RemoteException {
1734 Parcel data = Parcel.obtain();
1735 Parcel reply = Parcel.obtain();
1736 data.writeInterfaceToken(IActivityManager.descriptor);
1737 data.writeInt(maxNum);
1738 data.writeInt(flags);
1739 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1740 reply.readException();
1741 ArrayList list = null;
1742 int N = reply.readInt();
1743 if (N >= 0) {
1744 list = new ArrayList();
1745 while (N > 0) {
1746 ActivityManager.RunningServiceInfo info =
1747 ActivityManager.RunningServiceInfo.CREATOR
1748 .createFromParcel(reply);
1749 list.add(info);
1750 N--;
1751 }
1752 }
1753 data.recycle();
1754 reply.recycle();
1755 return list;
1756 }
1757 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1758 throws RemoteException {
1759 Parcel data = Parcel.obtain();
1760 Parcel reply = Parcel.obtain();
1761 data.writeInterfaceToken(IActivityManager.descriptor);
1762 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1763 reply.readException();
1764 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1765 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1766 data.recycle();
1767 reply.recycle();
1768 return list;
1769 }
1770 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1771 throws RemoteException {
1772 Parcel data = Parcel.obtain();
1773 Parcel reply = Parcel.obtain();
1774 data.writeInterfaceToken(IActivityManager.descriptor);
1775 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1776 reply.readException();
1777 ArrayList<ActivityManager.RunningAppProcessInfo> list
1778 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1779 data.recycle();
1780 reply.recycle();
1781 return list;
1782 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07001783 public List<ApplicationInfo> getRunningExternalApplications()
1784 throws RemoteException {
1785 Parcel data = Parcel.obtain();
1786 Parcel reply = Parcel.obtain();
1787 data.writeInterfaceToken(IActivityManager.descriptor);
1788 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
1789 reply.readException();
1790 ArrayList<ApplicationInfo> list
1791 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
1792 data.recycle();
1793 reply.recycle();
1794 return list;
1795 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001796 public void moveTaskToFront(int task) throws RemoteException
1797 {
1798 Parcel data = Parcel.obtain();
1799 Parcel reply = Parcel.obtain();
1800 data.writeInterfaceToken(IActivityManager.descriptor);
1801 data.writeInt(task);
1802 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1803 reply.readException();
1804 data.recycle();
1805 reply.recycle();
1806 }
1807 public void moveTaskToBack(int task) throws RemoteException
1808 {
1809 Parcel data = Parcel.obtain();
1810 Parcel reply = Parcel.obtain();
1811 data.writeInterfaceToken(IActivityManager.descriptor);
1812 data.writeInt(task);
1813 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1814 reply.readException();
1815 data.recycle();
1816 reply.recycle();
1817 }
1818 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1819 throws RemoteException {
1820 Parcel data = Parcel.obtain();
1821 Parcel reply = Parcel.obtain();
1822 data.writeInterfaceToken(IActivityManager.descriptor);
1823 data.writeStrongBinder(token);
1824 data.writeInt(nonRoot ? 1 : 0);
1825 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1826 reply.readException();
1827 boolean res = reply.readInt() != 0;
1828 data.recycle();
1829 reply.recycle();
1830 return res;
1831 }
1832 public void moveTaskBackwards(int task) throws RemoteException
1833 {
1834 Parcel data = Parcel.obtain();
1835 Parcel reply = Parcel.obtain();
1836 data.writeInterfaceToken(IActivityManager.descriptor);
1837 data.writeInt(task);
1838 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1839 reply.readException();
1840 data.recycle();
1841 reply.recycle();
1842 }
1843 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
1844 {
1845 Parcel data = Parcel.obtain();
1846 Parcel reply = Parcel.obtain();
1847 data.writeInterfaceToken(IActivityManager.descriptor);
1848 data.writeStrongBinder(token);
1849 data.writeInt(onlyRoot ? 1 : 0);
1850 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
1851 reply.readException();
1852 int res = reply.readInt();
1853 data.recycle();
1854 reply.recycle();
1855 return res;
1856 }
1857 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
1858 {
1859 Parcel data = Parcel.obtain();
1860 Parcel reply = Parcel.obtain();
1861 data.writeInterfaceToken(IActivityManager.descriptor);
1862 data.writeStrongBinder(token);
1863 ComponentName.writeToParcel(className, data);
1864 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
1865 reply.readException();
1866 data.recycle();
1867 reply.recycle();
1868 }
1869 public void reportThumbnail(IBinder token,
1870 Bitmap thumbnail, CharSequence description) throws RemoteException
1871 {
1872 Parcel data = Parcel.obtain();
1873 Parcel reply = Parcel.obtain();
1874 data.writeInterfaceToken(IActivityManager.descriptor);
1875 data.writeStrongBinder(token);
1876 if (thumbnail != null) {
1877 data.writeInt(1);
1878 thumbnail.writeToParcel(data, 0);
1879 } else {
1880 data.writeInt(0);
1881 }
1882 TextUtils.writeToParcel(description, data, 0);
1883 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1884 reply.readException();
1885 data.recycle();
1886 reply.recycle();
1887 }
1888 public ContentProviderHolder getContentProvider(IApplicationThread caller,
1889 String name) throws RemoteException
1890 {
1891 Parcel data = Parcel.obtain();
1892 Parcel reply = Parcel.obtain();
1893 data.writeInterfaceToken(IActivityManager.descriptor);
1894 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1895 data.writeString(name);
1896 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1897 reply.readException();
1898 int res = reply.readInt();
1899 ContentProviderHolder cph = null;
1900 if (res != 0) {
1901 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
1902 }
1903 data.recycle();
1904 reply.recycle();
1905 return cph;
1906 }
1907 public void publishContentProviders(IApplicationThread caller,
1908 List<ContentProviderHolder> providers) throws RemoteException
1909 {
1910 Parcel data = Parcel.obtain();
1911 Parcel reply = Parcel.obtain();
1912 data.writeInterfaceToken(IActivityManager.descriptor);
1913 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1914 data.writeTypedList(providers);
1915 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
1916 reply.readException();
1917 data.recycle();
1918 reply.recycle();
1919 }
1920
1921 public void removeContentProvider(IApplicationThread caller,
1922 String name) throws RemoteException {
1923 Parcel data = Parcel.obtain();
1924 Parcel reply = Parcel.obtain();
1925 data.writeInterfaceToken(IActivityManager.descriptor);
1926 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1927 data.writeString(name);
1928 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
1929 reply.readException();
1930 data.recycle();
1931 reply.recycle();
1932 }
1933
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07001934 public PendingIntent getRunningServiceControlPanel(ComponentName service)
1935 throws RemoteException
1936 {
1937 Parcel data = Parcel.obtain();
1938 Parcel reply = Parcel.obtain();
1939 data.writeInterfaceToken(IActivityManager.descriptor);
1940 service.writeToParcel(data, 0);
1941 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
1942 reply.readException();
1943 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
1944 data.recycle();
1945 reply.recycle();
1946 return res;
1947 }
1948
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001949 public ComponentName startService(IApplicationThread caller, Intent service,
1950 String resolvedType) throws RemoteException
1951 {
1952 Parcel data = Parcel.obtain();
1953 Parcel reply = Parcel.obtain();
1954 data.writeInterfaceToken(IActivityManager.descriptor);
1955 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1956 service.writeToParcel(data, 0);
1957 data.writeString(resolvedType);
1958 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
1959 reply.readException();
1960 ComponentName res = ComponentName.readFromParcel(reply);
1961 data.recycle();
1962 reply.recycle();
1963 return res;
1964 }
1965 public int stopService(IApplicationThread caller, Intent service,
1966 String resolvedType) throws RemoteException
1967 {
1968 Parcel data = Parcel.obtain();
1969 Parcel reply = Parcel.obtain();
1970 data.writeInterfaceToken(IActivityManager.descriptor);
1971 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1972 service.writeToParcel(data, 0);
1973 data.writeString(resolvedType);
1974 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
1975 reply.readException();
1976 int res = reply.readInt();
1977 reply.recycle();
1978 data.recycle();
1979 return res;
1980 }
1981 public boolean stopServiceToken(ComponentName className, IBinder token,
1982 int startId) throws RemoteException {
1983 Parcel data = Parcel.obtain();
1984 Parcel reply = Parcel.obtain();
1985 data.writeInterfaceToken(IActivityManager.descriptor);
1986 ComponentName.writeToParcel(className, data);
1987 data.writeStrongBinder(token);
1988 data.writeInt(startId);
1989 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
1990 reply.readException();
1991 boolean res = reply.readInt() != 0;
1992 data.recycle();
1993 reply.recycle();
1994 return res;
1995 }
1996 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07001997 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001998 Parcel data = Parcel.obtain();
1999 Parcel reply = Parcel.obtain();
2000 data.writeInterfaceToken(IActivityManager.descriptor);
2001 ComponentName.writeToParcel(className, data);
2002 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002003 data.writeInt(id);
2004 if (notification != null) {
2005 data.writeInt(1);
2006 notification.writeToParcel(data, 0);
2007 } else {
2008 data.writeInt(0);
2009 }
2010 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002011 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2012 reply.readException();
2013 data.recycle();
2014 reply.recycle();
2015 }
2016 public int bindService(IApplicationThread caller, IBinder token,
2017 Intent service, String resolvedType, IServiceConnection connection,
2018 int flags) throws RemoteException {
2019 Parcel data = Parcel.obtain();
2020 Parcel reply = Parcel.obtain();
2021 data.writeInterfaceToken(IActivityManager.descriptor);
2022 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2023 data.writeStrongBinder(token);
2024 service.writeToParcel(data, 0);
2025 data.writeString(resolvedType);
2026 data.writeStrongBinder(connection.asBinder());
2027 data.writeInt(flags);
2028 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2029 reply.readException();
2030 int res = reply.readInt();
2031 data.recycle();
2032 reply.recycle();
2033 return res;
2034 }
2035 public boolean unbindService(IServiceConnection connection) throws RemoteException
2036 {
2037 Parcel data = Parcel.obtain();
2038 Parcel reply = Parcel.obtain();
2039 data.writeInterfaceToken(IActivityManager.descriptor);
2040 data.writeStrongBinder(connection.asBinder());
2041 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2042 reply.readException();
2043 boolean res = reply.readInt() != 0;
2044 data.recycle();
2045 reply.recycle();
2046 return res;
2047 }
2048
2049 public void publishService(IBinder token,
2050 Intent intent, IBinder service) 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.writeStrongBinder(service);
2057 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2058 reply.readException();
2059 data.recycle();
2060 reply.recycle();
2061 }
2062
2063 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2064 throws RemoteException {
2065 Parcel data = Parcel.obtain();
2066 Parcel reply = Parcel.obtain();
2067 data.writeInterfaceToken(IActivityManager.descriptor);
2068 data.writeStrongBinder(token);
2069 intent.writeToParcel(data, 0);
2070 data.writeInt(doRebind ? 1 : 0);
2071 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2072 reply.readException();
2073 data.recycle();
2074 reply.recycle();
2075 }
2076
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002077 public void serviceDoneExecuting(IBinder token, int type, int startId,
2078 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002079 Parcel data = Parcel.obtain();
2080 Parcel reply = Parcel.obtain();
2081 data.writeInterfaceToken(IActivityManager.descriptor);
2082 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002083 data.writeInt(type);
2084 data.writeInt(startId);
2085 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002086 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2087 reply.readException();
2088 data.recycle();
2089 reply.recycle();
2090 }
2091
2092 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2093 Parcel data = Parcel.obtain();
2094 Parcel reply = Parcel.obtain();
2095 data.writeInterfaceToken(IActivityManager.descriptor);
2096 service.writeToParcel(data, 0);
2097 data.writeString(resolvedType);
2098 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2099 reply.readException();
2100 IBinder binder = reply.readStrongBinder();
2101 reply.recycle();
2102 data.recycle();
2103 return binder;
2104 }
2105
Christopher Tate181fafa2009-05-14 11:12:14 -07002106 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2107 throws RemoteException {
2108 Parcel data = Parcel.obtain();
2109 Parcel reply = Parcel.obtain();
2110 data.writeInterfaceToken(IActivityManager.descriptor);
2111 app.writeToParcel(data, 0);
2112 data.writeInt(backupRestoreMode);
2113 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2114 reply.readException();
2115 boolean success = reply.readInt() != 0;
2116 reply.recycle();
2117 data.recycle();
2118 return success;
2119 }
2120
2121 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2122 Parcel data = Parcel.obtain();
2123 Parcel reply = Parcel.obtain();
2124 data.writeInterfaceToken(IActivityManager.descriptor);
2125 data.writeString(packageName);
2126 data.writeStrongBinder(agent);
2127 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2128 reply.recycle();
2129 data.recycle();
2130 }
2131
2132 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2133 Parcel data = Parcel.obtain();
2134 Parcel reply = Parcel.obtain();
2135 data.writeInterfaceToken(IActivityManager.descriptor);
2136 app.writeToParcel(data, 0);
2137 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2138 reply.readException();
2139 reply.recycle();
2140 data.recycle();
2141 }
2142
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002143 public boolean startInstrumentation(ComponentName className, String profileFile,
2144 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2145 throws RemoteException {
2146 Parcel data = Parcel.obtain();
2147 Parcel reply = Parcel.obtain();
2148 data.writeInterfaceToken(IActivityManager.descriptor);
2149 ComponentName.writeToParcel(className, data);
2150 data.writeString(profileFile);
2151 data.writeInt(flags);
2152 data.writeBundle(arguments);
2153 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2154 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2155 reply.readException();
2156 boolean res = reply.readInt() != 0;
2157 reply.recycle();
2158 data.recycle();
2159 return res;
2160 }
2161
2162 public void finishInstrumentation(IApplicationThread target,
2163 int resultCode, Bundle results) throws RemoteException {
2164 Parcel data = Parcel.obtain();
2165 Parcel reply = Parcel.obtain();
2166 data.writeInterfaceToken(IActivityManager.descriptor);
2167 data.writeStrongBinder(target != null ? target.asBinder() : null);
2168 data.writeInt(resultCode);
2169 data.writeBundle(results);
2170 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2171 reply.readException();
2172 data.recycle();
2173 reply.recycle();
2174 }
2175 public Configuration getConfiguration() throws RemoteException
2176 {
2177 Parcel data = Parcel.obtain();
2178 Parcel reply = Parcel.obtain();
2179 data.writeInterfaceToken(IActivityManager.descriptor);
2180 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2181 reply.readException();
2182 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2183 reply.recycle();
2184 data.recycle();
2185 return res;
2186 }
2187 public void updateConfiguration(Configuration values) throws RemoteException
2188 {
2189 Parcel data = Parcel.obtain();
2190 Parcel reply = Parcel.obtain();
2191 data.writeInterfaceToken(IActivityManager.descriptor);
2192 values.writeToParcel(data, 0);
2193 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2194 reply.readException();
2195 data.recycle();
2196 reply.recycle();
2197 }
2198 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2199 throws RemoteException {
2200 Parcel data = Parcel.obtain();
2201 Parcel reply = Parcel.obtain();
2202 data.writeInterfaceToken(IActivityManager.descriptor);
2203 data.writeStrongBinder(token);
2204 data.writeInt(requestedOrientation);
2205 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2206 reply.readException();
2207 data.recycle();
2208 reply.recycle();
2209 }
2210 public int getRequestedOrientation(IBinder token) throws RemoteException {
2211 Parcel data = Parcel.obtain();
2212 Parcel reply = Parcel.obtain();
2213 data.writeInterfaceToken(IActivityManager.descriptor);
2214 data.writeStrongBinder(token);
2215 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2216 reply.readException();
2217 int res = reply.readInt();
2218 data.recycle();
2219 reply.recycle();
2220 return res;
2221 }
2222 public ComponentName getActivityClassForToken(IBinder token)
2223 throws RemoteException {
2224 Parcel data = Parcel.obtain();
2225 Parcel reply = Parcel.obtain();
2226 data.writeInterfaceToken(IActivityManager.descriptor);
2227 data.writeStrongBinder(token);
2228 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2229 reply.readException();
2230 ComponentName res = ComponentName.readFromParcel(reply);
2231 data.recycle();
2232 reply.recycle();
2233 return res;
2234 }
2235 public String getPackageForToken(IBinder token) throws RemoteException
2236 {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(token);
2241 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2242 reply.readException();
2243 String res = reply.readString();
2244 data.recycle();
2245 reply.recycle();
2246 return res;
2247 }
2248 public IIntentSender getIntentSender(int type,
2249 String packageName, IBinder token, String resultWho,
2250 int requestCode, Intent intent, String resolvedType, int flags)
2251 throws RemoteException {
2252 Parcel data = Parcel.obtain();
2253 Parcel reply = Parcel.obtain();
2254 data.writeInterfaceToken(IActivityManager.descriptor);
2255 data.writeInt(type);
2256 data.writeString(packageName);
2257 data.writeStrongBinder(token);
2258 data.writeString(resultWho);
2259 data.writeInt(requestCode);
2260 if (intent != null) {
2261 data.writeInt(1);
2262 intent.writeToParcel(data, 0);
2263 } else {
2264 data.writeInt(0);
2265 }
2266 data.writeString(resolvedType);
2267 data.writeInt(flags);
2268 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2269 reply.readException();
2270 IIntentSender res = IIntentSender.Stub.asInterface(
2271 reply.readStrongBinder());
2272 data.recycle();
2273 reply.recycle();
2274 return res;
2275 }
2276 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2277 Parcel data = Parcel.obtain();
2278 Parcel reply = Parcel.obtain();
2279 data.writeInterfaceToken(IActivityManager.descriptor);
2280 data.writeStrongBinder(sender.asBinder());
2281 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2282 reply.readException();
2283 data.recycle();
2284 reply.recycle();
2285 }
2286 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2287 Parcel data = Parcel.obtain();
2288 Parcel reply = Parcel.obtain();
2289 data.writeInterfaceToken(IActivityManager.descriptor);
2290 data.writeStrongBinder(sender.asBinder());
2291 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2292 reply.readException();
2293 String res = reply.readString();
2294 data.recycle();
2295 reply.recycle();
2296 return res;
2297 }
2298 public void setProcessLimit(int max) throws RemoteException
2299 {
2300 Parcel data = Parcel.obtain();
2301 Parcel reply = Parcel.obtain();
2302 data.writeInterfaceToken(IActivityManager.descriptor);
2303 data.writeInt(max);
2304 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2305 reply.readException();
2306 data.recycle();
2307 reply.recycle();
2308 }
2309 public int getProcessLimit() throws RemoteException
2310 {
2311 Parcel data = Parcel.obtain();
2312 Parcel reply = Parcel.obtain();
2313 data.writeInterfaceToken(IActivityManager.descriptor);
2314 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2315 reply.readException();
2316 int res = reply.readInt();
2317 data.recycle();
2318 reply.recycle();
2319 return res;
2320 }
2321 public void setProcessForeground(IBinder token, int pid,
2322 boolean isForeground) throws RemoteException {
2323 Parcel data = Parcel.obtain();
2324 Parcel reply = Parcel.obtain();
2325 data.writeInterfaceToken(IActivityManager.descriptor);
2326 data.writeStrongBinder(token);
2327 data.writeInt(pid);
2328 data.writeInt(isForeground ? 1 : 0);
2329 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2330 reply.readException();
2331 data.recycle();
2332 reply.recycle();
2333 }
2334 public int checkPermission(String permission, int pid, int uid)
2335 throws RemoteException {
2336 Parcel data = Parcel.obtain();
2337 Parcel reply = Parcel.obtain();
2338 data.writeInterfaceToken(IActivityManager.descriptor);
2339 data.writeString(permission);
2340 data.writeInt(pid);
2341 data.writeInt(uid);
2342 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2343 reply.readException();
2344 int res = reply.readInt();
2345 data.recycle();
2346 reply.recycle();
2347 return res;
2348 }
2349 public boolean clearApplicationUserData(final String packageName,
2350 final IPackageDataObserver observer) throws RemoteException {
2351 Parcel data = Parcel.obtain();
2352 Parcel reply = Parcel.obtain();
2353 data.writeInterfaceToken(IActivityManager.descriptor);
2354 data.writeString(packageName);
2355 data.writeStrongBinder(observer.asBinder());
2356 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2357 reply.readException();
2358 boolean res = reply.readInt() != 0;
2359 data.recycle();
2360 reply.recycle();
2361 return res;
2362 }
2363 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2364 throws RemoteException {
2365 Parcel data = Parcel.obtain();
2366 Parcel reply = Parcel.obtain();
2367 data.writeInterfaceToken(IActivityManager.descriptor);
2368 uri.writeToParcel(data, 0);
2369 data.writeInt(pid);
2370 data.writeInt(uid);
2371 data.writeInt(mode);
2372 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2373 reply.readException();
2374 int res = reply.readInt();
2375 data.recycle();
2376 reply.recycle();
2377 return res;
2378 }
2379 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2380 Uri uri, 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 data.writeString(targetPkg);
2386 uri.writeToParcel(data, 0);
2387 data.writeInt(mode);
2388 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2389 reply.readException();
2390 data.recycle();
2391 reply.recycle();
2392 }
2393 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2394 int mode) throws RemoteException {
2395 Parcel data = Parcel.obtain();
2396 Parcel reply = Parcel.obtain();
2397 data.writeInterfaceToken(IActivityManager.descriptor);
2398 data.writeStrongBinder(caller.asBinder());
2399 uri.writeToParcel(data, 0);
2400 data.writeInt(mode);
2401 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2402 reply.readException();
2403 data.recycle();
2404 reply.recycle();
2405 }
2406 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2407 throws RemoteException {
2408 Parcel data = Parcel.obtain();
2409 Parcel reply = Parcel.obtain();
2410 data.writeInterfaceToken(IActivityManager.descriptor);
2411 data.writeStrongBinder(who.asBinder());
2412 data.writeInt(waiting ? 1 : 0);
2413 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2414 reply.readException();
2415 data.recycle();
2416 reply.recycle();
2417 }
2418 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2419 Parcel data = Parcel.obtain();
2420 Parcel reply = Parcel.obtain();
2421 data.writeInterfaceToken(IActivityManager.descriptor);
2422 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2423 reply.readException();
2424 outInfo.readFromParcel(reply);
2425 data.recycle();
2426 reply.recycle();
2427 }
2428 public void unhandledBack() throws RemoteException
2429 {
2430 Parcel data = Parcel.obtain();
2431 Parcel reply = Parcel.obtain();
2432 data.writeInterfaceToken(IActivityManager.descriptor);
2433 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2434 reply.readException();
2435 data.recycle();
2436 reply.recycle();
2437 }
2438 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2439 {
2440 Parcel data = Parcel.obtain();
2441 Parcel reply = Parcel.obtain();
2442 data.writeInterfaceToken(IActivityManager.descriptor);
2443 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 ParcelFileDescriptor pfd = null;
2446 if (reply.readInt() != 0) {
2447 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2448 }
2449 data.recycle();
2450 reply.recycle();
2451 return pfd;
2452 }
2453 public void goingToSleep() throws RemoteException
2454 {
2455 Parcel data = Parcel.obtain();
2456 Parcel reply = Parcel.obtain();
2457 data.writeInterfaceToken(IActivityManager.descriptor);
2458 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2459 reply.readException();
2460 data.recycle();
2461 reply.recycle();
2462 }
2463 public void wakingUp() throws RemoteException
2464 {
2465 Parcel data = Parcel.obtain();
2466 Parcel reply = Parcel.obtain();
2467 data.writeInterfaceToken(IActivityManager.descriptor);
2468 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2469 reply.readException();
2470 data.recycle();
2471 reply.recycle();
2472 }
2473 public void setDebugApp(
2474 String packageName, boolean waitForDebugger, boolean persistent)
2475 throws RemoteException
2476 {
2477 Parcel data = Parcel.obtain();
2478 Parcel reply = Parcel.obtain();
2479 data.writeInterfaceToken(IActivityManager.descriptor);
2480 data.writeString(packageName);
2481 data.writeInt(waitForDebugger ? 1 : 0);
2482 data.writeInt(persistent ? 1 : 0);
2483 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 data.recycle();
2486 reply.recycle();
2487 }
2488 public void setAlwaysFinish(boolean enabled) throws RemoteException
2489 {
2490 Parcel data = Parcel.obtain();
2491 Parcel reply = Parcel.obtain();
2492 data.writeInterfaceToken(IActivityManager.descriptor);
2493 data.writeInt(enabled ? 1 : 0);
2494 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2495 reply.readException();
2496 data.recycle();
2497 reply.recycle();
2498 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002499 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 {
2501 Parcel data = Parcel.obtain();
2502 Parcel reply = Parcel.obtain();
2503 data.writeInterfaceToken(IActivityManager.descriptor);
2504 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002505 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002506 reply.readException();
2507 data.recycle();
2508 reply.recycle();
2509 }
2510 public void enterSafeMode() throws RemoteException {
2511 Parcel data = Parcel.obtain();
2512 data.writeInterfaceToken(IActivityManager.descriptor);
2513 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2514 data.recycle();
2515 }
2516 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2517 Parcel data = Parcel.obtain();
2518 data.writeStrongBinder(sender.asBinder());
2519 data.writeInterfaceToken(IActivityManager.descriptor);
2520 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2521 data.recycle();
2522 }
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002523 public boolean killPids(int[] pids, String reason) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002524 Parcel data = Parcel.obtain();
2525 Parcel reply = Parcel.obtain();
2526 data.writeInterfaceToken(IActivityManager.descriptor);
2527 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002528 data.writeString(reason);
2529 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002530 boolean res = reply.readInt() != 0;
2531 data.recycle();
2532 reply.recycle();
2533 return res;
2534 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002535 public void startRunning(String pkg, String cls, String action,
2536 String indata) throws RemoteException {
2537 Parcel data = Parcel.obtain();
2538 Parcel reply = Parcel.obtain();
2539 data.writeInterfaceToken(IActivityManager.descriptor);
2540 data.writeString(pkg);
2541 data.writeString(cls);
2542 data.writeString(action);
2543 data.writeString(indata);
2544 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2545 reply.readException();
2546 data.recycle();
2547 reply.recycle();
2548 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002549 public boolean testIsSystemReady()
2550 {
2551 /* this base class version is never called */
2552 return true;
2553 }
Dan Egnor60d87622009-12-16 16:32:58 -08002554 public void handleApplicationCrash(IBinder app,
2555 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2556 {
2557 Parcel data = Parcel.obtain();
2558 Parcel reply = Parcel.obtain();
2559 data.writeInterfaceToken(IActivityManager.descriptor);
2560 data.writeStrongBinder(app);
2561 crashInfo.writeToParcel(data, 0);
2562 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2563 reply.readException();
2564 reply.recycle();
2565 data.recycle();
2566 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002567
Dan Egnor60d87622009-12-16 16:32:58 -08002568 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002569 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002570 {
2571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002576 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002577 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002579 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002580 reply.recycle();
2581 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002582 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002584
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002585 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002586 int violationMask,
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002587 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2588 {
2589 Parcel data = Parcel.obtain();
2590 Parcel reply = Parcel.obtain();
2591 data.writeInterfaceToken(IActivityManager.descriptor);
2592 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002593 data.writeInt(violationMask);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002594 crashInfo.writeToParcel(data, 0);
2595 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2596 reply.readException();
2597 reply.recycle();
2598 data.recycle();
2599 }
2600
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002601 public void signalPersistentProcesses(int sig) throws RemoteException {
2602 Parcel data = Parcel.obtain();
2603 Parcel reply = Parcel.obtain();
2604 data.writeInterfaceToken(IActivityManager.descriptor);
2605 data.writeInt(sig);
2606 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2607 reply.readException();
2608 data.recycle();
2609 reply.recycle();
2610 }
2611
Dianne Hackborn03abb812010-01-04 18:43:19 -08002612 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 Parcel data = Parcel.obtain();
2614 Parcel reply = Parcel.obtain();
2615 data.writeInterfaceToken(IActivityManager.descriptor);
2616 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002617 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2618 reply.readException();
2619 data.recycle();
2620 reply.recycle();
2621 }
2622
2623 public void forceStopPackage(String packageName) throws RemoteException {
2624 Parcel data = Parcel.obtain();
2625 Parcel reply = Parcel.obtain();
2626 data.writeInterfaceToken(IActivityManager.descriptor);
2627 data.writeString(packageName);
2628 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002629 reply.readException();
2630 data.recycle();
2631 reply.recycle();
2632 }
2633
2634 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2635 {
2636 Parcel data = Parcel.obtain();
2637 Parcel reply = Parcel.obtain();
2638 data.writeInterfaceToken(IActivityManager.descriptor);
2639 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2640 reply.readException();
2641 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2642 reply.recycle();
2643 data.recycle();
2644 return res;
2645 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002646
2647 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002648 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002649 {
2650 Parcel data = Parcel.obtain();
2651 Parcel reply = Parcel.obtain();
2652 data.writeInterfaceToken(IActivityManager.descriptor);
2653 data.writeString(process);
2654 data.writeInt(start ? 1 : 0);
2655 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002656 if (fd != null) {
2657 data.writeInt(1);
2658 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2659 } else {
2660 data.writeInt(0);
2661 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002662 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2663 reply.readException();
2664 boolean res = reply.readInt() != 0;
2665 reply.recycle();
2666 data.recycle();
2667 return res;
2668 }
2669
Dianne Hackborn55280a92009-05-07 15:53:46 -07002670 public boolean shutdown(int timeout) throws RemoteException
2671 {
2672 Parcel data = Parcel.obtain();
2673 Parcel reply = Parcel.obtain();
2674 data.writeInterfaceToken(IActivityManager.descriptor);
2675 data.writeInt(timeout);
2676 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2677 reply.readException();
2678 boolean res = reply.readInt() != 0;
2679 reply.recycle();
2680 data.recycle();
2681 return res;
2682 }
2683
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002684 public void stopAppSwitches() throws RemoteException {
2685 Parcel data = Parcel.obtain();
2686 Parcel reply = Parcel.obtain();
2687 data.writeInterfaceToken(IActivityManager.descriptor);
2688 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 reply.recycle();
2691 data.recycle();
2692 }
2693
2694 public void resumeAppSwitches() throws RemoteException {
2695 Parcel data = Parcel.obtain();
2696 Parcel reply = Parcel.obtain();
2697 data.writeInterfaceToken(IActivityManager.descriptor);
2698 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2699 reply.readException();
2700 reply.recycle();
2701 data.recycle();
2702 }
2703
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002704 public void registerActivityWatcher(IActivityWatcher watcher)
2705 throws RemoteException {
2706 Parcel data = Parcel.obtain();
2707 Parcel reply = Parcel.obtain();
2708 data.writeInterfaceToken(IActivityManager.descriptor);
2709 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2710 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2711 reply.readException();
2712 data.recycle();
2713 reply.recycle();
2714 }
2715
2716 public void unregisterActivityWatcher(IActivityWatcher watcher)
2717 throws RemoteException {
2718 Parcel data = Parcel.obtain();
2719 Parcel reply = Parcel.obtain();
2720 data.writeInterfaceToken(IActivityManager.descriptor);
2721 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2722 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2723 reply.readException();
2724 data.recycle();
2725 reply.recycle();
2726 }
2727
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002728 public int startActivityInPackage(int uid,
2729 Intent intent, String resolvedType, IBinder resultTo,
2730 String resultWho, int requestCode, boolean onlyIfNeeded)
2731 throws RemoteException {
2732 Parcel data = Parcel.obtain();
2733 Parcel reply = Parcel.obtain();
2734 data.writeInterfaceToken(IActivityManager.descriptor);
2735 data.writeInt(uid);
2736 intent.writeToParcel(data, 0);
2737 data.writeString(resolvedType);
2738 data.writeStrongBinder(resultTo);
2739 data.writeString(resultWho);
2740 data.writeInt(requestCode);
2741 data.writeInt(onlyIfNeeded ? 1 : 0);
2742 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2743 reply.readException();
2744 int result = reply.readInt();
2745 reply.recycle();
2746 data.recycle();
2747 return result;
2748 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002749
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002750 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2751 Parcel data = Parcel.obtain();
2752 Parcel reply = Parcel.obtain();
2753 data.writeInterfaceToken(IActivityManager.descriptor);
2754 data.writeString(pkg);
2755 data.writeInt(uid);
2756 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2757 reply.readException();
2758 data.recycle();
2759 reply.recycle();
2760 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002761
2762 public void closeSystemDialogs(String reason) throws RemoteException {
2763 Parcel data = Parcel.obtain();
2764 Parcel reply = Parcel.obtain();
2765 data.writeInterfaceToken(IActivityManager.descriptor);
2766 data.writeString(reason);
2767 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2768 reply.readException();
2769 data.recycle();
2770 reply.recycle();
2771 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002772
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002773 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002774 throws RemoteException {
2775 Parcel data = Parcel.obtain();
2776 Parcel reply = Parcel.obtain();
2777 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002778 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002779 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
2780 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002781 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002782 data.recycle();
2783 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002784 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002785 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07002786
2787 public void killApplicationProcess(String processName, int uid) throws RemoteException {
2788 Parcel data = Parcel.obtain();
2789 Parcel reply = Parcel.obtain();
2790 data.writeInterfaceToken(IActivityManager.descriptor);
2791 data.writeString(processName);
2792 data.writeInt(uid);
2793 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
2794 reply.readException();
2795 data.recycle();
2796 reply.recycle();
2797 }
2798
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07002799 public void overridePendingTransition(IBinder token, String packageName,
2800 int enterAnim, int exitAnim) throws RemoteException {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeStrongBinder(token);
2805 data.writeString(packageName);
2806 data.writeInt(enterAnim);
2807 data.writeInt(exitAnim);
2808 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 data.recycle();
2811 reply.recycle();
2812 }
2813
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08002814 public boolean isUserAMonkey() throws RemoteException {
2815 Parcel data = Parcel.obtain();
2816 Parcel reply = Parcel.obtain();
2817 data.writeInterfaceToken(IActivityManager.descriptor);
2818 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
2819 reply.readException();
2820 boolean res = reply.readInt() != 0;
2821 data.recycle();
2822 reply.recycle();
2823 return res;
2824 }
2825
Dianne Hackborn860755f2010-06-03 18:47:52 -07002826 public void finishHeavyWeightApp() throws RemoteException {
2827 Parcel data = Parcel.obtain();
2828 Parcel reply = Parcel.obtain();
2829 data.writeInterfaceToken(IActivityManager.descriptor);
2830 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
2831 reply.readException();
2832 data.recycle();
2833 reply.recycle();
2834 }
2835
Daniel Sandler69a48172010-06-23 16:29:36 -04002836 public void setImmersive(IBinder token, boolean immersive)
2837 throws RemoteException {
2838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 data.writeStrongBinder(token);
2842 data.writeInt(immersive ? 1 : 0);
2843 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
2844 reply.readException();
2845 data.recycle();
2846 reply.recycle();
2847 }
2848
2849 public boolean isImmersive(IBinder token)
2850 throws RemoteException {
2851 Parcel data = Parcel.obtain();
2852 Parcel reply = Parcel.obtain();
2853 data.writeInterfaceToken(IActivityManager.descriptor);
2854 data.writeStrongBinder(token);
2855 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
2856 boolean res = reply.readInt() == 1;
2857 reply.readException();
2858 data.recycle();
2859 reply.recycle();
2860 return res;
2861 }
2862
2863 public boolean isTopActivityImmersive()
2864 throws RemoteException {
2865 Parcel data = Parcel.obtain();
2866 Parcel reply = Parcel.obtain();
2867 data.writeInterfaceToken(IActivityManager.descriptor);
2868 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
2869 boolean res = reply.readInt() == 1;
2870 reply.readException();
2871 data.recycle();
2872 reply.recycle();
2873 return res;
2874 }
2875
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07002876 public void crashApplication(int uid, int initialPid, String packageName,
2877 String message) throws RemoteException {
2878 Parcel data = Parcel.obtain();
2879 Parcel reply = Parcel.obtain();
2880 data.writeInterfaceToken(IActivityManager.descriptor);
2881 data.writeInt(uid);
2882 data.writeInt(initialPid);
2883 data.writeString(packageName);
2884 data.writeString(message);
2885 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
2886 reply.readException();
2887 data.recycle();
2888 reply.recycle();
2889 }
Andy McFadden824c5102010-07-09 16:26:57 -07002890
2891 public boolean dumpHeap(String process, boolean managed,
2892 String path, ParcelFileDescriptor fd) throws RemoteException {
2893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeString(process);
2897 data.writeInt(managed ? 1 : 0);
2898 data.writeString(path);
2899 if (fd != null) {
2900 data.writeInt(1);
2901 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2902 } else {
2903 data.writeInt(0);
2904 }
2905 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
2906 reply.readException();
2907 boolean res = reply.readInt() != 0;
2908 reply.recycle();
2909 data.recycle();
2910 return res;
2911 }
2912
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002913 private IBinder mRemote;
2914}