blob: 11e9975eb610d1c5acda21c5fc50cd479250b727 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.Intent;
21import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070022import android.content.IIntentSender;
23import android.content.IIntentReceiver;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
28import android.content.res.Configuration;
29import android.graphics.Bitmap;
30import android.net.Uri;
31import android.os.Binder;
32import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070033import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.os.Parcelable;
35import android.os.ParcelFileDescriptor;
36import android.os.RemoteException;
37import android.os.IBinder;
38import android.os.Parcel;
39import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070040import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.text.TextUtils;
42import android.util.Config;
43import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080091 static public void broadcastStickyIntent(Intent intent, String permission) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 try {
93 getDefault().broadcastIntent(
94 null, intent, null, null, Activity.RESULT_OK, null, null,
95 null /*permission*/, false, true);
96 } catch (RemoteException ex) {
97 }
98 }
99
100 static public void noteWakeupAlarm(PendingIntent ps) {
101 try {
102 getDefault().noteWakeupAlarm(ps.getTarget());
103 } catch (RemoteException ex) {
104 }
105 }
106
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800107 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 attachInterface(this, descriptor);
109 }
110
111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
112 throws RemoteException {
113 switch (code) {
114 case START_ACTIVITY_TRANSACTION:
115 {
116 data.enforceInterface(IActivityManager.descriptor);
117 IBinder b = data.readStrongBinder();
118 IApplicationThread app = ApplicationThreadNative.asInterface(b);
119 Intent intent = Intent.CREATOR.createFromParcel(data);
120 String resolvedType = data.readString();
121 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
122 int grantedMode = data.readInt();
123 IBinder resultTo = data.readStrongBinder();
124 String resultWho = data.readString();
125 int requestCode = data.readInt();
126 boolean onlyIfNeeded = data.readInt() != 0;
127 boolean debug = data.readInt() != 0;
128 int result = startActivity(app, intent, resolvedType,
129 grantedUriPermissions, grantedMode, resultTo, resultWho,
130 requestCode, onlyIfNeeded, debug);
131 reply.writeNoException();
132 reply.writeInt(result);
133 return true;
134 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700135
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800136 case START_ACTIVITY_AND_WAIT_TRANSACTION:
137 {
138 data.enforceInterface(IActivityManager.descriptor);
139 IBinder b = data.readStrongBinder();
140 IApplicationThread app = ApplicationThreadNative.asInterface(b);
141 Intent intent = Intent.CREATOR.createFromParcel(data);
142 String resolvedType = data.readString();
143 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
144 int grantedMode = data.readInt();
145 IBinder resultTo = data.readStrongBinder();
146 String resultWho = data.readString();
147 int requestCode = data.readInt();
148 boolean onlyIfNeeded = data.readInt() != 0;
149 boolean debug = data.readInt() != 0;
150 WaitResult result = startActivityAndWait(app, intent, resolvedType,
151 grantedUriPermissions, grantedMode, resultTo, resultWho,
152 requestCode, onlyIfNeeded, debug);
153 reply.writeNoException();
154 result.writeToParcel(reply, 0);
155 return true;
156 }
157
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700158 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
159 {
160 data.enforceInterface(IActivityManager.descriptor);
161 IBinder b = data.readStrongBinder();
162 IApplicationThread app = ApplicationThreadNative.asInterface(b);
163 Intent intent = Intent.CREATOR.createFromParcel(data);
164 String resolvedType = data.readString();
165 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
166 int grantedMode = data.readInt();
167 IBinder resultTo = data.readStrongBinder();
168 String resultWho = data.readString();
169 int requestCode = data.readInt();
170 boolean onlyIfNeeded = data.readInt() != 0;
171 boolean debug = data.readInt() != 0;
172 Configuration config = Configuration.CREATOR.createFromParcel(data);
173 int result = startActivityWithConfig(app, intent, resolvedType,
174 grantedUriPermissions, grantedMode, resultTo, resultWho,
175 requestCode, onlyIfNeeded, debug, config);
176 reply.writeNoException();
177 reply.writeInt(result);
178 return true;
179 }
180
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700181 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700182 {
183 data.enforceInterface(IActivityManager.descriptor);
184 IBinder b = data.readStrongBinder();
185 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700186 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700187 Intent fillInIntent = null;
188 if (data.readInt() != 0) {
189 fillInIntent = Intent.CREATOR.createFromParcel(data);
190 }
191 String resolvedType = data.readString();
192 IBinder resultTo = data.readStrongBinder();
193 String resultWho = data.readString();
194 int requestCode = data.readInt();
195 int flagsMask = data.readInt();
196 int flagsValues = data.readInt();
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700197 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700198 fillInIntent, resolvedType, resultTo, resultWho,
199 requestCode, flagsMask, flagsValues);
200 reply.writeNoException();
201 reply.writeInt(result);
202 return true;
203 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800204
205 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
206 {
207 data.enforceInterface(IActivityManager.descriptor);
208 IBinder callingActivity = data.readStrongBinder();
209 Intent intent = Intent.CREATOR.createFromParcel(data);
210 boolean result = startNextMatchingActivity(callingActivity, intent);
211 reply.writeNoException();
212 reply.writeInt(result ? 1 : 0);
213 return true;
214 }
215
216 case FINISH_ACTIVITY_TRANSACTION: {
217 data.enforceInterface(IActivityManager.descriptor);
218 IBinder token = data.readStrongBinder();
219 Intent resultData = null;
220 int resultCode = data.readInt();
221 if (data.readInt() != 0) {
222 resultData = Intent.CREATOR.createFromParcel(data);
223 }
224 boolean res = finishActivity(token, resultCode, resultData);
225 reply.writeNoException();
226 reply.writeInt(res ? 1 : 0);
227 return true;
228 }
229
230 case FINISH_SUB_ACTIVITY_TRANSACTION: {
231 data.enforceInterface(IActivityManager.descriptor);
232 IBinder token = data.readStrongBinder();
233 String resultWho = data.readString();
234 int requestCode = data.readInt();
235 finishSubActivity(token, resultWho, requestCode);
236 reply.writeNoException();
237 return true;
238 }
239
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800240 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
241 data.enforceInterface(IActivityManager.descriptor);
242 IBinder token = data.readStrongBinder();
243 boolean res = willActivityBeVisible(token);
244 reply.writeNoException();
245 reply.writeInt(res ? 1 : 0);
246 return true;
247 }
248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 case REGISTER_RECEIVER_TRANSACTION:
250 {
251 data.enforceInterface(IActivityManager.descriptor);
252 IBinder b = data.readStrongBinder();
253 IApplicationThread app =
254 b != null ? ApplicationThreadNative.asInterface(b) : null;
255 b = data.readStrongBinder();
256 IIntentReceiver rec
257 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
258 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
259 String perm = data.readString();
260 Intent intent = registerReceiver(app, rec, filter, perm);
261 reply.writeNoException();
262 if (intent != null) {
263 reply.writeInt(1);
264 intent.writeToParcel(reply, 0);
265 } else {
266 reply.writeInt(0);
267 }
268 return true;
269 }
270
271 case UNREGISTER_RECEIVER_TRANSACTION:
272 {
273 data.enforceInterface(IActivityManager.descriptor);
274 IBinder b = data.readStrongBinder();
275 if (b == null) {
276 return true;
277 }
278 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
279 unregisterReceiver(rec);
280 reply.writeNoException();
281 return true;
282 }
283
284 case BROADCAST_INTENT_TRANSACTION:
285 {
286 data.enforceInterface(IActivityManager.descriptor);
287 IBinder b = data.readStrongBinder();
288 IApplicationThread app =
289 b != null ? ApplicationThreadNative.asInterface(b) : null;
290 Intent intent = Intent.CREATOR.createFromParcel(data);
291 String resolvedType = data.readString();
292 b = data.readStrongBinder();
293 IIntentReceiver resultTo =
294 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
295 int resultCode = data.readInt();
296 String resultData = data.readString();
297 Bundle resultExtras = data.readBundle();
298 String perm = data.readString();
299 boolean serialized = data.readInt() != 0;
300 boolean sticky = data.readInt() != 0;
301 int res = broadcastIntent(app, intent, resolvedType, resultTo,
302 resultCode, resultData, resultExtras, perm,
303 serialized, sticky);
304 reply.writeNoException();
305 reply.writeInt(res);
306 return true;
307 }
308
309 case UNBROADCAST_INTENT_TRANSACTION:
310 {
311 data.enforceInterface(IActivityManager.descriptor);
312 IBinder b = data.readStrongBinder();
313 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
314 Intent intent = Intent.CREATOR.createFromParcel(data);
315 unbroadcastIntent(app, intent);
316 reply.writeNoException();
317 return true;
318 }
319
320 case FINISH_RECEIVER_TRANSACTION: {
321 data.enforceInterface(IActivityManager.descriptor);
322 IBinder who = data.readStrongBinder();
323 int resultCode = data.readInt();
324 String resultData = data.readString();
325 Bundle resultExtras = data.readBundle();
326 boolean resultAbort = data.readInt() != 0;
327 if (who != null) {
328 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
329 }
330 reply.writeNoException();
331 return true;
332 }
333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 case ATTACH_APPLICATION_TRANSACTION: {
335 data.enforceInterface(IActivityManager.descriptor);
336 IApplicationThread app = ApplicationThreadNative.asInterface(
337 data.readStrongBinder());
338 if (app != null) {
339 attachApplication(app);
340 }
341 reply.writeNoException();
342 return true;
343 }
344
345 case ACTIVITY_IDLE_TRANSACTION: {
346 data.enforceInterface(IActivityManager.descriptor);
347 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700348 Configuration config = null;
349 if (data.readInt() != 0) {
350 config = Configuration.CREATOR.createFromParcel(data);
351 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 if (token != null) {
Dianne Hackborne88846e2009-09-30 21:34:25 -0700353 activityIdle(token, config);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 }
355 reply.writeNoException();
356 return true;
357 }
358
359 case ACTIVITY_PAUSED_TRANSACTION: {
360 data.enforceInterface(IActivityManager.descriptor);
361 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800362 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 reply.writeNoException();
364 return true;
365 }
366
367 case ACTIVITY_STOPPED_TRANSACTION: {
368 data.enforceInterface(IActivityManager.descriptor);
369 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800370 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 Bitmap thumbnail = data.readInt() != 0
372 ? Bitmap.CREATOR.createFromParcel(data) : null;
373 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800374 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800375 reply.writeNoException();
376 return true;
377 }
378
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800379 case ACTIVITY_SLEPT_TRANSACTION: {
380 data.enforceInterface(IActivityManager.descriptor);
381 IBinder token = data.readStrongBinder();
382 activitySlept(token);
383 reply.writeNoException();
384 return true;
385 }
386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 case ACTIVITY_DESTROYED_TRANSACTION: {
388 data.enforceInterface(IActivityManager.descriptor);
389 IBinder token = data.readStrongBinder();
390 activityDestroyed(token);
391 reply.writeNoException();
392 return true;
393 }
394
395 case GET_CALLING_PACKAGE_TRANSACTION: {
396 data.enforceInterface(IActivityManager.descriptor);
397 IBinder token = data.readStrongBinder();
398 String res = token != null ? getCallingPackage(token) : null;
399 reply.writeNoException();
400 reply.writeString(res);
401 return true;
402 }
403
404 case GET_CALLING_ACTIVITY_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 ComponentName cn = getCallingActivity(token);
408 reply.writeNoException();
409 ComponentName.writeToParcel(cn, reply);
410 return true;
411 }
412
413 case GET_TASKS_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 int maxNum = data.readInt();
416 int fl = data.readInt();
417 IBinder receiverBinder = data.readStrongBinder();
418 IThumbnailReceiver receiver = receiverBinder != null
419 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
420 : null;
421 List list = getTasks(maxNum, fl, receiver);
422 reply.writeNoException();
423 int N = list != null ? list.size() : -1;
424 reply.writeInt(N);
425 int i;
426 for (i=0; i<N; i++) {
427 ActivityManager.RunningTaskInfo info =
428 (ActivityManager.RunningTaskInfo)list.get(i);
429 info.writeToParcel(reply, 0);
430 }
431 return true;
432 }
433
434 case GET_RECENT_TASKS_TRANSACTION: {
435 data.enforceInterface(IActivityManager.descriptor);
436 int maxNum = data.readInt();
437 int fl = data.readInt();
438 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
439 fl);
440 reply.writeNoException();
441 reply.writeTypedList(list);
442 return true;
443 }
444
Dianne Hackbornd94df452011-02-16 18:53:31 -0800445 case GET_TASK_THUMBNAIL_TRANSACTION: {
446 data.enforceInterface(IActivityManager.descriptor);
447 int id = data.readInt();
448 Bitmap bm = getTaskThumbnail(id);
449 reply.writeNoException();
450 if (bm != null) {
451 reply.writeInt(1);
452 bm.writeToParcel(reply, 0);
453 } else {
454 reply.writeInt(0);
455 }
456 return true;
457 }
458
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 case GET_SERVICES_TRANSACTION: {
460 data.enforceInterface(IActivityManager.descriptor);
461 int maxNum = data.readInt();
462 int fl = data.readInt();
463 List list = getServices(maxNum, fl);
464 reply.writeNoException();
465 int N = list != null ? list.size() : -1;
466 reply.writeInt(N);
467 int i;
468 for (i=0; i<N; i++) {
469 ActivityManager.RunningServiceInfo info =
470 (ActivityManager.RunningServiceInfo)list.get(i);
471 info.writeToParcel(reply, 0);
472 }
473 return true;
474 }
475
476 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
477 data.enforceInterface(IActivityManager.descriptor);
478 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
479 reply.writeNoException();
480 reply.writeTypedList(list);
481 return true;
482 }
483
484 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
485 data.enforceInterface(IActivityManager.descriptor);
486 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
487 reply.writeNoException();
488 reply.writeTypedList(list);
489 return true;
490 }
491
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700492 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
493 data.enforceInterface(IActivityManager.descriptor);
494 List<ApplicationInfo> list = getRunningExternalApplications();
495 reply.writeNoException();
496 reply.writeTypedList(list);
497 return true;
498 }
499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 case MOVE_TASK_TO_FRONT_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800503 int fl = data.readInt();
504 moveTaskToFront(task, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 reply.writeNoException();
506 return true;
507 }
508
509 case MOVE_TASK_TO_BACK_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 int task = data.readInt();
512 moveTaskToBack(task);
513 reply.writeNoException();
514 return true;
515 }
516
517 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder token = data.readStrongBinder();
520 boolean nonRoot = data.readInt() != 0;
521 boolean res = moveActivityTaskToBack(token, nonRoot);
522 reply.writeNoException();
523 reply.writeInt(res ? 1 : 0);
524 return true;
525 }
526
527 case MOVE_TASK_BACKWARDS_TRANSACTION: {
528 data.enforceInterface(IActivityManager.descriptor);
529 int task = data.readInt();
530 moveTaskBackwards(task);
531 reply.writeNoException();
532 return true;
533 }
534
535 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
536 data.enforceInterface(IActivityManager.descriptor);
537 IBinder token = data.readStrongBinder();
538 boolean onlyRoot = data.readInt() != 0;
539 int res = token != null
540 ? getTaskForActivity(token, onlyRoot) : -1;
541 reply.writeNoException();
542 reply.writeInt(res);
543 return true;
544 }
545
546 case FINISH_OTHER_INSTANCES_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 ComponentName className = ComponentName.readFromParcel(data);
550 finishOtherInstances(token, className);
551 reply.writeNoException();
552 return true;
553 }
554
555 case REPORT_THUMBNAIL_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 Bitmap thumbnail = data.readInt() != 0
559 ? Bitmap.CREATOR.createFromParcel(data) : null;
560 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
561 reportThumbnail(token, thumbnail, description);
562 reply.writeNoException();
563 return true;
564 }
565
566 case GET_CONTENT_PROVIDER_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder b = data.readStrongBinder();
569 IApplicationThread app = ApplicationThreadNative.asInterface(b);
570 String name = data.readString();
571 ContentProviderHolder cph = getContentProvider(app, name);
572 reply.writeNoException();
573 if (cph != null) {
574 reply.writeInt(1);
575 cph.writeToParcel(reply, 0);
576 } else {
577 reply.writeInt(0);
578 }
579 return true;
580 }
581
582 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
583 data.enforceInterface(IActivityManager.descriptor);
584 IBinder b = data.readStrongBinder();
585 IApplicationThread app = ApplicationThreadNative.asInterface(b);
586 ArrayList<ContentProviderHolder> providers =
587 data.createTypedArrayList(ContentProviderHolder.CREATOR);
588 publishContentProviders(app, providers);
589 reply.writeNoException();
590 return true;
591 }
592
593 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
594 data.enforceInterface(IActivityManager.descriptor);
595 IBinder b = data.readStrongBinder();
596 IApplicationThread app = ApplicationThreadNative.asInterface(b);
597 String name = data.readString();
598 removeContentProvider(app, name);
599 reply.writeNoException();
600 return true;
601 }
602
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700603 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
604 data.enforceInterface(IActivityManager.descriptor);
605 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
606 PendingIntent pi = getRunningServiceControlPanel(comp);
607 reply.writeNoException();
608 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
609 return true;
610 }
611
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 case START_SERVICE_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 IBinder b = data.readStrongBinder();
615 IApplicationThread app = ApplicationThreadNative.asInterface(b);
616 Intent service = Intent.CREATOR.createFromParcel(data);
617 String resolvedType = data.readString();
618 ComponentName cn = startService(app, service, resolvedType);
619 reply.writeNoException();
620 ComponentName.writeToParcel(cn, reply);
621 return true;
622 }
623
624 case STOP_SERVICE_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 IBinder b = data.readStrongBinder();
627 IApplicationThread app = ApplicationThreadNative.asInterface(b);
628 Intent service = Intent.CREATOR.createFromParcel(data);
629 String resolvedType = data.readString();
630 int res = stopService(app, service, resolvedType);
631 reply.writeNoException();
632 reply.writeInt(res);
633 return true;
634 }
635
636 case STOP_SERVICE_TOKEN_TRANSACTION: {
637 data.enforceInterface(IActivityManager.descriptor);
638 ComponentName className = ComponentName.readFromParcel(data);
639 IBinder token = data.readStrongBinder();
640 int startId = data.readInt();
641 boolean res = stopServiceToken(className, token, startId);
642 reply.writeNoException();
643 reply.writeInt(res ? 1 : 0);
644 return true;
645 }
646
647 case SET_SERVICE_FOREGROUND_TRANSACTION: {
648 data.enforceInterface(IActivityManager.descriptor);
649 ComponentName className = ComponentName.readFromParcel(data);
650 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700651 int id = data.readInt();
652 Notification notification = null;
653 if (data.readInt() != 0) {
654 notification = Notification.CREATOR.createFromParcel(data);
655 }
656 boolean removeNotification = data.readInt() != 0;
657 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800658 reply.writeNoException();
659 return true;
660 }
661
662 case BIND_SERVICE_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 IBinder b = data.readStrongBinder();
665 IApplicationThread app = ApplicationThreadNative.asInterface(b);
666 IBinder token = data.readStrongBinder();
667 Intent service = Intent.CREATOR.createFromParcel(data);
668 String resolvedType = data.readString();
669 b = data.readStrongBinder();
670 int fl = data.readInt();
671 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
672 int res = bindService(app, token, service, resolvedType, conn, fl);
673 reply.writeNoException();
674 reply.writeInt(res);
675 return true;
676 }
677
678 case UNBIND_SERVICE_TRANSACTION: {
679 data.enforceInterface(IActivityManager.descriptor);
680 IBinder b = data.readStrongBinder();
681 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
682 boolean res = unbindService(conn);
683 reply.writeNoException();
684 reply.writeInt(res ? 1 : 0);
685 return true;
686 }
687
688 case PUBLISH_SERVICE_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 IBinder token = data.readStrongBinder();
691 Intent intent = Intent.CREATOR.createFromParcel(data);
692 IBinder service = data.readStrongBinder();
693 publishService(token, intent, service);
694 reply.writeNoException();
695 return true;
696 }
697
698 case UNBIND_FINISHED_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 IBinder token = data.readStrongBinder();
701 Intent intent = Intent.CREATOR.createFromParcel(data);
702 boolean doRebind = data.readInt() != 0;
703 unbindFinished(token, intent, doRebind);
704 reply.writeNoException();
705 return true;
706 }
707
708 case SERVICE_DONE_EXECUTING_TRANSACTION: {
709 data.enforceInterface(IActivityManager.descriptor);
710 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700711 int type = data.readInt();
712 int startId = data.readInt();
713 int res = data.readInt();
714 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 reply.writeNoException();
716 return true;
717 }
718
719 case START_INSTRUMENTATION_TRANSACTION: {
720 data.enforceInterface(IActivityManager.descriptor);
721 ComponentName className = ComponentName.readFromParcel(data);
722 String profileFile = data.readString();
723 int fl = data.readInt();
724 Bundle arguments = data.readBundle();
725 IBinder b = data.readStrongBinder();
726 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
727 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
728 reply.writeNoException();
729 reply.writeInt(res ? 1 : 0);
730 return true;
731 }
732
733
734 case FINISH_INSTRUMENTATION_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 IBinder b = data.readStrongBinder();
737 IApplicationThread app = ApplicationThreadNative.asInterface(b);
738 int resultCode = data.readInt();
739 Bundle results = data.readBundle();
740 finishInstrumentation(app, resultCode, results);
741 reply.writeNoException();
742 return true;
743 }
744
745 case GET_CONFIGURATION_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 Configuration config = getConfiguration();
748 reply.writeNoException();
749 config.writeToParcel(reply, 0);
750 return true;
751 }
752
753 case UPDATE_CONFIGURATION_TRANSACTION: {
754 data.enforceInterface(IActivityManager.descriptor);
755 Configuration config = Configuration.CREATOR.createFromParcel(data);
756 updateConfiguration(config);
757 reply.writeNoException();
758 return true;
759 }
760
761 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 IBinder token = data.readStrongBinder();
764 int requestedOrientation = data.readInt();
765 setRequestedOrientation(token, requestedOrientation);
766 reply.writeNoException();
767 return true;
768 }
769
770 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 IBinder token = data.readStrongBinder();
773 int req = getRequestedOrientation(token);
774 reply.writeNoException();
775 reply.writeInt(req);
776 return true;
777 }
778
779 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
780 data.enforceInterface(IActivityManager.descriptor);
781 IBinder token = data.readStrongBinder();
782 ComponentName cn = getActivityClassForToken(token);
783 reply.writeNoException();
784 ComponentName.writeToParcel(cn, reply);
785 return true;
786 }
787
788 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder token = data.readStrongBinder();
791 reply.writeNoException();
792 reply.writeString(getPackageForToken(token));
793 return true;
794 }
795
796 case GET_INTENT_SENDER_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 int type = data.readInt();
799 String packageName = data.readString();
800 IBinder token = data.readStrongBinder();
801 String resultWho = data.readString();
802 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800803 Intent[] requestIntents;
804 String[] requestResolvedTypes;
805 if (data.readInt() != 0) {
806 requestIntents = data.createTypedArray(Intent.CREATOR);
807 requestResolvedTypes = data.createStringArray();
808 } else {
809 requestIntents = null;
810 requestResolvedTypes = null;
811 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800812 int fl = data.readInt();
813 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800814 resultWho, requestCode, requestIntents,
815 requestResolvedTypes, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 reply.writeNoException();
817 reply.writeStrongBinder(res != null ? res.asBinder() : null);
818 return true;
819 }
820
821 case CANCEL_INTENT_SENDER_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IIntentSender r = IIntentSender.Stub.asInterface(
824 data.readStrongBinder());
825 cancelIntentSender(r);
826 reply.writeNoException();
827 return true;
828 }
829
830 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IIntentSender r = IIntentSender.Stub.asInterface(
833 data.readStrongBinder());
834 String res = getPackageForIntentSender(r);
835 reply.writeNoException();
836 reply.writeString(res);
837 return true;
838 }
839
840 case SET_PROCESS_LIMIT_TRANSACTION: {
841 data.enforceInterface(IActivityManager.descriptor);
842 int max = data.readInt();
843 setProcessLimit(max);
844 reply.writeNoException();
845 return true;
846 }
847
848 case GET_PROCESS_LIMIT_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 int limit = getProcessLimit();
851 reply.writeNoException();
852 reply.writeInt(limit);
853 return true;
854 }
855
856 case SET_PROCESS_FOREGROUND_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 IBinder token = data.readStrongBinder();
859 int pid = data.readInt();
860 boolean isForeground = data.readInt() != 0;
861 setProcessForeground(token, pid, isForeground);
862 reply.writeNoException();
863 return true;
864 }
865
866 case CHECK_PERMISSION_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 String perm = data.readString();
869 int pid = data.readInt();
870 int uid = data.readInt();
871 int res = checkPermission(perm, pid, uid);
872 reply.writeNoException();
873 reply.writeInt(res);
874 return true;
875 }
876
877 case CHECK_URI_PERMISSION_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 Uri uri = Uri.CREATOR.createFromParcel(data);
880 int pid = data.readInt();
881 int uid = data.readInt();
882 int mode = data.readInt();
883 int res = checkUriPermission(uri, pid, uid, mode);
884 reply.writeNoException();
885 reply.writeInt(res);
886 return true;
887 }
888
889 case CLEAR_APP_DATA_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 String packageName = data.readString();
892 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
893 data.readStrongBinder());
894 boolean res = clearApplicationUserData(packageName, observer);
895 reply.writeNoException();
896 reply.writeInt(res ? 1 : 0);
897 return true;
898 }
899
900 case GRANT_URI_PERMISSION_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder b = data.readStrongBinder();
903 IApplicationThread app = ApplicationThreadNative.asInterface(b);
904 String targetPkg = data.readString();
905 Uri uri = Uri.CREATOR.createFromParcel(data);
906 int mode = data.readInt();
907 grantUriPermission(app, targetPkg, uri, mode);
908 reply.writeNoException();
909 return true;
910 }
911
912 case REVOKE_URI_PERMISSION_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 IBinder b = data.readStrongBinder();
915 IApplicationThread app = ApplicationThreadNative.asInterface(b);
916 Uri uri = Uri.CREATOR.createFromParcel(data);
917 int mode = data.readInt();
918 revokeUriPermission(app, uri, mode);
919 reply.writeNoException();
920 return true;
921 }
922
923 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 IApplicationThread app = ApplicationThreadNative.asInterface(b);
927 boolean waiting = data.readInt() != 0;
928 showWaitingForDebugger(app, waiting);
929 reply.writeNoException();
930 return true;
931 }
932
933 case GET_MEMORY_INFO_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
936 getMemoryInfo(mi);
937 reply.writeNoException();
938 mi.writeToParcel(reply, 0);
939 return true;
940 }
941
942 case UNHANDLED_BACK_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 unhandledBack();
945 reply.writeNoException();
946 return true;
947 }
948
949 case OPEN_CONTENT_URI_TRANSACTION: {
950 data.enforceInterface(IActivityManager.descriptor);
951 Uri uri = Uri.parse(data.readString());
952 ParcelFileDescriptor pfd = openContentUri(uri);
953 reply.writeNoException();
954 if (pfd != null) {
955 reply.writeInt(1);
956 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
957 } else {
958 reply.writeInt(0);
959 }
960 return true;
961 }
962
963 case GOING_TO_SLEEP_TRANSACTION: {
964 data.enforceInterface(IActivityManager.descriptor);
965 goingToSleep();
966 reply.writeNoException();
967 return true;
968 }
969
970 case WAKING_UP_TRANSACTION: {
971 data.enforceInterface(IActivityManager.descriptor);
972 wakingUp();
973 reply.writeNoException();
974 return true;
975 }
976
977 case SET_DEBUG_APP_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 String pn = data.readString();
980 boolean wfd = data.readInt() != 0;
981 boolean per = data.readInt() != 0;
982 setDebugApp(pn, wfd, per);
983 reply.writeNoException();
984 return true;
985 }
986
987 case SET_ALWAYS_FINISH_TRANSACTION: {
988 data.enforceInterface(IActivityManager.descriptor);
989 boolean enabled = data.readInt() != 0;
990 setAlwaysFinish(enabled);
991 reply.writeNoException();
992 return true;
993 }
994
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700995 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700997 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800998 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700999 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001000 return true;
1001 }
1002
1003 case ENTER_SAFE_MODE_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 enterSafeMode();
1006 reply.writeNoException();
1007 return true;
1008 }
1009
1010 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 IIntentSender is = IIntentSender.Stub.asInterface(
1013 data.readStrongBinder());
1014 noteWakeupAlarm(is);
1015 reply.writeNoException();
1016 return true;
1017 }
1018
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001019 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001020 data.enforceInterface(IActivityManager.descriptor);
1021 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001022 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001023 boolean secure = data.readInt() != 0;
1024 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001025 reply.writeNoException();
1026 reply.writeInt(res ? 1 : 0);
1027 return true;
1028 }
1029
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 case START_RUNNING_TRANSACTION: {
1031 data.enforceInterface(IActivityManager.descriptor);
1032 String pkg = data.readString();
1033 String cls = data.readString();
1034 String action = data.readString();
1035 String indata = data.readString();
1036 startRunning(pkg, cls, action, indata);
1037 reply.writeNoException();
1038 return true;
1039 }
1040
Dan Egnor60d87622009-12-16 16:32:58 -08001041 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1042 data.enforceInterface(IActivityManager.descriptor);
1043 IBinder app = data.readStrongBinder();
1044 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1045 handleApplicationCrash(app, ci);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
1050 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 data.enforceInterface(IActivityManager.descriptor);
1052 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001054 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001055 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001056 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001057 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001058 return true;
1059 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001060
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001061 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001064 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001065 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1066 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001067 reply.writeNoException();
1068 return true;
1069 }
1070
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001071 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 int sig = data.readInt();
1074 signalPersistentProcesses(sig);
1075 reply.writeNoException();
1076 return true;
1077 }
1078
Dianne Hackborn03abb812010-01-04 18:43:19 -08001079 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001082 killBackgroundProcesses(packageName);
1083 reply.writeNoException();
1084 return true;
1085 }
1086
1087 case FORCE_STOP_PACKAGE_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 String packageName = data.readString();
1090 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 reply.writeNoException();
1092 return true;
1093 }
1094
1095 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 ConfigurationInfo config = getDeviceConfigurationInfo();
1098 reply.writeNoException();
1099 config.writeToParcel(reply, 0);
1100 return true;
1101 }
1102
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001103 case PROFILE_CONTROL_TRANSACTION: {
1104 data.enforceInterface(IActivityManager.descriptor);
1105 String process = data.readString();
1106 boolean start = data.readInt() != 0;
1107 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001108 ParcelFileDescriptor fd = data.readInt() != 0
1109 ? data.readFileDescriptor() : null;
1110 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001111 reply.writeNoException();
1112 reply.writeInt(res ? 1 : 0);
1113 return true;
1114 }
1115
Dianne Hackborn55280a92009-05-07 15:53:46 -07001116 case SHUTDOWN_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 boolean res = shutdown(data.readInt());
1119 reply.writeNoException();
1120 reply.writeInt(res ? 1 : 0);
1121 return true;
1122 }
1123
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001124 case STOP_APP_SWITCHES_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 stopAppSwitches();
1127 reply.writeNoException();
1128 return true;
1129 }
1130
1131 case RESUME_APP_SWITCHES_TRANSACTION: {
1132 data.enforceInterface(IActivityManager.descriptor);
1133 resumeAppSwitches();
1134 reply.writeNoException();
1135 return true;
1136 }
1137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 case PEEK_SERVICE_TRANSACTION: {
1139 data.enforceInterface(IActivityManager.descriptor);
1140 Intent service = Intent.CREATOR.createFromParcel(data);
1141 String resolvedType = data.readString();
1142 IBinder binder = peekService(service, resolvedType);
1143 reply.writeNoException();
1144 reply.writeStrongBinder(binder);
1145 return true;
1146 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001147
1148 case START_BACKUP_AGENT_TRANSACTION: {
1149 data.enforceInterface(IActivityManager.descriptor);
1150 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1151 int backupRestoreMode = data.readInt();
1152 boolean success = bindBackupAgent(info, backupRestoreMode);
1153 reply.writeNoException();
1154 reply.writeInt(success ? 1 : 0);
1155 return true;
1156 }
1157
1158 case BACKUP_AGENT_CREATED_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 String packageName = data.readString();
1161 IBinder agent = data.readStrongBinder();
1162 backupAgentCreated(packageName, agent);
1163 reply.writeNoException();
1164 return true;
1165 }
1166
1167 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1170 unbindBackupAgent(info);
1171 reply.writeNoException();
1172 return true;
1173 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001174
1175 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1178 data.readStrongBinder());
1179 registerActivityWatcher(watcher);
1180 return true;
1181 }
1182
1183 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1184 data.enforceInterface(IActivityManager.descriptor);
1185 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1186 data.readStrongBinder());
1187 unregisterActivityWatcher(watcher);
1188 return true;
1189 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001190
1191 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1192 {
1193 data.enforceInterface(IActivityManager.descriptor);
1194 int uid = data.readInt();
1195 Intent intent = Intent.CREATOR.createFromParcel(data);
1196 String resolvedType = data.readString();
1197 IBinder resultTo = data.readStrongBinder();
1198 String resultWho = data.readString();
1199 int requestCode = data.readInt();
1200 boolean onlyIfNeeded = data.readInt() != 0;
1201 int result = startActivityInPackage(uid, intent, resolvedType,
1202 resultTo, resultWho, requestCode, onlyIfNeeded);
1203 reply.writeNoException();
1204 reply.writeInt(result);
1205 return true;
1206 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001207
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001208 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 String pkg = data.readString();
1211 int uid = data.readInt();
1212 killApplicationWithUid(pkg, uid);
1213 reply.writeNoException();
1214 return true;
1215 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001216
1217 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1218 data.enforceInterface(IActivityManager.descriptor);
1219 String reason = data.readString();
1220 closeSystemDialogs(reason);
1221 reply.writeNoException();
1222 return true;
1223 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001224
1225 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001227 int[] pids = data.createIntArray();
1228 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001229 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001230 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001231 return true;
1232 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001233
1234 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 String processName = data.readString();
1237 int uid = data.readInt();
1238 killApplicationProcess(processName, uid);
1239 reply.writeNoException();
1240 return true;
1241 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001242
1243 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
1245 IBinder token = data.readStrongBinder();
1246 String packageName = data.readString();
1247 int enterAnim = data.readInt();
1248 int exitAnim = data.readInt();
1249 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001250 reply.writeNoException();
1251 return true;
1252 }
1253
1254 case IS_USER_A_MONKEY_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001256 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001257 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001258 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001259 return true;
1260 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001261
1262 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1263 data.enforceInterface(IActivityManager.descriptor);
1264 finishHeavyWeightApp();
1265 reply.writeNoException();
1266 return true;
1267 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001268
1269 case IS_IMMERSIVE_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
1271 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001272 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001273 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001274 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001275 return true;
1276 }
1277
1278 case SET_IMMERSIVE_TRANSACTION: {
1279 data.enforceInterface(IActivityManager.descriptor);
1280 IBinder token = data.readStrongBinder();
1281 boolean imm = data.readInt() == 1;
1282 setImmersive(token, imm);
1283 reply.writeNoException();
1284 return true;
1285 }
1286
1287 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001289 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001290 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001291 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001292 return true;
1293 }
1294
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001295 case CRASH_APPLICATION_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 int uid = data.readInt();
1298 int initialPid = data.readInt();
1299 String packageName = data.readString();
1300 String message = data.readString();
1301 crashApplication(uid, initialPid, packageName, message);
1302 reply.writeNoException();
1303 return true;
1304 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001305
1306 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 Uri uri = Uri.CREATOR.createFromParcel(data);
1309 String type = getProviderMimeType(uri);
1310 reply.writeNoException();
1311 reply.writeString(type);
1312 return true;
1313 }
1314
Dianne Hackborn7e269642010-08-25 19:50:20 -07001315 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 String name = data.readString();
1318 IBinder perm = newUriPermissionOwner(name);
1319 reply.writeNoException();
1320 reply.writeStrongBinder(perm);
1321 return true;
1322 }
1323
1324 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1325 data.enforceInterface(IActivityManager.descriptor);
1326 IBinder owner = data.readStrongBinder();
1327 int fromUid = data.readInt();
1328 String targetPkg = data.readString();
1329 Uri uri = Uri.CREATOR.createFromParcel(data);
1330 int mode = data.readInt();
1331 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1332 reply.writeNoException();
1333 return true;
1334 }
1335
1336 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 IBinder owner = data.readStrongBinder();
1339 Uri uri = null;
1340 if (data.readInt() != 0) {
1341 Uri.CREATOR.createFromParcel(data);
1342 }
1343 int mode = data.readInt();
1344 revokeUriPermissionFromOwner(owner, uri, mode);
1345 reply.writeNoException();
1346 return true;
1347 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001348
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001349 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 int callingUid = data.readInt();
1352 String targetPkg = data.readString();
1353 Uri uri = Uri.CREATOR.createFromParcel(data);
1354 int modeFlags = data.readInt();
1355 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1356 reply.writeNoException();
1357 reply.writeInt(res);
1358 return true;
1359 }
1360
Andy McFadden824c5102010-07-09 16:26:57 -07001361 case DUMP_HEAP_TRANSACTION: {
1362 data.enforceInterface(IActivityManager.descriptor);
1363 String process = data.readString();
1364 boolean managed = data.readInt() != 0;
1365 String path = data.readString();
1366 ParcelFileDescriptor fd = data.readInt() != 0
1367 ? data.readFileDescriptor() : null;
1368 boolean res = dumpHeap(process, managed, path, fd);
1369 reply.writeNoException();
1370 reply.writeInt(res ? 1 : 0);
1371 return true;
1372 }
1373
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001374 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1375 {
1376 data.enforceInterface(IActivityManager.descriptor);
1377 int uid = data.readInt();
1378 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1379 String[] resolvedTypes = data.createStringArray();
1380 IBinder resultTo = data.readStrongBinder();
1381 int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
1382 reply.writeNoException();
1383 reply.writeInt(result);
1384 return true;
1385 }
1386
1387 case START_ACTIVITIES_TRANSACTION:
1388 {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 IBinder b = data.readStrongBinder();
1391 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1392 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1393 String[] resolvedTypes = data.createStringArray();
1394 IBinder resultTo = data.readStrongBinder();
1395 int result = startActivities(app, intents, resolvedTypes, resultTo);
1396 reply.writeNoException();
1397 reply.writeInt(result);
1398 return true;
1399 }
1400
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001401 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1402 {
1403 data.enforceInterface(IActivityManager.descriptor);
1404 String pkg = data.readString();
1405 boolean enabled = data.readInt() != 0;
1406 setPackageScreenCompatMode(pkg, enabled);
1407 reply.writeNoException();
1408 return true;
1409 }
1410
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001411 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001413 return super.onTransact(code, data, reply, flags);
1414 }
1415
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001416 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001417 return this;
1418 }
1419
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001420 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1421 protected IActivityManager create() {
1422 IBinder b = ServiceManager.getService("activity");
1423 if (Config.LOGV) {
1424 Log.v("ActivityManager", "default service binder = " + b);
1425 }
1426 IActivityManager am = asInterface(b);
1427 if (Config.LOGV) {
1428 Log.v("ActivityManager", "default service = " + am);
1429 }
1430 return am;
1431 }
1432 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433}
1434
1435class ActivityManagerProxy implements IActivityManager
1436{
1437 public ActivityManagerProxy(IBinder remote)
1438 {
1439 mRemote = remote;
1440 }
1441
1442 public IBinder asBinder()
1443 {
1444 return mRemote;
1445 }
1446
1447 public int startActivity(IApplicationThread caller, Intent intent,
1448 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1449 IBinder resultTo, String resultWho,
1450 int requestCode, boolean onlyIfNeeded,
1451 boolean debug) throws RemoteException {
1452 Parcel data = Parcel.obtain();
1453 Parcel reply = Parcel.obtain();
1454 data.writeInterfaceToken(IActivityManager.descriptor);
1455 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1456 intent.writeToParcel(data, 0);
1457 data.writeString(resolvedType);
1458 data.writeTypedArray(grantedUriPermissions, 0);
1459 data.writeInt(grantedMode);
1460 data.writeStrongBinder(resultTo);
1461 data.writeString(resultWho);
1462 data.writeInt(requestCode);
1463 data.writeInt(onlyIfNeeded ? 1 : 0);
1464 data.writeInt(debug ? 1 : 0);
1465 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1466 reply.readException();
1467 int result = reply.readInt();
1468 reply.recycle();
1469 data.recycle();
1470 return result;
1471 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001472 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1473 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1474 IBinder resultTo, String resultWho,
1475 int requestCode, boolean onlyIfNeeded,
1476 boolean debug) throws RemoteException {
1477 Parcel data = Parcel.obtain();
1478 Parcel reply = Parcel.obtain();
1479 data.writeInterfaceToken(IActivityManager.descriptor);
1480 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1481 intent.writeToParcel(data, 0);
1482 data.writeString(resolvedType);
1483 data.writeTypedArray(grantedUriPermissions, 0);
1484 data.writeInt(grantedMode);
1485 data.writeStrongBinder(resultTo);
1486 data.writeString(resultWho);
1487 data.writeInt(requestCode);
1488 data.writeInt(onlyIfNeeded ? 1 : 0);
1489 data.writeInt(debug ? 1 : 0);
1490 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1491 reply.readException();
1492 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1493 reply.recycle();
1494 data.recycle();
1495 return result;
1496 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001497 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1498 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1499 IBinder resultTo, String resultWho,
1500 int requestCode, boolean onlyIfNeeded,
1501 boolean debug, Configuration config) throws RemoteException {
1502 Parcel data = Parcel.obtain();
1503 Parcel reply = Parcel.obtain();
1504 data.writeInterfaceToken(IActivityManager.descriptor);
1505 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1506 intent.writeToParcel(data, 0);
1507 data.writeString(resolvedType);
1508 data.writeTypedArray(grantedUriPermissions, 0);
1509 data.writeInt(grantedMode);
1510 data.writeStrongBinder(resultTo);
1511 data.writeString(resultWho);
1512 data.writeInt(requestCode);
1513 data.writeInt(onlyIfNeeded ? 1 : 0);
1514 data.writeInt(debug ? 1 : 0);
1515 config.writeToParcel(data, 0);
1516 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1517 reply.readException();
1518 int result = reply.readInt();
1519 reply.recycle();
1520 data.recycle();
1521 return result;
1522 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001523 public int startActivityIntentSender(IApplicationThread caller,
1524 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001525 IBinder resultTo, String resultWho, int requestCode,
1526 int flagsMask, int flagsValues) throws RemoteException {
1527 Parcel data = Parcel.obtain();
1528 Parcel reply = Parcel.obtain();
1529 data.writeInterfaceToken(IActivityManager.descriptor);
1530 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1531 intent.writeToParcel(data, 0);
1532 if (fillInIntent != null) {
1533 data.writeInt(1);
1534 fillInIntent.writeToParcel(data, 0);
1535 } else {
1536 data.writeInt(0);
1537 }
1538 data.writeString(resolvedType);
1539 data.writeStrongBinder(resultTo);
1540 data.writeString(resultWho);
1541 data.writeInt(requestCode);
1542 data.writeInt(flagsMask);
1543 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001544 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001545 reply.readException();
1546 int result = reply.readInt();
1547 reply.recycle();
1548 data.recycle();
1549 return result;
1550 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001551 public boolean startNextMatchingActivity(IBinder callingActivity,
1552 Intent intent) throws RemoteException {
1553 Parcel data = Parcel.obtain();
1554 Parcel reply = Parcel.obtain();
1555 data.writeInterfaceToken(IActivityManager.descriptor);
1556 data.writeStrongBinder(callingActivity);
1557 intent.writeToParcel(data, 0);
1558 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1559 reply.readException();
1560 int result = reply.readInt();
1561 reply.recycle();
1562 data.recycle();
1563 return result != 0;
1564 }
1565 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1566 throws RemoteException {
1567 Parcel data = Parcel.obtain();
1568 Parcel reply = Parcel.obtain();
1569 data.writeInterfaceToken(IActivityManager.descriptor);
1570 data.writeStrongBinder(token);
1571 data.writeInt(resultCode);
1572 if (resultData != null) {
1573 data.writeInt(1);
1574 resultData.writeToParcel(data, 0);
1575 } else {
1576 data.writeInt(0);
1577 }
1578 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1579 reply.readException();
1580 boolean res = reply.readInt() != 0;
1581 data.recycle();
1582 reply.recycle();
1583 return res;
1584 }
1585 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1586 {
1587 Parcel data = Parcel.obtain();
1588 Parcel reply = Parcel.obtain();
1589 data.writeInterfaceToken(IActivityManager.descriptor);
1590 data.writeStrongBinder(token);
1591 data.writeString(resultWho);
1592 data.writeInt(requestCode);
1593 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1594 reply.readException();
1595 data.recycle();
1596 reply.recycle();
1597 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001598 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1599 Parcel data = Parcel.obtain();
1600 Parcel reply = Parcel.obtain();
1601 data.writeInterfaceToken(IActivityManager.descriptor);
1602 data.writeStrongBinder(token);
1603 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1604 reply.readException();
1605 boolean res = reply.readInt() != 0;
1606 data.recycle();
1607 reply.recycle();
1608 return res;
1609 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610 public Intent registerReceiver(IApplicationThread caller,
1611 IIntentReceiver receiver,
1612 IntentFilter filter, String perm) throws RemoteException
1613 {
1614 Parcel data = Parcel.obtain();
1615 Parcel reply = Parcel.obtain();
1616 data.writeInterfaceToken(IActivityManager.descriptor);
1617 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1618 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1619 filter.writeToParcel(data, 0);
1620 data.writeString(perm);
1621 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1622 reply.readException();
1623 Intent intent = null;
1624 int haveIntent = reply.readInt();
1625 if (haveIntent != 0) {
1626 intent = Intent.CREATOR.createFromParcel(reply);
1627 }
1628 reply.recycle();
1629 data.recycle();
1630 return intent;
1631 }
1632 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1633 {
1634 Parcel data = Parcel.obtain();
1635 Parcel reply = Parcel.obtain();
1636 data.writeInterfaceToken(IActivityManager.descriptor);
1637 data.writeStrongBinder(receiver.asBinder());
1638 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1639 reply.readException();
1640 data.recycle();
1641 reply.recycle();
1642 }
1643 public int broadcastIntent(IApplicationThread caller,
1644 Intent intent, String resolvedType, IIntentReceiver resultTo,
1645 int resultCode, String resultData, Bundle map,
1646 String requiredPermission, boolean serialized,
1647 boolean sticky) throws RemoteException
1648 {
1649 Parcel data = Parcel.obtain();
1650 Parcel reply = Parcel.obtain();
1651 data.writeInterfaceToken(IActivityManager.descriptor);
1652 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1653 intent.writeToParcel(data, 0);
1654 data.writeString(resolvedType);
1655 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1656 data.writeInt(resultCode);
1657 data.writeString(resultData);
1658 data.writeBundle(map);
1659 data.writeString(requiredPermission);
1660 data.writeInt(serialized ? 1 : 0);
1661 data.writeInt(sticky ? 1 : 0);
1662 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1663 reply.readException();
1664 int res = reply.readInt();
1665 reply.recycle();
1666 data.recycle();
1667 return res;
1668 }
1669 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1670 {
1671 Parcel data = Parcel.obtain();
1672 Parcel reply = Parcel.obtain();
1673 data.writeInterfaceToken(IActivityManager.descriptor);
1674 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1675 intent.writeToParcel(data, 0);
1676 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1677 reply.readException();
1678 data.recycle();
1679 reply.recycle();
1680 }
1681 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1682 {
1683 Parcel data = Parcel.obtain();
1684 Parcel reply = Parcel.obtain();
1685 data.writeInterfaceToken(IActivityManager.descriptor);
1686 data.writeStrongBinder(who);
1687 data.writeInt(resultCode);
1688 data.writeString(resultData);
1689 data.writeBundle(map);
1690 data.writeInt(abortBroadcast ? 1 : 0);
1691 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1692 reply.readException();
1693 data.recycle();
1694 reply.recycle();
1695 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001696 public void attachApplication(IApplicationThread app) throws RemoteException
1697 {
1698 Parcel data = Parcel.obtain();
1699 Parcel reply = Parcel.obtain();
1700 data.writeInterfaceToken(IActivityManager.descriptor);
1701 data.writeStrongBinder(app.asBinder());
1702 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1703 reply.readException();
1704 data.recycle();
1705 reply.recycle();
1706 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001707 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001708 {
1709 Parcel data = Parcel.obtain();
1710 Parcel reply = Parcel.obtain();
1711 data.writeInterfaceToken(IActivityManager.descriptor);
1712 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001713 if (config != null) {
1714 data.writeInt(1);
1715 config.writeToParcel(data, 0);
1716 } else {
1717 data.writeInt(0);
1718 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001719 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1720 reply.readException();
1721 data.recycle();
1722 reply.recycle();
1723 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001724 public void activityPaused(IBinder token) throws RemoteException
1725 {
1726 Parcel data = Parcel.obtain();
1727 Parcel reply = Parcel.obtain();
1728 data.writeInterfaceToken(IActivityManager.descriptor);
1729 data.writeStrongBinder(token);
1730 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1731 reply.readException();
1732 data.recycle();
1733 reply.recycle();
1734 }
1735 public void activityStopped(IBinder token, Bundle state,
1736 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001737 {
1738 Parcel data = Parcel.obtain();
1739 Parcel reply = Parcel.obtain();
1740 data.writeInterfaceToken(IActivityManager.descriptor);
1741 data.writeStrongBinder(token);
1742 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001743 if (thumbnail != null) {
1744 data.writeInt(1);
1745 thumbnail.writeToParcel(data, 0);
1746 } else {
1747 data.writeInt(0);
1748 }
1749 TextUtils.writeToParcel(description, data, 0);
1750 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1751 reply.readException();
1752 data.recycle();
1753 reply.recycle();
1754 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001755 public void activitySlept(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_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1762 reply.readException();
1763 data.recycle();
1764 reply.recycle();
1765 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001766 public void activityDestroyed(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(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1773 reply.readException();
1774 data.recycle();
1775 reply.recycle();
1776 }
1777 public String getCallingPackage(IBinder token) throws RemoteException
1778 {
1779 Parcel data = Parcel.obtain();
1780 Parcel reply = Parcel.obtain();
1781 data.writeInterfaceToken(IActivityManager.descriptor);
1782 data.writeStrongBinder(token);
1783 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1784 reply.readException();
1785 String res = reply.readString();
1786 data.recycle();
1787 reply.recycle();
1788 return res;
1789 }
1790 public ComponentName getCallingActivity(IBinder token)
1791 throws RemoteException {
1792 Parcel data = Parcel.obtain();
1793 Parcel reply = Parcel.obtain();
1794 data.writeInterfaceToken(IActivityManager.descriptor);
1795 data.writeStrongBinder(token);
1796 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1797 reply.readException();
1798 ComponentName res = ComponentName.readFromParcel(reply);
1799 data.recycle();
1800 reply.recycle();
1801 return res;
1802 }
1803 public List getTasks(int maxNum, int flags,
1804 IThumbnailReceiver receiver) throws RemoteException {
1805 Parcel data = Parcel.obtain();
1806 Parcel reply = Parcel.obtain();
1807 data.writeInterfaceToken(IActivityManager.descriptor);
1808 data.writeInt(maxNum);
1809 data.writeInt(flags);
1810 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1811 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1812 reply.readException();
1813 ArrayList list = null;
1814 int N = reply.readInt();
1815 if (N >= 0) {
1816 list = new ArrayList();
1817 while (N > 0) {
1818 ActivityManager.RunningTaskInfo info =
1819 ActivityManager.RunningTaskInfo.CREATOR
1820 .createFromParcel(reply);
1821 list.add(info);
1822 N--;
1823 }
1824 }
1825 data.recycle();
1826 reply.recycle();
1827 return list;
1828 }
1829 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1830 int flags) throws RemoteException {
1831 Parcel data = Parcel.obtain();
1832 Parcel reply = Parcel.obtain();
1833 data.writeInterfaceToken(IActivityManager.descriptor);
1834 data.writeInt(maxNum);
1835 data.writeInt(flags);
1836 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1837 reply.readException();
1838 ArrayList<ActivityManager.RecentTaskInfo> list
1839 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1840 data.recycle();
1841 reply.recycle();
1842 return list;
1843 }
Dianne Hackbornd94df452011-02-16 18:53:31 -08001844 public Bitmap getTaskThumbnail(int id) throws RemoteException {
1845 Parcel data = Parcel.obtain();
1846 Parcel reply = Parcel.obtain();
1847 data.writeInterfaceToken(IActivityManager.descriptor);
1848 data.writeInt(id);
1849 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
1850 reply.readException();
1851 Bitmap bm = null;
1852 if (reply.readInt() != 0) {
1853 bm = Bitmap.CREATOR.createFromParcel(reply);
1854 }
1855 data.recycle();
1856 reply.recycle();
1857 return bm;
1858 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001859 public List getServices(int maxNum, int flags) throws RemoteException {
1860 Parcel data = Parcel.obtain();
1861 Parcel reply = Parcel.obtain();
1862 data.writeInterfaceToken(IActivityManager.descriptor);
1863 data.writeInt(maxNum);
1864 data.writeInt(flags);
1865 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1866 reply.readException();
1867 ArrayList list = null;
1868 int N = reply.readInt();
1869 if (N >= 0) {
1870 list = new ArrayList();
1871 while (N > 0) {
1872 ActivityManager.RunningServiceInfo info =
1873 ActivityManager.RunningServiceInfo.CREATOR
1874 .createFromParcel(reply);
1875 list.add(info);
1876 N--;
1877 }
1878 }
1879 data.recycle();
1880 reply.recycle();
1881 return list;
1882 }
1883 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1884 throws RemoteException {
1885 Parcel data = Parcel.obtain();
1886 Parcel reply = Parcel.obtain();
1887 data.writeInterfaceToken(IActivityManager.descriptor);
1888 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1889 reply.readException();
1890 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1891 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1892 data.recycle();
1893 reply.recycle();
1894 return list;
1895 }
1896 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1897 throws RemoteException {
1898 Parcel data = Parcel.obtain();
1899 Parcel reply = Parcel.obtain();
1900 data.writeInterfaceToken(IActivityManager.descriptor);
1901 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1902 reply.readException();
1903 ArrayList<ActivityManager.RunningAppProcessInfo> list
1904 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1905 data.recycle();
1906 reply.recycle();
1907 return list;
1908 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07001909 public List<ApplicationInfo> getRunningExternalApplications()
1910 throws RemoteException {
1911 Parcel data = Parcel.obtain();
1912 Parcel reply = Parcel.obtain();
1913 data.writeInterfaceToken(IActivityManager.descriptor);
1914 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
1915 reply.readException();
1916 ArrayList<ApplicationInfo> list
1917 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
1918 data.recycle();
1919 reply.recycle();
1920 return list;
1921 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001922 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001923 {
1924 Parcel data = Parcel.obtain();
1925 Parcel reply = Parcel.obtain();
1926 data.writeInterfaceToken(IActivityManager.descriptor);
1927 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001928 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001929 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1930 reply.readException();
1931 data.recycle();
1932 reply.recycle();
1933 }
1934 public void moveTaskToBack(int task) throws RemoteException
1935 {
1936 Parcel data = Parcel.obtain();
1937 Parcel reply = Parcel.obtain();
1938 data.writeInterfaceToken(IActivityManager.descriptor);
1939 data.writeInt(task);
1940 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1941 reply.readException();
1942 data.recycle();
1943 reply.recycle();
1944 }
1945 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1946 throws RemoteException {
1947 Parcel data = Parcel.obtain();
1948 Parcel reply = Parcel.obtain();
1949 data.writeInterfaceToken(IActivityManager.descriptor);
1950 data.writeStrongBinder(token);
1951 data.writeInt(nonRoot ? 1 : 0);
1952 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1953 reply.readException();
1954 boolean res = reply.readInt() != 0;
1955 data.recycle();
1956 reply.recycle();
1957 return res;
1958 }
1959 public void moveTaskBackwards(int task) throws RemoteException
1960 {
1961 Parcel data = Parcel.obtain();
1962 Parcel reply = Parcel.obtain();
1963 data.writeInterfaceToken(IActivityManager.descriptor);
1964 data.writeInt(task);
1965 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1966 reply.readException();
1967 data.recycle();
1968 reply.recycle();
1969 }
1970 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
1971 {
1972 Parcel data = Parcel.obtain();
1973 Parcel reply = Parcel.obtain();
1974 data.writeInterfaceToken(IActivityManager.descriptor);
1975 data.writeStrongBinder(token);
1976 data.writeInt(onlyRoot ? 1 : 0);
1977 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
1978 reply.readException();
1979 int res = reply.readInt();
1980 data.recycle();
1981 reply.recycle();
1982 return res;
1983 }
1984 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
1985 {
1986 Parcel data = Parcel.obtain();
1987 Parcel reply = Parcel.obtain();
1988 data.writeInterfaceToken(IActivityManager.descriptor);
1989 data.writeStrongBinder(token);
1990 ComponentName.writeToParcel(className, data);
1991 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
1992 reply.readException();
1993 data.recycle();
1994 reply.recycle();
1995 }
1996 public void reportThumbnail(IBinder token,
1997 Bitmap thumbnail, CharSequence description) throws RemoteException
1998 {
1999 Parcel data = Parcel.obtain();
2000 Parcel reply = Parcel.obtain();
2001 data.writeInterfaceToken(IActivityManager.descriptor);
2002 data.writeStrongBinder(token);
2003 if (thumbnail != null) {
2004 data.writeInt(1);
2005 thumbnail.writeToParcel(data, 0);
2006 } else {
2007 data.writeInt(0);
2008 }
2009 TextUtils.writeToParcel(description, data, 0);
2010 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2011 reply.readException();
2012 data.recycle();
2013 reply.recycle();
2014 }
2015 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2016 String name) throws RemoteException
2017 {
2018 Parcel data = Parcel.obtain();
2019 Parcel reply = Parcel.obtain();
2020 data.writeInterfaceToken(IActivityManager.descriptor);
2021 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2022 data.writeString(name);
2023 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2024 reply.readException();
2025 int res = reply.readInt();
2026 ContentProviderHolder cph = null;
2027 if (res != 0) {
2028 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2029 }
2030 data.recycle();
2031 reply.recycle();
2032 return cph;
2033 }
2034 public void publishContentProviders(IApplicationThread caller,
2035 List<ContentProviderHolder> providers) throws RemoteException
2036 {
2037 Parcel data = Parcel.obtain();
2038 Parcel reply = Parcel.obtain();
2039 data.writeInterfaceToken(IActivityManager.descriptor);
2040 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2041 data.writeTypedList(providers);
2042 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2043 reply.readException();
2044 data.recycle();
2045 reply.recycle();
2046 }
2047
2048 public void removeContentProvider(IApplicationThread caller,
2049 String name) throws RemoteException {
2050 Parcel data = Parcel.obtain();
2051 Parcel reply = Parcel.obtain();
2052 data.writeInterfaceToken(IActivityManager.descriptor);
2053 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2054 data.writeString(name);
2055 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2056 reply.readException();
2057 data.recycle();
2058 reply.recycle();
2059 }
2060
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002061 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2062 throws RemoteException
2063 {
2064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 service.writeToParcel(data, 0);
2068 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2069 reply.readException();
2070 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2071 data.recycle();
2072 reply.recycle();
2073 return res;
2074 }
2075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002076 public ComponentName startService(IApplicationThread caller, Intent service,
2077 String resolvedType) throws RemoteException
2078 {
2079 Parcel data = Parcel.obtain();
2080 Parcel reply = Parcel.obtain();
2081 data.writeInterfaceToken(IActivityManager.descriptor);
2082 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2083 service.writeToParcel(data, 0);
2084 data.writeString(resolvedType);
2085 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2086 reply.readException();
2087 ComponentName res = ComponentName.readFromParcel(reply);
2088 data.recycle();
2089 reply.recycle();
2090 return res;
2091 }
2092 public int stopService(IApplicationThread caller, Intent service,
2093 String resolvedType) throws RemoteException
2094 {
2095 Parcel data = Parcel.obtain();
2096 Parcel reply = Parcel.obtain();
2097 data.writeInterfaceToken(IActivityManager.descriptor);
2098 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2099 service.writeToParcel(data, 0);
2100 data.writeString(resolvedType);
2101 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2102 reply.readException();
2103 int res = reply.readInt();
2104 reply.recycle();
2105 data.recycle();
2106 return res;
2107 }
2108 public boolean stopServiceToken(ComponentName className, IBinder token,
2109 int startId) throws RemoteException {
2110 Parcel data = Parcel.obtain();
2111 Parcel reply = Parcel.obtain();
2112 data.writeInterfaceToken(IActivityManager.descriptor);
2113 ComponentName.writeToParcel(className, data);
2114 data.writeStrongBinder(token);
2115 data.writeInt(startId);
2116 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2117 reply.readException();
2118 boolean res = reply.readInt() != 0;
2119 data.recycle();
2120 reply.recycle();
2121 return res;
2122 }
2123 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002124 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002125 Parcel data = Parcel.obtain();
2126 Parcel reply = Parcel.obtain();
2127 data.writeInterfaceToken(IActivityManager.descriptor);
2128 ComponentName.writeToParcel(className, data);
2129 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002130 data.writeInt(id);
2131 if (notification != null) {
2132 data.writeInt(1);
2133 notification.writeToParcel(data, 0);
2134 } else {
2135 data.writeInt(0);
2136 }
2137 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002138 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2139 reply.readException();
2140 data.recycle();
2141 reply.recycle();
2142 }
2143 public int bindService(IApplicationThread caller, IBinder token,
2144 Intent service, String resolvedType, IServiceConnection connection,
2145 int flags) throws RemoteException {
2146 Parcel data = Parcel.obtain();
2147 Parcel reply = Parcel.obtain();
2148 data.writeInterfaceToken(IActivityManager.descriptor);
2149 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2150 data.writeStrongBinder(token);
2151 service.writeToParcel(data, 0);
2152 data.writeString(resolvedType);
2153 data.writeStrongBinder(connection.asBinder());
2154 data.writeInt(flags);
2155 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2156 reply.readException();
2157 int res = reply.readInt();
2158 data.recycle();
2159 reply.recycle();
2160 return res;
2161 }
2162 public boolean unbindService(IServiceConnection connection) throws RemoteException
2163 {
2164 Parcel data = Parcel.obtain();
2165 Parcel reply = Parcel.obtain();
2166 data.writeInterfaceToken(IActivityManager.descriptor);
2167 data.writeStrongBinder(connection.asBinder());
2168 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2169 reply.readException();
2170 boolean res = reply.readInt() != 0;
2171 data.recycle();
2172 reply.recycle();
2173 return res;
2174 }
2175
2176 public void publishService(IBinder token,
2177 Intent intent, IBinder service) throws RemoteException {
2178 Parcel data = Parcel.obtain();
2179 Parcel reply = Parcel.obtain();
2180 data.writeInterfaceToken(IActivityManager.descriptor);
2181 data.writeStrongBinder(token);
2182 intent.writeToParcel(data, 0);
2183 data.writeStrongBinder(service);
2184 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2185 reply.readException();
2186 data.recycle();
2187 reply.recycle();
2188 }
2189
2190 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2191 throws RemoteException {
2192 Parcel data = Parcel.obtain();
2193 Parcel reply = Parcel.obtain();
2194 data.writeInterfaceToken(IActivityManager.descriptor);
2195 data.writeStrongBinder(token);
2196 intent.writeToParcel(data, 0);
2197 data.writeInt(doRebind ? 1 : 0);
2198 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2199 reply.readException();
2200 data.recycle();
2201 reply.recycle();
2202 }
2203
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002204 public void serviceDoneExecuting(IBinder token, int type, int startId,
2205 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002206 Parcel data = Parcel.obtain();
2207 Parcel reply = Parcel.obtain();
2208 data.writeInterfaceToken(IActivityManager.descriptor);
2209 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002210 data.writeInt(type);
2211 data.writeInt(startId);
2212 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002213 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2214 reply.readException();
2215 data.recycle();
2216 reply.recycle();
2217 }
2218
2219 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2220 Parcel data = Parcel.obtain();
2221 Parcel reply = Parcel.obtain();
2222 data.writeInterfaceToken(IActivityManager.descriptor);
2223 service.writeToParcel(data, 0);
2224 data.writeString(resolvedType);
2225 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2226 reply.readException();
2227 IBinder binder = reply.readStrongBinder();
2228 reply.recycle();
2229 data.recycle();
2230 return binder;
2231 }
2232
Christopher Tate181fafa2009-05-14 11:12:14 -07002233 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2234 throws RemoteException {
2235 Parcel data = Parcel.obtain();
2236 Parcel reply = Parcel.obtain();
2237 data.writeInterfaceToken(IActivityManager.descriptor);
2238 app.writeToParcel(data, 0);
2239 data.writeInt(backupRestoreMode);
2240 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2241 reply.readException();
2242 boolean success = reply.readInt() != 0;
2243 reply.recycle();
2244 data.recycle();
2245 return success;
2246 }
2247
2248 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2249 Parcel data = Parcel.obtain();
2250 Parcel reply = Parcel.obtain();
2251 data.writeInterfaceToken(IActivityManager.descriptor);
2252 data.writeString(packageName);
2253 data.writeStrongBinder(agent);
2254 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2255 reply.recycle();
2256 data.recycle();
2257 }
2258
2259 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2260 Parcel data = Parcel.obtain();
2261 Parcel reply = Parcel.obtain();
2262 data.writeInterfaceToken(IActivityManager.descriptor);
2263 app.writeToParcel(data, 0);
2264 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2265 reply.readException();
2266 reply.recycle();
2267 data.recycle();
2268 }
2269
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002270 public boolean startInstrumentation(ComponentName className, String profileFile,
2271 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2272 throws RemoteException {
2273 Parcel data = Parcel.obtain();
2274 Parcel reply = Parcel.obtain();
2275 data.writeInterfaceToken(IActivityManager.descriptor);
2276 ComponentName.writeToParcel(className, data);
2277 data.writeString(profileFile);
2278 data.writeInt(flags);
2279 data.writeBundle(arguments);
2280 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2281 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2282 reply.readException();
2283 boolean res = reply.readInt() != 0;
2284 reply.recycle();
2285 data.recycle();
2286 return res;
2287 }
2288
2289 public void finishInstrumentation(IApplicationThread target,
2290 int resultCode, Bundle results) throws RemoteException {
2291 Parcel data = Parcel.obtain();
2292 Parcel reply = Parcel.obtain();
2293 data.writeInterfaceToken(IActivityManager.descriptor);
2294 data.writeStrongBinder(target != null ? target.asBinder() : null);
2295 data.writeInt(resultCode);
2296 data.writeBundle(results);
2297 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2298 reply.readException();
2299 data.recycle();
2300 reply.recycle();
2301 }
2302 public Configuration getConfiguration() throws RemoteException
2303 {
2304 Parcel data = Parcel.obtain();
2305 Parcel reply = Parcel.obtain();
2306 data.writeInterfaceToken(IActivityManager.descriptor);
2307 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2308 reply.readException();
2309 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2310 reply.recycle();
2311 data.recycle();
2312 return res;
2313 }
2314 public void updateConfiguration(Configuration values) throws RemoteException
2315 {
2316 Parcel data = Parcel.obtain();
2317 Parcel reply = Parcel.obtain();
2318 data.writeInterfaceToken(IActivityManager.descriptor);
2319 values.writeToParcel(data, 0);
2320 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2321 reply.readException();
2322 data.recycle();
2323 reply.recycle();
2324 }
2325 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2326 throws RemoteException {
2327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 data.writeStrongBinder(token);
2331 data.writeInt(requestedOrientation);
2332 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 data.recycle();
2335 reply.recycle();
2336 }
2337 public int getRequestedOrientation(IBinder token) throws RemoteException {
2338 Parcel data = Parcel.obtain();
2339 Parcel reply = Parcel.obtain();
2340 data.writeInterfaceToken(IActivityManager.descriptor);
2341 data.writeStrongBinder(token);
2342 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2343 reply.readException();
2344 int res = reply.readInt();
2345 data.recycle();
2346 reply.recycle();
2347 return res;
2348 }
2349 public ComponentName getActivityClassForToken(IBinder token)
2350 throws RemoteException {
2351 Parcel data = Parcel.obtain();
2352 Parcel reply = Parcel.obtain();
2353 data.writeInterfaceToken(IActivityManager.descriptor);
2354 data.writeStrongBinder(token);
2355 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2356 reply.readException();
2357 ComponentName res = ComponentName.readFromParcel(reply);
2358 data.recycle();
2359 reply.recycle();
2360 return res;
2361 }
2362 public String getPackageForToken(IBinder token) throws RemoteException
2363 {
2364 Parcel data = Parcel.obtain();
2365 Parcel reply = Parcel.obtain();
2366 data.writeInterfaceToken(IActivityManager.descriptor);
2367 data.writeStrongBinder(token);
2368 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2369 reply.readException();
2370 String res = reply.readString();
2371 data.recycle();
2372 reply.recycle();
2373 return res;
2374 }
2375 public IIntentSender getIntentSender(int type,
2376 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002377 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002378 throws RemoteException {
2379 Parcel data = Parcel.obtain();
2380 Parcel reply = Parcel.obtain();
2381 data.writeInterfaceToken(IActivityManager.descriptor);
2382 data.writeInt(type);
2383 data.writeString(packageName);
2384 data.writeStrongBinder(token);
2385 data.writeString(resultWho);
2386 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002387 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002388 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002389 data.writeTypedArray(intents, 0);
2390 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002391 } else {
2392 data.writeInt(0);
2393 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002394 data.writeInt(flags);
2395 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2396 reply.readException();
2397 IIntentSender res = IIntentSender.Stub.asInterface(
2398 reply.readStrongBinder());
2399 data.recycle();
2400 reply.recycle();
2401 return res;
2402 }
2403 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2404 Parcel data = Parcel.obtain();
2405 Parcel reply = Parcel.obtain();
2406 data.writeInterfaceToken(IActivityManager.descriptor);
2407 data.writeStrongBinder(sender.asBinder());
2408 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2409 reply.readException();
2410 data.recycle();
2411 reply.recycle();
2412 }
2413 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2414 Parcel data = Parcel.obtain();
2415 Parcel reply = Parcel.obtain();
2416 data.writeInterfaceToken(IActivityManager.descriptor);
2417 data.writeStrongBinder(sender.asBinder());
2418 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2419 reply.readException();
2420 String res = reply.readString();
2421 data.recycle();
2422 reply.recycle();
2423 return res;
2424 }
2425 public void setProcessLimit(int max) throws RemoteException
2426 {
2427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 data.writeInt(max);
2431 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2432 reply.readException();
2433 data.recycle();
2434 reply.recycle();
2435 }
2436 public int getProcessLimit() throws RemoteException
2437 {
2438 Parcel data = Parcel.obtain();
2439 Parcel reply = Parcel.obtain();
2440 data.writeInterfaceToken(IActivityManager.descriptor);
2441 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 int res = reply.readInt();
2444 data.recycle();
2445 reply.recycle();
2446 return res;
2447 }
2448 public void setProcessForeground(IBinder token, int pid,
2449 boolean isForeground) throws RemoteException {
2450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 data.writeStrongBinder(token);
2454 data.writeInt(pid);
2455 data.writeInt(isForeground ? 1 : 0);
2456 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2457 reply.readException();
2458 data.recycle();
2459 reply.recycle();
2460 }
2461 public int checkPermission(String permission, int pid, int uid)
2462 throws RemoteException {
2463 Parcel data = Parcel.obtain();
2464 Parcel reply = Parcel.obtain();
2465 data.writeInterfaceToken(IActivityManager.descriptor);
2466 data.writeString(permission);
2467 data.writeInt(pid);
2468 data.writeInt(uid);
2469 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2470 reply.readException();
2471 int res = reply.readInt();
2472 data.recycle();
2473 reply.recycle();
2474 return res;
2475 }
2476 public boolean clearApplicationUserData(final String packageName,
2477 final IPackageDataObserver observer) throws RemoteException {
2478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 data.writeString(packageName);
2482 data.writeStrongBinder(observer.asBinder());
2483 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 boolean res = reply.readInt() != 0;
2486 data.recycle();
2487 reply.recycle();
2488 return res;
2489 }
2490 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2491 throws RemoteException {
2492 Parcel data = Parcel.obtain();
2493 Parcel reply = Parcel.obtain();
2494 data.writeInterfaceToken(IActivityManager.descriptor);
2495 uri.writeToParcel(data, 0);
2496 data.writeInt(pid);
2497 data.writeInt(uid);
2498 data.writeInt(mode);
2499 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2500 reply.readException();
2501 int res = reply.readInt();
2502 data.recycle();
2503 reply.recycle();
2504 return res;
2505 }
2506 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2507 Uri uri, int mode) throws RemoteException {
2508 Parcel data = Parcel.obtain();
2509 Parcel reply = Parcel.obtain();
2510 data.writeInterfaceToken(IActivityManager.descriptor);
2511 data.writeStrongBinder(caller.asBinder());
2512 data.writeString(targetPkg);
2513 uri.writeToParcel(data, 0);
2514 data.writeInt(mode);
2515 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2516 reply.readException();
2517 data.recycle();
2518 reply.recycle();
2519 }
2520 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2521 int mode) throws RemoteException {
2522 Parcel data = Parcel.obtain();
2523 Parcel reply = Parcel.obtain();
2524 data.writeInterfaceToken(IActivityManager.descriptor);
2525 data.writeStrongBinder(caller.asBinder());
2526 uri.writeToParcel(data, 0);
2527 data.writeInt(mode);
2528 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2529 reply.readException();
2530 data.recycle();
2531 reply.recycle();
2532 }
2533 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2534 throws RemoteException {
2535 Parcel data = Parcel.obtain();
2536 Parcel reply = Parcel.obtain();
2537 data.writeInterfaceToken(IActivityManager.descriptor);
2538 data.writeStrongBinder(who.asBinder());
2539 data.writeInt(waiting ? 1 : 0);
2540 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2541 reply.readException();
2542 data.recycle();
2543 reply.recycle();
2544 }
2545 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2546 Parcel data = Parcel.obtain();
2547 Parcel reply = Parcel.obtain();
2548 data.writeInterfaceToken(IActivityManager.descriptor);
2549 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2550 reply.readException();
2551 outInfo.readFromParcel(reply);
2552 data.recycle();
2553 reply.recycle();
2554 }
2555 public void unhandledBack() throws RemoteException
2556 {
2557 Parcel data = Parcel.obtain();
2558 Parcel reply = Parcel.obtain();
2559 data.writeInterfaceToken(IActivityManager.descriptor);
2560 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2561 reply.readException();
2562 data.recycle();
2563 reply.recycle();
2564 }
2565 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2566 {
2567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2571 reply.readException();
2572 ParcelFileDescriptor pfd = null;
2573 if (reply.readInt() != 0) {
2574 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2575 }
2576 data.recycle();
2577 reply.recycle();
2578 return pfd;
2579 }
2580 public void goingToSleep() throws RemoteException
2581 {
2582 Parcel data = Parcel.obtain();
2583 Parcel reply = Parcel.obtain();
2584 data.writeInterfaceToken(IActivityManager.descriptor);
2585 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2586 reply.readException();
2587 data.recycle();
2588 reply.recycle();
2589 }
2590 public void wakingUp() throws RemoteException
2591 {
2592 Parcel data = Parcel.obtain();
2593 Parcel reply = Parcel.obtain();
2594 data.writeInterfaceToken(IActivityManager.descriptor);
2595 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2596 reply.readException();
2597 data.recycle();
2598 reply.recycle();
2599 }
2600 public void setDebugApp(
2601 String packageName, boolean waitForDebugger, boolean persistent)
2602 throws RemoteException
2603 {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 data.writeString(packageName);
2608 data.writeInt(waitForDebugger ? 1 : 0);
2609 data.writeInt(persistent ? 1 : 0);
2610 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2611 reply.readException();
2612 data.recycle();
2613 reply.recycle();
2614 }
2615 public void setAlwaysFinish(boolean enabled) throws RemoteException
2616 {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeInt(enabled ? 1 : 0);
2621 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2622 reply.readException();
2623 data.recycle();
2624 reply.recycle();
2625 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002626 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002627 {
2628 Parcel data = Parcel.obtain();
2629 Parcel reply = Parcel.obtain();
2630 data.writeInterfaceToken(IActivityManager.descriptor);
2631 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002632 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002633 reply.readException();
2634 data.recycle();
2635 reply.recycle();
2636 }
2637 public void enterSafeMode() throws RemoteException {
2638 Parcel data = Parcel.obtain();
2639 data.writeInterfaceToken(IActivityManager.descriptor);
2640 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2641 data.recycle();
2642 }
2643 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2644 Parcel data = Parcel.obtain();
2645 data.writeStrongBinder(sender.asBinder());
2646 data.writeInterfaceToken(IActivityManager.descriptor);
2647 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2648 data.recycle();
2649 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002650 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002651 Parcel data = Parcel.obtain();
2652 Parcel reply = Parcel.obtain();
2653 data.writeInterfaceToken(IActivityManager.descriptor);
2654 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002655 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002656 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002657 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 boolean res = reply.readInt() != 0;
2659 data.recycle();
2660 reply.recycle();
2661 return res;
2662 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002663 public void startRunning(String pkg, String cls, String action,
2664 String indata) throws RemoteException {
2665 Parcel data = Parcel.obtain();
2666 Parcel reply = Parcel.obtain();
2667 data.writeInterfaceToken(IActivityManager.descriptor);
2668 data.writeString(pkg);
2669 data.writeString(cls);
2670 data.writeString(action);
2671 data.writeString(indata);
2672 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2673 reply.readException();
2674 data.recycle();
2675 reply.recycle();
2676 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002677 public boolean testIsSystemReady()
2678 {
2679 /* this base class version is never called */
2680 return true;
2681 }
Dan Egnor60d87622009-12-16 16:32:58 -08002682 public void handleApplicationCrash(IBinder app,
2683 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2684 {
2685 Parcel data = Parcel.obtain();
2686 Parcel reply = Parcel.obtain();
2687 data.writeInterfaceToken(IActivityManager.descriptor);
2688 data.writeStrongBinder(app);
2689 crashInfo.writeToParcel(data, 0);
2690 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2691 reply.readException();
2692 reply.recycle();
2693 data.recycle();
2694 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002695
Dan Egnor60d87622009-12-16 16:32:58 -08002696 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002697 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002698 {
2699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002703 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002704 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002705 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002706 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002707 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002708 reply.recycle();
2709 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002710 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002711 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002712
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002713 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002714 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002715 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002716 {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002721 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002722 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002723 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2724 reply.readException();
2725 reply.recycle();
2726 data.recycle();
2727 }
2728
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 public void signalPersistentProcesses(int sig) throws RemoteException {
2730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 data.writeInt(sig);
2734 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2735 reply.readException();
2736 data.recycle();
2737 reply.recycle();
2738 }
2739
Dianne Hackborn03abb812010-01-04 18:43:19 -08002740 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
2743 data.writeInterfaceToken(IActivityManager.descriptor);
2744 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002745 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2746 reply.readException();
2747 data.recycle();
2748 reply.recycle();
2749 }
2750
2751 public void forceStopPackage(String packageName) throws RemoteException {
2752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 data.writeString(packageName);
2756 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002757 reply.readException();
2758 data.recycle();
2759 reply.recycle();
2760 }
2761
2762 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2763 {
2764 Parcel data = Parcel.obtain();
2765 Parcel reply = Parcel.obtain();
2766 data.writeInterfaceToken(IActivityManager.descriptor);
2767 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2768 reply.readException();
2769 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2770 reply.recycle();
2771 data.recycle();
2772 return res;
2773 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002774
2775 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002776 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002777 {
2778 Parcel data = Parcel.obtain();
2779 Parcel reply = Parcel.obtain();
2780 data.writeInterfaceToken(IActivityManager.descriptor);
2781 data.writeString(process);
2782 data.writeInt(start ? 1 : 0);
2783 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002784 if (fd != null) {
2785 data.writeInt(1);
2786 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2787 } else {
2788 data.writeInt(0);
2789 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002790 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 boolean res = reply.readInt() != 0;
2793 reply.recycle();
2794 data.recycle();
2795 return res;
2796 }
2797
Dianne Hackborn55280a92009-05-07 15:53:46 -07002798 public boolean shutdown(int timeout) throws RemoteException
2799 {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeInt(timeout);
2804 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 boolean res = reply.readInt() != 0;
2807 reply.recycle();
2808 data.recycle();
2809 return res;
2810 }
2811
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002812 public void stopAppSwitches() throws RemoteException {
2813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2817 reply.readException();
2818 reply.recycle();
2819 data.recycle();
2820 }
2821
2822 public void resumeAppSwitches() throws RemoteException {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 reply.recycle();
2829 data.recycle();
2830 }
2831
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002832 public void registerActivityWatcher(IActivityWatcher watcher)
2833 throws RemoteException {
2834 Parcel data = Parcel.obtain();
2835 Parcel reply = Parcel.obtain();
2836 data.writeInterfaceToken(IActivityManager.descriptor);
2837 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2838 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2839 reply.readException();
2840 data.recycle();
2841 reply.recycle();
2842 }
2843
2844 public void unregisterActivityWatcher(IActivityWatcher watcher)
2845 throws RemoteException {
2846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2850 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2851 reply.readException();
2852 data.recycle();
2853 reply.recycle();
2854 }
2855
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002856 public int startActivityInPackage(int uid,
2857 Intent intent, String resolvedType, IBinder resultTo,
2858 String resultWho, int requestCode, boolean onlyIfNeeded)
2859 throws RemoteException {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeInt(uid);
2864 intent.writeToParcel(data, 0);
2865 data.writeString(resolvedType);
2866 data.writeStrongBinder(resultTo);
2867 data.writeString(resultWho);
2868 data.writeInt(requestCode);
2869 data.writeInt(onlyIfNeeded ? 1 : 0);
2870 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2871 reply.readException();
2872 int result = reply.readInt();
2873 reply.recycle();
2874 data.recycle();
2875 return result;
2876 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002877
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002878 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
2882 data.writeString(pkg);
2883 data.writeInt(uid);
2884 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 data.recycle();
2887 reply.recycle();
2888 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002889
2890 public void closeSystemDialogs(String reason) throws RemoteException {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 data.writeString(reason);
2895 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2896 reply.readException();
2897 data.recycle();
2898 reply.recycle();
2899 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002900
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002901 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002902 throws RemoteException {
2903 Parcel data = Parcel.obtain();
2904 Parcel reply = Parcel.obtain();
2905 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002906 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002907 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
2908 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002909 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002910 data.recycle();
2911 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002912 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002913 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07002914
2915 public void killApplicationProcess(String processName, int uid) throws RemoteException {
2916 Parcel data = Parcel.obtain();
2917 Parcel reply = Parcel.obtain();
2918 data.writeInterfaceToken(IActivityManager.descriptor);
2919 data.writeString(processName);
2920 data.writeInt(uid);
2921 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
2922 reply.readException();
2923 data.recycle();
2924 reply.recycle();
2925 }
2926
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07002927 public void overridePendingTransition(IBinder token, String packageName,
2928 int enterAnim, int exitAnim) throws RemoteException {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeStrongBinder(token);
2933 data.writeString(packageName);
2934 data.writeInt(enterAnim);
2935 data.writeInt(exitAnim);
2936 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
2937 reply.readException();
2938 data.recycle();
2939 reply.recycle();
2940 }
2941
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08002942 public boolean isUserAMonkey() throws RemoteException {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 boolean res = reply.readInt() != 0;
2949 data.recycle();
2950 reply.recycle();
2951 return res;
2952 }
2953
Dianne Hackborn860755f2010-06-03 18:47:52 -07002954 public void finishHeavyWeightApp() throws RemoteException {
2955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 data.recycle();
2961 reply.recycle();
2962 }
2963
Daniel Sandler69a48172010-06-23 16:29:36 -04002964 public void setImmersive(IBinder token, boolean immersive)
2965 throws RemoteException {
2966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
2969 data.writeStrongBinder(token);
2970 data.writeInt(immersive ? 1 : 0);
2971 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 data.recycle();
2974 reply.recycle();
2975 }
2976
2977 public boolean isImmersive(IBinder token)
2978 throws RemoteException {
2979 Parcel data = Parcel.obtain();
2980 Parcel reply = Parcel.obtain();
2981 data.writeInterfaceToken(IActivityManager.descriptor);
2982 data.writeStrongBinder(token);
2983 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04002984 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07002985 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04002986 data.recycle();
2987 reply.recycle();
2988 return res;
2989 }
2990
2991 public boolean isTopActivityImmersive()
2992 throws RemoteException {
2993 Parcel data = Parcel.obtain();
2994 Parcel reply = Parcel.obtain();
2995 data.writeInterfaceToken(IActivityManager.descriptor);
2996 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04002997 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07002998 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04002999 data.recycle();
3000 reply.recycle();
3001 return res;
3002 }
3003
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003004 public void crashApplication(int uid, int initialPid, String packageName,
3005 String message) throws RemoteException {
3006 Parcel data = Parcel.obtain();
3007 Parcel reply = Parcel.obtain();
3008 data.writeInterfaceToken(IActivityManager.descriptor);
3009 data.writeInt(uid);
3010 data.writeInt(initialPid);
3011 data.writeString(packageName);
3012 data.writeString(message);
3013 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3014 reply.readException();
3015 data.recycle();
3016 reply.recycle();
3017 }
Andy McFadden824c5102010-07-09 16:26:57 -07003018
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003019 public String getProviderMimeType(Uri uri)
3020 throws RemoteException {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 uri.writeToParcel(data, 0);
3025 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3026 reply.readException();
3027 String res = reply.readString();
3028 data.recycle();
3029 reply.recycle();
3030 return res;
3031 }
3032
Dianne Hackborn7e269642010-08-25 19:50:20 -07003033 public IBinder newUriPermissionOwner(String name)
3034 throws RemoteException {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeString(name);
3039 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 IBinder res = reply.readStrongBinder();
3042 data.recycle();
3043 reply.recycle();
3044 return res;
3045 }
3046
3047 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3048 Uri uri, int mode) throws RemoteException {
3049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 data.writeStrongBinder(owner);
3053 data.writeInt(fromUid);
3054 data.writeString(targetPkg);
3055 uri.writeToParcel(data, 0);
3056 data.writeInt(mode);
3057 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3058 reply.readException();
3059 data.recycle();
3060 reply.recycle();
3061 }
3062
3063 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3064 int mode) throws RemoteException {
3065 Parcel data = Parcel.obtain();
3066 Parcel reply = Parcel.obtain();
3067 data.writeInterfaceToken(IActivityManager.descriptor);
3068 data.writeStrongBinder(owner);
3069 if (uri != null) {
3070 data.writeInt(1);
3071 uri.writeToParcel(data, 0);
3072 } else {
3073 data.writeInt(0);
3074 }
3075 data.writeInt(mode);
3076 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3077 reply.readException();
3078 data.recycle();
3079 reply.recycle();
3080 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003081
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003082 public int checkGrantUriPermission(int callingUid, String targetPkg,
3083 Uri uri, int modeFlags) throws RemoteException {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeInt(callingUid);
3088 data.writeString(targetPkg);
3089 uri.writeToParcel(data, 0);
3090 data.writeInt(modeFlags);
3091 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3092 reply.readException();
3093 int res = reply.readInt();
3094 data.recycle();
3095 reply.recycle();
3096 return res;
3097 }
3098
Andy McFadden824c5102010-07-09 16:26:57 -07003099 public boolean dumpHeap(String process, boolean managed,
3100 String path, ParcelFileDescriptor fd) throws RemoteException {
3101 Parcel data = Parcel.obtain();
3102 Parcel reply = Parcel.obtain();
3103 data.writeInterfaceToken(IActivityManager.descriptor);
3104 data.writeString(process);
3105 data.writeInt(managed ? 1 : 0);
3106 data.writeString(path);
3107 if (fd != null) {
3108 data.writeInt(1);
3109 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3110 } else {
3111 data.writeInt(0);
3112 }
3113 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3114 reply.readException();
3115 boolean res = reply.readInt() != 0;
3116 reply.recycle();
3117 data.recycle();
3118 return res;
3119 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003120
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003121 public int startActivities(IApplicationThread caller,
3122 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3127 data.writeTypedArray(intents, 0);
3128 data.writeStringArray(resolvedTypes);
3129 data.writeStrongBinder(resultTo);
3130 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3131 reply.readException();
3132 int result = reply.readInt();
3133 reply.recycle();
3134 data.recycle();
3135 return result;
3136 }
3137
3138 public int startActivitiesInPackage(int uid,
3139 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 data.writeInt(uid);
3144 data.writeTypedArray(intents, 0);
3145 data.writeStringArray(resolvedTypes);
3146 data.writeStrongBinder(resultTo);
3147 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3148 reply.readException();
3149 int result = reply.readInt();
3150 reply.recycle();
3151 data.recycle();
3152 return result;
3153 }
3154
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003155 public void setPackageScreenCompatMode(String packageName, boolean compatEnabled)
3156 throws RemoteException {
3157 Parcel data = Parcel.obtain();
3158 Parcel reply = Parcel.obtain();
3159 data.writeInterfaceToken(IActivityManager.descriptor);
3160 data.writeString(packageName);
3161 data.writeInt(compatEnabled ? 1 : 0);
3162 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 reply.recycle();
3165 data.recycle();
3166 }
3167
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 private IBinder mRemote;
3169}