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