blob: fdf4a3af906d8f31594ac3d34efc34e0dc3da41b [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.Intent;
21import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070022import android.content.IIntentSender;
23import android.content.IIntentReceiver;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
28import android.content.res.Configuration;
29import android.graphics.Bitmap;
30import android.net.Uri;
31import android.os.Binder;
32import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070033import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.os.Parcelable;
35import android.os.ParcelFileDescriptor;
36import android.os.RemoteException;
37import android.os.IBinder;
38import android.os.Parcel;
39import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070040import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080043import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import java.util.ArrayList;
46import java.util.List;
47
48/** {@hide} */
49public abstract class ActivityManagerNative extends Binder implements IActivityManager
50{
51 /**
52 * Cast a Binder object into an activity manager interface, generating
53 * a proxy if needed.
54 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080055 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 if (obj == null) {
57 return null;
58 }
59 IActivityManager in =
60 (IActivityManager)obj.queryLocalInterface(descriptor);
61 if (in != null) {
62 return in;
63 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 return new ActivityManagerProxy(obj);
66 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 /**
69 * Retrieve the system's default/global activity manager.
70 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080071 static public IActivityManager getDefault() {
72 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 }
74
75 /**
76 * Convenience for checking whether the system is ready. For internal use only.
77 */
78 static public boolean isSystemReady() {
79 if (!sSystemReady) {
80 sSystemReady = getDefault().testIsSystemReady();
81 }
82 return sSystemReady;
83 }
84 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080085
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 /**
87 * Convenience for sending a sticky broadcast. For internal use only.
88 * If you don't care about permission, use null.
89 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080090 static public void broadcastStickyIntent(Intent intent, String permission) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 try {
92 getDefault().broadcastIntent(
93 null, intent, null, null, Activity.RESULT_OK, null, null,
94 null /*permission*/, false, true);
95 } catch (RemoteException ex) {
96 }
97 }
98
99 static public void noteWakeupAlarm(PendingIntent ps) {
100 try {
101 getDefault().noteWakeupAlarm(ps.getTarget());
102 } catch (RemoteException ex) {
103 }
104 }
105
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800106 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 attachInterface(this, descriptor);
108 }
109
110 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
111 throws RemoteException {
112 switch (code) {
113 case START_ACTIVITY_TRANSACTION:
114 {
115 data.enforceInterface(IActivityManager.descriptor);
116 IBinder b = data.readStrongBinder();
117 IApplicationThread app = ApplicationThreadNative.asInterface(b);
118 Intent intent = Intent.CREATOR.createFromParcel(data);
119 String resolvedType = data.readString();
120 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
121 int grantedMode = data.readInt();
122 IBinder resultTo = data.readStrongBinder();
123 String resultWho = data.readString();
124 int requestCode = data.readInt();
125 boolean onlyIfNeeded = data.readInt() != 0;
126 boolean debug = data.readInt() != 0;
127 int result = startActivity(app, intent, resolvedType,
128 grantedUriPermissions, grantedMode, resultTo, resultWho,
129 requestCode, onlyIfNeeded, debug);
130 reply.writeNoException();
131 reply.writeInt(result);
132 return true;
133 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700134
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800135 case START_ACTIVITY_AND_WAIT_TRANSACTION:
136 {
137 data.enforceInterface(IActivityManager.descriptor);
138 IBinder b = data.readStrongBinder();
139 IApplicationThread app = ApplicationThreadNative.asInterface(b);
140 Intent intent = Intent.CREATOR.createFromParcel(data);
141 String resolvedType = data.readString();
142 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
143 int grantedMode = data.readInt();
144 IBinder resultTo = data.readStrongBinder();
145 String resultWho = data.readString();
146 int requestCode = data.readInt();
147 boolean onlyIfNeeded = data.readInt() != 0;
148 boolean debug = data.readInt() != 0;
149 WaitResult result = startActivityAndWait(app, intent, resolvedType,
150 grantedUriPermissions, grantedMode, resultTo, resultWho,
151 requestCode, onlyIfNeeded, debug);
152 reply.writeNoException();
153 result.writeToParcel(reply, 0);
154 return true;
155 }
156
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700157 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
158 {
159 data.enforceInterface(IActivityManager.descriptor);
160 IBinder b = data.readStrongBinder();
161 IApplicationThread app = ApplicationThreadNative.asInterface(b);
162 Intent intent = Intent.CREATOR.createFromParcel(data);
163 String resolvedType = data.readString();
164 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
165 int grantedMode = data.readInt();
166 IBinder resultTo = data.readStrongBinder();
167 String resultWho = data.readString();
168 int requestCode = data.readInt();
169 boolean onlyIfNeeded = data.readInt() != 0;
170 boolean debug = data.readInt() != 0;
171 Configuration config = Configuration.CREATOR.createFromParcel(data);
172 int result = startActivityWithConfig(app, intent, resolvedType,
173 grantedUriPermissions, grantedMode, resultTo, resultWho,
174 requestCode, onlyIfNeeded, debug, config);
175 reply.writeNoException();
176 reply.writeInt(result);
177 return true;
178 }
179
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700180 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700181 {
182 data.enforceInterface(IActivityManager.descriptor);
183 IBinder b = data.readStrongBinder();
184 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700185 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700186 Intent fillInIntent = null;
187 if (data.readInt() != 0) {
188 fillInIntent = Intent.CREATOR.createFromParcel(data);
189 }
190 String resolvedType = data.readString();
191 IBinder resultTo = data.readStrongBinder();
192 String resultWho = data.readString();
193 int requestCode = data.readInt();
194 int flagsMask = data.readInt();
195 int flagsValues = data.readInt();
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700196 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700197 fillInIntent, resolvedType, resultTo, resultWho,
198 requestCode, flagsMask, flagsValues);
199 reply.writeNoException();
200 reply.writeInt(result);
201 return true;
202 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800203
204 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
205 {
206 data.enforceInterface(IActivityManager.descriptor);
207 IBinder callingActivity = data.readStrongBinder();
208 Intent intent = Intent.CREATOR.createFromParcel(data);
209 boolean result = startNextMatchingActivity(callingActivity, intent);
210 reply.writeNoException();
211 reply.writeInt(result ? 1 : 0);
212 return true;
213 }
214
215 case FINISH_ACTIVITY_TRANSACTION: {
216 data.enforceInterface(IActivityManager.descriptor);
217 IBinder token = data.readStrongBinder();
218 Intent resultData = null;
219 int resultCode = data.readInt();
220 if (data.readInt() != 0) {
221 resultData = Intent.CREATOR.createFromParcel(data);
222 }
223 boolean res = finishActivity(token, resultCode, resultData);
224 reply.writeNoException();
225 reply.writeInt(res ? 1 : 0);
226 return true;
227 }
228
229 case FINISH_SUB_ACTIVITY_TRANSACTION: {
230 data.enforceInterface(IActivityManager.descriptor);
231 IBinder token = data.readStrongBinder();
232 String resultWho = data.readString();
233 int requestCode = data.readInt();
234 finishSubActivity(token, resultWho, requestCode);
235 reply.writeNoException();
236 return true;
237 }
238
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800239 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
240 data.enforceInterface(IActivityManager.descriptor);
241 IBinder token = data.readStrongBinder();
242 boolean res = willActivityBeVisible(token);
243 reply.writeNoException();
244 reply.writeInt(res ? 1 : 0);
245 return true;
246 }
247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800248 case REGISTER_RECEIVER_TRANSACTION:
249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 IBinder b = data.readStrongBinder();
252 IApplicationThread app =
253 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700254 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800255 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();
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700260 Intent intent = registerReceiver(app, packageName, rec, filter, perm);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800261 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 Hackbornf26fd992011-04-08 18:14:09 -0700445 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800446 data.enforceInterface(IActivityManager.descriptor);
447 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700448 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800449 reply.writeNoException();
450 if (bm != null) {
451 reply.writeInt(1);
452 bm.writeToParcel(reply, 0);
453 } else {
454 reply.writeInt(0);
455 }
456 return true;
457 }
458
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800459 case GET_SERVICES_TRANSACTION: {
460 data.enforceInterface(IActivityManager.descriptor);
461 int maxNum = data.readInt();
462 int fl = data.readInt();
463 List list = getServices(maxNum, fl);
464 reply.writeNoException();
465 int N = list != null ? list.size() : -1;
466 reply.writeInt(N);
467 int i;
468 for (i=0; i<N; i++) {
469 ActivityManager.RunningServiceInfo info =
470 (ActivityManager.RunningServiceInfo)list.get(i);
471 info.writeToParcel(reply, 0);
472 }
473 return true;
474 }
475
476 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
477 data.enforceInterface(IActivityManager.descriptor);
478 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
479 reply.writeNoException();
480 reply.writeTypedList(list);
481 return true;
482 }
483
484 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
485 data.enforceInterface(IActivityManager.descriptor);
486 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
487 reply.writeNoException();
488 reply.writeTypedList(list);
489 return true;
490 }
491
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700492 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
493 data.enforceInterface(IActivityManager.descriptor);
494 List<ApplicationInfo> list = getRunningExternalApplications();
495 reply.writeNoException();
496 reply.writeTypedList(list);
497 return true;
498 }
499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800500 case MOVE_TASK_TO_FRONT_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800503 int fl = data.readInt();
504 moveTaskToFront(task, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 reply.writeNoException();
506 return true;
507 }
508
509 case MOVE_TASK_TO_BACK_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 int task = data.readInt();
512 moveTaskToBack(task);
513 reply.writeNoException();
514 return true;
515 }
516
517 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
518 data.enforceInterface(IActivityManager.descriptor);
519 IBinder token = data.readStrongBinder();
520 boolean nonRoot = data.readInt() != 0;
521 boolean res = moveActivityTaskToBack(token, nonRoot);
522 reply.writeNoException();
523 reply.writeInt(res ? 1 : 0);
524 return true;
525 }
526
527 case MOVE_TASK_BACKWARDS_TRANSACTION: {
528 data.enforceInterface(IActivityManager.descriptor);
529 int task = data.readInt();
530 moveTaskBackwards(task);
531 reply.writeNoException();
532 return true;
533 }
534
535 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
536 data.enforceInterface(IActivityManager.descriptor);
537 IBinder token = data.readStrongBinder();
538 boolean onlyRoot = data.readInt() != 0;
539 int res = token != null
540 ? getTaskForActivity(token, onlyRoot) : -1;
541 reply.writeNoException();
542 reply.writeInt(res);
543 return true;
544 }
545
546 case FINISH_OTHER_INSTANCES_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 ComponentName className = ComponentName.readFromParcel(data);
550 finishOtherInstances(token, className);
551 reply.writeNoException();
552 return true;
553 }
554
555 case REPORT_THUMBNAIL_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 Bitmap thumbnail = data.readInt() != 0
559 ? Bitmap.CREATOR.createFromParcel(data) : null;
560 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
561 reportThumbnail(token, thumbnail, description);
562 reply.writeNoException();
563 return true;
564 }
565
566 case GET_CONTENT_PROVIDER_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder b = data.readStrongBinder();
569 IApplicationThread app = ApplicationThreadNative.asInterface(b);
570 String name = data.readString();
571 ContentProviderHolder cph = getContentProvider(app, name);
572 reply.writeNoException();
573 if (cph != null) {
574 reply.writeInt(1);
575 cph.writeToParcel(reply, 0);
576 } else {
577 reply.writeInt(0);
578 }
579 return true;
580 }
581
582 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
583 data.enforceInterface(IActivityManager.descriptor);
584 IBinder b = data.readStrongBinder();
585 IApplicationThread app = ApplicationThreadNative.asInterface(b);
586 ArrayList<ContentProviderHolder> providers =
587 data.createTypedArrayList(ContentProviderHolder.CREATOR);
588 publishContentProviders(app, providers);
589 reply.writeNoException();
590 return true;
591 }
592
593 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
594 data.enforceInterface(IActivityManager.descriptor);
595 IBinder b = data.readStrongBinder();
596 IApplicationThread app = ApplicationThreadNative.asInterface(b);
597 String name = data.readString();
598 removeContentProvider(app, name);
599 reply.writeNoException();
600 return true;
601 }
602
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700603 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
604 data.enforceInterface(IActivityManager.descriptor);
605 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
606 PendingIntent pi = getRunningServiceControlPanel(comp);
607 reply.writeNoException();
608 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
609 return true;
610 }
611
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 case START_SERVICE_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 IBinder b = data.readStrongBinder();
615 IApplicationThread app = ApplicationThreadNative.asInterface(b);
616 Intent service = Intent.CREATOR.createFromParcel(data);
617 String resolvedType = data.readString();
618 ComponentName cn = startService(app, service, resolvedType);
619 reply.writeNoException();
620 ComponentName.writeToParcel(cn, reply);
621 return true;
622 }
623
624 case STOP_SERVICE_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 IBinder b = data.readStrongBinder();
627 IApplicationThread app = ApplicationThreadNative.asInterface(b);
628 Intent service = Intent.CREATOR.createFromParcel(data);
629 String resolvedType = data.readString();
630 int res = stopService(app, service, resolvedType);
631 reply.writeNoException();
632 reply.writeInt(res);
633 return true;
634 }
635
636 case STOP_SERVICE_TOKEN_TRANSACTION: {
637 data.enforceInterface(IActivityManager.descriptor);
638 ComponentName className = ComponentName.readFromParcel(data);
639 IBinder token = data.readStrongBinder();
640 int startId = data.readInt();
641 boolean res = stopServiceToken(className, token, startId);
642 reply.writeNoException();
643 reply.writeInt(res ? 1 : 0);
644 return true;
645 }
646
647 case SET_SERVICE_FOREGROUND_TRANSACTION: {
648 data.enforceInterface(IActivityManager.descriptor);
649 ComponentName className = ComponentName.readFromParcel(data);
650 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700651 int id = data.readInt();
652 Notification notification = null;
653 if (data.readInt() != 0) {
654 notification = Notification.CREATOR.createFromParcel(data);
655 }
656 boolean removeNotification = data.readInt() != 0;
657 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800658 reply.writeNoException();
659 return true;
660 }
661
662 case BIND_SERVICE_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 IBinder b = data.readStrongBinder();
665 IApplicationThread app = ApplicationThreadNative.asInterface(b);
666 IBinder token = data.readStrongBinder();
667 Intent service = Intent.CREATOR.createFromParcel(data);
668 String resolvedType = data.readString();
669 b = data.readStrongBinder();
670 int fl = data.readInt();
671 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
672 int res = bindService(app, token, service, resolvedType, conn, fl);
673 reply.writeNoException();
674 reply.writeInt(res);
675 return true;
676 }
677
678 case UNBIND_SERVICE_TRANSACTION: {
679 data.enforceInterface(IActivityManager.descriptor);
680 IBinder b = data.readStrongBinder();
681 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
682 boolean res = unbindService(conn);
683 reply.writeNoException();
684 reply.writeInt(res ? 1 : 0);
685 return true;
686 }
687
688 case PUBLISH_SERVICE_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 IBinder token = data.readStrongBinder();
691 Intent intent = Intent.CREATOR.createFromParcel(data);
692 IBinder service = data.readStrongBinder();
693 publishService(token, intent, service);
694 reply.writeNoException();
695 return true;
696 }
697
698 case UNBIND_FINISHED_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 IBinder token = data.readStrongBinder();
701 Intent intent = Intent.CREATOR.createFromParcel(data);
702 boolean doRebind = data.readInt() != 0;
703 unbindFinished(token, intent, doRebind);
704 reply.writeNoException();
705 return true;
706 }
707
708 case SERVICE_DONE_EXECUTING_TRANSACTION: {
709 data.enforceInterface(IActivityManager.descriptor);
710 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700711 int type = data.readInt();
712 int startId = data.readInt();
713 int res = data.readInt();
714 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800715 reply.writeNoException();
716 return true;
717 }
718
719 case START_INSTRUMENTATION_TRANSACTION: {
720 data.enforceInterface(IActivityManager.descriptor);
721 ComponentName className = ComponentName.readFromParcel(data);
722 String profileFile = data.readString();
723 int fl = data.readInt();
724 Bundle arguments = data.readBundle();
725 IBinder b = data.readStrongBinder();
726 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
727 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
728 reply.writeNoException();
729 reply.writeInt(res ? 1 : 0);
730 return true;
731 }
732
733
734 case FINISH_INSTRUMENTATION_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 IBinder b = data.readStrongBinder();
737 IApplicationThread app = ApplicationThreadNative.asInterface(b);
738 int resultCode = data.readInt();
739 Bundle results = data.readBundle();
740 finishInstrumentation(app, resultCode, results);
741 reply.writeNoException();
742 return true;
743 }
744
745 case GET_CONFIGURATION_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 Configuration config = getConfiguration();
748 reply.writeNoException();
749 config.writeToParcel(reply, 0);
750 return true;
751 }
752
753 case UPDATE_CONFIGURATION_TRANSACTION: {
754 data.enforceInterface(IActivityManager.descriptor);
755 Configuration config = Configuration.CREATOR.createFromParcel(data);
756 updateConfiguration(config);
757 reply.writeNoException();
758 return true;
759 }
760
761 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 IBinder token = data.readStrongBinder();
764 int requestedOrientation = data.readInt();
765 setRequestedOrientation(token, requestedOrientation);
766 reply.writeNoException();
767 return true;
768 }
769
770 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 IBinder token = data.readStrongBinder();
773 int req = getRequestedOrientation(token);
774 reply.writeNoException();
775 reply.writeInt(req);
776 return true;
777 }
778
779 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
780 data.enforceInterface(IActivityManager.descriptor);
781 IBinder token = data.readStrongBinder();
782 ComponentName cn = getActivityClassForToken(token);
783 reply.writeNoException();
784 ComponentName.writeToParcel(cn, reply);
785 return true;
786 }
787
788 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder token = data.readStrongBinder();
791 reply.writeNoException();
792 reply.writeString(getPackageForToken(token));
793 return true;
794 }
795
796 case GET_INTENT_SENDER_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 int type = data.readInt();
799 String packageName = data.readString();
800 IBinder token = data.readStrongBinder();
801 String resultWho = data.readString();
802 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800803 Intent[] requestIntents;
804 String[] requestResolvedTypes;
805 if (data.readInt() != 0) {
806 requestIntents = data.createTypedArray(Intent.CREATOR);
807 requestResolvedTypes = data.createStringArray();
808 } else {
809 requestIntents = null;
810 requestResolvedTypes = null;
811 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800812 int fl = data.readInt();
813 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800814 resultWho, requestCode, requestIntents,
815 requestResolvedTypes, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 reply.writeNoException();
817 reply.writeStrongBinder(res != null ? res.asBinder() : null);
818 return true;
819 }
820
821 case CANCEL_INTENT_SENDER_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 IIntentSender r = IIntentSender.Stub.asInterface(
824 data.readStrongBinder());
825 cancelIntentSender(r);
826 reply.writeNoException();
827 return true;
828 }
829
830 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IIntentSender r = IIntentSender.Stub.asInterface(
833 data.readStrongBinder());
834 String res = getPackageForIntentSender(r);
835 reply.writeNoException();
836 reply.writeString(res);
837 return true;
838 }
839
840 case SET_PROCESS_LIMIT_TRANSACTION: {
841 data.enforceInterface(IActivityManager.descriptor);
842 int max = data.readInt();
843 setProcessLimit(max);
844 reply.writeNoException();
845 return true;
846 }
847
848 case GET_PROCESS_LIMIT_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 int limit = getProcessLimit();
851 reply.writeNoException();
852 reply.writeInt(limit);
853 return true;
854 }
855
856 case SET_PROCESS_FOREGROUND_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 IBinder token = data.readStrongBinder();
859 int pid = data.readInt();
860 boolean isForeground = data.readInt() != 0;
861 setProcessForeground(token, pid, isForeground);
862 reply.writeNoException();
863 return true;
864 }
865
866 case CHECK_PERMISSION_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 String perm = data.readString();
869 int pid = data.readInt();
870 int uid = data.readInt();
871 int res = checkPermission(perm, pid, uid);
872 reply.writeNoException();
873 reply.writeInt(res);
874 return true;
875 }
876
877 case CHECK_URI_PERMISSION_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 Uri uri = Uri.CREATOR.createFromParcel(data);
880 int pid = data.readInt();
881 int uid = data.readInt();
882 int mode = data.readInt();
883 int res = checkUriPermission(uri, pid, uid, mode);
884 reply.writeNoException();
885 reply.writeInt(res);
886 return true;
887 }
888
889 case CLEAR_APP_DATA_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 String packageName = data.readString();
892 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
893 data.readStrongBinder());
894 boolean res = clearApplicationUserData(packageName, observer);
895 reply.writeNoException();
896 reply.writeInt(res ? 1 : 0);
897 return true;
898 }
899
900 case GRANT_URI_PERMISSION_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder b = data.readStrongBinder();
903 IApplicationThread app = ApplicationThreadNative.asInterface(b);
904 String targetPkg = data.readString();
905 Uri uri = Uri.CREATOR.createFromParcel(data);
906 int mode = data.readInt();
907 grantUriPermission(app, targetPkg, uri, mode);
908 reply.writeNoException();
909 return true;
910 }
911
912 case REVOKE_URI_PERMISSION_TRANSACTION: {
913 data.enforceInterface(IActivityManager.descriptor);
914 IBinder b = data.readStrongBinder();
915 IApplicationThread app = ApplicationThreadNative.asInterface(b);
916 Uri uri = Uri.CREATOR.createFromParcel(data);
917 int mode = data.readInt();
918 revokeUriPermission(app, uri, mode);
919 reply.writeNoException();
920 return true;
921 }
922
923 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 IApplicationThread app = ApplicationThreadNative.asInterface(b);
927 boolean waiting = data.readInt() != 0;
928 showWaitingForDebugger(app, waiting);
929 reply.writeNoException();
930 return true;
931 }
932
933 case GET_MEMORY_INFO_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
936 getMemoryInfo(mi);
937 reply.writeNoException();
938 mi.writeToParcel(reply, 0);
939 return true;
940 }
941
942 case UNHANDLED_BACK_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 unhandledBack();
945 reply.writeNoException();
946 return true;
947 }
948
949 case OPEN_CONTENT_URI_TRANSACTION: {
950 data.enforceInterface(IActivityManager.descriptor);
951 Uri uri = Uri.parse(data.readString());
952 ParcelFileDescriptor pfd = openContentUri(uri);
953 reply.writeNoException();
954 if (pfd != null) {
955 reply.writeInt(1);
956 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
957 } else {
958 reply.writeInt(0);
959 }
960 return true;
961 }
962
963 case GOING_TO_SLEEP_TRANSACTION: {
964 data.enforceInterface(IActivityManager.descriptor);
965 goingToSleep();
966 reply.writeNoException();
967 return true;
968 }
969
970 case WAKING_UP_TRANSACTION: {
971 data.enforceInterface(IActivityManager.descriptor);
972 wakingUp();
973 reply.writeNoException();
974 return true;
975 }
976
977 case SET_DEBUG_APP_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 String pn = data.readString();
980 boolean wfd = data.readInt() != 0;
981 boolean per = data.readInt() != 0;
982 setDebugApp(pn, wfd, per);
983 reply.writeNoException();
984 return true;
985 }
986
987 case SET_ALWAYS_FINISH_TRANSACTION: {
988 data.enforceInterface(IActivityManager.descriptor);
989 boolean enabled = data.readInt() != 0;
990 setAlwaysFinish(enabled);
991 reply.writeNoException();
992 return true;
993 }
994
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700995 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700997 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800998 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -0700999 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001000 return true;
1001 }
1002
1003 case ENTER_SAFE_MODE_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 enterSafeMode();
1006 reply.writeNoException();
1007 return true;
1008 }
1009
1010 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1011 data.enforceInterface(IActivityManager.descriptor);
1012 IIntentSender is = IIntentSender.Stub.asInterface(
1013 data.readStrongBinder());
1014 noteWakeupAlarm(is);
1015 reply.writeNoException();
1016 return true;
1017 }
1018
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001019 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001020 data.enforceInterface(IActivityManager.descriptor);
1021 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001022 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001023 boolean secure = data.readInt() != 0;
1024 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001025 reply.writeNoException();
1026 reply.writeInt(res ? 1 : 0);
1027 return true;
1028 }
1029
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 case START_RUNNING_TRANSACTION: {
1031 data.enforceInterface(IActivityManager.descriptor);
1032 String pkg = data.readString();
1033 String cls = data.readString();
1034 String action = data.readString();
1035 String indata = data.readString();
1036 startRunning(pkg, cls, action, indata);
1037 reply.writeNoException();
1038 return true;
1039 }
1040
Dan Egnor60d87622009-12-16 16:32:58 -08001041 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1042 data.enforceInterface(IActivityManager.descriptor);
1043 IBinder app = data.readStrongBinder();
1044 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1045 handleApplicationCrash(app, ci);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
1050 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001051 data.enforceInterface(IActivityManager.descriptor);
1052 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001054 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001055 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001056 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001057 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001058 return true;
1059 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001060
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001061 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001064 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001065 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1066 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001067 reply.writeNoException();
1068 return true;
1069 }
1070
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001071 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 int sig = data.readInt();
1074 signalPersistentProcesses(sig);
1075 reply.writeNoException();
1076 return true;
1077 }
1078
Dianne Hackborn03abb812010-01-04 18:43:19 -08001079 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001082 killBackgroundProcesses(packageName);
1083 reply.writeNoException();
1084 return true;
1085 }
1086
1087 case FORCE_STOP_PACKAGE_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 String packageName = data.readString();
1090 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001091 reply.writeNoException();
1092 return true;
1093 }
1094
1095 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 ConfigurationInfo config = getDeviceConfigurationInfo();
1098 reply.writeNoException();
1099 config.writeToParcel(reply, 0);
1100 return true;
1101 }
1102
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001103 case PROFILE_CONTROL_TRANSACTION: {
1104 data.enforceInterface(IActivityManager.descriptor);
1105 String process = data.readString();
1106 boolean start = data.readInt() != 0;
1107 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001108 ParcelFileDescriptor fd = data.readInt() != 0
1109 ? data.readFileDescriptor() : null;
1110 boolean res = profileControl(process, start, path, fd);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001111 reply.writeNoException();
1112 reply.writeInt(res ? 1 : 0);
1113 return true;
1114 }
1115
Dianne Hackborn55280a92009-05-07 15:53:46 -07001116 case SHUTDOWN_TRANSACTION: {
1117 data.enforceInterface(IActivityManager.descriptor);
1118 boolean res = shutdown(data.readInt());
1119 reply.writeNoException();
1120 reply.writeInt(res ? 1 : 0);
1121 return true;
1122 }
1123
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001124 case STOP_APP_SWITCHES_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 stopAppSwitches();
1127 reply.writeNoException();
1128 return true;
1129 }
1130
1131 case RESUME_APP_SWITCHES_TRANSACTION: {
1132 data.enforceInterface(IActivityManager.descriptor);
1133 resumeAppSwitches();
1134 reply.writeNoException();
1135 return true;
1136 }
1137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 case PEEK_SERVICE_TRANSACTION: {
1139 data.enforceInterface(IActivityManager.descriptor);
1140 Intent service = Intent.CREATOR.createFromParcel(data);
1141 String resolvedType = data.readString();
1142 IBinder binder = peekService(service, resolvedType);
1143 reply.writeNoException();
1144 reply.writeStrongBinder(binder);
1145 return true;
1146 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001147
1148 case START_BACKUP_AGENT_TRANSACTION: {
1149 data.enforceInterface(IActivityManager.descriptor);
1150 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1151 int backupRestoreMode = data.readInt();
1152 boolean success = bindBackupAgent(info, backupRestoreMode);
1153 reply.writeNoException();
1154 reply.writeInt(success ? 1 : 0);
1155 return true;
1156 }
1157
1158 case BACKUP_AGENT_CREATED_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 String packageName = data.readString();
1161 IBinder agent = data.readStrongBinder();
1162 backupAgentCreated(packageName, agent);
1163 reply.writeNoException();
1164 return true;
1165 }
1166
1167 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1170 unbindBackupAgent(info);
1171 reply.writeNoException();
1172 return true;
1173 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001174
1175 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1178 data.readStrongBinder());
1179 registerActivityWatcher(watcher);
1180 return true;
1181 }
1182
1183 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1184 data.enforceInterface(IActivityManager.descriptor);
1185 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1186 data.readStrongBinder());
1187 unregisterActivityWatcher(watcher);
1188 return true;
1189 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001190
1191 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1192 {
1193 data.enforceInterface(IActivityManager.descriptor);
1194 int uid = data.readInt();
1195 Intent intent = Intent.CREATOR.createFromParcel(data);
1196 String resolvedType = data.readString();
1197 IBinder resultTo = data.readStrongBinder();
1198 String resultWho = data.readString();
1199 int requestCode = data.readInt();
1200 boolean onlyIfNeeded = data.readInt() != 0;
1201 int result = startActivityInPackage(uid, intent, resolvedType,
1202 resultTo, resultWho, requestCode, onlyIfNeeded);
1203 reply.writeNoException();
1204 reply.writeInt(result);
1205 return true;
1206 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001207
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001208 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 String pkg = data.readString();
1211 int uid = data.readInt();
1212 killApplicationWithUid(pkg, uid);
1213 reply.writeNoException();
1214 return true;
1215 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001216
1217 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1218 data.enforceInterface(IActivityManager.descriptor);
1219 String reason = data.readString();
1220 closeSystemDialogs(reason);
1221 reply.writeNoException();
1222 return true;
1223 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001224
1225 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001227 int[] pids = data.createIntArray();
1228 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001229 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001230 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001231 return true;
1232 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001233
1234 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 String processName = data.readString();
1237 int uid = data.readInt();
1238 killApplicationProcess(processName, uid);
1239 reply.writeNoException();
1240 return true;
1241 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001242
1243 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
1245 IBinder token = data.readStrongBinder();
1246 String packageName = data.readString();
1247 int enterAnim = data.readInt();
1248 int exitAnim = data.readInt();
1249 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001250 reply.writeNoException();
1251 return true;
1252 }
1253
1254 case IS_USER_A_MONKEY_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001256 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001257 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001258 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001259 return true;
1260 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001261
1262 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1263 data.enforceInterface(IActivityManager.descriptor);
1264 finishHeavyWeightApp();
1265 reply.writeNoException();
1266 return true;
1267 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001268
1269 case IS_IMMERSIVE_TRANSACTION: {
1270 data.enforceInterface(IActivityManager.descriptor);
1271 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001272 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001273 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001274 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001275 return true;
1276 }
1277
1278 case SET_IMMERSIVE_TRANSACTION: {
1279 data.enforceInterface(IActivityManager.descriptor);
1280 IBinder token = data.readStrongBinder();
1281 boolean imm = data.readInt() == 1;
1282 setImmersive(token, imm);
1283 reply.writeNoException();
1284 return true;
1285 }
1286
1287 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001289 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001290 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001291 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001292 return true;
1293 }
1294
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001295 case CRASH_APPLICATION_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 int uid = data.readInt();
1298 int initialPid = data.readInt();
1299 String packageName = data.readString();
1300 String message = data.readString();
1301 crashApplication(uid, initialPid, packageName, message);
1302 reply.writeNoException();
1303 return true;
1304 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001305
1306 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 Uri uri = Uri.CREATOR.createFromParcel(data);
1309 String type = getProviderMimeType(uri);
1310 reply.writeNoException();
1311 reply.writeString(type);
1312 return true;
1313 }
1314
Dianne Hackborn7e269642010-08-25 19:50:20 -07001315 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 String name = data.readString();
1318 IBinder perm = newUriPermissionOwner(name);
1319 reply.writeNoException();
1320 reply.writeStrongBinder(perm);
1321 return true;
1322 }
1323
1324 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1325 data.enforceInterface(IActivityManager.descriptor);
1326 IBinder owner = data.readStrongBinder();
1327 int fromUid = data.readInt();
1328 String targetPkg = data.readString();
1329 Uri uri = Uri.CREATOR.createFromParcel(data);
1330 int mode = data.readInt();
1331 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1332 reply.writeNoException();
1333 return true;
1334 }
1335
1336 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 IBinder owner = data.readStrongBinder();
1339 Uri uri = null;
1340 if (data.readInt() != 0) {
1341 Uri.CREATOR.createFromParcel(data);
1342 }
1343 int mode = data.readInt();
1344 revokeUriPermissionFromOwner(owner, uri, mode);
1345 reply.writeNoException();
1346 return true;
1347 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001348
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001349 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 int callingUid = data.readInt();
1352 String targetPkg = data.readString();
1353 Uri uri = Uri.CREATOR.createFromParcel(data);
1354 int modeFlags = data.readInt();
1355 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1356 reply.writeNoException();
1357 reply.writeInt(res);
1358 return true;
1359 }
1360
Andy McFadden824c5102010-07-09 16:26:57 -07001361 case DUMP_HEAP_TRANSACTION: {
1362 data.enforceInterface(IActivityManager.descriptor);
1363 String process = data.readString();
1364 boolean managed = data.readInt() != 0;
1365 String path = data.readString();
1366 ParcelFileDescriptor fd = data.readInt() != 0
1367 ? data.readFileDescriptor() : null;
1368 boolean res = dumpHeap(process, managed, path, fd);
1369 reply.writeNoException();
1370 reply.writeInt(res ? 1 : 0);
1371 return true;
1372 }
1373
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001374 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1375 {
1376 data.enforceInterface(IActivityManager.descriptor);
1377 int uid = data.readInt();
1378 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1379 String[] resolvedTypes = data.createStringArray();
1380 IBinder resultTo = data.readStrongBinder();
1381 int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
1382 reply.writeNoException();
1383 reply.writeInt(result);
1384 return true;
1385 }
1386
1387 case START_ACTIVITIES_TRANSACTION:
1388 {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 IBinder b = data.readStrongBinder();
1391 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1392 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1393 String[] resolvedTypes = data.createStringArray();
1394 IBinder resultTo = data.readStrongBinder();
1395 int result = startActivities(app, intents, resolvedTypes, resultTo);
1396 reply.writeNoException();
1397 reply.writeInt(result);
1398 return true;
1399 }
1400
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001401 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1402 {
1403 data.enforceInterface(IActivityManager.descriptor);
1404 int mode = getFrontActivityScreenCompatMode();
1405 reply.writeNoException();
1406 reply.writeInt(mode);
1407 return true;
1408 }
1409
1410 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1411 {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 int mode = data.readInt();
1414 setFrontActivityScreenCompatMode(mode);
1415 reply.writeNoException();
1416 reply.writeInt(mode);
1417 return true;
1418 }
1419
1420 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1421 {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 String pkg = data.readString();
1424 int mode = getPackageScreenCompatMode(pkg);
1425 reply.writeNoException();
1426 reply.writeInt(mode);
1427 return true;
1428 }
1429
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001430 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1431 {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001434 int mode = data.readInt();
1435 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001436 reply.writeNoException();
1437 return true;
1438 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001439
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001440 case SWITCH_USER_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 int userid = data.readInt();
1443 boolean result = switchUser(userid);
1444 reply.writeNoException();
1445 reply.writeInt(result ? 1 : 0);
1446 return true;
1447 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001448
1449 case REMOVE_SUB_TASK_TRANSACTION:
1450 {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 int taskId = data.readInt();
1453 int subTaskIndex = data.readInt();
1454 boolean result = removeSubTask(taskId, subTaskIndex);
1455 reply.writeNoException();
1456 reply.writeInt(result ? 1 : 0);
1457 return true;
1458 }
1459
1460 case REMOVE_TASK_TRANSACTION:
1461 {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 int taskId = data.readInt();
1464 int fl = data.readInt();
1465 boolean result = removeTask(taskId, fl);
1466 reply.writeNoException();
1467 reply.writeInt(result ? 1 : 0);
1468 return true;
1469 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001470
Jeff Sharkeya4620792011-05-20 15:29:23 -07001471 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1474 data.readStrongBinder());
1475 registerProcessObserver(observer);
1476 return true;
1477 }
1478
1479 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1482 data.readStrongBinder());
1483 unregisterProcessObserver(observer);
1484 return true;
1485 }
1486
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001487 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1488 {
1489 data.enforceInterface(IActivityManager.descriptor);
1490 String pkg = data.readString();
1491 boolean ask = getPackageAskScreenCompat(pkg);
1492 reply.writeNoException();
1493 reply.writeInt(ask ? 1 : 0);
1494 return true;
1495 }
1496
1497 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1498 {
1499 data.enforceInterface(IActivityManager.descriptor);
1500 String pkg = data.readString();
1501 boolean ask = data.readInt() != 0;
1502 setPackageAskScreenCompat(pkg, ask);
1503 reply.writeNoException();
1504 return true;
1505 }
1506
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001507 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 IIntentSender r = IIntentSender.Stub.asInterface(
1510 data.readStrongBinder());
1511 boolean res = isIntentSenderTargetedToPackage(r);
1512 reply.writeNoException();
1513 reply.writeInt(res ? 1 : 0);
1514 return true;
1515 }
1516
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001517 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001518
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001519 return super.onTransact(code, data, reply, flags);
1520 }
1521
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001522 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001523 return this;
1524 }
1525
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001526 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1527 protected IActivityManager create() {
1528 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001529 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001530 Log.v("ActivityManager", "default service binder = " + b);
1531 }
1532 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001533 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001534 Log.v("ActivityManager", "default service = " + am);
1535 }
1536 return am;
1537 }
1538 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001539}
1540
1541class ActivityManagerProxy implements IActivityManager
1542{
1543 public ActivityManagerProxy(IBinder remote)
1544 {
1545 mRemote = remote;
1546 }
1547
1548 public IBinder asBinder()
1549 {
1550 return mRemote;
1551 }
1552
1553 public int startActivity(IApplicationThread caller, Intent intent,
1554 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1555 IBinder resultTo, String resultWho,
1556 int requestCode, boolean onlyIfNeeded,
1557 boolean debug) throws RemoteException {
1558 Parcel data = Parcel.obtain();
1559 Parcel reply = Parcel.obtain();
1560 data.writeInterfaceToken(IActivityManager.descriptor);
1561 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1562 intent.writeToParcel(data, 0);
1563 data.writeString(resolvedType);
1564 data.writeTypedArray(grantedUriPermissions, 0);
1565 data.writeInt(grantedMode);
1566 data.writeStrongBinder(resultTo);
1567 data.writeString(resultWho);
1568 data.writeInt(requestCode);
1569 data.writeInt(onlyIfNeeded ? 1 : 0);
1570 data.writeInt(debug ? 1 : 0);
1571 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1572 reply.readException();
1573 int result = reply.readInt();
1574 reply.recycle();
1575 data.recycle();
1576 return result;
1577 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001578 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1579 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1580 IBinder resultTo, String resultWho,
1581 int requestCode, boolean onlyIfNeeded,
1582 boolean debug) throws RemoteException {
1583 Parcel data = Parcel.obtain();
1584 Parcel reply = Parcel.obtain();
1585 data.writeInterfaceToken(IActivityManager.descriptor);
1586 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1587 intent.writeToParcel(data, 0);
1588 data.writeString(resolvedType);
1589 data.writeTypedArray(grantedUriPermissions, 0);
1590 data.writeInt(grantedMode);
1591 data.writeStrongBinder(resultTo);
1592 data.writeString(resultWho);
1593 data.writeInt(requestCode);
1594 data.writeInt(onlyIfNeeded ? 1 : 0);
1595 data.writeInt(debug ? 1 : 0);
1596 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1597 reply.readException();
1598 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1599 reply.recycle();
1600 data.recycle();
1601 return result;
1602 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001603 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1604 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1605 IBinder resultTo, String resultWho,
1606 int requestCode, boolean onlyIfNeeded,
1607 boolean debug, Configuration config) throws RemoteException {
1608 Parcel data = Parcel.obtain();
1609 Parcel reply = Parcel.obtain();
1610 data.writeInterfaceToken(IActivityManager.descriptor);
1611 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1612 intent.writeToParcel(data, 0);
1613 data.writeString(resolvedType);
1614 data.writeTypedArray(grantedUriPermissions, 0);
1615 data.writeInt(grantedMode);
1616 data.writeStrongBinder(resultTo);
1617 data.writeString(resultWho);
1618 data.writeInt(requestCode);
1619 data.writeInt(onlyIfNeeded ? 1 : 0);
1620 data.writeInt(debug ? 1 : 0);
1621 config.writeToParcel(data, 0);
1622 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1623 reply.readException();
1624 int result = reply.readInt();
1625 reply.recycle();
1626 data.recycle();
1627 return result;
1628 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001629 public int startActivityIntentSender(IApplicationThread caller,
1630 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001631 IBinder resultTo, String resultWho, int requestCode,
1632 int flagsMask, int flagsValues) throws RemoteException {
1633 Parcel data = Parcel.obtain();
1634 Parcel reply = Parcel.obtain();
1635 data.writeInterfaceToken(IActivityManager.descriptor);
1636 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1637 intent.writeToParcel(data, 0);
1638 if (fillInIntent != null) {
1639 data.writeInt(1);
1640 fillInIntent.writeToParcel(data, 0);
1641 } else {
1642 data.writeInt(0);
1643 }
1644 data.writeString(resolvedType);
1645 data.writeStrongBinder(resultTo);
1646 data.writeString(resultWho);
1647 data.writeInt(requestCode);
1648 data.writeInt(flagsMask);
1649 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001650 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001651 reply.readException();
1652 int result = reply.readInt();
1653 reply.recycle();
1654 data.recycle();
1655 return result;
1656 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001657 public boolean startNextMatchingActivity(IBinder callingActivity,
1658 Intent intent) throws RemoteException {
1659 Parcel data = Parcel.obtain();
1660 Parcel reply = Parcel.obtain();
1661 data.writeInterfaceToken(IActivityManager.descriptor);
1662 data.writeStrongBinder(callingActivity);
1663 intent.writeToParcel(data, 0);
1664 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1665 reply.readException();
1666 int result = reply.readInt();
1667 reply.recycle();
1668 data.recycle();
1669 return result != 0;
1670 }
1671 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1672 throws RemoteException {
1673 Parcel data = Parcel.obtain();
1674 Parcel reply = Parcel.obtain();
1675 data.writeInterfaceToken(IActivityManager.descriptor);
1676 data.writeStrongBinder(token);
1677 data.writeInt(resultCode);
1678 if (resultData != null) {
1679 data.writeInt(1);
1680 resultData.writeToParcel(data, 0);
1681 } else {
1682 data.writeInt(0);
1683 }
1684 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1685 reply.readException();
1686 boolean res = reply.readInt() != 0;
1687 data.recycle();
1688 reply.recycle();
1689 return res;
1690 }
1691 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1692 {
1693 Parcel data = Parcel.obtain();
1694 Parcel reply = Parcel.obtain();
1695 data.writeInterfaceToken(IActivityManager.descriptor);
1696 data.writeStrongBinder(token);
1697 data.writeString(resultWho);
1698 data.writeInt(requestCode);
1699 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1700 reply.readException();
1701 data.recycle();
1702 reply.recycle();
1703 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001704 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1705 Parcel data = Parcel.obtain();
1706 Parcel reply = Parcel.obtain();
1707 data.writeInterfaceToken(IActivityManager.descriptor);
1708 data.writeStrongBinder(token);
1709 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1710 reply.readException();
1711 boolean res = reply.readInt() != 0;
1712 data.recycle();
1713 reply.recycle();
1714 return res;
1715 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001716 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001717 IIntentReceiver receiver,
1718 IntentFilter filter, String perm) throws RemoteException
1719 {
1720 Parcel data = Parcel.obtain();
1721 Parcel reply = Parcel.obtain();
1722 data.writeInterfaceToken(IActivityManager.descriptor);
1723 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001724 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001725 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1726 filter.writeToParcel(data, 0);
1727 data.writeString(perm);
1728 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1729 reply.readException();
1730 Intent intent = null;
1731 int haveIntent = reply.readInt();
1732 if (haveIntent != 0) {
1733 intent = Intent.CREATOR.createFromParcel(reply);
1734 }
1735 reply.recycle();
1736 data.recycle();
1737 return intent;
1738 }
1739 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1740 {
1741 Parcel data = Parcel.obtain();
1742 Parcel reply = Parcel.obtain();
1743 data.writeInterfaceToken(IActivityManager.descriptor);
1744 data.writeStrongBinder(receiver.asBinder());
1745 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1746 reply.readException();
1747 data.recycle();
1748 reply.recycle();
1749 }
1750 public int broadcastIntent(IApplicationThread caller,
1751 Intent intent, String resolvedType, IIntentReceiver resultTo,
1752 int resultCode, String resultData, Bundle map,
1753 String requiredPermission, boolean serialized,
1754 boolean sticky) throws RemoteException
1755 {
1756 Parcel data = Parcel.obtain();
1757 Parcel reply = Parcel.obtain();
1758 data.writeInterfaceToken(IActivityManager.descriptor);
1759 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1760 intent.writeToParcel(data, 0);
1761 data.writeString(resolvedType);
1762 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1763 data.writeInt(resultCode);
1764 data.writeString(resultData);
1765 data.writeBundle(map);
1766 data.writeString(requiredPermission);
1767 data.writeInt(serialized ? 1 : 0);
1768 data.writeInt(sticky ? 1 : 0);
1769 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1770 reply.readException();
1771 int res = reply.readInt();
1772 reply.recycle();
1773 data.recycle();
1774 return res;
1775 }
1776 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1777 {
1778 Parcel data = Parcel.obtain();
1779 Parcel reply = Parcel.obtain();
1780 data.writeInterfaceToken(IActivityManager.descriptor);
1781 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1782 intent.writeToParcel(data, 0);
1783 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1784 reply.readException();
1785 data.recycle();
1786 reply.recycle();
1787 }
1788 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1789 {
1790 Parcel data = Parcel.obtain();
1791 Parcel reply = Parcel.obtain();
1792 data.writeInterfaceToken(IActivityManager.descriptor);
1793 data.writeStrongBinder(who);
1794 data.writeInt(resultCode);
1795 data.writeString(resultData);
1796 data.writeBundle(map);
1797 data.writeInt(abortBroadcast ? 1 : 0);
1798 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1799 reply.readException();
1800 data.recycle();
1801 reply.recycle();
1802 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001803 public void attachApplication(IApplicationThread app) throws RemoteException
1804 {
1805 Parcel data = Parcel.obtain();
1806 Parcel reply = Parcel.obtain();
1807 data.writeInterfaceToken(IActivityManager.descriptor);
1808 data.writeStrongBinder(app.asBinder());
1809 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1810 reply.readException();
1811 data.recycle();
1812 reply.recycle();
1813 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001814 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001815 {
1816 Parcel data = Parcel.obtain();
1817 Parcel reply = Parcel.obtain();
1818 data.writeInterfaceToken(IActivityManager.descriptor);
1819 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001820 if (config != null) {
1821 data.writeInt(1);
1822 config.writeToParcel(data, 0);
1823 } else {
1824 data.writeInt(0);
1825 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001826 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1827 reply.readException();
1828 data.recycle();
1829 reply.recycle();
1830 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001831 public void activityPaused(IBinder token) throws RemoteException
1832 {
1833 Parcel data = Parcel.obtain();
1834 Parcel reply = Parcel.obtain();
1835 data.writeInterfaceToken(IActivityManager.descriptor);
1836 data.writeStrongBinder(token);
1837 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1838 reply.readException();
1839 data.recycle();
1840 reply.recycle();
1841 }
1842 public void activityStopped(IBinder token, Bundle state,
1843 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001844 {
1845 Parcel data = Parcel.obtain();
1846 Parcel reply = Parcel.obtain();
1847 data.writeInterfaceToken(IActivityManager.descriptor);
1848 data.writeStrongBinder(token);
1849 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001850 if (thumbnail != null) {
1851 data.writeInt(1);
1852 thumbnail.writeToParcel(data, 0);
1853 } else {
1854 data.writeInt(0);
1855 }
1856 TextUtils.writeToParcel(description, data, 0);
1857 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1858 reply.readException();
1859 data.recycle();
1860 reply.recycle();
1861 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001862 public void activitySlept(IBinder token) throws RemoteException
1863 {
1864 Parcel data = Parcel.obtain();
1865 Parcel reply = Parcel.obtain();
1866 data.writeInterfaceToken(IActivityManager.descriptor);
1867 data.writeStrongBinder(token);
1868 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1869 reply.readException();
1870 data.recycle();
1871 reply.recycle();
1872 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001873 public void activityDestroyed(IBinder token) throws RemoteException
1874 {
1875 Parcel data = Parcel.obtain();
1876 Parcel reply = Parcel.obtain();
1877 data.writeInterfaceToken(IActivityManager.descriptor);
1878 data.writeStrongBinder(token);
1879 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1880 reply.readException();
1881 data.recycle();
1882 reply.recycle();
1883 }
1884 public String getCallingPackage(IBinder token) throws RemoteException
1885 {
1886 Parcel data = Parcel.obtain();
1887 Parcel reply = Parcel.obtain();
1888 data.writeInterfaceToken(IActivityManager.descriptor);
1889 data.writeStrongBinder(token);
1890 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1891 reply.readException();
1892 String res = reply.readString();
1893 data.recycle();
1894 reply.recycle();
1895 return res;
1896 }
1897 public ComponentName getCallingActivity(IBinder token)
1898 throws RemoteException {
1899 Parcel data = Parcel.obtain();
1900 Parcel reply = Parcel.obtain();
1901 data.writeInterfaceToken(IActivityManager.descriptor);
1902 data.writeStrongBinder(token);
1903 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1904 reply.readException();
1905 ComponentName res = ComponentName.readFromParcel(reply);
1906 data.recycle();
1907 reply.recycle();
1908 return res;
1909 }
1910 public List getTasks(int maxNum, int flags,
1911 IThumbnailReceiver receiver) throws RemoteException {
1912 Parcel data = Parcel.obtain();
1913 Parcel reply = Parcel.obtain();
1914 data.writeInterfaceToken(IActivityManager.descriptor);
1915 data.writeInt(maxNum);
1916 data.writeInt(flags);
1917 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1918 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1919 reply.readException();
1920 ArrayList list = null;
1921 int N = reply.readInt();
1922 if (N >= 0) {
1923 list = new ArrayList();
1924 while (N > 0) {
1925 ActivityManager.RunningTaskInfo info =
1926 ActivityManager.RunningTaskInfo.CREATOR
1927 .createFromParcel(reply);
1928 list.add(info);
1929 N--;
1930 }
1931 }
1932 data.recycle();
1933 reply.recycle();
1934 return list;
1935 }
1936 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1937 int flags) throws RemoteException {
1938 Parcel data = Parcel.obtain();
1939 Parcel reply = Parcel.obtain();
1940 data.writeInterfaceToken(IActivityManager.descriptor);
1941 data.writeInt(maxNum);
1942 data.writeInt(flags);
1943 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1944 reply.readException();
1945 ArrayList<ActivityManager.RecentTaskInfo> list
1946 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1947 data.recycle();
1948 reply.recycle();
1949 return list;
1950 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001951 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08001952 Parcel data = Parcel.obtain();
1953 Parcel reply = Parcel.obtain();
1954 data.writeInterfaceToken(IActivityManager.descriptor);
1955 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001956 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08001957 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001958 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08001959 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001960 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08001961 }
1962 data.recycle();
1963 reply.recycle();
1964 return bm;
1965 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001966 public List getServices(int maxNum, int flags) throws RemoteException {
1967 Parcel data = Parcel.obtain();
1968 Parcel reply = Parcel.obtain();
1969 data.writeInterfaceToken(IActivityManager.descriptor);
1970 data.writeInt(maxNum);
1971 data.writeInt(flags);
1972 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
1973 reply.readException();
1974 ArrayList list = null;
1975 int N = reply.readInt();
1976 if (N >= 0) {
1977 list = new ArrayList();
1978 while (N > 0) {
1979 ActivityManager.RunningServiceInfo info =
1980 ActivityManager.RunningServiceInfo.CREATOR
1981 .createFromParcel(reply);
1982 list.add(info);
1983 N--;
1984 }
1985 }
1986 data.recycle();
1987 reply.recycle();
1988 return list;
1989 }
1990 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1991 throws RemoteException {
1992 Parcel data = Parcel.obtain();
1993 Parcel reply = Parcel.obtain();
1994 data.writeInterfaceToken(IActivityManager.descriptor);
1995 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1996 reply.readException();
1997 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1998 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1999 data.recycle();
2000 reply.recycle();
2001 return list;
2002 }
2003 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2004 throws RemoteException {
2005 Parcel data = Parcel.obtain();
2006 Parcel reply = Parcel.obtain();
2007 data.writeInterfaceToken(IActivityManager.descriptor);
2008 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2009 reply.readException();
2010 ArrayList<ActivityManager.RunningAppProcessInfo> list
2011 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2012 data.recycle();
2013 reply.recycle();
2014 return list;
2015 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002016 public List<ApplicationInfo> getRunningExternalApplications()
2017 throws RemoteException {
2018 Parcel data = Parcel.obtain();
2019 Parcel reply = Parcel.obtain();
2020 data.writeInterfaceToken(IActivityManager.descriptor);
2021 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2022 reply.readException();
2023 ArrayList<ApplicationInfo> list
2024 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2025 data.recycle();
2026 reply.recycle();
2027 return list;
2028 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002029 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002030 {
2031 Parcel data = Parcel.obtain();
2032 Parcel reply = Parcel.obtain();
2033 data.writeInterfaceToken(IActivityManager.descriptor);
2034 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002035 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002036 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2037 reply.readException();
2038 data.recycle();
2039 reply.recycle();
2040 }
2041 public void moveTaskToBack(int task) throws RemoteException
2042 {
2043 Parcel data = Parcel.obtain();
2044 Parcel reply = Parcel.obtain();
2045 data.writeInterfaceToken(IActivityManager.descriptor);
2046 data.writeInt(task);
2047 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2048 reply.readException();
2049 data.recycle();
2050 reply.recycle();
2051 }
2052 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2053 throws RemoteException {
2054 Parcel data = Parcel.obtain();
2055 Parcel reply = Parcel.obtain();
2056 data.writeInterfaceToken(IActivityManager.descriptor);
2057 data.writeStrongBinder(token);
2058 data.writeInt(nonRoot ? 1 : 0);
2059 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2060 reply.readException();
2061 boolean res = reply.readInt() != 0;
2062 data.recycle();
2063 reply.recycle();
2064 return res;
2065 }
2066 public void moveTaskBackwards(int task) throws RemoteException
2067 {
2068 Parcel data = Parcel.obtain();
2069 Parcel reply = Parcel.obtain();
2070 data.writeInterfaceToken(IActivityManager.descriptor);
2071 data.writeInt(task);
2072 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2073 reply.readException();
2074 data.recycle();
2075 reply.recycle();
2076 }
2077 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2078 {
2079 Parcel data = Parcel.obtain();
2080 Parcel reply = Parcel.obtain();
2081 data.writeInterfaceToken(IActivityManager.descriptor);
2082 data.writeStrongBinder(token);
2083 data.writeInt(onlyRoot ? 1 : 0);
2084 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2085 reply.readException();
2086 int res = reply.readInt();
2087 data.recycle();
2088 reply.recycle();
2089 return res;
2090 }
2091 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
2092 {
2093 Parcel data = Parcel.obtain();
2094 Parcel reply = Parcel.obtain();
2095 data.writeInterfaceToken(IActivityManager.descriptor);
2096 data.writeStrongBinder(token);
2097 ComponentName.writeToParcel(className, data);
2098 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
2099 reply.readException();
2100 data.recycle();
2101 reply.recycle();
2102 }
2103 public void reportThumbnail(IBinder token,
2104 Bitmap thumbnail, CharSequence description) throws RemoteException
2105 {
2106 Parcel data = Parcel.obtain();
2107 Parcel reply = Parcel.obtain();
2108 data.writeInterfaceToken(IActivityManager.descriptor);
2109 data.writeStrongBinder(token);
2110 if (thumbnail != null) {
2111 data.writeInt(1);
2112 thumbnail.writeToParcel(data, 0);
2113 } else {
2114 data.writeInt(0);
2115 }
2116 TextUtils.writeToParcel(description, data, 0);
2117 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2118 reply.readException();
2119 data.recycle();
2120 reply.recycle();
2121 }
2122 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2123 String name) throws RemoteException
2124 {
2125 Parcel data = Parcel.obtain();
2126 Parcel reply = Parcel.obtain();
2127 data.writeInterfaceToken(IActivityManager.descriptor);
2128 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2129 data.writeString(name);
2130 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2131 reply.readException();
2132 int res = reply.readInt();
2133 ContentProviderHolder cph = null;
2134 if (res != 0) {
2135 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2136 }
2137 data.recycle();
2138 reply.recycle();
2139 return cph;
2140 }
2141 public void publishContentProviders(IApplicationThread caller,
2142 List<ContentProviderHolder> providers) throws RemoteException
2143 {
2144 Parcel data = Parcel.obtain();
2145 Parcel reply = Parcel.obtain();
2146 data.writeInterfaceToken(IActivityManager.descriptor);
2147 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2148 data.writeTypedList(providers);
2149 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2150 reply.readException();
2151 data.recycle();
2152 reply.recycle();
2153 }
2154
2155 public void removeContentProvider(IApplicationThread caller,
2156 String name) throws RemoteException {
2157 Parcel data = Parcel.obtain();
2158 Parcel reply = Parcel.obtain();
2159 data.writeInterfaceToken(IActivityManager.descriptor);
2160 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2161 data.writeString(name);
2162 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2163 reply.readException();
2164 data.recycle();
2165 reply.recycle();
2166 }
2167
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002168 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2169 throws RemoteException
2170 {
2171 Parcel data = Parcel.obtain();
2172 Parcel reply = Parcel.obtain();
2173 data.writeInterfaceToken(IActivityManager.descriptor);
2174 service.writeToParcel(data, 0);
2175 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2176 reply.readException();
2177 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2178 data.recycle();
2179 reply.recycle();
2180 return res;
2181 }
2182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002183 public ComponentName startService(IApplicationThread caller, Intent service,
2184 String resolvedType) throws RemoteException
2185 {
2186 Parcel data = Parcel.obtain();
2187 Parcel reply = Parcel.obtain();
2188 data.writeInterfaceToken(IActivityManager.descriptor);
2189 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2190 service.writeToParcel(data, 0);
2191 data.writeString(resolvedType);
2192 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2193 reply.readException();
2194 ComponentName res = ComponentName.readFromParcel(reply);
2195 data.recycle();
2196 reply.recycle();
2197 return res;
2198 }
2199 public int stopService(IApplicationThread caller, Intent service,
2200 String resolvedType) throws RemoteException
2201 {
2202 Parcel data = Parcel.obtain();
2203 Parcel reply = Parcel.obtain();
2204 data.writeInterfaceToken(IActivityManager.descriptor);
2205 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2206 service.writeToParcel(data, 0);
2207 data.writeString(resolvedType);
2208 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2209 reply.readException();
2210 int res = reply.readInt();
2211 reply.recycle();
2212 data.recycle();
2213 return res;
2214 }
2215 public boolean stopServiceToken(ComponentName className, IBinder token,
2216 int startId) throws RemoteException {
2217 Parcel data = Parcel.obtain();
2218 Parcel reply = Parcel.obtain();
2219 data.writeInterfaceToken(IActivityManager.descriptor);
2220 ComponentName.writeToParcel(className, data);
2221 data.writeStrongBinder(token);
2222 data.writeInt(startId);
2223 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2224 reply.readException();
2225 boolean res = reply.readInt() != 0;
2226 data.recycle();
2227 reply.recycle();
2228 return res;
2229 }
2230 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002231 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002232 Parcel data = Parcel.obtain();
2233 Parcel reply = Parcel.obtain();
2234 data.writeInterfaceToken(IActivityManager.descriptor);
2235 ComponentName.writeToParcel(className, data);
2236 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002237 data.writeInt(id);
2238 if (notification != null) {
2239 data.writeInt(1);
2240 notification.writeToParcel(data, 0);
2241 } else {
2242 data.writeInt(0);
2243 }
2244 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002245 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2246 reply.readException();
2247 data.recycle();
2248 reply.recycle();
2249 }
2250 public int bindService(IApplicationThread caller, IBinder token,
2251 Intent service, String resolvedType, IServiceConnection connection,
2252 int flags) throws RemoteException {
2253 Parcel data = Parcel.obtain();
2254 Parcel reply = Parcel.obtain();
2255 data.writeInterfaceToken(IActivityManager.descriptor);
2256 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2257 data.writeStrongBinder(token);
2258 service.writeToParcel(data, 0);
2259 data.writeString(resolvedType);
2260 data.writeStrongBinder(connection.asBinder());
2261 data.writeInt(flags);
2262 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2263 reply.readException();
2264 int res = reply.readInt();
2265 data.recycle();
2266 reply.recycle();
2267 return res;
2268 }
2269 public boolean unbindService(IServiceConnection connection) throws RemoteException
2270 {
2271 Parcel data = Parcel.obtain();
2272 Parcel reply = Parcel.obtain();
2273 data.writeInterfaceToken(IActivityManager.descriptor);
2274 data.writeStrongBinder(connection.asBinder());
2275 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2276 reply.readException();
2277 boolean res = reply.readInt() != 0;
2278 data.recycle();
2279 reply.recycle();
2280 return res;
2281 }
2282
2283 public void publishService(IBinder token,
2284 Intent intent, IBinder service) throws RemoteException {
2285 Parcel data = Parcel.obtain();
2286 Parcel reply = Parcel.obtain();
2287 data.writeInterfaceToken(IActivityManager.descriptor);
2288 data.writeStrongBinder(token);
2289 intent.writeToParcel(data, 0);
2290 data.writeStrongBinder(service);
2291 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2292 reply.readException();
2293 data.recycle();
2294 reply.recycle();
2295 }
2296
2297 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2298 throws RemoteException {
2299 Parcel data = Parcel.obtain();
2300 Parcel reply = Parcel.obtain();
2301 data.writeInterfaceToken(IActivityManager.descriptor);
2302 data.writeStrongBinder(token);
2303 intent.writeToParcel(data, 0);
2304 data.writeInt(doRebind ? 1 : 0);
2305 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2306 reply.readException();
2307 data.recycle();
2308 reply.recycle();
2309 }
2310
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002311 public void serviceDoneExecuting(IBinder token, int type, int startId,
2312 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002313 Parcel data = Parcel.obtain();
2314 Parcel reply = Parcel.obtain();
2315 data.writeInterfaceToken(IActivityManager.descriptor);
2316 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002317 data.writeInt(type);
2318 data.writeInt(startId);
2319 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002320 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2321 reply.readException();
2322 data.recycle();
2323 reply.recycle();
2324 }
2325
2326 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 service.writeToParcel(data, 0);
2331 data.writeString(resolvedType);
2332 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 IBinder binder = reply.readStrongBinder();
2335 reply.recycle();
2336 data.recycle();
2337 return binder;
2338 }
2339
Christopher Tate181fafa2009-05-14 11:12:14 -07002340 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2341 throws RemoteException {
2342 Parcel data = Parcel.obtain();
2343 Parcel reply = Parcel.obtain();
2344 data.writeInterfaceToken(IActivityManager.descriptor);
2345 app.writeToParcel(data, 0);
2346 data.writeInt(backupRestoreMode);
2347 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2348 reply.readException();
2349 boolean success = reply.readInt() != 0;
2350 reply.recycle();
2351 data.recycle();
2352 return success;
2353 }
2354
2355 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2356 Parcel data = Parcel.obtain();
2357 Parcel reply = Parcel.obtain();
2358 data.writeInterfaceToken(IActivityManager.descriptor);
2359 data.writeString(packageName);
2360 data.writeStrongBinder(agent);
2361 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2362 reply.recycle();
2363 data.recycle();
2364 }
2365
2366 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2367 Parcel data = Parcel.obtain();
2368 Parcel reply = Parcel.obtain();
2369 data.writeInterfaceToken(IActivityManager.descriptor);
2370 app.writeToParcel(data, 0);
2371 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2372 reply.readException();
2373 reply.recycle();
2374 data.recycle();
2375 }
2376
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 public boolean startInstrumentation(ComponentName className, String profileFile,
2378 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2379 throws RemoteException {
2380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 ComponentName.writeToParcel(className, data);
2384 data.writeString(profileFile);
2385 data.writeInt(flags);
2386 data.writeBundle(arguments);
2387 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2388 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2389 reply.readException();
2390 boolean res = reply.readInt() != 0;
2391 reply.recycle();
2392 data.recycle();
2393 return res;
2394 }
2395
2396 public void finishInstrumentation(IApplicationThread target,
2397 int resultCode, Bundle results) throws RemoteException {
2398 Parcel data = Parcel.obtain();
2399 Parcel reply = Parcel.obtain();
2400 data.writeInterfaceToken(IActivityManager.descriptor);
2401 data.writeStrongBinder(target != null ? target.asBinder() : null);
2402 data.writeInt(resultCode);
2403 data.writeBundle(results);
2404 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2405 reply.readException();
2406 data.recycle();
2407 reply.recycle();
2408 }
2409 public Configuration getConfiguration() throws RemoteException
2410 {
2411 Parcel data = Parcel.obtain();
2412 Parcel reply = Parcel.obtain();
2413 data.writeInterfaceToken(IActivityManager.descriptor);
2414 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2415 reply.readException();
2416 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2417 reply.recycle();
2418 data.recycle();
2419 return res;
2420 }
2421 public void updateConfiguration(Configuration values) throws RemoteException
2422 {
2423 Parcel data = Parcel.obtain();
2424 Parcel reply = Parcel.obtain();
2425 data.writeInterfaceToken(IActivityManager.descriptor);
2426 values.writeToParcel(data, 0);
2427 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2428 reply.readException();
2429 data.recycle();
2430 reply.recycle();
2431 }
2432 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2433 throws RemoteException {
2434 Parcel data = Parcel.obtain();
2435 Parcel reply = Parcel.obtain();
2436 data.writeInterfaceToken(IActivityManager.descriptor);
2437 data.writeStrongBinder(token);
2438 data.writeInt(requestedOrientation);
2439 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2440 reply.readException();
2441 data.recycle();
2442 reply.recycle();
2443 }
2444 public int getRequestedOrientation(IBinder token) throws RemoteException {
2445 Parcel data = Parcel.obtain();
2446 Parcel reply = Parcel.obtain();
2447 data.writeInterfaceToken(IActivityManager.descriptor);
2448 data.writeStrongBinder(token);
2449 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2450 reply.readException();
2451 int res = reply.readInt();
2452 data.recycle();
2453 reply.recycle();
2454 return res;
2455 }
2456 public ComponentName getActivityClassForToken(IBinder token)
2457 throws RemoteException {
2458 Parcel data = Parcel.obtain();
2459 Parcel reply = Parcel.obtain();
2460 data.writeInterfaceToken(IActivityManager.descriptor);
2461 data.writeStrongBinder(token);
2462 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2463 reply.readException();
2464 ComponentName res = ComponentName.readFromParcel(reply);
2465 data.recycle();
2466 reply.recycle();
2467 return res;
2468 }
2469 public String getPackageForToken(IBinder token) throws RemoteException
2470 {
2471 Parcel data = Parcel.obtain();
2472 Parcel reply = Parcel.obtain();
2473 data.writeInterfaceToken(IActivityManager.descriptor);
2474 data.writeStrongBinder(token);
2475 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2476 reply.readException();
2477 String res = reply.readString();
2478 data.recycle();
2479 reply.recycle();
2480 return res;
2481 }
2482 public IIntentSender getIntentSender(int type,
2483 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002484 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002485 throws RemoteException {
2486 Parcel data = Parcel.obtain();
2487 Parcel reply = Parcel.obtain();
2488 data.writeInterfaceToken(IActivityManager.descriptor);
2489 data.writeInt(type);
2490 data.writeString(packageName);
2491 data.writeStrongBinder(token);
2492 data.writeString(resultWho);
2493 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002494 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002495 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002496 data.writeTypedArray(intents, 0);
2497 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002498 } else {
2499 data.writeInt(0);
2500 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 data.writeInt(flags);
2502 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2503 reply.readException();
2504 IIntentSender res = IIntentSender.Stub.asInterface(
2505 reply.readStrongBinder());
2506 data.recycle();
2507 reply.recycle();
2508 return res;
2509 }
2510 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(sender.asBinder());
2515 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2516 reply.readException();
2517 data.recycle();
2518 reply.recycle();
2519 }
2520 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2521 Parcel data = Parcel.obtain();
2522 Parcel reply = Parcel.obtain();
2523 data.writeInterfaceToken(IActivityManager.descriptor);
2524 data.writeStrongBinder(sender.asBinder());
2525 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2526 reply.readException();
2527 String res = reply.readString();
2528 data.recycle();
2529 reply.recycle();
2530 return res;
2531 }
2532 public void setProcessLimit(int max) throws RemoteException
2533 {
2534 Parcel data = Parcel.obtain();
2535 Parcel reply = Parcel.obtain();
2536 data.writeInterfaceToken(IActivityManager.descriptor);
2537 data.writeInt(max);
2538 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2539 reply.readException();
2540 data.recycle();
2541 reply.recycle();
2542 }
2543 public int getProcessLimit() throws RemoteException
2544 {
2545 Parcel data = Parcel.obtain();
2546 Parcel reply = Parcel.obtain();
2547 data.writeInterfaceToken(IActivityManager.descriptor);
2548 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2549 reply.readException();
2550 int res = reply.readInt();
2551 data.recycle();
2552 reply.recycle();
2553 return res;
2554 }
2555 public void setProcessForeground(IBinder token, int pid,
2556 boolean isForeground) throws RemoteException {
2557 Parcel data = Parcel.obtain();
2558 Parcel reply = Parcel.obtain();
2559 data.writeInterfaceToken(IActivityManager.descriptor);
2560 data.writeStrongBinder(token);
2561 data.writeInt(pid);
2562 data.writeInt(isForeground ? 1 : 0);
2563 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 data.recycle();
2566 reply.recycle();
2567 }
2568 public int checkPermission(String permission, int pid, int uid)
2569 throws RemoteException {
2570 Parcel data = Parcel.obtain();
2571 Parcel reply = Parcel.obtain();
2572 data.writeInterfaceToken(IActivityManager.descriptor);
2573 data.writeString(permission);
2574 data.writeInt(pid);
2575 data.writeInt(uid);
2576 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2577 reply.readException();
2578 int res = reply.readInt();
2579 data.recycle();
2580 reply.recycle();
2581 return res;
2582 }
2583 public boolean clearApplicationUserData(final String packageName,
2584 final IPackageDataObserver observer) throws RemoteException {
2585 Parcel data = Parcel.obtain();
2586 Parcel reply = Parcel.obtain();
2587 data.writeInterfaceToken(IActivityManager.descriptor);
2588 data.writeString(packageName);
2589 data.writeStrongBinder(observer.asBinder());
2590 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2591 reply.readException();
2592 boolean res = reply.readInt() != 0;
2593 data.recycle();
2594 reply.recycle();
2595 return res;
2596 }
2597 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2598 throws RemoteException {
2599 Parcel data = Parcel.obtain();
2600 Parcel reply = Parcel.obtain();
2601 data.writeInterfaceToken(IActivityManager.descriptor);
2602 uri.writeToParcel(data, 0);
2603 data.writeInt(pid);
2604 data.writeInt(uid);
2605 data.writeInt(mode);
2606 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2607 reply.readException();
2608 int res = reply.readInt();
2609 data.recycle();
2610 reply.recycle();
2611 return res;
2612 }
2613 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2614 Uri uri, int mode) throws RemoteException {
2615 Parcel data = Parcel.obtain();
2616 Parcel reply = Parcel.obtain();
2617 data.writeInterfaceToken(IActivityManager.descriptor);
2618 data.writeStrongBinder(caller.asBinder());
2619 data.writeString(targetPkg);
2620 uri.writeToParcel(data, 0);
2621 data.writeInt(mode);
2622 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 data.recycle();
2625 reply.recycle();
2626 }
2627 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2628 int mode) throws RemoteException {
2629 Parcel data = Parcel.obtain();
2630 Parcel reply = Parcel.obtain();
2631 data.writeInterfaceToken(IActivityManager.descriptor);
2632 data.writeStrongBinder(caller.asBinder());
2633 uri.writeToParcel(data, 0);
2634 data.writeInt(mode);
2635 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2636 reply.readException();
2637 data.recycle();
2638 reply.recycle();
2639 }
2640 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2641 throws RemoteException {
2642 Parcel data = Parcel.obtain();
2643 Parcel reply = Parcel.obtain();
2644 data.writeInterfaceToken(IActivityManager.descriptor);
2645 data.writeStrongBinder(who.asBinder());
2646 data.writeInt(waiting ? 1 : 0);
2647 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2648 reply.readException();
2649 data.recycle();
2650 reply.recycle();
2651 }
2652 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2653 Parcel data = Parcel.obtain();
2654 Parcel reply = Parcel.obtain();
2655 data.writeInterfaceToken(IActivityManager.descriptor);
2656 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2657 reply.readException();
2658 outInfo.readFromParcel(reply);
2659 data.recycle();
2660 reply.recycle();
2661 }
2662 public void unhandledBack() throws RemoteException
2663 {
2664 Parcel data = Parcel.obtain();
2665 Parcel reply = Parcel.obtain();
2666 data.writeInterfaceToken(IActivityManager.descriptor);
2667 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2668 reply.readException();
2669 data.recycle();
2670 reply.recycle();
2671 }
2672 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2673 {
2674 Parcel data = Parcel.obtain();
2675 Parcel reply = Parcel.obtain();
2676 data.writeInterfaceToken(IActivityManager.descriptor);
2677 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2678 reply.readException();
2679 ParcelFileDescriptor pfd = null;
2680 if (reply.readInt() != 0) {
2681 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2682 }
2683 data.recycle();
2684 reply.recycle();
2685 return pfd;
2686 }
2687 public void goingToSleep() throws RemoteException
2688 {
2689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 data.recycle();
2695 reply.recycle();
2696 }
2697 public void wakingUp() throws RemoteException
2698 {
2699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2703 reply.readException();
2704 data.recycle();
2705 reply.recycle();
2706 }
2707 public void setDebugApp(
2708 String packageName, boolean waitForDebugger, boolean persistent)
2709 throws RemoteException
2710 {
2711 Parcel data = Parcel.obtain();
2712 Parcel reply = Parcel.obtain();
2713 data.writeInterfaceToken(IActivityManager.descriptor);
2714 data.writeString(packageName);
2715 data.writeInt(waitForDebugger ? 1 : 0);
2716 data.writeInt(persistent ? 1 : 0);
2717 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 data.recycle();
2720 reply.recycle();
2721 }
2722 public void setAlwaysFinish(boolean enabled) throws RemoteException
2723 {
2724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 data.writeInt(enabled ? 1 : 0);
2728 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 data.recycle();
2731 reply.recycle();
2732 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002733 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002734 {
2735 Parcel data = Parcel.obtain();
2736 Parcel reply = Parcel.obtain();
2737 data.writeInterfaceToken(IActivityManager.descriptor);
2738 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002739 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 reply.readException();
2741 data.recycle();
2742 reply.recycle();
2743 }
2744 public void enterSafeMode() throws RemoteException {
2745 Parcel data = Parcel.obtain();
2746 data.writeInterfaceToken(IActivityManager.descriptor);
2747 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2748 data.recycle();
2749 }
2750 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2751 Parcel data = Parcel.obtain();
2752 data.writeStrongBinder(sender.asBinder());
2753 data.writeInterfaceToken(IActivityManager.descriptor);
2754 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2755 data.recycle();
2756 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002757 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
2760 data.writeInterfaceToken(IActivityManager.descriptor);
2761 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002762 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002763 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002764 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 boolean res = reply.readInt() != 0;
2766 data.recycle();
2767 reply.recycle();
2768 return res;
2769 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 public void startRunning(String pkg, String cls, String action,
2771 String indata) throws RemoteException {
2772 Parcel data = Parcel.obtain();
2773 Parcel reply = Parcel.obtain();
2774 data.writeInterfaceToken(IActivityManager.descriptor);
2775 data.writeString(pkg);
2776 data.writeString(cls);
2777 data.writeString(action);
2778 data.writeString(indata);
2779 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2780 reply.readException();
2781 data.recycle();
2782 reply.recycle();
2783 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 public boolean testIsSystemReady()
2785 {
2786 /* this base class version is never called */
2787 return true;
2788 }
Dan Egnor60d87622009-12-16 16:32:58 -08002789 public void handleApplicationCrash(IBinder app,
2790 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2791 {
2792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeStrongBinder(app);
2796 crashInfo.writeToParcel(data, 0);
2797 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2798 reply.readException();
2799 reply.recycle();
2800 data.recycle();
2801 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002802
Dan Egnor60d87622009-12-16 16:32:58 -08002803 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002804 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002805 {
2806 Parcel data = Parcel.obtain();
2807 Parcel reply = Parcel.obtain();
2808 data.writeInterfaceToken(IActivityManager.descriptor);
2809 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002810 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002811 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002812 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002814 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002815 reply.recycle();
2816 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002817 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002818 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002819
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002820 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002821 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002822 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002823 {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002828 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002829 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002830 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2831 reply.readException();
2832 reply.recycle();
2833 data.recycle();
2834 }
2835
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 public void signalPersistentProcesses(int sig) throws RemoteException {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 data.writeInt(sig);
2841 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2842 reply.readException();
2843 data.recycle();
2844 reply.recycle();
2845 }
2846
Dianne Hackborn03abb812010-01-04 18:43:19 -08002847 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002848 Parcel data = Parcel.obtain();
2849 Parcel reply = Parcel.obtain();
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002852 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2853 reply.readException();
2854 data.recycle();
2855 reply.recycle();
2856 }
2857
2858 public void forceStopPackage(String packageName) throws RemoteException {
2859 Parcel data = Parcel.obtain();
2860 Parcel reply = Parcel.obtain();
2861 data.writeInterfaceToken(IActivityManager.descriptor);
2862 data.writeString(packageName);
2863 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002864 reply.readException();
2865 data.recycle();
2866 reply.recycle();
2867 }
2868
2869 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2870 {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2875 reply.readException();
2876 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2877 reply.recycle();
2878 data.recycle();
2879 return res;
2880 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002881
2882 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002883 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002884 {
2885 Parcel data = Parcel.obtain();
2886 Parcel reply = Parcel.obtain();
2887 data.writeInterfaceToken(IActivityManager.descriptor);
2888 data.writeString(process);
2889 data.writeInt(start ? 1 : 0);
2890 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002891 if (fd != null) {
2892 data.writeInt(1);
2893 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2894 } else {
2895 data.writeInt(0);
2896 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002897 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2898 reply.readException();
2899 boolean res = reply.readInt() != 0;
2900 reply.recycle();
2901 data.recycle();
2902 return res;
2903 }
2904
Dianne Hackborn55280a92009-05-07 15:53:46 -07002905 public boolean shutdown(int timeout) throws RemoteException
2906 {
2907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 data.writeInt(timeout);
2911 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 boolean res = reply.readInt() != 0;
2914 reply.recycle();
2915 data.recycle();
2916 return res;
2917 }
2918
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002919 public void stopAppSwitches() throws RemoteException {
2920 Parcel data = Parcel.obtain();
2921 Parcel reply = Parcel.obtain();
2922 data.writeInterfaceToken(IActivityManager.descriptor);
2923 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2924 reply.readException();
2925 reply.recycle();
2926 data.recycle();
2927 }
2928
2929 public void resumeAppSwitches() throws RemoteException {
2930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2934 reply.readException();
2935 reply.recycle();
2936 data.recycle();
2937 }
2938
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002939 public void registerActivityWatcher(IActivityWatcher watcher)
2940 throws RemoteException {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2945 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2946 reply.readException();
2947 data.recycle();
2948 reply.recycle();
2949 }
2950
2951 public void unregisterActivityWatcher(IActivityWatcher watcher)
2952 throws RemoteException {
2953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
2956 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2957 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2958 reply.readException();
2959 data.recycle();
2960 reply.recycle();
2961 }
2962
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002963 public int startActivityInPackage(int uid,
2964 Intent intent, String resolvedType, IBinder resultTo,
2965 String resultWho, int requestCode, boolean onlyIfNeeded)
2966 throws RemoteException {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeInt(uid);
2971 intent.writeToParcel(data, 0);
2972 data.writeString(resolvedType);
2973 data.writeStrongBinder(resultTo);
2974 data.writeString(resultWho);
2975 data.writeInt(requestCode);
2976 data.writeInt(onlyIfNeeded ? 1 : 0);
2977 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2978 reply.readException();
2979 int result = reply.readInt();
2980 reply.recycle();
2981 data.recycle();
2982 return result;
2983 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002984
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002985 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2986 Parcel data = Parcel.obtain();
2987 Parcel reply = Parcel.obtain();
2988 data.writeInterfaceToken(IActivityManager.descriptor);
2989 data.writeString(pkg);
2990 data.writeInt(uid);
2991 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2992 reply.readException();
2993 data.recycle();
2994 reply.recycle();
2995 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002996
2997 public void closeSystemDialogs(String reason) throws RemoteException {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeString(reason);
3002 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 data.recycle();
3005 reply.recycle();
3006 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003007
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003008 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003009 throws RemoteException {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003013 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003014 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3015 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003016 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003017 data.recycle();
3018 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003019 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003020 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003021
3022 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 data.writeString(processName);
3027 data.writeInt(uid);
3028 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 data.recycle();
3031 reply.recycle();
3032 }
3033
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003034 public void overridePendingTransition(IBinder token, String packageName,
3035 int enterAnim, int exitAnim) throws RemoteException {
3036 Parcel data = Parcel.obtain();
3037 Parcel reply = Parcel.obtain();
3038 data.writeInterfaceToken(IActivityManager.descriptor);
3039 data.writeStrongBinder(token);
3040 data.writeString(packageName);
3041 data.writeInt(enterAnim);
3042 data.writeInt(exitAnim);
3043 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 data.recycle();
3046 reply.recycle();
3047 }
3048
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003049 public boolean isUserAMonkey() throws RemoteException {
3050 Parcel data = Parcel.obtain();
3051 Parcel reply = Parcel.obtain();
3052 data.writeInterfaceToken(IActivityManager.descriptor);
3053 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3054 reply.readException();
3055 boolean res = reply.readInt() != 0;
3056 data.recycle();
3057 reply.recycle();
3058 return res;
3059 }
3060
Dianne Hackborn860755f2010-06-03 18:47:52 -07003061 public void finishHeavyWeightApp() throws RemoteException {
3062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
3065 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3066 reply.readException();
3067 data.recycle();
3068 reply.recycle();
3069 }
3070
Daniel Sandler69a48172010-06-23 16:29:36 -04003071 public void setImmersive(IBinder token, boolean immersive)
3072 throws RemoteException {
3073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeStrongBinder(token);
3077 data.writeInt(immersive ? 1 : 0);
3078 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3079 reply.readException();
3080 data.recycle();
3081 reply.recycle();
3082 }
3083
3084 public boolean isImmersive(IBinder token)
3085 throws RemoteException {
3086 Parcel data = Parcel.obtain();
3087 Parcel reply = Parcel.obtain();
3088 data.writeInterfaceToken(IActivityManager.descriptor);
3089 data.writeStrongBinder(token);
3090 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003091 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003092 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003093 data.recycle();
3094 reply.recycle();
3095 return res;
3096 }
3097
3098 public boolean isTopActivityImmersive()
3099 throws RemoteException {
3100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003104 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003105 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003106 data.recycle();
3107 reply.recycle();
3108 return res;
3109 }
3110
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003111 public void crashApplication(int uid, int initialPid, String packageName,
3112 String message) throws RemoteException {
3113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeInt(uid);
3117 data.writeInt(initialPid);
3118 data.writeString(packageName);
3119 data.writeString(message);
3120 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3121 reply.readException();
3122 data.recycle();
3123 reply.recycle();
3124 }
Andy McFadden824c5102010-07-09 16:26:57 -07003125
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003126 public String getProviderMimeType(Uri uri)
3127 throws RemoteException {
3128 Parcel data = Parcel.obtain();
3129 Parcel reply = Parcel.obtain();
3130 data.writeInterfaceToken(IActivityManager.descriptor);
3131 uri.writeToParcel(data, 0);
3132 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3133 reply.readException();
3134 String res = reply.readString();
3135 data.recycle();
3136 reply.recycle();
3137 return res;
3138 }
3139
Dianne Hackborn7e269642010-08-25 19:50:20 -07003140 public IBinder newUriPermissionOwner(String name)
3141 throws RemoteException {
3142 Parcel data = Parcel.obtain();
3143 Parcel reply = Parcel.obtain();
3144 data.writeInterfaceToken(IActivityManager.descriptor);
3145 data.writeString(name);
3146 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3147 reply.readException();
3148 IBinder res = reply.readStrongBinder();
3149 data.recycle();
3150 reply.recycle();
3151 return res;
3152 }
3153
3154 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3155 Uri uri, int mode) throws RemoteException {
3156 Parcel data = Parcel.obtain();
3157 Parcel reply = Parcel.obtain();
3158 data.writeInterfaceToken(IActivityManager.descriptor);
3159 data.writeStrongBinder(owner);
3160 data.writeInt(fromUid);
3161 data.writeString(targetPkg);
3162 uri.writeToParcel(data, 0);
3163 data.writeInt(mode);
3164 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 data.recycle();
3167 reply.recycle();
3168 }
3169
3170 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3171 int mode) throws RemoteException {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeStrongBinder(owner);
3176 if (uri != null) {
3177 data.writeInt(1);
3178 uri.writeToParcel(data, 0);
3179 } else {
3180 data.writeInt(0);
3181 }
3182 data.writeInt(mode);
3183 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3184 reply.readException();
3185 data.recycle();
3186 reply.recycle();
3187 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003188
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003189 public int checkGrantUriPermission(int callingUid, String targetPkg,
3190 Uri uri, int modeFlags) throws RemoteException {
3191 Parcel data = Parcel.obtain();
3192 Parcel reply = Parcel.obtain();
3193 data.writeInterfaceToken(IActivityManager.descriptor);
3194 data.writeInt(callingUid);
3195 data.writeString(targetPkg);
3196 uri.writeToParcel(data, 0);
3197 data.writeInt(modeFlags);
3198 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 int res = reply.readInt();
3201 data.recycle();
3202 reply.recycle();
3203 return res;
3204 }
3205
Andy McFadden824c5102010-07-09 16:26:57 -07003206 public boolean dumpHeap(String process, boolean managed,
3207 String path, ParcelFileDescriptor fd) throws RemoteException {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 data.writeString(process);
3212 data.writeInt(managed ? 1 : 0);
3213 data.writeString(path);
3214 if (fd != null) {
3215 data.writeInt(1);
3216 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3217 } else {
3218 data.writeInt(0);
3219 }
3220 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3221 reply.readException();
3222 boolean res = reply.readInt() != 0;
3223 reply.recycle();
3224 data.recycle();
3225 return res;
3226 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003227
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003228 public int startActivities(IApplicationThread caller,
3229 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3234 data.writeTypedArray(intents, 0);
3235 data.writeStringArray(resolvedTypes);
3236 data.writeStrongBinder(resultTo);
3237 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 int result = reply.readInt();
3240 reply.recycle();
3241 data.recycle();
3242 return result;
3243 }
3244
3245 public int startActivitiesInPackage(int uid,
3246 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3247 Parcel data = Parcel.obtain();
3248 Parcel reply = Parcel.obtain();
3249 data.writeInterfaceToken(IActivityManager.descriptor);
3250 data.writeInt(uid);
3251 data.writeTypedArray(intents, 0);
3252 data.writeStringArray(resolvedTypes);
3253 data.writeStrongBinder(resultTo);
3254 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 int result = reply.readInt();
3257 reply.recycle();
3258 data.recycle();
3259 return result;
3260 }
3261
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003262 public int getFrontActivityScreenCompatMode() throws RemoteException {
3263 Parcel data = Parcel.obtain();
3264 Parcel reply = Parcel.obtain();
3265 data.writeInterfaceToken(IActivityManager.descriptor);
3266 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3267 reply.readException();
3268 int mode = reply.readInt();
3269 reply.recycle();
3270 data.recycle();
3271 return mode;
3272 }
3273
3274 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeInt(mode);
3279 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3280 reply.readException();
3281 reply.recycle();
3282 data.recycle();
3283 }
3284
3285 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003289 data.writeString(packageName);
3290 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003291 reply.readException();
3292 int mode = reply.readInt();
3293 reply.recycle();
3294 data.recycle();
3295 return mode;
3296 }
3297
3298 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003299 throws RemoteException {
3300 Parcel data = Parcel.obtain();
3301 Parcel reply = Parcel.obtain();
3302 data.writeInterfaceToken(IActivityManager.descriptor);
3303 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003304 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003305 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3306 reply.readException();
3307 reply.recycle();
3308 data.recycle();
3309 }
3310
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003311 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeString(packageName);
3316 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 boolean ask = reply.readInt() != 0;
3319 reply.recycle();
3320 data.recycle();
3321 return ask;
3322 }
3323
3324 public void setPackageAskScreenCompat(String packageName, boolean ask)
3325 throws RemoteException {
3326 Parcel data = Parcel.obtain();
3327 Parcel reply = Parcel.obtain();
3328 data.writeInterfaceToken(IActivityManager.descriptor);
3329 data.writeString(packageName);
3330 data.writeInt(ask ? 1 : 0);
3331 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3332 reply.readException();
3333 reply.recycle();
3334 data.recycle();
3335 }
3336
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003337 public boolean switchUser(int userid) throws RemoteException {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeInt(userid);
3342 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3343 reply.readException();
3344 boolean result = reply.readInt() != 0;
3345 reply.recycle();
3346 data.recycle();
3347 return result;
3348 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003349
3350 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3351 Parcel data = Parcel.obtain();
3352 Parcel reply = Parcel.obtain();
3353 data.writeInterfaceToken(IActivityManager.descriptor);
3354 data.writeInt(taskId);
3355 data.writeInt(subTaskIndex);
3356 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3357 reply.readException();
3358 boolean result = reply.readInt() != 0;
3359 reply.recycle();
3360 data.recycle();
3361 return result;
3362 }
3363
3364 public boolean removeTask(int taskId, int flags) throws RemoteException {
3365 Parcel data = Parcel.obtain();
3366 Parcel reply = Parcel.obtain();
3367 data.writeInterfaceToken(IActivityManager.descriptor);
3368 data.writeInt(taskId);
3369 data.writeInt(flags);
3370 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 boolean result = reply.readInt() != 0;
3373 reply.recycle();
3374 data.recycle();
3375 return result;
3376 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003377
Jeff Sharkeya4620792011-05-20 15:29:23 -07003378 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3379 Parcel data = Parcel.obtain();
3380 Parcel reply = Parcel.obtain();
3381 data.writeInterfaceToken(IActivityManager.descriptor);
3382 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3383 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3384 reply.readException();
3385 data.recycle();
3386 reply.recycle();
3387 }
3388
3389 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3394 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3395 reply.readException();
3396 data.recycle();
3397 reply.recycle();
3398 }
3399
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003400 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3401 Parcel data = Parcel.obtain();
3402 Parcel reply = Parcel.obtain();
3403 data.writeInterfaceToken(IActivityManager.descriptor);
3404 data.writeStrongBinder(sender.asBinder());
3405 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3406 reply.readException();
3407 boolean res = reply.readInt() != 0;
3408 data.recycle();
3409 reply.recycle();
3410 return res;
3411 }
3412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003413 private IBinder mRemote;
3414}