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