blob: d3d3792947892a91c6db719ec8423ed740aec846 [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();
1023 boolean res = killPids(pids, reason);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 reply.writeNoException();
1025 reply.writeInt(res ? 1 : 0);
1026 return true;
1027 }
1028
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 case START_RUNNING_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 String pkg = data.readString();
1032 String cls = data.readString();
1033 String action = data.readString();
1034 String indata = data.readString();
1035 startRunning(pkg, cls, action, indata);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
Dan Egnor60d87622009-12-16 16:32:58 -08001040 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IBinder app = data.readStrongBinder();
1043 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1044 handleApplicationCrash(app, ci);
1045 reply.writeNoException();
1046 return true;
1047 }
1048
1049 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001050 data.enforceInterface(IActivityManager.descriptor);
1051 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001052 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001053 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001054 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001056 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001057 return true;
1058 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001059
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001060 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1061 data.enforceInterface(IActivityManager.descriptor);
1062 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001063 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001064 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1065 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001066 reply.writeNoException();
1067 return true;
1068 }
1069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001070 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 int sig = data.readInt();
1073 signalPersistentProcesses(sig);
1074 reply.writeNoException();
1075 return true;
1076 }
1077
Dianne Hackborn03abb812010-01-04 18:43:19 -08001078 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1079 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001080 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001081 killBackgroundProcesses(packageName);
1082 reply.writeNoException();
1083 return true;
1084 }
1085
1086 case FORCE_STOP_PACKAGE_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 String packageName = data.readString();
1089 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 reply.writeNoException();
1091 return true;
1092 }
1093
1094 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1095 data.enforceInterface(IActivityManager.descriptor);
1096 ConfigurationInfo config = getDeviceConfigurationInfo();
1097 reply.writeNoException();
1098 config.writeToParcel(reply, 0);
1099 return true;
1100 }
1101
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001102 case PROFILE_CONTROL_TRANSACTION: {
1103 data.enforceInterface(IActivityManager.descriptor);
1104 String process = data.readString();
1105 boolean start = data.readInt() != 0;
1106 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001107 ParcelFileDescriptor fd = data.readInt() != 0
1108 ? data.readFileDescriptor() : null;
1109 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001110 reply.writeNoException();
1111 reply.writeInt(res ? 1 : 0);
1112 return true;
1113 }
1114
Dianne Hackborn55280a92009-05-07 15:53:46 -07001115 case SHUTDOWN_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 boolean res = shutdown(data.readInt());
1118 reply.writeNoException();
1119 reply.writeInt(res ? 1 : 0);
1120 return true;
1121 }
1122
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001123 case STOP_APP_SWITCHES_TRANSACTION: {
1124 data.enforceInterface(IActivityManager.descriptor);
1125 stopAppSwitches();
1126 reply.writeNoException();
1127 return true;
1128 }
1129
1130 case RESUME_APP_SWITCHES_TRANSACTION: {
1131 data.enforceInterface(IActivityManager.descriptor);
1132 resumeAppSwitches();
1133 reply.writeNoException();
1134 return true;
1135 }
1136
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001137 case PEEK_SERVICE_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 Intent service = Intent.CREATOR.createFromParcel(data);
1140 String resolvedType = data.readString();
1141 IBinder binder = peekService(service, resolvedType);
1142 reply.writeNoException();
1143 reply.writeStrongBinder(binder);
1144 return true;
1145 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001146
1147 case START_BACKUP_AGENT_TRANSACTION: {
1148 data.enforceInterface(IActivityManager.descriptor);
1149 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1150 int backupRestoreMode = data.readInt();
1151 boolean success = bindBackupAgent(info, backupRestoreMode);
1152 reply.writeNoException();
1153 reply.writeInt(success ? 1 : 0);
1154 return true;
1155 }
1156
1157 case BACKUP_AGENT_CREATED_TRANSACTION: {
1158 data.enforceInterface(IActivityManager.descriptor);
1159 String packageName = data.readString();
1160 IBinder agent = data.readStrongBinder();
1161 backupAgentCreated(packageName, agent);
1162 reply.writeNoException();
1163 return true;
1164 }
1165
1166 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1167 data.enforceInterface(IActivityManager.descriptor);
1168 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1169 unbindBackupAgent(info);
1170 reply.writeNoException();
1171 return true;
1172 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001173
1174 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1175 data.enforceInterface(IActivityManager.descriptor);
1176 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1177 data.readStrongBinder());
1178 registerActivityWatcher(watcher);
1179 return true;
1180 }
1181
1182 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1185 data.readStrongBinder());
1186 unregisterActivityWatcher(watcher);
1187 return true;
1188 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001189
1190 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1191 {
1192 data.enforceInterface(IActivityManager.descriptor);
1193 int uid = data.readInt();
1194 Intent intent = Intent.CREATOR.createFromParcel(data);
1195 String resolvedType = data.readString();
1196 IBinder resultTo = data.readStrongBinder();
1197 String resultWho = data.readString();
1198 int requestCode = data.readInt();
1199 boolean onlyIfNeeded = data.readInt() != 0;
1200 int result = startActivityInPackage(uid, intent, resolvedType,
1201 resultTo, resultWho, requestCode, onlyIfNeeded);
1202 reply.writeNoException();
1203 reply.writeInt(result);
1204 return true;
1205 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001206
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001207 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1208 data.enforceInterface(IActivityManager.descriptor);
1209 String pkg = data.readString();
1210 int uid = data.readInt();
1211 killApplicationWithUid(pkg, uid);
1212 reply.writeNoException();
1213 return true;
1214 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001215
1216 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 String reason = data.readString();
1219 closeSystemDialogs(reason);
1220 reply.writeNoException();
1221 return true;
1222 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001223
1224 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1225 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001226 int[] pids = data.createIntArray();
1227 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001228 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001229 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001230 return true;
1231 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001232
1233 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1234 data.enforceInterface(IActivityManager.descriptor);
1235 String processName = data.readString();
1236 int uid = data.readInt();
1237 killApplicationProcess(processName, uid);
1238 reply.writeNoException();
1239 return true;
1240 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001241
1242 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 IBinder token = data.readStrongBinder();
1245 String packageName = data.readString();
1246 int enterAnim = data.readInt();
1247 int exitAnim = data.readInt();
1248 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001249 reply.writeNoException();
1250 return true;
1251 }
1252
1253 case IS_USER_A_MONKEY_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001255 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001256 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001257 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001258 return true;
1259 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001260
1261 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 finishHeavyWeightApp();
1264 reply.writeNoException();
1265 return true;
1266 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001267
1268 case IS_IMMERSIVE_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001271 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001272 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001273 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001274 return true;
1275 }
1276
1277 case SET_IMMERSIVE_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 IBinder token = data.readStrongBinder();
1280 boolean imm = data.readInt() == 1;
1281 setImmersive(token, imm);
1282 reply.writeNoException();
1283 return true;
1284 }
1285
1286 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001288 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001289 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001290 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001291 return true;
1292 }
1293
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001294 case CRASH_APPLICATION_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 int uid = data.readInt();
1297 int initialPid = data.readInt();
1298 String packageName = data.readString();
1299 String message = data.readString();
1300 crashApplication(uid, initialPid, packageName, message);
1301 reply.writeNoException();
1302 return true;
1303 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001304
1305 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 Uri uri = Uri.CREATOR.createFromParcel(data);
1308 String type = getProviderMimeType(uri);
1309 reply.writeNoException();
1310 reply.writeString(type);
1311 return true;
1312 }
1313
Dianne Hackborn7e269642010-08-25 19:50:20 -07001314 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
1316 String name = data.readString();
1317 IBinder perm = newUriPermissionOwner(name);
1318 reply.writeNoException();
1319 reply.writeStrongBinder(perm);
1320 return true;
1321 }
1322
1323 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 IBinder owner = data.readStrongBinder();
1326 int fromUid = data.readInt();
1327 String targetPkg = data.readString();
1328 Uri uri = Uri.CREATOR.createFromParcel(data);
1329 int mode = data.readInt();
1330 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1331 reply.writeNoException();
1332 return true;
1333 }
1334
1335 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 IBinder owner = data.readStrongBinder();
1338 Uri uri = null;
1339 if (data.readInt() != 0) {
1340 Uri.CREATOR.createFromParcel(data);
1341 }
1342 int mode = data.readInt();
1343 revokeUriPermissionFromOwner(owner, uri, mode);
1344 reply.writeNoException();
1345 return true;
1346 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001347
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001348 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 int callingUid = data.readInt();
1351 String targetPkg = data.readString();
1352 Uri uri = Uri.CREATOR.createFromParcel(data);
1353 int modeFlags = data.readInt();
1354 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1355 reply.writeNoException();
1356 reply.writeInt(res);
1357 return true;
1358 }
1359
Andy McFadden824c5102010-07-09 16:26:57 -07001360 case DUMP_HEAP_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 String process = data.readString();
1363 boolean managed = data.readInt() != 0;
1364 String path = data.readString();
1365 ParcelFileDescriptor fd = data.readInt() != 0
1366 ? data.readFileDescriptor() : null;
1367 boolean res = dumpHeap(process, managed, path, fd);
1368 reply.writeNoException();
1369 reply.writeInt(res ? 1 : 0);
1370 return true;
1371 }
1372
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001373 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1374 {
1375 data.enforceInterface(IActivityManager.descriptor);
1376 int uid = data.readInt();
1377 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1378 String[] resolvedTypes = data.createStringArray();
1379 IBinder resultTo = data.readStrongBinder();
1380 int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
1381 reply.writeNoException();
1382 reply.writeInt(result);
1383 return true;
1384 }
1385
1386 case START_ACTIVITIES_TRANSACTION:
1387 {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 IBinder b = data.readStrongBinder();
1390 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1391 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1392 String[] resolvedTypes = data.createStringArray();
1393 IBinder resultTo = data.readStrongBinder();
1394 int result = startActivities(app, intents, resolvedTypes, resultTo);
1395 reply.writeNoException();
1396 reply.writeInt(result);
1397 return true;
1398 }
1399
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001400 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001401
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001402 return super.onTransact(code, data, reply, flags);
1403 }
1404
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001405 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001406 return this;
1407 }
1408
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001409 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1410 protected IActivityManager create() {
1411 IBinder b = ServiceManager.getService("activity");
1412 if (Config.LOGV) {
1413 Log.v("ActivityManager", "default service binder = " + b);
1414 }
1415 IActivityManager am = asInterface(b);
1416 if (Config.LOGV) {
1417 Log.v("ActivityManager", "default service = " + am);
1418 }
1419 return am;
1420 }
1421 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422}
1423
1424class ActivityManagerProxy implements IActivityManager
1425{
1426 public ActivityManagerProxy(IBinder remote)
1427 {
1428 mRemote = remote;
1429 }
1430
1431 public IBinder asBinder()
1432 {
1433 return mRemote;
1434 }
1435
1436 public int startActivity(IApplicationThread caller, Intent intent,
1437 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1438 IBinder resultTo, String resultWho,
1439 int requestCode, boolean onlyIfNeeded,
1440 boolean debug) throws RemoteException {
1441 Parcel data = Parcel.obtain();
1442 Parcel reply = Parcel.obtain();
1443 data.writeInterfaceToken(IActivityManager.descriptor);
1444 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1445 intent.writeToParcel(data, 0);
1446 data.writeString(resolvedType);
1447 data.writeTypedArray(grantedUriPermissions, 0);
1448 data.writeInt(grantedMode);
1449 data.writeStrongBinder(resultTo);
1450 data.writeString(resultWho);
1451 data.writeInt(requestCode);
1452 data.writeInt(onlyIfNeeded ? 1 : 0);
1453 data.writeInt(debug ? 1 : 0);
1454 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1455 reply.readException();
1456 int result = reply.readInt();
1457 reply.recycle();
1458 data.recycle();
1459 return result;
1460 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001461 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1462 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1463 IBinder resultTo, String resultWho,
1464 int requestCode, boolean onlyIfNeeded,
1465 boolean debug) throws RemoteException {
1466 Parcel data = Parcel.obtain();
1467 Parcel reply = Parcel.obtain();
1468 data.writeInterfaceToken(IActivityManager.descriptor);
1469 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1470 intent.writeToParcel(data, 0);
1471 data.writeString(resolvedType);
1472 data.writeTypedArray(grantedUriPermissions, 0);
1473 data.writeInt(grantedMode);
1474 data.writeStrongBinder(resultTo);
1475 data.writeString(resultWho);
1476 data.writeInt(requestCode);
1477 data.writeInt(onlyIfNeeded ? 1 : 0);
1478 data.writeInt(debug ? 1 : 0);
1479 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1480 reply.readException();
1481 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1482 reply.recycle();
1483 data.recycle();
1484 return result;
1485 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001486 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1487 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1488 IBinder resultTo, String resultWho,
1489 int requestCode, boolean onlyIfNeeded,
1490 boolean debug, Configuration config) throws RemoteException {
1491 Parcel data = Parcel.obtain();
1492 Parcel reply = Parcel.obtain();
1493 data.writeInterfaceToken(IActivityManager.descriptor);
1494 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1495 intent.writeToParcel(data, 0);
1496 data.writeString(resolvedType);
1497 data.writeTypedArray(grantedUriPermissions, 0);
1498 data.writeInt(grantedMode);
1499 data.writeStrongBinder(resultTo);
1500 data.writeString(resultWho);
1501 data.writeInt(requestCode);
1502 data.writeInt(onlyIfNeeded ? 1 : 0);
1503 data.writeInt(debug ? 1 : 0);
1504 config.writeToParcel(data, 0);
1505 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1506 reply.readException();
1507 int result = reply.readInt();
1508 reply.recycle();
1509 data.recycle();
1510 return result;
1511 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001512 public int startActivityIntentSender(IApplicationThread caller,
1513 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001514 IBinder resultTo, String resultWho, int requestCode,
1515 int flagsMask, int flagsValues) throws RemoteException {
1516 Parcel data = Parcel.obtain();
1517 Parcel reply = Parcel.obtain();
1518 data.writeInterfaceToken(IActivityManager.descriptor);
1519 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1520 intent.writeToParcel(data, 0);
1521 if (fillInIntent != null) {
1522 data.writeInt(1);
1523 fillInIntent.writeToParcel(data, 0);
1524 } else {
1525 data.writeInt(0);
1526 }
1527 data.writeString(resolvedType);
1528 data.writeStrongBinder(resultTo);
1529 data.writeString(resultWho);
1530 data.writeInt(requestCode);
1531 data.writeInt(flagsMask);
1532 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001533 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001534 reply.readException();
1535 int result = reply.readInt();
1536 reply.recycle();
1537 data.recycle();
1538 return result;
1539 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001540 public boolean startNextMatchingActivity(IBinder callingActivity,
1541 Intent intent) throws RemoteException {
1542 Parcel data = Parcel.obtain();
1543 Parcel reply = Parcel.obtain();
1544 data.writeInterfaceToken(IActivityManager.descriptor);
1545 data.writeStrongBinder(callingActivity);
1546 intent.writeToParcel(data, 0);
1547 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1548 reply.readException();
1549 int result = reply.readInt();
1550 reply.recycle();
1551 data.recycle();
1552 return result != 0;
1553 }
1554 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1555 throws RemoteException {
1556 Parcel data = Parcel.obtain();
1557 Parcel reply = Parcel.obtain();
1558 data.writeInterfaceToken(IActivityManager.descriptor);
1559 data.writeStrongBinder(token);
1560 data.writeInt(resultCode);
1561 if (resultData != null) {
1562 data.writeInt(1);
1563 resultData.writeToParcel(data, 0);
1564 } else {
1565 data.writeInt(0);
1566 }
1567 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1568 reply.readException();
1569 boolean res = reply.readInt() != 0;
1570 data.recycle();
1571 reply.recycle();
1572 return res;
1573 }
1574 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1575 {
1576 Parcel data = Parcel.obtain();
1577 Parcel reply = Parcel.obtain();
1578 data.writeInterfaceToken(IActivityManager.descriptor);
1579 data.writeStrongBinder(token);
1580 data.writeString(resultWho);
1581 data.writeInt(requestCode);
1582 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1583 reply.readException();
1584 data.recycle();
1585 reply.recycle();
1586 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001587 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1588 Parcel data = Parcel.obtain();
1589 Parcel reply = Parcel.obtain();
1590 data.writeInterfaceToken(IActivityManager.descriptor);
1591 data.writeStrongBinder(token);
1592 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1593 reply.readException();
1594 boolean res = reply.readInt() != 0;
1595 data.recycle();
1596 reply.recycle();
1597 return res;
1598 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001599 public Intent registerReceiver(IApplicationThread caller,
1600 IIntentReceiver receiver,
1601 IntentFilter filter, String perm) throws RemoteException
1602 {
1603 Parcel data = Parcel.obtain();
1604 Parcel reply = Parcel.obtain();
1605 data.writeInterfaceToken(IActivityManager.descriptor);
1606 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1607 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1608 filter.writeToParcel(data, 0);
1609 data.writeString(perm);
1610 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1611 reply.readException();
1612 Intent intent = null;
1613 int haveIntent = reply.readInt();
1614 if (haveIntent != 0) {
1615 intent = Intent.CREATOR.createFromParcel(reply);
1616 }
1617 reply.recycle();
1618 data.recycle();
1619 return intent;
1620 }
1621 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1622 {
1623 Parcel data = Parcel.obtain();
1624 Parcel reply = Parcel.obtain();
1625 data.writeInterfaceToken(IActivityManager.descriptor);
1626 data.writeStrongBinder(receiver.asBinder());
1627 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1628 reply.readException();
1629 data.recycle();
1630 reply.recycle();
1631 }
1632 public int broadcastIntent(IApplicationThread caller,
1633 Intent intent, String resolvedType, IIntentReceiver resultTo,
1634 int resultCode, String resultData, Bundle map,
1635 String requiredPermission, boolean serialized,
1636 boolean sticky) throws RemoteException
1637 {
1638 Parcel data = Parcel.obtain();
1639 Parcel reply = Parcel.obtain();
1640 data.writeInterfaceToken(IActivityManager.descriptor);
1641 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1642 intent.writeToParcel(data, 0);
1643 data.writeString(resolvedType);
1644 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1645 data.writeInt(resultCode);
1646 data.writeString(resultData);
1647 data.writeBundle(map);
1648 data.writeString(requiredPermission);
1649 data.writeInt(serialized ? 1 : 0);
1650 data.writeInt(sticky ? 1 : 0);
1651 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1652 reply.readException();
1653 int res = reply.readInt();
1654 reply.recycle();
1655 data.recycle();
1656 return res;
1657 }
1658 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1659 {
1660 Parcel data = Parcel.obtain();
1661 Parcel reply = Parcel.obtain();
1662 data.writeInterfaceToken(IActivityManager.descriptor);
1663 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1664 intent.writeToParcel(data, 0);
1665 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1666 reply.readException();
1667 data.recycle();
1668 reply.recycle();
1669 }
1670 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1671 {
1672 Parcel data = Parcel.obtain();
1673 Parcel reply = Parcel.obtain();
1674 data.writeInterfaceToken(IActivityManager.descriptor);
1675 data.writeStrongBinder(who);
1676 data.writeInt(resultCode);
1677 data.writeString(resultData);
1678 data.writeBundle(map);
1679 data.writeInt(abortBroadcast ? 1 : 0);
1680 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1681 reply.readException();
1682 data.recycle();
1683 reply.recycle();
1684 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001685 public void attachApplication(IApplicationThread app) throws RemoteException
1686 {
1687 Parcel data = Parcel.obtain();
1688 Parcel reply = Parcel.obtain();
1689 data.writeInterfaceToken(IActivityManager.descriptor);
1690 data.writeStrongBinder(app.asBinder());
1691 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1692 reply.readException();
1693 data.recycle();
1694 reply.recycle();
1695 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001696 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001697 {
1698 Parcel data = Parcel.obtain();
1699 Parcel reply = Parcel.obtain();
1700 data.writeInterfaceToken(IActivityManager.descriptor);
1701 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001702 if (config != null) {
1703 data.writeInt(1);
1704 config.writeToParcel(data, 0);
1705 } else {
1706 data.writeInt(0);
1707 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001708 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1709 reply.readException();
1710 data.recycle();
1711 reply.recycle();
1712 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001713 public void activityPaused(IBinder token) throws RemoteException
1714 {
1715 Parcel data = Parcel.obtain();
1716 Parcel reply = Parcel.obtain();
1717 data.writeInterfaceToken(IActivityManager.descriptor);
1718 data.writeStrongBinder(token);
1719 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1720 reply.readException();
1721 data.recycle();
1722 reply.recycle();
1723 }
1724 public void activityStopped(IBinder token, Bundle state,
1725 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 {
1727 Parcel data = Parcel.obtain();
1728 Parcel reply = Parcel.obtain();
1729 data.writeInterfaceToken(IActivityManager.descriptor);
1730 data.writeStrongBinder(token);
1731 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001732 if (thumbnail != null) {
1733 data.writeInt(1);
1734 thumbnail.writeToParcel(data, 0);
1735 } else {
1736 data.writeInt(0);
1737 }
1738 TextUtils.writeToParcel(description, data, 0);
1739 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1740 reply.readException();
1741 data.recycle();
1742 reply.recycle();
1743 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001744 public void activitySlept(IBinder token) throws RemoteException
1745 {
1746 Parcel data = Parcel.obtain();
1747 Parcel reply = Parcel.obtain();
1748 data.writeInterfaceToken(IActivityManager.descriptor);
1749 data.writeStrongBinder(token);
1750 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1751 reply.readException();
1752 data.recycle();
1753 reply.recycle();
1754 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001755 public void activityDestroyed(IBinder token) throws RemoteException
1756 {
1757 Parcel data = Parcel.obtain();
1758 Parcel reply = Parcel.obtain();
1759 data.writeInterfaceToken(IActivityManager.descriptor);
1760 data.writeStrongBinder(token);
1761 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1762 reply.readException();
1763 data.recycle();
1764 reply.recycle();
1765 }
1766 public String getCallingPackage(IBinder token) throws RemoteException
1767 {
1768 Parcel data = Parcel.obtain();
1769 Parcel reply = Parcel.obtain();
1770 data.writeInterfaceToken(IActivityManager.descriptor);
1771 data.writeStrongBinder(token);
1772 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1773 reply.readException();
1774 String res = reply.readString();
1775 data.recycle();
1776 reply.recycle();
1777 return res;
1778 }
1779 public ComponentName getCallingActivity(IBinder token)
1780 throws RemoteException {
1781 Parcel data = Parcel.obtain();
1782 Parcel reply = Parcel.obtain();
1783 data.writeInterfaceToken(IActivityManager.descriptor);
1784 data.writeStrongBinder(token);
1785 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1786 reply.readException();
1787 ComponentName res = ComponentName.readFromParcel(reply);
1788 data.recycle();
1789 reply.recycle();
1790 return res;
1791 }
1792 public List getTasks(int maxNum, int flags,
1793 IThumbnailReceiver receiver) throws RemoteException {
1794 Parcel data = Parcel.obtain();
1795 Parcel reply = Parcel.obtain();
1796 data.writeInterfaceToken(IActivityManager.descriptor);
1797 data.writeInt(maxNum);
1798 data.writeInt(flags);
1799 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1800 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1801 reply.readException();
1802 ArrayList list = null;
1803 int N = reply.readInt();
1804 if (N >= 0) {
1805 list = new ArrayList();
1806 while (N > 0) {
1807 ActivityManager.RunningTaskInfo info =
1808 ActivityManager.RunningTaskInfo.CREATOR
1809 .createFromParcel(reply);
1810 list.add(info);
1811 N--;
1812 }
1813 }
1814 data.recycle();
1815 reply.recycle();
1816 return list;
1817 }
1818 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1819 int flags) throws RemoteException {
1820 Parcel data = Parcel.obtain();
1821 Parcel reply = Parcel.obtain();
1822 data.writeInterfaceToken(IActivityManager.descriptor);
1823 data.writeInt(maxNum);
1824 data.writeInt(flags);
1825 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1826 reply.readException();
1827 ArrayList<ActivityManager.RecentTaskInfo> list
1828 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1829 data.recycle();
1830 reply.recycle();
1831 return list;
1832 }
Dianne Hackbornd94df452011-02-16 18:53:31 -08001833 public Bitmap getTaskThumbnail(int id) throws RemoteException {
1834 Parcel data = Parcel.obtain();
1835 Parcel reply = Parcel.obtain();
1836 data.writeInterfaceToken(IActivityManager.descriptor);
1837 data.writeInt(id);
1838 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
1839 reply.readException();
1840 Bitmap bm = null;
1841 if (reply.readInt() != 0) {
1842 bm = Bitmap.CREATOR.createFromParcel(reply);
1843 }
1844 data.recycle();
1845 reply.recycle();
1846 return bm;
1847 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001848 public List getServices(int maxNum, int flags) throws RemoteException {
1849 Parcel data = Parcel.obtain();
1850 Parcel reply = Parcel.obtain();
1851 data.writeInterfaceToken(IActivityManager.descriptor);
1852 data.writeInt(maxNum);
1853 data.writeInt(flags);
1854 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1855 reply.readException();
1856 ArrayList list = null;
1857 int N = reply.readInt();
1858 if (N >= 0) {
1859 list = new ArrayList();
1860 while (N > 0) {
1861 ActivityManager.RunningServiceInfo info =
1862 ActivityManager.RunningServiceInfo.CREATOR
1863 .createFromParcel(reply);
1864 list.add(info);
1865 N--;
1866 }
1867 }
1868 data.recycle();
1869 reply.recycle();
1870 return list;
1871 }
1872 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1873 throws RemoteException {
1874 Parcel data = Parcel.obtain();
1875 Parcel reply = Parcel.obtain();
1876 data.writeInterfaceToken(IActivityManager.descriptor);
1877 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1878 reply.readException();
1879 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1880 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1881 data.recycle();
1882 reply.recycle();
1883 return list;
1884 }
1885 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1886 throws RemoteException {
1887 Parcel data = Parcel.obtain();
1888 Parcel reply = Parcel.obtain();
1889 data.writeInterfaceToken(IActivityManager.descriptor);
1890 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1891 reply.readException();
1892 ArrayList<ActivityManager.RunningAppProcessInfo> list
1893 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1894 data.recycle();
1895 reply.recycle();
1896 return list;
1897 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07001898 public List<ApplicationInfo> getRunningExternalApplications()
1899 throws RemoteException {
1900 Parcel data = Parcel.obtain();
1901 Parcel reply = Parcel.obtain();
1902 data.writeInterfaceToken(IActivityManager.descriptor);
1903 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
1904 reply.readException();
1905 ArrayList<ApplicationInfo> list
1906 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
1907 data.recycle();
1908 reply.recycle();
1909 return list;
1910 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001911 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001912 {
1913 Parcel data = Parcel.obtain();
1914 Parcel reply = Parcel.obtain();
1915 data.writeInterfaceToken(IActivityManager.descriptor);
1916 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001917 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001918 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1919 reply.readException();
1920 data.recycle();
1921 reply.recycle();
1922 }
1923 public void moveTaskToBack(int task) throws RemoteException
1924 {
1925 Parcel data = Parcel.obtain();
1926 Parcel reply = Parcel.obtain();
1927 data.writeInterfaceToken(IActivityManager.descriptor);
1928 data.writeInt(task);
1929 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1930 reply.readException();
1931 data.recycle();
1932 reply.recycle();
1933 }
1934 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1935 throws RemoteException {
1936 Parcel data = Parcel.obtain();
1937 Parcel reply = Parcel.obtain();
1938 data.writeInterfaceToken(IActivityManager.descriptor);
1939 data.writeStrongBinder(token);
1940 data.writeInt(nonRoot ? 1 : 0);
1941 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1942 reply.readException();
1943 boolean res = reply.readInt() != 0;
1944 data.recycle();
1945 reply.recycle();
1946 return res;
1947 }
1948 public void moveTaskBackwards(int task) throws RemoteException
1949 {
1950 Parcel data = Parcel.obtain();
1951 Parcel reply = Parcel.obtain();
1952 data.writeInterfaceToken(IActivityManager.descriptor);
1953 data.writeInt(task);
1954 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1955 reply.readException();
1956 data.recycle();
1957 reply.recycle();
1958 }
1959 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
1960 {
1961 Parcel data = Parcel.obtain();
1962 Parcel reply = Parcel.obtain();
1963 data.writeInterfaceToken(IActivityManager.descriptor);
1964 data.writeStrongBinder(token);
1965 data.writeInt(onlyRoot ? 1 : 0);
1966 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
1967 reply.readException();
1968 int res = reply.readInt();
1969 data.recycle();
1970 reply.recycle();
1971 return res;
1972 }
1973 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
1974 {
1975 Parcel data = Parcel.obtain();
1976 Parcel reply = Parcel.obtain();
1977 data.writeInterfaceToken(IActivityManager.descriptor);
1978 data.writeStrongBinder(token);
1979 ComponentName.writeToParcel(className, data);
1980 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
1981 reply.readException();
1982 data.recycle();
1983 reply.recycle();
1984 }
1985 public void reportThumbnail(IBinder token,
1986 Bitmap thumbnail, CharSequence description) throws RemoteException
1987 {
1988 Parcel data = Parcel.obtain();
1989 Parcel reply = Parcel.obtain();
1990 data.writeInterfaceToken(IActivityManager.descriptor);
1991 data.writeStrongBinder(token);
1992 if (thumbnail != null) {
1993 data.writeInt(1);
1994 thumbnail.writeToParcel(data, 0);
1995 } else {
1996 data.writeInt(0);
1997 }
1998 TextUtils.writeToParcel(description, data, 0);
1999 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2000 reply.readException();
2001 data.recycle();
2002 reply.recycle();
2003 }
2004 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2005 String name) throws RemoteException
2006 {
2007 Parcel data = Parcel.obtain();
2008 Parcel reply = Parcel.obtain();
2009 data.writeInterfaceToken(IActivityManager.descriptor);
2010 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2011 data.writeString(name);
2012 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2013 reply.readException();
2014 int res = reply.readInt();
2015 ContentProviderHolder cph = null;
2016 if (res != 0) {
2017 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2018 }
2019 data.recycle();
2020 reply.recycle();
2021 return cph;
2022 }
2023 public void publishContentProviders(IApplicationThread caller,
2024 List<ContentProviderHolder> providers) throws RemoteException
2025 {
2026 Parcel data = Parcel.obtain();
2027 Parcel reply = Parcel.obtain();
2028 data.writeInterfaceToken(IActivityManager.descriptor);
2029 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2030 data.writeTypedList(providers);
2031 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2032 reply.readException();
2033 data.recycle();
2034 reply.recycle();
2035 }
2036
2037 public void removeContentProvider(IApplicationThread caller,
2038 String name) throws RemoteException {
2039 Parcel data = Parcel.obtain();
2040 Parcel reply = Parcel.obtain();
2041 data.writeInterfaceToken(IActivityManager.descriptor);
2042 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2043 data.writeString(name);
2044 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2045 reply.readException();
2046 data.recycle();
2047 reply.recycle();
2048 }
2049
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002050 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2051 throws RemoteException
2052 {
2053 Parcel data = Parcel.obtain();
2054 Parcel reply = Parcel.obtain();
2055 data.writeInterfaceToken(IActivityManager.descriptor);
2056 service.writeToParcel(data, 0);
2057 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2058 reply.readException();
2059 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2060 data.recycle();
2061 reply.recycle();
2062 return res;
2063 }
2064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 public ComponentName startService(IApplicationThread caller, Intent service,
2066 String resolvedType) throws RemoteException
2067 {
2068 Parcel data = Parcel.obtain();
2069 Parcel reply = Parcel.obtain();
2070 data.writeInterfaceToken(IActivityManager.descriptor);
2071 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2072 service.writeToParcel(data, 0);
2073 data.writeString(resolvedType);
2074 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2075 reply.readException();
2076 ComponentName res = ComponentName.readFromParcel(reply);
2077 data.recycle();
2078 reply.recycle();
2079 return res;
2080 }
2081 public int stopService(IApplicationThread caller, Intent service,
2082 String resolvedType) throws RemoteException
2083 {
2084 Parcel data = Parcel.obtain();
2085 Parcel reply = Parcel.obtain();
2086 data.writeInterfaceToken(IActivityManager.descriptor);
2087 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2088 service.writeToParcel(data, 0);
2089 data.writeString(resolvedType);
2090 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2091 reply.readException();
2092 int res = reply.readInt();
2093 reply.recycle();
2094 data.recycle();
2095 return res;
2096 }
2097 public boolean stopServiceToken(ComponentName className, IBinder token,
2098 int startId) throws RemoteException {
2099 Parcel data = Parcel.obtain();
2100 Parcel reply = Parcel.obtain();
2101 data.writeInterfaceToken(IActivityManager.descriptor);
2102 ComponentName.writeToParcel(className, data);
2103 data.writeStrongBinder(token);
2104 data.writeInt(startId);
2105 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2106 reply.readException();
2107 boolean res = reply.readInt() != 0;
2108 data.recycle();
2109 reply.recycle();
2110 return res;
2111 }
2112 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002113 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002114 Parcel data = Parcel.obtain();
2115 Parcel reply = Parcel.obtain();
2116 data.writeInterfaceToken(IActivityManager.descriptor);
2117 ComponentName.writeToParcel(className, data);
2118 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002119 data.writeInt(id);
2120 if (notification != null) {
2121 data.writeInt(1);
2122 notification.writeToParcel(data, 0);
2123 } else {
2124 data.writeInt(0);
2125 }
2126 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002127 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2128 reply.readException();
2129 data.recycle();
2130 reply.recycle();
2131 }
2132 public int bindService(IApplicationThread caller, IBinder token,
2133 Intent service, String resolvedType, IServiceConnection connection,
2134 int flags) throws RemoteException {
2135 Parcel data = Parcel.obtain();
2136 Parcel reply = Parcel.obtain();
2137 data.writeInterfaceToken(IActivityManager.descriptor);
2138 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2139 data.writeStrongBinder(token);
2140 service.writeToParcel(data, 0);
2141 data.writeString(resolvedType);
2142 data.writeStrongBinder(connection.asBinder());
2143 data.writeInt(flags);
2144 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2145 reply.readException();
2146 int res = reply.readInt();
2147 data.recycle();
2148 reply.recycle();
2149 return res;
2150 }
2151 public boolean unbindService(IServiceConnection connection) throws RemoteException
2152 {
2153 Parcel data = Parcel.obtain();
2154 Parcel reply = Parcel.obtain();
2155 data.writeInterfaceToken(IActivityManager.descriptor);
2156 data.writeStrongBinder(connection.asBinder());
2157 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2158 reply.readException();
2159 boolean res = reply.readInt() != 0;
2160 data.recycle();
2161 reply.recycle();
2162 return res;
2163 }
2164
2165 public void publishService(IBinder token,
2166 Intent intent, IBinder service) throws RemoteException {
2167 Parcel data = Parcel.obtain();
2168 Parcel reply = Parcel.obtain();
2169 data.writeInterfaceToken(IActivityManager.descriptor);
2170 data.writeStrongBinder(token);
2171 intent.writeToParcel(data, 0);
2172 data.writeStrongBinder(service);
2173 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2174 reply.readException();
2175 data.recycle();
2176 reply.recycle();
2177 }
2178
2179 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2180 throws RemoteException {
2181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeStrongBinder(token);
2185 intent.writeToParcel(data, 0);
2186 data.writeInt(doRebind ? 1 : 0);
2187 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2188 reply.readException();
2189 data.recycle();
2190 reply.recycle();
2191 }
2192
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002193 public void serviceDoneExecuting(IBinder token, int type, int startId,
2194 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 Parcel data = Parcel.obtain();
2196 Parcel reply = Parcel.obtain();
2197 data.writeInterfaceToken(IActivityManager.descriptor);
2198 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002199 data.writeInt(type);
2200 data.writeInt(startId);
2201 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002202 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2203 reply.readException();
2204 data.recycle();
2205 reply.recycle();
2206 }
2207
2208 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2209 Parcel data = Parcel.obtain();
2210 Parcel reply = Parcel.obtain();
2211 data.writeInterfaceToken(IActivityManager.descriptor);
2212 service.writeToParcel(data, 0);
2213 data.writeString(resolvedType);
2214 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 IBinder binder = reply.readStrongBinder();
2217 reply.recycle();
2218 data.recycle();
2219 return binder;
2220 }
2221
Christopher Tate181fafa2009-05-14 11:12:14 -07002222 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2223 throws RemoteException {
2224 Parcel data = Parcel.obtain();
2225 Parcel reply = Parcel.obtain();
2226 data.writeInterfaceToken(IActivityManager.descriptor);
2227 app.writeToParcel(data, 0);
2228 data.writeInt(backupRestoreMode);
2229 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2230 reply.readException();
2231 boolean success = reply.readInt() != 0;
2232 reply.recycle();
2233 data.recycle();
2234 return success;
2235 }
2236
2237 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2238 Parcel data = Parcel.obtain();
2239 Parcel reply = Parcel.obtain();
2240 data.writeInterfaceToken(IActivityManager.descriptor);
2241 data.writeString(packageName);
2242 data.writeStrongBinder(agent);
2243 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2244 reply.recycle();
2245 data.recycle();
2246 }
2247
2248 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2249 Parcel data = Parcel.obtain();
2250 Parcel reply = Parcel.obtain();
2251 data.writeInterfaceToken(IActivityManager.descriptor);
2252 app.writeToParcel(data, 0);
2253 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2254 reply.readException();
2255 reply.recycle();
2256 data.recycle();
2257 }
2258
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002259 public boolean startInstrumentation(ComponentName className, String profileFile,
2260 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2261 throws RemoteException {
2262 Parcel data = Parcel.obtain();
2263 Parcel reply = Parcel.obtain();
2264 data.writeInterfaceToken(IActivityManager.descriptor);
2265 ComponentName.writeToParcel(className, data);
2266 data.writeString(profileFile);
2267 data.writeInt(flags);
2268 data.writeBundle(arguments);
2269 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2270 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2271 reply.readException();
2272 boolean res = reply.readInt() != 0;
2273 reply.recycle();
2274 data.recycle();
2275 return res;
2276 }
2277
2278 public void finishInstrumentation(IApplicationThread target,
2279 int resultCode, Bundle results) throws RemoteException {
2280 Parcel data = Parcel.obtain();
2281 Parcel reply = Parcel.obtain();
2282 data.writeInterfaceToken(IActivityManager.descriptor);
2283 data.writeStrongBinder(target != null ? target.asBinder() : null);
2284 data.writeInt(resultCode);
2285 data.writeBundle(results);
2286 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2287 reply.readException();
2288 data.recycle();
2289 reply.recycle();
2290 }
2291 public Configuration getConfiguration() throws RemoteException
2292 {
2293 Parcel data = Parcel.obtain();
2294 Parcel reply = Parcel.obtain();
2295 data.writeInterfaceToken(IActivityManager.descriptor);
2296 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2297 reply.readException();
2298 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2299 reply.recycle();
2300 data.recycle();
2301 return res;
2302 }
2303 public void updateConfiguration(Configuration values) throws RemoteException
2304 {
2305 Parcel data = Parcel.obtain();
2306 Parcel reply = Parcel.obtain();
2307 data.writeInterfaceToken(IActivityManager.descriptor);
2308 values.writeToParcel(data, 0);
2309 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2310 reply.readException();
2311 data.recycle();
2312 reply.recycle();
2313 }
2314 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2315 throws RemoteException {
2316 Parcel data = Parcel.obtain();
2317 Parcel reply = Parcel.obtain();
2318 data.writeInterfaceToken(IActivityManager.descriptor);
2319 data.writeStrongBinder(token);
2320 data.writeInt(requestedOrientation);
2321 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2322 reply.readException();
2323 data.recycle();
2324 reply.recycle();
2325 }
2326 public int getRequestedOrientation(IBinder token) throws RemoteException {
2327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 data.writeStrongBinder(token);
2331 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2332 reply.readException();
2333 int res = reply.readInt();
2334 data.recycle();
2335 reply.recycle();
2336 return res;
2337 }
2338 public ComponentName getActivityClassForToken(IBinder token)
2339 throws RemoteException {
2340 Parcel data = Parcel.obtain();
2341 Parcel reply = Parcel.obtain();
2342 data.writeInterfaceToken(IActivityManager.descriptor);
2343 data.writeStrongBinder(token);
2344 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2345 reply.readException();
2346 ComponentName res = ComponentName.readFromParcel(reply);
2347 data.recycle();
2348 reply.recycle();
2349 return res;
2350 }
2351 public String getPackageForToken(IBinder token) throws RemoteException
2352 {
2353 Parcel data = Parcel.obtain();
2354 Parcel reply = Parcel.obtain();
2355 data.writeInterfaceToken(IActivityManager.descriptor);
2356 data.writeStrongBinder(token);
2357 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2358 reply.readException();
2359 String res = reply.readString();
2360 data.recycle();
2361 reply.recycle();
2362 return res;
2363 }
2364 public IIntentSender getIntentSender(int type,
2365 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002366 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367 throws RemoteException {
2368 Parcel data = Parcel.obtain();
2369 Parcel reply = Parcel.obtain();
2370 data.writeInterfaceToken(IActivityManager.descriptor);
2371 data.writeInt(type);
2372 data.writeString(packageName);
2373 data.writeStrongBinder(token);
2374 data.writeString(resultWho);
2375 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002376 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002378 data.writeTypedArray(intents, 0);
2379 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002380 } else {
2381 data.writeInt(0);
2382 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 data.writeInt(flags);
2384 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2385 reply.readException();
2386 IIntentSender res = IIntentSender.Stub.asInterface(
2387 reply.readStrongBinder());
2388 data.recycle();
2389 reply.recycle();
2390 return res;
2391 }
2392 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2393 Parcel data = Parcel.obtain();
2394 Parcel reply = Parcel.obtain();
2395 data.writeInterfaceToken(IActivityManager.descriptor);
2396 data.writeStrongBinder(sender.asBinder());
2397 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2398 reply.readException();
2399 data.recycle();
2400 reply.recycle();
2401 }
2402 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2403 Parcel data = Parcel.obtain();
2404 Parcel reply = Parcel.obtain();
2405 data.writeInterfaceToken(IActivityManager.descriptor);
2406 data.writeStrongBinder(sender.asBinder());
2407 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2408 reply.readException();
2409 String res = reply.readString();
2410 data.recycle();
2411 reply.recycle();
2412 return res;
2413 }
2414 public void setProcessLimit(int max) throws RemoteException
2415 {
2416 Parcel data = Parcel.obtain();
2417 Parcel reply = Parcel.obtain();
2418 data.writeInterfaceToken(IActivityManager.descriptor);
2419 data.writeInt(max);
2420 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2421 reply.readException();
2422 data.recycle();
2423 reply.recycle();
2424 }
2425 public int getProcessLimit() throws RemoteException
2426 {
2427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2431 reply.readException();
2432 int res = reply.readInt();
2433 data.recycle();
2434 reply.recycle();
2435 return res;
2436 }
2437 public void setProcessForeground(IBinder token, int pid,
2438 boolean isForeground) throws RemoteException {
2439 Parcel data = Parcel.obtain();
2440 Parcel reply = Parcel.obtain();
2441 data.writeInterfaceToken(IActivityManager.descriptor);
2442 data.writeStrongBinder(token);
2443 data.writeInt(pid);
2444 data.writeInt(isForeground ? 1 : 0);
2445 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2446 reply.readException();
2447 data.recycle();
2448 reply.recycle();
2449 }
2450 public int checkPermission(String permission, int pid, int uid)
2451 throws RemoteException {
2452 Parcel data = Parcel.obtain();
2453 Parcel reply = Parcel.obtain();
2454 data.writeInterfaceToken(IActivityManager.descriptor);
2455 data.writeString(permission);
2456 data.writeInt(pid);
2457 data.writeInt(uid);
2458 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2459 reply.readException();
2460 int res = reply.readInt();
2461 data.recycle();
2462 reply.recycle();
2463 return res;
2464 }
2465 public boolean clearApplicationUserData(final String packageName,
2466 final IPackageDataObserver observer) throws RemoteException {
2467 Parcel data = Parcel.obtain();
2468 Parcel reply = Parcel.obtain();
2469 data.writeInterfaceToken(IActivityManager.descriptor);
2470 data.writeString(packageName);
2471 data.writeStrongBinder(observer.asBinder());
2472 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2473 reply.readException();
2474 boolean res = reply.readInt() != 0;
2475 data.recycle();
2476 reply.recycle();
2477 return res;
2478 }
2479 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2480 throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 uri.writeToParcel(data, 0);
2485 data.writeInt(pid);
2486 data.writeInt(uid);
2487 data.writeInt(mode);
2488 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2489 reply.readException();
2490 int res = reply.readInt();
2491 data.recycle();
2492 reply.recycle();
2493 return res;
2494 }
2495 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2496 Uri uri, int mode) throws RemoteException {
2497 Parcel data = Parcel.obtain();
2498 Parcel reply = Parcel.obtain();
2499 data.writeInterfaceToken(IActivityManager.descriptor);
2500 data.writeStrongBinder(caller.asBinder());
2501 data.writeString(targetPkg);
2502 uri.writeToParcel(data, 0);
2503 data.writeInt(mode);
2504 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2505 reply.readException();
2506 data.recycle();
2507 reply.recycle();
2508 }
2509 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2510 int mode) throws RemoteException {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(caller.asBinder());
2515 uri.writeToParcel(data, 0);
2516 data.writeInt(mode);
2517 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2518 reply.readException();
2519 data.recycle();
2520 reply.recycle();
2521 }
2522 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2523 throws RemoteException {
2524 Parcel data = Parcel.obtain();
2525 Parcel reply = Parcel.obtain();
2526 data.writeInterfaceToken(IActivityManager.descriptor);
2527 data.writeStrongBinder(who.asBinder());
2528 data.writeInt(waiting ? 1 : 0);
2529 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2530 reply.readException();
2531 data.recycle();
2532 reply.recycle();
2533 }
2534 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2535 Parcel data = Parcel.obtain();
2536 Parcel reply = Parcel.obtain();
2537 data.writeInterfaceToken(IActivityManager.descriptor);
2538 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 outInfo.readFromParcel(reply);
2541 data.recycle();
2542 reply.recycle();
2543 }
2544 public void unhandledBack() throws RemoteException
2545 {
2546 Parcel data = Parcel.obtain();
2547 Parcel reply = Parcel.obtain();
2548 data.writeInterfaceToken(IActivityManager.descriptor);
2549 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2550 reply.readException();
2551 data.recycle();
2552 reply.recycle();
2553 }
2554 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2555 {
2556 Parcel data = Parcel.obtain();
2557 Parcel reply = Parcel.obtain();
2558 data.writeInterfaceToken(IActivityManager.descriptor);
2559 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2560 reply.readException();
2561 ParcelFileDescriptor pfd = null;
2562 if (reply.readInt() != 0) {
2563 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2564 }
2565 data.recycle();
2566 reply.recycle();
2567 return pfd;
2568 }
2569 public void goingToSleep() throws RemoteException
2570 {
2571 Parcel data = Parcel.obtain();
2572 Parcel reply = Parcel.obtain();
2573 data.writeInterfaceToken(IActivityManager.descriptor);
2574 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2575 reply.readException();
2576 data.recycle();
2577 reply.recycle();
2578 }
2579 public void wakingUp() throws RemoteException
2580 {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 data.recycle();
2587 reply.recycle();
2588 }
2589 public void setDebugApp(
2590 String packageName, boolean waitForDebugger, boolean persistent)
2591 throws RemoteException
2592 {
2593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 data.writeString(packageName);
2597 data.writeInt(waitForDebugger ? 1 : 0);
2598 data.writeInt(persistent ? 1 : 0);
2599 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2600 reply.readException();
2601 data.recycle();
2602 reply.recycle();
2603 }
2604 public void setAlwaysFinish(boolean enabled) throws RemoteException
2605 {
2606 Parcel data = Parcel.obtain();
2607 Parcel reply = Parcel.obtain();
2608 data.writeInterfaceToken(IActivityManager.descriptor);
2609 data.writeInt(enabled ? 1 : 0);
2610 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2611 reply.readException();
2612 data.recycle();
2613 reply.recycle();
2614 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002615 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002621 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 reply.readException();
2623 data.recycle();
2624 reply.recycle();
2625 }
2626 public void enterSafeMode() throws RemoteException {
2627 Parcel data = Parcel.obtain();
2628 data.writeInterfaceToken(IActivityManager.descriptor);
2629 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2630 data.recycle();
2631 }
2632 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2633 Parcel data = Parcel.obtain();
2634 data.writeStrongBinder(sender.asBinder());
2635 data.writeInterfaceToken(IActivityManager.descriptor);
2636 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2637 data.recycle();
2638 }
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002639 public boolean killPids(int[] pids, String reason) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002644 data.writeString(reason);
2645 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002646 boolean res = reply.readInt() != 0;
2647 data.recycle();
2648 reply.recycle();
2649 return res;
2650 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002651 public void startRunning(String pkg, String cls, String action,
2652 String indata) throws RemoteException {
2653 Parcel data = Parcel.obtain();
2654 Parcel reply = Parcel.obtain();
2655 data.writeInterfaceToken(IActivityManager.descriptor);
2656 data.writeString(pkg);
2657 data.writeString(cls);
2658 data.writeString(action);
2659 data.writeString(indata);
2660 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2661 reply.readException();
2662 data.recycle();
2663 reply.recycle();
2664 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002665 public boolean testIsSystemReady()
2666 {
2667 /* this base class version is never called */
2668 return true;
2669 }
Dan Egnor60d87622009-12-16 16:32:58 -08002670 public void handleApplicationCrash(IBinder app,
2671 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2672 {
2673 Parcel data = Parcel.obtain();
2674 Parcel reply = Parcel.obtain();
2675 data.writeInterfaceToken(IActivityManager.descriptor);
2676 data.writeStrongBinder(app);
2677 crashInfo.writeToParcel(data, 0);
2678 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2679 reply.readException();
2680 reply.recycle();
2681 data.recycle();
2682 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002683
Dan Egnor60d87622009-12-16 16:32:58 -08002684 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002685 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002686 {
2687 Parcel data = Parcel.obtain();
2688 Parcel reply = Parcel.obtain();
2689 data.writeInterfaceToken(IActivityManager.descriptor);
2690 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002691 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002692 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002693 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002694 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002695 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002696 reply.recycle();
2697 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002698 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002700
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002701 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002702 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002703 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002704 {
2705 Parcel data = Parcel.obtain();
2706 Parcel reply = Parcel.obtain();
2707 data.writeInterfaceToken(IActivityManager.descriptor);
2708 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002709 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002710 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002711 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2712 reply.readException();
2713 reply.recycle();
2714 data.recycle();
2715 }
2716
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002717 public void signalPersistentProcesses(int sig) throws RemoteException {
2718 Parcel data = Parcel.obtain();
2719 Parcel reply = Parcel.obtain();
2720 data.writeInterfaceToken(IActivityManager.descriptor);
2721 data.writeInt(sig);
2722 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2723 reply.readException();
2724 data.recycle();
2725 reply.recycle();
2726 }
2727
Dianne Hackborn03abb812010-01-04 18:43:19 -08002728 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002733 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 data.recycle();
2736 reply.recycle();
2737 }
2738
2739 public void forceStopPackage(String packageName) throws RemoteException {
2740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeString(packageName);
2744 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002745 reply.readException();
2746 data.recycle();
2747 reply.recycle();
2748 }
2749
2750 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2751 {
2752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2758 reply.recycle();
2759 data.recycle();
2760 return res;
2761 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002762
2763 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002764 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002765 {
2766 Parcel data = Parcel.obtain();
2767 Parcel reply = Parcel.obtain();
2768 data.writeInterfaceToken(IActivityManager.descriptor);
2769 data.writeString(process);
2770 data.writeInt(start ? 1 : 0);
2771 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002772 if (fd != null) {
2773 data.writeInt(1);
2774 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2775 } else {
2776 data.writeInt(0);
2777 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002778 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2779 reply.readException();
2780 boolean res = reply.readInt() != 0;
2781 reply.recycle();
2782 data.recycle();
2783 return res;
2784 }
2785
Dianne Hackborn55280a92009-05-07 15:53:46 -07002786 public boolean shutdown(int timeout) throws RemoteException
2787 {
2788 Parcel data = Parcel.obtain();
2789 Parcel reply = Parcel.obtain();
2790 data.writeInterfaceToken(IActivityManager.descriptor);
2791 data.writeInt(timeout);
2792 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2793 reply.readException();
2794 boolean res = reply.readInt() != 0;
2795 reply.recycle();
2796 data.recycle();
2797 return res;
2798 }
2799
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002800 public void stopAppSwitches() throws RemoteException {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 reply.recycle();
2807 data.recycle();
2808 }
2809
2810 public void resumeAppSwitches() throws RemoteException {
2811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 reply.recycle();
2817 data.recycle();
2818 }
2819
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002820 public void registerActivityWatcher(IActivityWatcher watcher)
2821 throws RemoteException {
2822 Parcel data = Parcel.obtain();
2823 Parcel reply = Parcel.obtain();
2824 data.writeInterfaceToken(IActivityManager.descriptor);
2825 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2826 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 data.recycle();
2829 reply.recycle();
2830 }
2831
2832 public void unregisterActivityWatcher(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(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2839 reply.readException();
2840 data.recycle();
2841 reply.recycle();
2842 }
2843
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002844 public int startActivityInPackage(int uid,
2845 Intent intent, String resolvedType, IBinder resultTo,
2846 String resultWho, int requestCode, boolean onlyIfNeeded)
2847 throws RemoteException {
2848 Parcel data = Parcel.obtain();
2849 Parcel reply = Parcel.obtain();
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 data.writeInt(uid);
2852 intent.writeToParcel(data, 0);
2853 data.writeString(resolvedType);
2854 data.writeStrongBinder(resultTo);
2855 data.writeString(resultWho);
2856 data.writeInt(requestCode);
2857 data.writeInt(onlyIfNeeded ? 1 : 0);
2858 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2859 reply.readException();
2860 int result = reply.readInt();
2861 reply.recycle();
2862 data.recycle();
2863 return result;
2864 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002865
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002866 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2867 Parcel data = Parcel.obtain();
2868 Parcel reply = Parcel.obtain();
2869 data.writeInterfaceToken(IActivityManager.descriptor);
2870 data.writeString(pkg);
2871 data.writeInt(uid);
2872 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 data.recycle();
2875 reply.recycle();
2876 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002877
2878 public void closeSystemDialogs(String reason) throws RemoteException {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
2882 data.writeString(reason);
2883 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2884 reply.readException();
2885 data.recycle();
2886 reply.recycle();
2887 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002888
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002889 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002890 throws RemoteException {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002894 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002895 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
2896 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002897 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002898 data.recycle();
2899 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002900 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002901 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07002902
2903 public void killApplicationProcess(String processName, int uid) throws RemoteException {
2904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 data.writeString(processName);
2908 data.writeInt(uid);
2909 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
2910 reply.readException();
2911 data.recycle();
2912 reply.recycle();
2913 }
2914
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07002915 public void overridePendingTransition(IBinder token, String packageName,
2916 int enterAnim, int exitAnim) throws RemoteException {
2917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 data.writeStrongBinder(token);
2921 data.writeString(packageName);
2922 data.writeInt(enterAnim);
2923 data.writeInt(exitAnim);
2924 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
2925 reply.readException();
2926 data.recycle();
2927 reply.recycle();
2928 }
2929
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08002930 public boolean isUserAMonkey() throws RemoteException {
2931 Parcel data = Parcel.obtain();
2932 Parcel reply = Parcel.obtain();
2933 data.writeInterfaceToken(IActivityManager.descriptor);
2934 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
2935 reply.readException();
2936 boolean res = reply.readInt() != 0;
2937 data.recycle();
2938 reply.recycle();
2939 return res;
2940 }
2941
Dianne Hackborn860755f2010-06-03 18:47:52 -07002942 public void finishHeavyWeightApp() throws RemoteException {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 data.recycle();
2949 reply.recycle();
2950 }
2951
Daniel Sandler69a48172010-06-23 16:29:36 -04002952 public void setImmersive(IBinder token, boolean immersive)
2953 throws RemoteException {
2954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeStrongBinder(token);
2958 data.writeInt(immersive ? 1 : 0);
2959 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 data.recycle();
2962 reply.recycle();
2963 }
2964
2965 public boolean isImmersive(IBinder token)
2966 throws RemoteException {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeStrongBinder(token);
2971 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04002972 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07002973 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04002974 data.recycle();
2975 reply.recycle();
2976 return res;
2977 }
2978
2979 public boolean isTopActivityImmersive()
2980 throws RemoteException {
2981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
2984 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04002985 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07002986 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04002987 data.recycle();
2988 reply.recycle();
2989 return res;
2990 }
2991
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07002992 public void crashApplication(int uid, int initialPid, String packageName,
2993 String message) throws RemoteException {
2994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 data.writeInt(uid);
2998 data.writeInt(initialPid);
2999 data.writeString(packageName);
3000 data.writeString(message);
3001 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3002 reply.readException();
3003 data.recycle();
3004 reply.recycle();
3005 }
Andy McFadden824c5102010-07-09 16:26:57 -07003006
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003007 public String getProviderMimeType(Uri uri)
3008 throws RemoteException {
3009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
3011 data.writeInterfaceToken(IActivityManager.descriptor);
3012 uri.writeToParcel(data, 0);
3013 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3014 reply.readException();
3015 String res = reply.readString();
3016 data.recycle();
3017 reply.recycle();
3018 return res;
3019 }
3020
Dianne Hackborn7e269642010-08-25 19:50:20 -07003021 public IBinder newUriPermissionOwner(String name)
3022 throws RemoteException {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 data.writeString(name);
3027 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 IBinder res = reply.readStrongBinder();
3030 data.recycle();
3031 reply.recycle();
3032 return res;
3033 }
3034
3035 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3036 Uri uri, int mode) throws RemoteException {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 data.writeStrongBinder(owner);
3041 data.writeInt(fromUid);
3042 data.writeString(targetPkg);
3043 uri.writeToParcel(data, 0);
3044 data.writeInt(mode);
3045 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3046 reply.readException();
3047 data.recycle();
3048 reply.recycle();
3049 }
3050
3051 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3052 int mode) throws RemoteException {
3053 Parcel data = Parcel.obtain();
3054 Parcel reply = Parcel.obtain();
3055 data.writeInterfaceToken(IActivityManager.descriptor);
3056 data.writeStrongBinder(owner);
3057 if (uri != null) {
3058 data.writeInt(1);
3059 uri.writeToParcel(data, 0);
3060 } else {
3061 data.writeInt(0);
3062 }
3063 data.writeInt(mode);
3064 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 data.recycle();
3067 reply.recycle();
3068 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003069
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003070 public int checkGrantUriPermission(int callingUid, String targetPkg,
3071 Uri uri, int modeFlags) throws RemoteException {
3072 Parcel data = Parcel.obtain();
3073 Parcel reply = Parcel.obtain();
3074 data.writeInterfaceToken(IActivityManager.descriptor);
3075 data.writeInt(callingUid);
3076 data.writeString(targetPkg);
3077 uri.writeToParcel(data, 0);
3078 data.writeInt(modeFlags);
3079 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3080 reply.readException();
3081 int res = reply.readInt();
3082 data.recycle();
3083 reply.recycle();
3084 return res;
3085 }
3086
Andy McFadden824c5102010-07-09 16:26:57 -07003087 public boolean dumpHeap(String process, boolean managed,
3088 String path, ParcelFileDescriptor fd) throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 data.writeString(process);
3093 data.writeInt(managed ? 1 : 0);
3094 data.writeString(path);
3095 if (fd != null) {
3096 data.writeInt(1);
3097 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3098 } else {
3099 data.writeInt(0);
3100 }
3101 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3102 reply.readException();
3103 boolean res = reply.readInt() != 0;
3104 reply.recycle();
3105 data.recycle();
3106 return res;
3107 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003108
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003109 public int startActivities(IApplicationThread caller,
3110 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3111 Parcel data = Parcel.obtain();
3112 Parcel reply = Parcel.obtain();
3113 data.writeInterfaceToken(IActivityManager.descriptor);
3114 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3115 data.writeTypedArray(intents, 0);
3116 data.writeStringArray(resolvedTypes);
3117 data.writeStrongBinder(resultTo);
3118 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3119 reply.readException();
3120 int result = reply.readInt();
3121 reply.recycle();
3122 data.recycle();
3123 return result;
3124 }
3125
3126 public int startActivitiesInPackage(int uid,
3127 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
3130 data.writeInterfaceToken(IActivityManager.descriptor);
3131 data.writeInt(uid);
3132 data.writeTypedArray(intents, 0);
3133 data.writeStringArray(resolvedTypes);
3134 data.writeStrongBinder(resultTo);
3135 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3136 reply.readException();
3137 int result = reply.readInt();
3138 reply.recycle();
3139 data.recycle();
3140 return result;
3141 }
3142
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003143 private IBinder mRemote;
3144}