blob: 77997796a8f772dc6516ac1577406a50744861cd [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.Intent;
21import android.content.IntentFilter;
Suchi Amalapurapu1ccac752009-06-12 10:09:58 -070022import android.content.IIntentSender;
23import android.content.IIntentReceiver;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
28import android.content.res.Configuration;
29import android.graphics.Bitmap;
30import android.net.Uri;
31import android.os.Binder;
32import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070033import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.os.Parcelable;
35import android.os.ParcelFileDescriptor;
36import android.os.RemoteException;
37import android.os.IBinder;
38import android.os.Parcel;
39import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070040import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080043import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import java.util.ArrayList;
46import java.util.List;
47
48/** {@hide} */
49public abstract class ActivityManagerNative extends Binder implements IActivityManager
50{
51 /**
52 * Cast a Binder object into an activity manager interface, generating
53 * a proxy if needed.
54 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080055 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056 if (obj == null) {
57 return null;
58 }
59 IActivityManager in =
60 (IActivityManager)obj.queryLocalInterface(descriptor);
61 if (in != null) {
62 return in;
63 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080064
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065 return new ActivityManagerProxy(obj);
66 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080067
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 /**
69 * Retrieve the system's default/global activity manager.
70 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080071 static public IActivityManager getDefault() {
72 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 }
74
75 /**
76 * Convenience for checking whether the system is ready. For internal use only.
77 */
78 static public boolean isSystemReady() {
79 if (!sSystemReady) {
80 sSystemReady = getDefault().testIsSystemReady();
81 }
82 return sSystemReady;
83 }
84 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080085
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 /**
87 * Convenience for sending a sticky broadcast. For internal use only.
88 * If you don't care about permission, use null.
89 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080090 static public void broadcastStickyIntent(Intent intent, String permission) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 try {
92 getDefault().broadcastIntent(
93 null, intent, null, null, Activity.RESULT_OK, null, null,
94 null /*permission*/, false, true);
95 } catch (RemoteException ex) {
96 }
97 }
98
99 static public void noteWakeupAlarm(PendingIntent ps) {
100 try {
101 getDefault().noteWakeupAlarm(ps.getTarget());
102 } catch (RemoteException ex) {
103 }
104 }
105
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800106 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 attachInterface(this, descriptor);
108 }
109
110 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
111 throws RemoteException {
112 switch (code) {
113 case START_ACTIVITY_TRANSACTION:
114 {
115 data.enforceInterface(IActivityManager.descriptor);
116 IBinder b = data.readStrongBinder();
117 IApplicationThread app = ApplicationThreadNative.asInterface(b);
118 Intent intent = Intent.CREATOR.createFromParcel(data);
119 String resolvedType = data.readString();
120 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
121 int grantedMode = data.readInt();
122 IBinder resultTo = data.readStrongBinder();
123 String resultWho = data.readString();
124 int requestCode = data.readInt();
125 boolean onlyIfNeeded = data.readInt() != 0;
126 boolean debug = data.readInt() != 0;
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700127 String profileFile = data.readString();
128 ParcelFileDescriptor profileFd = data.readInt() != 0
129 ? data.readFileDescriptor() : null;
130 boolean autoStopProfiler = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int result = startActivity(app, intent, resolvedType,
132 grantedUriPermissions, grantedMode, resultTo, resultWho,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700133 requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800139 case START_ACTIVITY_AND_WAIT_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
144 Intent intent = Intent.CREATOR.createFromParcel(data);
145 String resolvedType = data.readString();
146 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
147 int grantedMode = data.readInt();
148 IBinder resultTo = data.readStrongBinder();
149 String resultWho = data.readString();
150 int requestCode = data.readInt();
151 boolean onlyIfNeeded = data.readInt() != 0;
152 boolean debug = data.readInt() != 0;
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700153 String profileFile = data.readString();
154 ParcelFileDescriptor profileFd = data.readInt() != 0
155 ? data.readFileDescriptor() : null;
156 boolean autoStopProfiler = data.readInt() != 0;
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800157 WaitResult result = startActivityAndWait(app, intent, resolvedType,
158 grantedUriPermissions, grantedMode, resultTo, resultWho,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700159 requestCode, onlyIfNeeded, debug, profileFile, profileFd, autoStopProfiler);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800160 reply.writeNoException();
161 result.writeToParcel(reply, 0);
162 return true;
163 }
164
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700165 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
166 {
167 data.enforceInterface(IActivityManager.descriptor);
168 IBinder b = data.readStrongBinder();
169 IApplicationThread app = ApplicationThreadNative.asInterface(b);
170 Intent intent = Intent.CREATOR.createFromParcel(data);
171 String resolvedType = data.readString();
172 Uri[] grantedUriPermissions = data.createTypedArray(Uri.CREATOR);
173 int grantedMode = data.readInt();
174 IBinder resultTo = data.readStrongBinder();
175 String resultWho = data.readString();
176 int requestCode = data.readInt();
177 boolean onlyIfNeeded = data.readInt() != 0;
178 boolean debug = data.readInt() != 0;
179 Configuration config = Configuration.CREATOR.createFromParcel(data);
180 int result = startActivityWithConfig(app, intent, resolvedType,
181 grantedUriPermissions, grantedMode, resultTo, resultWho,
182 requestCode, onlyIfNeeded, debug, config);
183 reply.writeNoException();
184 reply.writeInt(result);
185 return true;
186 }
187
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700188 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700189 {
190 data.enforceInterface(IActivityManager.descriptor);
191 IBinder b = data.readStrongBinder();
192 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700193 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700194 Intent fillInIntent = null;
195 if (data.readInt() != 0) {
196 fillInIntent = Intent.CREATOR.createFromParcel(data);
197 }
198 String resolvedType = data.readString();
199 IBinder resultTo = data.readStrongBinder();
200 String resultWho = data.readString();
201 int requestCode = data.readInt();
202 int flagsMask = data.readInt();
203 int flagsValues = data.readInt();
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700204 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700205 fillInIntent, resolvedType, resultTo, resultWho,
206 requestCode, flagsMask, flagsValues);
207 reply.writeNoException();
208 reply.writeInt(result);
209 return true;
210 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800211
212 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
213 {
214 data.enforceInterface(IActivityManager.descriptor);
215 IBinder callingActivity = data.readStrongBinder();
216 Intent intent = Intent.CREATOR.createFromParcel(data);
217 boolean result = startNextMatchingActivity(callingActivity, intent);
218 reply.writeNoException();
219 reply.writeInt(result ? 1 : 0);
220 return true;
221 }
222
223 case FINISH_ACTIVITY_TRANSACTION: {
224 data.enforceInterface(IActivityManager.descriptor);
225 IBinder token = data.readStrongBinder();
226 Intent resultData = null;
227 int resultCode = data.readInt();
228 if (data.readInt() != 0) {
229 resultData = Intent.CREATOR.createFromParcel(data);
230 }
231 boolean res = finishActivity(token, resultCode, resultData);
232 reply.writeNoException();
233 reply.writeInt(res ? 1 : 0);
234 return true;
235 }
236
237 case FINISH_SUB_ACTIVITY_TRANSACTION: {
238 data.enforceInterface(IActivityManager.descriptor);
239 IBinder token = data.readStrongBinder();
240 String resultWho = data.readString();
241 int requestCode = data.readInt();
242 finishSubActivity(token, resultWho, requestCode);
243 reply.writeNoException();
244 return true;
245 }
246
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800247 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
248 data.enforceInterface(IActivityManager.descriptor);
249 IBinder token = data.readStrongBinder();
250 boolean res = willActivityBeVisible(token);
251 reply.writeNoException();
252 reply.writeInt(res ? 1 : 0);
253 return true;
254 }
255
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800256 case REGISTER_RECEIVER_TRANSACTION:
257 {
258 data.enforceInterface(IActivityManager.descriptor);
259 IBinder b = data.readStrongBinder();
260 IApplicationThread app =
261 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700262 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800263 b = data.readStrongBinder();
264 IIntentReceiver rec
265 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
266 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
267 String perm = data.readString();
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700268 Intent intent = registerReceiver(app, packageName, rec, filter, perm);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800269 reply.writeNoException();
270 if (intent != null) {
271 reply.writeInt(1);
272 intent.writeToParcel(reply, 0);
273 } else {
274 reply.writeInt(0);
275 }
276 return true;
277 }
278
279 case UNREGISTER_RECEIVER_TRANSACTION:
280 {
281 data.enforceInterface(IActivityManager.descriptor);
282 IBinder b = data.readStrongBinder();
283 if (b == null) {
284 return true;
285 }
286 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
287 unregisterReceiver(rec);
288 reply.writeNoException();
289 return true;
290 }
291
292 case BROADCAST_INTENT_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder b = data.readStrongBinder();
296 IApplicationThread app =
297 b != null ? ApplicationThreadNative.asInterface(b) : null;
298 Intent intent = Intent.CREATOR.createFromParcel(data);
299 String resolvedType = data.readString();
300 b = data.readStrongBinder();
301 IIntentReceiver resultTo =
302 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
303 int resultCode = data.readInt();
304 String resultData = data.readString();
305 Bundle resultExtras = data.readBundle();
306 String perm = data.readString();
307 boolean serialized = data.readInt() != 0;
308 boolean sticky = data.readInt() != 0;
309 int res = broadcastIntent(app, intent, resolvedType, resultTo,
310 resultCode, resultData, resultExtras, perm,
311 serialized, sticky);
312 reply.writeNoException();
313 reply.writeInt(res);
314 return true;
315 }
316
317 case UNBROADCAST_INTENT_TRANSACTION:
318 {
319 data.enforceInterface(IActivityManager.descriptor);
320 IBinder b = data.readStrongBinder();
321 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
322 Intent intent = Intent.CREATOR.createFromParcel(data);
323 unbroadcastIntent(app, intent);
324 reply.writeNoException();
325 return true;
326 }
327
328 case FINISH_RECEIVER_TRANSACTION: {
329 data.enforceInterface(IActivityManager.descriptor);
330 IBinder who = data.readStrongBinder();
331 int resultCode = data.readInt();
332 String resultData = data.readString();
333 Bundle resultExtras = data.readBundle();
334 boolean resultAbort = data.readInt() != 0;
335 if (who != null) {
336 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
337 }
338 reply.writeNoException();
339 return true;
340 }
341
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800342 case ATTACH_APPLICATION_TRANSACTION: {
343 data.enforceInterface(IActivityManager.descriptor);
344 IApplicationThread app = ApplicationThreadNative.asInterface(
345 data.readStrongBinder());
346 if (app != null) {
347 attachApplication(app);
348 }
349 reply.writeNoException();
350 return true;
351 }
352
353 case ACTIVITY_IDLE_TRANSACTION: {
354 data.enforceInterface(IActivityManager.descriptor);
355 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700356 Configuration config = null;
357 if (data.readInt() != 0) {
358 config = Configuration.CREATOR.createFromParcel(data);
359 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700360 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700362 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 }
364 reply.writeNoException();
365 return true;
366 }
367
368 case ACTIVITY_PAUSED_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800371 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 reply.writeNoException();
373 return true;
374 }
375
376 case ACTIVITY_STOPPED_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800379 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 Bitmap thumbnail = data.readInt() != 0
381 ? Bitmap.CREATOR.createFromParcel(data) : null;
382 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800383 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 reply.writeNoException();
385 return true;
386 }
387
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800388 case ACTIVITY_SLEPT_TRANSACTION: {
389 data.enforceInterface(IActivityManager.descriptor);
390 IBinder token = data.readStrongBinder();
391 activitySlept(token);
392 reply.writeNoException();
393 return true;
394 }
395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 case ACTIVITY_DESTROYED_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
399 activityDestroyed(token);
400 reply.writeNoException();
401 return true;
402 }
403
404 case GET_CALLING_PACKAGE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 String res = token != null ? getCallingPackage(token) : null;
408 reply.writeNoException();
409 reply.writeString(res);
410 return true;
411 }
412
413 case GET_CALLING_ACTIVITY_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder token = data.readStrongBinder();
416 ComponentName cn = getCallingActivity(token);
417 reply.writeNoException();
418 ComponentName.writeToParcel(cn, reply);
419 return true;
420 }
421
422 case GET_TASKS_TRANSACTION: {
423 data.enforceInterface(IActivityManager.descriptor);
424 int maxNum = data.readInt();
425 int fl = data.readInt();
426 IBinder receiverBinder = data.readStrongBinder();
427 IThumbnailReceiver receiver = receiverBinder != null
428 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
429 : null;
430 List list = getTasks(maxNum, fl, receiver);
431 reply.writeNoException();
432 int N = list != null ? list.size() : -1;
433 reply.writeInt(N);
434 int i;
435 for (i=0; i<N; i++) {
436 ActivityManager.RunningTaskInfo info =
437 (ActivityManager.RunningTaskInfo)list.get(i);
438 info.writeToParcel(reply, 0);
439 }
440 return true;
441 }
442
443 case GET_RECENT_TASKS_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 int maxNum = data.readInt();
446 int fl = data.readInt();
447 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
448 fl);
449 reply.writeNoException();
450 reply.writeTypedList(list);
451 return true;
452 }
453
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700454 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800455 data.enforceInterface(IActivityManager.descriptor);
456 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700457 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800458 reply.writeNoException();
459 if (bm != null) {
460 reply.writeInt(1);
461 bm.writeToParcel(reply, 0);
462 } else {
463 reply.writeInt(0);
464 }
465 return true;
466 }
467
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 case GET_SERVICES_TRANSACTION: {
469 data.enforceInterface(IActivityManager.descriptor);
470 int maxNum = data.readInt();
471 int fl = data.readInt();
472 List list = getServices(maxNum, fl);
473 reply.writeNoException();
474 int N = list != null ? list.size() : -1;
475 reply.writeInt(N);
476 int i;
477 for (i=0; i<N; i++) {
478 ActivityManager.RunningServiceInfo info =
479 (ActivityManager.RunningServiceInfo)list.get(i);
480 info.writeToParcel(reply, 0);
481 }
482 return true;
483 }
484
485 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
486 data.enforceInterface(IActivityManager.descriptor);
487 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
488 reply.writeNoException();
489 reply.writeTypedList(list);
490 return true;
491 }
492
493 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
494 data.enforceInterface(IActivityManager.descriptor);
495 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
496 reply.writeNoException();
497 reply.writeTypedList(list);
498 return true;
499 }
500
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700501 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
502 data.enforceInterface(IActivityManager.descriptor);
503 List<ApplicationInfo> list = getRunningExternalApplications();
504 reply.writeNoException();
505 reply.writeTypedList(list);
506 return true;
507 }
508
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 case MOVE_TASK_TO_FRONT_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800512 int fl = data.readInt();
513 moveTaskToFront(task, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 return true;
516 }
517
518 case MOVE_TASK_TO_BACK_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 int task = data.readInt();
521 moveTaskToBack(task);
522 reply.writeNoException();
523 return true;
524 }
525
526 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
527 data.enforceInterface(IActivityManager.descriptor);
528 IBinder token = data.readStrongBinder();
529 boolean nonRoot = data.readInt() != 0;
530 boolean res = moveActivityTaskToBack(token, nonRoot);
531 reply.writeNoException();
532 reply.writeInt(res ? 1 : 0);
533 return true;
534 }
535
536 case MOVE_TASK_BACKWARDS_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 int task = data.readInt();
539 moveTaskBackwards(task);
540 reply.writeNoException();
541 return true;
542 }
543
544 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
547 boolean onlyRoot = data.readInt() != 0;
548 int res = token != null
549 ? getTaskForActivity(token, onlyRoot) : -1;
550 reply.writeNoException();
551 reply.writeInt(res);
552 return true;
553 }
554
555 case FINISH_OTHER_INSTANCES_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 ComponentName className = ComponentName.readFromParcel(data);
559 finishOtherInstances(token, className);
560 reply.writeNoException();
561 return true;
562 }
563
564 case REPORT_THUMBNAIL_TRANSACTION: {
565 data.enforceInterface(IActivityManager.descriptor);
566 IBinder token = data.readStrongBinder();
567 Bitmap thumbnail = data.readInt() != 0
568 ? Bitmap.CREATOR.createFromParcel(data) : null;
569 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
570 reportThumbnail(token, thumbnail, description);
571 reply.writeNoException();
572 return true;
573 }
574
575 case GET_CONTENT_PROVIDER_TRANSACTION: {
576 data.enforceInterface(IActivityManager.descriptor);
577 IBinder b = data.readStrongBinder();
578 IApplicationThread app = ApplicationThreadNative.asInterface(b);
579 String name = data.readString();
580 ContentProviderHolder cph = getContentProvider(app, name);
581 reply.writeNoException();
582 if (cph != null) {
583 reply.writeInt(1);
584 cph.writeToParcel(reply, 0);
585 } else {
586 reply.writeInt(0);
587 }
588 return true;
589 }
590
591 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
592 data.enforceInterface(IActivityManager.descriptor);
593 IBinder b = data.readStrongBinder();
594 IApplicationThread app = ApplicationThreadNative.asInterface(b);
595 ArrayList<ContentProviderHolder> providers =
596 data.createTypedArrayList(ContentProviderHolder.CREATOR);
597 publishContentProviders(app, providers);
598 reply.writeNoException();
599 return true;
600 }
601
602 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
603 data.enforceInterface(IActivityManager.descriptor);
604 IBinder b = data.readStrongBinder();
605 IApplicationThread app = ApplicationThreadNative.asInterface(b);
606 String name = data.readString();
607 removeContentProvider(app, name);
608 reply.writeNoException();
609 return true;
610 }
611
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700612 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
613 data.enforceInterface(IActivityManager.descriptor);
614 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
615 PendingIntent pi = getRunningServiceControlPanel(comp);
616 reply.writeNoException();
617 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
618 return true;
619 }
620
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 case START_SERVICE_TRANSACTION: {
622 data.enforceInterface(IActivityManager.descriptor);
623 IBinder b = data.readStrongBinder();
624 IApplicationThread app = ApplicationThreadNative.asInterface(b);
625 Intent service = Intent.CREATOR.createFromParcel(data);
626 String resolvedType = data.readString();
627 ComponentName cn = startService(app, service, resolvedType);
628 reply.writeNoException();
629 ComponentName.writeToParcel(cn, reply);
630 return true;
631 }
632
633 case STOP_SERVICE_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 IBinder b = data.readStrongBinder();
636 IApplicationThread app = ApplicationThreadNative.asInterface(b);
637 Intent service = Intent.CREATOR.createFromParcel(data);
638 String resolvedType = data.readString();
639 int res = stopService(app, service, resolvedType);
640 reply.writeNoException();
641 reply.writeInt(res);
642 return true;
643 }
644
645 case STOP_SERVICE_TOKEN_TRANSACTION: {
646 data.enforceInterface(IActivityManager.descriptor);
647 ComponentName className = ComponentName.readFromParcel(data);
648 IBinder token = data.readStrongBinder();
649 int startId = data.readInt();
650 boolean res = stopServiceToken(className, token, startId);
651 reply.writeNoException();
652 reply.writeInt(res ? 1 : 0);
653 return true;
654 }
655
656 case SET_SERVICE_FOREGROUND_TRANSACTION: {
657 data.enforceInterface(IActivityManager.descriptor);
658 ComponentName className = ComponentName.readFromParcel(data);
659 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700660 int id = data.readInt();
661 Notification notification = null;
662 if (data.readInt() != 0) {
663 notification = Notification.CREATOR.createFromParcel(data);
664 }
665 boolean removeNotification = data.readInt() != 0;
666 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800667 reply.writeNoException();
668 return true;
669 }
670
671 case BIND_SERVICE_TRANSACTION: {
672 data.enforceInterface(IActivityManager.descriptor);
673 IBinder b = data.readStrongBinder();
674 IApplicationThread app = ApplicationThreadNative.asInterface(b);
675 IBinder token = data.readStrongBinder();
676 Intent service = Intent.CREATOR.createFromParcel(data);
677 String resolvedType = data.readString();
678 b = data.readStrongBinder();
679 int fl = data.readInt();
680 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
681 int res = bindService(app, token, service, resolvedType, conn, fl);
682 reply.writeNoException();
683 reply.writeInt(res);
684 return true;
685 }
686
687 case UNBIND_SERVICE_TRANSACTION: {
688 data.enforceInterface(IActivityManager.descriptor);
689 IBinder b = data.readStrongBinder();
690 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
691 boolean res = unbindService(conn);
692 reply.writeNoException();
693 reply.writeInt(res ? 1 : 0);
694 return true;
695 }
696
697 case PUBLISH_SERVICE_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 IBinder token = data.readStrongBinder();
700 Intent intent = Intent.CREATOR.createFromParcel(data);
701 IBinder service = data.readStrongBinder();
702 publishService(token, intent, service);
703 reply.writeNoException();
704 return true;
705 }
706
707 case UNBIND_FINISHED_TRANSACTION: {
708 data.enforceInterface(IActivityManager.descriptor);
709 IBinder token = data.readStrongBinder();
710 Intent intent = Intent.CREATOR.createFromParcel(data);
711 boolean doRebind = data.readInt() != 0;
712 unbindFinished(token, intent, doRebind);
713 reply.writeNoException();
714 return true;
715 }
716
717 case SERVICE_DONE_EXECUTING_TRANSACTION: {
718 data.enforceInterface(IActivityManager.descriptor);
719 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700720 int type = data.readInt();
721 int startId = data.readInt();
722 int res = data.readInt();
723 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 reply.writeNoException();
725 return true;
726 }
727
728 case START_INSTRUMENTATION_TRANSACTION: {
729 data.enforceInterface(IActivityManager.descriptor);
730 ComponentName className = ComponentName.readFromParcel(data);
731 String profileFile = data.readString();
732 int fl = data.readInt();
733 Bundle arguments = data.readBundle();
734 IBinder b = data.readStrongBinder();
735 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
736 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
737 reply.writeNoException();
738 reply.writeInt(res ? 1 : 0);
739 return true;
740 }
741
742
743 case FINISH_INSTRUMENTATION_TRANSACTION: {
744 data.enforceInterface(IActivityManager.descriptor);
745 IBinder b = data.readStrongBinder();
746 IApplicationThread app = ApplicationThreadNative.asInterface(b);
747 int resultCode = data.readInt();
748 Bundle results = data.readBundle();
749 finishInstrumentation(app, resultCode, results);
750 reply.writeNoException();
751 return true;
752 }
753
754 case GET_CONFIGURATION_TRANSACTION: {
755 data.enforceInterface(IActivityManager.descriptor);
756 Configuration config = getConfiguration();
757 reply.writeNoException();
758 config.writeToParcel(reply, 0);
759 return true;
760 }
761
762 case UPDATE_CONFIGURATION_TRANSACTION: {
763 data.enforceInterface(IActivityManager.descriptor);
764 Configuration config = Configuration.CREATOR.createFromParcel(data);
765 updateConfiguration(config);
766 reply.writeNoException();
767 return true;
768 }
769
770 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 IBinder token = data.readStrongBinder();
773 int requestedOrientation = data.readInt();
774 setRequestedOrientation(token, requestedOrientation);
775 reply.writeNoException();
776 return true;
777 }
778
779 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
780 data.enforceInterface(IActivityManager.descriptor);
781 IBinder token = data.readStrongBinder();
782 int req = getRequestedOrientation(token);
783 reply.writeNoException();
784 reply.writeInt(req);
785 return true;
786 }
787
788 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder token = data.readStrongBinder();
791 ComponentName cn = getActivityClassForToken(token);
792 reply.writeNoException();
793 ComponentName.writeToParcel(cn, reply);
794 return true;
795 }
796
797 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 IBinder token = data.readStrongBinder();
800 reply.writeNoException();
801 reply.writeString(getPackageForToken(token));
802 return true;
803 }
804
805 case GET_INTENT_SENDER_TRANSACTION: {
806 data.enforceInterface(IActivityManager.descriptor);
807 int type = data.readInt();
808 String packageName = data.readString();
809 IBinder token = data.readStrongBinder();
810 String resultWho = data.readString();
811 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800812 Intent[] requestIntents;
813 String[] requestResolvedTypes;
814 if (data.readInt() != 0) {
815 requestIntents = data.createTypedArray(Intent.CREATOR);
816 requestResolvedTypes = data.createStringArray();
817 } else {
818 requestIntents = null;
819 requestResolvedTypes = null;
820 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800821 int fl = data.readInt();
822 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800823 resultWho, requestCode, requestIntents,
824 requestResolvedTypes, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 reply.writeNoException();
826 reply.writeStrongBinder(res != null ? res.asBinder() : null);
827 return true;
828 }
829
830 case CANCEL_INTENT_SENDER_TRANSACTION: {
831 data.enforceInterface(IActivityManager.descriptor);
832 IIntentSender r = IIntentSender.Stub.asInterface(
833 data.readStrongBinder());
834 cancelIntentSender(r);
835 reply.writeNoException();
836 return true;
837 }
838
839 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
840 data.enforceInterface(IActivityManager.descriptor);
841 IIntentSender r = IIntentSender.Stub.asInterface(
842 data.readStrongBinder());
843 String res = getPackageForIntentSender(r);
844 reply.writeNoException();
845 reply.writeString(res);
846 return true;
847 }
848
849 case SET_PROCESS_LIMIT_TRANSACTION: {
850 data.enforceInterface(IActivityManager.descriptor);
851 int max = data.readInt();
852 setProcessLimit(max);
853 reply.writeNoException();
854 return true;
855 }
856
857 case GET_PROCESS_LIMIT_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 int limit = getProcessLimit();
860 reply.writeNoException();
861 reply.writeInt(limit);
862 return true;
863 }
864
865 case SET_PROCESS_FOREGROUND_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder token = data.readStrongBinder();
868 int pid = data.readInt();
869 boolean isForeground = data.readInt() != 0;
870 setProcessForeground(token, pid, isForeground);
871 reply.writeNoException();
872 return true;
873 }
874
875 case CHECK_PERMISSION_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 String perm = data.readString();
878 int pid = data.readInt();
879 int uid = data.readInt();
880 int res = checkPermission(perm, pid, uid);
881 reply.writeNoException();
882 reply.writeInt(res);
883 return true;
884 }
885
886 case CHECK_URI_PERMISSION_TRANSACTION: {
887 data.enforceInterface(IActivityManager.descriptor);
888 Uri uri = Uri.CREATOR.createFromParcel(data);
889 int pid = data.readInt();
890 int uid = data.readInt();
891 int mode = data.readInt();
892 int res = checkUriPermission(uri, pid, uid, mode);
893 reply.writeNoException();
894 reply.writeInt(res);
895 return true;
896 }
897
898 case CLEAR_APP_DATA_TRANSACTION: {
899 data.enforceInterface(IActivityManager.descriptor);
900 String packageName = data.readString();
901 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
902 data.readStrongBinder());
903 boolean res = clearApplicationUserData(packageName, observer);
904 reply.writeNoException();
905 reply.writeInt(res ? 1 : 0);
906 return true;
907 }
908
909 case GRANT_URI_PERMISSION_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 IBinder b = data.readStrongBinder();
912 IApplicationThread app = ApplicationThreadNative.asInterface(b);
913 String targetPkg = data.readString();
914 Uri uri = Uri.CREATOR.createFromParcel(data);
915 int mode = data.readInt();
916 grantUriPermission(app, targetPkg, uri, mode);
917 reply.writeNoException();
918 return true;
919 }
920
921 case REVOKE_URI_PERMISSION_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 IBinder b = data.readStrongBinder();
924 IApplicationThread app = ApplicationThreadNative.asInterface(b);
925 Uri uri = Uri.CREATOR.createFromParcel(data);
926 int mode = data.readInt();
927 revokeUriPermission(app, uri, mode);
928 reply.writeNoException();
929 return true;
930 }
931
932 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IBinder b = data.readStrongBinder();
935 IApplicationThread app = ApplicationThreadNative.asInterface(b);
936 boolean waiting = data.readInt() != 0;
937 showWaitingForDebugger(app, waiting);
938 reply.writeNoException();
939 return true;
940 }
941
942 case GET_MEMORY_INFO_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
945 getMemoryInfo(mi);
946 reply.writeNoException();
947 mi.writeToParcel(reply, 0);
948 return true;
949 }
950
951 case UNHANDLED_BACK_TRANSACTION: {
952 data.enforceInterface(IActivityManager.descriptor);
953 unhandledBack();
954 reply.writeNoException();
955 return true;
956 }
957
958 case OPEN_CONTENT_URI_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 Uri uri = Uri.parse(data.readString());
961 ParcelFileDescriptor pfd = openContentUri(uri);
962 reply.writeNoException();
963 if (pfd != null) {
964 reply.writeInt(1);
965 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
966 } else {
967 reply.writeInt(0);
968 }
969 return true;
970 }
971
972 case GOING_TO_SLEEP_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 goingToSleep();
975 reply.writeNoException();
976 return true;
977 }
978
979 case WAKING_UP_TRANSACTION: {
980 data.enforceInterface(IActivityManager.descriptor);
981 wakingUp();
982 reply.writeNoException();
983 return true;
984 }
985
986 case SET_DEBUG_APP_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 String pn = data.readString();
989 boolean wfd = data.readInt() != 0;
990 boolean per = data.readInt() != 0;
991 setDebugApp(pn, wfd, per);
992 reply.writeNoException();
993 return true;
994 }
995
996 case SET_ALWAYS_FINISH_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 boolean enabled = data.readInt() != 0;
999 setAlwaysFinish(enabled);
1000 reply.writeNoException();
1001 return true;
1002 }
1003
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001004 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001006 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001007 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001008 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001009 return true;
1010 }
1011
1012 case ENTER_SAFE_MODE_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 enterSafeMode();
1015 reply.writeNoException();
1016 return true;
1017 }
1018
1019 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 IIntentSender is = IIntentSender.Stub.asInterface(
1022 data.readStrongBinder());
1023 noteWakeupAlarm(is);
1024 reply.writeNoException();
1025 return true;
1026 }
1027
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001028 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001029 data.enforceInterface(IActivityManager.descriptor);
1030 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001031 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001032 boolean secure = data.readInt() != 0;
1033 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 reply.writeNoException();
1035 reply.writeInt(res ? 1 : 0);
1036 return true;
1037 }
1038
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001039 case START_RUNNING_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 String pkg = data.readString();
1042 String cls = data.readString();
1043 String action = data.readString();
1044 String indata = data.readString();
1045 startRunning(pkg, cls, action, indata);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
Dan Egnor60d87622009-12-16 16:32:58 -08001050 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 IBinder app = data.readStrongBinder();
1053 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1054 handleApplicationCrash(app, ci);
1055 reply.writeNoException();
1056 return true;
1057 }
1058
1059 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001060 data.enforceInterface(IActivityManager.descriptor);
1061 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001062 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001063 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001064 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001065 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001066 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001067 return true;
1068 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001069
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001070 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1071 data.enforceInterface(IActivityManager.descriptor);
1072 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001073 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001074 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1075 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001076 reply.writeNoException();
1077 return true;
1078 }
1079
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001080 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1081 data.enforceInterface(IActivityManager.descriptor);
1082 int sig = data.readInt();
1083 signalPersistentProcesses(sig);
1084 reply.writeNoException();
1085 return true;
1086 }
1087
Dianne Hackborn03abb812010-01-04 18:43:19 -08001088 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1089 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001091 killBackgroundProcesses(packageName);
1092 reply.writeNoException();
1093 return true;
1094 }
1095
1096 case FORCE_STOP_PACKAGE_TRANSACTION: {
1097 data.enforceInterface(IActivityManager.descriptor);
1098 String packageName = data.readString();
1099 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 reply.writeNoException();
1101 return true;
1102 }
1103
1104 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 ConfigurationInfo config = getDeviceConfigurationInfo();
1107 reply.writeNoException();
1108 config.writeToParcel(reply, 0);
1109 return true;
1110 }
1111
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001112 case PROFILE_CONTROL_TRANSACTION: {
1113 data.enforceInterface(IActivityManager.descriptor);
1114 String process = data.readString();
1115 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001116 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001117 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001118 ParcelFileDescriptor fd = data.readInt() != 0
1119 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001120 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001121 reply.writeNoException();
1122 reply.writeInt(res ? 1 : 0);
1123 return true;
1124 }
1125
Dianne Hackborn55280a92009-05-07 15:53:46 -07001126 case SHUTDOWN_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 boolean res = shutdown(data.readInt());
1129 reply.writeNoException();
1130 reply.writeInt(res ? 1 : 0);
1131 return true;
1132 }
1133
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001134 case STOP_APP_SWITCHES_TRANSACTION: {
1135 data.enforceInterface(IActivityManager.descriptor);
1136 stopAppSwitches();
1137 reply.writeNoException();
1138 return true;
1139 }
1140
1141 case RESUME_APP_SWITCHES_TRANSACTION: {
1142 data.enforceInterface(IActivityManager.descriptor);
1143 resumeAppSwitches();
1144 reply.writeNoException();
1145 return true;
1146 }
1147
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 case PEEK_SERVICE_TRANSACTION: {
1149 data.enforceInterface(IActivityManager.descriptor);
1150 Intent service = Intent.CREATOR.createFromParcel(data);
1151 String resolvedType = data.readString();
1152 IBinder binder = peekService(service, resolvedType);
1153 reply.writeNoException();
1154 reply.writeStrongBinder(binder);
1155 return true;
1156 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001157
1158 case START_BACKUP_AGENT_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1161 int backupRestoreMode = data.readInt();
1162 boolean success = bindBackupAgent(info, backupRestoreMode);
1163 reply.writeNoException();
1164 reply.writeInt(success ? 1 : 0);
1165 return true;
1166 }
1167
1168 case BACKUP_AGENT_CREATED_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 String packageName = data.readString();
1171 IBinder agent = data.readStrongBinder();
1172 backupAgentCreated(packageName, agent);
1173 reply.writeNoException();
1174 return true;
1175 }
1176
1177 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1180 unbindBackupAgent(info);
1181 reply.writeNoException();
1182 return true;
1183 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001184
1185 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1186 data.enforceInterface(IActivityManager.descriptor);
1187 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1188 data.readStrongBinder());
1189 registerActivityWatcher(watcher);
1190 return true;
1191 }
1192
1193 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1194 data.enforceInterface(IActivityManager.descriptor);
1195 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1196 data.readStrongBinder());
1197 unregisterActivityWatcher(watcher);
1198 return true;
1199 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001200
1201 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1202 {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 int uid = data.readInt();
1205 Intent intent = Intent.CREATOR.createFromParcel(data);
1206 String resolvedType = data.readString();
1207 IBinder resultTo = data.readStrongBinder();
1208 String resultWho = data.readString();
1209 int requestCode = data.readInt();
1210 boolean onlyIfNeeded = data.readInt() != 0;
1211 int result = startActivityInPackage(uid, intent, resolvedType,
1212 resultTo, resultWho, requestCode, onlyIfNeeded);
1213 reply.writeNoException();
1214 reply.writeInt(result);
1215 return true;
1216 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001217
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001218 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 String pkg = data.readString();
1221 int uid = data.readInt();
1222 killApplicationWithUid(pkg, uid);
1223 reply.writeNoException();
1224 return true;
1225 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001226
1227 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1228 data.enforceInterface(IActivityManager.descriptor);
1229 String reason = data.readString();
1230 closeSystemDialogs(reason);
1231 reply.writeNoException();
1232 return true;
1233 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001234
1235 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1236 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001237 int[] pids = data.createIntArray();
1238 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001239 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001240 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001241 return true;
1242 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001243
1244 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 String processName = data.readString();
1247 int uid = data.readInt();
1248 killApplicationProcess(processName, uid);
1249 reply.writeNoException();
1250 return true;
1251 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001252
1253 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1254 data.enforceInterface(IActivityManager.descriptor);
1255 IBinder token = data.readStrongBinder();
1256 String packageName = data.readString();
1257 int enterAnim = data.readInt();
1258 int exitAnim = data.readInt();
1259 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001260 reply.writeNoException();
1261 return true;
1262 }
1263
1264 case IS_USER_A_MONKEY_TRANSACTION: {
1265 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001266 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001267 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001268 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001269 return true;
1270 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001271
1272 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1273 data.enforceInterface(IActivityManager.descriptor);
1274 finishHeavyWeightApp();
1275 reply.writeNoException();
1276 return true;
1277 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001278
1279 case IS_IMMERSIVE_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001282 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001283 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001284 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001285 return true;
1286 }
1287
1288 case SET_IMMERSIVE_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 IBinder token = data.readStrongBinder();
1291 boolean imm = data.readInt() == 1;
1292 setImmersive(token, imm);
1293 reply.writeNoException();
1294 return true;
1295 }
1296
1297 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001299 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001300 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001301 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001302 return true;
1303 }
1304
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001305 case CRASH_APPLICATION_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 int uid = data.readInt();
1308 int initialPid = data.readInt();
1309 String packageName = data.readString();
1310 String message = data.readString();
1311 crashApplication(uid, initialPid, packageName, message);
1312 reply.writeNoException();
1313 return true;
1314 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001315
1316 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 Uri uri = Uri.CREATOR.createFromParcel(data);
1319 String type = getProviderMimeType(uri);
1320 reply.writeNoException();
1321 reply.writeString(type);
1322 return true;
1323 }
1324
Dianne Hackborn7e269642010-08-25 19:50:20 -07001325 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1326 data.enforceInterface(IActivityManager.descriptor);
1327 String name = data.readString();
1328 IBinder perm = newUriPermissionOwner(name);
1329 reply.writeNoException();
1330 reply.writeStrongBinder(perm);
1331 return true;
1332 }
1333
1334 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 IBinder owner = data.readStrongBinder();
1337 int fromUid = data.readInt();
1338 String targetPkg = data.readString();
1339 Uri uri = Uri.CREATOR.createFromParcel(data);
1340 int mode = data.readInt();
1341 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1342 reply.writeNoException();
1343 return true;
1344 }
1345
1346 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1347 data.enforceInterface(IActivityManager.descriptor);
1348 IBinder owner = data.readStrongBinder();
1349 Uri uri = null;
1350 if (data.readInt() != 0) {
1351 Uri.CREATOR.createFromParcel(data);
1352 }
1353 int mode = data.readInt();
1354 revokeUriPermissionFromOwner(owner, uri, mode);
1355 reply.writeNoException();
1356 return true;
1357 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001358
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001359 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1360 data.enforceInterface(IActivityManager.descriptor);
1361 int callingUid = data.readInt();
1362 String targetPkg = data.readString();
1363 Uri uri = Uri.CREATOR.createFromParcel(data);
1364 int modeFlags = data.readInt();
1365 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1366 reply.writeNoException();
1367 reply.writeInt(res);
1368 return true;
1369 }
1370
Andy McFadden824c5102010-07-09 16:26:57 -07001371 case DUMP_HEAP_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 String process = data.readString();
1374 boolean managed = data.readInt() != 0;
1375 String path = data.readString();
1376 ParcelFileDescriptor fd = data.readInt() != 0
1377 ? data.readFileDescriptor() : null;
1378 boolean res = dumpHeap(process, managed, path, fd);
1379 reply.writeNoException();
1380 reply.writeInt(res ? 1 : 0);
1381 return true;
1382 }
1383
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001384 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1385 {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 int uid = data.readInt();
1388 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1389 String[] resolvedTypes = data.createStringArray();
1390 IBinder resultTo = data.readStrongBinder();
1391 int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
1392 reply.writeNoException();
1393 reply.writeInt(result);
1394 return true;
1395 }
1396
1397 case START_ACTIVITIES_TRANSACTION:
1398 {
1399 data.enforceInterface(IActivityManager.descriptor);
1400 IBinder b = data.readStrongBinder();
1401 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1402 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1403 String[] resolvedTypes = data.createStringArray();
1404 IBinder resultTo = data.readStrongBinder();
1405 int result = startActivities(app, intents, resolvedTypes, resultTo);
1406 reply.writeNoException();
1407 reply.writeInt(result);
1408 return true;
1409 }
1410
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001411 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1412 {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 int mode = getFrontActivityScreenCompatMode();
1415 reply.writeNoException();
1416 reply.writeInt(mode);
1417 return true;
1418 }
1419
1420 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1421 {
1422 data.enforceInterface(IActivityManager.descriptor);
1423 int mode = data.readInt();
1424 setFrontActivityScreenCompatMode(mode);
1425 reply.writeNoException();
1426 reply.writeInt(mode);
1427 return true;
1428 }
1429
1430 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1431 {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 String pkg = data.readString();
1434 int mode = getPackageScreenCompatMode(pkg);
1435 reply.writeNoException();
1436 reply.writeInt(mode);
1437 return true;
1438 }
1439
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001440 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1441 {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001444 int mode = data.readInt();
1445 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001446 reply.writeNoException();
1447 return true;
1448 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001449
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001450 case SWITCH_USER_TRANSACTION: {
1451 data.enforceInterface(IActivityManager.descriptor);
1452 int userid = data.readInt();
1453 boolean result = switchUser(userid);
1454 reply.writeNoException();
1455 reply.writeInt(result ? 1 : 0);
1456 return true;
1457 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001458
1459 case REMOVE_SUB_TASK_TRANSACTION:
1460 {
1461 data.enforceInterface(IActivityManager.descriptor);
1462 int taskId = data.readInt();
1463 int subTaskIndex = data.readInt();
1464 boolean result = removeSubTask(taskId, subTaskIndex);
1465 reply.writeNoException();
1466 reply.writeInt(result ? 1 : 0);
1467 return true;
1468 }
1469
1470 case REMOVE_TASK_TRANSACTION:
1471 {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 int taskId = data.readInt();
1474 int fl = data.readInt();
1475 boolean result = removeTask(taskId, fl);
1476 reply.writeNoException();
1477 reply.writeInt(result ? 1 : 0);
1478 return true;
1479 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001480
Jeff Sharkeya4620792011-05-20 15:29:23 -07001481 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1484 data.readStrongBinder());
1485 registerProcessObserver(observer);
1486 return true;
1487 }
1488
1489 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1490 data.enforceInterface(IActivityManager.descriptor);
1491 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1492 data.readStrongBinder());
1493 unregisterProcessObserver(observer);
1494 return true;
1495 }
1496
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001497 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1498 {
1499 data.enforceInterface(IActivityManager.descriptor);
1500 String pkg = data.readString();
1501 boolean ask = getPackageAskScreenCompat(pkg);
1502 reply.writeNoException();
1503 reply.writeInt(ask ? 1 : 0);
1504 return true;
1505 }
1506
1507 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1508 {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 String pkg = data.readString();
1511 boolean ask = data.readInt() != 0;
1512 setPackageAskScreenCompat(pkg, ask);
1513 reply.writeNoException();
1514 return true;
1515 }
1516
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001517 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1518 data.enforceInterface(IActivityManager.descriptor);
1519 IIntentSender r = IIntentSender.Stub.asInterface(
1520 data.readStrongBinder());
1521 boolean res = isIntentSenderTargetedToPackage(r);
1522 reply.writeNoException();
1523 reply.writeInt(res ? 1 : 0);
1524 return true;
1525 }
1526
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001527 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 Configuration config = Configuration.CREATOR.createFromParcel(data);
1530 updatePersistentConfiguration(config);
1531 reply.writeNoException();
1532 return true;
1533 }
1534
Dianne Hackbornb437e092011-08-05 17:50:29 -07001535 case GET_PROCESS_PSS_TRANSACTION: {
1536 data.enforceInterface(IActivityManager.descriptor);
1537 int[] pids = data.createIntArray();
1538 long[] pss = getProcessPss(pids);
1539 reply.writeNoException();
1540 reply.writeLongArray(pss);
1541 return true;
1542 }
1543
Dianne Hackborn661cd522011-08-22 00:26:20 -07001544 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1545 data.enforceInterface(IActivityManager.descriptor);
1546 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1547 boolean always = data.readInt() != 0;
1548 showBootMessage(msg, always);
1549 reply.writeNoException();
1550 return true;
1551 }
1552
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001553 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001554
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001555 return super.onTransact(code, data, reply, flags);
1556 }
1557
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001558 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001559 return this;
1560 }
1561
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001562 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1563 protected IActivityManager create() {
1564 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001565 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001566 Log.v("ActivityManager", "default service binder = " + b);
1567 }
1568 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001569 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001570 Log.v("ActivityManager", "default service = " + am);
1571 }
1572 return am;
1573 }
1574 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001575}
1576
1577class ActivityManagerProxy implements IActivityManager
1578{
1579 public ActivityManagerProxy(IBinder remote)
1580 {
1581 mRemote = remote;
1582 }
1583
1584 public IBinder asBinder()
1585 {
1586 return mRemote;
1587 }
1588
1589 public int startActivity(IApplicationThread caller, Intent intent,
1590 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1591 IBinder resultTo, String resultWho,
1592 int requestCode, boolean onlyIfNeeded,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001593 boolean debug, String profileFile, ParcelFileDescriptor profileFd,
1594 boolean autoStopProfiler) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001595 Parcel data = Parcel.obtain();
1596 Parcel reply = Parcel.obtain();
1597 data.writeInterfaceToken(IActivityManager.descriptor);
1598 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1599 intent.writeToParcel(data, 0);
1600 data.writeString(resolvedType);
1601 data.writeTypedArray(grantedUriPermissions, 0);
1602 data.writeInt(grantedMode);
1603 data.writeStrongBinder(resultTo);
1604 data.writeString(resultWho);
1605 data.writeInt(requestCode);
1606 data.writeInt(onlyIfNeeded ? 1 : 0);
1607 data.writeInt(debug ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001608 data.writeString(profileFile);
1609 if (profileFd != null) {
1610 data.writeInt(1);
1611 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1612 } else {
1613 data.writeInt(0);
1614 }
1615 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001616 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1617 reply.readException();
1618 int result = reply.readInt();
1619 reply.recycle();
1620 data.recycle();
1621 return result;
1622 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001623 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1624 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1625 IBinder resultTo, String resultWho,
1626 int requestCode, boolean onlyIfNeeded,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001627 boolean debug, String profileFile, ParcelFileDescriptor profileFd,
1628 boolean autoStopProfiler) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001629 Parcel data = Parcel.obtain();
1630 Parcel reply = Parcel.obtain();
1631 data.writeInterfaceToken(IActivityManager.descriptor);
1632 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1633 intent.writeToParcel(data, 0);
1634 data.writeString(resolvedType);
1635 data.writeTypedArray(grantedUriPermissions, 0);
1636 data.writeInt(grantedMode);
1637 data.writeStrongBinder(resultTo);
1638 data.writeString(resultWho);
1639 data.writeInt(requestCode);
1640 data.writeInt(onlyIfNeeded ? 1 : 0);
1641 data.writeInt(debug ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001642 data.writeString(profileFile);
1643 if (profileFd != null) {
1644 data.writeInt(1);
1645 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1646 } else {
1647 data.writeInt(0);
1648 }
1649 data.writeInt(autoStopProfiler ? 1 : 0);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001650 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1651 reply.readException();
1652 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1653 reply.recycle();
1654 data.recycle();
1655 return result;
1656 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001657 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1658 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1659 IBinder resultTo, String resultWho,
1660 int requestCode, boolean onlyIfNeeded,
1661 boolean debug, Configuration config) throws RemoteException {
1662 Parcel data = Parcel.obtain();
1663 Parcel reply = Parcel.obtain();
1664 data.writeInterfaceToken(IActivityManager.descriptor);
1665 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1666 intent.writeToParcel(data, 0);
1667 data.writeString(resolvedType);
1668 data.writeTypedArray(grantedUriPermissions, 0);
1669 data.writeInt(grantedMode);
1670 data.writeStrongBinder(resultTo);
1671 data.writeString(resultWho);
1672 data.writeInt(requestCode);
1673 data.writeInt(onlyIfNeeded ? 1 : 0);
1674 data.writeInt(debug ? 1 : 0);
1675 config.writeToParcel(data, 0);
1676 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1677 reply.readException();
1678 int result = reply.readInt();
1679 reply.recycle();
1680 data.recycle();
1681 return result;
1682 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001683 public int startActivityIntentSender(IApplicationThread caller,
1684 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001685 IBinder resultTo, String resultWho, int requestCode,
1686 int flagsMask, int flagsValues) throws RemoteException {
1687 Parcel data = Parcel.obtain();
1688 Parcel reply = Parcel.obtain();
1689 data.writeInterfaceToken(IActivityManager.descriptor);
1690 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1691 intent.writeToParcel(data, 0);
1692 if (fillInIntent != null) {
1693 data.writeInt(1);
1694 fillInIntent.writeToParcel(data, 0);
1695 } else {
1696 data.writeInt(0);
1697 }
1698 data.writeString(resolvedType);
1699 data.writeStrongBinder(resultTo);
1700 data.writeString(resultWho);
1701 data.writeInt(requestCode);
1702 data.writeInt(flagsMask);
1703 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001704 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001705 reply.readException();
1706 int result = reply.readInt();
1707 reply.recycle();
1708 data.recycle();
1709 return result;
1710 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001711 public boolean startNextMatchingActivity(IBinder callingActivity,
1712 Intent intent) throws RemoteException {
1713 Parcel data = Parcel.obtain();
1714 Parcel reply = Parcel.obtain();
1715 data.writeInterfaceToken(IActivityManager.descriptor);
1716 data.writeStrongBinder(callingActivity);
1717 intent.writeToParcel(data, 0);
1718 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1719 reply.readException();
1720 int result = reply.readInt();
1721 reply.recycle();
1722 data.recycle();
1723 return result != 0;
1724 }
1725 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1726 throws RemoteException {
1727 Parcel data = Parcel.obtain();
1728 Parcel reply = Parcel.obtain();
1729 data.writeInterfaceToken(IActivityManager.descriptor);
1730 data.writeStrongBinder(token);
1731 data.writeInt(resultCode);
1732 if (resultData != null) {
1733 data.writeInt(1);
1734 resultData.writeToParcel(data, 0);
1735 } else {
1736 data.writeInt(0);
1737 }
1738 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1739 reply.readException();
1740 boolean res = reply.readInt() != 0;
1741 data.recycle();
1742 reply.recycle();
1743 return res;
1744 }
1745 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1746 {
1747 Parcel data = Parcel.obtain();
1748 Parcel reply = Parcel.obtain();
1749 data.writeInterfaceToken(IActivityManager.descriptor);
1750 data.writeStrongBinder(token);
1751 data.writeString(resultWho);
1752 data.writeInt(requestCode);
1753 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1754 reply.readException();
1755 data.recycle();
1756 reply.recycle();
1757 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001758 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1759 Parcel data = Parcel.obtain();
1760 Parcel reply = Parcel.obtain();
1761 data.writeInterfaceToken(IActivityManager.descriptor);
1762 data.writeStrongBinder(token);
1763 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1764 reply.readException();
1765 boolean res = reply.readInt() != 0;
1766 data.recycle();
1767 reply.recycle();
1768 return res;
1769 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001770 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001771 IIntentReceiver receiver,
1772 IntentFilter filter, String perm) throws RemoteException
1773 {
1774 Parcel data = Parcel.obtain();
1775 Parcel reply = Parcel.obtain();
1776 data.writeInterfaceToken(IActivityManager.descriptor);
1777 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001778 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001779 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1780 filter.writeToParcel(data, 0);
1781 data.writeString(perm);
1782 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1783 reply.readException();
1784 Intent intent = null;
1785 int haveIntent = reply.readInt();
1786 if (haveIntent != 0) {
1787 intent = Intent.CREATOR.createFromParcel(reply);
1788 }
1789 reply.recycle();
1790 data.recycle();
1791 return intent;
1792 }
1793 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1794 {
1795 Parcel data = Parcel.obtain();
1796 Parcel reply = Parcel.obtain();
1797 data.writeInterfaceToken(IActivityManager.descriptor);
1798 data.writeStrongBinder(receiver.asBinder());
1799 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1800 reply.readException();
1801 data.recycle();
1802 reply.recycle();
1803 }
1804 public int broadcastIntent(IApplicationThread caller,
1805 Intent intent, String resolvedType, IIntentReceiver resultTo,
1806 int resultCode, String resultData, Bundle map,
1807 String requiredPermission, boolean serialized,
1808 boolean sticky) throws RemoteException
1809 {
1810 Parcel data = Parcel.obtain();
1811 Parcel reply = Parcel.obtain();
1812 data.writeInterfaceToken(IActivityManager.descriptor);
1813 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1814 intent.writeToParcel(data, 0);
1815 data.writeString(resolvedType);
1816 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1817 data.writeInt(resultCode);
1818 data.writeString(resultData);
1819 data.writeBundle(map);
1820 data.writeString(requiredPermission);
1821 data.writeInt(serialized ? 1 : 0);
1822 data.writeInt(sticky ? 1 : 0);
1823 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1824 reply.readException();
1825 int res = reply.readInt();
1826 reply.recycle();
1827 data.recycle();
1828 return res;
1829 }
1830 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1831 {
1832 Parcel data = Parcel.obtain();
1833 Parcel reply = Parcel.obtain();
1834 data.writeInterfaceToken(IActivityManager.descriptor);
1835 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1836 intent.writeToParcel(data, 0);
1837 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1838 reply.readException();
1839 data.recycle();
1840 reply.recycle();
1841 }
1842 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1843 {
1844 Parcel data = Parcel.obtain();
1845 Parcel reply = Parcel.obtain();
1846 data.writeInterfaceToken(IActivityManager.descriptor);
1847 data.writeStrongBinder(who);
1848 data.writeInt(resultCode);
1849 data.writeString(resultData);
1850 data.writeBundle(map);
1851 data.writeInt(abortBroadcast ? 1 : 0);
1852 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1853 reply.readException();
1854 data.recycle();
1855 reply.recycle();
1856 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001857 public void attachApplication(IApplicationThread app) throws RemoteException
1858 {
1859 Parcel data = Parcel.obtain();
1860 Parcel reply = Parcel.obtain();
1861 data.writeInterfaceToken(IActivityManager.descriptor);
1862 data.writeStrongBinder(app.asBinder());
1863 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1864 reply.readException();
1865 data.recycle();
1866 reply.recycle();
1867 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001868 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1869 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001870 {
1871 Parcel data = Parcel.obtain();
1872 Parcel reply = Parcel.obtain();
1873 data.writeInterfaceToken(IActivityManager.descriptor);
1874 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001875 if (config != null) {
1876 data.writeInt(1);
1877 config.writeToParcel(data, 0);
1878 } else {
1879 data.writeInt(0);
1880 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001881 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001882 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1883 reply.readException();
1884 data.recycle();
1885 reply.recycle();
1886 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001887 public void activityPaused(IBinder token) throws RemoteException
1888 {
1889 Parcel data = Parcel.obtain();
1890 Parcel reply = Parcel.obtain();
1891 data.writeInterfaceToken(IActivityManager.descriptor);
1892 data.writeStrongBinder(token);
1893 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1894 reply.readException();
1895 data.recycle();
1896 reply.recycle();
1897 }
1898 public void activityStopped(IBinder token, Bundle state,
1899 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001900 {
1901 Parcel data = Parcel.obtain();
1902 Parcel reply = Parcel.obtain();
1903 data.writeInterfaceToken(IActivityManager.descriptor);
1904 data.writeStrongBinder(token);
1905 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001906 if (thumbnail != null) {
1907 data.writeInt(1);
1908 thumbnail.writeToParcel(data, 0);
1909 } else {
1910 data.writeInt(0);
1911 }
1912 TextUtils.writeToParcel(description, data, 0);
1913 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1914 reply.readException();
1915 data.recycle();
1916 reply.recycle();
1917 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001918 public void activitySlept(IBinder token) throws RemoteException
1919 {
1920 Parcel data = Parcel.obtain();
1921 Parcel reply = Parcel.obtain();
1922 data.writeInterfaceToken(IActivityManager.descriptor);
1923 data.writeStrongBinder(token);
1924 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1925 reply.readException();
1926 data.recycle();
1927 reply.recycle();
1928 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001929 public void activityDestroyed(IBinder token) throws RemoteException
1930 {
1931 Parcel data = Parcel.obtain();
1932 Parcel reply = Parcel.obtain();
1933 data.writeInterfaceToken(IActivityManager.descriptor);
1934 data.writeStrongBinder(token);
1935 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1936 reply.readException();
1937 data.recycle();
1938 reply.recycle();
1939 }
1940 public String getCallingPackage(IBinder token) throws RemoteException
1941 {
1942 Parcel data = Parcel.obtain();
1943 Parcel reply = Parcel.obtain();
1944 data.writeInterfaceToken(IActivityManager.descriptor);
1945 data.writeStrongBinder(token);
1946 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1947 reply.readException();
1948 String res = reply.readString();
1949 data.recycle();
1950 reply.recycle();
1951 return res;
1952 }
1953 public ComponentName getCallingActivity(IBinder token)
1954 throws RemoteException {
1955 Parcel data = Parcel.obtain();
1956 Parcel reply = Parcel.obtain();
1957 data.writeInterfaceToken(IActivityManager.descriptor);
1958 data.writeStrongBinder(token);
1959 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1960 reply.readException();
1961 ComponentName res = ComponentName.readFromParcel(reply);
1962 data.recycle();
1963 reply.recycle();
1964 return res;
1965 }
1966 public List getTasks(int maxNum, int flags,
1967 IThumbnailReceiver receiver) throws RemoteException {
1968 Parcel data = Parcel.obtain();
1969 Parcel reply = Parcel.obtain();
1970 data.writeInterfaceToken(IActivityManager.descriptor);
1971 data.writeInt(maxNum);
1972 data.writeInt(flags);
1973 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1974 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1975 reply.readException();
1976 ArrayList list = null;
1977 int N = reply.readInt();
1978 if (N >= 0) {
1979 list = new ArrayList();
1980 while (N > 0) {
1981 ActivityManager.RunningTaskInfo info =
1982 ActivityManager.RunningTaskInfo.CREATOR
1983 .createFromParcel(reply);
1984 list.add(info);
1985 N--;
1986 }
1987 }
1988 data.recycle();
1989 reply.recycle();
1990 return list;
1991 }
1992 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
1993 int flags) throws RemoteException {
1994 Parcel data = Parcel.obtain();
1995 Parcel reply = Parcel.obtain();
1996 data.writeInterfaceToken(IActivityManager.descriptor);
1997 data.writeInt(maxNum);
1998 data.writeInt(flags);
1999 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2000 reply.readException();
2001 ArrayList<ActivityManager.RecentTaskInfo> list
2002 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2003 data.recycle();
2004 reply.recycle();
2005 return list;
2006 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002007 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002008 Parcel data = Parcel.obtain();
2009 Parcel reply = Parcel.obtain();
2010 data.writeInterfaceToken(IActivityManager.descriptor);
2011 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002012 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002013 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002014 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002015 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002016 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002017 }
2018 data.recycle();
2019 reply.recycle();
2020 return bm;
2021 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002022 public List getServices(int maxNum, int flags) throws RemoteException {
2023 Parcel data = Parcel.obtain();
2024 Parcel reply = Parcel.obtain();
2025 data.writeInterfaceToken(IActivityManager.descriptor);
2026 data.writeInt(maxNum);
2027 data.writeInt(flags);
2028 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2029 reply.readException();
2030 ArrayList list = null;
2031 int N = reply.readInt();
2032 if (N >= 0) {
2033 list = new ArrayList();
2034 while (N > 0) {
2035 ActivityManager.RunningServiceInfo info =
2036 ActivityManager.RunningServiceInfo.CREATOR
2037 .createFromParcel(reply);
2038 list.add(info);
2039 N--;
2040 }
2041 }
2042 data.recycle();
2043 reply.recycle();
2044 return list;
2045 }
2046 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2047 throws RemoteException {
2048 Parcel data = Parcel.obtain();
2049 Parcel reply = Parcel.obtain();
2050 data.writeInterfaceToken(IActivityManager.descriptor);
2051 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2052 reply.readException();
2053 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2054 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2055 data.recycle();
2056 reply.recycle();
2057 return list;
2058 }
2059 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2060 throws RemoteException {
2061 Parcel data = Parcel.obtain();
2062 Parcel reply = Parcel.obtain();
2063 data.writeInterfaceToken(IActivityManager.descriptor);
2064 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2065 reply.readException();
2066 ArrayList<ActivityManager.RunningAppProcessInfo> list
2067 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2068 data.recycle();
2069 reply.recycle();
2070 return list;
2071 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002072 public List<ApplicationInfo> getRunningExternalApplications()
2073 throws RemoteException {
2074 Parcel data = Parcel.obtain();
2075 Parcel reply = Parcel.obtain();
2076 data.writeInterfaceToken(IActivityManager.descriptor);
2077 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2078 reply.readException();
2079 ArrayList<ApplicationInfo> list
2080 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2081 data.recycle();
2082 reply.recycle();
2083 return list;
2084 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002085 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002086 {
2087 Parcel data = Parcel.obtain();
2088 Parcel reply = Parcel.obtain();
2089 data.writeInterfaceToken(IActivityManager.descriptor);
2090 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002091 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002092 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2093 reply.readException();
2094 data.recycle();
2095 reply.recycle();
2096 }
2097 public void moveTaskToBack(int task) throws RemoteException
2098 {
2099 Parcel data = Parcel.obtain();
2100 Parcel reply = Parcel.obtain();
2101 data.writeInterfaceToken(IActivityManager.descriptor);
2102 data.writeInt(task);
2103 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2104 reply.readException();
2105 data.recycle();
2106 reply.recycle();
2107 }
2108 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2109 throws RemoteException {
2110 Parcel data = Parcel.obtain();
2111 Parcel reply = Parcel.obtain();
2112 data.writeInterfaceToken(IActivityManager.descriptor);
2113 data.writeStrongBinder(token);
2114 data.writeInt(nonRoot ? 1 : 0);
2115 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2116 reply.readException();
2117 boolean res = reply.readInt() != 0;
2118 data.recycle();
2119 reply.recycle();
2120 return res;
2121 }
2122 public void moveTaskBackwards(int task) throws RemoteException
2123 {
2124 Parcel data = Parcel.obtain();
2125 Parcel reply = Parcel.obtain();
2126 data.writeInterfaceToken(IActivityManager.descriptor);
2127 data.writeInt(task);
2128 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2129 reply.readException();
2130 data.recycle();
2131 reply.recycle();
2132 }
2133 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2134 {
2135 Parcel data = Parcel.obtain();
2136 Parcel reply = Parcel.obtain();
2137 data.writeInterfaceToken(IActivityManager.descriptor);
2138 data.writeStrongBinder(token);
2139 data.writeInt(onlyRoot ? 1 : 0);
2140 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2141 reply.readException();
2142 int res = reply.readInt();
2143 data.recycle();
2144 reply.recycle();
2145 return res;
2146 }
2147 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
2148 {
2149 Parcel data = Parcel.obtain();
2150 Parcel reply = Parcel.obtain();
2151 data.writeInterfaceToken(IActivityManager.descriptor);
2152 data.writeStrongBinder(token);
2153 ComponentName.writeToParcel(className, data);
2154 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
2155 reply.readException();
2156 data.recycle();
2157 reply.recycle();
2158 }
2159 public void reportThumbnail(IBinder token,
2160 Bitmap thumbnail, CharSequence description) throws RemoteException
2161 {
2162 Parcel data = Parcel.obtain();
2163 Parcel reply = Parcel.obtain();
2164 data.writeInterfaceToken(IActivityManager.descriptor);
2165 data.writeStrongBinder(token);
2166 if (thumbnail != null) {
2167 data.writeInt(1);
2168 thumbnail.writeToParcel(data, 0);
2169 } else {
2170 data.writeInt(0);
2171 }
2172 TextUtils.writeToParcel(description, data, 0);
2173 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2174 reply.readException();
2175 data.recycle();
2176 reply.recycle();
2177 }
2178 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2179 String name) throws RemoteException
2180 {
2181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2185 data.writeString(name);
2186 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2187 reply.readException();
2188 int res = reply.readInt();
2189 ContentProviderHolder cph = null;
2190 if (res != 0) {
2191 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2192 }
2193 data.recycle();
2194 reply.recycle();
2195 return cph;
2196 }
2197 public void publishContentProviders(IApplicationThread caller,
2198 List<ContentProviderHolder> providers) throws RemoteException
2199 {
2200 Parcel data = Parcel.obtain();
2201 Parcel reply = Parcel.obtain();
2202 data.writeInterfaceToken(IActivityManager.descriptor);
2203 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2204 data.writeTypedList(providers);
2205 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2206 reply.readException();
2207 data.recycle();
2208 reply.recycle();
2209 }
2210
2211 public void removeContentProvider(IApplicationThread caller,
2212 String name) throws RemoteException {
2213 Parcel data = Parcel.obtain();
2214 Parcel reply = Parcel.obtain();
2215 data.writeInterfaceToken(IActivityManager.descriptor);
2216 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2217 data.writeString(name);
2218 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2219 reply.readException();
2220 data.recycle();
2221 reply.recycle();
2222 }
2223
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002224 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2225 throws RemoteException
2226 {
2227 Parcel data = Parcel.obtain();
2228 Parcel reply = Parcel.obtain();
2229 data.writeInterfaceToken(IActivityManager.descriptor);
2230 service.writeToParcel(data, 0);
2231 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2232 reply.readException();
2233 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2234 data.recycle();
2235 reply.recycle();
2236 return res;
2237 }
2238
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002239 public ComponentName startService(IApplicationThread caller, Intent service,
2240 String resolvedType) throws RemoteException
2241 {
2242 Parcel data = Parcel.obtain();
2243 Parcel reply = Parcel.obtain();
2244 data.writeInterfaceToken(IActivityManager.descriptor);
2245 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2246 service.writeToParcel(data, 0);
2247 data.writeString(resolvedType);
2248 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2249 reply.readException();
2250 ComponentName res = ComponentName.readFromParcel(reply);
2251 data.recycle();
2252 reply.recycle();
2253 return res;
2254 }
2255 public int stopService(IApplicationThread caller, Intent service,
2256 String resolvedType) throws RemoteException
2257 {
2258 Parcel data = Parcel.obtain();
2259 Parcel reply = Parcel.obtain();
2260 data.writeInterfaceToken(IActivityManager.descriptor);
2261 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2262 service.writeToParcel(data, 0);
2263 data.writeString(resolvedType);
2264 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2265 reply.readException();
2266 int res = reply.readInt();
2267 reply.recycle();
2268 data.recycle();
2269 return res;
2270 }
2271 public boolean stopServiceToken(ComponentName className, IBinder token,
2272 int startId) throws RemoteException {
2273 Parcel data = Parcel.obtain();
2274 Parcel reply = Parcel.obtain();
2275 data.writeInterfaceToken(IActivityManager.descriptor);
2276 ComponentName.writeToParcel(className, data);
2277 data.writeStrongBinder(token);
2278 data.writeInt(startId);
2279 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2280 reply.readException();
2281 boolean res = reply.readInt() != 0;
2282 data.recycle();
2283 reply.recycle();
2284 return res;
2285 }
2286 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002287 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002288 Parcel data = Parcel.obtain();
2289 Parcel reply = Parcel.obtain();
2290 data.writeInterfaceToken(IActivityManager.descriptor);
2291 ComponentName.writeToParcel(className, data);
2292 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002293 data.writeInt(id);
2294 if (notification != null) {
2295 data.writeInt(1);
2296 notification.writeToParcel(data, 0);
2297 } else {
2298 data.writeInt(0);
2299 }
2300 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002301 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2302 reply.readException();
2303 data.recycle();
2304 reply.recycle();
2305 }
2306 public int bindService(IApplicationThread caller, IBinder token,
2307 Intent service, String resolvedType, IServiceConnection connection,
2308 int flags) throws RemoteException {
2309 Parcel data = Parcel.obtain();
2310 Parcel reply = Parcel.obtain();
2311 data.writeInterfaceToken(IActivityManager.descriptor);
2312 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2313 data.writeStrongBinder(token);
2314 service.writeToParcel(data, 0);
2315 data.writeString(resolvedType);
2316 data.writeStrongBinder(connection.asBinder());
2317 data.writeInt(flags);
2318 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2319 reply.readException();
2320 int res = reply.readInt();
2321 data.recycle();
2322 reply.recycle();
2323 return res;
2324 }
2325 public boolean unbindService(IServiceConnection connection) throws RemoteException
2326 {
2327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 data.writeStrongBinder(connection.asBinder());
2331 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2332 reply.readException();
2333 boolean res = reply.readInt() != 0;
2334 data.recycle();
2335 reply.recycle();
2336 return res;
2337 }
2338
2339 public void publishService(IBinder token,
2340 Intent intent, IBinder service) throws RemoteException {
2341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeStrongBinder(token);
2345 intent.writeToParcel(data, 0);
2346 data.writeStrongBinder(service);
2347 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2348 reply.readException();
2349 data.recycle();
2350 reply.recycle();
2351 }
2352
2353 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2354 throws RemoteException {
2355 Parcel data = Parcel.obtain();
2356 Parcel reply = Parcel.obtain();
2357 data.writeInterfaceToken(IActivityManager.descriptor);
2358 data.writeStrongBinder(token);
2359 intent.writeToParcel(data, 0);
2360 data.writeInt(doRebind ? 1 : 0);
2361 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 data.recycle();
2364 reply.recycle();
2365 }
2366
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002367 public void serviceDoneExecuting(IBinder token, int type, int startId,
2368 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002369 Parcel data = Parcel.obtain();
2370 Parcel reply = Parcel.obtain();
2371 data.writeInterfaceToken(IActivityManager.descriptor);
2372 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002373 data.writeInt(type);
2374 data.writeInt(startId);
2375 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002376 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2377 reply.readException();
2378 data.recycle();
2379 reply.recycle();
2380 }
2381
2382 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2383 Parcel data = Parcel.obtain();
2384 Parcel reply = Parcel.obtain();
2385 data.writeInterfaceToken(IActivityManager.descriptor);
2386 service.writeToParcel(data, 0);
2387 data.writeString(resolvedType);
2388 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2389 reply.readException();
2390 IBinder binder = reply.readStrongBinder();
2391 reply.recycle();
2392 data.recycle();
2393 return binder;
2394 }
2395
Christopher Tate181fafa2009-05-14 11:12:14 -07002396 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2397 throws RemoteException {
2398 Parcel data = Parcel.obtain();
2399 Parcel reply = Parcel.obtain();
2400 data.writeInterfaceToken(IActivityManager.descriptor);
2401 app.writeToParcel(data, 0);
2402 data.writeInt(backupRestoreMode);
2403 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2404 reply.readException();
2405 boolean success = reply.readInt() != 0;
2406 reply.recycle();
2407 data.recycle();
2408 return success;
2409 }
2410
2411 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2412 Parcel data = Parcel.obtain();
2413 Parcel reply = Parcel.obtain();
2414 data.writeInterfaceToken(IActivityManager.descriptor);
2415 data.writeString(packageName);
2416 data.writeStrongBinder(agent);
2417 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2418 reply.recycle();
2419 data.recycle();
2420 }
2421
2422 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2423 Parcel data = Parcel.obtain();
2424 Parcel reply = Parcel.obtain();
2425 data.writeInterfaceToken(IActivityManager.descriptor);
2426 app.writeToParcel(data, 0);
2427 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2428 reply.readException();
2429 reply.recycle();
2430 data.recycle();
2431 }
2432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002433 public boolean startInstrumentation(ComponentName className, String profileFile,
2434 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2435 throws RemoteException {
2436 Parcel data = Parcel.obtain();
2437 Parcel reply = Parcel.obtain();
2438 data.writeInterfaceToken(IActivityManager.descriptor);
2439 ComponentName.writeToParcel(className, data);
2440 data.writeString(profileFile);
2441 data.writeInt(flags);
2442 data.writeBundle(arguments);
2443 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2444 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2445 reply.readException();
2446 boolean res = reply.readInt() != 0;
2447 reply.recycle();
2448 data.recycle();
2449 return res;
2450 }
2451
2452 public void finishInstrumentation(IApplicationThread target,
2453 int resultCode, Bundle results) throws RemoteException {
2454 Parcel data = Parcel.obtain();
2455 Parcel reply = Parcel.obtain();
2456 data.writeInterfaceToken(IActivityManager.descriptor);
2457 data.writeStrongBinder(target != null ? target.asBinder() : null);
2458 data.writeInt(resultCode);
2459 data.writeBundle(results);
2460 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2461 reply.readException();
2462 data.recycle();
2463 reply.recycle();
2464 }
2465 public Configuration getConfiguration() throws RemoteException
2466 {
2467 Parcel data = Parcel.obtain();
2468 Parcel reply = Parcel.obtain();
2469 data.writeInterfaceToken(IActivityManager.descriptor);
2470 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2471 reply.readException();
2472 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2473 reply.recycle();
2474 data.recycle();
2475 return res;
2476 }
2477 public void updateConfiguration(Configuration values) throws RemoteException
2478 {
2479 Parcel data = Parcel.obtain();
2480 Parcel reply = Parcel.obtain();
2481 data.writeInterfaceToken(IActivityManager.descriptor);
2482 values.writeToParcel(data, 0);
2483 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 data.recycle();
2486 reply.recycle();
2487 }
2488 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2489 throws RemoteException {
2490 Parcel data = Parcel.obtain();
2491 Parcel reply = Parcel.obtain();
2492 data.writeInterfaceToken(IActivityManager.descriptor);
2493 data.writeStrongBinder(token);
2494 data.writeInt(requestedOrientation);
2495 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2496 reply.readException();
2497 data.recycle();
2498 reply.recycle();
2499 }
2500 public int getRequestedOrientation(IBinder token) throws RemoteException {
2501 Parcel data = Parcel.obtain();
2502 Parcel reply = Parcel.obtain();
2503 data.writeInterfaceToken(IActivityManager.descriptor);
2504 data.writeStrongBinder(token);
2505 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2506 reply.readException();
2507 int res = reply.readInt();
2508 data.recycle();
2509 reply.recycle();
2510 return res;
2511 }
2512 public ComponentName getActivityClassForToken(IBinder token)
2513 throws RemoteException {
2514 Parcel data = Parcel.obtain();
2515 Parcel reply = Parcel.obtain();
2516 data.writeInterfaceToken(IActivityManager.descriptor);
2517 data.writeStrongBinder(token);
2518 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2519 reply.readException();
2520 ComponentName res = ComponentName.readFromParcel(reply);
2521 data.recycle();
2522 reply.recycle();
2523 return res;
2524 }
2525 public String getPackageForToken(IBinder token) throws RemoteException
2526 {
2527 Parcel data = Parcel.obtain();
2528 Parcel reply = Parcel.obtain();
2529 data.writeInterfaceToken(IActivityManager.descriptor);
2530 data.writeStrongBinder(token);
2531 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2532 reply.readException();
2533 String res = reply.readString();
2534 data.recycle();
2535 reply.recycle();
2536 return res;
2537 }
2538 public IIntentSender getIntentSender(int type,
2539 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002540 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002541 throws RemoteException {
2542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeInt(type);
2546 data.writeString(packageName);
2547 data.writeStrongBinder(token);
2548 data.writeString(resultWho);
2549 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002550 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002552 data.writeTypedArray(intents, 0);
2553 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002554 } else {
2555 data.writeInt(0);
2556 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002557 data.writeInt(flags);
2558 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 IIntentSender res = IIntentSender.Stub.asInterface(
2561 reply.readStrongBinder());
2562 data.recycle();
2563 reply.recycle();
2564 return res;
2565 }
2566 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 data.writeStrongBinder(sender.asBinder());
2571 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2572 reply.readException();
2573 data.recycle();
2574 reply.recycle();
2575 }
2576 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 data.writeStrongBinder(sender.asBinder());
2581 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2582 reply.readException();
2583 String res = reply.readString();
2584 data.recycle();
2585 reply.recycle();
2586 return res;
2587 }
2588 public void setProcessLimit(int max) throws RemoteException
2589 {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeInt(max);
2594 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2595 reply.readException();
2596 data.recycle();
2597 reply.recycle();
2598 }
2599 public int getProcessLimit() throws RemoteException
2600 {
2601 Parcel data = Parcel.obtain();
2602 Parcel reply = Parcel.obtain();
2603 data.writeInterfaceToken(IActivityManager.descriptor);
2604 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2605 reply.readException();
2606 int res = reply.readInt();
2607 data.recycle();
2608 reply.recycle();
2609 return res;
2610 }
2611 public void setProcessForeground(IBinder token, int pid,
2612 boolean isForeground) throws RemoteException {
2613 Parcel data = Parcel.obtain();
2614 Parcel reply = Parcel.obtain();
2615 data.writeInterfaceToken(IActivityManager.descriptor);
2616 data.writeStrongBinder(token);
2617 data.writeInt(pid);
2618 data.writeInt(isForeground ? 1 : 0);
2619 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2620 reply.readException();
2621 data.recycle();
2622 reply.recycle();
2623 }
2624 public int checkPermission(String permission, int pid, int uid)
2625 throws RemoteException {
2626 Parcel data = Parcel.obtain();
2627 Parcel reply = Parcel.obtain();
2628 data.writeInterfaceToken(IActivityManager.descriptor);
2629 data.writeString(permission);
2630 data.writeInt(pid);
2631 data.writeInt(uid);
2632 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2633 reply.readException();
2634 int res = reply.readInt();
2635 data.recycle();
2636 reply.recycle();
2637 return res;
2638 }
2639 public boolean clearApplicationUserData(final String packageName,
2640 final IPackageDataObserver observer) throws RemoteException {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 data.writeString(packageName);
2645 data.writeStrongBinder(observer.asBinder());
2646 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2647 reply.readException();
2648 boolean res = reply.readInt() != 0;
2649 data.recycle();
2650 reply.recycle();
2651 return res;
2652 }
2653 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2654 throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 uri.writeToParcel(data, 0);
2659 data.writeInt(pid);
2660 data.writeInt(uid);
2661 data.writeInt(mode);
2662 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2663 reply.readException();
2664 int res = reply.readInt();
2665 data.recycle();
2666 reply.recycle();
2667 return res;
2668 }
2669 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2670 Uri uri, int mode) throws RemoteException {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeStrongBinder(caller.asBinder());
2675 data.writeString(targetPkg);
2676 uri.writeToParcel(data, 0);
2677 data.writeInt(mode);
2678 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2679 reply.readException();
2680 data.recycle();
2681 reply.recycle();
2682 }
2683 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2684 int mode) throws RemoteException {
2685 Parcel data = Parcel.obtain();
2686 Parcel reply = Parcel.obtain();
2687 data.writeInterfaceToken(IActivityManager.descriptor);
2688 data.writeStrongBinder(caller.asBinder());
2689 uri.writeToParcel(data, 0);
2690 data.writeInt(mode);
2691 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2692 reply.readException();
2693 data.recycle();
2694 reply.recycle();
2695 }
2696 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2697 throws RemoteException {
2698 Parcel data = Parcel.obtain();
2699 Parcel reply = Parcel.obtain();
2700 data.writeInterfaceToken(IActivityManager.descriptor);
2701 data.writeStrongBinder(who.asBinder());
2702 data.writeInt(waiting ? 1 : 0);
2703 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2704 reply.readException();
2705 data.recycle();
2706 reply.recycle();
2707 }
2708 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 outInfo.readFromParcel(reply);
2715 data.recycle();
2716 reply.recycle();
2717 }
2718 public void unhandledBack() throws RemoteException
2719 {
2720 Parcel data = Parcel.obtain();
2721 Parcel reply = Parcel.obtain();
2722 data.writeInterfaceToken(IActivityManager.descriptor);
2723 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2724 reply.readException();
2725 data.recycle();
2726 reply.recycle();
2727 }
2728 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2729 {
2730 Parcel data = Parcel.obtain();
2731 Parcel reply = Parcel.obtain();
2732 data.writeInterfaceToken(IActivityManager.descriptor);
2733 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 ParcelFileDescriptor pfd = null;
2736 if (reply.readInt() != 0) {
2737 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2738 }
2739 data.recycle();
2740 reply.recycle();
2741 return pfd;
2742 }
2743 public void goingToSleep() throws RemoteException
2744 {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 data.recycle();
2751 reply.recycle();
2752 }
2753 public void wakingUp() throws RemoteException
2754 {
2755 Parcel data = Parcel.obtain();
2756 Parcel reply = Parcel.obtain();
2757 data.writeInterfaceToken(IActivityManager.descriptor);
2758 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2759 reply.readException();
2760 data.recycle();
2761 reply.recycle();
2762 }
2763 public void setDebugApp(
2764 String packageName, boolean waitForDebugger, boolean persistent)
2765 throws RemoteException
2766 {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeString(packageName);
2771 data.writeInt(waitForDebugger ? 1 : 0);
2772 data.writeInt(persistent ? 1 : 0);
2773 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2774 reply.readException();
2775 data.recycle();
2776 reply.recycle();
2777 }
2778 public void setAlwaysFinish(boolean enabled) throws RemoteException
2779 {
2780 Parcel data = Parcel.obtain();
2781 Parcel reply = Parcel.obtain();
2782 data.writeInterfaceToken(IActivityManager.descriptor);
2783 data.writeInt(enabled ? 1 : 0);
2784 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2785 reply.readException();
2786 data.recycle();
2787 reply.recycle();
2788 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002789 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 {
2791 Parcel data = Parcel.obtain();
2792 Parcel reply = Parcel.obtain();
2793 data.writeInterfaceToken(IActivityManager.descriptor);
2794 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002795 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002796 reply.readException();
2797 data.recycle();
2798 reply.recycle();
2799 }
2800 public void enterSafeMode() throws RemoteException {
2801 Parcel data = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2804 data.recycle();
2805 }
2806 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2807 Parcel data = Parcel.obtain();
2808 data.writeStrongBinder(sender.asBinder());
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2811 data.recycle();
2812 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002813 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002818 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002819 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002820 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 boolean res = reply.readInt() != 0;
2822 data.recycle();
2823 reply.recycle();
2824 return res;
2825 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002826 public void startRunning(String pkg, String cls, String action,
2827 String indata) throws RemoteException {
2828 Parcel data = Parcel.obtain();
2829 Parcel reply = Parcel.obtain();
2830 data.writeInterfaceToken(IActivityManager.descriptor);
2831 data.writeString(pkg);
2832 data.writeString(cls);
2833 data.writeString(action);
2834 data.writeString(indata);
2835 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2836 reply.readException();
2837 data.recycle();
2838 reply.recycle();
2839 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002840 public boolean testIsSystemReady()
2841 {
2842 /* this base class version is never called */
2843 return true;
2844 }
Dan Egnor60d87622009-12-16 16:32:58 -08002845 public void handleApplicationCrash(IBinder app,
2846 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2847 {
2848 Parcel data = Parcel.obtain();
2849 Parcel reply = Parcel.obtain();
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 data.writeStrongBinder(app);
2852 crashInfo.writeToParcel(data, 0);
2853 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 reply.recycle();
2856 data.recycle();
2857 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002858
Dan Egnor60d87622009-12-16 16:32:58 -08002859 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002860 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002861 {
2862 Parcel data = Parcel.obtain();
2863 Parcel reply = Parcel.obtain();
2864 data.writeInterfaceToken(IActivityManager.descriptor);
2865 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002866 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002867 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002868 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002870 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002871 reply.recycle();
2872 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002873 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002874 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002875
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002876 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002877 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002878 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002879 {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002884 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002885 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002886 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 reply.recycle();
2889 data.recycle();
2890 }
2891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002892 public void signalPersistentProcesses(int sig) throws RemoteException {
2893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeInt(sig);
2897 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2898 reply.readException();
2899 data.recycle();
2900 reply.recycle();
2901 }
2902
Dianne Hackborn03abb812010-01-04 18:43:19 -08002903 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002908 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2909 reply.readException();
2910 data.recycle();
2911 reply.recycle();
2912 }
2913
2914 public void forceStopPackage(String packageName) throws RemoteException {
2915 Parcel data = Parcel.obtain();
2916 Parcel reply = Parcel.obtain();
2917 data.writeInterfaceToken(IActivityManager.descriptor);
2918 data.writeString(packageName);
2919 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002920 reply.readException();
2921 data.recycle();
2922 reply.recycle();
2923 }
2924
2925 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2926 {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2933 reply.recycle();
2934 data.recycle();
2935 return res;
2936 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002937
2938 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07002939 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002940 {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 data.writeString(process);
2945 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07002946 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002947 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002948 if (fd != null) {
2949 data.writeInt(1);
2950 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2951 } else {
2952 data.writeInt(0);
2953 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002954 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 boolean res = reply.readInt() != 0;
2957 reply.recycle();
2958 data.recycle();
2959 return res;
2960 }
2961
Dianne Hackborn55280a92009-05-07 15:53:46 -07002962 public boolean shutdown(int timeout) throws RemoteException
2963 {
2964 Parcel data = Parcel.obtain();
2965 Parcel reply = Parcel.obtain();
2966 data.writeInterfaceToken(IActivityManager.descriptor);
2967 data.writeInt(timeout);
2968 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2969 reply.readException();
2970 boolean res = reply.readInt() != 0;
2971 reply.recycle();
2972 data.recycle();
2973 return res;
2974 }
2975
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07002976 public void stopAppSwitches() throws RemoteException {
2977 Parcel data = Parcel.obtain();
2978 Parcel reply = Parcel.obtain();
2979 data.writeInterfaceToken(IActivityManager.descriptor);
2980 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 reply.recycle();
2983 data.recycle();
2984 }
2985
2986 public void resumeAppSwitches() throws RemoteException {
2987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
2990 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 reply.recycle();
2993 data.recycle();
2994 }
2995
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002996 public void registerActivityWatcher(IActivityWatcher watcher)
2997 throws RemoteException {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
3002 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 data.recycle();
3005 reply.recycle();
3006 }
3007
3008 public void unregisterActivityWatcher(IActivityWatcher watcher)
3009 throws RemoteException {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
3014 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
3015 reply.readException();
3016 data.recycle();
3017 reply.recycle();
3018 }
3019
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003020 public int startActivityInPackage(int uid,
3021 Intent intent, String resolvedType, IBinder resultTo,
3022 String resultWho, int requestCode, boolean onlyIfNeeded)
3023 throws RemoteException {
3024 Parcel data = Parcel.obtain();
3025 Parcel reply = Parcel.obtain();
3026 data.writeInterfaceToken(IActivityManager.descriptor);
3027 data.writeInt(uid);
3028 intent.writeToParcel(data, 0);
3029 data.writeString(resolvedType);
3030 data.writeStrongBinder(resultTo);
3031 data.writeString(resultWho);
3032 data.writeInt(requestCode);
3033 data.writeInt(onlyIfNeeded ? 1 : 0);
3034 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3035 reply.readException();
3036 int result = reply.readInt();
3037 reply.recycle();
3038 data.recycle();
3039 return result;
3040 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003041
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003042 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3043 Parcel data = Parcel.obtain();
3044 Parcel reply = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 data.writeString(pkg);
3047 data.writeInt(uid);
3048 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3049 reply.readException();
3050 data.recycle();
3051 reply.recycle();
3052 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003053
3054 public void closeSystemDialogs(String reason) throws RemoteException {
3055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
3057 data.writeInterfaceToken(IActivityManager.descriptor);
3058 data.writeString(reason);
3059 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3060 reply.readException();
3061 data.recycle();
3062 reply.recycle();
3063 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003064
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003065 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003066 throws RemoteException {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003070 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003071 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3072 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003073 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003074 data.recycle();
3075 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003076 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003077 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003078
3079 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeString(processName);
3084 data.writeInt(uid);
3085 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3086 reply.readException();
3087 data.recycle();
3088 reply.recycle();
3089 }
3090
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003091 public void overridePendingTransition(IBinder token, String packageName,
3092 int enterAnim, int exitAnim) throws RemoteException {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeStrongBinder(token);
3097 data.writeString(packageName);
3098 data.writeInt(enterAnim);
3099 data.writeInt(exitAnim);
3100 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3101 reply.readException();
3102 data.recycle();
3103 reply.recycle();
3104 }
3105
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003106 public boolean isUserAMonkey() throws RemoteException {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3111 reply.readException();
3112 boolean res = reply.readInt() != 0;
3113 data.recycle();
3114 reply.recycle();
3115 return res;
3116 }
3117
Dianne Hackborn860755f2010-06-03 18:47:52 -07003118 public void finishHeavyWeightApp() throws RemoteException {
3119 Parcel data = Parcel.obtain();
3120 Parcel reply = Parcel.obtain();
3121 data.writeInterfaceToken(IActivityManager.descriptor);
3122 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3123 reply.readException();
3124 data.recycle();
3125 reply.recycle();
3126 }
3127
Daniel Sandler69a48172010-06-23 16:29:36 -04003128 public void setImmersive(IBinder token, boolean immersive)
3129 throws RemoteException {
3130 Parcel data = Parcel.obtain();
3131 Parcel reply = Parcel.obtain();
3132 data.writeInterfaceToken(IActivityManager.descriptor);
3133 data.writeStrongBinder(token);
3134 data.writeInt(immersive ? 1 : 0);
3135 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3136 reply.readException();
3137 data.recycle();
3138 reply.recycle();
3139 }
3140
3141 public boolean isImmersive(IBinder token)
3142 throws RemoteException {
3143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
3145 data.writeInterfaceToken(IActivityManager.descriptor);
3146 data.writeStrongBinder(token);
3147 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003148 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003149 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003150 data.recycle();
3151 reply.recycle();
3152 return res;
3153 }
3154
3155 public boolean isTopActivityImmersive()
3156 throws RemoteException {
3157 Parcel data = Parcel.obtain();
3158 Parcel reply = Parcel.obtain();
3159 data.writeInterfaceToken(IActivityManager.descriptor);
3160 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003161 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003162 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003163 data.recycle();
3164 reply.recycle();
3165 return res;
3166 }
3167
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003168 public void crashApplication(int uid, int initialPid, String packageName,
3169 String message) throws RemoteException {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 data.writeInt(uid);
3174 data.writeInt(initialPid);
3175 data.writeString(packageName);
3176 data.writeString(message);
3177 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 data.recycle();
3180 reply.recycle();
3181 }
Andy McFadden824c5102010-07-09 16:26:57 -07003182
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003183 public String getProviderMimeType(Uri uri)
3184 throws RemoteException {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 uri.writeToParcel(data, 0);
3189 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 String res = reply.readString();
3192 data.recycle();
3193 reply.recycle();
3194 return res;
3195 }
3196
Dianne Hackborn7e269642010-08-25 19:50:20 -07003197 public IBinder newUriPermissionOwner(String name)
3198 throws RemoteException {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 data.writeString(name);
3203 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 IBinder res = reply.readStrongBinder();
3206 data.recycle();
3207 reply.recycle();
3208 return res;
3209 }
3210
3211 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3212 Uri uri, int mode) throws RemoteException {
3213 Parcel data = Parcel.obtain();
3214 Parcel reply = Parcel.obtain();
3215 data.writeInterfaceToken(IActivityManager.descriptor);
3216 data.writeStrongBinder(owner);
3217 data.writeInt(fromUid);
3218 data.writeString(targetPkg);
3219 uri.writeToParcel(data, 0);
3220 data.writeInt(mode);
3221 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3222 reply.readException();
3223 data.recycle();
3224 reply.recycle();
3225 }
3226
3227 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3228 int mode) throws RemoteException {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeStrongBinder(owner);
3233 if (uri != null) {
3234 data.writeInt(1);
3235 uri.writeToParcel(data, 0);
3236 } else {
3237 data.writeInt(0);
3238 }
3239 data.writeInt(mode);
3240 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3241 reply.readException();
3242 data.recycle();
3243 reply.recycle();
3244 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003245
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003246 public int checkGrantUriPermission(int callingUid, String targetPkg,
3247 Uri uri, int modeFlags) throws RemoteException {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeInt(callingUid);
3252 data.writeString(targetPkg);
3253 uri.writeToParcel(data, 0);
3254 data.writeInt(modeFlags);
3255 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3256 reply.readException();
3257 int res = reply.readInt();
3258 data.recycle();
3259 reply.recycle();
3260 return res;
3261 }
3262
Andy McFadden824c5102010-07-09 16:26:57 -07003263 public boolean dumpHeap(String process, boolean managed,
3264 String path, ParcelFileDescriptor fd) throws RemoteException {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 data.writeString(process);
3269 data.writeInt(managed ? 1 : 0);
3270 data.writeString(path);
3271 if (fd != null) {
3272 data.writeInt(1);
3273 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3274 } else {
3275 data.writeInt(0);
3276 }
3277 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3278 reply.readException();
3279 boolean res = reply.readInt() != 0;
3280 reply.recycle();
3281 data.recycle();
3282 return res;
3283 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003284
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003285 public int startActivities(IApplicationThread caller,
3286 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3287 Parcel data = Parcel.obtain();
3288 Parcel reply = Parcel.obtain();
3289 data.writeInterfaceToken(IActivityManager.descriptor);
3290 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3291 data.writeTypedArray(intents, 0);
3292 data.writeStringArray(resolvedTypes);
3293 data.writeStrongBinder(resultTo);
3294 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3295 reply.readException();
3296 int result = reply.readInt();
3297 reply.recycle();
3298 data.recycle();
3299 return result;
3300 }
3301
3302 public int startActivitiesInPackage(int uid,
3303 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3304 Parcel data = Parcel.obtain();
3305 Parcel reply = Parcel.obtain();
3306 data.writeInterfaceToken(IActivityManager.descriptor);
3307 data.writeInt(uid);
3308 data.writeTypedArray(intents, 0);
3309 data.writeStringArray(resolvedTypes);
3310 data.writeStrongBinder(resultTo);
3311 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3312 reply.readException();
3313 int result = reply.readInt();
3314 reply.recycle();
3315 data.recycle();
3316 return result;
3317 }
3318
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003319 public int getFrontActivityScreenCompatMode() throws RemoteException {
3320 Parcel data = Parcel.obtain();
3321 Parcel reply = Parcel.obtain();
3322 data.writeInterfaceToken(IActivityManager.descriptor);
3323 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3324 reply.readException();
3325 int mode = reply.readInt();
3326 reply.recycle();
3327 data.recycle();
3328 return mode;
3329 }
3330
3331 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3332 Parcel data = Parcel.obtain();
3333 Parcel reply = Parcel.obtain();
3334 data.writeInterfaceToken(IActivityManager.descriptor);
3335 data.writeInt(mode);
3336 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3337 reply.readException();
3338 reply.recycle();
3339 data.recycle();
3340 }
3341
3342 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3343 Parcel data = Parcel.obtain();
3344 Parcel reply = Parcel.obtain();
3345 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003346 data.writeString(packageName);
3347 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003348 reply.readException();
3349 int mode = reply.readInt();
3350 reply.recycle();
3351 data.recycle();
3352 return mode;
3353 }
3354
3355 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003356 throws RemoteException {
3357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003361 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003362 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 reply.recycle();
3365 data.recycle();
3366 }
3367
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003368 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeString(packageName);
3373 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3374 reply.readException();
3375 boolean ask = reply.readInt() != 0;
3376 reply.recycle();
3377 data.recycle();
3378 return ask;
3379 }
3380
3381 public void setPackageAskScreenCompat(String packageName, boolean ask)
3382 throws RemoteException {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 data.writeString(packageName);
3387 data.writeInt(ask ? 1 : 0);
3388 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3389 reply.readException();
3390 reply.recycle();
3391 data.recycle();
3392 }
3393
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003394 public boolean switchUser(int userid) throws RemoteException {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 data.writeInt(userid);
3399 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3400 reply.readException();
3401 boolean result = reply.readInt() != 0;
3402 reply.recycle();
3403 data.recycle();
3404 return result;
3405 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003406
3407 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3408 Parcel data = Parcel.obtain();
3409 Parcel reply = Parcel.obtain();
3410 data.writeInterfaceToken(IActivityManager.descriptor);
3411 data.writeInt(taskId);
3412 data.writeInt(subTaskIndex);
3413 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3414 reply.readException();
3415 boolean result = reply.readInt() != 0;
3416 reply.recycle();
3417 data.recycle();
3418 return result;
3419 }
3420
3421 public boolean removeTask(int taskId, int flags) throws RemoteException {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 data.writeInt(taskId);
3426 data.writeInt(flags);
3427 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 boolean result = reply.readInt() != 0;
3430 reply.recycle();
3431 data.recycle();
3432 return result;
3433 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003434
Jeff Sharkeya4620792011-05-20 15:29:23 -07003435 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3440 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3441 reply.readException();
3442 data.recycle();
3443 reply.recycle();
3444 }
3445
3446 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3447 Parcel data = Parcel.obtain();
3448 Parcel reply = Parcel.obtain();
3449 data.writeInterfaceToken(IActivityManager.descriptor);
3450 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3451 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3452 reply.readException();
3453 data.recycle();
3454 reply.recycle();
3455 }
3456
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003457 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3458 Parcel data = Parcel.obtain();
3459 Parcel reply = Parcel.obtain();
3460 data.writeInterfaceToken(IActivityManager.descriptor);
3461 data.writeStrongBinder(sender.asBinder());
3462 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3463 reply.readException();
3464 boolean res = reply.readInt() != 0;
3465 data.recycle();
3466 reply.recycle();
3467 return res;
3468 }
3469
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003470 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3471 {
3472 Parcel data = Parcel.obtain();
3473 Parcel reply = Parcel.obtain();
3474 data.writeInterfaceToken(IActivityManager.descriptor);
3475 values.writeToParcel(data, 0);
3476 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3477 reply.readException();
3478 data.recycle();
3479 reply.recycle();
3480 }
3481
Dianne Hackbornb437e092011-08-05 17:50:29 -07003482 public long[] getProcessPss(int[] pids) throws RemoteException {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 data.writeIntArray(pids);
3487 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3488 reply.readException();
3489 long[] res = reply.createLongArray();
3490 data.recycle();
3491 reply.recycle();
3492 return res;
3493 }
3494
Dianne Hackborn661cd522011-08-22 00:26:20 -07003495 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
3498 data.writeInterfaceToken(IActivityManager.descriptor);
3499 TextUtils.writeToParcel(msg, data, 0);
3500 data.writeInt(always ? 1 : 0);
3501 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3502 reply.readException();
3503 data.recycle();
3504 reply.recycle();
3505 }
3506
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003507 private IBinder mRemote;
3508}