blob: 7994d7cd3bfb02d68204fcf7c0b35695b2e517be [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 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001095
1096 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1097 data.enforceInterface(IActivityManager.descriptor);
1098 killAllBackgroundProcesses();
1099 reply.writeNoException();
1100 return true;
1101 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001102
1103 case FORCE_STOP_PACKAGE_TRANSACTION: {
1104 data.enforceInterface(IActivityManager.descriptor);
1105 String packageName = data.readString();
1106 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 reply.writeNoException();
1108 return true;
1109 }
1110
1111 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 ConfigurationInfo config = getDeviceConfigurationInfo();
1114 reply.writeNoException();
1115 config.writeToParcel(reply, 0);
1116 return true;
1117 }
1118
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001119 case PROFILE_CONTROL_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 String process = data.readString();
1122 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001123 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001124 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001125 ParcelFileDescriptor fd = data.readInt() != 0
1126 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001127 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001128 reply.writeNoException();
1129 reply.writeInt(res ? 1 : 0);
1130 return true;
1131 }
1132
Dianne Hackborn55280a92009-05-07 15:53:46 -07001133 case SHUTDOWN_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 boolean res = shutdown(data.readInt());
1136 reply.writeNoException();
1137 reply.writeInt(res ? 1 : 0);
1138 return true;
1139 }
1140
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001141 case STOP_APP_SWITCHES_TRANSACTION: {
1142 data.enforceInterface(IActivityManager.descriptor);
1143 stopAppSwitches();
1144 reply.writeNoException();
1145 return true;
1146 }
1147
1148 case RESUME_APP_SWITCHES_TRANSACTION: {
1149 data.enforceInterface(IActivityManager.descriptor);
1150 resumeAppSwitches();
1151 reply.writeNoException();
1152 return true;
1153 }
1154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 case PEEK_SERVICE_TRANSACTION: {
1156 data.enforceInterface(IActivityManager.descriptor);
1157 Intent service = Intent.CREATOR.createFromParcel(data);
1158 String resolvedType = data.readString();
1159 IBinder binder = peekService(service, resolvedType);
1160 reply.writeNoException();
1161 reply.writeStrongBinder(binder);
1162 return true;
1163 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001164
1165 case START_BACKUP_AGENT_TRANSACTION: {
1166 data.enforceInterface(IActivityManager.descriptor);
1167 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1168 int backupRestoreMode = data.readInt();
1169 boolean success = bindBackupAgent(info, backupRestoreMode);
1170 reply.writeNoException();
1171 reply.writeInt(success ? 1 : 0);
1172 return true;
1173 }
1174
1175 case BACKUP_AGENT_CREATED_TRANSACTION: {
1176 data.enforceInterface(IActivityManager.descriptor);
1177 String packageName = data.readString();
1178 IBinder agent = data.readStrongBinder();
1179 backupAgentCreated(packageName, agent);
1180 reply.writeNoException();
1181 return true;
1182 }
1183
1184 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1185 data.enforceInterface(IActivityManager.descriptor);
1186 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1187 unbindBackupAgent(info);
1188 reply.writeNoException();
1189 return true;
1190 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001191
1192 case REGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1193 data.enforceInterface(IActivityManager.descriptor);
1194 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1195 data.readStrongBinder());
1196 registerActivityWatcher(watcher);
1197 return true;
1198 }
1199
1200 case UNREGISTER_ACTIVITY_WATCHER_TRANSACTION: {
1201 data.enforceInterface(IActivityManager.descriptor);
1202 IActivityWatcher watcher = IActivityWatcher.Stub.asInterface(
1203 data.readStrongBinder());
1204 unregisterActivityWatcher(watcher);
1205 return true;
1206 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001207
1208 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1209 {
1210 data.enforceInterface(IActivityManager.descriptor);
1211 int uid = data.readInt();
1212 Intent intent = Intent.CREATOR.createFromParcel(data);
1213 String resolvedType = data.readString();
1214 IBinder resultTo = data.readStrongBinder();
1215 String resultWho = data.readString();
1216 int requestCode = data.readInt();
1217 boolean onlyIfNeeded = data.readInt() != 0;
1218 int result = startActivityInPackage(uid, intent, resolvedType,
1219 resultTo, resultWho, requestCode, onlyIfNeeded);
1220 reply.writeNoException();
1221 reply.writeInt(result);
1222 return true;
1223 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001224
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001225 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 String pkg = data.readString();
1228 int uid = data.readInt();
1229 killApplicationWithUid(pkg, uid);
1230 reply.writeNoException();
1231 return true;
1232 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001233
1234 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 String reason = data.readString();
1237 closeSystemDialogs(reason);
1238 reply.writeNoException();
1239 return true;
1240 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001241
1242 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001244 int[] pids = data.createIntArray();
1245 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001246 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001247 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001248 return true;
1249 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001250
1251 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1252 data.enforceInterface(IActivityManager.descriptor);
1253 String processName = data.readString();
1254 int uid = data.readInt();
1255 killApplicationProcess(processName, uid);
1256 reply.writeNoException();
1257 return true;
1258 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001259
1260 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 IBinder token = data.readStrongBinder();
1263 String packageName = data.readString();
1264 int enterAnim = data.readInt();
1265 int exitAnim = data.readInt();
1266 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001267 reply.writeNoException();
1268 return true;
1269 }
1270
1271 case IS_USER_A_MONKEY_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001273 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001274 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001275 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001276 return true;
1277 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001278
1279 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 finishHeavyWeightApp();
1282 reply.writeNoException();
1283 return true;
1284 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001285
1286 case IS_IMMERSIVE_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
1288 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001289 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001290 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001291 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001292 return true;
1293 }
1294
1295 case SET_IMMERSIVE_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 IBinder token = data.readStrongBinder();
1298 boolean imm = data.readInt() == 1;
1299 setImmersive(token, imm);
1300 reply.writeNoException();
1301 return true;
1302 }
1303
1304 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1305 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001306 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001307 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001308 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001309 return true;
1310 }
1311
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001312 case CRASH_APPLICATION_TRANSACTION: {
1313 data.enforceInterface(IActivityManager.descriptor);
1314 int uid = data.readInt();
1315 int initialPid = data.readInt();
1316 String packageName = data.readString();
1317 String message = data.readString();
1318 crashApplication(uid, initialPid, packageName, message);
1319 reply.writeNoException();
1320 return true;
1321 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001322
1323 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 Uri uri = Uri.CREATOR.createFromParcel(data);
1326 String type = getProviderMimeType(uri);
1327 reply.writeNoException();
1328 reply.writeString(type);
1329 return true;
1330 }
1331
Dianne Hackborn7e269642010-08-25 19:50:20 -07001332 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 String name = data.readString();
1335 IBinder perm = newUriPermissionOwner(name);
1336 reply.writeNoException();
1337 reply.writeStrongBinder(perm);
1338 return true;
1339 }
1340
1341 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1342 data.enforceInterface(IActivityManager.descriptor);
1343 IBinder owner = data.readStrongBinder();
1344 int fromUid = data.readInt();
1345 String targetPkg = data.readString();
1346 Uri uri = Uri.CREATOR.createFromParcel(data);
1347 int mode = data.readInt();
1348 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1349 reply.writeNoException();
1350 return true;
1351 }
1352
1353 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 IBinder owner = data.readStrongBinder();
1356 Uri uri = null;
1357 if (data.readInt() != 0) {
1358 Uri.CREATOR.createFromParcel(data);
1359 }
1360 int mode = data.readInt();
1361 revokeUriPermissionFromOwner(owner, uri, mode);
1362 reply.writeNoException();
1363 return true;
1364 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001365
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001366 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 int callingUid = data.readInt();
1369 String targetPkg = data.readString();
1370 Uri uri = Uri.CREATOR.createFromParcel(data);
1371 int modeFlags = data.readInt();
1372 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1373 reply.writeNoException();
1374 reply.writeInt(res);
1375 return true;
1376 }
1377
Andy McFadden824c5102010-07-09 16:26:57 -07001378 case DUMP_HEAP_TRANSACTION: {
1379 data.enforceInterface(IActivityManager.descriptor);
1380 String process = data.readString();
1381 boolean managed = data.readInt() != 0;
1382 String path = data.readString();
1383 ParcelFileDescriptor fd = data.readInt() != 0
1384 ? data.readFileDescriptor() : null;
1385 boolean res = dumpHeap(process, managed, path, fd);
1386 reply.writeNoException();
1387 reply.writeInt(res ? 1 : 0);
1388 return true;
1389 }
1390
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001391 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1392 {
1393 data.enforceInterface(IActivityManager.descriptor);
1394 int uid = data.readInt();
1395 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1396 String[] resolvedTypes = data.createStringArray();
1397 IBinder resultTo = data.readStrongBinder();
1398 int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
1399 reply.writeNoException();
1400 reply.writeInt(result);
1401 return true;
1402 }
1403
1404 case START_ACTIVITIES_TRANSACTION:
1405 {
1406 data.enforceInterface(IActivityManager.descriptor);
1407 IBinder b = data.readStrongBinder();
1408 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1409 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1410 String[] resolvedTypes = data.createStringArray();
1411 IBinder resultTo = data.readStrongBinder();
1412 int result = startActivities(app, intents, resolvedTypes, resultTo);
1413 reply.writeNoException();
1414 reply.writeInt(result);
1415 return true;
1416 }
1417
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001418 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1419 {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 int mode = getFrontActivityScreenCompatMode();
1422 reply.writeNoException();
1423 reply.writeInt(mode);
1424 return true;
1425 }
1426
1427 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1428 {
1429 data.enforceInterface(IActivityManager.descriptor);
1430 int mode = data.readInt();
1431 setFrontActivityScreenCompatMode(mode);
1432 reply.writeNoException();
1433 reply.writeInt(mode);
1434 return true;
1435 }
1436
1437 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1438 {
1439 data.enforceInterface(IActivityManager.descriptor);
1440 String pkg = data.readString();
1441 int mode = getPackageScreenCompatMode(pkg);
1442 reply.writeNoException();
1443 reply.writeInt(mode);
1444 return true;
1445 }
1446
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001447 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1448 {
1449 data.enforceInterface(IActivityManager.descriptor);
1450 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001451 int mode = data.readInt();
1452 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001453 reply.writeNoException();
1454 return true;
1455 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001456
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001457 case SWITCH_USER_TRANSACTION: {
1458 data.enforceInterface(IActivityManager.descriptor);
1459 int userid = data.readInt();
1460 boolean result = switchUser(userid);
1461 reply.writeNoException();
1462 reply.writeInt(result ? 1 : 0);
1463 return true;
1464 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001465
1466 case REMOVE_SUB_TASK_TRANSACTION:
1467 {
1468 data.enforceInterface(IActivityManager.descriptor);
1469 int taskId = data.readInt();
1470 int subTaskIndex = data.readInt();
1471 boolean result = removeSubTask(taskId, subTaskIndex);
1472 reply.writeNoException();
1473 reply.writeInt(result ? 1 : 0);
1474 return true;
1475 }
1476
1477 case REMOVE_TASK_TRANSACTION:
1478 {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 int taskId = data.readInt();
1481 int fl = data.readInt();
1482 boolean result = removeTask(taskId, fl);
1483 reply.writeNoException();
1484 reply.writeInt(result ? 1 : 0);
1485 return true;
1486 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001487
Jeff Sharkeya4620792011-05-20 15:29:23 -07001488 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
1490 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1491 data.readStrongBinder());
1492 registerProcessObserver(observer);
1493 return true;
1494 }
1495
1496 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1497 data.enforceInterface(IActivityManager.descriptor);
1498 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1499 data.readStrongBinder());
1500 unregisterProcessObserver(observer);
1501 return true;
1502 }
1503
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001504 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1505 {
1506 data.enforceInterface(IActivityManager.descriptor);
1507 String pkg = data.readString();
1508 boolean ask = getPackageAskScreenCompat(pkg);
1509 reply.writeNoException();
1510 reply.writeInt(ask ? 1 : 0);
1511 return true;
1512 }
1513
1514 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1515 {
1516 data.enforceInterface(IActivityManager.descriptor);
1517 String pkg = data.readString();
1518 boolean ask = data.readInt() != 0;
1519 setPackageAskScreenCompat(pkg, ask);
1520 reply.writeNoException();
1521 return true;
1522 }
1523
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001524 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IIntentSender r = IIntentSender.Stub.asInterface(
1527 data.readStrongBinder());
1528 boolean res = isIntentSenderTargetedToPackage(r);
1529 reply.writeNoException();
1530 reply.writeInt(res ? 1 : 0);
1531 return true;
1532 }
1533
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001534 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1535 data.enforceInterface(IActivityManager.descriptor);
1536 Configuration config = Configuration.CREATOR.createFromParcel(data);
1537 updatePersistentConfiguration(config);
1538 reply.writeNoException();
1539 return true;
1540 }
1541
Dianne Hackbornb437e092011-08-05 17:50:29 -07001542 case GET_PROCESS_PSS_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 int[] pids = data.createIntArray();
1545 long[] pss = getProcessPss(pids);
1546 reply.writeNoException();
1547 reply.writeLongArray(pss);
1548 return true;
1549 }
1550
Dianne Hackborn661cd522011-08-22 00:26:20 -07001551 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1554 boolean always = data.readInt() != 0;
1555 showBootMessage(msg, always);
1556 reply.writeNoException();
1557 return true;
1558 }
1559
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001560 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
1562 dismissKeyguardOnNextActivity();
1563 reply.writeNoException();
1564 return true;
1565 }
1566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001567 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001568
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001569 return super.onTransact(code, data, reply, flags);
1570 }
1571
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001572 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001573 return this;
1574 }
1575
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001576 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1577 protected IActivityManager create() {
1578 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001579 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001580 Log.v("ActivityManager", "default service binder = " + b);
1581 }
1582 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001583 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001584 Log.v("ActivityManager", "default service = " + am);
1585 }
1586 return am;
1587 }
1588 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001589}
1590
1591class ActivityManagerProxy implements IActivityManager
1592{
1593 public ActivityManagerProxy(IBinder remote)
1594 {
1595 mRemote = remote;
1596 }
1597
1598 public IBinder asBinder()
1599 {
1600 return mRemote;
1601 }
1602
1603 public int startActivity(IApplicationThread caller, Intent intent,
1604 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1605 IBinder resultTo, String resultWho,
1606 int requestCode, boolean onlyIfNeeded,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001607 boolean debug, String profileFile, ParcelFileDescriptor profileFd,
1608 boolean autoStopProfiler) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001609 Parcel data = Parcel.obtain();
1610 Parcel reply = Parcel.obtain();
1611 data.writeInterfaceToken(IActivityManager.descriptor);
1612 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1613 intent.writeToParcel(data, 0);
1614 data.writeString(resolvedType);
1615 data.writeTypedArray(grantedUriPermissions, 0);
1616 data.writeInt(grantedMode);
1617 data.writeStrongBinder(resultTo);
1618 data.writeString(resultWho);
1619 data.writeInt(requestCode);
1620 data.writeInt(onlyIfNeeded ? 1 : 0);
1621 data.writeInt(debug ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001622 data.writeString(profileFile);
1623 if (profileFd != null) {
1624 data.writeInt(1);
1625 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1626 } else {
1627 data.writeInt(0);
1628 }
1629 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001630 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1631 reply.readException();
1632 int result = reply.readInt();
1633 reply.recycle();
1634 data.recycle();
1635 return result;
1636 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001637 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1638 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1639 IBinder resultTo, String resultWho,
1640 int requestCode, boolean onlyIfNeeded,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001641 boolean debug, String profileFile, ParcelFileDescriptor profileFd,
1642 boolean autoStopProfiler) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001643 Parcel data = Parcel.obtain();
1644 Parcel reply = Parcel.obtain();
1645 data.writeInterfaceToken(IActivityManager.descriptor);
1646 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1647 intent.writeToParcel(data, 0);
1648 data.writeString(resolvedType);
1649 data.writeTypedArray(grantedUriPermissions, 0);
1650 data.writeInt(grantedMode);
1651 data.writeStrongBinder(resultTo);
1652 data.writeString(resultWho);
1653 data.writeInt(requestCode);
1654 data.writeInt(onlyIfNeeded ? 1 : 0);
1655 data.writeInt(debug ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001656 data.writeString(profileFile);
1657 if (profileFd != null) {
1658 data.writeInt(1);
1659 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1660 } else {
1661 data.writeInt(0);
1662 }
1663 data.writeInt(autoStopProfiler ? 1 : 0);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001664 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1665 reply.readException();
1666 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1667 reply.recycle();
1668 data.recycle();
1669 return result;
1670 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001671 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1672 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1673 IBinder resultTo, String resultWho,
1674 int requestCode, boolean onlyIfNeeded,
1675 boolean debug, Configuration config) throws RemoteException {
1676 Parcel data = Parcel.obtain();
1677 Parcel reply = Parcel.obtain();
1678 data.writeInterfaceToken(IActivityManager.descriptor);
1679 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1680 intent.writeToParcel(data, 0);
1681 data.writeString(resolvedType);
1682 data.writeTypedArray(grantedUriPermissions, 0);
1683 data.writeInt(grantedMode);
1684 data.writeStrongBinder(resultTo);
1685 data.writeString(resultWho);
1686 data.writeInt(requestCode);
1687 data.writeInt(onlyIfNeeded ? 1 : 0);
1688 data.writeInt(debug ? 1 : 0);
1689 config.writeToParcel(data, 0);
1690 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1691 reply.readException();
1692 int result = reply.readInt();
1693 reply.recycle();
1694 data.recycle();
1695 return result;
1696 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001697 public int startActivityIntentSender(IApplicationThread caller,
1698 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001699 IBinder resultTo, String resultWho, int requestCode,
1700 int flagsMask, int flagsValues) throws RemoteException {
1701 Parcel data = Parcel.obtain();
1702 Parcel reply = Parcel.obtain();
1703 data.writeInterfaceToken(IActivityManager.descriptor);
1704 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1705 intent.writeToParcel(data, 0);
1706 if (fillInIntent != null) {
1707 data.writeInt(1);
1708 fillInIntent.writeToParcel(data, 0);
1709 } else {
1710 data.writeInt(0);
1711 }
1712 data.writeString(resolvedType);
1713 data.writeStrongBinder(resultTo);
1714 data.writeString(resultWho);
1715 data.writeInt(requestCode);
1716 data.writeInt(flagsMask);
1717 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001718 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001719 reply.readException();
1720 int result = reply.readInt();
1721 reply.recycle();
1722 data.recycle();
1723 return result;
1724 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001725 public boolean startNextMatchingActivity(IBinder callingActivity,
1726 Intent intent) throws RemoteException {
1727 Parcel data = Parcel.obtain();
1728 Parcel reply = Parcel.obtain();
1729 data.writeInterfaceToken(IActivityManager.descriptor);
1730 data.writeStrongBinder(callingActivity);
1731 intent.writeToParcel(data, 0);
1732 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1733 reply.readException();
1734 int result = reply.readInt();
1735 reply.recycle();
1736 data.recycle();
1737 return result != 0;
1738 }
1739 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1740 throws RemoteException {
1741 Parcel data = Parcel.obtain();
1742 Parcel reply = Parcel.obtain();
1743 data.writeInterfaceToken(IActivityManager.descriptor);
1744 data.writeStrongBinder(token);
1745 data.writeInt(resultCode);
1746 if (resultData != null) {
1747 data.writeInt(1);
1748 resultData.writeToParcel(data, 0);
1749 } else {
1750 data.writeInt(0);
1751 }
1752 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1753 reply.readException();
1754 boolean res = reply.readInt() != 0;
1755 data.recycle();
1756 reply.recycle();
1757 return res;
1758 }
1759 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1760 {
1761 Parcel data = Parcel.obtain();
1762 Parcel reply = Parcel.obtain();
1763 data.writeInterfaceToken(IActivityManager.descriptor);
1764 data.writeStrongBinder(token);
1765 data.writeString(resultWho);
1766 data.writeInt(requestCode);
1767 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1768 reply.readException();
1769 data.recycle();
1770 reply.recycle();
1771 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001772 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1773 Parcel data = Parcel.obtain();
1774 Parcel reply = Parcel.obtain();
1775 data.writeInterfaceToken(IActivityManager.descriptor);
1776 data.writeStrongBinder(token);
1777 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1778 reply.readException();
1779 boolean res = reply.readInt() != 0;
1780 data.recycle();
1781 reply.recycle();
1782 return res;
1783 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001784 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001785 IIntentReceiver receiver,
1786 IntentFilter filter, String perm) throws RemoteException
1787 {
1788 Parcel data = Parcel.obtain();
1789 Parcel reply = Parcel.obtain();
1790 data.writeInterfaceToken(IActivityManager.descriptor);
1791 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001792 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001793 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1794 filter.writeToParcel(data, 0);
1795 data.writeString(perm);
1796 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1797 reply.readException();
1798 Intent intent = null;
1799 int haveIntent = reply.readInt();
1800 if (haveIntent != 0) {
1801 intent = Intent.CREATOR.createFromParcel(reply);
1802 }
1803 reply.recycle();
1804 data.recycle();
1805 return intent;
1806 }
1807 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1808 {
1809 Parcel data = Parcel.obtain();
1810 Parcel reply = Parcel.obtain();
1811 data.writeInterfaceToken(IActivityManager.descriptor);
1812 data.writeStrongBinder(receiver.asBinder());
1813 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1814 reply.readException();
1815 data.recycle();
1816 reply.recycle();
1817 }
1818 public int broadcastIntent(IApplicationThread caller,
1819 Intent intent, String resolvedType, IIntentReceiver resultTo,
1820 int resultCode, String resultData, Bundle map,
1821 String requiredPermission, boolean serialized,
1822 boolean sticky) throws RemoteException
1823 {
1824 Parcel data = Parcel.obtain();
1825 Parcel reply = Parcel.obtain();
1826 data.writeInterfaceToken(IActivityManager.descriptor);
1827 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1828 intent.writeToParcel(data, 0);
1829 data.writeString(resolvedType);
1830 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1831 data.writeInt(resultCode);
1832 data.writeString(resultData);
1833 data.writeBundle(map);
1834 data.writeString(requiredPermission);
1835 data.writeInt(serialized ? 1 : 0);
1836 data.writeInt(sticky ? 1 : 0);
1837 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1838 reply.readException();
1839 int res = reply.readInt();
1840 reply.recycle();
1841 data.recycle();
1842 return res;
1843 }
1844 public void unbroadcastIntent(IApplicationThread caller, Intent intent) throws RemoteException
1845 {
1846 Parcel data = Parcel.obtain();
1847 Parcel reply = Parcel.obtain();
1848 data.writeInterfaceToken(IActivityManager.descriptor);
1849 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1850 intent.writeToParcel(data, 0);
1851 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1852 reply.readException();
1853 data.recycle();
1854 reply.recycle();
1855 }
1856 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1857 {
1858 Parcel data = Parcel.obtain();
1859 Parcel reply = Parcel.obtain();
1860 data.writeInterfaceToken(IActivityManager.descriptor);
1861 data.writeStrongBinder(who);
1862 data.writeInt(resultCode);
1863 data.writeString(resultData);
1864 data.writeBundle(map);
1865 data.writeInt(abortBroadcast ? 1 : 0);
1866 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1867 reply.readException();
1868 data.recycle();
1869 reply.recycle();
1870 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001871 public void attachApplication(IApplicationThread app) throws RemoteException
1872 {
1873 Parcel data = Parcel.obtain();
1874 Parcel reply = Parcel.obtain();
1875 data.writeInterfaceToken(IActivityManager.descriptor);
1876 data.writeStrongBinder(app.asBinder());
1877 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1878 reply.readException();
1879 data.recycle();
1880 reply.recycle();
1881 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001882 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1883 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001884 {
1885 Parcel data = Parcel.obtain();
1886 Parcel reply = Parcel.obtain();
1887 data.writeInterfaceToken(IActivityManager.descriptor);
1888 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001889 if (config != null) {
1890 data.writeInt(1);
1891 config.writeToParcel(data, 0);
1892 } else {
1893 data.writeInt(0);
1894 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001895 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001896 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1897 reply.readException();
1898 data.recycle();
1899 reply.recycle();
1900 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001901 public void activityPaused(IBinder token) throws RemoteException
1902 {
1903 Parcel data = Parcel.obtain();
1904 Parcel reply = Parcel.obtain();
1905 data.writeInterfaceToken(IActivityManager.descriptor);
1906 data.writeStrongBinder(token);
1907 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1908 reply.readException();
1909 data.recycle();
1910 reply.recycle();
1911 }
1912 public void activityStopped(IBinder token, Bundle state,
1913 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001914 {
1915 Parcel data = Parcel.obtain();
1916 Parcel reply = Parcel.obtain();
1917 data.writeInterfaceToken(IActivityManager.descriptor);
1918 data.writeStrongBinder(token);
1919 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001920 if (thumbnail != null) {
1921 data.writeInt(1);
1922 thumbnail.writeToParcel(data, 0);
1923 } else {
1924 data.writeInt(0);
1925 }
1926 TextUtils.writeToParcel(description, data, 0);
1927 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1928 reply.readException();
1929 data.recycle();
1930 reply.recycle();
1931 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001932 public void activitySlept(IBinder token) throws RemoteException
1933 {
1934 Parcel data = Parcel.obtain();
1935 Parcel reply = Parcel.obtain();
1936 data.writeInterfaceToken(IActivityManager.descriptor);
1937 data.writeStrongBinder(token);
1938 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1939 reply.readException();
1940 data.recycle();
1941 reply.recycle();
1942 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001943 public void activityDestroyed(IBinder token) throws RemoteException
1944 {
1945 Parcel data = Parcel.obtain();
1946 Parcel reply = Parcel.obtain();
1947 data.writeInterfaceToken(IActivityManager.descriptor);
1948 data.writeStrongBinder(token);
1949 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1950 reply.readException();
1951 data.recycle();
1952 reply.recycle();
1953 }
1954 public String getCallingPackage(IBinder token) throws RemoteException
1955 {
1956 Parcel data = Parcel.obtain();
1957 Parcel reply = Parcel.obtain();
1958 data.writeInterfaceToken(IActivityManager.descriptor);
1959 data.writeStrongBinder(token);
1960 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1961 reply.readException();
1962 String res = reply.readString();
1963 data.recycle();
1964 reply.recycle();
1965 return res;
1966 }
1967 public ComponentName getCallingActivity(IBinder token)
1968 throws RemoteException {
1969 Parcel data = Parcel.obtain();
1970 Parcel reply = Parcel.obtain();
1971 data.writeInterfaceToken(IActivityManager.descriptor);
1972 data.writeStrongBinder(token);
1973 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1974 reply.readException();
1975 ComponentName res = ComponentName.readFromParcel(reply);
1976 data.recycle();
1977 reply.recycle();
1978 return res;
1979 }
1980 public List getTasks(int maxNum, int flags,
1981 IThumbnailReceiver receiver) throws RemoteException {
1982 Parcel data = Parcel.obtain();
1983 Parcel reply = Parcel.obtain();
1984 data.writeInterfaceToken(IActivityManager.descriptor);
1985 data.writeInt(maxNum);
1986 data.writeInt(flags);
1987 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1988 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1989 reply.readException();
1990 ArrayList list = null;
1991 int N = reply.readInt();
1992 if (N >= 0) {
1993 list = new ArrayList();
1994 while (N > 0) {
1995 ActivityManager.RunningTaskInfo info =
1996 ActivityManager.RunningTaskInfo.CREATOR
1997 .createFromParcel(reply);
1998 list.add(info);
1999 N--;
2000 }
2001 }
2002 data.recycle();
2003 reply.recycle();
2004 return list;
2005 }
2006 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2007 int flags) throws RemoteException {
2008 Parcel data = Parcel.obtain();
2009 Parcel reply = Parcel.obtain();
2010 data.writeInterfaceToken(IActivityManager.descriptor);
2011 data.writeInt(maxNum);
2012 data.writeInt(flags);
2013 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2014 reply.readException();
2015 ArrayList<ActivityManager.RecentTaskInfo> list
2016 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2017 data.recycle();
2018 reply.recycle();
2019 return list;
2020 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002021 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002022 Parcel data = Parcel.obtain();
2023 Parcel reply = Parcel.obtain();
2024 data.writeInterfaceToken(IActivityManager.descriptor);
2025 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002026 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002027 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002028 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002029 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002030 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002031 }
2032 data.recycle();
2033 reply.recycle();
2034 return bm;
2035 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002036 public List getServices(int maxNum, int flags) throws RemoteException {
2037 Parcel data = Parcel.obtain();
2038 Parcel reply = Parcel.obtain();
2039 data.writeInterfaceToken(IActivityManager.descriptor);
2040 data.writeInt(maxNum);
2041 data.writeInt(flags);
2042 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2043 reply.readException();
2044 ArrayList list = null;
2045 int N = reply.readInt();
2046 if (N >= 0) {
2047 list = new ArrayList();
2048 while (N > 0) {
2049 ActivityManager.RunningServiceInfo info =
2050 ActivityManager.RunningServiceInfo.CREATOR
2051 .createFromParcel(reply);
2052 list.add(info);
2053 N--;
2054 }
2055 }
2056 data.recycle();
2057 reply.recycle();
2058 return list;
2059 }
2060 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2061 throws RemoteException {
2062 Parcel data = Parcel.obtain();
2063 Parcel reply = Parcel.obtain();
2064 data.writeInterfaceToken(IActivityManager.descriptor);
2065 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2066 reply.readException();
2067 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2068 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2069 data.recycle();
2070 reply.recycle();
2071 return list;
2072 }
2073 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2074 throws RemoteException {
2075 Parcel data = Parcel.obtain();
2076 Parcel reply = Parcel.obtain();
2077 data.writeInterfaceToken(IActivityManager.descriptor);
2078 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2079 reply.readException();
2080 ArrayList<ActivityManager.RunningAppProcessInfo> list
2081 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2082 data.recycle();
2083 reply.recycle();
2084 return list;
2085 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002086 public List<ApplicationInfo> getRunningExternalApplications()
2087 throws RemoteException {
2088 Parcel data = Parcel.obtain();
2089 Parcel reply = Parcel.obtain();
2090 data.writeInterfaceToken(IActivityManager.descriptor);
2091 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2092 reply.readException();
2093 ArrayList<ApplicationInfo> list
2094 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2095 data.recycle();
2096 reply.recycle();
2097 return list;
2098 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002099 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002100 {
2101 Parcel data = Parcel.obtain();
2102 Parcel reply = Parcel.obtain();
2103 data.writeInterfaceToken(IActivityManager.descriptor);
2104 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002105 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002106 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2107 reply.readException();
2108 data.recycle();
2109 reply.recycle();
2110 }
2111 public void moveTaskToBack(int task) throws RemoteException
2112 {
2113 Parcel data = Parcel.obtain();
2114 Parcel reply = Parcel.obtain();
2115 data.writeInterfaceToken(IActivityManager.descriptor);
2116 data.writeInt(task);
2117 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2118 reply.readException();
2119 data.recycle();
2120 reply.recycle();
2121 }
2122 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2123 throws RemoteException {
2124 Parcel data = Parcel.obtain();
2125 Parcel reply = Parcel.obtain();
2126 data.writeInterfaceToken(IActivityManager.descriptor);
2127 data.writeStrongBinder(token);
2128 data.writeInt(nonRoot ? 1 : 0);
2129 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2130 reply.readException();
2131 boolean res = reply.readInt() != 0;
2132 data.recycle();
2133 reply.recycle();
2134 return res;
2135 }
2136 public void moveTaskBackwards(int task) throws RemoteException
2137 {
2138 Parcel data = Parcel.obtain();
2139 Parcel reply = Parcel.obtain();
2140 data.writeInterfaceToken(IActivityManager.descriptor);
2141 data.writeInt(task);
2142 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2143 reply.readException();
2144 data.recycle();
2145 reply.recycle();
2146 }
2147 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2148 {
2149 Parcel data = Parcel.obtain();
2150 Parcel reply = Parcel.obtain();
2151 data.writeInterfaceToken(IActivityManager.descriptor);
2152 data.writeStrongBinder(token);
2153 data.writeInt(onlyRoot ? 1 : 0);
2154 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2155 reply.readException();
2156 int res = reply.readInt();
2157 data.recycle();
2158 reply.recycle();
2159 return res;
2160 }
2161 public void finishOtherInstances(IBinder token, ComponentName className) throws RemoteException
2162 {
2163 Parcel data = Parcel.obtain();
2164 Parcel reply = Parcel.obtain();
2165 data.writeInterfaceToken(IActivityManager.descriptor);
2166 data.writeStrongBinder(token);
2167 ComponentName.writeToParcel(className, data);
2168 mRemote.transact(FINISH_OTHER_INSTANCES_TRANSACTION, data, reply, 0);
2169 reply.readException();
2170 data.recycle();
2171 reply.recycle();
2172 }
2173 public void reportThumbnail(IBinder token,
2174 Bitmap thumbnail, CharSequence description) throws RemoteException
2175 {
2176 Parcel data = Parcel.obtain();
2177 Parcel reply = Parcel.obtain();
2178 data.writeInterfaceToken(IActivityManager.descriptor);
2179 data.writeStrongBinder(token);
2180 if (thumbnail != null) {
2181 data.writeInt(1);
2182 thumbnail.writeToParcel(data, 0);
2183 } else {
2184 data.writeInt(0);
2185 }
2186 TextUtils.writeToParcel(description, data, 0);
2187 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2188 reply.readException();
2189 data.recycle();
2190 reply.recycle();
2191 }
2192 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2193 String name) throws RemoteException
2194 {
2195 Parcel data = Parcel.obtain();
2196 Parcel reply = Parcel.obtain();
2197 data.writeInterfaceToken(IActivityManager.descriptor);
2198 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2199 data.writeString(name);
2200 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2201 reply.readException();
2202 int res = reply.readInt();
2203 ContentProviderHolder cph = null;
2204 if (res != 0) {
2205 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2206 }
2207 data.recycle();
2208 reply.recycle();
2209 return cph;
2210 }
2211 public void publishContentProviders(IApplicationThread caller,
2212 List<ContentProviderHolder> providers) throws RemoteException
2213 {
2214 Parcel data = Parcel.obtain();
2215 Parcel reply = Parcel.obtain();
2216 data.writeInterfaceToken(IActivityManager.descriptor);
2217 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2218 data.writeTypedList(providers);
2219 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2220 reply.readException();
2221 data.recycle();
2222 reply.recycle();
2223 }
2224
2225 public void removeContentProvider(IApplicationThread caller,
2226 String name) throws RemoteException {
2227 Parcel data = Parcel.obtain();
2228 Parcel reply = Parcel.obtain();
2229 data.writeInterfaceToken(IActivityManager.descriptor);
2230 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2231 data.writeString(name);
2232 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2233 reply.readException();
2234 data.recycle();
2235 reply.recycle();
2236 }
2237
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002238 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2239 throws RemoteException
2240 {
2241 Parcel data = Parcel.obtain();
2242 Parcel reply = Parcel.obtain();
2243 data.writeInterfaceToken(IActivityManager.descriptor);
2244 service.writeToParcel(data, 0);
2245 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2246 reply.readException();
2247 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2248 data.recycle();
2249 reply.recycle();
2250 return res;
2251 }
2252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002253 public ComponentName startService(IApplicationThread caller, Intent service,
2254 String resolvedType) throws RemoteException
2255 {
2256 Parcel data = Parcel.obtain();
2257 Parcel reply = Parcel.obtain();
2258 data.writeInterfaceToken(IActivityManager.descriptor);
2259 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2260 service.writeToParcel(data, 0);
2261 data.writeString(resolvedType);
2262 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2263 reply.readException();
2264 ComponentName res = ComponentName.readFromParcel(reply);
2265 data.recycle();
2266 reply.recycle();
2267 return res;
2268 }
2269 public int stopService(IApplicationThread caller, Intent service,
2270 String resolvedType) throws RemoteException
2271 {
2272 Parcel data = Parcel.obtain();
2273 Parcel reply = Parcel.obtain();
2274 data.writeInterfaceToken(IActivityManager.descriptor);
2275 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2276 service.writeToParcel(data, 0);
2277 data.writeString(resolvedType);
2278 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2279 reply.readException();
2280 int res = reply.readInt();
2281 reply.recycle();
2282 data.recycle();
2283 return res;
2284 }
2285 public boolean stopServiceToken(ComponentName className, IBinder token,
2286 int startId) throws RemoteException {
2287 Parcel data = Parcel.obtain();
2288 Parcel reply = Parcel.obtain();
2289 data.writeInterfaceToken(IActivityManager.descriptor);
2290 ComponentName.writeToParcel(className, data);
2291 data.writeStrongBinder(token);
2292 data.writeInt(startId);
2293 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2294 reply.readException();
2295 boolean res = reply.readInt() != 0;
2296 data.recycle();
2297 reply.recycle();
2298 return res;
2299 }
2300 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002301 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002302 Parcel data = Parcel.obtain();
2303 Parcel reply = Parcel.obtain();
2304 data.writeInterfaceToken(IActivityManager.descriptor);
2305 ComponentName.writeToParcel(className, data);
2306 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002307 data.writeInt(id);
2308 if (notification != null) {
2309 data.writeInt(1);
2310 notification.writeToParcel(data, 0);
2311 } else {
2312 data.writeInt(0);
2313 }
2314 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002315 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2316 reply.readException();
2317 data.recycle();
2318 reply.recycle();
2319 }
2320 public int bindService(IApplicationThread caller, IBinder token,
2321 Intent service, String resolvedType, IServiceConnection connection,
2322 int flags) throws RemoteException {
2323 Parcel data = Parcel.obtain();
2324 Parcel reply = Parcel.obtain();
2325 data.writeInterfaceToken(IActivityManager.descriptor);
2326 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2327 data.writeStrongBinder(token);
2328 service.writeToParcel(data, 0);
2329 data.writeString(resolvedType);
2330 data.writeStrongBinder(connection.asBinder());
2331 data.writeInt(flags);
2332 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 int res = reply.readInt();
2335 data.recycle();
2336 reply.recycle();
2337 return res;
2338 }
2339 public boolean unbindService(IServiceConnection connection) throws RemoteException
2340 {
2341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeStrongBinder(connection.asBinder());
2345 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2346 reply.readException();
2347 boolean res = reply.readInt() != 0;
2348 data.recycle();
2349 reply.recycle();
2350 return res;
2351 }
2352
2353 public void publishService(IBinder token,
2354 Intent intent, IBinder service) 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.writeStrongBinder(service);
2361 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 data.recycle();
2364 reply.recycle();
2365 }
2366
2367 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2368 throws RemoteException {
2369 Parcel data = Parcel.obtain();
2370 Parcel reply = Parcel.obtain();
2371 data.writeInterfaceToken(IActivityManager.descriptor);
2372 data.writeStrongBinder(token);
2373 intent.writeToParcel(data, 0);
2374 data.writeInt(doRebind ? 1 : 0);
2375 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2376 reply.readException();
2377 data.recycle();
2378 reply.recycle();
2379 }
2380
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002381 public void serviceDoneExecuting(IBinder token, int type, int startId,
2382 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002383 Parcel data = Parcel.obtain();
2384 Parcel reply = Parcel.obtain();
2385 data.writeInterfaceToken(IActivityManager.descriptor);
2386 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002387 data.writeInt(type);
2388 data.writeInt(startId);
2389 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002390 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2391 reply.readException();
2392 data.recycle();
2393 reply.recycle();
2394 }
2395
2396 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2397 Parcel data = Parcel.obtain();
2398 Parcel reply = Parcel.obtain();
2399 data.writeInterfaceToken(IActivityManager.descriptor);
2400 service.writeToParcel(data, 0);
2401 data.writeString(resolvedType);
2402 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2403 reply.readException();
2404 IBinder binder = reply.readStrongBinder();
2405 reply.recycle();
2406 data.recycle();
2407 return binder;
2408 }
2409
Christopher Tate181fafa2009-05-14 11:12:14 -07002410 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2411 throws RemoteException {
2412 Parcel data = Parcel.obtain();
2413 Parcel reply = Parcel.obtain();
2414 data.writeInterfaceToken(IActivityManager.descriptor);
2415 app.writeToParcel(data, 0);
2416 data.writeInt(backupRestoreMode);
2417 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2418 reply.readException();
2419 boolean success = reply.readInt() != 0;
2420 reply.recycle();
2421 data.recycle();
2422 return success;
2423 }
2424
2425 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2426 Parcel data = Parcel.obtain();
2427 Parcel reply = Parcel.obtain();
2428 data.writeInterfaceToken(IActivityManager.descriptor);
2429 data.writeString(packageName);
2430 data.writeStrongBinder(agent);
2431 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2432 reply.recycle();
2433 data.recycle();
2434 }
2435
2436 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2437 Parcel data = Parcel.obtain();
2438 Parcel reply = Parcel.obtain();
2439 data.writeInterfaceToken(IActivityManager.descriptor);
2440 app.writeToParcel(data, 0);
2441 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 reply.recycle();
2444 data.recycle();
2445 }
2446
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002447 public boolean startInstrumentation(ComponentName className, String profileFile,
2448 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2449 throws RemoteException {
2450 Parcel data = Parcel.obtain();
2451 Parcel reply = Parcel.obtain();
2452 data.writeInterfaceToken(IActivityManager.descriptor);
2453 ComponentName.writeToParcel(className, data);
2454 data.writeString(profileFile);
2455 data.writeInt(flags);
2456 data.writeBundle(arguments);
2457 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2458 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2459 reply.readException();
2460 boolean res = reply.readInt() != 0;
2461 reply.recycle();
2462 data.recycle();
2463 return res;
2464 }
2465
2466 public void finishInstrumentation(IApplicationThread target,
2467 int resultCode, Bundle results) throws RemoteException {
2468 Parcel data = Parcel.obtain();
2469 Parcel reply = Parcel.obtain();
2470 data.writeInterfaceToken(IActivityManager.descriptor);
2471 data.writeStrongBinder(target != null ? target.asBinder() : null);
2472 data.writeInt(resultCode);
2473 data.writeBundle(results);
2474 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2475 reply.readException();
2476 data.recycle();
2477 reply.recycle();
2478 }
2479 public Configuration getConfiguration() throws RemoteException
2480 {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2487 reply.recycle();
2488 data.recycle();
2489 return res;
2490 }
2491 public void updateConfiguration(Configuration values) throws RemoteException
2492 {
2493 Parcel data = Parcel.obtain();
2494 Parcel reply = Parcel.obtain();
2495 data.writeInterfaceToken(IActivityManager.descriptor);
2496 values.writeToParcel(data, 0);
2497 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2498 reply.readException();
2499 data.recycle();
2500 reply.recycle();
2501 }
2502 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2503 throws RemoteException {
2504 Parcel data = Parcel.obtain();
2505 Parcel reply = Parcel.obtain();
2506 data.writeInterfaceToken(IActivityManager.descriptor);
2507 data.writeStrongBinder(token);
2508 data.writeInt(requestedOrientation);
2509 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 data.recycle();
2512 reply.recycle();
2513 }
2514 public int getRequestedOrientation(IBinder token) throws RemoteException {
2515 Parcel data = Parcel.obtain();
2516 Parcel reply = Parcel.obtain();
2517 data.writeInterfaceToken(IActivityManager.descriptor);
2518 data.writeStrongBinder(token);
2519 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2520 reply.readException();
2521 int res = reply.readInt();
2522 data.recycle();
2523 reply.recycle();
2524 return res;
2525 }
2526 public ComponentName getActivityClassForToken(IBinder token)
2527 throws RemoteException {
2528 Parcel data = Parcel.obtain();
2529 Parcel reply = Parcel.obtain();
2530 data.writeInterfaceToken(IActivityManager.descriptor);
2531 data.writeStrongBinder(token);
2532 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2533 reply.readException();
2534 ComponentName res = ComponentName.readFromParcel(reply);
2535 data.recycle();
2536 reply.recycle();
2537 return res;
2538 }
2539 public String getPackageForToken(IBinder token) throws RemoteException
2540 {
2541 Parcel data = Parcel.obtain();
2542 Parcel reply = Parcel.obtain();
2543 data.writeInterfaceToken(IActivityManager.descriptor);
2544 data.writeStrongBinder(token);
2545 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2546 reply.readException();
2547 String res = reply.readString();
2548 data.recycle();
2549 reply.recycle();
2550 return res;
2551 }
2552 public IIntentSender getIntentSender(int type,
2553 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002554 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002555 throws RemoteException {
2556 Parcel data = Parcel.obtain();
2557 Parcel reply = Parcel.obtain();
2558 data.writeInterfaceToken(IActivityManager.descriptor);
2559 data.writeInt(type);
2560 data.writeString(packageName);
2561 data.writeStrongBinder(token);
2562 data.writeString(resultWho);
2563 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002564 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002565 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002566 data.writeTypedArray(intents, 0);
2567 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002568 } else {
2569 data.writeInt(0);
2570 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 data.writeInt(flags);
2572 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2573 reply.readException();
2574 IIntentSender res = IIntentSender.Stub.asInterface(
2575 reply.readStrongBinder());
2576 data.recycle();
2577 reply.recycle();
2578 return res;
2579 }
2580 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 data.writeStrongBinder(sender.asBinder());
2585 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2586 reply.readException();
2587 data.recycle();
2588 reply.recycle();
2589 }
2590 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2591 Parcel data = Parcel.obtain();
2592 Parcel reply = Parcel.obtain();
2593 data.writeInterfaceToken(IActivityManager.descriptor);
2594 data.writeStrongBinder(sender.asBinder());
2595 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2596 reply.readException();
2597 String res = reply.readString();
2598 data.recycle();
2599 reply.recycle();
2600 return res;
2601 }
2602 public void setProcessLimit(int max) throws RemoteException
2603 {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 data.writeInt(max);
2608 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2609 reply.readException();
2610 data.recycle();
2611 reply.recycle();
2612 }
2613 public int getProcessLimit() throws RemoteException
2614 {
2615 Parcel data = Parcel.obtain();
2616 Parcel reply = Parcel.obtain();
2617 data.writeInterfaceToken(IActivityManager.descriptor);
2618 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2619 reply.readException();
2620 int res = reply.readInt();
2621 data.recycle();
2622 reply.recycle();
2623 return res;
2624 }
2625 public void setProcessForeground(IBinder token, int pid,
2626 boolean isForeground) throws RemoteException {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeStrongBinder(token);
2631 data.writeInt(pid);
2632 data.writeInt(isForeground ? 1 : 0);
2633 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2634 reply.readException();
2635 data.recycle();
2636 reply.recycle();
2637 }
2638 public int checkPermission(String permission, int pid, int uid)
2639 throws RemoteException {
2640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeString(permission);
2644 data.writeInt(pid);
2645 data.writeInt(uid);
2646 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2647 reply.readException();
2648 int res = reply.readInt();
2649 data.recycle();
2650 reply.recycle();
2651 return res;
2652 }
2653 public boolean clearApplicationUserData(final String packageName,
2654 final IPackageDataObserver observer) throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 data.writeString(packageName);
2659 data.writeStrongBinder(observer.asBinder());
2660 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2661 reply.readException();
2662 boolean res = reply.readInt() != 0;
2663 data.recycle();
2664 reply.recycle();
2665 return res;
2666 }
2667 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2668 throws RemoteException {
2669 Parcel data = Parcel.obtain();
2670 Parcel reply = Parcel.obtain();
2671 data.writeInterfaceToken(IActivityManager.descriptor);
2672 uri.writeToParcel(data, 0);
2673 data.writeInt(pid);
2674 data.writeInt(uid);
2675 data.writeInt(mode);
2676 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2677 reply.readException();
2678 int res = reply.readInt();
2679 data.recycle();
2680 reply.recycle();
2681 return res;
2682 }
2683 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2684 Uri uri, 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 data.writeString(targetPkg);
2690 uri.writeToParcel(data, 0);
2691 data.writeInt(mode);
2692 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2693 reply.readException();
2694 data.recycle();
2695 reply.recycle();
2696 }
2697 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2698 int mode) throws RemoteException {
2699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 data.writeStrongBinder(caller.asBinder());
2703 uri.writeToParcel(data, 0);
2704 data.writeInt(mode);
2705 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2706 reply.readException();
2707 data.recycle();
2708 reply.recycle();
2709 }
2710 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2711 throws RemoteException {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeStrongBinder(who.asBinder());
2716 data.writeInt(waiting ? 1 : 0);
2717 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 data.recycle();
2720 reply.recycle();
2721 }
2722 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2723 Parcel data = Parcel.obtain();
2724 Parcel reply = Parcel.obtain();
2725 data.writeInterfaceToken(IActivityManager.descriptor);
2726 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2727 reply.readException();
2728 outInfo.readFromParcel(reply);
2729 data.recycle();
2730 reply.recycle();
2731 }
2732 public void unhandledBack() throws RemoteException
2733 {
2734 Parcel data = Parcel.obtain();
2735 Parcel reply = Parcel.obtain();
2736 data.writeInterfaceToken(IActivityManager.descriptor);
2737 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2738 reply.readException();
2739 data.recycle();
2740 reply.recycle();
2741 }
2742 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2743 {
2744 Parcel data = Parcel.obtain();
2745 Parcel reply = Parcel.obtain();
2746 data.writeInterfaceToken(IActivityManager.descriptor);
2747 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2748 reply.readException();
2749 ParcelFileDescriptor pfd = null;
2750 if (reply.readInt() != 0) {
2751 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2752 }
2753 data.recycle();
2754 reply.recycle();
2755 return pfd;
2756 }
2757 public void goingToSleep() throws RemoteException
2758 {
2759 Parcel data = Parcel.obtain();
2760 Parcel reply = Parcel.obtain();
2761 data.writeInterfaceToken(IActivityManager.descriptor);
2762 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2763 reply.readException();
2764 data.recycle();
2765 reply.recycle();
2766 }
2767 public void wakingUp() throws RemoteException
2768 {
2769 Parcel data = Parcel.obtain();
2770 Parcel reply = Parcel.obtain();
2771 data.writeInterfaceToken(IActivityManager.descriptor);
2772 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 data.recycle();
2775 reply.recycle();
2776 }
2777 public void setDebugApp(
2778 String packageName, boolean waitForDebugger, boolean persistent)
2779 throws RemoteException
2780 {
2781 Parcel data = Parcel.obtain();
2782 Parcel reply = Parcel.obtain();
2783 data.writeInterfaceToken(IActivityManager.descriptor);
2784 data.writeString(packageName);
2785 data.writeInt(waitForDebugger ? 1 : 0);
2786 data.writeInt(persistent ? 1 : 0);
2787 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 data.recycle();
2790 reply.recycle();
2791 }
2792 public void setAlwaysFinish(boolean enabled) throws RemoteException
2793 {
2794 Parcel data = Parcel.obtain();
2795 Parcel reply = Parcel.obtain();
2796 data.writeInterfaceToken(IActivityManager.descriptor);
2797 data.writeInt(enabled ? 1 : 0);
2798 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2799 reply.readException();
2800 data.recycle();
2801 reply.recycle();
2802 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002803 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002804 {
2805 Parcel data = Parcel.obtain();
2806 Parcel reply = Parcel.obtain();
2807 data.writeInterfaceToken(IActivityManager.descriptor);
2808 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002809 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002810 reply.readException();
2811 data.recycle();
2812 reply.recycle();
2813 }
2814 public void enterSafeMode() throws RemoteException {
2815 Parcel data = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2818 data.recycle();
2819 }
2820 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2821 Parcel data = Parcel.obtain();
2822 data.writeStrongBinder(sender.asBinder());
2823 data.writeInterfaceToken(IActivityManager.descriptor);
2824 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2825 data.recycle();
2826 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002827 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 Parcel data = Parcel.obtain();
2829 Parcel reply = Parcel.obtain();
2830 data.writeInterfaceToken(IActivityManager.descriptor);
2831 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002832 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002833 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002834 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002835 boolean res = reply.readInt() != 0;
2836 data.recycle();
2837 reply.recycle();
2838 return res;
2839 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002840 public void startRunning(String pkg, String cls, String action,
2841 String indata) throws RemoteException {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 data.writeString(pkg);
2846 data.writeString(cls);
2847 data.writeString(action);
2848 data.writeString(indata);
2849 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2850 reply.readException();
2851 data.recycle();
2852 reply.recycle();
2853 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002854 public boolean testIsSystemReady()
2855 {
2856 /* this base class version is never called */
2857 return true;
2858 }
Dan Egnor60d87622009-12-16 16:32:58 -08002859 public void handleApplicationCrash(IBinder app,
2860 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2861 {
2862 Parcel data = Parcel.obtain();
2863 Parcel reply = Parcel.obtain();
2864 data.writeInterfaceToken(IActivityManager.descriptor);
2865 data.writeStrongBinder(app);
2866 crashInfo.writeToParcel(data, 0);
2867 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2868 reply.readException();
2869 reply.recycle();
2870 data.recycle();
2871 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002872
Dan Egnor60d87622009-12-16 16:32:58 -08002873 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002874 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002875 {
2876 Parcel data = Parcel.obtain();
2877 Parcel reply = Parcel.obtain();
2878 data.writeInterfaceToken(IActivityManager.descriptor);
2879 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002880 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002881 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002882 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002884 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002885 reply.recycle();
2886 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002887 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002888 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002889
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002890 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002891 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002892 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002893 {
2894 Parcel data = Parcel.obtain();
2895 Parcel reply = Parcel.obtain();
2896 data.writeInterfaceToken(IActivityManager.descriptor);
2897 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002898 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002899 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002900 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 reply.recycle();
2903 data.recycle();
2904 }
2905
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002906 public void signalPersistentProcesses(int sig) throws RemoteException {
2907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 data.writeInt(sig);
2911 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 data.recycle();
2914 reply.recycle();
2915 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08002916
Dianne Hackborn03abb812010-01-04 18:43:19 -08002917 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002922 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2923 reply.readException();
2924 data.recycle();
2925 reply.recycle();
2926 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08002927
2928 public void killAllBackgroundProcesses() throws RemoteException {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2933 reply.readException();
2934 data.recycle();
2935 reply.recycle();
2936 }
2937
Dianne Hackborn03abb812010-01-04 18:43:19 -08002938 public void forceStopPackage(String packageName) throws RemoteException {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeString(packageName);
2943 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002944 reply.readException();
2945 data.recycle();
2946 reply.recycle();
2947 }
2948
2949 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2950 {
2951 Parcel data = Parcel.obtain();
2952 Parcel reply = Parcel.obtain();
2953 data.writeInterfaceToken(IActivityManager.descriptor);
2954 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2957 reply.recycle();
2958 data.recycle();
2959 return res;
2960 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002961
2962 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07002963 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002964 {
2965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeString(process);
2969 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07002970 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002971 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002972 if (fd != null) {
2973 data.writeInt(1);
2974 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2975 } else {
2976 data.writeInt(0);
2977 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002978 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
2979 reply.readException();
2980 boolean res = reply.readInt() != 0;
2981 reply.recycle();
2982 data.recycle();
2983 return res;
2984 }
2985
Dianne Hackborn55280a92009-05-07 15:53:46 -07002986 public boolean shutdown(int timeout) throws RemoteException
2987 {
2988 Parcel data = Parcel.obtain();
2989 Parcel reply = Parcel.obtain();
2990 data.writeInterfaceToken(IActivityManager.descriptor);
2991 data.writeInt(timeout);
2992 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 boolean res = reply.readInt() != 0;
2995 reply.recycle();
2996 data.recycle();
2997 return res;
2998 }
2999
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003000 public void stopAppSwitches() throws RemoteException {
3001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3005 reply.readException();
3006 reply.recycle();
3007 data.recycle();
3008 }
3009
3010 public void resumeAppSwitches() throws RemoteException {
3011 Parcel data = Parcel.obtain();
3012 Parcel reply = Parcel.obtain();
3013 data.writeInterfaceToken(IActivityManager.descriptor);
3014 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3015 reply.readException();
3016 reply.recycle();
3017 data.recycle();
3018 }
3019
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003020 public void registerActivityWatcher(IActivityWatcher watcher)
3021 throws RemoteException {
3022 Parcel data = Parcel.obtain();
3023 Parcel reply = Parcel.obtain();
3024 data.writeInterfaceToken(IActivityManager.descriptor);
3025 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
3026 mRemote.transact(REGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
3027 reply.readException();
3028 data.recycle();
3029 reply.recycle();
3030 }
3031
3032 public void unregisterActivityWatcher(IActivityWatcher watcher)
3033 throws RemoteException {
3034 Parcel data = Parcel.obtain();
3035 Parcel reply = Parcel.obtain();
3036 data.writeInterfaceToken(IActivityManager.descriptor);
3037 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
3038 mRemote.transact(UNREGISTER_ACTIVITY_WATCHER_TRANSACTION, data, reply, 0);
3039 reply.readException();
3040 data.recycle();
3041 reply.recycle();
3042 }
3043
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003044 public int startActivityInPackage(int uid,
3045 Intent intent, String resolvedType, IBinder resultTo,
3046 String resultWho, int requestCode, boolean onlyIfNeeded)
3047 throws RemoteException {
3048 Parcel data = Parcel.obtain();
3049 Parcel reply = Parcel.obtain();
3050 data.writeInterfaceToken(IActivityManager.descriptor);
3051 data.writeInt(uid);
3052 intent.writeToParcel(data, 0);
3053 data.writeString(resolvedType);
3054 data.writeStrongBinder(resultTo);
3055 data.writeString(resultWho);
3056 data.writeInt(requestCode);
3057 data.writeInt(onlyIfNeeded ? 1 : 0);
3058 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 int result = reply.readInt();
3061 reply.recycle();
3062 data.recycle();
3063 return result;
3064 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003065
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003066 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3067 Parcel data = Parcel.obtain();
3068 Parcel reply = Parcel.obtain();
3069 data.writeInterfaceToken(IActivityManager.descriptor);
3070 data.writeString(pkg);
3071 data.writeInt(uid);
3072 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 data.recycle();
3075 reply.recycle();
3076 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003077
3078 public void closeSystemDialogs(String reason) throws RemoteException {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeString(reason);
3083 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 data.recycle();
3086 reply.recycle();
3087 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003088
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003089 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003090 throws RemoteException {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003094 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003095 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3096 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003097 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003098 data.recycle();
3099 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003100 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003101 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003102
3103 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeString(processName);
3108 data.writeInt(uid);
3109 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3110 reply.readException();
3111 data.recycle();
3112 reply.recycle();
3113 }
3114
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003115 public void overridePendingTransition(IBinder token, String packageName,
3116 int enterAnim, int exitAnim) throws RemoteException {
3117 Parcel data = Parcel.obtain();
3118 Parcel reply = Parcel.obtain();
3119 data.writeInterfaceToken(IActivityManager.descriptor);
3120 data.writeStrongBinder(token);
3121 data.writeString(packageName);
3122 data.writeInt(enterAnim);
3123 data.writeInt(exitAnim);
3124 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3125 reply.readException();
3126 data.recycle();
3127 reply.recycle();
3128 }
3129
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003130 public boolean isUserAMonkey() throws RemoteException {
3131 Parcel data = Parcel.obtain();
3132 Parcel reply = Parcel.obtain();
3133 data.writeInterfaceToken(IActivityManager.descriptor);
3134 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3135 reply.readException();
3136 boolean res = reply.readInt() != 0;
3137 data.recycle();
3138 reply.recycle();
3139 return res;
3140 }
3141
Dianne Hackborn860755f2010-06-03 18:47:52 -07003142 public void finishHeavyWeightApp() throws RemoteException {
3143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
3145 data.writeInterfaceToken(IActivityManager.descriptor);
3146 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3147 reply.readException();
3148 data.recycle();
3149 reply.recycle();
3150 }
3151
Daniel Sandler69a48172010-06-23 16:29:36 -04003152 public void setImmersive(IBinder token, boolean immersive)
3153 throws RemoteException {
3154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 data.writeStrongBinder(token);
3158 data.writeInt(immersive ? 1 : 0);
3159 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3160 reply.readException();
3161 data.recycle();
3162 reply.recycle();
3163 }
3164
3165 public boolean isImmersive(IBinder token)
3166 throws RemoteException {
3167 Parcel data = Parcel.obtain();
3168 Parcel reply = Parcel.obtain();
3169 data.writeInterfaceToken(IActivityManager.descriptor);
3170 data.writeStrongBinder(token);
3171 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003172 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003173 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003174 data.recycle();
3175 reply.recycle();
3176 return res;
3177 }
3178
3179 public boolean isTopActivityImmersive()
3180 throws RemoteException {
3181 Parcel data = Parcel.obtain();
3182 Parcel reply = Parcel.obtain();
3183 data.writeInterfaceToken(IActivityManager.descriptor);
3184 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003185 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003186 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003187 data.recycle();
3188 reply.recycle();
3189 return res;
3190 }
3191
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003192 public void crashApplication(int uid, int initialPid, String packageName,
3193 String message) throws RemoteException {
3194 Parcel data = Parcel.obtain();
3195 Parcel reply = Parcel.obtain();
3196 data.writeInterfaceToken(IActivityManager.descriptor);
3197 data.writeInt(uid);
3198 data.writeInt(initialPid);
3199 data.writeString(packageName);
3200 data.writeString(message);
3201 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 data.recycle();
3204 reply.recycle();
3205 }
Andy McFadden824c5102010-07-09 16:26:57 -07003206
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003207 public String getProviderMimeType(Uri uri)
3208 throws RemoteException {
3209 Parcel data = Parcel.obtain();
3210 Parcel reply = Parcel.obtain();
3211 data.writeInterfaceToken(IActivityManager.descriptor);
3212 uri.writeToParcel(data, 0);
3213 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3214 reply.readException();
3215 String res = reply.readString();
3216 data.recycle();
3217 reply.recycle();
3218 return res;
3219 }
3220
Dianne Hackborn7e269642010-08-25 19:50:20 -07003221 public IBinder newUriPermissionOwner(String name)
3222 throws RemoteException {
3223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 data.writeString(name);
3227 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3228 reply.readException();
3229 IBinder res = reply.readStrongBinder();
3230 data.recycle();
3231 reply.recycle();
3232 return res;
3233 }
3234
3235 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3236 Uri uri, int mode) throws RemoteException {
3237 Parcel data = Parcel.obtain();
3238 Parcel reply = Parcel.obtain();
3239 data.writeInterfaceToken(IActivityManager.descriptor);
3240 data.writeStrongBinder(owner);
3241 data.writeInt(fromUid);
3242 data.writeString(targetPkg);
3243 uri.writeToParcel(data, 0);
3244 data.writeInt(mode);
3245 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
3250
3251 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3252 int mode) throws RemoteException {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 data.writeStrongBinder(owner);
3257 if (uri != null) {
3258 data.writeInt(1);
3259 uri.writeToParcel(data, 0);
3260 } else {
3261 data.writeInt(0);
3262 }
3263 data.writeInt(mode);
3264 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3265 reply.readException();
3266 data.recycle();
3267 reply.recycle();
3268 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003269
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003270 public int checkGrantUriPermission(int callingUid, String targetPkg,
3271 Uri uri, int modeFlags) throws RemoteException {
3272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeInt(callingUid);
3276 data.writeString(targetPkg);
3277 uri.writeToParcel(data, 0);
3278 data.writeInt(modeFlags);
3279 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3280 reply.readException();
3281 int res = reply.readInt();
3282 data.recycle();
3283 reply.recycle();
3284 return res;
3285 }
3286
Andy McFadden824c5102010-07-09 16:26:57 -07003287 public boolean dumpHeap(String process, boolean managed,
3288 String path, ParcelFileDescriptor fd) throws RemoteException {
3289 Parcel data = Parcel.obtain();
3290 Parcel reply = Parcel.obtain();
3291 data.writeInterfaceToken(IActivityManager.descriptor);
3292 data.writeString(process);
3293 data.writeInt(managed ? 1 : 0);
3294 data.writeString(path);
3295 if (fd != null) {
3296 data.writeInt(1);
3297 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3298 } else {
3299 data.writeInt(0);
3300 }
3301 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 boolean res = reply.readInt() != 0;
3304 reply.recycle();
3305 data.recycle();
3306 return res;
3307 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003308
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003309 public int startActivities(IApplicationThread caller,
3310 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3311 Parcel data = Parcel.obtain();
3312 Parcel reply = Parcel.obtain();
3313 data.writeInterfaceToken(IActivityManager.descriptor);
3314 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3315 data.writeTypedArray(intents, 0);
3316 data.writeStringArray(resolvedTypes);
3317 data.writeStrongBinder(resultTo);
3318 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3319 reply.readException();
3320 int result = reply.readInt();
3321 reply.recycle();
3322 data.recycle();
3323 return result;
3324 }
3325
3326 public int startActivitiesInPackage(int uid,
3327 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeInt(uid);
3332 data.writeTypedArray(intents, 0);
3333 data.writeStringArray(resolvedTypes);
3334 data.writeStrongBinder(resultTo);
3335 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3336 reply.readException();
3337 int result = reply.readInt();
3338 reply.recycle();
3339 data.recycle();
3340 return result;
3341 }
3342
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003343 public int getFrontActivityScreenCompatMode() throws RemoteException {
3344 Parcel data = Parcel.obtain();
3345 Parcel reply = Parcel.obtain();
3346 data.writeInterfaceToken(IActivityManager.descriptor);
3347 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3348 reply.readException();
3349 int mode = reply.readInt();
3350 reply.recycle();
3351 data.recycle();
3352 return mode;
3353 }
3354
3355 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3356 Parcel data = Parcel.obtain();
3357 Parcel reply = Parcel.obtain();
3358 data.writeInterfaceToken(IActivityManager.descriptor);
3359 data.writeInt(mode);
3360 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3361 reply.readException();
3362 reply.recycle();
3363 data.recycle();
3364 }
3365
3366 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003370 data.writeString(packageName);
3371 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003372 reply.readException();
3373 int mode = reply.readInt();
3374 reply.recycle();
3375 data.recycle();
3376 return mode;
3377 }
3378
3379 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003380 throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003385 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003386 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 reply.recycle();
3389 data.recycle();
3390 }
3391
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003392 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 data.writeString(packageName);
3397 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3398 reply.readException();
3399 boolean ask = reply.readInt() != 0;
3400 reply.recycle();
3401 data.recycle();
3402 return ask;
3403 }
3404
3405 public void setPackageAskScreenCompat(String packageName, boolean ask)
3406 throws RemoteException {
3407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 data.writeString(packageName);
3411 data.writeInt(ask ? 1 : 0);
3412 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 reply.recycle();
3415 data.recycle();
3416 }
3417
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003418 public boolean switchUser(int userid) throws RemoteException {
3419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 data.writeInt(userid);
3423 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 boolean result = reply.readInt() != 0;
3426 reply.recycle();
3427 data.recycle();
3428 return result;
3429 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003430
3431 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3432 Parcel data = Parcel.obtain();
3433 Parcel reply = Parcel.obtain();
3434 data.writeInterfaceToken(IActivityManager.descriptor);
3435 data.writeInt(taskId);
3436 data.writeInt(subTaskIndex);
3437 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 boolean result = reply.readInt() != 0;
3440 reply.recycle();
3441 data.recycle();
3442 return result;
3443 }
3444
3445 public boolean removeTask(int taskId, int flags) throws RemoteException {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 data.writeInt(taskId);
3450 data.writeInt(flags);
3451 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3452 reply.readException();
3453 boolean result = reply.readInt() != 0;
3454 reply.recycle();
3455 data.recycle();
3456 return result;
3457 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003458
Jeff Sharkeya4620792011-05-20 15:29:23 -07003459 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3460 Parcel data = Parcel.obtain();
3461 Parcel reply = Parcel.obtain();
3462 data.writeInterfaceToken(IActivityManager.descriptor);
3463 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3464 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3465 reply.readException();
3466 data.recycle();
3467 reply.recycle();
3468 }
3469
3470 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3475 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3476 reply.readException();
3477 data.recycle();
3478 reply.recycle();
3479 }
3480
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003481 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3482 Parcel data = Parcel.obtain();
3483 Parcel reply = Parcel.obtain();
3484 data.writeInterfaceToken(IActivityManager.descriptor);
3485 data.writeStrongBinder(sender.asBinder());
3486 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 boolean res = reply.readInt() != 0;
3489 data.recycle();
3490 reply.recycle();
3491 return res;
3492 }
3493
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003494 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3495 {
3496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
3498 data.writeInterfaceToken(IActivityManager.descriptor);
3499 values.writeToParcel(data, 0);
3500 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3501 reply.readException();
3502 data.recycle();
3503 reply.recycle();
3504 }
3505
Dianne Hackbornb437e092011-08-05 17:50:29 -07003506 public long[] getProcessPss(int[] pids) throws RemoteException {
3507 Parcel data = Parcel.obtain();
3508 Parcel reply = Parcel.obtain();
3509 data.writeInterfaceToken(IActivityManager.descriptor);
3510 data.writeIntArray(pids);
3511 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 long[] res = reply.createLongArray();
3514 data.recycle();
3515 reply.recycle();
3516 return res;
3517 }
3518
Dianne Hackborn661cd522011-08-22 00:26:20 -07003519 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3520 Parcel data = Parcel.obtain();
3521 Parcel reply = Parcel.obtain();
3522 data.writeInterfaceToken(IActivityManager.descriptor);
3523 TextUtils.writeToParcel(msg, data, 0);
3524 data.writeInt(always ? 1 : 0);
3525 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 data.recycle();
3528 reply.recycle();
3529 }
3530
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003531 public void dismissKeyguardOnNextActivity() throws RemoteException {
3532 Parcel data = Parcel.obtain();
3533 Parcel reply = Parcel.obtain();
3534 data.writeInterfaceToken(IActivityManager.descriptor);
3535 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3536 reply.readException();
3537 data.recycle();
3538 reply.recycle();
3539 }
3540
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 private IBinder mRemote;
3542}