blob: a37b67f4dae5ec7f9e1633426f0165f50732ae1e [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.Intent;
21import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070022import android.content.IIntentSender;
23import android.content.IIntentReceiver;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
28import android.content.res.Configuration;
29import android.graphics.Bitmap;
30import android.net.Uri;
31import android.os.Binder;
32import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070033import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.os.Parcelable;
35import android.os.ParcelFileDescriptor;
36import android.os.RemoteException;
37import android.os.IBinder;
38import android.os.Parcel;
39import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070040import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080043import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import java.util.ArrayList;
46import java.util.List;
47
48/** {@hide} */
49public abstract class ActivityManagerNative extends Binder implements IActivityManager
50{
51 /**
52 * Cast a Binder object into an activity manager interface, generating
53 * a proxy if needed.
54 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080055 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 if (obj == null) {
57 return null;
58 }
59 IActivityManager in =
60 (IActivityManager)obj.queryLocalInterface(descriptor);
61 if (in != null) {
62 return in;
63 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 return new ActivityManagerProxy(obj);
66 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 /**
69 * Retrieve the system's default/global activity manager.
70 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080071 static public IActivityManager getDefault() {
72 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 }
74
75 /**
76 * Convenience for checking whether the system is ready. For internal use only.
77 */
78 static public boolean isSystemReady() {
79 if (!sSystemReady) {
80 sSystemReady = getDefault().testIsSystemReady();
81 }
82 return sSystemReady;
83 }
84 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080085
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 /**
87 * Convenience for sending a sticky broadcast. For internal use only.
88 * If you don't care about permission, use null.
89 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080090 static public void broadcastStickyIntent(Intent intent, String permission) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 try {
92 getDefault().broadcastIntent(
93 null, intent, null, null, Activity.RESULT_OK, null, null,
94 null /*permission*/, false, true);
95 } catch (RemoteException ex) {
96 }
97 }
98
99 static public void noteWakeupAlarm(PendingIntent ps) {
100 try {
101 getDefault().noteWakeupAlarm(ps.getTarget());
102 } catch (RemoteException ex) {
103 }
104 }
105
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800106 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 attachInterface(this, descriptor);
108 }
109
110 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
111 throws RemoteException {
112 switch (code) {
113 case START_ACTIVITY_TRANSACTION:
114 {
115 data.enforceInterface(IActivityManager.descriptor);
116 IBinder b = data.readStrongBinder();
117 IApplicationThread app = ApplicationThreadNative.asInterface(b);
118 Intent intent = Intent.CREATOR.createFromParcel(data);
119 String resolvedType = data.readString();
120 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
121 int grantedMode = data.readInt();
122 IBinder resultTo = data.readStrongBinder();
123 String resultWho = data.readString();
124 int requestCode = data.readInt();
125 boolean onlyIfNeeded = data.readInt() != 0;
126 boolean debug = data.readInt() != 0;
127 int result = startActivity(app, intent, resolvedType,
128 grantedUriPermissions, grantedMode, resultTo, resultWho,
129 requestCode, onlyIfNeeded, debug);
130 reply.writeNoException();
131 reply.writeInt(result);
132 return true;
133 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700134
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800135 case START_ACTIVITY_AND_WAIT_TRANSACTION:
136 {
137 data.enforceInterface(IActivityManager.descriptor);
138 IBinder b = data.readStrongBinder();
139 IApplicationThread app = ApplicationThreadNative.asInterface(b);
140 Intent intent = Intent.CREATOR.createFromParcel(data);
141 String resolvedType = data.readString();
142 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
143 int grantedMode = data.readInt();
144 IBinder resultTo = data.readStrongBinder();
145 String resultWho = data.readString();
146 int requestCode = data.readInt();
147 boolean onlyIfNeeded = data.readInt() != 0;
148 boolean debug = data.readInt() != 0;
149 WaitResult result = startActivityAndWait(app, intent, resolvedType,
150 grantedUriPermissions, grantedMode, resultTo, resultWho,
151 requestCode, onlyIfNeeded, debug);
152 reply.writeNoException();
153 result.writeToParcel(reply, 0);
154 return true;
155 }
156
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700157 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
158 {
159 data.enforceInterface(IActivityManager.descriptor);
160 IBinder b = data.readStrongBinder();
161 IApplicationThread app = ApplicationThreadNative.asInterface(b);
162 Intent intent = Intent.CREATOR.createFromParcel(data);
163 String resolvedType = data.readString();
164 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
165 int grantedMode = data.readInt();
166 IBinder resultTo = data.readStrongBinder();
167 String resultWho = data.readString();
168 int requestCode = data.readInt();
169 boolean onlyIfNeeded = data.readInt() != 0;
170 boolean debug = data.readInt() != 0;
171 Configuration config = Configuration.CREATOR.createFromParcel(data);
172 int result = startActivityWithConfig(app, intent, resolvedType,
173 grantedUriPermissions, grantedMode, resultTo, resultWho,
174 requestCode, onlyIfNeeded, debug, config);
175 reply.writeNoException();
176 reply.writeInt(result);
177 return true;
178 }
179
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700180 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700181 {
182 data.enforceInterface(IActivityManager.descriptor);
183 IBinder b = data.readStrongBinder();
184 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700185 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700186 Intent fillInIntent = null;
187 if (data.readInt() != 0) {
188 fillInIntent = Intent.CREATOR.createFromParcel(data);
189 }
190 String resolvedType = data.readString();
191 IBinder resultTo = data.readStrongBinder();
192 String resultWho = data.readString();
193 int requestCode = data.readInt();
194 int flagsMask = data.readInt();
195 int flagsValues = data.readInt();
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700196 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700197 fillInIntent, resolvedType, resultTo, resultWho,
198 requestCode, flagsMask, flagsValues);
199 reply.writeNoException();
200 reply.writeInt(result);
201 return true;
202 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800203
204 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
205 {
206 data.enforceInterface(IActivityManager.descriptor);
207 IBinder callingActivity = data.readStrongBinder();
208 Intent intent = Intent.CREATOR.createFromParcel(data);
209 boolean result = startNextMatchingActivity(callingActivity, intent);
210 reply.writeNoException();
211 reply.writeInt(result ? 1 : 0);
212 return true;
213 }
214
215 case FINISH_ACTIVITY_TRANSACTION: {
216 data.enforceInterface(IActivityManager.descriptor);
217 IBinder token = data.readStrongBinder();
218 Intent resultData = null;
219 int resultCode = data.readInt();
220 if (data.readInt() != 0) {
221 resultData = Intent.CREATOR.createFromParcel(data);
222 }
223 boolean res = finishActivity(token, resultCode, resultData);
224 reply.writeNoException();
225 reply.writeInt(res ? 1 : 0);
226 return true;
227 }
228
229 case FINISH_SUB_ACTIVITY_TRANSACTION: {
230 data.enforceInterface(IActivityManager.descriptor);
231 IBinder token = data.readStrongBinder();
232 String resultWho = data.readString();
233 int requestCode = data.readInt();
234 finishSubActivity(token, resultWho, requestCode);
235 reply.writeNoException();
236 return true;
237 }
238
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800239 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
240 data.enforceInterface(IActivityManager.descriptor);
241 IBinder token = data.readStrongBinder();
242 boolean res = willActivityBeVisible(token);
243 reply.writeNoException();
244 reply.writeInt(res ? 1 : 0);
245 return true;
246 }
247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 case REGISTER_RECEIVER_TRANSACTION:
249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 IBinder b = data.readStrongBinder();
252 IApplicationThread app =
253 b != null ? ApplicationThreadNative.asInterface(b) : null;
254 b = data.readStrongBinder();
255 IIntentReceiver rec
256 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
257 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
258 String perm = data.readString();
259 Intent intent = registerReceiver(app, rec, filter, perm);
260 reply.writeNoException();
261 if (intent != null) {
262 reply.writeInt(1);
263 intent.writeToParcel(reply, 0);
264 } else {
265 reply.writeInt(0);
266 }
267 return true;
268 }
269
270 case UNREGISTER_RECEIVER_TRANSACTION:
271 {
272 data.enforceInterface(IActivityManager.descriptor);
273 IBinder b = data.readStrongBinder();
274 if (b == null) {
275 return true;
276 }
277 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
278 unregisterReceiver(rec);
279 reply.writeNoException();
280 return true;
281 }
282
283 case BROADCAST_INTENT_TRANSACTION:
284 {
285 data.enforceInterface(IActivityManager.descriptor);
286 IBinder b = data.readStrongBinder();
287 IApplicationThread app =
288 b != null ? ApplicationThreadNative.asInterface(b) : null;
289 Intent intent = Intent.CREATOR.createFromParcel(data);
290 String resolvedType = data.readString();
291 b = data.readStrongBinder();
292 IIntentReceiver resultTo =
293 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
294 int resultCode = data.readInt();
295 String resultData = data.readString();
296 Bundle resultExtras = data.readBundle();
297 String perm = data.readString();
298 boolean serialized = data.readInt() != 0;
299 boolean sticky = data.readInt() != 0;
300 int res = broadcastIntent(app, intent, resolvedType, resultTo,
301 resultCode, resultData, resultExtras, perm,
302 serialized, sticky);
303 reply.writeNoException();
304 reply.writeInt(res);
305 return true;
306 }
307
308 case UNBROADCAST_INTENT_TRANSACTION:
309 {
310 data.enforceInterface(IActivityManager.descriptor);
311 IBinder b = data.readStrongBinder();
312 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
313 Intent intent = Intent.CREATOR.createFromParcel(data);
314 unbroadcastIntent(app, intent);
315 reply.writeNoException();
316 return true;
317 }
318
319 case FINISH_RECEIVER_TRANSACTION: {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder who = data.readStrongBinder();
322 int resultCode = data.readInt();
323 String resultData = data.readString();
324 Bundle resultExtras = data.readBundle();
325 boolean resultAbort = data.readInt() != 0;
326 if (who != null) {
327 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
328 }
329 reply.writeNoException();
330 return true;
331 }
332
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800333 case ATTACH_APPLICATION_TRANSACTION: {
334 data.enforceInterface(IActivityManager.descriptor);
335 IApplicationThread app = ApplicationThreadNative.asInterface(
336 data.readStrongBinder());
337 if (app != null) {
338 attachApplication(app);
339 }
340 reply.writeNoException();
341 return true;
342 }
343
344 case ACTIVITY_IDLE_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700347 Configuration config = null;
348 if (data.readInt() != 0) {
349 config = Configuration.CREATOR.createFromParcel(data);
350 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 if (token != null) {
Dianne Hackborne88846e2009-09-30 21:34:25 -0700352 activityIdle(token, config);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 }
354 reply.writeNoException();
355 return true;
356 }
357
358 case ACTIVITY_PAUSED_TRANSACTION: {
359 data.enforceInterface(IActivityManager.descriptor);
360 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800361 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 reply.writeNoException();
363 return true;
364 }
365
366 case ACTIVITY_STOPPED_TRANSACTION: {
367 data.enforceInterface(IActivityManager.descriptor);
368 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800369 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800370 Bitmap thumbnail = data.readInt() != 0
371 ? Bitmap.CREATOR.createFromParcel(data) : null;
372 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800373 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800374 reply.writeNoException();
375 return true;
376 }
377
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800378 case ACTIVITY_SLEPT_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder token = data.readStrongBinder();
381 activitySlept(token);
382 reply.writeNoException();
383 return true;
384 }
385
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 case ACTIVITY_DESTROYED_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
389 activityDestroyed(token);
390 reply.writeNoException();
391 return true;
392 }
393
394 case GET_CALLING_PACKAGE_TRANSACTION: {
395 data.enforceInterface(IActivityManager.descriptor);
396 IBinder token = data.readStrongBinder();
397 String res = token != null ? getCallingPackage(token) : null;
398 reply.writeNoException();
399 reply.writeString(res);
400 return true;
401 }
402
403 case GET_CALLING_ACTIVITY_TRANSACTION: {
404 data.enforceInterface(IActivityManager.descriptor);
405 IBinder token = data.readStrongBinder();
406 ComponentName cn = getCallingActivity(token);
407 reply.writeNoException();
408 ComponentName.writeToParcel(cn, reply);
409 return true;
410 }
411
412 case GET_TASKS_TRANSACTION: {
413 data.enforceInterface(IActivityManager.descriptor);
414 int maxNum = data.readInt();
415 int fl = data.readInt();
416 IBinder receiverBinder = data.readStrongBinder();
417 IThumbnailReceiver receiver = receiverBinder != null
418 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
419 : null;
420 List list = getTasks(maxNum, fl, receiver);
421 reply.writeNoException();
422 int N = list != null ? list.size() : -1;
423 reply.writeInt(N);
424 int i;
425 for (i=0; i<N; i++) {
426 ActivityManager.RunningTaskInfo info =
427 (ActivityManager.RunningTaskInfo)list.get(i);
428 info.writeToParcel(reply, 0);
429 }
430 return true;
431 }
432
433 case GET_RECENT_TASKS_TRANSACTION: {
434 data.enforceInterface(IActivityManager.descriptor);
435 int maxNum = data.readInt();
436 int fl = data.readInt();
437 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
438 fl);
439 reply.writeNoException();
440 reply.writeTypedList(list);
441 return true;
442 }
443
Dianne Hackbornd94df452011-02-16 18:53:31 -0800444 case GET_TASK_THUMBNAIL_TRANSACTION: {
445 data.enforceInterface(IActivityManager.descriptor);
446 int id = data.readInt();
447 Bitmap bm = getTaskThumbnail(id);
448 reply.writeNoException();
449 if (bm != null) {
450 reply.writeInt(1);
451 bm.writeToParcel(reply, 0);
452 } else {
453 reply.writeInt(0);
454 }
455 return true;
456 }
457
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800458 case GET_SERVICES_TRANSACTION: {
459 data.enforceInterface(IActivityManager.descriptor);
460 int maxNum = data.readInt();
461 int fl = data.readInt();
462 List list = getServices(maxNum, fl);
463 reply.writeNoException();
464 int N = list != null ? list.size() : -1;
465 reply.writeInt(N);
466 int i;
467 for (i=0; i<N; i++) {
468 ActivityManager.RunningServiceInfo info =
469 (ActivityManager.RunningServiceInfo)list.get(i);
470 info.writeToParcel(reply, 0);
471 }
472 return true;
473 }
474
475 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
478 reply.writeNoException();
479 reply.writeTypedList(list);
480 return true;
481 }
482
483 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
486 reply.writeNoException();
487 reply.writeTypedList(list);
488 return true;
489 }
490
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700491 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 List<ApplicationInfo> list = getRunningExternalApplications();
494 reply.writeNoException();
495 reply.writeTypedList(list);
496 return true;
497 }
498
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 case MOVE_TASK_TO_FRONT_TRANSACTION: {
500 data.enforceInterface(IActivityManager.descriptor);
501 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800502 int fl = data.readInt();
503 moveTaskToFront(task, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800504 reply.writeNoException();
505 return true;
506 }
507
508 case MOVE_TASK_TO_BACK_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 int task = data.readInt();
511 moveTaskToBack(task);
512 reply.writeNoException();
513 return true;
514 }
515
516 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 IBinder token = data.readStrongBinder();
519 boolean nonRoot = data.readInt() != 0;
520 boolean res = moveActivityTaskToBack(token, nonRoot);
521 reply.writeNoException();
522 reply.writeInt(res ? 1 : 0);
523 return true;
524 }
525
526 case MOVE_TASK_BACKWARDS_TRANSACTION: {
527 data.enforceInterface(IActivityManager.descriptor);
528 int task = data.readInt();
529 moveTaskBackwards(task);
530 reply.writeNoException();
531 return true;
532 }
533
534 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
535 data.enforceInterface(IActivityManager.descriptor);
536 IBinder token = data.readStrongBinder();
537 boolean onlyRoot = data.readInt() != 0;
538 int res = token != null
539 ? getTaskForActivity(token, onlyRoot) : -1;
540 reply.writeNoException();
541 reply.writeInt(res);
542 return true;
543 }
544
545 case FINISH_OTHER_INSTANCES_TRANSACTION: {
546 data.enforceInterface(IActivityManager.descriptor);
547 IBinder token = data.readStrongBinder();
548 ComponentName className = ComponentName.readFromParcel(data);
549 finishOtherInstances(token, className);
550 reply.writeNoException();
551 return true;
552 }
553
554 case REPORT_THUMBNAIL_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 IBinder token = data.readStrongBinder();
557 Bitmap thumbnail = data.readInt() != 0
558 ? Bitmap.CREATOR.createFromParcel(data) : null;
559 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
560 reportThumbnail(token, thumbnail, description);
561 reply.writeNoException();
562 return true;
563 }
564
565 case GET_CONTENT_PROVIDER_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 IBinder b = data.readStrongBinder();
568 IApplicationThread app = ApplicationThreadNative.asInterface(b);
569 String name = data.readString();
570 ContentProviderHolder cph = getContentProvider(app, name);
571 reply.writeNoException();
572 if (cph != null) {
573 reply.writeInt(1);
574 cph.writeToParcel(reply, 0);
575 } else {
576 reply.writeInt(0);
577 }
578 return true;
579 }
580
581 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
582 data.enforceInterface(IActivityManager.descriptor);
583 IBinder b = data.readStrongBinder();
584 IApplicationThread app = ApplicationThreadNative.asInterface(b);
585 ArrayList<ContentProviderHolder> providers =
586 data.createTypedArrayList(ContentProviderHolder.CREATOR);
587 publishContentProviders(app, providers);
588 reply.writeNoException();
589 return true;
590 }
591
592 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
593 data.enforceInterface(IActivityManager.descriptor);
594 IBinder b = data.readStrongBinder();
595 IApplicationThread app = ApplicationThreadNative.asInterface(b);
596 String name = data.readString();
597 removeContentProvider(app, name);
598 reply.writeNoException();
599 return true;
600 }
601
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700602 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
603 data.enforceInterface(IActivityManager.descriptor);
604 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
605 PendingIntent pi = getRunningServiceControlPanel(comp);
606 reply.writeNoException();
607 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
608 return true;
609 }
610
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800611 case START_SERVICE_TRANSACTION: {
612 data.enforceInterface(IActivityManager.descriptor);
613 IBinder b = data.readStrongBinder();
614 IApplicationThread app = ApplicationThreadNative.asInterface(b);
615 Intent service = Intent.CREATOR.createFromParcel(data);
616 String resolvedType = data.readString();
617 ComponentName cn = startService(app, service, resolvedType);
618 reply.writeNoException();
619 ComponentName.writeToParcel(cn, reply);
620 return true;
621 }
622
623 case STOP_SERVICE_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 IBinder b = data.readStrongBinder();
626 IApplicationThread app = ApplicationThreadNative.asInterface(b);
627 Intent service = Intent.CREATOR.createFromParcel(data);
628 String resolvedType = data.readString();
629 int res = stopService(app, service, resolvedType);
630 reply.writeNoException();
631 reply.writeInt(res);
632 return true;
633 }
634
635 case STOP_SERVICE_TOKEN_TRANSACTION: {
636 data.enforceInterface(IActivityManager.descriptor);
637 ComponentName className = ComponentName.readFromParcel(data);
638 IBinder token = data.readStrongBinder();
639 int startId = data.readInt();
640 boolean res = stopServiceToken(className, token, startId);
641 reply.writeNoException();
642 reply.writeInt(res ? 1 : 0);
643 return true;
644 }
645
646 case SET_SERVICE_FOREGROUND_TRANSACTION: {
647 data.enforceInterface(IActivityManager.descriptor);
648 ComponentName className = ComponentName.readFromParcel(data);
649 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700650 int id = data.readInt();
651 Notification notification = null;
652 if (data.readInt() != 0) {
653 notification = Notification.CREATOR.createFromParcel(data);
654 }
655 boolean removeNotification = data.readInt() != 0;
656 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800657 reply.writeNoException();
658 return true;
659 }
660
661 case BIND_SERVICE_TRANSACTION: {
662 data.enforceInterface(IActivityManager.descriptor);
663 IBinder b = data.readStrongBinder();
664 IApplicationThread app = ApplicationThreadNative.asInterface(b);
665 IBinder token = data.readStrongBinder();
666 Intent service = Intent.CREATOR.createFromParcel(data);
667 String resolvedType = data.readString();
668 b = data.readStrongBinder();
669 int fl = data.readInt();
670 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
671 int res = bindService(app, token, service, resolvedType, conn, fl);
672 reply.writeNoException();
673 reply.writeInt(res);
674 return true;
675 }
676
677 case UNBIND_SERVICE_TRANSACTION: {
678 data.enforceInterface(IActivityManager.descriptor);
679 IBinder b = data.readStrongBinder();
680 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
681 boolean res = unbindService(conn);
682 reply.writeNoException();
683 reply.writeInt(res ? 1 : 0);
684 return true;
685 }
686
687 case PUBLISH_SERVICE_TRANSACTION: {
688 data.enforceInterface(IActivityManager.descriptor);
689 IBinder token = data.readStrongBinder();
690 Intent intent = Intent.CREATOR.createFromParcel(data);
691 IBinder service = data.readStrongBinder();
692 publishService(token, intent, service);
693 reply.writeNoException();
694 return true;
695 }
696
697 case UNBIND_FINISHED_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 IBinder token = data.readStrongBinder();
700 Intent intent = Intent.CREATOR.createFromParcel(data);
701 boolean doRebind = data.readInt() != 0;
702 unbindFinished(token, intent, doRebind);
703 reply.writeNoException();
704 return true;
705 }
706
707 case SERVICE_DONE_EXECUTING_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700710 int type = data.readInt();
711 int startId = data.readInt();
712 int res = data.readInt();
713 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800714 reply.writeNoException();
715 return true;
716 }
717
718 case START_INSTRUMENTATION_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 ComponentName className = ComponentName.readFromParcel(data);
721 String profileFile = data.readString();
722 int fl = data.readInt();
723 Bundle arguments = data.readBundle();
724 IBinder b = data.readStrongBinder();
725 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
726 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
727 reply.writeNoException();
728 reply.writeInt(res ? 1 : 0);
729 return true;
730 }
731
732
733 case FINISH_INSTRUMENTATION_TRANSACTION: {
734 data.enforceInterface(IActivityManager.descriptor);
735 IBinder b = data.readStrongBinder();
736 IApplicationThread app = ApplicationThreadNative.asInterface(b);
737 int resultCode = data.readInt();
738 Bundle results = data.readBundle();
739 finishInstrumentation(app, resultCode, results);
740 reply.writeNoException();
741 return true;
742 }
743
744 case GET_CONFIGURATION_TRANSACTION: {
745 data.enforceInterface(IActivityManager.descriptor);
746 Configuration config = getConfiguration();
747 reply.writeNoException();
748 config.writeToParcel(reply, 0);
749 return true;
750 }
751
752 case UPDATE_CONFIGURATION_TRANSACTION: {
753 data.enforceInterface(IActivityManager.descriptor);
754 Configuration config = Configuration.CREATOR.createFromParcel(data);
755 updateConfiguration(config);
756 reply.writeNoException();
757 return true;
758 }
759
760 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 IBinder token = data.readStrongBinder();
763 int requestedOrientation = data.readInt();
764 setRequestedOrientation(token, requestedOrientation);
765 reply.writeNoException();
766 return true;
767 }
768
769 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
770 data.enforceInterface(IActivityManager.descriptor);
771 IBinder token = data.readStrongBinder();
772 int req = getRequestedOrientation(token);
773 reply.writeNoException();
774 reply.writeInt(req);
775 return true;
776 }
777
778 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
779 data.enforceInterface(IActivityManager.descriptor);
780 IBinder token = data.readStrongBinder();
781 ComponentName cn = getActivityClassForToken(token);
782 reply.writeNoException();
783 ComponentName.writeToParcel(cn, reply);
784 return true;
785 }
786
787 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
788 data.enforceInterface(IActivityManager.descriptor);
789 IBinder token = data.readStrongBinder();
790 reply.writeNoException();
791 reply.writeString(getPackageForToken(token));
792 return true;
793 }
794
795 case GET_INTENT_SENDER_TRANSACTION: {
796 data.enforceInterface(IActivityManager.descriptor);
797 int type = data.readInt();
798 String packageName = data.readString();
799 IBinder token = data.readStrongBinder();
800 String resultWho = data.readString();
801 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800802 Intent[] requestIntents;
803 String[] requestResolvedTypes;
804 if (data.readInt() != 0) {
805 requestIntents = data.createTypedArray(Intent.CREATOR);
806 requestResolvedTypes = data.createStringArray();
807 } else {
808 requestIntents = null;
809 requestResolvedTypes = null;
810 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 int fl = data.readInt();
812 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800813 resultWho, requestCode, requestIntents,
814 requestResolvedTypes, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800815 reply.writeNoException();
816 reply.writeStrongBinder(res != null ? res.asBinder() : null);
817 return true;
818 }
819
820 case CANCEL_INTENT_SENDER_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IIntentSender r = IIntentSender.Stub.asInterface(
823 data.readStrongBinder());
824 cancelIntentSender(r);
825 reply.writeNoException();
826 return true;
827 }
828
829 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
830 data.enforceInterface(IActivityManager.descriptor);
831 IIntentSender r = IIntentSender.Stub.asInterface(
832 data.readStrongBinder());
833 String res = getPackageForIntentSender(r);
834 reply.writeNoException();
835 reply.writeString(res);
836 return true;
837 }
838
839 case SET_PROCESS_LIMIT_TRANSACTION: {
840 data.enforceInterface(IActivityManager.descriptor);
841 int max = data.readInt();
842 setProcessLimit(max);
843 reply.writeNoException();
844 return true;
845 }
846
847 case GET_PROCESS_LIMIT_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 int limit = getProcessLimit();
850 reply.writeNoException();
851 reply.writeInt(limit);
852 return true;
853 }
854
855 case SET_PROCESS_FOREGROUND_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder token = data.readStrongBinder();
858 int pid = data.readInt();
859 boolean isForeground = data.readInt() != 0;
860 setProcessForeground(token, pid, isForeground);
861 reply.writeNoException();
862 return true;
863 }
864
865 case CHECK_PERMISSION_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 String perm = data.readString();
868 int pid = data.readInt();
869 int uid = data.readInt();
870 int res = checkPermission(perm, pid, uid);
871 reply.writeNoException();
872 reply.writeInt(res);
873 return true;
874 }
875
876 case CHECK_URI_PERMISSION_TRANSACTION: {
877 data.enforceInterface(IActivityManager.descriptor);
878 Uri uri = Uri.CREATOR.createFromParcel(data);
879 int pid = data.readInt();
880 int uid = data.readInt();
881 int mode = data.readInt();
882 int res = checkUriPermission(uri, pid, uid, mode);
883 reply.writeNoException();
884 reply.writeInt(res);
885 return true;
886 }
887
888 case CLEAR_APP_DATA_TRANSACTION: {
889 data.enforceInterface(IActivityManager.descriptor);
890 String packageName = data.readString();
891 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
892 data.readStrongBinder());
893 boolean res = clearApplicationUserData(packageName, observer);
894 reply.writeNoException();
895 reply.writeInt(res ? 1 : 0);
896 return true;
897 }
898
899 case GRANT_URI_PERMISSION_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder b = data.readStrongBinder();
902 IApplicationThread app = ApplicationThreadNative.asInterface(b);
903 String targetPkg = data.readString();
904 Uri uri = Uri.CREATOR.createFromParcel(data);
905 int mode = data.readInt();
906 grantUriPermission(app, targetPkg, uri, mode);
907 reply.writeNoException();
908 return true;
909 }
910
911 case REVOKE_URI_PERMISSION_TRANSACTION: {
912 data.enforceInterface(IActivityManager.descriptor);
913 IBinder b = data.readStrongBinder();
914 IApplicationThread app = ApplicationThreadNative.asInterface(b);
915 Uri uri = Uri.CREATOR.createFromParcel(data);
916 int mode = data.readInt();
917 revokeUriPermission(app, uri, mode);
918 reply.writeNoException();
919 return true;
920 }
921
922 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
923 data.enforceInterface(IActivityManager.descriptor);
924 IBinder b = data.readStrongBinder();
925 IApplicationThread app = ApplicationThreadNative.asInterface(b);
926 boolean waiting = data.readInt() != 0;
927 showWaitingForDebugger(app, waiting);
928 reply.writeNoException();
929 return true;
930 }
931
932 case GET_MEMORY_INFO_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
935 getMemoryInfo(mi);
936 reply.writeNoException();
937 mi.writeToParcel(reply, 0);
938 return true;
939 }
940
941 case UNHANDLED_BACK_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 unhandledBack();
944 reply.writeNoException();
945 return true;
946 }
947
948 case OPEN_CONTENT_URI_TRANSACTION: {
949 data.enforceInterface(IActivityManager.descriptor);
950 Uri uri = Uri.parse(data.readString());
951 ParcelFileDescriptor pfd = openContentUri(uri);
952 reply.writeNoException();
953 if (pfd != null) {
954 reply.writeInt(1);
955 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
956 } else {
957 reply.writeInt(0);
958 }
959 return true;
960 }
961
962 case GOING_TO_SLEEP_TRANSACTION: {
963 data.enforceInterface(IActivityManager.descriptor);
964 goingToSleep();
965 reply.writeNoException();
966 return true;
967 }
968
969 case WAKING_UP_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 wakingUp();
972 reply.writeNoException();
973 return true;
974 }
975
976 case SET_DEBUG_APP_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 String pn = data.readString();
979 boolean wfd = data.readInt() != 0;
980 boolean per = data.readInt() != 0;
981 setDebugApp(pn, wfd, per);
982 reply.writeNoException();
983 return true;
984 }
985
986 case SET_ALWAYS_FINISH_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 boolean enabled = data.readInt() != 0;
989 setAlwaysFinish(enabled);
990 reply.writeNoException();
991 return true;
992 }
993
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700994 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800995 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700996 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800997 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700998 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 return true;
1000 }
1001
1002 case ENTER_SAFE_MODE_TRANSACTION: {
1003 data.enforceInterface(IActivityManager.descriptor);
1004 enterSafeMode();
1005 reply.writeNoException();
1006 return true;
1007 }
1008
1009 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1010 data.enforceInterface(IActivityManager.descriptor);
1011 IIntentSender is = IIntentSender.Stub.asInterface(
1012 data.readStrongBinder());
1013 noteWakeupAlarm(is);
1014 reply.writeNoException();
1015 return true;
1016 }
1017
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001018 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 data.enforceInterface(IActivityManager.descriptor);
1020 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001021 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001022 boolean secure = data.readInt() != 0;
1023 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 reply.writeNoException();
1025 reply.writeInt(res ? 1 : 0);
1026 return true;
1027 }
1028
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 case START_RUNNING_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 String pkg = data.readString();
1032 String cls = data.readString();
1033 String action = data.readString();
1034 String indata = data.readString();
1035 startRunning(pkg, cls, action, indata);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
Dan Egnor60d87622009-12-16 16:32:58 -08001040 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder app = data.readStrongBinder();
1043 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1044 handleApplicationCrash(app, ci);
1045 reply.writeNoException();
1046 return true;
1047 }
1048
1049 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001050 data.enforceInterface(IActivityManager.descriptor);
1051 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001052 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001053 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001054 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001056 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001057 return true;
1058 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001059
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001060 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1061 data.enforceInterface(IActivityManager.descriptor);
1062 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001063 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001064 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1065 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001066 reply.writeNoException();
1067 return true;
1068 }
1069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001070 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 int sig = data.readInt();
1073 signalPersistentProcesses(sig);
1074 reply.writeNoException();
1075 return true;
1076 }
1077
Dianne Hackborn03abb812010-01-04 18:43:19 -08001078 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1079 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001080 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001081 killBackgroundProcesses(packageName);
1082 reply.writeNoException();
1083 return true;
1084 }
1085
1086 case FORCE_STOP_PACKAGE_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 String packageName = data.readString();
1089 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 reply.writeNoException();
1091 return true;
1092 }
1093
1094 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 ConfigurationInfo config = getDeviceConfigurationInfo();
1097 reply.writeNoException();
1098 config.writeToParcel(reply, 0);
1099 return true;
1100 }
1101
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001102 case PROFILE_CONTROL_TRANSACTION: {
1103 data.enforceInterface(IActivityManager.descriptor);
1104 String process = data.readString();
1105 boolean start = data.readInt() != 0;
1106 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001107 ParcelFileDescriptor fd = data.readInt() != 0
1108 ? data.readFileDescriptor() : null;
1109 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001110 reply.writeNoException();
1111 reply.writeInt(res ? 1 : 0);
1112 return true;
1113 }
1114
Dianne Hackborn55280a92009-05-07 15:53:46 -07001115 case SHUTDOWN_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 boolean res = shutdown(data.readInt());
1118 reply.writeNoException();
1119 reply.writeInt(res ? 1 : 0);
1120 return true;
1121 }
1122
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001123 case STOP_APP_SWITCHES_TRANSACTION: {
1124 data.enforceInterface(IActivityManager.descriptor);
1125 stopAppSwitches();
1126 reply.writeNoException();
1127 return true;
1128 }
1129
1130 case RESUME_APP_SWITCHES_TRANSACTION: {
1131 data.enforceInterface(IActivityManager.descriptor);
1132 resumeAppSwitches();
1133 reply.writeNoException();
1134 return true;
1135 }
1136
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001137 case PEEK_SERVICE_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 Intent service = Intent.CREATOR.createFromParcel(data);
1140 String resolvedType = data.readString();
1141 IBinder binder = peekService(service, resolvedType);
1142 reply.writeNoException();
1143 reply.writeStrongBinder(binder);
1144 return true;
1145 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001146
1147 case START_BACKUP_AGENT_TRANSACTION: {
1148 data.enforceInterface(IActivityManager.descriptor);
1149 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1150 int backupRestoreMode = data.readInt();
1151 boolean success = bindBackupAgent(info, backupRestoreMode);
1152 reply.writeNoException();
1153 reply.writeInt(success ? 1 : 0);
1154 return true;
1155 }
1156
1157 case BACKUP_AGENT_CREATED_TRANSACTION: {
1158 data.enforceInterface(IActivityManager.descriptor);
1159 String packageName = data.readString();
1160 IBinder agent = data.readStrongBinder();
1161 backupAgentCreated(packageName, agent);
1162 reply.writeNoException();
1163 return true;
1164 }
1165
1166 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1167 data.enforceInterface(IActivityManager.descriptor);
1168 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1169 unbindBackupAgent(info);
1170 reply.writeNoException();
1171 return true;
1172 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001173
1174 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1175 data.enforceInterface(IActivityManager.descriptor);
1176 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1177 data.readStrongBinder());
1178 registerActivityWatcher(watcher);
1179 return true;
1180 }
1181
1182 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1185 data.readStrongBinder());
1186 unregisterActivityWatcher(watcher);
1187 return true;
1188 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001189
1190 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1191 {
1192 data.enforceInterface(IActivityManager.descriptor);
1193 int uid = data.readInt();
1194 Intent intent = Intent.CREATOR.createFromParcel(data);
1195 String resolvedType = data.readString();
1196 IBinder resultTo = data.readStrongBinder();
1197 String resultWho = data.readString();
1198 int requestCode = data.readInt();
1199 boolean onlyIfNeeded = data.readInt() != 0;
1200 int result = startActivityInPackage(uid, intent, resolvedType,
1201 resultTo, resultWho, requestCode, onlyIfNeeded);
1202 reply.writeNoException();
1203 reply.writeInt(result);
1204 return true;
1205 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001206
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001207 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 String pkg = data.readString();
1210 int uid = data.readInt();
1211 killApplicationWithUid(pkg, uid);
1212 reply.writeNoException();
1213 return true;
1214 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001215
1216 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 String reason = data.readString();
1219 closeSystemDialogs(reason);
1220 reply.writeNoException();
1221 return true;
1222 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001223
1224 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1225 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001226 int[] pids = data.createIntArray();
1227 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001228 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001229 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001230 return true;
1231 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001232
1233 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1234 data.enforceInterface(IActivityManager.descriptor);
1235 String processName = data.readString();
1236 int uid = data.readInt();
1237 killApplicationProcess(processName, uid);
1238 reply.writeNoException();
1239 return true;
1240 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001241
1242 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 IBinder token = data.readStrongBinder();
1245 String packageName = data.readString();
1246 int enterAnim = data.readInt();
1247 int exitAnim = data.readInt();
1248 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001249 reply.writeNoException();
1250 return true;
1251 }
1252
1253 case IS_USER_A_MONKEY_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001255 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001256 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001257 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001258 return true;
1259 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001260
1261 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 finishHeavyWeightApp();
1264 reply.writeNoException();
1265 return true;
1266 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001267
1268 case IS_IMMERSIVE_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001271 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001272 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001273 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001274 return true;
1275 }
1276
1277 case SET_IMMERSIVE_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 IBinder token = data.readStrongBinder();
1280 boolean imm = data.readInt() == 1;
1281 setImmersive(token, imm);
1282 reply.writeNoException();
1283 return true;
1284 }
1285
1286 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001288 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001289 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001290 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001291 return true;
1292 }
1293
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001294 case CRASH_APPLICATION_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 int uid = data.readInt();
1297 int initialPid = data.readInt();
1298 String packageName = data.readString();
1299 String message = data.readString();
1300 crashApplication(uid, initialPid, packageName, message);
1301 reply.writeNoException();
1302 return true;
1303 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001304
1305 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 Uri uri = Uri.CREATOR.createFromParcel(data);
1308 String type = getProviderMimeType(uri);
1309 reply.writeNoException();
1310 reply.writeString(type);
1311 return true;
1312 }
1313
Dianne Hackborn7e269642010-08-25 19:50:20 -07001314 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
1316 String name = data.readString();
1317 IBinder perm = newUriPermissionOwner(name);
1318 reply.writeNoException();
1319 reply.writeStrongBinder(perm);
1320 return true;
1321 }
1322
1323 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 IBinder owner = data.readStrongBinder();
1326 int fromUid = data.readInt();
1327 String targetPkg = data.readString();
1328 Uri uri = Uri.CREATOR.createFromParcel(data);
1329 int mode = data.readInt();
1330 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1331 reply.writeNoException();
1332 return true;
1333 }
1334
1335 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 IBinder owner = data.readStrongBinder();
1338 Uri uri = null;
1339 if (data.readInt() != 0) {
1340 Uri.CREATOR.createFromParcel(data);
1341 }
1342 int mode = data.readInt();
1343 revokeUriPermissionFromOwner(owner, uri, mode);
1344 reply.writeNoException();
1345 return true;
1346 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001347
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001348 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 int callingUid = data.readInt();
1351 String targetPkg = data.readString();
1352 Uri uri = Uri.CREATOR.createFromParcel(data);
1353 int modeFlags = data.readInt();
1354 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1355 reply.writeNoException();
1356 reply.writeInt(res);
1357 return true;
1358 }
1359
Andy McFadden824c5102010-07-09 16:26:57 -07001360 case DUMP_HEAP_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 String process = data.readString();
1363 boolean managed = data.readInt() != 0;
1364 String path = data.readString();
1365 ParcelFileDescriptor fd = data.readInt() != 0
1366 ? data.readFileDescriptor() : null;
1367 boolean res = dumpHeap(process, managed, path, fd);
1368 reply.writeNoException();
1369 reply.writeInt(res ? 1 : 0);
1370 return true;
1371 }
1372
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001373 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1374 {
1375 data.enforceInterface(IActivityManager.descriptor);
1376 int uid = data.readInt();
1377 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1378 String[] resolvedTypes = data.createStringArray();
1379 IBinder resultTo = data.readStrongBinder();
1380 int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
1381 reply.writeNoException();
1382 reply.writeInt(result);
1383 return true;
1384 }
1385
1386 case START_ACTIVITIES_TRANSACTION:
1387 {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 IBinder b = data.readStrongBinder();
1390 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1391 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1392 String[] resolvedTypes = data.createStringArray();
1393 IBinder resultTo = data.readStrongBinder();
1394 int result = startActivities(app, intents, resolvedTypes, resultTo);
1395 reply.writeNoException();
1396 reply.writeInt(result);
1397 return true;
1398 }
1399
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001400 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001401
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001402 return super.onTransact(code, data, reply, flags);
1403 }
1404
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001405 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001406 return this;
1407 }
1408
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001409 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1410 protected IActivityManager create() {
1411 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001412 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001413 Log.v("ActivityManager", "default service binder = " + b);
1414 }
1415 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001416 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001417 Log.v("ActivityManager", "default service = " + am);
1418 }
1419 return am;
1420 }
1421 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422}
1423
1424class ActivityManagerProxy implements IActivityManager
1425{
1426 public ActivityManagerProxy(IBinder remote)
1427 {
1428 mRemote = remote;
1429 }
1430
1431 public IBinder asBinder()
1432 {
1433 return mRemote;
1434 }
1435
1436 public int startActivity(IApplicationThread caller, Intent intent,
1437 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1438 IBinder resultTo, String resultWho,
1439 int requestCode, boolean onlyIfNeeded,
1440 boolean debug) throws RemoteException {
1441 Parcel data = Parcel.obtain();
1442 Parcel reply = Parcel.obtain();
1443 data.writeInterfaceToken(IActivityManager.descriptor);
1444 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1445 intent.writeToParcel(data, 0);
1446 data.writeString(resolvedType);
1447 data.writeTypedArray(grantedUriPermissions, 0);
1448 data.writeInt(grantedMode);
1449 data.writeStrongBinder(resultTo);
1450 data.writeString(resultWho);
1451 data.writeInt(requestCode);
1452 data.writeInt(onlyIfNeeded ? 1 : 0);
1453 data.writeInt(debug ? 1 : 0);
1454 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1455 reply.readException();
1456 int result = reply.readInt();
1457 reply.recycle();
1458 data.recycle();
1459 return result;
1460 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001461 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1462 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1463 IBinder resultTo, String resultWho,
1464 int requestCode, boolean onlyIfNeeded,
1465 boolean debug) throws RemoteException {
1466 Parcel data = Parcel.obtain();
1467 Parcel reply = Parcel.obtain();
1468 data.writeInterfaceToken(IActivityManager.descriptor);
1469 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1470 intent.writeToParcel(data, 0);
1471 data.writeString(resolvedType);
1472 data.writeTypedArray(grantedUriPermissions, 0);
1473 data.writeInt(grantedMode);
1474 data.writeStrongBinder(resultTo);
1475 data.writeString(resultWho);
1476 data.writeInt(requestCode);
1477 data.writeInt(onlyIfNeeded ? 1 : 0);
1478 data.writeInt(debug ? 1 : 0);
1479 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1480 reply.readException();
1481 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1482 reply.recycle();
1483 data.recycle();
1484 return result;
1485 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001486 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1487 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1488 IBinder resultTo, String resultWho,
1489 int requestCode, boolean onlyIfNeeded,
1490 boolean debug, Configuration config) throws RemoteException {
1491 Parcel data = Parcel.obtain();
1492 Parcel reply = Parcel.obtain();
1493 data.writeInterfaceToken(IActivityManager.descriptor);
1494 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1495 intent.writeToParcel(data, 0);
1496 data.writeString(resolvedType);
1497 data.writeTypedArray(grantedUriPermissions, 0);
1498 data.writeInt(grantedMode);
1499 data.writeStrongBinder(resultTo);
1500 data.writeString(resultWho);
1501 data.writeInt(requestCode);
1502 data.writeInt(onlyIfNeeded ? 1 : 0);
1503 data.writeInt(debug ? 1 : 0);
1504 config.writeToParcel(data, 0);
1505 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1506 reply.readException();
1507 int result = reply.readInt();
1508 reply.recycle();
1509 data.recycle();
1510 return result;
1511 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001512 public int startActivityIntentSender(IApplicationThread caller,
1513 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001514 IBinder resultTo, String resultWho, int requestCode,
1515 int flagsMask, int flagsValues) throws RemoteException {
1516 Parcel data = Parcel.obtain();
1517 Parcel reply = Parcel.obtain();
1518 data.writeInterfaceToken(IActivityManager.descriptor);
1519 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1520 intent.writeToParcel(data, 0);
1521 if (fillInIntent != null) {
1522 data.writeInt(1);
1523 fillInIntent.writeToParcel(data, 0);
1524 } else {
1525 data.writeInt(0);
1526 }
1527 data.writeString(resolvedType);
1528 data.writeStrongBinder(resultTo);
1529 data.writeString(resultWho);
1530 data.writeInt(requestCode);
1531 data.writeInt(flagsMask);
1532 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001533 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001534 reply.readException();
1535 int result = reply.readInt();
1536 reply.recycle();
1537 data.recycle();
1538 return result;
1539 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001540 public boolean startNextMatchingActivity(IBinder callingActivity,
1541 Intent intent) throws RemoteException {
1542 Parcel data = Parcel.obtain();
1543 Parcel reply = Parcel.obtain();
1544 data.writeInterfaceToken(IActivityManager.descriptor);
1545 data.writeStrongBinder(callingActivity);
1546 intent.writeToParcel(data, 0);
1547 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1548 reply.readException();
1549 int result = reply.readInt();
1550 reply.recycle();
1551 data.recycle();
1552 return result != 0;
1553 }
1554 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1555 throws RemoteException {
1556 Parcel data = Parcel.obtain();
1557 Parcel reply = Parcel.obtain();
1558 data.writeInterfaceToken(IActivityManager.descriptor);
1559 data.writeStrongBinder(token);
1560 data.writeInt(resultCode);
1561 if (resultData != null) {
1562 data.writeInt(1);
1563 resultData.writeToParcel(data, 0);
1564 } else {
1565 data.writeInt(0);
1566 }
1567 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1568 reply.readException();
1569 boolean res = reply.readInt() != 0;
1570 data.recycle();
1571 reply.recycle();
1572 return res;
1573 }
1574 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1575 {
1576 Parcel data = Parcel.obtain();
1577 Parcel reply = Parcel.obtain();
1578 data.writeInterfaceToken(IActivityManager.descriptor);
1579 data.writeStrongBinder(token);
1580 data.writeString(resultWho);
1581 data.writeInt(requestCode);
1582 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1583 reply.readException();
1584 data.recycle();
1585 reply.recycle();
1586 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001587 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1588 Parcel data = Parcel.obtain();
1589 Parcel reply = Parcel.obtain();
1590 data.writeInterfaceToken(IActivityManager.descriptor);
1591 data.writeStrongBinder(token);
1592 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1593 reply.readException();
1594 boolean res = reply.readInt() != 0;
1595 data.recycle();
1596 reply.recycle();
1597 return res;
1598 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001599 public Intent registerReceiver(IApplicationThread caller,
1600 IIntentReceiver receiver,
1601 IntentFilter filter, String perm) throws RemoteException
1602 {
1603 Parcel data = Parcel.obtain();
1604 Parcel reply = Parcel.obtain();
1605 data.writeInterfaceToken(IActivityManager.descriptor);
1606 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1607 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1608 filter.writeToParcel(data, 0);
1609 data.writeString(perm);
1610 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1611 reply.readException();
1612 Intent intent = null;
1613 int haveIntent = reply.readInt();
1614 if (haveIntent != 0) {
1615 intent = Intent.CREATOR.createFromParcel(reply);
1616 }
1617 reply.recycle();
1618 data.recycle();
1619 return intent;
1620 }
1621 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1622 {
1623 Parcel data = Parcel.obtain();
1624 Parcel reply = Parcel.obtain();
1625 data.writeInterfaceToken(IActivityManager.descriptor);
1626 data.writeStrongBinder(receiver.asBinder());
1627 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1628 reply.readException();
1629 data.recycle();
1630 reply.recycle();
1631 }
1632 public int broadcastIntent(IApplicationThread caller,
1633 Intent intent, String resolvedType, IIntentReceiver resultTo,
1634 int resultCode, String resultData, Bundle map,
1635 String requiredPermission, boolean serialized,
1636 boolean sticky) throws RemoteException
1637 {
1638 Parcel data = Parcel.obtain();
1639 Parcel reply = Parcel.obtain();
1640 data.writeInterfaceToken(IActivityManager.descriptor);
1641 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1642 intent.writeToParcel(data, 0);
1643 data.writeString(resolvedType);
1644 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1645 data.writeInt(resultCode);
1646 data.writeString(resultData);
1647 data.writeBundle(map);
1648 data.writeString(requiredPermission);
1649 data.writeInt(serialized ? 1 : 0);
1650 data.writeInt(sticky ? 1 : 0);
1651 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1652 reply.readException();
1653 int res = reply.readInt();
1654 reply.recycle();
1655 data.recycle();
1656 return res;
1657 }
1658 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1659 {
1660 Parcel data = Parcel.obtain();
1661 Parcel reply = Parcel.obtain();
1662 data.writeInterfaceToken(IActivityManager.descriptor);
1663 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1664 intent.writeToParcel(data, 0);
1665 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1666 reply.readException();
1667 data.recycle();
1668 reply.recycle();
1669 }
1670 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1671 {
1672 Parcel data = Parcel.obtain();
1673 Parcel reply = Parcel.obtain();
1674 data.writeInterfaceToken(IActivityManager.descriptor);
1675 data.writeStrongBinder(who);
1676 data.writeInt(resultCode);
1677 data.writeString(resultData);
1678 data.writeBundle(map);
1679 data.writeInt(abortBroadcast ? 1 : 0);
1680 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1681 reply.readException();
1682 data.recycle();
1683 reply.recycle();
1684 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001685 public void attachApplication(IApplicationThread app) throws RemoteException
1686 {
1687 Parcel data = Parcel.obtain();
1688 Parcel reply = Parcel.obtain();
1689 data.writeInterfaceToken(IActivityManager.descriptor);
1690 data.writeStrongBinder(app.asBinder());
1691 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1692 reply.readException();
1693 data.recycle();
1694 reply.recycle();
1695 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001696 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001697 {
1698 Parcel data = Parcel.obtain();
1699 Parcel reply = Parcel.obtain();
1700 data.writeInterfaceToken(IActivityManager.descriptor);
1701 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001702 if (config != null) {
1703 data.writeInt(1);
1704 config.writeToParcel(data, 0);
1705 } else {
1706 data.writeInt(0);
1707 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001708 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1709 reply.readException();
1710 data.recycle();
1711 reply.recycle();
1712 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001713 public void activityPaused(IBinder token) throws RemoteException
1714 {
1715 Parcel data = Parcel.obtain();
1716 Parcel reply = Parcel.obtain();
1717 data.writeInterfaceToken(IActivityManager.descriptor);
1718 data.writeStrongBinder(token);
1719 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1720 reply.readException();
1721 data.recycle();
1722 reply.recycle();
1723 }
1724 public void activityStopped(IBinder token, Bundle state,
1725 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 {
1727 Parcel data = Parcel.obtain();
1728 Parcel reply = Parcel.obtain();
1729 data.writeInterfaceToken(IActivityManager.descriptor);
1730 data.writeStrongBinder(token);
1731 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001732 if (thumbnail != null) {
1733 data.writeInt(1);
1734 thumbnail.writeToParcel(data, 0);
1735 } else {
1736 data.writeInt(0);
1737 }
1738 TextUtils.writeToParcel(description, data, 0);
1739 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1740 reply.readException();
1741 data.recycle();
1742 reply.recycle();
1743 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001744 public void activitySlept(IBinder token) throws RemoteException
1745 {
1746 Parcel data = Parcel.obtain();
1747 Parcel reply = Parcel.obtain();
1748 data.writeInterfaceToken(IActivityManager.descriptor);
1749 data.writeStrongBinder(token);
1750 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1751 reply.readException();
1752 data.recycle();
1753 reply.recycle();
1754 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001755 public void activityDestroyed(IBinder token) throws RemoteException
1756 {
1757 Parcel data = Parcel.obtain();
1758 Parcel reply = Parcel.obtain();
1759 data.writeInterfaceToken(IActivityManager.descriptor);
1760 data.writeStrongBinder(token);
1761 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1762 reply.readException();
1763 data.recycle();
1764 reply.recycle();
1765 }
1766 public String getCallingPackage(IBinder token) throws RemoteException
1767 {
1768 Parcel data = Parcel.obtain();
1769 Parcel reply = Parcel.obtain();
1770 data.writeInterfaceToken(IActivityManager.descriptor);
1771 data.writeStrongBinder(token);
1772 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1773 reply.readException();
1774 String res = reply.readString();
1775 data.recycle();
1776 reply.recycle();
1777 return res;
1778 }
1779 public ComponentName getCallingActivity(IBinder token)
1780 throws RemoteException {
1781 Parcel data = Parcel.obtain();
1782 Parcel reply = Parcel.obtain();
1783 data.writeInterfaceToken(IActivityManager.descriptor);
1784 data.writeStrongBinder(token);
1785 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1786 reply.readException();
1787 ComponentName res = ComponentName.readFromParcel(reply);
1788 data.recycle();
1789 reply.recycle();
1790 return res;
1791 }
1792 public List getTasks(int maxNum, int flags,
1793 IThumbnailReceiver receiver) throws RemoteException {
1794 Parcel data = Parcel.obtain();
1795 Parcel reply = Parcel.obtain();
1796 data.writeInterfaceToken(IActivityManager.descriptor);
1797 data.writeInt(maxNum);
1798 data.writeInt(flags);
1799 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1800 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1801 reply.readException();
1802 ArrayList list = null;
1803 int N = reply.readInt();
1804 if (N >= 0) {
1805 list = new ArrayList();
1806 while (N > 0) {
1807 ActivityManager.RunningTaskInfo info =
1808 ActivityManager.RunningTaskInfo.CREATOR
1809 .createFromParcel(reply);
1810 list.add(info);
1811 N--;
1812 }
1813 }
1814 data.recycle();
1815 reply.recycle();
1816 return list;
1817 }
1818 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1819 int flags) throws RemoteException {
1820 Parcel data = Parcel.obtain();
1821 Parcel reply = Parcel.obtain();
1822 data.writeInterfaceToken(IActivityManager.descriptor);
1823 data.writeInt(maxNum);
1824 data.writeInt(flags);
1825 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1826 reply.readException();
1827 ArrayList<ActivityManager.RecentTaskInfo> list
1828 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1829 data.recycle();
1830 reply.recycle();
1831 return list;
1832 }
Dianne Hackbornd94df452011-02-16 18:53:31 -08001833 public Bitmap getTaskThumbnail(int id) throws RemoteException {
1834 Parcel data = Parcel.obtain();
1835 Parcel reply = Parcel.obtain();
1836 data.writeInterfaceToken(IActivityManager.descriptor);
1837 data.writeInt(id);
1838 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
1839 reply.readException();
1840 Bitmap bm = null;
1841 if (reply.readInt() != 0) {
1842 bm = Bitmap.CREATOR.createFromParcel(reply);
1843 }
1844 data.recycle();
1845 reply.recycle();
1846 return bm;
1847 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001848 public List getServices(int maxNum, int flags) throws RemoteException {
1849 Parcel data = Parcel.obtain();
1850 Parcel reply = Parcel.obtain();
1851 data.writeInterfaceToken(IActivityManager.descriptor);
1852 data.writeInt(maxNum);
1853 data.writeInt(flags);
1854 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1855 reply.readException();
1856 ArrayList list = null;
1857 int N = reply.readInt();
1858 if (N >= 0) {
1859 list = new ArrayList();
1860 while (N > 0) {
1861 ActivityManager.RunningServiceInfo info =
1862 ActivityManager.RunningServiceInfo.CREATOR
1863 .createFromParcel(reply);
1864 list.add(info);
1865 N--;
1866 }
1867 }
1868 data.recycle();
1869 reply.recycle();
1870 return list;
1871 }
1872 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1873 throws RemoteException {
1874 Parcel data = Parcel.obtain();
1875 Parcel reply = Parcel.obtain();
1876 data.writeInterfaceToken(IActivityManager.descriptor);
1877 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1878 reply.readException();
1879 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1880 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1881 data.recycle();
1882 reply.recycle();
1883 return list;
1884 }
1885 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1886 throws RemoteException {
1887 Parcel data = Parcel.obtain();
1888 Parcel reply = Parcel.obtain();
1889 data.writeInterfaceToken(IActivityManager.descriptor);
1890 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1891 reply.readException();
1892 ArrayList<ActivityManager.RunningAppProcessInfo> list
1893 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1894 data.recycle();
1895 reply.recycle();
1896 return list;
1897 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07001898 public List<ApplicationInfo> getRunningExternalApplications()
1899 throws RemoteException {
1900 Parcel data = Parcel.obtain();
1901 Parcel reply = Parcel.obtain();
1902 data.writeInterfaceToken(IActivityManager.descriptor);
1903 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
1904 reply.readException();
1905 ArrayList<ApplicationInfo> list
1906 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
1907 data.recycle();
1908 reply.recycle();
1909 return list;
1910 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001911 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001912 {
1913 Parcel data = Parcel.obtain();
1914 Parcel reply = Parcel.obtain();
1915 data.writeInterfaceToken(IActivityManager.descriptor);
1916 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001917 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001918 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1919 reply.readException();
1920 data.recycle();
1921 reply.recycle();
1922 }
1923 public void moveTaskToBack(int task) throws RemoteException
1924 {
1925 Parcel data = Parcel.obtain();
1926 Parcel reply = Parcel.obtain();
1927 data.writeInterfaceToken(IActivityManager.descriptor);
1928 data.writeInt(task);
1929 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1930 reply.readException();
1931 data.recycle();
1932 reply.recycle();
1933 }
1934 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1935 throws RemoteException {
1936 Parcel data = Parcel.obtain();
1937 Parcel reply = Parcel.obtain();
1938 data.writeInterfaceToken(IActivityManager.descriptor);
1939 data.writeStrongBinder(token);
1940 data.writeInt(nonRoot ? 1 : 0);
1941 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1942 reply.readException();
1943 boolean res = reply.readInt() != 0;
1944 data.recycle();
1945 reply.recycle();
1946 return res;
1947 }
1948 public void moveTaskBackwards(int task) throws RemoteException
1949 {
1950 Parcel data = Parcel.obtain();
1951 Parcel reply = Parcel.obtain();
1952 data.writeInterfaceToken(IActivityManager.descriptor);
1953 data.writeInt(task);
1954 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1955 reply.readException();
1956 data.recycle();
1957 reply.recycle();
1958 }
1959 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
1960 {
1961 Parcel data = Parcel.obtain();
1962 Parcel reply = Parcel.obtain();
1963 data.writeInterfaceToken(IActivityManager.descriptor);
1964 data.writeStrongBinder(token);
1965 data.writeInt(onlyRoot ? 1 : 0);
1966 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
1967 reply.readException();
1968 int res = reply.readInt();
1969 data.recycle();
1970 reply.recycle();
1971 return res;
1972 }
1973 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
1974 {
1975 Parcel data = Parcel.obtain();
1976 Parcel reply = Parcel.obtain();
1977 data.writeInterfaceToken(IActivityManager.descriptor);
1978 data.writeStrongBinder(token);
1979 ComponentName.writeToParcel(className, data);
1980 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
1981 reply.readException();
1982 data.recycle();
1983 reply.recycle();
1984 }
1985 public void reportThumbnail(IBinder token,
1986 Bitmap thumbnail, CharSequence description) throws RemoteException
1987 {
1988 Parcel data = Parcel.obtain();
1989 Parcel reply = Parcel.obtain();
1990 data.writeInterfaceToken(IActivityManager.descriptor);
1991 data.writeStrongBinder(token);
1992 if (thumbnail != null) {
1993 data.writeInt(1);
1994 thumbnail.writeToParcel(data, 0);
1995 } else {
1996 data.writeInt(0);
1997 }
1998 TextUtils.writeToParcel(description, data, 0);
1999 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2000 reply.readException();
2001 data.recycle();
2002 reply.recycle();
2003 }
2004 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2005 String name) throws RemoteException
2006 {
2007 Parcel data = Parcel.obtain();
2008 Parcel reply = Parcel.obtain();
2009 data.writeInterfaceToken(IActivityManager.descriptor);
2010 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2011 data.writeString(name);
2012 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2013 reply.readException();
2014 int res = reply.readInt();
2015 ContentProviderHolder cph = null;
2016 if (res != 0) {
2017 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2018 }
2019 data.recycle();
2020 reply.recycle();
2021 return cph;
2022 }
2023 public void publishContentProviders(IApplicationThread caller,
2024 List<ContentProviderHolder> providers) throws RemoteException
2025 {
2026 Parcel data = Parcel.obtain();
2027 Parcel reply = Parcel.obtain();
2028 data.writeInterfaceToken(IActivityManager.descriptor);
2029 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2030 data.writeTypedList(providers);
2031 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2032 reply.readException();
2033 data.recycle();
2034 reply.recycle();
2035 }
2036
2037 public void removeContentProvider(IApplicationThread caller,
2038 String name) throws RemoteException {
2039 Parcel data = Parcel.obtain();
2040 Parcel reply = Parcel.obtain();
2041 data.writeInterfaceToken(IActivityManager.descriptor);
2042 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2043 data.writeString(name);
2044 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2045 reply.readException();
2046 data.recycle();
2047 reply.recycle();
2048 }
2049
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002050 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2051 throws RemoteException
2052 {
2053 Parcel data = Parcel.obtain();
2054 Parcel reply = Parcel.obtain();
2055 data.writeInterfaceToken(IActivityManager.descriptor);
2056 service.writeToParcel(data, 0);
2057 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2058 reply.readException();
2059 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2060 data.recycle();
2061 reply.recycle();
2062 return res;
2063 }
2064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 public ComponentName startService(IApplicationThread caller, Intent service,
2066 String resolvedType) throws RemoteException
2067 {
2068 Parcel data = Parcel.obtain();
2069 Parcel reply = Parcel.obtain();
2070 data.writeInterfaceToken(IActivityManager.descriptor);
2071 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2072 service.writeToParcel(data, 0);
2073 data.writeString(resolvedType);
2074 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2075 reply.readException();
2076 ComponentName res = ComponentName.readFromParcel(reply);
2077 data.recycle();
2078 reply.recycle();
2079 return res;
2080 }
2081 public int stopService(IApplicationThread caller, Intent service,
2082 String resolvedType) throws RemoteException
2083 {
2084 Parcel data = Parcel.obtain();
2085 Parcel reply = Parcel.obtain();
2086 data.writeInterfaceToken(IActivityManager.descriptor);
2087 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2088 service.writeToParcel(data, 0);
2089 data.writeString(resolvedType);
2090 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2091 reply.readException();
2092 int res = reply.readInt();
2093 reply.recycle();
2094 data.recycle();
2095 return res;
2096 }
2097 public boolean stopServiceToken(ComponentName className, IBinder token,
2098 int startId) throws RemoteException {
2099 Parcel data = Parcel.obtain();
2100 Parcel reply = Parcel.obtain();
2101 data.writeInterfaceToken(IActivityManager.descriptor);
2102 ComponentName.writeToParcel(className, data);
2103 data.writeStrongBinder(token);
2104 data.writeInt(startId);
2105 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2106 reply.readException();
2107 boolean res = reply.readInt() != 0;
2108 data.recycle();
2109 reply.recycle();
2110 return res;
2111 }
2112 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002113 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002114 Parcel data = Parcel.obtain();
2115 Parcel reply = Parcel.obtain();
2116 data.writeInterfaceToken(IActivityManager.descriptor);
2117 ComponentName.writeToParcel(className, data);
2118 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002119 data.writeInt(id);
2120 if (notification != null) {
2121 data.writeInt(1);
2122 notification.writeToParcel(data, 0);
2123 } else {
2124 data.writeInt(0);
2125 }
2126 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002127 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2128 reply.readException();
2129 data.recycle();
2130 reply.recycle();
2131 }
2132 public int bindService(IApplicationThread caller, IBinder token,
2133 Intent service, String resolvedType, IServiceConnection connection,
2134 int flags) throws RemoteException {
2135 Parcel data = Parcel.obtain();
2136 Parcel reply = Parcel.obtain();
2137 data.writeInterfaceToken(IActivityManager.descriptor);
2138 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2139 data.writeStrongBinder(token);
2140 service.writeToParcel(data, 0);
2141 data.writeString(resolvedType);
2142 data.writeStrongBinder(connection.asBinder());
2143 data.writeInt(flags);
2144 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2145 reply.readException();
2146 int res = reply.readInt();
2147 data.recycle();
2148 reply.recycle();
2149 return res;
2150 }
2151 public boolean unbindService(IServiceConnection connection) throws RemoteException
2152 {
2153 Parcel data = Parcel.obtain();
2154 Parcel reply = Parcel.obtain();
2155 data.writeInterfaceToken(IActivityManager.descriptor);
2156 data.writeStrongBinder(connection.asBinder());
2157 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2158 reply.readException();
2159 boolean res = reply.readInt() != 0;
2160 data.recycle();
2161 reply.recycle();
2162 return res;
2163 }
2164
2165 public void publishService(IBinder token,
2166 Intent intent, IBinder service) throws RemoteException {
2167 Parcel data = Parcel.obtain();
2168 Parcel reply = Parcel.obtain();
2169 data.writeInterfaceToken(IActivityManager.descriptor);
2170 data.writeStrongBinder(token);
2171 intent.writeToParcel(data, 0);
2172 data.writeStrongBinder(service);
2173 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2174 reply.readException();
2175 data.recycle();
2176 reply.recycle();
2177 }
2178
2179 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2180 throws RemoteException {
2181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeStrongBinder(token);
2185 intent.writeToParcel(data, 0);
2186 data.writeInt(doRebind ? 1 : 0);
2187 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2188 reply.readException();
2189 data.recycle();
2190 reply.recycle();
2191 }
2192
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002193 public void serviceDoneExecuting(IBinder token, int type, int startId,
2194 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 Parcel data = Parcel.obtain();
2196 Parcel reply = Parcel.obtain();
2197 data.writeInterfaceToken(IActivityManager.descriptor);
2198 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002199 data.writeInt(type);
2200 data.writeInt(startId);
2201 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002202 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2203 reply.readException();
2204 data.recycle();
2205 reply.recycle();
2206 }
2207
2208 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2209 Parcel data = Parcel.obtain();
2210 Parcel reply = Parcel.obtain();
2211 data.writeInterfaceToken(IActivityManager.descriptor);
2212 service.writeToParcel(data, 0);
2213 data.writeString(resolvedType);
2214 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 IBinder binder = reply.readStrongBinder();
2217 reply.recycle();
2218 data.recycle();
2219 return binder;
2220 }
2221
Christopher Tate181fafa2009-05-14 11:12:14 -07002222 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2223 throws RemoteException {
2224 Parcel data = Parcel.obtain();
2225 Parcel reply = Parcel.obtain();
2226 data.writeInterfaceToken(IActivityManager.descriptor);
2227 app.writeToParcel(data, 0);
2228 data.writeInt(backupRestoreMode);
2229 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2230 reply.readException();
2231 boolean success = reply.readInt() != 0;
2232 reply.recycle();
2233 data.recycle();
2234 return success;
2235 }
2236
2237 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2238 Parcel data = Parcel.obtain();
2239 Parcel reply = Parcel.obtain();
2240 data.writeInterfaceToken(IActivityManager.descriptor);
2241 data.writeString(packageName);
2242 data.writeStrongBinder(agent);
2243 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2244 reply.recycle();
2245 data.recycle();
2246 }
2247
2248 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2249 Parcel data = Parcel.obtain();
2250 Parcel reply = Parcel.obtain();
2251 data.writeInterfaceToken(IActivityManager.descriptor);
2252 app.writeToParcel(data, 0);
2253 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2254 reply.readException();
2255 reply.recycle();
2256 data.recycle();
2257 }
2258
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002259 public boolean startInstrumentation(ComponentName className, String profileFile,
2260 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2261 throws RemoteException {
2262 Parcel data = Parcel.obtain();
2263 Parcel reply = Parcel.obtain();
2264 data.writeInterfaceToken(IActivityManager.descriptor);
2265 ComponentName.writeToParcel(className, data);
2266 data.writeString(profileFile);
2267 data.writeInt(flags);
2268 data.writeBundle(arguments);
2269 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2270 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2271 reply.readException();
2272 boolean res = reply.readInt() != 0;
2273 reply.recycle();
2274 data.recycle();
2275 return res;
2276 }
2277
2278 public void finishInstrumentation(IApplicationThread target,
2279 int resultCode, Bundle results) throws RemoteException {
2280 Parcel data = Parcel.obtain();
2281 Parcel reply = Parcel.obtain();
2282 data.writeInterfaceToken(IActivityManager.descriptor);
2283 data.writeStrongBinder(target != null ? target.asBinder() : null);
2284 data.writeInt(resultCode);
2285 data.writeBundle(results);
2286 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2287 reply.readException();
2288 data.recycle();
2289 reply.recycle();
2290 }
2291 public Configuration getConfiguration() throws RemoteException
2292 {
2293 Parcel data = Parcel.obtain();
2294 Parcel reply = Parcel.obtain();
2295 data.writeInterfaceToken(IActivityManager.descriptor);
2296 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2297 reply.readException();
2298 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2299 reply.recycle();
2300 data.recycle();
2301 return res;
2302 }
2303 public void updateConfiguration(Configuration values) throws RemoteException
2304 {
2305 Parcel data = Parcel.obtain();
2306 Parcel reply = Parcel.obtain();
2307 data.writeInterfaceToken(IActivityManager.descriptor);
2308 values.writeToParcel(data, 0);
2309 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2310 reply.readException();
2311 data.recycle();
2312 reply.recycle();
2313 }
2314 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2315 throws RemoteException {
2316 Parcel data = Parcel.obtain();
2317 Parcel reply = Parcel.obtain();
2318 data.writeInterfaceToken(IActivityManager.descriptor);
2319 data.writeStrongBinder(token);
2320 data.writeInt(requestedOrientation);
2321 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2322 reply.readException();
2323 data.recycle();
2324 reply.recycle();
2325 }
2326 public int getRequestedOrientation(IBinder token) throws RemoteException {
2327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 data.writeStrongBinder(token);
2331 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2332 reply.readException();
2333 int res = reply.readInt();
2334 data.recycle();
2335 reply.recycle();
2336 return res;
2337 }
2338 public ComponentName getActivityClassForToken(IBinder token)
2339 throws RemoteException {
2340 Parcel data = Parcel.obtain();
2341 Parcel reply = Parcel.obtain();
2342 data.writeInterfaceToken(IActivityManager.descriptor);
2343 data.writeStrongBinder(token);
2344 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2345 reply.readException();
2346 ComponentName res = ComponentName.readFromParcel(reply);
2347 data.recycle();
2348 reply.recycle();
2349 return res;
2350 }
2351 public String getPackageForToken(IBinder token) throws RemoteException
2352 {
2353 Parcel data = Parcel.obtain();
2354 Parcel reply = Parcel.obtain();
2355 data.writeInterfaceToken(IActivityManager.descriptor);
2356 data.writeStrongBinder(token);
2357 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2358 reply.readException();
2359 String res = reply.readString();
2360 data.recycle();
2361 reply.recycle();
2362 return res;
2363 }
2364 public IIntentSender getIntentSender(int type,
2365 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002366 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367 throws RemoteException {
2368 Parcel data = Parcel.obtain();
2369 Parcel reply = Parcel.obtain();
2370 data.writeInterfaceToken(IActivityManager.descriptor);
2371 data.writeInt(type);
2372 data.writeString(packageName);
2373 data.writeStrongBinder(token);
2374 data.writeString(resultWho);
2375 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002376 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002378 data.writeTypedArray(intents, 0);
2379 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002380 } else {
2381 data.writeInt(0);
2382 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 data.writeInt(flags);
2384 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2385 reply.readException();
2386 IIntentSender res = IIntentSender.Stub.asInterface(
2387 reply.readStrongBinder());
2388 data.recycle();
2389 reply.recycle();
2390 return res;
2391 }
2392 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2393 Parcel data = Parcel.obtain();
2394 Parcel reply = Parcel.obtain();
2395 data.writeInterfaceToken(IActivityManager.descriptor);
2396 data.writeStrongBinder(sender.asBinder());
2397 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2398 reply.readException();
2399 data.recycle();
2400 reply.recycle();
2401 }
2402 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2403 Parcel data = Parcel.obtain();
2404 Parcel reply = Parcel.obtain();
2405 data.writeInterfaceToken(IActivityManager.descriptor);
2406 data.writeStrongBinder(sender.asBinder());
2407 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2408 reply.readException();
2409 String res = reply.readString();
2410 data.recycle();
2411 reply.recycle();
2412 return res;
2413 }
2414 public void setProcessLimit(int max) throws RemoteException
2415 {
2416 Parcel data = Parcel.obtain();
2417 Parcel reply = Parcel.obtain();
2418 data.writeInterfaceToken(IActivityManager.descriptor);
2419 data.writeInt(max);
2420 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2421 reply.readException();
2422 data.recycle();
2423 reply.recycle();
2424 }
2425 public int getProcessLimit() throws RemoteException
2426 {
2427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2431 reply.readException();
2432 int res = reply.readInt();
2433 data.recycle();
2434 reply.recycle();
2435 return res;
2436 }
2437 public void setProcessForeground(IBinder token, int pid,
2438 boolean isForeground) throws RemoteException {
2439 Parcel data = Parcel.obtain();
2440 Parcel reply = Parcel.obtain();
2441 data.writeInterfaceToken(IActivityManager.descriptor);
2442 data.writeStrongBinder(token);
2443 data.writeInt(pid);
2444 data.writeInt(isForeground ? 1 : 0);
2445 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2446 reply.readException();
2447 data.recycle();
2448 reply.recycle();
2449 }
2450 public int checkPermission(String permission, int pid, int uid)
2451 throws RemoteException {
2452 Parcel data = Parcel.obtain();
2453 Parcel reply = Parcel.obtain();
2454 data.writeInterfaceToken(IActivityManager.descriptor);
2455 data.writeString(permission);
2456 data.writeInt(pid);
2457 data.writeInt(uid);
2458 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2459 reply.readException();
2460 int res = reply.readInt();
2461 data.recycle();
2462 reply.recycle();
2463 return res;
2464 }
2465 public boolean clearApplicationUserData(final String packageName,
2466 final IPackageDataObserver observer) throws RemoteException {
2467 Parcel data = Parcel.obtain();
2468 Parcel reply = Parcel.obtain();
2469 data.writeInterfaceToken(IActivityManager.descriptor);
2470 data.writeString(packageName);
2471 data.writeStrongBinder(observer.asBinder());
2472 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2473 reply.readException();
2474 boolean res = reply.readInt() != 0;
2475 data.recycle();
2476 reply.recycle();
2477 return res;
2478 }
2479 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2480 throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 uri.writeToParcel(data, 0);
2485 data.writeInt(pid);
2486 data.writeInt(uid);
2487 data.writeInt(mode);
2488 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2489 reply.readException();
2490 int res = reply.readInt();
2491 data.recycle();
2492 reply.recycle();
2493 return res;
2494 }
2495 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2496 Uri uri, int mode) throws RemoteException {
2497 Parcel data = Parcel.obtain();
2498 Parcel reply = Parcel.obtain();
2499 data.writeInterfaceToken(IActivityManager.descriptor);
2500 data.writeStrongBinder(caller.asBinder());
2501 data.writeString(targetPkg);
2502 uri.writeToParcel(data, 0);
2503 data.writeInt(mode);
2504 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2505 reply.readException();
2506 data.recycle();
2507 reply.recycle();
2508 }
2509 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2510 int mode) throws RemoteException {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(caller.asBinder());
2515 uri.writeToParcel(data, 0);
2516 data.writeInt(mode);
2517 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2518 reply.readException();
2519 data.recycle();
2520 reply.recycle();
2521 }
2522 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2523 throws RemoteException {
2524 Parcel data = Parcel.obtain();
2525 Parcel reply = Parcel.obtain();
2526 data.writeInterfaceToken(IActivityManager.descriptor);
2527 data.writeStrongBinder(who.asBinder());
2528 data.writeInt(waiting ? 1 : 0);
2529 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2530 reply.readException();
2531 data.recycle();
2532 reply.recycle();
2533 }
2534 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2535 Parcel data = Parcel.obtain();
2536 Parcel reply = Parcel.obtain();
2537 data.writeInterfaceToken(IActivityManager.descriptor);
2538 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 outInfo.readFromParcel(reply);
2541 data.recycle();
2542 reply.recycle();
2543 }
2544 public void unhandledBack() throws RemoteException
2545 {
2546 Parcel data = Parcel.obtain();
2547 Parcel reply = Parcel.obtain();
2548 data.writeInterfaceToken(IActivityManager.descriptor);
2549 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2550 reply.readException();
2551 data.recycle();
2552 reply.recycle();
2553 }
2554 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2555 {
2556 Parcel data = Parcel.obtain();
2557 Parcel reply = Parcel.obtain();
2558 data.writeInterfaceToken(IActivityManager.descriptor);
2559 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2560 reply.readException();
2561 ParcelFileDescriptor pfd = null;
2562 if (reply.readInt() != 0) {
2563 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2564 }
2565 data.recycle();
2566 reply.recycle();
2567 return pfd;
2568 }
2569 public void goingToSleep() throws RemoteException
2570 {
2571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2575 reply.readException();
2576 data.recycle();
2577 reply.recycle();
2578 }
2579 public void wakingUp() throws RemoteException
2580 {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 data.recycle();
2587 reply.recycle();
2588 }
2589 public void setDebugApp(
2590 String packageName, boolean waitForDebugger, boolean persistent)
2591 throws RemoteException
2592 {
2593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 data.writeString(packageName);
2597 data.writeInt(waitForDebugger ? 1 : 0);
2598 data.writeInt(persistent ? 1 : 0);
2599 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2600 reply.readException();
2601 data.recycle();
2602 reply.recycle();
2603 }
2604 public void setAlwaysFinish(boolean enabled) throws RemoteException
2605 {
2606 Parcel data = Parcel.obtain();
2607 Parcel reply = Parcel.obtain();
2608 data.writeInterfaceToken(IActivityManager.descriptor);
2609 data.writeInt(enabled ? 1 : 0);
2610 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2611 reply.readException();
2612 data.recycle();
2613 reply.recycle();
2614 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002615 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002621 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 reply.readException();
2623 data.recycle();
2624 reply.recycle();
2625 }
2626 public void enterSafeMode() throws RemoteException {
2627 Parcel data = Parcel.obtain();
2628 data.writeInterfaceToken(IActivityManager.descriptor);
2629 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2630 data.recycle();
2631 }
2632 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2633 Parcel data = Parcel.obtain();
2634 data.writeStrongBinder(sender.asBinder());
2635 data.writeInterfaceToken(IActivityManager.descriptor);
2636 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2637 data.recycle();
2638 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002639 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002644 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002645 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002646 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002647 boolean res = reply.readInt() != 0;
2648 data.recycle();
2649 reply.recycle();
2650 return res;
2651 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002652 public void startRunning(String pkg, String cls, String action,
2653 String indata) throws RemoteException {
2654 Parcel data = Parcel.obtain();
2655 Parcel reply = Parcel.obtain();
2656 data.writeInterfaceToken(IActivityManager.descriptor);
2657 data.writeString(pkg);
2658 data.writeString(cls);
2659 data.writeString(action);
2660 data.writeString(indata);
2661 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2662 reply.readException();
2663 data.recycle();
2664 reply.recycle();
2665 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002666 public boolean testIsSystemReady()
2667 {
2668 /* this base class version is never called */
2669 return true;
2670 }
Dan Egnor60d87622009-12-16 16:32:58 -08002671 public void handleApplicationCrash(IBinder app,
2672 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2673 {
2674 Parcel data = Parcel.obtain();
2675 Parcel reply = Parcel.obtain();
2676 data.writeInterfaceToken(IActivityManager.descriptor);
2677 data.writeStrongBinder(app);
2678 crashInfo.writeToParcel(data, 0);
2679 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2680 reply.readException();
2681 reply.recycle();
2682 data.recycle();
2683 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002684
Dan Egnor60d87622009-12-16 16:32:58 -08002685 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002686 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002692 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002693 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002694 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002695 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002696 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002697 reply.recycle();
2698 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002699 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002700 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002701
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002702 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002703 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002704 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002705 {
2706 Parcel data = Parcel.obtain();
2707 Parcel reply = Parcel.obtain();
2708 data.writeInterfaceToken(IActivityManager.descriptor);
2709 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002710 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002711 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002712 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 reply.recycle();
2715 data.recycle();
2716 }
2717
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002718 public void signalPersistentProcesses(int sig) throws RemoteException {
2719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
2721 data.writeInterfaceToken(IActivityManager.descriptor);
2722 data.writeInt(sig);
2723 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2724 reply.readException();
2725 data.recycle();
2726 reply.recycle();
2727 }
2728
Dianne Hackborn03abb812010-01-04 18:43:19 -08002729 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002734 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2735 reply.readException();
2736 data.recycle();
2737 reply.recycle();
2738 }
2739
2740 public void forceStopPackage(String packageName) throws RemoteException {
2741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
2743 data.writeInterfaceToken(IActivityManager.descriptor);
2744 data.writeString(packageName);
2745 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 reply.readException();
2747 data.recycle();
2748 reply.recycle();
2749 }
2750
2751 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2752 {
2753 Parcel data = Parcel.obtain();
2754 Parcel reply = Parcel.obtain();
2755 data.writeInterfaceToken(IActivityManager.descriptor);
2756 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2757 reply.readException();
2758 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2759 reply.recycle();
2760 data.recycle();
2761 return res;
2762 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002763
2764 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002765 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002766 {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeString(process);
2771 data.writeInt(start ? 1 : 0);
2772 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002773 if (fd != null) {
2774 data.writeInt(1);
2775 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2776 } else {
2777 data.writeInt(0);
2778 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002779 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2780 reply.readException();
2781 boolean res = reply.readInt() != 0;
2782 reply.recycle();
2783 data.recycle();
2784 return res;
2785 }
2786
Dianne Hackborn55280a92009-05-07 15:53:46 -07002787 public boolean shutdown(int timeout) throws RemoteException
2788 {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 data.writeInt(timeout);
2793 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2794 reply.readException();
2795 boolean res = reply.readInt() != 0;
2796 reply.recycle();
2797 data.recycle();
2798 return res;
2799 }
2800
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002801 public void stopAppSwitches() throws RemoteException {
2802 Parcel data = Parcel.obtain();
2803 Parcel reply = Parcel.obtain();
2804 data.writeInterfaceToken(IActivityManager.descriptor);
2805 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2806 reply.readException();
2807 reply.recycle();
2808 data.recycle();
2809 }
2810
2811 public void resumeAppSwitches() throws RemoteException {
2812 Parcel data = Parcel.obtain();
2813 Parcel reply = Parcel.obtain();
2814 data.writeInterfaceToken(IActivityManager.descriptor);
2815 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2816 reply.readException();
2817 reply.recycle();
2818 data.recycle();
2819 }
2820
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002821 public void registerActivityWatcher(IActivityWatcher watcher)
2822 throws RemoteException {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2827 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 data.recycle();
2830 reply.recycle();
2831 }
2832
2833 public void unregisterActivityWatcher(IActivityWatcher watcher)
2834 throws RemoteException {
2835 Parcel data = Parcel.obtain();
2836 Parcel reply = Parcel.obtain();
2837 data.writeInterfaceToken(IActivityManager.descriptor);
2838 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2839 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2840 reply.readException();
2841 data.recycle();
2842 reply.recycle();
2843 }
2844
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002845 public int startActivityInPackage(int uid,
2846 Intent intent, String resolvedType, IBinder resultTo,
2847 String resultWho, int requestCode, boolean onlyIfNeeded)
2848 throws RemoteException {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeInt(uid);
2853 intent.writeToParcel(data, 0);
2854 data.writeString(resolvedType);
2855 data.writeStrongBinder(resultTo);
2856 data.writeString(resultWho);
2857 data.writeInt(requestCode);
2858 data.writeInt(onlyIfNeeded ? 1 : 0);
2859 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2860 reply.readException();
2861 int result = reply.readInt();
2862 reply.recycle();
2863 data.recycle();
2864 return result;
2865 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002866
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002867 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2868 Parcel data = Parcel.obtain();
2869 Parcel reply = Parcel.obtain();
2870 data.writeInterfaceToken(IActivityManager.descriptor);
2871 data.writeString(pkg);
2872 data.writeInt(uid);
2873 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2874 reply.readException();
2875 data.recycle();
2876 reply.recycle();
2877 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002878
2879 public void closeSystemDialogs(String reason) throws RemoteException {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeString(reason);
2884 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 data.recycle();
2887 reply.recycle();
2888 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002889
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002890 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002891 throws RemoteException {
2892 Parcel data = Parcel.obtain();
2893 Parcel reply = Parcel.obtain();
2894 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002895 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002896 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
2897 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002898 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002899 data.recycle();
2900 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002901 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002902 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07002903
2904 public void killApplicationProcess(String processName, int uid) throws RemoteException {
2905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
2907 data.writeInterfaceToken(IActivityManager.descriptor);
2908 data.writeString(processName);
2909 data.writeInt(uid);
2910 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 data.recycle();
2913 reply.recycle();
2914 }
2915
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07002916 public void overridePendingTransition(IBinder token, String packageName,
2917 int enterAnim, int exitAnim) throws RemoteException {
2918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeStrongBinder(token);
2922 data.writeString(packageName);
2923 data.writeInt(enterAnim);
2924 data.writeInt(exitAnim);
2925 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 data.recycle();
2928 reply.recycle();
2929 }
2930
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08002931 public boolean isUserAMonkey() throws RemoteException {
2932 Parcel data = Parcel.obtain();
2933 Parcel reply = Parcel.obtain();
2934 data.writeInterfaceToken(IActivityManager.descriptor);
2935 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
2936 reply.readException();
2937 boolean res = reply.readInt() != 0;
2938 data.recycle();
2939 reply.recycle();
2940 return res;
2941 }
2942
Dianne Hackborn860755f2010-06-03 18:47:52 -07002943 public void finishHeavyWeightApp() throws RemoteException {
2944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 data.recycle();
2950 reply.recycle();
2951 }
2952
Daniel Sandler69a48172010-06-23 16:29:36 -04002953 public void setImmersive(IBinder token, boolean immersive)
2954 throws RemoteException {
2955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 data.writeStrongBinder(token);
2959 data.writeInt(immersive ? 1 : 0);
2960 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
2961 reply.readException();
2962 data.recycle();
2963 reply.recycle();
2964 }
2965
2966 public boolean isImmersive(IBinder token)
2967 throws RemoteException {
2968 Parcel data = Parcel.obtain();
2969 Parcel reply = Parcel.obtain();
2970 data.writeInterfaceToken(IActivityManager.descriptor);
2971 data.writeStrongBinder(token);
2972 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04002973 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07002974 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04002975 data.recycle();
2976 reply.recycle();
2977 return res;
2978 }
2979
2980 public boolean isTopActivityImmersive()
2981 throws RemoteException {
2982 Parcel data = Parcel.obtain();
2983 Parcel reply = Parcel.obtain();
2984 data.writeInterfaceToken(IActivityManager.descriptor);
2985 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04002986 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07002987 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04002988 data.recycle();
2989 reply.recycle();
2990 return res;
2991 }
2992
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07002993 public void crashApplication(int uid, int initialPid, String packageName,
2994 String message) throws RemoteException {
2995 Parcel data = Parcel.obtain();
2996 Parcel reply = Parcel.obtain();
2997 data.writeInterfaceToken(IActivityManager.descriptor);
2998 data.writeInt(uid);
2999 data.writeInt(initialPid);
3000 data.writeString(packageName);
3001 data.writeString(message);
3002 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 data.recycle();
3005 reply.recycle();
3006 }
Andy McFadden824c5102010-07-09 16:26:57 -07003007
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003008 public String getProviderMimeType(Uri uri)
3009 throws RemoteException {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 uri.writeToParcel(data, 0);
3014 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3015 reply.readException();
3016 String res = reply.readString();
3017 data.recycle();
3018 reply.recycle();
3019 return res;
3020 }
3021
Dianne Hackborn7e269642010-08-25 19:50:20 -07003022 public IBinder newUriPermissionOwner(String name)
3023 throws RemoteException {
3024 Parcel data = Parcel.obtain();
3025 Parcel reply = Parcel.obtain();
3026 data.writeInterfaceToken(IActivityManager.descriptor);
3027 data.writeString(name);
3028 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 IBinder res = reply.readStrongBinder();
3031 data.recycle();
3032 reply.recycle();
3033 return res;
3034 }
3035
3036 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3037 Uri uri, int mode) throws RemoteException {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 data.writeStrongBinder(owner);
3042 data.writeInt(fromUid);
3043 data.writeString(targetPkg);
3044 uri.writeToParcel(data, 0);
3045 data.writeInt(mode);
3046 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3047 reply.readException();
3048 data.recycle();
3049 reply.recycle();
3050 }
3051
3052 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3053 int mode) throws RemoteException {
3054 Parcel data = Parcel.obtain();
3055 Parcel reply = Parcel.obtain();
3056 data.writeInterfaceToken(IActivityManager.descriptor);
3057 data.writeStrongBinder(owner);
3058 if (uri != null) {
3059 data.writeInt(1);
3060 uri.writeToParcel(data, 0);
3061 } else {
3062 data.writeInt(0);
3063 }
3064 data.writeInt(mode);
3065 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3066 reply.readException();
3067 data.recycle();
3068 reply.recycle();
3069 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003070
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003071 public int checkGrantUriPermission(int callingUid, String targetPkg,
3072 Uri uri, int modeFlags) throws RemoteException {
3073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeInt(callingUid);
3077 data.writeString(targetPkg);
3078 uri.writeToParcel(data, 0);
3079 data.writeInt(modeFlags);
3080 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3081 reply.readException();
3082 int res = reply.readInt();
3083 data.recycle();
3084 reply.recycle();
3085 return res;
3086 }
3087
Andy McFadden824c5102010-07-09 16:26:57 -07003088 public boolean dumpHeap(String process, boolean managed,
3089 String path, ParcelFileDescriptor fd) throws RemoteException {
3090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 data.writeString(process);
3094 data.writeInt(managed ? 1 : 0);
3095 data.writeString(path);
3096 if (fd != null) {
3097 data.writeInt(1);
3098 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3099 } else {
3100 data.writeInt(0);
3101 }
3102 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 boolean res = reply.readInt() != 0;
3105 reply.recycle();
3106 data.recycle();
3107 return res;
3108 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003109
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003110 public int startActivities(IApplicationThread caller,
3111 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3116 data.writeTypedArray(intents, 0);
3117 data.writeStringArray(resolvedTypes);
3118 data.writeStrongBinder(resultTo);
3119 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 int result = reply.readInt();
3122 reply.recycle();
3123 data.recycle();
3124 return result;
3125 }
3126
3127 public int startActivitiesInPackage(int uid,
3128 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeInt(uid);
3133 data.writeTypedArray(intents, 0);
3134 data.writeStringArray(resolvedTypes);
3135 data.writeStrongBinder(resultTo);
3136 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3137 reply.readException();
3138 int result = reply.readInt();
3139 reply.recycle();
3140 data.recycle();
3141 return result;
3142 }
3143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003144 private IBinder mRemote;
3145}