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