blob: 24079a5d8a2ff8dd6fc383c03a1a78cd3c9f9b4f [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,
Amith Yamasani742a6712011-05-04 14:49:28 -070094 null /*permission*/, false, true, Binder.getOrigCallingUser());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095 } 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;
Amith Yamasani742a6712011-05-04 14:49:28 -0700309 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800310 int res = broadcastIntent(app, intent, resolvedType, resultTo,
311 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700312 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800313 reply.writeNoException();
314 reply.writeInt(res);
315 return true;
316 }
317
318 case UNBROADCAST_INTENT_TRANSACTION:
319 {
320 data.enforceInterface(IActivityManager.descriptor);
321 IBinder b = data.readStrongBinder();
322 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
323 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700324 int userId = data.readInt();
325 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800326 reply.writeNoException();
327 return true;
328 }
329
330 case FINISH_RECEIVER_TRANSACTION: {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder who = data.readStrongBinder();
333 int resultCode = data.readInt();
334 String resultData = data.readString();
335 Bundle resultExtras = data.readBundle();
336 boolean resultAbort = data.readInt() != 0;
337 if (who != null) {
338 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
339 }
340 reply.writeNoException();
341 return true;
342 }
343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800344 case ATTACH_APPLICATION_TRANSACTION: {
345 data.enforceInterface(IActivityManager.descriptor);
346 IApplicationThread app = ApplicationThreadNative.asInterface(
347 data.readStrongBinder());
348 if (app != null) {
349 attachApplication(app);
350 }
351 reply.writeNoException();
352 return true;
353 }
354
355 case ACTIVITY_IDLE_TRANSACTION: {
356 data.enforceInterface(IActivityManager.descriptor);
357 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700358 Configuration config = null;
359 if (data.readInt() != 0) {
360 config = Configuration.CREATOR.createFromParcel(data);
361 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700362 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700364 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800365 }
366 reply.writeNoException();
367 return true;
368 }
369
370 case ACTIVITY_PAUSED_TRANSACTION: {
371 data.enforceInterface(IActivityManager.descriptor);
372 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800373 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800374 reply.writeNoException();
375 return true;
376 }
377
378 case ACTIVITY_STOPPED_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800381 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 Bitmap thumbnail = data.readInt() != 0
383 ? Bitmap.CREATOR.createFromParcel(data) : null;
384 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800385 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800386 reply.writeNoException();
387 return true;
388 }
389
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800390 case ACTIVITY_SLEPT_TRANSACTION: {
391 data.enforceInterface(IActivityManager.descriptor);
392 IBinder token = data.readStrongBinder();
393 activitySlept(token);
394 reply.writeNoException();
395 return true;
396 }
397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 case ACTIVITY_DESTROYED_TRANSACTION: {
399 data.enforceInterface(IActivityManager.descriptor);
400 IBinder token = data.readStrongBinder();
401 activityDestroyed(token);
402 reply.writeNoException();
403 return true;
404 }
405
406 case GET_CALLING_PACKAGE_TRANSACTION: {
407 data.enforceInterface(IActivityManager.descriptor);
408 IBinder token = data.readStrongBinder();
409 String res = token != null ? getCallingPackage(token) : null;
410 reply.writeNoException();
411 reply.writeString(res);
412 return true;
413 }
414
415 case GET_CALLING_ACTIVITY_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
418 ComponentName cn = getCallingActivity(token);
419 reply.writeNoException();
420 ComponentName.writeToParcel(cn, reply);
421 return true;
422 }
423
424 case GET_TASKS_TRANSACTION: {
425 data.enforceInterface(IActivityManager.descriptor);
426 int maxNum = data.readInt();
427 int fl = data.readInt();
428 IBinder receiverBinder = data.readStrongBinder();
429 IThumbnailReceiver receiver = receiverBinder != null
430 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
431 : null;
432 List list = getTasks(maxNum, fl, receiver);
433 reply.writeNoException();
434 int N = list != null ? list.size() : -1;
435 reply.writeInt(N);
436 int i;
437 for (i=0; i<N; i++) {
438 ActivityManager.RunningTaskInfo info =
439 (ActivityManager.RunningTaskInfo)list.get(i);
440 info.writeToParcel(reply, 0);
441 }
442 return true;
443 }
444
445 case GET_RECENT_TASKS_TRANSACTION: {
446 data.enforceInterface(IActivityManager.descriptor);
447 int maxNum = data.readInt();
448 int fl = data.readInt();
449 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
450 fl);
451 reply.writeNoException();
452 reply.writeTypedList(list);
453 return true;
454 }
455
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700456 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800457 data.enforceInterface(IActivityManager.descriptor);
458 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700459 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800460 reply.writeNoException();
461 if (bm != null) {
462 reply.writeInt(1);
463 bm.writeToParcel(reply, 0);
464 } else {
465 reply.writeInt(0);
466 }
467 return true;
468 }
469
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800470 case GET_SERVICES_TRANSACTION: {
471 data.enforceInterface(IActivityManager.descriptor);
472 int maxNum = data.readInt();
473 int fl = data.readInt();
474 List list = getServices(maxNum, fl);
475 reply.writeNoException();
476 int N = list != null ? list.size() : -1;
477 reply.writeInt(N);
478 int i;
479 for (i=0; i<N; i++) {
480 ActivityManager.RunningServiceInfo info =
481 (ActivityManager.RunningServiceInfo)list.get(i);
482 info.writeToParcel(reply, 0);
483 }
484 return true;
485 }
486
487 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
488 data.enforceInterface(IActivityManager.descriptor);
489 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
490 reply.writeNoException();
491 reply.writeTypedList(list);
492 return true;
493 }
494
495 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
496 data.enforceInterface(IActivityManager.descriptor);
497 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
498 reply.writeNoException();
499 reply.writeTypedList(list);
500 return true;
501 }
502
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700503 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
504 data.enforceInterface(IActivityManager.descriptor);
505 List<ApplicationInfo> list = getRunningExternalApplications();
506 reply.writeNoException();
507 reply.writeTypedList(list);
508 return true;
509 }
510
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 case MOVE_TASK_TO_FRONT_TRANSACTION: {
512 data.enforceInterface(IActivityManager.descriptor);
513 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800514 int fl = data.readInt();
515 moveTaskToFront(task, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800516 reply.writeNoException();
517 return true;
518 }
519
520 case MOVE_TASK_TO_BACK_TRANSACTION: {
521 data.enforceInterface(IActivityManager.descriptor);
522 int task = data.readInt();
523 moveTaskToBack(task);
524 reply.writeNoException();
525 return true;
526 }
527
528 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 boolean nonRoot = data.readInt() != 0;
532 boolean res = moveActivityTaskToBack(token, nonRoot);
533 reply.writeNoException();
534 reply.writeInt(res ? 1 : 0);
535 return true;
536 }
537
538 case MOVE_TASK_BACKWARDS_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 int task = data.readInt();
541 moveTaskBackwards(task);
542 reply.writeNoException();
543 return true;
544 }
545
546 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 boolean onlyRoot = data.readInt() != 0;
550 int res = token != null
551 ? getTaskForActivity(token, onlyRoot) : -1;
552 reply.writeNoException();
553 reply.writeInt(res);
554 return true;
555 }
556
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800557 case REPORT_THUMBNAIL_TRANSACTION: {
558 data.enforceInterface(IActivityManager.descriptor);
559 IBinder token = data.readStrongBinder();
560 Bitmap thumbnail = data.readInt() != 0
561 ? Bitmap.CREATOR.createFromParcel(data) : null;
562 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
563 reportThumbnail(token, thumbnail, description);
564 reply.writeNoException();
565 return true;
566 }
567
568 case GET_CONTENT_PROVIDER_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 IBinder b = data.readStrongBinder();
571 IApplicationThread app = ApplicationThreadNative.asInterface(b);
572 String name = data.readString();
573 ContentProviderHolder cph = getContentProvider(app, name);
574 reply.writeNoException();
575 if (cph != null) {
576 reply.writeInt(1);
577 cph.writeToParcel(reply, 0);
578 } else {
579 reply.writeInt(0);
580 }
581 return true;
582 }
583
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800584 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
585 data.enforceInterface(IActivityManager.descriptor);
586 String name = data.readString();
587 IBinder token = data.readStrongBinder();
588 ContentProviderHolder cph = getContentProviderExternal(name, token);
589 reply.writeNoException();
590 if (cph != null) {
591 reply.writeInt(1);
592 cph.writeToParcel(reply, 0);
593 } else {
594 reply.writeInt(0);
595 }
596 return true;
597 }
598
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
601 IBinder b = data.readStrongBinder();
602 IApplicationThread app = ApplicationThreadNative.asInterface(b);
603 ArrayList<ContentProviderHolder> providers =
604 data.createTypedArrayList(ContentProviderHolder.CREATOR);
605 publishContentProviders(app, providers);
606 reply.writeNoException();
607 return true;
608 }
609
610 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
611 data.enforceInterface(IActivityManager.descriptor);
612 IBinder b = data.readStrongBinder();
613 IApplicationThread app = ApplicationThreadNative.asInterface(b);
614 String name = data.readString();
615 removeContentProvider(app, name);
616 reply.writeNoException();
617 return true;
618 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800619
620 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 String name = data.readString();
623 IBinder token = data.readStrongBinder();
624 removeContentProviderExternal(name, token);
625 reply.writeNoException();
626 return true;
627 }
628
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700629 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
630 data.enforceInterface(IActivityManager.descriptor);
631 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
632 PendingIntent pi = getRunningServiceControlPanel(comp);
633 reply.writeNoException();
634 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
635 return true;
636 }
637
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 case START_SERVICE_TRANSACTION: {
639 data.enforceInterface(IActivityManager.descriptor);
640 IBinder b = data.readStrongBinder();
641 IApplicationThread app = ApplicationThreadNative.asInterface(b);
642 Intent service = Intent.CREATOR.createFromParcel(data);
643 String resolvedType = data.readString();
644 ComponentName cn = startService(app, service, resolvedType);
645 reply.writeNoException();
646 ComponentName.writeToParcel(cn, reply);
647 return true;
648 }
649
650 case STOP_SERVICE_TRANSACTION: {
651 data.enforceInterface(IActivityManager.descriptor);
652 IBinder b = data.readStrongBinder();
653 IApplicationThread app = ApplicationThreadNative.asInterface(b);
654 Intent service = Intent.CREATOR.createFromParcel(data);
655 String resolvedType = data.readString();
656 int res = stopService(app, service, resolvedType);
657 reply.writeNoException();
658 reply.writeInt(res);
659 return true;
660 }
661
662 case STOP_SERVICE_TOKEN_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 ComponentName className = ComponentName.readFromParcel(data);
665 IBinder token = data.readStrongBinder();
666 int startId = data.readInt();
667 boolean res = stopServiceToken(className, token, startId);
668 reply.writeNoException();
669 reply.writeInt(res ? 1 : 0);
670 return true;
671 }
672
673 case SET_SERVICE_FOREGROUND_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 ComponentName className = ComponentName.readFromParcel(data);
676 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700677 int id = data.readInt();
678 Notification notification = null;
679 if (data.readInt() != 0) {
680 notification = Notification.CREATOR.createFromParcel(data);
681 }
682 boolean removeNotification = data.readInt() != 0;
683 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 reply.writeNoException();
685 return true;
686 }
687
688 case BIND_SERVICE_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 IBinder b = data.readStrongBinder();
691 IApplicationThread app = ApplicationThreadNative.asInterface(b);
692 IBinder token = data.readStrongBinder();
693 Intent service = Intent.CREATOR.createFromParcel(data);
694 String resolvedType = data.readString();
695 b = data.readStrongBinder();
696 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800697 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800699 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700 reply.writeNoException();
701 reply.writeInt(res);
702 return true;
703 }
704
705 case UNBIND_SERVICE_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 IBinder b = data.readStrongBinder();
708 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
709 boolean res = unbindService(conn);
710 reply.writeNoException();
711 reply.writeInt(res ? 1 : 0);
712 return true;
713 }
714
715 case PUBLISH_SERVICE_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 IBinder token = data.readStrongBinder();
718 Intent intent = Intent.CREATOR.createFromParcel(data);
719 IBinder service = data.readStrongBinder();
720 publishService(token, intent, service);
721 reply.writeNoException();
722 return true;
723 }
724
725 case UNBIND_FINISHED_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 IBinder token = data.readStrongBinder();
728 Intent intent = Intent.CREATOR.createFromParcel(data);
729 boolean doRebind = data.readInt() != 0;
730 unbindFinished(token, intent, doRebind);
731 reply.writeNoException();
732 return true;
733 }
734
735 case SERVICE_DONE_EXECUTING_TRANSACTION: {
736 data.enforceInterface(IActivityManager.descriptor);
737 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700738 int type = data.readInt();
739 int startId = data.readInt();
740 int res = data.readInt();
741 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742 reply.writeNoException();
743 return true;
744 }
745
746 case START_INSTRUMENTATION_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 ComponentName className = ComponentName.readFromParcel(data);
749 String profileFile = data.readString();
750 int fl = data.readInt();
751 Bundle arguments = data.readBundle();
752 IBinder b = data.readStrongBinder();
753 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
754 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
755 reply.writeNoException();
756 reply.writeInt(res ? 1 : 0);
757 return true;
758 }
759
760
761 case FINISH_INSTRUMENTATION_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 IBinder b = data.readStrongBinder();
764 IApplicationThread app = ApplicationThreadNative.asInterface(b);
765 int resultCode = data.readInt();
766 Bundle results = data.readBundle();
767 finishInstrumentation(app, resultCode, results);
768 reply.writeNoException();
769 return true;
770 }
771
772 case GET_CONFIGURATION_TRANSACTION: {
773 data.enforceInterface(IActivityManager.descriptor);
774 Configuration config = getConfiguration();
775 reply.writeNoException();
776 config.writeToParcel(reply, 0);
777 return true;
778 }
779
780 case UPDATE_CONFIGURATION_TRANSACTION: {
781 data.enforceInterface(IActivityManager.descriptor);
782 Configuration config = Configuration.CREATOR.createFromParcel(data);
783 updateConfiguration(config);
784 reply.writeNoException();
785 return true;
786 }
787
788 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder token = data.readStrongBinder();
791 int requestedOrientation = data.readInt();
792 setRequestedOrientation(token, requestedOrientation);
793 reply.writeNoException();
794 return true;
795 }
796
797 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 IBinder token = data.readStrongBinder();
800 int req = getRequestedOrientation(token);
801 reply.writeNoException();
802 reply.writeInt(req);
803 return true;
804 }
805
806 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
807 data.enforceInterface(IActivityManager.descriptor);
808 IBinder token = data.readStrongBinder();
809 ComponentName cn = getActivityClassForToken(token);
810 reply.writeNoException();
811 ComponentName.writeToParcel(cn, reply);
812 return true;
813 }
814
815 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 IBinder token = data.readStrongBinder();
818 reply.writeNoException();
819 reply.writeString(getPackageForToken(token));
820 return true;
821 }
822
823 case GET_INTENT_SENDER_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 int type = data.readInt();
826 String packageName = data.readString();
827 IBinder token = data.readStrongBinder();
828 String resultWho = data.readString();
829 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800830 Intent[] requestIntents;
831 String[] requestResolvedTypes;
832 if (data.readInt() != 0) {
833 requestIntents = data.createTypedArray(Intent.CREATOR);
834 requestResolvedTypes = data.createStringArray();
835 } else {
836 requestIntents = null;
837 requestResolvedTypes = null;
838 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800839 int fl = data.readInt();
840 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800841 resultWho, requestCode, requestIntents,
842 requestResolvedTypes, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 reply.writeNoException();
844 reply.writeStrongBinder(res != null ? res.asBinder() : null);
845 return true;
846 }
847
848 case CANCEL_INTENT_SENDER_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 IIntentSender r = IIntentSender.Stub.asInterface(
851 data.readStrongBinder());
852 cancelIntentSender(r);
853 reply.writeNoException();
854 return true;
855 }
856
857 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 IIntentSender r = IIntentSender.Stub.asInterface(
860 data.readStrongBinder());
861 String res = getPackageForIntentSender(r);
862 reply.writeNoException();
863 reply.writeString(res);
864 return true;
865 }
866
867 case SET_PROCESS_LIMIT_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 int max = data.readInt();
870 setProcessLimit(max);
871 reply.writeNoException();
872 return true;
873 }
874
875 case GET_PROCESS_LIMIT_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 int limit = getProcessLimit();
878 reply.writeNoException();
879 reply.writeInt(limit);
880 return true;
881 }
882
883 case SET_PROCESS_FOREGROUND_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 IBinder token = data.readStrongBinder();
886 int pid = data.readInt();
887 boolean isForeground = data.readInt() != 0;
888 setProcessForeground(token, pid, isForeground);
889 reply.writeNoException();
890 return true;
891 }
892
893 case CHECK_PERMISSION_TRANSACTION: {
894 data.enforceInterface(IActivityManager.descriptor);
895 String perm = data.readString();
896 int pid = data.readInt();
897 int uid = data.readInt();
898 int res = checkPermission(perm, pid, uid);
899 reply.writeNoException();
900 reply.writeInt(res);
901 return true;
902 }
903
904 case CHECK_URI_PERMISSION_TRANSACTION: {
905 data.enforceInterface(IActivityManager.descriptor);
906 Uri uri = Uri.CREATOR.createFromParcel(data);
907 int pid = data.readInt();
908 int uid = data.readInt();
909 int mode = data.readInt();
910 int res = checkUriPermission(uri, pid, uid, mode);
911 reply.writeNoException();
912 reply.writeInt(res);
913 return true;
914 }
915
916 case CLEAR_APP_DATA_TRANSACTION: {
917 data.enforceInterface(IActivityManager.descriptor);
918 String packageName = data.readString();
919 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
920 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -0700921 int userId = data.readInt();
922 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800923 reply.writeNoException();
924 reply.writeInt(res ? 1 : 0);
925 return true;
926 }
927
928 case GRANT_URI_PERMISSION_TRANSACTION: {
929 data.enforceInterface(IActivityManager.descriptor);
930 IBinder b = data.readStrongBinder();
931 IApplicationThread app = ApplicationThreadNative.asInterface(b);
932 String targetPkg = data.readString();
933 Uri uri = Uri.CREATOR.createFromParcel(data);
934 int mode = data.readInt();
935 grantUriPermission(app, targetPkg, uri, mode);
936 reply.writeNoException();
937 return true;
938 }
939
940 case REVOKE_URI_PERMISSION_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 IBinder b = data.readStrongBinder();
943 IApplicationThread app = ApplicationThreadNative.asInterface(b);
944 Uri uri = Uri.CREATOR.createFromParcel(data);
945 int mode = data.readInt();
946 revokeUriPermission(app, uri, mode);
947 reply.writeNoException();
948 return true;
949 }
950
951 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
952 data.enforceInterface(IActivityManager.descriptor);
953 IBinder b = data.readStrongBinder();
954 IApplicationThread app = ApplicationThreadNative.asInterface(b);
955 boolean waiting = data.readInt() != 0;
956 showWaitingForDebugger(app, waiting);
957 reply.writeNoException();
958 return true;
959 }
960
961 case GET_MEMORY_INFO_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
964 getMemoryInfo(mi);
965 reply.writeNoException();
966 mi.writeToParcel(reply, 0);
967 return true;
968 }
969
970 case UNHANDLED_BACK_TRANSACTION: {
971 data.enforceInterface(IActivityManager.descriptor);
972 unhandledBack();
973 reply.writeNoException();
974 return true;
975 }
976
977 case OPEN_CONTENT_URI_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 Uri uri = Uri.parse(data.readString());
980 ParcelFileDescriptor pfd = openContentUri(uri);
981 reply.writeNoException();
982 if (pfd != null) {
983 reply.writeInt(1);
984 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
985 } else {
986 reply.writeInt(0);
987 }
988 return true;
989 }
990
991 case GOING_TO_SLEEP_TRANSACTION: {
992 data.enforceInterface(IActivityManager.descriptor);
993 goingToSleep();
994 reply.writeNoException();
995 return true;
996 }
997
998 case WAKING_UP_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 wakingUp();
1001 reply.writeNoException();
1002 return true;
1003 }
1004
1005 case SET_DEBUG_APP_TRANSACTION: {
1006 data.enforceInterface(IActivityManager.descriptor);
1007 String pn = data.readString();
1008 boolean wfd = data.readInt() != 0;
1009 boolean per = data.readInt() != 0;
1010 setDebugApp(pn, wfd, per);
1011 reply.writeNoException();
1012 return true;
1013 }
1014
1015 case SET_ALWAYS_FINISH_TRANSACTION: {
1016 data.enforceInterface(IActivityManager.descriptor);
1017 boolean enabled = data.readInt() != 0;
1018 setAlwaysFinish(enabled);
1019 reply.writeNoException();
1020 return true;
1021 }
1022
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001023 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001024 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001025 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001026 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001027 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001028 return true;
1029 }
1030
1031 case ENTER_SAFE_MODE_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 enterSafeMode();
1034 reply.writeNoException();
1035 return true;
1036 }
1037
1038 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1039 data.enforceInterface(IActivityManager.descriptor);
1040 IIntentSender is = IIntentSender.Stub.asInterface(
1041 data.readStrongBinder());
1042 noteWakeupAlarm(is);
1043 reply.writeNoException();
1044 return true;
1045 }
1046
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001047 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001048 data.enforceInterface(IActivityManager.descriptor);
1049 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001050 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001051 boolean secure = data.readInt() != 0;
1052 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 reply.writeNoException();
1054 reply.writeInt(res ? 1 : 0);
1055 return true;
1056 }
1057
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001058 case START_RUNNING_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 String pkg = data.readString();
1061 String cls = data.readString();
1062 String action = data.readString();
1063 String indata = data.readString();
1064 startRunning(pkg, cls, action, indata);
1065 reply.writeNoException();
1066 return true;
1067 }
1068
Dan Egnor60d87622009-12-16 16:32:58 -08001069 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 IBinder app = data.readStrongBinder();
1072 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1073 handleApplicationCrash(app, ci);
1074 reply.writeNoException();
1075 return true;
1076 }
1077
1078 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001079 data.enforceInterface(IActivityManager.descriptor);
1080 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001082 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001083 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001084 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001085 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001086 return true;
1087 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001088
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001089 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001092 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001093 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1094 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001095 reply.writeNoException();
1096 return true;
1097 }
1098
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001099 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1100 data.enforceInterface(IActivityManager.descriptor);
1101 int sig = data.readInt();
1102 signalPersistentProcesses(sig);
1103 reply.writeNoException();
1104 return true;
1105 }
1106
Dianne Hackborn03abb812010-01-04 18:43:19 -08001107 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001110 killBackgroundProcesses(packageName);
1111 reply.writeNoException();
1112 return true;
1113 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001114
1115 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1116 data.enforceInterface(IActivityManager.descriptor);
1117 killAllBackgroundProcesses();
1118 reply.writeNoException();
1119 return true;
1120 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001121
1122 case FORCE_STOP_PACKAGE_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 String packageName = data.readString();
1125 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001126 reply.writeNoException();
1127 return true;
1128 }
1129
1130 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1131 data.enforceInterface(IActivityManager.descriptor);
1132 ConfigurationInfo config = getDeviceConfigurationInfo();
1133 reply.writeNoException();
1134 config.writeToParcel(reply, 0);
1135 return true;
1136 }
1137
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001138 case PROFILE_CONTROL_TRANSACTION: {
1139 data.enforceInterface(IActivityManager.descriptor);
1140 String process = data.readString();
1141 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001142 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001143 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001144 ParcelFileDescriptor fd = data.readInt() != 0
1145 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001146 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001147 reply.writeNoException();
1148 reply.writeInt(res ? 1 : 0);
1149 return true;
1150 }
1151
Dianne Hackborn55280a92009-05-07 15:53:46 -07001152 case SHUTDOWN_TRANSACTION: {
1153 data.enforceInterface(IActivityManager.descriptor);
1154 boolean res = shutdown(data.readInt());
1155 reply.writeNoException();
1156 reply.writeInt(res ? 1 : 0);
1157 return true;
1158 }
1159
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001160 case STOP_APP_SWITCHES_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 stopAppSwitches();
1163 reply.writeNoException();
1164 return true;
1165 }
1166
1167 case RESUME_APP_SWITCHES_TRANSACTION: {
1168 data.enforceInterface(IActivityManager.descriptor);
1169 resumeAppSwitches();
1170 reply.writeNoException();
1171 return true;
1172 }
1173
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001174 case PEEK_SERVICE_TRANSACTION: {
1175 data.enforceInterface(IActivityManager.descriptor);
1176 Intent service = Intent.CREATOR.createFromParcel(data);
1177 String resolvedType = data.readString();
1178 IBinder binder = peekService(service, resolvedType);
1179 reply.writeNoException();
1180 reply.writeStrongBinder(binder);
1181 return true;
1182 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001183
1184 case START_BACKUP_AGENT_TRANSACTION: {
1185 data.enforceInterface(IActivityManager.descriptor);
1186 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1187 int backupRestoreMode = data.readInt();
1188 boolean success = bindBackupAgent(info, backupRestoreMode);
1189 reply.writeNoException();
1190 reply.writeInt(success ? 1 : 0);
1191 return true;
1192 }
1193
1194 case BACKUP_AGENT_CREATED_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 String packageName = data.readString();
1197 IBinder agent = data.readStrongBinder();
1198 backupAgentCreated(packageName, agent);
1199 reply.writeNoException();
1200 return true;
1201 }
1202
1203 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1204 data.enforceInterface(IActivityManager.descriptor);
1205 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1206 unbindBackupAgent(info);
1207 reply.writeNoException();
1208 return true;
1209 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001210
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001211 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1212 {
1213 data.enforceInterface(IActivityManager.descriptor);
1214 int uid = data.readInt();
1215 Intent intent = Intent.CREATOR.createFromParcel(data);
1216 String resolvedType = data.readString();
1217 IBinder resultTo = data.readStrongBinder();
1218 String resultWho = data.readString();
1219 int requestCode = data.readInt();
1220 boolean onlyIfNeeded = data.readInt() != 0;
1221 int result = startActivityInPackage(uid, intent, resolvedType,
1222 resultTo, resultWho, requestCode, onlyIfNeeded);
1223 reply.writeNoException();
1224 reply.writeInt(result);
1225 return true;
1226 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001227
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001228 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 String pkg = data.readString();
1231 int uid = data.readInt();
1232 killApplicationWithUid(pkg, uid);
1233 reply.writeNoException();
1234 return true;
1235 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001236
1237 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1238 data.enforceInterface(IActivityManager.descriptor);
1239 String reason = data.readString();
1240 closeSystemDialogs(reason);
1241 reply.writeNoException();
1242 return true;
1243 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001244
1245 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1246 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001247 int[] pids = data.createIntArray();
1248 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001249 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001250 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001251 return true;
1252 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001253
1254 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 String processName = data.readString();
1257 int uid = data.readInt();
1258 killApplicationProcess(processName, uid);
1259 reply.writeNoException();
1260 return true;
1261 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001262
1263 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 IBinder token = data.readStrongBinder();
1266 String packageName = data.readString();
1267 int enterAnim = data.readInt();
1268 int exitAnim = data.readInt();
1269 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001270 reply.writeNoException();
1271 return true;
1272 }
1273
1274 case IS_USER_A_MONKEY_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001276 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001277 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001278 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001279 return true;
1280 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001281
1282 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1283 data.enforceInterface(IActivityManager.descriptor);
1284 finishHeavyWeightApp();
1285 reply.writeNoException();
1286 return true;
1287 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001288
1289 case IS_IMMERSIVE_TRANSACTION: {
1290 data.enforceInterface(IActivityManager.descriptor);
1291 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001292 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001293 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001294 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001295 return true;
1296 }
1297
1298 case SET_IMMERSIVE_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 IBinder token = data.readStrongBinder();
1301 boolean imm = data.readInt() == 1;
1302 setImmersive(token, imm);
1303 reply.writeNoException();
1304 return true;
1305 }
1306
1307 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1308 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001309 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001310 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001311 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001312 return true;
1313 }
1314
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001315 case CRASH_APPLICATION_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 int uid = data.readInt();
1318 int initialPid = data.readInt();
1319 String packageName = data.readString();
1320 String message = data.readString();
1321 crashApplication(uid, initialPid, packageName, message);
1322 reply.writeNoException();
1323 return true;
1324 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001325
1326 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 Uri uri = Uri.CREATOR.createFromParcel(data);
1329 String type = getProviderMimeType(uri);
1330 reply.writeNoException();
1331 reply.writeString(type);
1332 return true;
1333 }
1334
Dianne Hackborn7e269642010-08-25 19:50:20 -07001335 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 String name = data.readString();
1338 IBinder perm = newUriPermissionOwner(name);
1339 reply.writeNoException();
1340 reply.writeStrongBinder(perm);
1341 return true;
1342 }
1343
1344 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 IBinder owner = data.readStrongBinder();
1347 int fromUid = data.readInt();
1348 String targetPkg = data.readString();
1349 Uri uri = Uri.CREATOR.createFromParcel(data);
1350 int mode = data.readInt();
1351 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1352 reply.writeNoException();
1353 return true;
1354 }
1355
1356 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1357 data.enforceInterface(IActivityManager.descriptor);
1358 IBinder owner = data.readStrongBinder();
1359 Uri uri = null;
1360 if (data.readInt() != 0) {
1361 Uri.CREATOR.createFromParcel(data);
1362 }
1363 int mode = data.readInt();
1364 revokeUriPermissionFromOwner(owner, uri, mode);
1365 reply.writeNoException();
1366 return true;
1367 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001368
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001369 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1370 data.enforceInterface(IActivityManager.descriptor);
1371 int callingUid = data.readInt();
1372 String targetPkg = data.readString();
1373 Uri uri = Uri.CREATOR.createFromParcel(data);
1374 int modeFlags = data.readInt();
1375 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1376 reply.writeNoException();
1377 reply.writeInt(res);
1378 return true;
1379 }
1380
Andy McFadden824c5102010-07-09 16:26:57 -07001381 case DUMP_HEAP_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 String process = data.readString();
1384 boolean managed = data.readInt() != 0;
1385 String path = data.readString();
1386 ParcelFileDescriptor fd = data.readInt() != 0
1387 ? data.readFileDescriptor() : null;
1388 boolean res = dumpHeap(process, managed, path, fd);
1389 reply.writeNoException();
1390 reply.writeInt(res ? 1 : 0);
1391 return true;
1392 }
1393
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001394 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1395 {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 int uid = data.readInt();
1398 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1399 String[] resolvedTypes = data.createStringArray();
1400 IBinder resultTo = data.readStrongBinder();
1401 int result = startActivitiesInPackage(uid, intents, resolvedTypes, resultTo);
1402 reply.writeNoException();
1403 reply.writeInt(result);
1404 return true;
1405 }
1406
1407 case START_ACTIVITIES_TRANSACTION:
1408 {
1409 data.enforceInterface(IActivityManager.descriptor);
1410 IBinder b = data.readStrongBinder();
1411 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1412 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1413 String[] resolvedTypes = data.createStringArray();
1414 IBinder resultTo = data.readStrongBinder();
1415 int result = startActivities(app, intents, resolvedTypes, resultTo);
1416 reply.writeNoException();
1417 reply.writeInt(result);
1418 return true;
1419 }
1420
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001421 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1422 {
1423 data.enforceInterface(IActivityManager.descriptor);
1424 int mode = getFrontActivityScreenCompatMode();
1425 reply.writeNoException();
1426 reply.writeInt(mode);
1427 return true;
1428 }
1429
1430 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1431 {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 int mode = data.readInt();
1434 setFrontActivityScreenCompatMode(mode);
1435 reply.writeNoException();
1436 reply.writeInt(mode);
1437 return true;
1438 }
1439
1440 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1441 {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 String pkg = data.readString();
1444 int mode = getPackageScreenCompatMode(pkg);
1445 reply.writeNoException();
1446 reply.writeInt(mode);
1447 return true;
1448 }
1449
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001450 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1451 {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001454 int mode = data.readInt();
1455 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001456 reply.writeNoException();
1457 return true;
1458 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001459
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001460 case SWITCH_USER_TRANSACTION: {
1461 data.enforceInterface(IActivityManager.descriptor);
1462 int userid = data.readInt();
1463 boolean result = switchUser(userid);
1464 reply.writeNoException();
1465 reply.writeInt(result ? 1 : 0);
1466 return true;
1467 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001468
1469 case REMOVE_SUB_TASK_TRANSACTION:
1470 {
1471 data.enforceInterface(IActivityManager.descriptor);
1472 int taskId = data.readInt();
1473 int subTaskIndex = data.readInt();
1474 boolean result = removeSubTask(taskId, subTaskIndex);
1475 reply.writeNoException();
1476 reply.writeInt(result ? 1 : 0);
1477 return true;
1478 }
1479
1480 case REMOVE_TASK_TRANSACTION:
1481 {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 int taskId = data.readInt();
1484 int fl = data.readInt();
1485 boolean result = removeTask(taskId, fl);
1486 reply.writeNoException();
1487 reply.writeInt(result ? 1 : 0);
1488 return true;
1489 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001490
Jeff Sharkeya4620792011-05-20 15:29:23 -07001491 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1492 data.enforceInterface(IActivityManager.descriptor);
1493 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1494 data.readStrongBinder());
1495 registerProcessObserver(observer);
1496 return true;
1497 }
1498
1499 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1502 data.readStrongBinder());
1503 unregisterProcessObserver(observer);
1504 return true;
1505 }
1506
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001507 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1508 {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 String pkg = data.readString();
1511 boolean ask = getPackageAskScreenCompat(pkg);
1512 reply.writeNoException();
1513 reply.writeInt(ask ? 1 : 0);
1514 return true;
1515 }
1516
1517 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1518 {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 String pkg = data.readString();
1521 boolean ask = data.readInt() != 0;
1522 setPackageAskScreenCompat(pkg, ask);
1523 reply.writeNoException();
1524 return true;
1525 }
1526
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001527 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1528 data.enforceInterface(IActivityManager.descriptor);
1529 IIntentSender r = IIntentSender.Stub.asInterface(
1530 data.readStrongBinder());
1531 boolean res = isIntentSenderTargetedToPackage(r);
1532 reply.writeNoException();
1533 reply.writeInt(res ? 1 : 0);
1534 return true;
1535 }
1536
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001537 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1538 data.enforceInterface(IActivityManager.descriptor);
1539 Configuration config = Configuration.CREATOR.createFromParcel(data);
1540 updatePersistentConfiguration(config);
1541 reply.writeNoException();
1542 return true;
1543 }
1544
Dianne Hackbornb437e092011-08-05 17:50:29 -07001545 case GET_PROCESS_PSS_TRANSACTION: {
1546 data.enforceInterface(IActivityManager.descriptor);
1547 int[] pids = data.createIntArray();
1548 long[] pss = getProcessPss(pids);
1549 reply.writeNoException();
1550 reply.writeLongArray(pss);
1551 return true;
1552 }
1553
Dianne Hackborn661cd522011-08-22 00:26:20 -07001554 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1557 boolean always = data.readInt() != 0;
1558 showBootMessage(msg, always);
1559 reply.writeNoException();
1560 return true;
1561 }
1562
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001563 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
1565 dismissKeyguardOnNextActivity();
1566 reply.writeNoException();
1567 return true;
1568 }
1569
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001570 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001571
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001572 return super.onTransact(code, data, reply, flags);
1573 }
1574
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001575 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001576 return this;
1577 }
1578
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001579 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1580 protected IActivityManager create() {
1581 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001582 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001583 Log.v("ActivityManager", "default service binder = " + b);
1584 }
1585 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001586 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001587 Log.v("ActivityManager", "default service = " + am);
1588 }
1589 return am;
1590 }
1591 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001592}
1593
1594class ActivityManagerProxy implements IActivityManager
1595{
1596 public ActivityManagerProxy(IBinder remote)
1597 {
1598 mRemote = remote;
1599 }
1600
1601 public IBinder asBinder()
1602 {
1603 return mRemote;
1604 }
1605
1606 public int startActivity(IApplicationThread caller, Intent intent,
1607 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1608 IBinder resultTo, String resultWho,
1609 int requestCode, boolean onlyIfNeeded,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001610 boolean debug, String profileFile, ParcelFileDescriptor profileFd,
1611 boolean autoStopProfiler) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001612 Parcel data = Parcel.obtain();
1613 Parcel reply = Parcel.obtain();
1614 data.writeInterfaceToken(IActivityManager.descriptor);
1615 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1616 intent.writeToParcel(data, 0);
1617 data.writeString(resolvedType);
1618 data.writeTypedArray(grantedUriPermissions, 0);
1619 data.writeInt(grantedMode);
1620 data.writeStrongBinder(resultTo);
1621 data.writeString(resultWho);
1622 data.writeInt(requestCode);
1623 data.writeInt(onlyIfNeeded ? 1 : 0);
1624 data.writeInt(debug ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001625 data.writeString(profileFile);
1626 if (profileFd != null) {
1627 data.writeInt(1);
1628 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1629 } else {
1630 data.writeInt(0);
1631 }
1632 data.writeInt(autoStopProfiler ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001633 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1634 reply.readException();
1635 int result = reply.readInt();
1636 reply.recycle();
1637 data.recycle();
1638 return result;
1639 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001640 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
1641 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1642 IBinder resultTo, String resultWho,
1643 int requestCode, boolean onlyIfNeeded,
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001644 boolean debug, String profileFile, ParcelFileDescriptor profileFd,
1645 boolean autoStopProfiler) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001646 Parcel data = Parcel.obtain();
1647 Parcel reply = Parcel.obtain();
1648 data.writeInterfaceToken(IActivityManager.descriptor);
1649 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1650 intent.writeToParcel(data, 0);
1651 data.writeString(resolvedType);
1652 data.writeTypedArray(grantedUriPermissions, 0);
1653 data.writeInt(grantedMode);
1654 data.writeStrongBinder(resultTo);
1655 data.writeString(resultWho);
1656 data.writeInt(requestCode);
1657 data.writeInt(onlyIfNeeded ? 1 : 0);
1658 data.writeInt(debug ? 1 : 0);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001659 data.writeString(profileFile);
1660 if (profileFd != null) {
1661 data.writeInt(1);
1662 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1663 } else {
1664 data.writeInt(0);
1665 }
1666 data.writeInt(autoStopProfiler ? 1 : 0);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001667 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1668 reply.readException();
1669 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1670 reply.recycle();
1671 data.recycle();
1672 return result;
1673 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001674 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
1675 String resolvedType, Uri[] grantedUriPermissions, int grantedMode,
1676 IBinder resultTo, String resultWho,
1677 int requestCode, boolean onlyIfNeeded,
1678 boolean debug, Configuration config) throws RemoteException {
1679 Parcel data = Parcel.obtain();
1680 Parcel reply = Parcel.obtain();
1681 data.writeInterfaceToken(IActivityManager.descriptor);
1682 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1683 intent.writeToParcel(data, 0);
1684 data.writeString(resolvedType);
1685 data.writeTypedArray(grantedUriPermissions, 0);
1686 data.writeInt(grantedMode);
1687 data.writeStrongBinder(resultTo);
1688 data.writeString(resultWho);
1689 data.writeInt(requestCode);
1690 data.writeInt(onlyIfNeeded ? 1 : 0);
1691 data.writeInt(debug ? 1 : 0);
1692 config.writeToParcel(data, 0);
1693 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1694 reply.readException();
1695 int result = reply.readInt();
1696 reply.recycle();
1697 data.recycle();
1698 return result;
1699 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001700 public int startActivityIntentSender(IApplicationThread caller,
1701 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001702 IBinder resultTo, String resultWho, int requestCode,
1703 int flagsMask, int flagsValues) throws RemoteException {
1704 Parcel data = Parcel.obtain();
1705 Parcel reply = Parcel.obtain();
1706 data.writeInterfaceToken(IActivityManager.descriptor);
1707 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1708 intent.writeToParcel(data, 0);
1709 if (fillInIntent != null) {
1710 data.writeInt(1);
1711 fillInIntent.writeToParcel(data, 0);
1712 } else {
1713 data.writeInt(0);
1714 }
1715 data.writeString(resolvedType);
1716 data.writeStrongBinder(resultTo);
1717 data.writeString(resultWho);
1718 data.writeInt(requestCode);
1719 data.writeInt(flagsMask);
1720 data.writeInt(flagsValues);
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001721 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001722 reply.readException();
1723 int result = reply.readInt();
1724 reply.recycle();
1725 data.recycle();
1726 return result;
1727 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001728 public boolean startNextMatchingActivity(IBinder callingActivity,
1729 Intent intent) throws RemoteException {
1730 Parcel data = Parcel.obtain();
1731 Parcel reply = Parcel.obtain();
1732 data.writeInterfaceToken(IActivityManager.descriptor);
1733 data.writeStrongBinder(callingActivity);
1734 intent.writeToParcel(data, 0);
1735 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1736 reply.readException();
1737 int result = reply.readInt();
1738 reply.recycle();
1739 data.recycle();
1740 return result != 0;
1741 }
1742 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1743 throws RemoteException {
1744 Parcel data = Parcel.obtain();
1745 Parcel reply = Parcel.obtain();
1746 data.writeInterfaceToken(IActivityManager.descriptor);
1747 data.writeStrongBinder(token);
1748 data.writeInt(resultCode);
1749 if (resultData != null) {
1750 data.writeInt(1);
1751 resultData.writeToParcel(data, 0);
1752 } else {
1753 data.writeInt(0);
1754 }
1755 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1756 reply.readException();
1757 boolean res = reply.readInt() != 0;
1758 data.recycle();
1759 reply.recycle();
1760 return res;
1761 }
1762 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1763 {
1764 Parcel data = Parcel.obtain();
1765 Parcel reply = Parcel.obtain();
1766 data.writeInterfaceToken(IActivityManager.descriptor);
1767 data.writeStrongBinder(token);
1768 data.writeString(resultWho);
1769 data.writeInt(requestCode);
1770 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1771 reply.readException();
1772 data.recycle();
1773 reply.recycle();
1774 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001775 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1776 Parcel data = Parcel.obtain();
1777 Parcel reply = Parcel.obtain();
1778 data.writeInterfaceToken(IActivityManager.descriptor);
1779 data.writeStrongBinder(token);
1780 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1781 reply.readException();
1782 boolean res = reply.readInt() != 0;
1783 data.recycle();
1784 reply.recycle();
1785 return res;
1786 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001787 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001788 IIntentReceiver receiver,
1789 IntentFilter filter, String perm) throws RemoteException
1790 {
1791 Parcel data = Parcel.obtain();
1792 Parcel reply = Parcel.obtain();
1793 data.writeInterfaceToken(IActivityManager.descriptor);
1794 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001795 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001796 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1797 filter.writeToParcel(data, 0);
1798 data.writeString(perm);
1799 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1800 reply.readException();
1801 Intent intent = null;
1802 int haveIntent = reply.readInt();
1803 if (haveIntent != 0) {
1804 intent = Intent.CREATOR.createFromParcel(reply);
1805 }
1806 reply.recycle();
1807 data.recycle();
1808 return intent;
1809 }
1810 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1811 {
1812 Parcel data = Parcel.obtain();
1813 Parcel reply = Parcel.obtain();
1814 data.writeInterfaceToken(IActivityManager.descriptor);
1815 data.writeStrongBinder(receiver.asBinder());
1816 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1817 reply.readException();
1818 data.recycle();
1819 reply.recycle();
1820 }
1821 public int broadcastIntent(IApplicationThread caller,
1822 Intent intent, String resolvedType, IIntentReceiver resultTo,
1823 int resultCode, String resultData, Bundle map,
1824 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001825 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001826 {
1827 Parcel data = Parcel.obtain();
1828 Parcel reply = Parcel.obtain();
1829 data.writeInterfaceToken(IActivityManager.descriptor);
1830 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1831 intent.writeToParcel(data, 0);
1832 data.writeString(resolvedType);
1833 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1834 data.writeInt(resultCode);
1835 data.writeString(resultData);
1836 data.writeBundle(map);
1837 data.writeString(requiredPermission);
1838 data.writeInt(serialized ? 1 : 0);
1839 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001840 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001841 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1842 reply.readException();
1843 int res = reply.readInt();
1844 reply.recycle();
1845 data.recycle();
1846 return res;
1847 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001848 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1849 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001850 {
1851 Parcel data = Parcel.obtain();
1852 Parcel reply = Parcel.obtain();
1853 data.writeInterfaceToken(IActivityManager.descriptor);
1854 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1855 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001856 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001857 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1858 reply.readException();
1859 data.recycle();
1860 reply.recycle();
1861 }
1862 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1863 {
1864 Parcel data = Parcel.obtain();
1865 Parcel reply = Parcel.obtain();
1866 data.writeInterfaceToken(IActivityManager.descriptor);
1867 data.writeStrongBinder(who);
1868 data.writeInt(resultCode);
1869 data.writeString(resultData);
1870 data.writeBundle(map);
1871 data.writeInt(abortBroadcast ? 1 : 0);
1872 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1873 reply.readException();
1874 data.recycle();
1875 reply.recycle();
1876 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001877 public void attachApplication(IApplicationThread app) throws RemoteException
1878 {
1879 Parcel data = Parcel.obtain();
1880 Parcel reply = Parcel.obtain();
1881 data.writeInterfaceToken(IActivityManager.descriptor);
1882 data.writeStrongBinder(app.asBinder());
1883 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1884 reply.readException();
1885 data.recycle();
1886 reply.recycle();
1887 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001888 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1889 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001890 {
1891 Parcel data = Parcel.obtain();
1892 Parcel reply = Parcel.obtain();
1893 data.writeInterfaceToken(IActivityManager.descriptor);
1894 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001895 if (config != null) {
1896 data.writeInt(1);
1897 config.writeToParcel(data, 0);
1898 } else {
1899 data.writeInt(0);
1900 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001901 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001902 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1903 reply.readException();
1904 data.recycle();
1905 reply.recycle();
1906 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001907 public void activityPaused(IBinder token) throws RemoteException
1908 {
1909 Parcel data = Parcel.obtain();
1910 Parcel reply = Parcel.obtain();
1911 data.writeInterfaceToken(IActivityManager.descriptor);
1912 data.writeStrongBinder(token);
1913 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1914 reply.readException();
1915 data.recycle();
1916 reply.recycle();
1917 }
1918 public void activityStopped(IBinder token, Bundle state,
1919 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001920 {
1921 Parcel data = Parcel.obtain();
1922 Parcel reply = Parcel.obtain();
1923 data.writeInterfaceToken(IActivityManager.descriptor);
1924 data.writeStrongBinder(token);
1925 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001926 if (thumbnail != null) {
1927 data.writeInt(1);
1928 thumbnail.writeToParcel(data, 0);
1929 } else {
1930 data.writeInt(0);
1931 }
1932 TextUtils.writeToParcel(description, data, 0);
1933 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1934 reply.readException();
1935 data.recycle();
1936 reply.recycle();
1937 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001938 public void activitySlept(IBinder token) throws RemoteException
1939 {
1940 Parcel data = Parcel.obtain();
1941 Parcel reply = Parcel.obtain();
1942 data.writeInterfaceToken(IActivityManager.descriptor);
1943 data.writeStrongBinder(token);
1944 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1945 reply.readException();
1946 data.recycle();
1947 reply.recycle();
1948 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001949 public void activityDestroyed(IBinder token) throws RemoteException
1950 {
1951 Parcel data = Parcel.obtain();
1952 Parcel reply = Parcel.obtain();
1953 data.writeInterfaceToken(IActivityManager.descriptor);
1954 data.writeStrongBinder(token);
1955 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1956 reply.readException();
1957 data.recycle();
1958 reply.recycle();
1959 }
1960 public String getCallingPackage(IBinder token) throws RemoteException
1961 {
1962 Parcel data = Parcel.obtain();
1963 Parcel reply = Parcel.obtain();
1964 data.writeInterfaceToken(IActivityManager.descriptor);
1965 data.writeStrongBinder(token);
1966 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1967 reply.readException();
1968 String res = reply.readString();
1969 data.recycle();
1970 reply.recycle();
1971 return res;
1972 }
1973 public ComponentName getCallingActivity(IBinder token)
1974 throws RemoteException {
1975 Parcel data = Parcel.obtain();
1976 Parcel reply = Parcel.obtain();
1977 data.writeInterfaceToken(IActivityManager.descriptor);
1978 data.writeStrongBinder(token);
1979 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
1980 reply.readException();
1981 ComponentName res = ComponentName.readFromParcel(reply);
1982 data.recycle();
1983 reply.recycle();
1984 return res;
1985 }
1986 public List getTasks(int maxNum, int flags,
1987 IThumbnailReceiver receiver) throws RemoteException {
1988 Parcel data = Parcel.obtain();
1989 Parcel reply = Parcel.obtain();
1990 data.writeInterfaceToken(IActivityManager.descriptor);
1991 data.writeInt(maxNum);
1992 data.writeInt(flags);
1993 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1994 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
1995 reply.readException();
1996 ArrayList list = null;
1997 int N = reply.readInt();
1998 if (N >= 0) {
1999 list = new ArrayList();
2000 while (N > 0) {
2001 ActivityManager.RunningTaskInfo info =
2002 ActivityManager.RunningTaskInfo.CREATOR
2003 .createFromParcel(reply);
2004 list.add(info);
2005 N--;
2006 }
2007 }
2008 data.recycle();
2009 reply.recycle();
2010 return list;
2011 }
2012 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2013 int flags) throws RemoteException {
2014 Parcel data = Parcel.obtain();
2015 Parcel reply = Parcel.obtain();
2016 data.writeInterfaceToken(IActivityManager.descriptor);
2017 data.writeInt(maxNum);
2018 data.writeInt(flags);
2019 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2020 reply.readException();
2021 ArrayList<ActivityManager.RecentTaskInfo> list
2022 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2023 data.recycle();
2024 reply.recycle();
2025 return list;
2026 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002027 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002028 Parcel data = Parcel.obtain();
2029 Parcel reply = Parcel.obtain();
2030 data.writeInterfaceToken(IActivityManager.descriptor);
2031 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002032 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002033 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002034 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002035 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002036 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002037 }
2038 data.recycle();
2039 reply.recycle();
2040 return bm;
2041 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002042 public List getServices(int maxNum, int flags) throws RemoteException {
2043 Parcel data = Parcel.obtain();
2044 Parcel reply = Parcel.obtain();
2045 data.writeInterfaceToken(IActivityManager.descriptor);
2046 data.writeInt(maxNum);
2047 data.writeInt(flags);
2048 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2049 reply.readException();
2050 ArrayList list = null;
2051 int N = reply.readInt();
2052 if (N >= 0) {
2053 list = new ArrayList();
2054 while (N > 0) {
2055 ActivityManager.RunningServiceInfo info =
2056 ActivityManager.RunningServiceInfo.CREATOR
2057 .createFromParcel(reply);
2058 list.add(info);
2059 N--;
2060 }
2061 }
2062 data.recycle();
2063 reply.recycle();
2064 return list;
2065 }
2066 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2067 throws RemoteException {
2068 Parcel data = Parcel.obtain();
2069 Parcel reply = Parcel.obtain();
2070 data.writeInterfaceToken(IActivityManager.descriptor);
2071 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2072 reply.readException();
2073 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2074 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2075 data.recycle();
2076 reply.recycle();
2077 return list;
2078 }
2079 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2080 throws RemoteException {
2081 Parcel data = Parcel.obtain();
2082 Parcel reply = Parcel.obtain();
2083 data.writeInterfaceToken(IActivityManager.descriptor);
2084 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2085 reply.readException();
2086 ArrayList<ActivityManager.RunningAppProcessInfo> list
2087 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2088 data.recycle();
2089 reply.recycle();
2090 return list;
2091 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002092 public List<ApplicationInfo> getRunningExternalApplications()
2093 throws RemoteException {
2094 Parcel data = Parcel.obtain();
2095 Parcel reply = Parcel.obtain();
2096 data.writeInterfaceToken(IActivityManager.descriptor);
2097 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2098 reply.readException();
2099 ArrayList<ApplicationInfo> list
2100 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2101 data.recycle();
2102 reply.recycle();
2103 return list;
2104 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002105 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002106 {
2107 Parcel data = Parcel.obtain();
2108 Parcel reply = Parcel.obtain();
2109 data.writeInterfaceToken(IActivityManager.descriptor);
2110 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002111 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002112 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2113 reply.readException();
2114 data.recycle();
2115 reply.recycle();
2116 }
2117 public void moveTaskToBack(int task) throws RemoteException
2118 {
2119 Parcel data = Parcel.obtain();
2120 Parcel reply = Parcel.obtain();
2121 data.writeInterfaceToken(IActivityManager.descriptor);
2122 data.writeInt(task);
2123 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2124 reply.readException();
2125 data.recycle();
2126 reply.recycle();
2127 }
2128 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2129 throws RemoteException {
2130 Parcel data = Parcel.obtain();
2131 Parcel reply = Parcel.obtain();
2132 data.writeInterfaceToken(IActivityManager.descriptor);
2133 data.writeStrongBinder(token);
2134 data.writeInt(nonRoot ? 1 : 0);
2135 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2136 reply.readException();
2137 boolean res = reply.readInt() != 0;
2138 data.recycle();
2139 reply.recycle();
2140 return res;
2141 }
2142 public void moveTaskBackwards(int task) throws RemoteException
2143 {
2144 Parcel data = Parcel.obtain();
2145 Parcel reply = Parcel.obtain();
2146 data.writeInterfaceToken(IActivityManager.descriptor);
2147 data.writeInt(task);
2148 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2149 reply.readException();
2150 data.recycle();
2151 reply.recycle();
2152 }
2153 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2154 {
2155 Parcel data = Parcel.obtain();
2156 Parcel reply = Parcel.obtain();
2157 data.writeInterfaceToken(IActivityManager.descriptor);
2158 data.writeStrongBinder(token);
2159 data.writeInt(onlyRoot ? 1 : 0);
2160 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2161 reply.readException();
2162 int res = reply.readInt();
2163 data.recycle();
2164 reply.recycle();
2165 return res;
2166 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002167 public void reportThumbnail(IBinder token,
2168 Bitmap thumbnail, CharSequence description) throws RemoteException
2169 {
2170 Parcel data = Parcel.obtain();
2171 Parcel reply = Parcel.obtain();
2172 data.writeInterfaceToken(IActivityManager.descriptor);
2173 data.writeStrongBinder(token);
2174 if (thumbnail != null) {
2175 data.writeInt(1);
2176 thumbnail.writeToParcel(data, 0);
2177 } else {
2178 data.writeInt(0);
2179 }
2180 TextUtils.writeToParcel(description, data, 0);
2181 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2182 reply.readException();
2183 data.recycle();
2184 reply.recycle();
2185 }
2186 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2187 String name) throws RemoteException
2188 {
2189 Parcel data = Parcel.obtain();
2190 Parcel reply = Parcel.obtain();
2191 data.writeInterfaceToken(IActivityManager.descriptor);
2192 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2193 data.writeString(name);
2194 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2195 reply.readException();
2196 int res = reply.readInt();
2197 ContentProviderHolder cph = null;
2198 if (res != 0) {
2199 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2200 }
2201 data.recycle();
2202 reply.recycle();
2203 return cph;
2204 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002205 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2206 throws RemoteException
2207 {
2208 Parcel data = Parcel.obtain();
2209 Parcel reply = Parcel.obtain();
2210 data.writeInterfaceToken(IActivityManager.descriptor);
2211 data.writeString(name);
2212 data.writeStrongBinder(token);
2213 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2214 reply.readException();
2215 int res = reply.readInt();
2216 ContentProviderHolder cph = null;
2217 if (res != 0) {
2218 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2219 }
2220 data.recycle();
2221 reply.recycle();
2222 return cph;
2223 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002224 public void publishContentProviders(IApplicationThread caller,
2225 List<ContentProviderHolder> providers) throws RemoteException
2226 {
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.writeTypedList(providers);
2232 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2233 reply.readException();
2234 data.recycle();
2235 reply.recycle();
2236 }
2237
2238 public void removeContentProvider(IApplicationThread caller,
2239 String name) throws RemoteException {
2240 Parcel data = Parcel.obtain();
2241 Parcel reply = Parcel.obtain();
2242 data.writeInterfaceToken(IActivityManager.descriptor);
2243 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2244 data.writeString(name);
2245 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2246 reply.readException();
2247 data.recycle();
2248 reply.recycle();
2249 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002250
2251 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2252 Parcel data = Parcel.obtain();
2253 Parcel reply = Parcel.obtain();
2254 data.writeInterfaceToken(IActivityManager.descriptor);
2255 data.writeString(name);
2256 data.writeStrongBinder(token);
2257 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2258 reply.readException();
2259 data.recycle();
2260 reply.recycle();
2261 }
2262
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002263 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2264 throws RemoteException
2265 {
2266 Parcel data = Parcel.obtain();
2267 Parcel reply = Parcel.obtain();
2268 data.writeInterfaceToken(IActivityManager.descriptor);
2269 service.writeToParcel(data, 0);
2270 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2271 reply.readException();
2272 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2273 data.recycle();
2274 reply.recycle();
2275 return res;
2276 }
2277
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002278 public ComponentName startService(IApplicationThread caller, Intent service,
2279 String resolvedType) throws RemoteException
2280 {
2281 Parcel data = Parcel.obtain();
2282 Parcel reply = Parcel.obtain();
2283 data.writeInterfaceToken(IActivityManager.descriptor);
2284 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2285 service.writeToParcel(data, 0);
2286 data.writeString(resolvedType);
2287 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2288 reply.readException();
2289 ComponentName res = ComponentName.readFromParcel(reply);
2290 data.recycle();
2291 reply.recycle();
2292 return res;
2293 }
2294 public int stopService(IApplicationThread caller, Intent service,
2295 String resolvedType) throws RemoteException
2296 {
2297 Parcel data = Parcel.obtain();
2298 Parcel reply = Parcel.obtain();
2299 data.writeInterfaceToken(IActivityManager.descriptor);
2300 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2301 service.writeToParcel(data, 0);
2302 data.writeString(resolvedType);
2303 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2304 reply.readException();
2305 int res = reply.readInt();
2306 reply.recycle();
2307 data.recycle();
2308 return res;
2309 }
2310 public boolean stopServiceToken(ComponentName className, IBinder token,
2311 int startId) throws RemoteException {
2312 Parcel data = Parcel.obtain();
2313 Parcel reply = Parcel.obtain();
2314 data.writeInterfaceToken(IActivityManager.descriptor);
2315 ComponentName.writeToParcel(className, data);
2316 data.writeStrongBinder(token);
2317 data.writeInt(startId);
2318 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2319 reply.readException();
2320 boolean res = reply.readInt() != 0;
2321 data.recycle();
2322 reply.recycle();
2323 return res;
2324 }
2325 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002326 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 ComponentName.writeToParcel(className, data);
2331 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002332 data.writeInt(id);
2333 if (notification != null) {
2334 data.writeInt(1);
2335 notification.writeToParcel(data, 0);
2336 } else {
2337 data.writeInt(0);
2338 }
2339 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002340 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2341 reply.readException();
2342 data.recycle();
2343 reply.recycle();
2344 }
2345 public int bindService(IApplicationThread caller, IBinder token,
2346 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002347 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002348 Parcel data = Parcel.obtain();
2349 Parcel reply = Parcel.obtain();
2350 data.writeInterfaceToken(IActivityManager.descriptor);
2351 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2352 data.writeStrongBinder(token);
2353 service.writeToParcel(data, 0);
2354 data.writeString(resolvedType);
2355 data.writeStrongBinder(connection.asBinder());
2356 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002357 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002358 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2359 reply.readException();
2360 int res = reply.readInt();
2361 data.recycle();
2362 reply.recycle();
2363 return res;
2364 }
2365 public boolean unbindService(IServiceConnection connection) throws RemoteException
2366 {
2367 Parcel data = Parcel.obtain();
2368 Parcel reply = Parcel.obtain();
2369 data.writeInterfaceToken(IActivityManager.descriptor);
2370 data.writeStrongBinder(connection.asBinder());
2371 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2372 reply.readException();
2373 boolean res = reply.readInt() != 0;
2374 data.recycle();
2375 reply.recycle();
2376 return res;
2377 }
2378
2379 public void publishService(IBinder token,
2380 Intent intent, IBinder service) throws RemoteException {
2381 Parcel data = Parcel.obtain();
2382 Parcel reply = Parcel.obtain();
2383 data.writeInterfaceToken(IActivityManager.descriptor);
2384 data.writeStrongBinder(token);
2385 intent.writeToParcel(data, 0);
2386 data.writeStrongBinder(service);
2387 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2388 reply.readException();
2389 data.recycle();
2390 reply.recycle();
2391 }
2392
2393 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2394 throws RemoteException {
2395 Parcel data = Parcel.obtain();
2396 Parcel reply = Parcel.obtain();
2397 data.writeInterfaceToken(IActivityManager.descriptor);
2398 data.writeStrongBinder(token);
2399 intent.writeToParcel(data, 0);
2400 data.writeInt(doRebind ? 1 : 0);
2401 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2402 reply.readException();
2403 data.recycle();
2404 reply.recycle();
2405 }
2406
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002407 public void serviceDoneExecuting(IBinder token, int type, int startId,
2408 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002409 Parcel data = Parcel.obtain();
2410 Parcel reply = Parcel.obtain();
2411 data.writeInterfaceToken(IActivityManager.descriptor);
2412 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002413 data.writeInt(type);
2414 data.writeInt(startId);
2415 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2417 reply.readException();
2418 data.recycle();
2419 reply.recycle();
2420 }
2421
2422 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2423 Parcel data = Parcel.obtain();
2424 Parcel reply = Parcel.obtain();
2425 data.writeInterfaceToken(IActivityManager.descriptor);
2426 service.writeToParcel(data, 0);
2427 data.writeString(resolvedType);
2428 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2429 reply.readException();
2430 IBinder binder = reply.readStrongBinder();
2431 reply.recycle();
2432 data.recycle();
2433 return binder;
2434 }
2435
Christopher Tate181fafa2009-05-14 11:12:14 -07002436 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2437 throws RemoteException {
2438 Parcel data = Parcel.obtain();
2439 Parcel reply = Parcel.obtain();
2440 data.writeInterfaceToken(IActivityManager.descriptor);
2441 app.writeToParcel(data, 0);
2442 data.writeInt(backupRestoreMode);
2443 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 boolean success = reply.readInt() != 0;
2446 reply.recycle();
2447 data.recycle();
2448 return success;
2449 }
2450
2451 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2452 Parcel data = Parcel.obtain();
2453 Parcel reply = Parcel.obtain();
2454 data.writeInterfaceToken(IActivityManager.descriptor);
2455 data.writeString(packageName);
2456 data.writeStrongBinder(agent);
2457 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2458 reply.recycle();
2459 data.recycle();
2460 }
2461
2462 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2463 Parcel data = Parcel.obtain();
2464 Parcel reply = Parcel.obtain();
2465 data.writeInterfaceToken(IActivityManager.descriptor);
2466 app.writeToParcel(data, 0);
2467 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2468 reply.readException();
2469 reply.recycle();
2470 data.recycle();
2471 }
2472
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002473 public boolean startInstrumentation(ComponentName className, String profileFile,
2474 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2475 throws RemoteException {
2476 Parcel data = Parcel.obtain();
2477 Parcel reply = Parcel.obtain();
2478 data.writeInterfaceToken(IActivityManager.descriptor);
2479 ComponentName.writeToParcel(className, data);
2480 data.writeString(profileFile);
2481 data.writeInt(flags);
2482 data.writeBundle(arguments);
2483 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2484 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 boolean res = reply.readInt() != 0;
2487 reply.recycle();
2488 data.recycle();
2489 return res;
2490 }
2491
2492 public void finishInstrumentation(IApplicationThread target,
2493 int resultCode, Bundle results) throws RemoteException {
2494 Parcel data = Parcel.obtain();
2495 Parcel reply = Parcel.obtain();
2496 data.writeInterfaceToken(IActivityManager.descriptor);
2497 data.writeStrongBinder(target != null ? target.asBinder() : null);
2498 data.writeInt(resultCode);
2499 data.writeBundle(results);
2500 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2501 reply.readException();
2502 data.recycle();
2503 reply.recycle();
2504 }
2505 public Configuration getConfiguration() throws RemoteException
2506 {
2507 Parcel data = Parcel.obtain();
2508 Parcel reply = Parcel.obtain();
2509 data.writeInterfaceToken(IActivityManager.descriptor);
2510 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2511 reply.readException();
2512 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2513 reply.recycle();
2514 data.recycle();
2515 return res;
2516 }
2517 public void updateConfiguration(Configuration values) throws RemoteException
2518 {
2519 Parcel data = Parcel.obtain();
2520 Parcel reply = Parcel.obtain();
2521 data.writeInterfaceToken(IActivityManager.descriptor);
2522 values.writeToParcel(data, 0);
2523 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2524 reply.readException();
2525 data.recycle();
2526 reply.recycle();
2527 }
2528 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2529 throws RemoteException {
2530 Parcel data = Parcel.obtain();
2531 Parcel reply = Parcel.obtain();
2532 data.writeInterfaceToken(IActivityManager.descriptor);
2533 data.writeStrongBinder(token);
2534 data.writeInt(requestedOrientation);
2535 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2536 reply.readException();
2537 data.recycle();
2538 reply.recycle();
2539 }
2540 public int getRequestedOrientation(IBinder token) throws RemoteException {
2541 Parcel data = Parcel.obtain();
2542 Parcel reply = Parcel.obtain();
2543 data.writeInterfaceToken(IActivityManager.descriptor);
2544 data.writeStrongBinder(token);
2545 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2546 reply.readException();
2547 int res = reply.readInt();
2548 data.recycle();
2549 reply.recycle();
2550 return res;
2551 }
2552 public ComponentName getActivityClassForToken(IBinder token)
2553 throws RemoteException {
2554 Parcel data = Parcel.obtain();
2555 Parcel reply = Parcel.obtain();
2556 data.writeInterfaceToken(IActivityManager.descriptor);
2557 data.writeStrongBinder(token);
2558 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 ComponentName res = ComponentName.readFromParcel(reply);
2561 data.recycle();
2562 reply.recycle();
2563 return res;
2564 }
2565 public String getPackageForToken(IBinder token) throws RemoteException
2566 {
2567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 data.writeStrongBinder(token);
2571 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2572 reply.readException();
2573 String res = reply.readString();
2574 data.recycle();
2575 reply.recycle();
2576 return res;
2577 }
2578 public IIntentSender getIntentSender(int type,
2579 String packageName, IBinder token, String resultWho,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002580 int requestCode, Intent[] intents, String[] resolvedTypes, int flags)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002581 throws RemoteException {
2582 Parcel data = Parcel.obtain();
2583 Parcel reply = Parcel.obtain();
2584 data.writeInterfaceToken(IActivityManager.descriptor);
2585 data.writeInt(type);
2586 data.writeString(packageName);
2587 data.writeStrongBinder(token);
2588 data.writeString(resultWho);
2589 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002590 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002591 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002592 data.writeTypedArray(intents, 0);
2593 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 } else {
2595 data.writeInt(0);
2596 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002597 data.writeInt(flags);
2598 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2599 reply.readException();
2600 IIntentSender res = IIntentSender.Stub.asInterface(
2601 reply.readStrongBinder());
2602 data.recycle();
2603 reply.recycle();
2604 return res;
2605 }
2606 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2607 Parcel data = Parcel.obtain();
2608 Parcel reply = Parcel.obtain();
2609 data.writeInterfaceToken(IActivityManager.descriptor);
2610 data.writeStrongBinder(sender.asBinder());
2611 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2612 reply.readException();
2613 data.recycle();
2614 reply.recycle();
2615 }
2616 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(sender.asBinder());
2621 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2622 reply.readException();
2623 String res = reply.readString();
2624 data.recycle();
2625 reply.recycle();
2626 return res;
2627 }
2628 public void setProcessLimit(int max) throws RemoteException
2629 {
2630 Parcel data = Parcel.obtain();
2631 Parcel reply = Parcel.obtain();
2632 data.writeInterfaceToken(IActivityManager.descriptor);
2633 data.writeInt(max);
2634 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2635 reply.readException();
2636 data.recycle();
2637 reply.recycle();
2638 }
2639 public int getProcessLimit() throws RemoteException
2640 {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2645 reply.readException();
2646 int res = reply.readInt();
2647 data.recycle();
2648 reply.recycle();
2649 return res;
2650 }
2651 public void setProcessForeground(IBinder token, int pid,
2652 boolean isForeground) throws RemoteException {
2653 Parcel data = Parcel.obtain();
2654 Parcel reply = Parcel.obtain();
2655 data.writeInterfaceToken(IActivityManager.descriptor);
2656 data.writeStrongBinder(token);
2657 data.writeInt(pid);
2658 data.writeInt(isForeground ? 1 : 0);
2659 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2660 reply.readException();
2661 data.recycle();
2662 reply.recycle();
2663 }
2664 public int checkPermission(String permission, int pid, int uid)
2665 throws RemoteException {
2666 Parcel data = Parcel.obtain();
2667 Parcel reply = Parcel.obtain();
2668 data.writeInterfaceToken(IActivityManager.descriptor);
2669 data.writeString(permission);
2670 data.writeInt(pid);
2671 data.writeInt(uid);
2672 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2673 reply.readException();
2674 int res = reply.readInt();
2675 data.recycle();
2676 reply.recycle();
2677 return res;
2678 }
2679 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002680 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002681 Parcel data = Parcel.obtain();
2682 Parcel reply = Parcel.obtain();
2683 data.writeInterfaceToken(IActivityManager.descriptor);
2684 data.writeString(packageName);
2685 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002686 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2688 reply.readException();
2689 boolean res = reply.readInt() != 0;
2690 data.recycle();
2691 reply.recycle();
2692 return res;
2693 }
2694 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2695 throws RemoteException {
2696 Parcel data = Parcel.obtain();
2697 Parcel reply = Parcel.obtain();
2698 data.writeInterfaceToken(IActivityManager.descriptor);
2699 uri.writeToParcel(data, 0);
2700 data.writeInt(pid);
2701 data.writeInt(uid);
2702 data.writeInt(mode);
2703 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2704 reply.readException();
2705 int res = reply.readInt();
2706 data.recycle();
2707 reply.recycle();
2708 return res;
2709 }
2710 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2711 Uri uri, int mode) throws RemoteException {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeStrongBinder(caller.asBinder());
2716 data.writeString(targetPkg);
2717 uri.writeToParcel(data, 0);
2718 data.writeInt(mode);
2719 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2720 reply.readException();
2721 data.recycle();
2722 reply.recycle();
2723 }
2724 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2725 int mode) throws RemoteException {
2726 Parcel data = Parcel.obtain();
2727 Parcel reply = Parcel.obtain();
2728 data.writeInterfaceToken(IActivityManager.descriptor);
2729 data.writeStrongBinder(caller.asBinder());
2730 uri.writeToParcel(data, 0);
2731 data.writeInt(mode);
2732 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 data.recycle();
2735 reply.recycle();
2736 }
2737 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2738 throws RemoteException {
2739 Parcel data = Parcel.obtain();
2740 Parcel reply = Parcel.obtain();
2741 data.writeInterfaceToken(IActivityManager.descriptor);
2742 data.writeStrongBinder(who.asBinder());
2743 data.writeInt(waiting ? 1 : 0);
2744 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2745 reply.readException();
2746 data.recycle();
2747 reply.recycle();
2748 }
2749 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2750 Parcel data = Parcel.obtain();
2751 Parcel reply = Parcel.obtain();
2752 data.writeInterfaceToken(IActivityManager.descriptor);
2753 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2754 reply.readException();
2755 outInfo.readFromParcel(reply);
2756 data.recycle();
2757 reply.recycle();
2758 }
2759 public void unhandledBack() throws RemoteException
2760 {
2761 Parcel data = Parcel.obtain();
2762 Parcel reply = Parcel.obtain();
2763 data.writeInterfaceToken(IActivityManager.descriptor);
2764 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2765 reply.readException();
2766 data.recycle();
2767 reply.recycle();
2768 }
2769 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2770 {
2771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
2773 data.writeInterfaceToken(IActivityManager.descriptor);
2774 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2775 reply.readException();
2776 ParcelFileDescriptor pfd = null;
2777 if (reply.readInt() != 0) {
2778 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2779 }
2780 data.recycle();
2781 reply.recycle();
2782 return pfd;
2783 }
2784 public void goingToSleep() throws RemoteException
2785 {
2786 Parcel data = Parcel.obtain();
2787 Parcel reply = Parcel.obtain();
2788 data.writeInterfaceToken(IActivityManager.descriptor);
2789 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2790 reply.readException();
2791 data.recycle();
2792 reply.recycle();
2793 }
2794 public void wakingUp() throws RemoteException
2795 {
2796 Parcel data = Parcel.obtain();
2797 Parcel reply = Parcel.obtain();
2798 data.writeInterfaceToken(IActivityManager.descriptor);
2799 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2800 reply.readException();
2801 data.recycle();
2802 reply.recycle();
2803 }
2804 public void setDebugApp(
2805 String packageName, boolean waitForDebugger, boolean persistent)
2806 throws RemoteException
2807 {
2808 Parcel data = Parcel.obtain();
2809 Parcel reply = Parcel.obtain();
2810 data.writeInterfaceToken(IActivityManager.descriptor);
2811 data.writeString(packageName);
2812 data.writeInt(waitForDebugger ? 1 : 0);
2813 data.writeInt(persistent ? 1 : 0);
2814 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 data.recycle();
2817 reply.recycle();
2818 }
2819 public void setAlwaysFinish(boolean enabled) throws RemoteException
2820 {
2821 Parcel data = Parcel.obtain();
2822 Parcel reply = Parcel.obtain();
2823 data.writeInterfaceToken(IActivityManager.descriptor);
2824 data.writeInt(enabled ? 1 : 0);
2825 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2826 reply.readException();
2827 data.recycle();
2828 reply.recycle();
2829 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002830 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002831 {
2832 Parcel data = Parcel.obtain();
2833 Parcel reply = Parcel.obtain();
2834 data.writeInterfaceToken(IActivityManager.descriptor);
2835 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002836 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002837 reply.readException();
2838 data.recycle();
2839 reply.recycle();
2840 }
2841 public void enterSafeMode() throws RemoteException {
2842 Parcel data = Parcel.obtain();
2843 data.writeInterfaceToken(IActivityManager.descriptor);
2844 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2845 data.recycle();
2846 }
2847 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2848 Parcel data = Parcel.obtain();
2849 data.writeStrongBinder(sender.asBinder());
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2852 data.recycle();
2853 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002854 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 Parcel data = Parcel.obtain();
2856 Parcel reply = Parcel.obtain();
2857 data.writeInterfaceToken(IActivityManager.descriptor);
2858 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002859 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002860 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002861 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 boolean res = reply.readInt() != 0;
2863 data.recycle();
2864 reply.recycle();
2865 return res;
2866 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002867 public void startRunning(String pkg, String cls, String action,
2868 String indata) throws RemoteException {
2869 Parcel data = Parcel.obtain();
2870 Parcel reply = Parcel.obtain();
2871 data.writeInterfaceToken(IActivityManager.descriptor);
2872 data.writeString(pkg);
2873 data.writeString(cls);
2874 data.writeString(action);
2875 data.writeString(indata);
2876 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 data.recycle();
2879 reply.recycle();
2880 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002881 public boolean testIsSystemReady()
2882 {
2883 /* this base class version is never called */
2884 return true;
2885 }
Dan Egnor60d87622009-12-16 16:32:58 -08002886 public void handleApplicationCrash(IBinder app,
2887 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2888 {
2889 Parcel data = Parcel.obtain();
2890 Parcel reply = Parcel.obtain();
2891 data.writeInterfaceToken(IActivityManager.descriptor);
2892 data.writeStrongBinder(app);
2893 crashInfo.writeToParcel(data, 0);
2894 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 reply.recycle();
2897 data.recycle();
2898 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002899
Dan Egnor60d87622009-12-16 16:32:58 -08002900 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002901 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002902 {
2903 Parcel data = Parcel.obtain();
2904 Parcel reply = Parcel.obtain();
2905 data.writeInterfaceToken(IActivityManager.descriptor);
2906 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002907 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002908 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002909 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002911 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 reply.recycle();
2913 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002914 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002915 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002916
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002917 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002918 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002919 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002920 {
2921 Parcel data = Parcel.obtain();
2922 Parcel reply = Parcel.obtain();
2923 data.writeInterfaceToken(IActivityManager.descriptor);
2924 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002925 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002926 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002927 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2928 reply.readException();
2929 reply.recycle();
2930 data.recycle();
2931 }
2932
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 public void signalPersistentProcesses(int sig) throws RemoteException {
2934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 data.writeInt(sig);
2938 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2939 reply.readException();
2940 data.recycle();
2941 reply.recycle();
2942 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08002943
Dianne Hackborn03abb812010-01-04 18:43:19 -08002944 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
2948 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002949 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2950 reply.readException();
2951 data.recycle();
2952 reply.recycle();
2953 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08002954
2955 public void killAllBackgroundProcesses() throws RemoteException {
2956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
2958 data.writeInterfaceToken(IActivityManager.descriptor);
2959 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 data.recycle();
2962 reply.recycle();
2963 }
2964
Dianne Hackborn03abb812010-01-04 18:43:19 -08002965 public void forceStopPackage(String packageName) throws RemoteException {
2966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
2969 data.writeString(packageName);
2970 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 reply.readException();
2972 data.recycle();
2973 reply.recycle();
2974 }
2975
2976 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
2977 {
2978 Parcel data = Parcel.obtain();
2979 Parcel reply = Parcel.obtain();
2980 data.writeInterfaceToken(IActivityManager.descriptor);
2981 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
2982 reply.readException();
2983 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
2984 reply.recycle();
2985 data.recycle();
2986 return res;
2987 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002988
2989 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07002990 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002991 {
2992 Parcel data = Parcel.obtain();
2993 Parcel reply = Parcel.obtain();
2994 data.writeInterfaceToken(IActivityManager.descriptor);
2995 data.writeString(process);
2996 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07002997 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08002998 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07002999 if (fd != null) {
3000 data.writeInt(1);
3001 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3002 } else {
3003 data.writeInt(0);
3004 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003005 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3006 reply.readException();
3007 boolean res = reply.readInt() != 0;
3008 reply.recycle();
3009 data.recycle();
3010 return res;
3011 }
3012
Dianne Hackborn55280a92009-05-07 15:53:46 -07003013 public boolean shutdown(int timeout) throws RemoteException
3014 {
3015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 data.writeInt(timeout);
3019 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3020 reply.readException();
3021 boolean res = reply.readInt() != 0;
3022 reply.recycle();
3023 data.recycle();
3024 return res;
3025 }
3026
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003027 public void stopAppSwitches() throws RemoteException {
3028 Parcel data = Parcel.obtain();
3029 Parcel reply = Parcel.obtain();
3030 data.writeInterfaceToken(IActivityManager.descriptor);
3031 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3032 reply.readException();
3033 reply.recycle();
3034 data.recycle();
3035 }
3036
3037 public void resumeAppSwitches() throws RemoteException {
3038 Parcel data = Parcel.obtain();
3039 Parcel reply = Parcel.obtain();
3040 data.writeInterfaceToken(IActivityManager.descriptor);
3041 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3042 reply.readException();
3043 reply.recycle();
3044 data.recycle();
3045 }
3046
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003047 public int startActivityInPackage(int uid,
3048 Intent intent, String resolvedType, IBinder resultTo,
3049 String resultWho, int requestCode, boolean onlyIfNeeded)
3050 throws RemoteException {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 data.writeInt(uid);
3055 intent.writeToParcel(data, 0);
3056 data.writeString(resolvedType);
3057 data.writeStrongBinder(resultTo);
3058 data.writeString(resultWho);
3059 data.writeInt(requestCode);
3060 data.writeInt(onlyIfNeeded ? 1 : 0);
3061 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 int result = reply.readInt();
3064 reply.recycle();
3065 data.recycle();
3066 return result;
3067 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003068
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003069 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 data.writeString(pkg);
3074 data.writeInt(uid);
3075 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3076 reply.readException();
3077 data.recycle();
3078 reply.recycle();
3079 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003080
3081 public void closeSystemDialogs(String reason) throws RemoteException {
3082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
3085 data.writeString(reason);
3086 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3087 reply.readException();
3088 data.recycle();
3089 reply.recycle();
3090 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003091
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003092 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003093 throws RemoteException {
3094 Parcel data = Parcel.obtain();
3095 Parcel reply = Parcel.obtain();
3096 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003097 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003098 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3099 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003100 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003101 data.recycle();
3102 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003103 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003104 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003105
3106 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeString(processName);
3111 data.writeInt(uid);
3112 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3113 reply.readException();
3114 data.recycle();
3115 reply.recycle();
3116 }
3117
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003118 public void overridePendingTransition(IBinder token, String packageName,
3119 int enterAnim, int exitAnim) throws RemoteException {
3120 Parcel data = Parcel.obtain();
3121 Parcel reply = Parcel.obtain();
3122 data.writeInterfaceToken(IActivityManager.descriptor);
3123 data.writeStrongBinder(token);
3124 data.writeString(packageName);
3125 data.writeInt(enterAnim);
3126 data.writeInt(exitAnim);
3127 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3128 reply.readException();
3129 data.recycle();
3130 reply.recycle();
3131 }
3132
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003133 public boolean isUserAMonkey() throws RemoteException {
3134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3138 reply.readException();
3139 boolean res = reply.readInt() != 0;
3140 data.recycle();
3141 reply.recycle();
3142 return res;
3143 }
3144
Dianne Hackborn860755f2010-06-03 18:47:52 -07003145 public void finishHeavyWeightApp() throws RemoteException {
3146 Parcel data = Parcel.obtain();
3147 Parcel reply = Parcel.obtain();
3148 data.writeInterfaceToken(IActivityManager.descriptor);
3149 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3150 reply.readException();
3151 data.recycle();
3152 reply.recycle();
3153 }
3154
Daniel Sandler69a48172010-06-23 16:29:36 -04003155 public void setImmersive(IBinder token, boolean immersive)
3156 throws RemoteException {
3157 Parcel data = Parcel.obtain();
3158 Parcel reply = Parcel.obtain();
3159 data.writeInterfaceToken(IActivityManager.descriptor);
3160 data.writeStrongBinder(token);
3161 data.writeInt(immersive ? 1 : 0);
3162 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 data.recycle();
3165 reply.recycle();
3166 }
3167
3168 public boolean isImmersive(IBinder token)
3169 throws RemoteException {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 data.writeStrongBinder(token);
3174 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003175 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003176 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003177 data.recycle();
3178 reply.recycle();
3179 return res;
3180 }
3181
3182 public boolean isTopActivityImmersive()
3183 throws RemoteException {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003188 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003189 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003190 data.recycle();
3191 reply.recycle();
3192 return res;
3193 }
3194
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003195 public void crashApplication(int uid, int initialPid, String packageName,
3196 String message) throws RemoteException {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 data.writeInt(uid);
3201 data.writeInt(initialPid);
3202 data.writeString(packageName);
3203 data.writeString(message);
3204 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3205 reply.readException();
3206 data.recycle();
3207 reply.recycle();
3208 }
Andy McFadden824c5102010-07-09 16:26:57 -07003209
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003210 public String getProviderMimeType(Uri uri)
3211 throws RemoteException {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 uri.writeToParcel(data, 0);
3216 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 String res = reply.readString();
3219 data.recycle();
3220 reply.recycle();
3221 return res;
3222 }
3223
Dianne Hackborn7e269642010-08-25 19:50:20 -07003224 public IBinder newUriPermissionOwner(String name)
3225 throws RemoteException {
3226 Parcel data = Parcel.obtain();
3227 Parcel reply = Parcel.obtain();
3228 data.writeInterfaceToken(IActivityManager.descriptor);
3229 data.writeString(name);
3230 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3231 reply.readException();
3232 IBinder res = reply.readStrongBinder();
3233 data.recycle();
3234 reply.recycle();
3235 return res;
3236 }
3237
3238 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3239 Uri uri, int mode) throws RemoteException {
3240 Parcel data = Parcel.obtain();
3241 Parcel reply = Parcel.obtain();
3242 data.writeInterfaceToken(IActivityManager.descriptor);
3243 data.writeStrongBinder(owner);
3244 data.writeInt(fromUid);
3245 data.writeString(targetPkg);
3246 uri.writeToParcel(data, 0);
3247 data.writeInt(mode);
3248 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3249 reply.readException();
3250 data.recycle();
3251 reply.recycle();
3252 }
3253
3254 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3255 int mode) throws RemoteException {
3256 Parcel data = Parcel.obtain();
3257 Parcel reply = Parcel.obtain();
3258 data.writeInterfaceToken(IActivityManager.descriptor);
3259 data.writeStrongBinder(owner);
3260 if (uri != null) {
3261 data.writeInt(1);
3262 uri.writeToParcel(data, 0);
3263 } else {
3264 data.writeInt(0);
3265 }
3266 data.writeInt(mode);
3267 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3268 reply.readException();
3269 data.recycle();
3270 reply.recycle();
3271 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003272
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003273 public int checkGrantUriPermission(int callingUid, String targetPkg,
3274 Uri uri, int modeFlags) throws RemoteException {
3275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeInt(callingUid);
3279 data.writeString(targetPkg);
3280 uri.writeToParcel(data, 0);
3281 data.writeInt(modeFlags);
3282 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3283 reply.readException();
3284 int res = reply.readInt();
3285 data.recycle();
3286 reply.recycle();
3287 return res;
3288 }
3289
Andy McFadden824c5102010-07-09 16:26:57 -07003290 public boolean dumpHeap(String process, boolean managed,
3291 String path, ParcelFileDescriptor fd) throws RemoteException {
3292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeString(process);
3296 data.writeInt(managed ? 1 : 0);
3297 data.writeString(path);
3298 if (fd != null) {
3299 data.writeInt(1);
3300 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3301 } else {
3302 data.writeInt(0);
3303 }
3304 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3305 reply.readException();
3306 boolean res = reply.readInt() != 0;
3307 reply.recycle();
3308 data.recycle();
3309 return res;
3310 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003311
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003312 public int startActivities(IApplicationThread caller,
3313 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3318 data.writeTypedArray(intents, 0);
3319 data.writeStringArray(resolvedTypes);
3320 data.writeStrongBinder(resultTo);
3321 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 int result = reply.readInt();
3324 reply.recycle();
3325 data.recycle();
3326 return result;
3327 }
3328
3329 public int startActivitiesInPackage(int uid,
3330 Intent[] intents, String[] resolvedTypes, IBinder resultTo) throws RemoteException {
3331 Parcel data = Parcel.obtain();
3332 Parcel reply = Parcel.obtain();
3333 data.writeInterfaceToken(IActivityManager.descriptor);
3334 data.writeInt(uid);
3335 data.writeTypedArray(intents, 0);
3336 data.writeStringArray(resolvedTypes);
3337 data.writeStrongBinder(resultTo);
3338 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3339 reply.readException();
3340 int result = reply.readInt();
3341 reply.recycle();
3342 data.recycle();
3343 return result;
3344 }
3345
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003346 public int getFrontActivityScreenCompatMode() throws RemoteException {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 int mode = reply.readInt();
3353 reply.recycle();
3354 data.recycle();
3355 return mode;
3356 }
3357
3358 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 data.writeInt(mode);
3363 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 reply.recycle();
3366 data.recycle();
3367 }
3368
3369 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003373 data.writeString(packageName);
3374 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003375 reply.readException();
3376 int mode = reply.readInt();
3377 reply.recycle();
3378 data.recycle();
3379 return mode;
3380 }
3381
3382 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003383 throws RemoteException {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003388 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003389 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 reply.recycle();
3392 data.recycle();
3393 }
3394
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003395 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeString(packageName);
3400 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3401 reply.readException();
3402 boolean ask = reply.readInt() != 0;
3403 reply.recycle();
3404 data.recycle();
3405 return ask;
3406 }
3407
3408 public void setPackageAskScreenCompat(String packageName, boolean ask)
3409 throws RemoteException {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeString(packageName);
3414 data.writeInt(ask ? 1 : 0);
3415 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3416 reply.readException();
3417 reply.recycle();
3418 data.recycle();
3419 }
3420
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003421 public boolean switchUser(int userid) throws RemoteException {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 data.writeInt(userid);
3426 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 boolean result = reply.readInt() != 0;
3429 reply.recycle();
3430 data.recycle();
3431 return result;
3432 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003433
3434 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeInt(taskId);
3439 data.writeInt(subTaskIndex);
3440 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3441 reply.readException();
3442 boolean result = reply.readInt() != 0;
3443 reply.recycle();
3444 data.recycle();
3445 return result;
3446 }
3447
3448 public boolean removeTask(int taskId, int flags) throws RemoteException {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 data.writeInt(taskId);
3453 data.writeInt(flags);
3454 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 boolean result = reply.readInt() != 0;
3457 reply.recycle();
3458 data.recycle();
3459 return result;
3460 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003461
Jeff Sharkeya4620792011-05-20 15:29:23 -07003462 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3467 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 data.recycle();
3470 reply.recycle();
3471 }
3472
3473 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3474 Parcel data = Parcel.obtain();
3475 Parcel reply = Parcel.obtain();
3476 data.writeInterfaceToken(IActivityManager.descriptor);
3477 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3478 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3479 reply.readException();
3480 data.recycle();
3481 reply.recycle();
3482 }
3483
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003484 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3485 Parcel data = Parcel.obtain();
3486 Parcel reply = Parcel.obtain();
3487 data.writeInterfaceToken(IActivityManager.descriptor);
3488 data.writeStrongBinder(sender.asBinder());
3489 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3490 reply.readException();
3491 boolean res = reply.readInt() != 0;
3492 data.recycle();
3493 reply.recycle();
3494 return res;
3495 }
3496
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003497 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3498 {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 values.writeToParcel(data, 0);
3503 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3504 reply.readException();
3505 data.recycle();
3506 reply.recycle();
3507 }
3508
Dianne Hackbornb437e092011-08-05 17:50:29 -07003509 public long[] getProcessPss(int[] pids) throws RemoteException {
3510 Parcel data = Parcel.obtain();
3511 Parcel reply = Parcel.obtain();
3512 data.writeInterfaceToken(IActivityManager.descriptor);
3513 data.writeIntArray(pids);
3514 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3515 reply.readException();
3516 long[] res = reply.createLongArray();
3517 data.recycle();
3518 reply.recycle();
3519 return res;
3520 }
3521
Dianne Hackborn661cd522011-08-22 00:26:20 -07003522 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 TextUtils.writeToParcel(msg, data, 0);
3527 data.writeInt(always ? 1 : 0);
3528 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3529 reply.readException();
3530 data.recycle();
3531 reply.recycle();
3532 }
3533
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003534 public void dismissKeyguardOnNextActivity() throws RemoteException {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3539 reply.readException();
3540 data.recycle();
3541 reply.recycle();
3542 }
3543
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003544 private IBinder mRemote;
3545}