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