blob: 5ffaee7f6c26150eb92532a75e95a26defda01dd [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 Hackborne2515ee2011-04-27 18:52:56 -04001400 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1401 {
1402 data.enforceInterface(IActivityManager.descriptor);
1403 String pkg = data.readString();
1404 boolean enabled = data.readInt() != 0;
1405 setPackageScreenCompatMode(pkg, enabled);
1406 reply.writeNoException();
1407 return true;
1408 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001409
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001410 case SWITCH_USER_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 int userid = data.readInt();
1413 boolean result = switchUser(userid);
1414 reply.writeNoException();
1415 reply.writeInt(result ? 1 : 0);
1416 return true;
1417 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001418
1419 case REMOVE_SUB_TASK_TRANSACTION:
1420 {
1421 data.enforceInterface(IActivityManager.descriptor);
1422 int taskId = data.readInt();
1423 int subTaskIndex = data.readInt();
1424 boolean result = removeSubTask(taskId, subTaskIndex);
1425 reply.writeNoException();
1426 reply.writeInt(result ? 1 : 0);
1427 return true;
1428 }
1429
1430 case REMOVE_TASK_TRANSACTION:
1431 {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 int taskId = data.readInt();
1434 int fl = data.readInt();
1435 boolean result = removeTask(taskId, fl);
1436 reply.writeNoException();
1437 reply.writeInt(result ? 1 : 0);
1438 return true;
1439 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001440
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001441 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001443 return super.onTransact(code, data, reply, flags);
1444 }
1445
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001446 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001447 return this;
1448 }
1449
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001450 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1451 protected IActivityManager create() {
1452 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001453 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001454 Log.v("ActivityManager", "default service binder = " + b);
1455 }
1456 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001457 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001458 Log.v("ActivityManager", "default service = " + am);
1459 }
1460 return am;
1461 }
1462 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001463}
1464
1465class ActivityManagerProxy implements IActivityManager
1466{
1467 public ActivityManagerProxy(IBinder remote)
1468 {
1469 mRemote = remote;
1470 }
1471
1472 public IBinder asBinder()
1473 {
1474 return mRemote;
1475 }
1476
1477 public int startActivity(IApplicationThread caller, Intent intent,
1478 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1479 IBinder resultTo, String resultWho,
1480 int requestCode, boolean onlyIfNeeded,
1481 boolean debug) throws RemoteException {
1482 Parcel data = Parcel.obtain();
1483 Parcel reply = Parcel.obtain();
1484 data.writeInterfaceToken(IActivityManager.descriptor);
1485 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1486 intent.writeToParcel(data, 0);
1487 data.writeString(resolvedType);
1488 data.writeTypedArray(grantedUriPermissions, 0);
1489 data.writeInt(grantedMode);
1490 data.writeStrongBinder(resultTo);
1491 data.writeString(resultWho);
1492 data.writeInt(requestCode);
1493 data.writeInt(onlyIfNeeded ? 1 : 0);
1494 data.writeInt(debug ? 1 : 0);
1495 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1496 reply.readException();
1497 int result = reply.readInt();
1498 reply.recycle();
1499 data.recycle();
1500 return result;
1501 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001502 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1503 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1504 IBinder resultTo, String resultWho,
1505 int requestCode, boolean onlyIfNeeded,
1506 boolean debug) throws RemoteException {
1507 Parcel data = Parcel.obtain();
1508 Parcel reply = Parcel.obtain();
1509 data.writeInterfaceToken(IActivityManager.descriptor);
1510 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1511 intent.writeToParcel(data, 0);
1512 data.writeString(resolvedType);
1513 data.writeTypedArray(grantedUriPermissions, 0);
1514 data.writeInt(grantedMode);
1515 data.writeStrongBinder(resultTo);
1516 data.writeString(resultWho);
1517 data.writeInt(requestCode);
1518 data.writeInt(onlyIfNeeded ? 1 : 0);
1519 data.writeInt(debug ? 1 : 0);
1520 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1521 reply.readException();
1522 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1523 reply.recycle();
1524 data.recycle();
1525 return result;
1526 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001527 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1528 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1529 IBinder resultTo, String resultWho,
1530 int requestCode, boolean onlyIfNeeded,
1531 boolean debug, Configuration config) throws RemoteException {
1532 Parcel data = Parcel.obtain();
1533 Parcel reply = Parcel.obtain();
1534 data.writeInterfaceToken(IActivityManager.descriptor);
1535 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1536 intent.writeToParcel(data, 0);
1537 data.writeString(resolvedType);
1538 data.writeTypedArray(grantedUriPermissions, 0);
1539 data.writeInt(grantedMode);
1540 data.writeStrongBinder(resultTo);
1541 data.writeString(resultWho);
1542 data.writeInt(requestCode);
1543 data.writeInt(onlyIfNeeded ? 1 : 0);
1544 data.writeInt(debug ? 1 : 0);
1545 config.writeToParcel(data, 0);
1546 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1547 reply.readException();
1548 int result = reply.readInt();
1549 reply.recycle();
1550 data.recycle();
1551 return result;
1552 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001553 public int startActivityIntentSender(IApplicationThread caller,
1554 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001555 IBinder resultTo, String resultWho, int requestCode,
1556 int flagsMask, int flagsValues) throws RemoteException {
1557 Parcel data = Parcel.obtain();
1558 Parcel reply = Parcel.obtain();
1559 data.writeInterfaceToken(IActivityManager.descriptor);
1560 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1561 intent.writeToParcel(data, 0);
1562 if (fillInIntent != null) {
1563 data.writeInt(1);
1564 fillInIntent.writeToParcel(data, 0);
1565 } else {
1566 data.writeInt(0);
1567 }
1568 data.writeString(resolvedType);
1569 data.writeStrongBinder(resultTo);
1570 data.writeString(resultWho);
1571 data.writeInt(requestCode);
1572 data.writeInt(flagsMask);
1573 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001574 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001575 reply.readException();
1576 int result = reply.readInt();
1577 reply.recycle();
1578 data.recycle();
1579 return result;
1580 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001581 public boolean startNextMatchingActivity(IBinder callingActivity,
1582 Intent intent) throws RemoteException {
1583 Parcel data = Parcel.obtain();
1584 Parcel reply = Parcel.obtain();
1585 data.writeInterfaceToken(IActivityManager.descriptor);
1586 data.writeStrongBinder(callingActivity);
1587 intent.writeToParcel(data, 0);
1588 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1589 reply.readException();
1590 int result = reply.readInt();
1591 reply.recycle();
1592 data.recycle();
1593 return result != 0;
1594 }
1595 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1596 throws RemoteException {
1597 Parcel data = Parcel.obtain();
1598 Parcel reply = Parcel.obtain();
1599 data.writeInterfaceToken(IActivityManager.descriptor);
1600 data.writeStrongBinder(token);
1601 data.writeInt(resultCode);
1602 if (resultData != null) {
1603 data.writeInt(1);
1604 resultData.writeToParcel(data, 0);
1605 } else {
1606 data.writeInt(0);
1607 }
1608 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1609 reply.readException();
1610 boolean res = reply.readInt() != 0;
1611 data.recycle();
1612 reply.recycle();
1613 return res;
1614 }
1615 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1616 {
1617 Parcel data = Parcel.obtain();
1618 Parcel reply = Parcel.obtain();
1619 data.writeInterfaceToken(IActivityManager.descriptor);
1620 data.writeStrongBinder(token);
1621 data.writeString(resultWho);
1622 data.writeInt(requestCode);
1623 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1624 reply.readException();
1625 data.recycle();
1626 reply.recycle();
1627 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001628 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1629 Parcel data = Parcel.obtain();
1630 Parcel reply = Parcel.obtain();
1631 data.writeInterfaceToken(IActivityManager.descriptor);
1632 data.writeStrongBinder(token);
1633 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1634 reply.readException();
1635 boolean res = reply.readInt() != 0;
1636 data.recycle();
1637 reply.recycle();
1638 return res;
1639 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001640 public Intent registerReceiver(IApplicationThread caller,
1641 IIntentReceiver receiver,
1642 IntentFilter filter, String perm) throws RemoteException
1643 {
1644 Parcel data = Parcel.obtain();
1645 Parcel reply = Parcel.obtain();
1646 data.writeInterfaceToken(IActivityManager.descriptor);
1647 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1648 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1649 filter.writeToParcel(data, 0);
1650 data.writeString(perm);
1651 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1652 reply.readException();
1653 Intent intent = null;
1654 int haveIntent = reply.readInt();
1655 if (haveIntent != 0) {
1656 intent = Intent.CREATOR.createFromParcel(reply);
1657 }
1658 reply.recycle();
1659 data.recycle();
1660 return intent;
1661 }
1662 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1663 {
1664 Parcel data = Parcel.obtain();
1665 Parcel reply = Parcel.obtain();
1666 data.writeInterfaceToken(IActivityManager.descriptor);
1667 data.writeStrongBinder(receiver.asBinder());
1668 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1669 reply.readException();
1670 data.recycle();
1671 reply.recycle();
1672 }
1673 public int broadcastIntent(IApplicationThread caller,
1674 Intent intent, String resolvedType, IIntentReceiver resultTo,
1675 int resultCode, String resultData, Bundle map,
1676 String requiredPermission, boolean serialized,
1677 boolean sticky) throws RemoteException
1678 {
1679 Parcel data = Parcel.obtain();
1680 Parcel reply = Parcel.obtain();
1681 data.writeInterfaceToken(IActivityManager.descriptor);
1682 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1683 intent.writeToParcel(data, 0);
1684 data.writeString(resolvedType);
1685 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1686 data.writeInt(resultCode);
1687 data.writeString(resultData);
1688 data.writeBundle(map);
1689 data.writeString(requiredPermission);
1690 data.writeInt(serialized ? 1 : 0);
1691 data.writeInt(sticky ? 1 : 0);
1692 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1693 reply.readException();
1694 int res = reply.readInt();
1695 reply.recycle();
1696 data.recycle();
1697 return res;
1698 }
1699 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1700 {
1701 Parcel data = Parcel.obtain();
1702 Parcel reply = Parcel.obtain();
1703 data.writeInterfaceToken(IActivityManager.descriptor);
1704 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1705 intent.writeToParcel(data, 0);
1706 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1707 reply.readException();
1708 data.recycle();
1709 reply.recycle();
1710 }
1711 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1712 {
1713 Parcel data = Parcel.obtain();
1714 Parcel reply = Parcel.obtain();
1715 data.writeInterfaceToken(IActivityManager.descriptor);
1716 data.writeStrongBinder(who);
1717 data.writeInt(resultCode);
1718 data.writeString(resultData);
1719 data.writeBundle(map);
1720 data.writeInt(abortBroadcast ? 1 : 0);
1721 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1722 reply.readException();
1723 data.recycle();
1724 reply.recycle();
1725 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 public void attachApplication(IApplicationThread app) throws RemoteException
1727 {
1728 Parcel data = Parcel.obtain();
1729 Parcel reply = Parcel.obtain();
1730 data.writeInterfaceToken(IActivityManager.descriptor);
1731 data.writeStrongBinder(app.asBinder());
1732 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1733 reply.readException();
1734 data.recycle();
1735 reply.recycle();
1736 }
Dianne Hackborne88846e2009-09-30 21:34:25 -07001737 public void activityIdle(IBinder token, Configuration config) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001738 {
1739 Parcel data = Parcel.obtain();
1740 Parcel reply = Parcel.obtain();
1741 data.writeInterfaceToken(IActivityManager.descriptor);
1742 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001743 if (config != null) {
1744 data.writeInt(1);
1745 config.writeToParcel(data, 0);
1746 } else {
1747 data.writeInt(0);
1748 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001749 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1750 reply.readException();
1751 data.recycle();
1752 reply.recycle();
1753 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001754 public void activityPaused(IBinder token) throws RemoteException
1755 {
1756 Parcel data = Parcel.obtain();
1757 Parcel reply = Parcel.obtain();
1758 data.writeInterfaceToken(IActivityManager.descriptor);
1759 data.writeStrongBinder(token);
1760 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1761 reply.readException();
1762 data.recycle();
1763 reply.recycle();
1764 }
1765 public void activityStopped(IBinder token, Bundle state,
1766 Bitmap thumbnail, CharSequence description) 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);
1772 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001773 if (thumbnail != null) {
1774 data.writeInt(1);
1775 thumbnail.writeToParcel(data, 0);
1776 } else {
1777 data.writeInt(0);
1778 }
1779 TextUtils.writeToParcel(description, data, 0);
1780 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1781 reply.readException();
1782 data.recycle();
1783 reply.recycle();
1784 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001785 public void activitySlept(IBinder token) throws RemoteException
1786 {
1787 Parcel data = Parcel.obtain();
1788 Parcel reply = Parcel.obtain();
1789 data.writeInterfaceToken(IActivityManager.descriptor);
1790 data.writeStrongBinder(token);
1791 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1792 reply.readException();
1793 data.recycle();
1794 reply.recycle();
1795 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001796 public void activityDestroyed(IBinder token) throws RemoteException
1797 {
1798 Parcel data = Parcel.obtain();
1799 Parcel reply = Parcel.obtain();
1800 data.writeInterfaceToken(IActivityManager.descriptor);
1801 data.writeStrongBinder(token);
1802 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1803 reply.readException();
1804 data.recycle();
1805 reply.recycle();
1806 }
1807 public String getCallingPackage(IBinder token) throws RemoteException
1808 {
1809 Parcel data = Parcel.obtain();
1810 Parcel reply = Parcel.obtain();
1811 data.writeInterfaceToken(IActivityManager.descriptor);
1812 data.writeStrongBinder(token);
1813 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1814 reply.readException();
1815 String res = reply.readString();
1816 data.recycle();
1817 reply.recycle();
1818 return res;
1819 }
1820 public ComponentName getCallingActivity(IBinder token)
1821 throws RemoteException {
1822 Parcel data = Parcel.obtain();
1823 Parcel reply = Parcel.obtain();
1824 data.writeInterfaceToken(IActivityManager.descriptor);
1825 data.writeStrongBinder(token);
1826 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1827 reply.readException();
1828 ComponentName res = ComponentName.readFromParcel(reply);
1829 data.recycle();
1830 reply.recycle();
1831 return res;
1832 }
1833 public List getTasks(int maxNum, int flags,
1834 IThumbnailReceiver receiver) throws RemoteException {
1835 Parcel data = Parcel.obtain();
1836 Parcel reply = Parcel.obtain();
1837 data.writeInterfaceToken(IActivityManager.descriptor);
1838 data.writeInt(maxNum);
1839 data.writeInt(flags);
1840 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1841 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1842 reply.readException();
1843 ArrayList list = null;
1844 int N = reply.readInt();
1845 if (N >= 0) {
1846 list = new ArrayList();
1847 while (N > 0) {
1848 ActivityManager.RunningTaskInfo info =
1849 ActivityManager.RunningTaskInfo.CREATOR
1850 .createFromParcel(reply);
1851 list.add(info);
1852 N--;
1853 }
1854 }
1855 data.recycle();
1856 reply.recycle();
1857 return list;
1858 }
1859 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1860 int flags) throws RemoteException {
1861 Parcel data = Parcel.obtain();
1862 Parcel reply = Parcel.obtain();
1863 data.writeInterfaceToken(IActivityManager.descriptor);
1864 data.writeInt(maxNum);
1865 data.writeInt(flags);
1866 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
1867 reply.readException();
1868 ArrayList<ActivityManager.RecentTaskInfo> list
1869 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
1870 data.recycle();
1871 reply.recycle();
1872 return list;
1873 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001874 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08001875 Parcel data = Parcel.obtain();
1876 Parcel reply = Parcel.obtain();
1877 data.writeInterfaceToken(IActivityManager.descriptor);
1878 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001879 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08001880 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001881 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08001882 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07001883 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08001884 }
1885 data.recycle();
1886 reply.recycle();
1887 return bm;
1888 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001889 public List getServices(int maxNum, 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_SERVICES_TRANSACTION, data, reply, 0);
1896 reply.readException();
1897 ArrayList list = null;
1898 int N = reply.readInt();
1899 if (N >= 0) {
1900 list = new ArrayList();
1901 while (N > 0) {
1902 ActivityManager.RunningServiceInfo info =
1903 ActivityManager.RunningServiceInfo.CREATOR
1904 .createFromParcel(reply);
1905 list.add(info);
1906 N--;
1907 }
1908 }
1909 data.recycle();
1910 reply.recycle();
1911 return list;
1912 }
1913 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
1914 throws RemoteException {
1915 Parcel data = Parcel.obtain();
1916 Parcel reply = Parcel.obtain();
1917 data.writeInterfaceToken(IActivityManager.descriptor);
1918 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
1919 reply.readException();
1920 ArrayList<ActivityManager.ProcessErrorStateInfo> list
1921 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
1922 data.recycle();
1923 reply.recycle();
1924 return list;
1925 }
1926 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
1927 throws RemoteException {
1928 Parcel data = Parcel.obtain();
1929 Parcel reply = Parcel.obtain();
1930 data.writeInterfaceToken(IActivityManager.descriptor);
1931 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
1932 reply.readException();
1933 ArrayList<ActivityManager.RunningAppProcessInfo> list
1934 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
1935 data.recycle();
1936 reply.recycle();
1937 return list;
1938 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07001939 public List<ApplicationInfo> getRunningExternalApplications()
1940 throws RemoteException {
1941 Parcel data = Parcel.obtain();
1942 Parcel reply = Parcel.obtain();
1943 data.writeInterfaceToken(IActivityManager.descriptor);
1944 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
1945 reply.readException();
1946 ArrayList<ApplicationInfo> list
1947 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
1948 data.recycle();
1949 reply.recycle();
1950 return list;
1951 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001952 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001953 {
1954 Parcel data = Parcel.obtain();
1955 Parcel reply = Parcel.obtain();
1956 data.writeInterfaceToken(IActivityManager.descriptor);
1957 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001958 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001959 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
1960 reply.readException();
1961 data.recycle();
1962 reply.recycle();
1963 }
1964 public void moveTaskToBack(int task) throws RemoteException
1965 {
1966 Parcel data = Parcel.obtain();
1967 Parcel reply = Parcel.obtain();
1968 data.writeInterfaceToken(IActivityManager.descriptor);
1969 data.writeInt(task);
1970 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1971 reply.readException();
1972 data.recycle();
1973 reply.recycle();
1974 }
1975 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
1976 throws RemoteException {
1977 Parcel data = Parcel.obtain();
1978 Parcel reply = Parcel.obtain();
1979 data.writeInterfaceToken(IActivityManager.descriptor);
1980 data.writeStrongBinder(token);
1981 data.writeInt(nonRoot ? 1 : 0);
1982 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
1983 reply.readException();
1984 boolean res = reply.readInt() != 0;
1985 data.recycle();
1986 reply.recycle();
1987 return res;
1988 }
1989 public void moveTaskBackwards(int task) throws RemoteException
1990 {
1991 Parcel data = Parcel.obtain();
1992 Parcel reply = Parcel.obtain();
1993 data.writeInterfaceToken(IActivityManager.descriptor);
1994 data.writeInt(task);
1995 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
1996 reply.readException();
1997 data.recycle();
1998 reply.recycle();
1999 }
2000 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2001 {
2002 Parcel data = Parcel.obtain();
2003 Parcel reply = Parcel.obtain();
2004 data.writeInterfaceToken(IActivityManager.descriptor);
2005 data.writeStrongBinder(token);
2006 data.writeInt(onlyRoot ? 1 : 0);
2007 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2008 reply.readException();
2009 int res = reply.readInt();
2010 data.recycle();
2011 reply.recycle();
2012 return res;
2013 }
2014 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
2015 {
2016 Parcel data = Parcel.obtain();
2017 Parcel reply = Parcel.obtain();
2018 data.writeInterfaceToken(IActivityManager.descriptor);
2019 data.writeStrongBinder(token);
2020 ComponentName.writeToParcel(className, data);
2021 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
2022 reply.readException();
2023 data.recycle();
2024 reply.recycle();
2025 }
2026 public void reportThumbnail(IBinder token,
2027 Bitmap thumbnail, CharSequence description) throws RemoteException
2028 {
2029 Parcel data = Parcel.obtain();
2030 Parcel reply = Parcel.obtain();
2031 data.writeInterfaceToken(IActivityManager.descriptor);
2032 data.writeStrongBinder(token);
2033 if (thumbnail != null) {
2034 data.writeInt(1);
2035 thumbnail.writeToParcel(data, 0);
2036 } else {
2037 data.writeInt(0);
2038 }
2039 TextUtils.writeToParcel(description, data, 0);
2040 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2041 reply.readException();
2042 data.recycle();
2043 reply.recycle();
2044 }
2045 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2046 String name) throws RemoteException
2047 {
2048 Parcel data = Parcel.obtain();
2049 Parcel reply = Parcel.obtain();
2050 data.writeInterfaceToken(IActivityManager.descriptor);
2051 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2052 data.writeString(name);
2053 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2054 reply.readException();
2055 int res = reply.readInt();
2056 ContentProviderHolder cph = null;
2057 if (res != 0) {
2058 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2059 }
2060 data.recycle();
2061 reply.recycle();
2062 return cph;
2063 }
2064 public void publishContentProviders(IApplicationThread caller,
2065 List<ContentProviderHolder> providers) throws RemoteException
2066 {
2067 Parcel data = Parcel.obtain();
2068 Parcel reply = Parcel.obtain();
2069 data.writeInterfaceToken(IActivityManager.descriptor);
2070 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2071 data.writeTypedList(providers);
2072 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2073 reply.readException();
2074 data.recycle();
2075 reply.recycle();
2076 }
2077
2078 public void removeContentProvider(IApplicationThread caller,
2079 String name) throws RemoteException {
2080 Parcel data = Parcel.obtain();
2081 Parcel reply = Parcel.obtain();
2082 data.writeInterfaceToken(IActivityManager.descriptor);
2083 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2084 data.writeString(name);
2085 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2086 reply.readException();
2087 data.recycle();
2088 reply.recycle();
2089 }
2090
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002091 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2092 throws RemoteException
2093 {
2094 Parcel data = Parcel.obtain();
2095 Parcel reply = Parcel.obtain();
2096 data.writeInterfaceToken(IActivityManager.descriptor);
2097 service.writeToParcel(data, 0);
2098 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2099 reply.readException();
2100 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2101 data.recycle();
2102 reply.recycle();
2103 return res;
2104 }
2105
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002106 public ComponentName startService(IApplicationThread caller, Intent service,
2107 String resolvedType) throws RemoteException
2108 {
2109 Parcel data = Parcel.obtain();
2110 Parcel reply = Parcel.obtain();
2111 data.writeInterfaceToken(IActivityManager.descriptor);
2112 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2113 service.writeToParcel(data, 0);
2114 data.writeString(resolvedType);
2115 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2116 reply.readException();
2117 ComponentName res = ComponentName.readFromParcel(reply);
2118 data.recycle();
2119 reply.recycle();
2120 return res;
2121 }
2122 public int stopService(IApplicationThread caller, Intent service,
2123 String resolvedType) throws RemoteException
2124 {
2125 Parcel data = Parcel.obtain();
2126 Parcel reply = Parcel.obtain();
2127 data.writeInterfaceToken(IActivityManager.descriptor);
2128 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2129 service.writeToParcel(data, 0);
2130 data.writeString(resolvedType);
2131 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2132 reply.readException();
2133 int res = reply.readInt();
2134 reply.recycle();
2135 data.recycle();
2136 return res;
2137 }
2138 public boolean stopServiceToken(ComponentName className, IBinder token,
2139 int startId) throws RemoteException {
2140 Parcel data = Parcel.obtain();
2141 Parcel reply = Parcel.obtain();
2142 data.writeInterfaceToken(IActivityManager.descriptor);
2143 ComponentName.writeToParcel(className, data);
2144 data.writeStrongBinder(token);
2145 data.writeInt(startId);
2146 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2147 reply.readException();
2148 boolean res = reply.readInt() != 0;
2149 data.recycle();
2150 reply.recycle();
2151 return res;
2152 }
2153 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002154 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002155 Parcel data = Parcel.obtain();
2156 Parcel reply = Parcel.obtain();
2157 data.writeInterfaceToken(IActivityManager.descriptor);
2158 ComponentName.writeToParcel(className, data);
2159 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002160 data.writeInt(id);
2161 if (notification != null) {
2162 data.writeInt(1);
2163 notification.writeToParcel(data, 0);
2164 } else {
2165 data.writeInt(0);
2166 }
2167 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002168 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2169 reply.readException();
2170 data.recycle();
2171 reply.recycle();
2172 }
2173 public int bindService(IApplicationThread caller, IBinder token,
2174 Intent service, String resolvedType, IServiceConnection connection,
2175 int flags) throws RemoteException {
2176 Parcel data = Parcel.obtain();
2177 Parcel reply = Parcel.obtain();
2178 data.writeInterfaceToken(IActivityManager.descriptor);
2179 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2180 data.writeStrongBinder(token);
2181 service.writeToParcel(data, 0);
2182 data.writeString(resolvedType);
2183 data.writeStrongBinder(connection.asBinder());
2184 data.writeInt(flags);
2185 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2186 reply.readException();
2187 int res = reply.readInt();
2188 data.recycle();
2189 reply.recycle();
2190 return res;
2191 }
2192 public boolean unbindService(IServiceConnection connection) throws RemoteException
2193 {
2194 Parcel data = Parcel.obtain();
2195 Parcel reply = Parcel.obtain();
2196 data.writeInterfaceToken(IActivityManager.descriptor);
2197 data.writeStrongBinder(connection.asBinder());
2198 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2199 reply.readException();
2200 boolean res = reply.readInt() != 0;
2201 data.recycle();
2202 reply.recycle();
2203 return res;
2204 }
2205
2206 public void publishService(IBinder token,
2207 Intent intent, IBinder service) throws RemoteException {
2208 Parcel data = Parcel.obtain();
2209 Parcel reply = Parcel.obtain();
2210 data.writeInterfaceToken(IActivityManager.descriptor);
2211 data.writeStrongBinder(token);
2212 intent.writeToParcel(data, 0);
2213 data.writeStrongBinder(service);
2214 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 data.recycle();
2217 reply.recycle();
2218 }
2219
2220 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2221 throws RemoteException {
2222 Parcel data = Parcel.obtain();
2223 Parcel reply = Parcel.obtain();
2224 data.writeInterfaceToken(IActivityManager.descriptor);
2225 data.writeStrongBinder(token);
2226 intent.writeToParcel(data, 0);
2227 data.writeInt(doRebind ? 1 : 0);
2228 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2229 reply.readException();
2230 data.recycle();
2231 reply.recycle();
2232 }
2233
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002234 public void serviceDoneExecuting(IBinder token, int type, int startId,
2235 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002236 Parcel data = Parcel.obtain();
2237 Parcel reply = Parcel.obtain();
2238 data.writeInterfaceToken(IActivityManager.descriptor);
2239 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002240 data.writeInt(type);
2241 data.writeInt(startId);
2242 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2244 reply.readException();
2245 data.recycle();
2246 reply.recycle();
2247 }
2248
2249 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2250 Parcel data = Parcel.obtain();
2251 Parcel reply = Parcel.obtain();
2252 data.writeInterfaceToken(IActivityManager.descriptor);
2253 service.writeToParcel(data, 0);
2254 data.writeString(resolvedType);
2255 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2256 reply.readException();
2257 IBinder binder = reply.readStrongBinder();
2258 reply.recycle();
2259 data.recycle();
2260 return binder;
2261 }
2262
Christopher Tate181fafa2009-05-14 11:12:14 -07002263 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2264 throws RemoteException {
2265 Parcel data = Parcel.obtain();
2266 Parcel reply = Parcel.obtain();
2267 data.writeInterfaceToken(IActivityManager.descriptor);
2268 app.writeToParcel(data, 0);
2269 data.writeInt(backupRestoreMode);
2270 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2271 reply.readException();
2272 boolean success = reply.readInt() != 0;
2273 reply.recycle();
2274 data.recycle();
2275 return success;
2276 }
2277
2278 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2279 Parcel data = Parcel.obtain();
2280 Parcel reply = Parcel.obtain();
2281 data.writeInterfaceToken(IActivityManager.descriptor);
2282 data.writeString(packageName);
2283 data.writeStrongBinder(agent);
2284 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2285 reply.recycle();
2286 data.recycle();
2287 }
2288
2289 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2290 Parcel data = Parcel.obtain();
2291 Parcel reply = Parcel.obtain();
2292 data.writeInterfaceToken(IActivityManager.descriptor);
2293 app.writeToParcel(data, 0);
2294 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2295 reply.readException();
2296 reply.recycle();
2297 data.recycle();
2298 }
2299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 public boolean startInstrumentation(ComponentName className, String profileFile,
2301 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2302 throws RemoteException {
2303 Parcel data = Parcel.obtain();
2304 Parcel reply = Parcel.obtain();
2305 data.writeInterfaceToken(IActivityManager.descriptor);
2306 ComponentName.writeToParcel(className, data);
2307 data.writeString(profileFile);
2308 data.writeInt(flags);
2309 data.writeBundle(arguments);
2310 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2311 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2312 reply.readException();
2313 boolean res = reply.readInt() != 0;
2314 reply.recycle();
2315 data.recycle();
2316 return res;
2317 }
2318
2319 public void finishInstrumentation(IApplicationThread target,
2320 int resultCode, Bundle results) throws RemoteException {
2321 Parcel data = Parcel.obtain();
2322 Parcel reply = Parcel.obtain();
2323 data.writeInterfaceToken(IActivityManager.descriptor);
2324 data.writeStrongBinder(target != null ? target.asBinder() : null);
2325 data.writeInt(resultCode);
2326 data.writeBundle(results);
2327 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2328 reply.readException();
2329 data.recycle();
2330 reply.recycle();
2331 }
2332 public Configuration getConfiguration() throws RemoteException
2333 {
2334 Parcel data = Parcel.obtain();
2335 Parcel reply = Parcel.obtain();
2336 data.writeInterfaceToken(IActivityManager.descriptor);
2337 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2338 reply.readException();
2339 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2340 reply.recycle();
2341 data.recycle();
2342 return res;
2343 }
2344 public void updateConfiguration(Configuration values) throws RemoteException
2345 {
2346 Parcel data = Parcel.obtain();
2347 Parcel reply = Parcel.obtain();
2348 data.writeInterfaceToken(IActivityManager.descriptor);
2349 values.writeToParcel(data, 0);
2350 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2351 reply.readException();
2352 data.recycle();
2353 reply.recycle();
2354 }
2355 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2356 throws RemoteException {
2357 Parcel data = Parcel.obtain();
2358 Parcel reply = Parcel.obtain();
2359 data.writeInterfaceToken(IActivityManager.descriptor);
2360 data.writeStrongBinder(token);
2361 data.writeInt(requestedOrientation);
2362 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2363 reply.readException();
2364 data.recycle();
2365 reply.recycle();
2366 }
2367 public int getRequestedOrientation(IBinder token) throws RemoteException {
2368 Parcel data = Parcel.obtain();
2369 Parcel reply = Parcel.obtain();
2370 data.writeInterfaceToken(IActivityManager.descriptor);
2371 data.writeStrongBinder(token);
2372 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2373 reply.readException();
2374 int res = reply.readInt();
2375 data.recycle();
2376 reply.recycle();
2377 return res;
2378 }
2379 public ComponentName getActivityClassForToken(IBinder token)
2380 throws RemoteException {
2381 Parcel data = Parcel.obtain();
2382 Parcel reply = Parcel.obtain();
2383 data.writeInterfaceToken(IActivityManager.descriptor);
2384 data.writeStrongBinder(token);
2385 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2386 reply.readException();
2387 ComponentName res = ComponentName.readFromParcel(reply);
2388 data.recycle();
2389 reply.recycle();
2390 return res;
2391 }
2392 public String getPackageForToken(IBinder token) throws RemoteException
2393 {
2394 Parcel data = Parcel.obtain();
2395 Parcel reply = Parcel.obtain();
2396 data.writeInterfaceToken(IActivityManager.descriptor);
2397 data.writeStrongBinder(token);
2398 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2399 reply.readException();
2400 String res = reply.readString();
2401 data.recycle();
2402 reply.recycle();
2403 return res;
2404 }
2405 public IIntentSender getIntentSender(int type,
2406 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002407 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002408 throws RemoteException {
2409 Parcel data = Parcel.obtain();
2410 Parcel reply = Parcel.obtain();
2411 data.writeInterfaceToken(IActivityManager.descriptor);
2412 data.writeInt(type);
2413 data.writeString(packageName);
2414 data.writeStrongBinder(token);
2415 data.writeString(resultWho);
2416 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002417 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002418 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002419 data.writeTypedArray(intents, 0);
2420 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002421 } else {
2422 data.writeInt(0);
2423 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002424 data.writeInt(flags);
2425 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2426 reply.readException();
2427 IIntentSender res = IIntentSender.Stub.asInterface(
2428 reply.readStrongBinder());
2429 data.recycle();
2430 reply.recycle();
2431 return res;
2432 }
2433 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2434 Parcel data = Parcel.obtain();
2435 Parcel reply = Parcel.obtain();
2436 data.writeInterfaceToken(IActivityManager.descriptor);
2437 data.writeStrongBinder(sender.asBinder());
2438 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2439 reply.readException();
2440 data.recycle();
2441 reply.recycle();
2442 }
2443 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2444 Parcel data = Parcel.obtain();
2445 Parcel reply = Parcel.obtain();
2446 data.writeInterfaceToken(IActivityManager.descriptor);
2447 data.writeStrongBinder(sender.asBinder());
2448 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 String res = reply.readString();
2451 data.recycle();
2452 reply.recycle();
2453 return res;
2454 }
2455 public void setProcessLimit(int max) throws RemoteException
2456 {
2457 Parcel data = Parcel.obtain();
2458 Parcel reply = Parcel.obtain();
2459 data.writeInterfaceToken(IActivityManager.descriptor);
2460 data.writeInt(max);
2461 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2462 reply.readException();
2463 data.recycle();
2464 reply.recycle();
2465 }
2466 public int getProcessLimit() throws RemoteException
2467 {
2468 Parcel data = Parcel.obtain();
2469 Parcel reply = Parcel.obtain();
2470 data.writeInterfaceToken(IActivityManager.descriptor);
2471 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2472 reply.readException();
2473 int res = reply.readInt();
2474 data.recycle();
2475 reply.recycle();
2476 return res;
2477 }
2478 public void setProcessForeground(IBinder token, int pid,
2479 boolean isForeground) throws RemoteException {
2480 Parcel data = Parcel.obtain();
2481 Parcel reply = Parcel.obtain();
2482 data.writeInterfaceToken(IActivityManager.descriptor);
2483 data.writeStrongBinder(token);
2484 data.writeInt(pid);
2485 data.writeInt(isForeground ? 1 : 0);
2486 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2487 reply.readException();
2488 data.recycle();
2489 reply.recycle();
2490 }
2491 public int checkPermission(String permission, int pid, int uid)
2492 throws RemoteException {
2493 Parcel data = Parcel.obtain();
2494 Parcel reply = Parcel.obtain();
2495 data.writeInterfaceToken(IActivityManager.descriptor);
2496 data.writeString(permission);
2497 data.writeInt(pid);
2498 data.writeInt(uid);
2499 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2500 reply.readException();
2501 int res = reply.readInt();
2502 data.recycle();
2503 reply.recycle();
2504 return res;
2505 }
2506 public boolean clearApplicationUserData(final String packageName,
2507 final IPackageDataObserver observer) throws RemoteException {
2508 Parcel data = Parcel.obtain();
2509 Parcel reply = Parcel.obtain();
2510 data.writeInterfaceToken(IActivityManager.descriptor);
2511 data.writeString(packageName);
2512 data.writeStrongBinder(observer.asBinder());
2513 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2514 reply.readException();
2515 boolean res = reply.readInt() != 0;
2516 data.recycle();
2517 reply.recycle();
2518 return res;
2519 }
2520 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2521 throws RemoteException {
2522 Parcel data = Parcel.obtain();
2523 Parcel reply = Parcel.obtain();
2524 data.writeInterfaceToken(IActivityManager.descriptor);
2525 uri.writeToParcel(data, 0);
2526 data.writeInt(pid);
2527 data.writeInt(uid);
2528 data.writeInt(mode);
2529 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2530 reply.readException();
2531 int res = reply.readInt();
2532 data.recycle();
2533 reply.recycle();
2534 return res;
2535 }
2536 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2537 Uri uri, int mode) throws RemoteException {
2538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeStrongBinder(caller.asBinder());
2542 data.writeString(targetPkg);
2543 uri.writeToParcel(data, 0);
2544 data.writeInt(mode);
2545 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2546 reply.readException();
2547 data.recycle();
2548 reply.recycle();
2549 }
2550 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2551 int mode) throws RemoteException {
2552 Parcel data = Parcel.obtain();
2553 Parcel reply = Parcel.obtain();
2554 data.writeInterfaceToken(IActivityManager.descriptor);
2555 data.writeStrongBinder(caller.asBinder());
2556 uri.writeToParcel(data, 0);
2557 data.writeInt(mode);
2558 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 data.recycle();
2561 reply.recycle();
2562 }
2563 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2564 throws RemoteException {
2565 Parcel data = Parcel.obtain();
2566 Parcel reply = Parcel.obtain();
2567 data.writeInterfaceToken(IActivityManager.descriptor);
2568 data.writeStrongBinder(who.asBinder());
2569 data.writeInt(waiting ? 1 : 0);
2570 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2571 reply.readException();
2572 data.recycle();
2573 reply.recycle();
2574 }
2575 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2576 Parcel data = Parcel.obtain();
2577 Parcel reply = Parcel.obtain();
2578 data.writeInterfaceToken(IActivityManager.descriptor);
2579 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2580 reply.readException();
2581 outInfo.readFromParcel(reply);
2582 data.recycle();
2583 reply.recycle();
2584 }
2585 public void unhandledBack() throws RemoteException
2586 {
2587 Parcel data = Parcel.obtain();
2588 Parcel reply = Parcel.obtain();
2589 data.writeInterfaceToken(IActivityManager.descriptor);
2590 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2591 reply.readException();
2592 data.recycle();
2593 reply.recycle();
2594 }
2595 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2596 {
2597 Parcel data = Parcel.obtain();
2598 Parcel reply = Parcel.obtain();
2599 data.writeInterfaceToken(IActivityManager.descriptor);
2600 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2601 reply.readException();
2602 ParcelFileDescriptor pfd = null;
2603 if (reply.readInt() != 0) {
2604 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2605 }
2606 data.recycle();
2607 reply.recycle();
2608 return pfd;
2609 }
2610 public void goingToSleep() throws RemoteException
2611 {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2616 reply.readException();
2617 data.recycle();
2618 reply.recycle();
2619 }
2620 public void wakingUp() throws RemoteException
2621 {
2622 Parcel data = Parcel.obtain();
2623 Parcel reply = Parcel.obtain();
2624 data.writeInterfaceToken(IActivityManager.descriptor);
2625 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2626 reply.readException();
2627 data.recycle();
2628 reply.recycle();
2629 }
2630 public void setDebugApp(
2631 String packageName, boolean waitForDebugger, boolean persistent)
2632 throws RemoteException
2633 {
2634 Parcel data = Parcel.obtain();
2635 Parcel reply = Parcel.obtain();
2636 data.writeInterfaceToken(IActivityManager.descriptor);
2637 data.writeString(packageName);
2638 data.writeInt(waitForDebugger ? 1 : 0);
2639 data.writeInt(persistent ? 1 : 0);
2640 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2641 reply.readException();
2642 data.recycle();
2643 reply.recycle();
2644 }
2645 public void setAlwaysFinish(boolean enabled) throws RemoteException
2646 {
2647 Parcel data = Parcel.obtain();
2648 Parcel reply = Parcel.obtain();
2649 data.writeInterfaceToken(IActivityManager.descriptor);
2650 data.writeInt(enabled ? 1 : 0);
2651 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2652 reply.readException();
2653 data.recycle();
2654 reply.recycle();
2655 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002656 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 {
2658 Parcel data = Parcel.obtain();
2659 Parcel reply = Parcel.obtain();
2660 data.writeInterfaceToken(IActivityManager.descriptor);
2661 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002662 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002663 reply.readException();
2664 data.recycle();
2665 reply.recycle();
2666 }
2667 public void enterSafeMode() throws RemoteException {
2668 Parcel data = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2671 data.recycle();
2672 }
2673 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2674 Parcel data = Parcel.obtain();
2675 data.writeStrongBinder(sender.asBinder());
2676 data.writeInterfaceToken(IActivityManager.descriptor);
2677 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2678 data.recycle();
2679 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002680 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002681 Parcel data = Parcel.obtain();
2682 Parcel reply = Parcel.obtain();
2683 data.writeInterfaceToken(IActivityManager.descriptor);
2684 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002685 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002686 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002687 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002688 boolean res = reply.readInt() != 0;
2689 data.recycle();
2690 reply.recycle();
2691 return res;
2692 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002693 public void startRunning(String pkg, String cls, String action,
2694 String indata) throws RemoteException {
2695 Parcel data = Parcel.obtain();
2696 Parcel reply = Parcel.obtain();
2697 data.writeInterfaceToken(IActivityManager.descriptor);
2698 data.writeString(pkg);
2699 data.writeString(cls);
2700 data.writeString(action);
2701 data.writeString(indata);
2702 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2703 reply.readException();
2704 data.recycle();
2705 reply.recycle();
2706 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002707 public boolean testIsSystemReady()
2708 {
2709 /* this base class version is never called */
2710 return true;
2711 }
Dan Egnor60d87622009-12-16 16:32:58 -08002712 public void handleApplicationCrash(IBinder app,
2713 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2714 {
2715 Parcel data = Parcel.obtain();
2716 Parcel reply = Parcel.obtain();
2717 data.writeInterfaceToken(IActivityManager.descriptor);
2718 data.writeStrongBinder(app);
2719 crashInfo.writeToParcel(data, 0);
2720 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2721 reply.readException();
2722 reply.recycle();
2723 data.recycle();
2724 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002725
Dan Egnor60d87622009-12-16 16:32:58 -08002726 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002727 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002728 {
2729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002733 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002734 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002735 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002737 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 reply.recycle();
2739 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002740 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002741 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002742
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002743 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002744 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002745 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002746 {
2747 Parcel data = Parcel.obtain();
2748 Parcel reply = Parcel.obtain();
2749 data.writeInterfaceToken(IActivityManager.descriptor);
2750 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002751 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002752 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002753 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2754 reply.readException();
2755 reply.recycle();
2756 data.recycle();
2757 }
2758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002759 public void signalPersistentProcesses(int sig) throws RemoteException {
2760 Parcel data = Parcel.obtain();
2761 Parcel reply = Parcel.obtain();
2762 data.writeInterfaceToken(IActivityManager.descriptor);
2763 data.writeInt(sig);
2764 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2765 reply.readException();
2766 data.recycle();
2767 reply.recycle();
2768 }
2769
Dianne Hackborn03abb812010-01-04 18:43:19 -08002770 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
2773 data.writeInterfaceToken(IActivityManager.descriptor);
2774 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002775 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2776 reply.readException();
2777 data.recycle();
2778 reply.recycle();
2779 }
2780
2781 public void forceStopPackage(String packageName) throws RemoteException {
2782 Parcel data = Parcel.obtain();
2783 Parcel reply = Parcel.obtain();
2784 data.writeInterfaceToken(IActivityManager.descriptor);
2785 data.writeString(packageName);
2786 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002787 reply.readException();
2788 data.recycle();
2789 reply.recycle();
2790 }
2791
2792 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2793 {
2794 Parcel data = Parcel.obtain();
2795 Parcel reply = Parcel.obtain();
2796 data.writeInterfaceToken(IActivityManager.descriptor);
2797 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2798 reply.readException();
2799 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2800 reply.recycle();
2801 data.recycle();
2802 return res;
2803 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002804
2805 public boolean profileControl(String process, boolean start,
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002806 String path, ParcelFileDescriptor fd) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002807 {
2808 Parcel data = Parcel.obtain();
2809 Parcel reply = Parcel.obtain();
2810 data.writeInterfaceToken(IActivityManager.descriptor);
2811 data.writeString(process);
2812 data.writeInt(start ? 1 : 0);
2813 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002814 if (fd != null) {
2815 data.writeInt(1);
2816 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2817 } else {
2818 data.writeInt(0);
2819 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002820 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 boolean res = reply.readInt() != 0;
2823 reply.recycle();
2824 data.recycle();
2825 return res;
2826 }
2827
Dianne Hackborn55280a92009-05-07 15:53:46 -07002828 public boolean shutdown(int timeout) throws RemoteException
2829 {
2830 Parcel data = Parcel.obtain();
2831 Parcel reply = Parcel.obtain();
2832 data.writeInterfaceToken(IActivityManager.descriptor);
2833 data.writeInt(timeout);
2834 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2835 reply.readException();
2836 boolean res = reply.readInt() != 0;
2837 reply.recycle();
2838 data.recycle();
2839 return res;
2840 }
2841
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002842 public void stopAppSwitches() throws RemoteException {
2843 Parcel data = Parcel.obtain();
2844 Parcel reply = Parcel.obtain();
2845 data.writeInterfaceToken(IActivityManager.descriptor);
2846 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2847 reply.readException();
2848 reply.recycle();
2849 data.recycle();
2850 }
2851
2852 public void resumeAppSwitches() throws RemoteException {
2853 Parcel data = Parcel.obtain();
2854 Parcel reply = Parcel.obtain();
2855 data.writeInterfaceToken(IActivityManager.descriptor);
2856 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2857 reply.readException();
2858 reply.recycle();
2859 data.recycle();
2860 }
2861
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002862 public void registerActivityWatcher(IActivityWatcher watcher)
2863 throws RemoteException {
2864 Parcel data = Parcel.obtain();
2865 Parcel reply = Parcel.obtain();
2866 data.writeInterfaceToken(IActivityManager.descriptor);
2867 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2868 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2869 reply.readException();
2870 data.recycle();
2871 reply.recycle();
2872 }
2873
2874 public void unregisterActivityWatcher(IActivityWatcher watcher)
2875 throws RemoteException {
2876 Parcel data = Parcel.obtain();
2877 Parcel reply = Parcel.obtain();
2878 data.writeInterfaceToken(IActivityManager.descriptor);
2879 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2880 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
2881 reply.readException();
2882 data.recycle();
2883 reply.recycle();
2884 }
2885
Dianne Hackborn2d91af02009-07-16 13:34:33 -07002886 public int startActivityInPackage(int uid,
2887 Intent intent, String resolvedType, IBinder resultTo,
2888 String resultWho, int requestCode, boolean onlyIfNeeded)
2889 throws RemoteException {
2890 Parcel data = Parcel.obtain();
2891 Parcel reply = Parcel.obtain();
2892 data.writeInterfaceToken(IActivityManager.descriptor);
2893 data.writeInt(uid);
2894 intent.writeToParcel(data, 0);
2895 data.writeString(resolvedType);
2896 data.writeStrongBinder(resultTo);
2897 data.writeString(resultWho);
2898 data.writeInt(requestCode);
2899 data.writeInt(onlyIfNeeded ? 1 : 0);
2900 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 int result = reply.readInt();
2903 reply.recycle();
2904 data.recycle();
2905 return result;
2906 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002907
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07002908 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 data.writeString(pkg);
2913 data.writeInt(uid);
2914 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
2915 reply.readException();
2916 data.recycle();
2917 reply.recycle();
2918 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07002919
2920 public void closeSystemDialogs(String reason) throws RemoteException {
2921 Parcel data = Parcel.obtain();
2922 Parcel reply = Parcel.obtain();
2923 data.writeInterfaceToken(IActivityManager.descriptor);
2924 data.writeString(reason);
2925 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 data.recycle();
2928 reply.recycle();
2929 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002930
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002931 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002932 throws RemoteException {
2933 Parcel data = Parcel.obtain();
2934 Parcel reply = Parcel.obtain();
2935 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002936 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002937 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
2938 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002939 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002940 data.recycle();
2941 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07002942 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07002943 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07002944
2945 public void killApplicationProcess(String processName, int uid) throws RemoteException {
2946 Parcel data = Parcel.obtain();
2947 Parcel reply = Parcel.obtain();
2948 data.writeInterfaceToken(IActivityManager.descriptor);
2949 data.writeString(processName);
2950 data.writeInt(uid);
2951 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
2952 reply.readException();
2953 data.recycle();
2954 reply.recycle();
2955 }
2956
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07002957 public void overridePendingTransition(IBinder token, String packageName,
2958 int enterAnim, int exitAnim) throws RemoteException {
2959 Parcel data = Parcel.obtain();
2960 Parcel reply = Parcel.obtain();
2961 data.writeInterfaceToken(IActivityManager.descriptor);
2962 data.writeStrongBinder(token);
2963 data.writeString(packageName);
2964 data.writeInt(enterAnim);
2965 data.writeInt(exitAnim);
2966 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
2967 reply.readException();
2968 data.recycle();
2969 reply.recycle();
2970 }
2971
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08002972 public boolean isUserAMonkey() throws RemoteException {
2973 Parcel data = Parcel.obtain();
2974 Parcel reply = Parcel.obtain();
2975 data.writeInterfaceToken(IActivityManager.descriptor);
2976 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
2977 reply.readException();
2978 boolean res = reply.readInt() != 0;
2979 data.recycle();
2980 reply.recycle();
2981 return res;
2982 }
2983
Dianne Hackborn860755f2010-06-03 18:47:52 -07002984 public void finishHeavyWeightApp() throws RemoteException {
2985 Parcel data = Parcel.obtain();
2986 Parcel reply = Parcel.obtain();
2987 data.writeInterfaceToken(IActivityManager.descriptor);
2988 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
2989 reply.readException();
2990 data.recycle();
2991 reply.recycle();
2992 }
2993
Daniel Sandler69a48172010-06-23 16:29:36 -04002994 public void setImmersive(IBinder token, boolean immersive)
2995 throws RemoteException {
2996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
2999 data.writeStrongBinder(token);
3000 data.writeInt(immersive ? 1 : 0);
3001 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3002 reply.readException();
3003 data.recycle();
3004 reply.recycle();
3005 }
3006
3007 public boolean isImmersive(IBinder token)
3008 throws RemoteException {
3009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
3011 data.writeInterfaceToken(IActivityManager.descriptor);
3012 data.writeStrongBinder(token);
3013 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003014 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003015 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003016 data.recycle();
3017 reply.recycle();
3018 return res;
3019 }
3020
3021 public boolean isTopActivityImmersive()
3022 throws RemoteException {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003027 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003028 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003029 data.recycle();
3030 reply.recycle();
3031 return res;
3032 }
3033
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003034 public void crashApplication(int uid, int initialPid, String packageName,
3035 String message) throws RemoteException {
3036 Parcel data = Parcel.obtain();
3037 Parcel reply = Parcel.obtain();
3038 data.writeInterfaceToken(IActivityManager.descriptor);
3039 data.writeInt(uid);
3040 data.writeInt(initialPid);
3041 data.writeString(packageName);
3042 data.writeString(message);
3043 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 data.recycle();
3046 reply.recycle();
3047 }
Andy McFadden824c5102010-07-09 16:26:57 -07003048
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003049 public String getProviderMimeType(Uri uri)
3050 throws RemoteException {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 uri.writeToParcel(data, 0);
3055 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 String res = reply.readString();
3058 data.recycle();
3059 reply.recycle();
3060 return res;
3061 }
3062
Dianne Hackborn7e269642010-08-25 19:50:20 -07003063 public IBinder newUriPermissionOwner(String name)
3064 throws RemoteException {
3065 Parcel data = Parcel.obtain();
3066 Parcel reply = Parcel.obtain();
3067 data.writeInterfaceToken(IActivityManager.descriptor);
3068 data.writeString(name);
3069 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3070 reply.readException();
3071 IBinder res = reply.readStrongBinder();
3072 data.recycle();
3073 reply.recycle();
3074 return res;
3075 }
3076
3077 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3078 Uri uri, int mode) throws RemoteException {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeStrongBinder(owner);
3083 data.writeInt(fromUid);
3084 data.writeString(targetPkg);
3085 uri.writeToParcel(data, 0);
3086 data.writeInt(mode);
3087 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3088 reply.readException();
3089 data.recycle();
3090 reply.recycle();
3091 }
3092
3093 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3094 int mode) throws RemoteException {
3095 Parcel data = Parcel.obtain();
3096 Parcel reply = Parcel.obtain();
3097 data.writeInterfaceToken(IActivityManager.descriptor);
3098 data.writeStrongBinder(owner);
3099 if (uri != null) {
3100 data.writeInt(1);
3101 uri.writeToParcel(data, 0);
3102 } else {
3103 data.writeInt(0);
3104 }
3105 data.writeInt(mode);
3106 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3107 reply.readException();
3108 data.recycle();
3109 reply.recycle();
3110 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003111
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003112 public int checkGrantUriPermission(int callingUid, String targetPkg,
3113 Uri uri, int modeFlags) throws RemoteException {
3114 Parcel data = Parcel.obtain();
3115 Parcel reply = Parcel.obtain();
3116 data.writeInterfaceToken(IActivityManager.descriptor);
3117 data.writeInt(callingUid);
3118 data.writeString(targetPkg);
3119 uri.writeToParcel(data, 0);
3120 data.writeInt(modeFlags);
3121 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3122 reply.readException();
3123 int res = reply.readInt();
3124 data.recycle();
3125 reply.recycle();
3126 return res;
3127 }
3128
Andy McFadden824c5102010-07-09 16:26:57 -07003129 public boolean dumpHeap(String process, boolean managed,
3130 String path, ParcelFileDescriptor fd) throws RemoteException {
3131 Parcel data = Parcel.obtain();
3132 Parcel reply = Parcel.obtain();
3133 data.writeInterfaceToken(IActivityManager.descriptor);
3134 data.writeString(process);
3135 data.writeInt(managed ? 1 : 0);
3136 data.writeString(path);
3137 if (fd != null) {
3138 data.writeInt(1);
3139 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3140 } else {
3141 data.writeInt(0);
3142 }
3143 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3144 reply.readException();
3145 boolean res = reply.readInt() != 0;
3146 reply.recycle();
3147 data.recycle();
3148 return res;
3149 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003150
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003151 public int startActivities(IApplicationThread caller,
3152 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3157 data.writeTypedArray(intents, 0);
3158 data.writeStringArray(resolvedTypes);
3159 data.writeStrongBinder(resultTo);
3160 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3161 reply.readException();
3162 int result = reply.readInt();
3163 reply.recycle();
3164 data.recycle();
3165 return result;
3166 }
3167
3168 public int startActivitiesInPackage(int uid,
3169 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 data.writeInt(uid);
3174 data.writeTypedArray(intents, 0);
3175 data.writeStringArray(resolvedTypes);
3176 data.writeStrongBinder(resultTo);
3177 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 int result = reply.readInt();
3180 reply.recycle();
3181 data.recycle();
3182 return result;
3183 }
3184
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003185 public void setPackageScreenCompatMode(String packageName, boolean compatEnabled)
3186 throws RemoteException {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeString(packageName);
3191 data.writeInt(compatEnabled ? 1 : 0);
3192 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 reply.recycle();
3195 data.recycle();
3196 }
3197
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003198 public boolean switchUser(int userid) throws RemoteException {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 data.writeInt(userid);
3203 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 boolean result = reply.readInt() != 0;
3206 reply.recycle();
3207 data.recycle();
3208 return result;
3209 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003210
3211 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeInt(taskId);
3216 data.writeInt(subTaskIndex);
3217 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3218 reply.readException();
3219 boolean result = reply.readInt() != 0;
3220 reply.recycle();
3221 data.recycle();
3222 return result;
3223 }
3224
3225 public boolean removeTask(int taskId, int flags) throws RemoteException {
3226 Parcel data = Parcel.obtain();
3227 Parcel reply = Parcel.obtain();
3228 data.writeInterfaceToken(IActivityManager.descriptor);
3229 data.writeInt(taskId);
3230 data.writeInt(flags);
3231 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3232 reply.readException();
3233 boolean result = reply.readInt() != 0;
3234 reply.recycle();
3235 data.recycle();
3236 return result;
3237 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003238
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 private IBinder mRemote;
3240}