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