blob: a3cc352f75d55ace4c8acb8c6e1a585f93e8aa67 [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();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800121 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700123 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700124 String profileFile = data.readString();
125 ParcelFileDescriptor profileFd = data.readInt() != 0
126 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700127 Bundle options = data.readInt() != 0
128 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 int result = startActivity(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700130 resultTo, resultWho, requestCode, startFlags,
131 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 reply.writeNoException();
133 reply.writeInt(result);
134 return true;
135 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700136
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800137 case START_ACTIVITY_AND_WAIT_TRANSACTION:
138 {
139 data.enforceInterface(IActivityManager.descriptor);
140 IBinder b = data.readStrongBinder();
141 IApplicationThread app = ApplicationThreadNative.asInterface(b);
142 Intent intent = Intent.CREATOR.createFromParcel(data);
143 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800144 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800145 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800146 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700147 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700148 String profileFile = data.readString();
149 ParcelFileDescriptor profileFd = data.readInt() != 0
150 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700151 Bundle options = data.readInt() != 0
152 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800153 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700154 resultTo, resultWho, requestCode, startFlags,
155 profileFile, profileFd, options);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800156 reply.writeNoException();
157 result.writeToParcel(reply, 0);
158 return true;
159 }
160
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700161 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
162 {
163 data.enforceInterface(IActivityManager.descriptor);
164 IBinder b = data.readStrongBinder();
165 IApplicationThread app = ApplicationThreadNative.asInterface(b);
166 Intent intent = Intent.CREATOR.createFromParcel(data);
167 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700168 IBinder resultTo = data.readStrongBinder();
169 String resultWho = data.readString();
170 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700171 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700172 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700173 Bundle options = data.readInt() != 0
174 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700175 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700176 resultTo, resultWho, requestCode, startFlags, config, options);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700177 reply.writeNoException();
178 reply.writeInt(result);
179 return true;
180 }
181
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700182 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700183 {
184 data.enforceInterface(IActivityManager.descriptor);
185 IBinder b = data.readStrongBinder();
186 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700187 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700188 Intent fillInIntent = null;
189 if (data.readInt() != 0) {
190 fillInIntent = Intent.CREATOR.createFromParcel(data);
191 }
192 String resolvedType = data.readString();
193 IBinder resultTo = data.readStrongBinder();
194 String resultWho = data.readString();
195 int requestCode = data.readInt();
196 int flagsMask = data.readInt();
197 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700198 Bundle options = data.readInt() != 0
199 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700200 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700201 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700202 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700203 reply.writeNoException();
204 reply.writeInt(result);
205 return true;
206 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800207
208 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
209 {
210 data.enforceInterface(IActivityManager.descriptor);
211 IBinder callingActivity = data.readStrongBinder();
212 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700213 Bundle options = data.readInt() != 0
214 ? Bundle.CREATOR.createFromParcel(data) : null;
215 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800216 reply.writeNoException();
217 reply.writeInt(result ? 1 : 0);
218 return true;
219 }
220
221 case FINISH_ACTIVITY_TRANSACTION: {
222 data.enforceInterface(IActivityManager.descriptor);
223 IBinder token = data.readStrongBinder();
224 Intent resultData = null;
225 int resultCode = data.readInt();
226 if (data.readInt() != 0) {
227 resultData = Intent.CREATOR.createFromParcel(data);
228 }
229 boolean res = finishActivity(token, resultCode, resultData);
230 reply.writeNoException();
231 reply.writeInt(res ? 1 : 0);
232 return true;
233 }
234
235 case FINISH_SUB_ACTIVITY_TRANSACTION: {
236 data.enforceInterface(IActivityManager.descriptor);
237 IBinder token = data.readStrongBinder();
238 String resultWho = data.readString();
239 int requestCode = data.readInt();
240 finishSubActivity(token, resultWho, requestCode);
241 reply.writeNoException();
242 return true;
243 }
244
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800245 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
246 data.enforceInterface(IActivityManager.descriptor);
247 IBinder token = data.readStrongBinder();
248 boolean res = willActivityBeVisible(token);
249 reply.writeNoException();
250 reply.writeInt(res ? 1 : 0);
251 return true;
252 }
253
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800254 case REGISTER_RECEIVER_TRANSACTION:
255 {
256 data.enforceInterface(IActivityManager.descriptor);
257 IBinder b = data.readStrongBinder();
258 IApplicationThread app =
259 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700260 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800261 b = data.readStrongBinder();
262 IIntentReceiver rec
263 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
264 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
265 String perm = data.readString();
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700266 Intent intent = registerReceiver(app, packageName, rec, filter, perm);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800267 reply.writeNoException();
268 if (intent != null) {
269 reply.writeInt(1);
270 intent.writeToParcel(reply, 0);
271 } else {
272 reply.writeInt(0);
273 }
274 return true;
275 }
276
277 case UNREGISTER_RECEIVER_TRANSACTION:
278 {
279 data.enforceInterface(IActivityManager.descriptor);
280 IBinder b = data.readStrongBinder();
281 if (b == null) {
282 return true;
283 }
284 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
285 unregisterReceiver(rec);
286 reply.writeNoException();
287 return true;
288 }
289
290 case BROADCAST_INTENT_TRANSACTION:
291 {
292 data.enforceInterface(IActivityManager.descriptor);
293 IBinder b = data.readStrongBinder();
294 IApplicationThread app =
295 b != null ? ApplicationThreadNative.asInterface(b) : null;
296 Intent intent = Intent.CREATOR.createFromParcel(data);
297 String resolvedType = data.readString();
298 b = data.readStrongBinder();
299 IIntentReceiver resultTo =
300 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
301 int resultCode = data.readInt();
302 String resultData = data.readString();
303 Bundle resultExtras = data.readBundle();
304 String perm = data.readString();
305 boolean serialized = data.readInt() != 0;
306 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700307 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800308 int res = broadcastIntent(app, intent, resolvedType, resultTo,
309 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700310 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800311 reply.writeNoException();
312 reply.writeInt(res);
313 return true;
314 }
315
316 case UNBROADCAST_INTENT_TRANSACTION:
317 {
318 data.enforceInterface(IActivityManager.descriptor);
319 IBinder b = data.readStrongBinder();
320 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
321 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700322 int userId = data.readInt();
323 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800324 reply.writeNoException();
325 return true;
326 }
327
328 case FINISH_RECEIVER_TRANSACTION: {
329 data.enforceInterface(IActivityManager.descriptor);
330 IBinder who = data.readStrongBinder();
331 int resultCode = data.readInt();
332 String resultData = data.readString();
333 Bundle resultExtras = data.readBundle();
334 boolean resultAbort = data.readInt() != 0;
335 if (who != null) {
336 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
337 }
338 reply.writeNoException();
339 return true;
340 }
341
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800342 case ATTACH_APPLICATION_TRANSACTION: {
343 data.enforceInterface(IActivityManager.descriptor);
344 IApplicationThread app = ApplicationThreadNative.asInterface(
345 data.readStrongBinder());
346 if (app != null) {
347 attachApplication(app);
348 }
349 reply.writeNoException();
350 return true;
351 }
352
353 case ACTIVITY_IDLE_TRANSACTION: {
354 data.enforceInterface(IActivityManager.descriptor);
355 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700356 Configuration config = null;
357 if (data.readInt() != 0) {
358 config = Configuration.CREATOR.createFromParcel(data);
359 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700360 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700362 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 }
364 reply.writeNoException();
365 return true;
366 }
367
368 case ACTIVITY_PAUSED_TRANSACTION: {
369 data.enforceInterface(IActivityManager.descriptor);
370 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800371 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 reply.writeNoException();
373 return true;
374 }
375
376 case ACTIVITY_STOPPED_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800379 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800380 Bitmap thumbnail = data.readInt() != 0
381 ? Bitmap.CREATOR.createFromParcel(data) : null;
382 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800383 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 reply.writeNoException();
385 return true;
386 }
387
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800388 case ACTIVITY_SLEPT_TRANSACTION: {
389 data.enforceInterface(IActivityManager.descriptor);
390 IBinder token = data.readStrongBinder();
391 activitySlept(token);
392 reply.writeNoException();
393 return true;
394 }
395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 case ACTIVITY_DESTROYED_TRANSACTION: {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder token = data.readStrongBinder();
399 activityDestroyed(token);
400 reply.writeNoException();
401 return true;
402 }
403
404 case GET_CALLING_PACKAGE_TRANSACTION: {
405 data.enforceInterface(IActivityManager.descriptor);
406 IBinder token = data.readStrongBinder();
407 String res = token != null ? getCallingPackage(token) : null;
408 reply.writeNoException();
409 reply.writeString(res);
410 return true;
411 }
412
413 case GET_CALLING_ACTIVITY_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder token = data.readStrongBinder();
416 ComponentName cn = getCallingActivity(token);
417 reply.writeNoException();
418 ComponentName.writeToParcel(cn, reply);
419 return true;
420 }
421
422 case GET_TASKS_TRANSACTION: {
423 data.enforceInterface(IActivityManager.descriptor);
424 int maxNum = data.readInt();
425 int fl = data.readInt();
426 IBinder receiverBinder = data.readStrongBinder();
427 IThumbnailReceiver receiver = receiverBinder != null
428 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
429 : null;
430 List list = getTasks(maxNum, fl, receiver);
431 reply.writeNoException();
432 int N = list != null ? list.size() : -1;
433 reply.writeInt(N);
434 int i;
435 for (i=0; i<N; i++) {
436 ActivityManager.RunningTaskInfo info =
437 (ActivityManager.RunningTaskInfo)list.get(i);
438 info.writeToParcel(reply, 0);
439 }
440 return true;
441 }
442
443 case GET_RECENT_TASKS_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 int maxNum = data.readInt();
446 int fl = data.readInt();
447 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
448 fl);
449 reply.writeNoException();
450 reply.writeTypedList(list);
451 return true;
452 }
453
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700454 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800455 data.enforceInterface(IActivityManager.descriptor);
456 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700457 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800458 reply.writeNoException();
459 if (bm != null) {
460 reply.writeInt(1);
461 bm.writeToParcel(reply, 0);
462 } else {
463 reply.writeInt(0);
464 }
465 return true;
466 }
467
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 case GET_SERVICES_TRANSACTION: {
469 data.enforceInterface(IActivityManager.descriptor);
470 int maxNum = data.readInt();
471 int fl = data.readInt();
472 List list = getServices(maxNum, fl);
473 reply.writeNoException();
474 int N = list != null ? list.size() : -1;
475 reply.writeInt(N);
476 int i;
477 for (i=0; i<N; i++) {
478 ActivityManager.RunningServiceInfo info =
479 (ActivityManager.RunningServiceInfo)list.get(i);
480 info.writeToParcel(reply, 0);
481 }
482 return true;
483 }
484
485 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
486 data.enforceInterface(IActivityManager.descriptor);
487 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
488 reply.writeNoException();
489 reply.writeTypedList(list);
490 return true;
491 }
492
493 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
494 data.enforceInterface(IActivityManager.descriptor);
495 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
496 reply.writeNoException();
497 reply.writeTypedList(list);
498 return true;
499 }
500
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700501 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
502 data.enforceInterface(IActivityManager.descriptor);
503 List<ApplicationInfo> list = getRunningExternalApplications();
504 reply.writeNoException();
505 reply.writeTypedList(list);
506 return true;
507 }
508
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800509 case MOVE_TASK_TO_FRONT_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800512 int fl = data.readInt();
513 moveTaskToFront(task, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800514 reply.writeNoException();
515 return true;
516 }
517
518 case MOVE_TASK_TO_BACK_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 int task = data.readInt();
521 moveTaskToBack(task);
522 reply.writeNoException();
523 return true;
524 }
525
526 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
527 data.enforceInterface(IActivityManager.descriptor);
528 IBinder token = data.readStrongBinder();
529 boolean nonRoot = data.readInt() != 0;
530 boolean res = moveActivityTaskToBack(token, nonRoot);
531 reply.writeNoException();
532 reply.writeInt(res ? 1 : 0);
533 return true;
534 }
535
536 case MOVE_TASK_BACKWARDS_TRANSACTION: {
537 data.enforceInterface(IActivityManager.descriptor);
538 int task = data.readInt();
539 moveTaskBackwards(task);
540 reply.writeNoException();
541 return true;
542 }
543
544 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
545 data.enforceInterface(IActivityManager.descriptor);
546 IBinder token = data.readStrongBinder();
547 boolean onlyRoot = data.readInt() != 0;
548 int res = token != null
549 ? getTaskForActivity(token, onlyRoot) : -1;
550 reply.writeNoException();
551 reply.writeInt(res);
552 return true;
553 }
554
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555 case REPORT_THUMBNAIL_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 IBinder token = data.readStrongBinder();
558 Bitmap thumbnail = data.readInt() != 0
559 ? Bitmap.CREATOR.createFromParcel(data) : null;
560 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
561 reportThumbnail(token, thumbnail, description);
562 reply.writeNoException();
563 return true;
564 }
565
566 case GET_CONTENT_PROVIDER_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder b = data.readStrongBinder();
569 IApplicationThread app = ApplicationThreadNative.asInterface(b);
570 String name = data.readString();
571 ContentProviderHolder cph = getContentProvider(app, name);
572 reply.writeNoException();
573 if (cph != null) {
574 reply.writeInt(1);
575 cph.writeToParcel(reply, 0);
576 } else {
577 reply.writeInt(0);
578 }
579 return true;
580 }
581
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800582 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
583 data.enforceInterface(IActivityManager.descriptor);
584 String name = data.readString();
585 IBinder token = data.readStrongBinder();
586 ContentProviderHolder cph = getContentProviderExternal(name, token);
587 reply.writeNoException();
588 if (cph != null) {
589 reply.writeInt(1);
590 cph.writeToParcel(reply, 0);
591 } else {
592 reply.writeInt(0);
593 }
594 return true;
595 }
596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 IBinder b = data.readStrongBinder();
600 IApplicationThread app = ApplicationThreadNative.asInterface(b);
601 ArrayList<ContentProviderHolder> providers =
602 data.createTypedArrayList(ContentProviderHolder.CREATOR);
603 publishContentProviders(app, providers);
604 reply.writeNoException();
605 return true;
606 }
607
608 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
609 data.enforceInterface(IActivityManager.descriptor);
610 IBinder b = data.readStrongBinder();
611 IApplicationThread app = ApplicationThreadNative.asInterface(b);
612 String name = data.readString();
613 removeContentProvider(app, name);
614 reply.writeNoException();
615 return true;
616 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800617
618 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
619 data.enforceInterface(IActivityManager.descriptor);
620 String name = data.readString();
621 IBinder token = data.readStrongBinder();
622 removeContentProviderExternal(name, token);
623 reply.writeNoException();
624 return true;
625 }
626
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700627 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
628 data.enforceInterface(IActivityManager.descriptor);
629 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
630 PendingIntent pi = getRunningServiceControlPanel(comp);
631 reply.writeNoException();
632 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
633 return true;
634 }
635
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800636 case START_SERVICE_TRANSACTION: {
637 data.enforceInterface(IActivityManager.descriptor);
638 IBinder b = data.readStrongBinder();
639 IApplicationThread app = ApplicationThreadNative.asInterface(b);
640 Intent service = Intent.CREATOR.createFromParcel(data);
641 String resolvedType = data.readString();
642 ComponentName cn = startService(app, service, resolvedType);
643 reply.writeNoException();
644 ComponentName.writeToParcel(cn, reply);
645 return true;
646 }
647
648 case STOP_SERVICE_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 IBinder b = data.readStrongBinder();
651 IApplicationThread app = ApplicationThreadNative.asInterface(b);
652 Intent service = Intent.CREATOR.createFromParcel(data);
653 String resolvedType = data.readString();
654 int res = stopService(app, service, resolvedType);
655 reply.writeNoException();
656 reply.writeInt(res);
657 return true;
658 }
659
660 case STOP_SERVICE_TOKEN_TRANSACTION: {
661 data.enforceInterface(IActivityManager.descriptor);
662 ComponentName className = ComponentName.readFromParcel(data);
663 IBinder token = data.readStrongBinder();
664 int startId = data.readInt();
665 boolean res = stopServiceToken(className, token, startId);
666 reply.writeNoException();
667 reply.writeInt(res ? 1 : 0);
668 return true;
669 }
670
671 case SET_SERVICE_FOREGROUND_TRANSACTION: {
672 data.enforceInterface(IActivityManager.descriptor);
673 ComponentName className = ComponentName.readFromParcel(data);
674 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700675 int id = data.readInt();
676 Notification notification = null;
677 if (data.readInt() != 0) {
678 notification = Notification.CREATOR.createFromParcel(data);
679 }
680 boolean removeNotification = data.readInt() != 0;
681 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 reply.writeNoException();
683 return true;
684 }
685
686 case BIND_SERVICE_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 IBinder b = data.readStrongBinder();
689 IApplicationThread app = ApplicationThreadNative.asInterface(b);
690 IBinder token = data.readStrongBinder();
691 Intent service = Intent.CREATOR.createFromParcel(data);
692 String resolvedType = data.readString();
693 b = data.readStrongBinder();
694 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800695 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800697 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 reply.writeNoException();
699 reply.writeInt(res);
700 return true;
701 }
702
703 case UNBIND_SERVICE_TRANSACTION: {
704 data.enforceInterface(IActivityManager.descriptor);
705 IBinder b = data.readStrongBinder();
706 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
707 boolean res = unbindService(conn);
708 reply.writeNoException();
709 reply.writeInt(res ? 1 : 0);
710 return true;
711 }
712
713 case PUBLISH_SERVICE_TRANSACTION: {
714 data.enforceInterface(IActivityManager.descriptor);
715 IBinder token = data.readStrongBinder();
716 Intent intent = Intent.CREATOR.createFromParcel(data);
717 IBinder service = data.readStrongBinder();
718 publishService(token, intent, service);
719 reply.writeNoException();
720 return true;
721 }
722
723 case UNBIND_FINISHED_TRANSACTION: {
724 data.enforceInterface(IActivityManager.descriptor);
725 IBinder token = data.readStrongBinder();
726 Intent intent = Intent.CREATOR.createFromParcel(data);
727 boolean doRebind = data.readInt() != 0;
728 unbindFinished(token, intent, doRebind);
729 reply.writeNoException();
730 return true;
731 }
732
733 case SERVICE_DONE_EXECUTING_TRANSACTION: {
734 data.enforceInterface(IActivityManager.descriptor);
735 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700736 int type = data.readInt();
737 int startId = data.readInt();
738 int res = data.readInt();
739 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800740 reply.writeNoException();
741 return true;
742 }
743
744 case START_INSTRUMENTATION_TRANSACTION: {
745 data.enforceInterface(IActivityManager.descriptor);
746 ComponentName className = ComponentName.readFromParcel(data);
747 String profileFile = data.readString();
748 int fl = data.readInt();
749 Bundle arguments = data.readBundle();
750 IBinder b = data.readStrongBinder();
751 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
752 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
753 reply.writeNoException();
754 reply.writeInt(res ? 1 : 0);
755 return true;
756 }
757
758
759 case FINISH_INSTRUMENTATION_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 IBinder b = data.readStrongBinder();
762 IApplicationThread app = ApplicationThreadNative.asInterface(b);
763 int resultCode = data.readInt();
764 Bundle results = data.readBundle();
765 finishInstrumentation(app, resultCode, results);
766 reply.writeNoException();
767 return true;
768 }
769
770 case GET_CONFIGURATION_TRANSACTION: {
771 data.enforceInterface(IActivityManager.descriptor);
772 Configuration config = getConfiguration();
773 reply.writeNoException();
774 config.writeToParcel(reply, 0);
775 return true;
776 }
777
778 case UPDATE_CONFIGURATION_TRANSACTION: {
779 data.enforceInterface(IActivityManager.descriptor);
780 Configuration config = Configuration.CREATOR.createFromParcel(data);
781 updateConfiguration(config);
782 reply.writeNoException();
783 return true;
784 }
785
786 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder token = data.readStrongBinder();
789 int requestedOrientation = data.readInt();
790 setRequestedOrientation(token, requestedOrientation);
791 reply.writeNoException();
792 return true;
793 }
794
795 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
796 data.enforceInterface(IActivityManager.descriptor);
797 IBinder token = data.readStrongBinder();
798 int req = getRequestedOrientation(token);
799 reply.writeNoException();
800 reply.writeInt(req);
801 return true;
802 }
803
804 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
805 data.enforceInterface(IActivityManager.descriptor);
806 IBinder token = data.readStrongBinder();
807 ComponentName cn = getActivityClassForToken(token);
808 reply.writeNoException();
809 ComponentName.writeToParcel(cn, reply);
810 return true;
811 }
812
813 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
814 data.enforceInterface(IActivityManager.descriptor);
815 IBinder token = data.readStrongBinder();
816 reply.writeNoException();
817 reply.writeString(getPackageForToken(token));
818 return true;
819 }
820
821 case GET_INTENT_SENDER_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 int type = data.readInt();
824 String packageName = data.readString();
825 IBinder token = data.readStrongBinder();
826 String resultWho = data.readString();
827 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800828 Intent[] requestIntents;
829 String[] requestResolvedTypes;
830 if (data.readInt() != 0) {
831 requestIntents = data.createTypedArray(Intent.CREATOR);
832 requestResolvedTypes = data.createStringArray();
833 } else {
834 requestIntents = null;
835 requestResolvedTypes = null;
836 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800837 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700838 Bundle options = data.readInt() != 0
839 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800840 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800841 resultWho, requestCode, requestIntents,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700842 requestResolvedTypes, fl, options);
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 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001129
1130 case GET_MY_MEMORY_STATE_TRANSACTION: {
1131 data.enforceInterface(IActivityManager.descriptor);
1132 ActivityManager.RunningAppProcessInfo info =
1133 new ActivityManager.RunningAppProcessInfo();
1134 getMyMemoryState(info);
1135 reply.writeNoException();
1136 info.writeToParcel(reply, 0);
1137 return true;
1138 }
1139
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001140 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1141 data.enforceInterface(IActivityManager.descriptor);
1142 ConfigurationInfo config = getDeviceConfigurationInfo();
1143 reply.writeNoException();
1144 config.writeToParcel(reply, 0);
1145 return true;
1146 }
1147
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001148 case PROFILE_CONTROL_TRANSACTION: {
1149 data.enforceInterface(IActivityManager.descriptor);
1150 String process = data.readString();
1151 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001152 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001153 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001154 ParcelFileDescriptor fd = data.readInt() != 0
1155 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001156 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001157 reply.writeNoException();
1158 reply.writeInt(res ? 1 : 0);
1159 return true;
1160 }
1161
Dianne Hackborn55280a92009-05-07 15:53:46 -07001162 case SHUTDOWN_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 boolean res = shutdown(data.readInt());
1165 reply.writeNoException();
1166 reply.writeInt(res ? 1 : 0);
1167 return true;
1168 }
1169
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001170 case STOP_APP_SWITCHES_TRANSACTION: {
1171 data.enforceInterface(IActivityManager.descriptor);
1172 stopAppSwitches();
1173 reply.writeNoException();
1174 return true;
1175 }
1176
1177 case RESUME_APP_SWITCHES_TRANSACTION: {
1178 data.enforceInterface(IActivityManager.descriptor);
1179 resumeAppSwitches();
1180 reply.writeNoException();
1181 return true;
1182 }
1183
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001184 case PEEK_SERVICE_TRANSACTION: {
1185 data.enforceInterface(IActivityManager.descriptor);
1186 Intent service = Intent.CREATOR.createFromParcel(data);
1187 String resolvedType = data.readString();
1188 IBinder binder = peekService(service, resolvedType);
1189 reply.writeNoException();
1190 reply.writeStrongBinder(binder);
1191 return true;
1192 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001193
1194 case START_BACKUP_AGENT_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1197 int backupRestoreMode = data.readInt();
1198 boolean success = bindBackupAgent(info, backupRestoreMode);
1199 reply.writeNoException();
1200 reply.writeInt(success ? 1 : 0);
1201 return true;
1202 }
1203
1204 case BACKUP_AGENT_CREATED_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 String packageName = data.readString();
1207 IBinder agent = data.readStrongBinder();
1208 backupAgentCreated(packageName, agent);
1209 reply.writeNoException();
1210 return true;
1211 }
1212
1213 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1216 unbindBackupAgent(info);
1217 reply.writeNoException();
1218 return true;
1219 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001220
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001221 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1222 {
1223 data.enforceInterface(IActivityManager.descriptor);
1224 int uid = data.readInt();
1225 Intent intent = Intent.CREATOR.createFromParcel(data);
1226 String resolvedType = data.readString();
1227 IBinder resultTo = data.readStrongBinder();
1228 String resultWho = data.readString();
1229 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001230 int startFlags = data.readInt();
1231 Bundle options = data.readInt() != 0
1232 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001233 int result = startActivityInPackage(uid, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001234 resultTo, resultWho, requestCode, startFlags, options);
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001235 reply.writeNoException();
1236 reply.writeInt(result);
1237 return true;
1238 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001239
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001240 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1241 data.enforceInterface(IActivityManager.descriptor);
1242 String pkg = data.readString();
1243 int uid = data.readInt();
1244 killApplicationWithUid(pkg, uid);
1245 reply.writeNoException();
1246 return true;
1247 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001248
1249 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 String reason = data.readString();
1252 closeSystemDialogs(reason);
1253 reply.writeNoException();
1254 return true;
1255 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001256
1257 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001259 int[] pids = data.createIntArray();
1260 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001261 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001262 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001263 return true;
1264 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001265
1266 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1267 data.enforceInterface(IActivityManager.descriptor);
1268 String processName = data.readString();
1269 int uid = data.readInt();
1270 killApplicationProcess(processName, uid);
1271 reply.writeNoException();
1272 return true;
1273 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001274
1275 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1276 data.enforceInterface(IActivityManager.descriptor);
1277 IBinder token = data.readStrongBinder();
1278 String packageName = data.readString();
1279 int enterAnim = data.readInt();
1280 int exitAnim = data.readInt();
1281 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001282 reply.writeNoException();
1283 return true;
1284 }
1285
1286 case IS_USER_A_MONKEY_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001288 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001289 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001290 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001291 return true;
1292 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001293
1294 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 finishHeavyWeightApp();
1297 reply.writeNoException();
1298 return true;
1299 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001300
1301 case IS_IMMERSIVE_TRANSACTION: {
1302 data.enforceInterface(IActivityManager.descriptor);
1303 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001304 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001305 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001306 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001307 return true;
1308 }
1309
1310 case SET_IMMERSIVE_TRANSACTION: {
1311 data.enforceInterface(IActivityManager.descriptor);
1312 IBinder token = data.readStrongBinder();
1313 boolean imm = data.readInt() == 1;
1314 setImmersive(token, imm);
1315 reply.writeNoException();
1316 return true;
1317 }
1318
1319 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001321 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001322 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001323 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001324 return true;
1325 }
1326
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001327 case CRASH_APPLICATION_TRANSACTION: {
1328 data.enforceInterface(IActivityManager.descriptor);
1329 int uid = data.readInt();
1330 int initialPid = data.readInt();
1331 String packageName = data.readString();
1332 String message = data.readString();
1333 crashApplication(uid, initialPid, packageName, message);
1334 reply.writeNoException();
1335 return true;
1336 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001337
1338 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 Uri uri = Uri.CREATOR.createFromParcel(data);
1341 String type = getProviderMimeType(uri);
1342 reply.writeNoException();
1343 reply.writeString(type);
1344 return true;
1345 }
1346
Dianne Hackborn7e269642010-08-25 19:50:20 -07001347 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 String name = data.readString();
1350 IBinder perm = newUriPermissionOwner(name);
1351 reply.writeNoException();
1352 reply.writeStrongBinder(perm);
1353 return true;
1354 }
1355
1356 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1357 data.enforceInterface(IActivityManager.descriptor);
1358 IBinder owner = data.readStrongBinder();
1359 int fromUid = data.readInt();
1360 String targetPkg = data.readString();
1361 Uri uri = Uri.CREATOR.createFromParcel(data);
1362 int mode = data.readInt();
1363 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1364 reply.writeNoException();
1365 return true;
1366 }
1367
1368 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1369 data.enforceInterface(IActivityManager.descriptor);
1370 IBinder owner = data.readStrongBinder();
1371 Uri uri = null;
1372 if (data.readInt() != 0) {
1373 Uri.CREATOR.createFromParcel(data);
1374 }
1375 int mode = data.readInt();
1376 revokeUriPermissionFromOwner(owner, uri, mode);
1377 reply.writeNoException();
1378 return true;
1379 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001380
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001381 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 int callingUid = data.readInt();
1384 String targetPkg = data.readString();
1385 Uri uri = Uri.CREATOR.createFromParcel(data);
1386 int modeFlags = data.readInt();
1387 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1388 reply.writeNoException();
1389 reply.writeInt(res);
1390 return true;
1391 }
1392
Andy McFadden824c5102010-07-09 16:26:57 -07001393 case DUMP_HEAP_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 String process = data.readString();
1396 boolean managed = data.readInt() != 0;
1397 String path = data.readString();
1398 ParcelFileDescriptor fd = data.readInt() != 0
1399 ? data.readFileDescriptor() : null;
1400 boolean res = dumpHeap(process, managed, path, fd);
1401 reply.writeNoException();
1402 reply.writeInt(res ? 1 : 0);
1403 return true;
1404 }
1405
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001406 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1407 {
1408 data.enforceInterface(IActivityManager.descriptor);
1409 int uid = data.readInt();
1410 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1411 String[] resolvedTypes = data.createStringArray();
1412 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001413 Bundle options = data.readInt() != 0
1414 ? Bundle.CREATOR.createFromParcel(data) : null;
1415 int result = startActivitiesInPackage(uid, intents, resolvedTypes,
1416 resultTo, options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001417 reply.writeNoException();
1418 reply.writeInt(result);
1419 return true;
1420 }
1421
1422 case START_ACTIVITIES_TRANSACTION:
1423 {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 IBinder b = data.readStrongBinder();
1426 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1427 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1428 String[] resolvedTypes = data.createStringArray();
1429 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001430 Bundle options = data.readInt() != 0
1431 ? Bundle.CREATOR.createFromParcel(data) : null;
1432 int result = startActivities(app, intents, resolvedTypes, resultTo,
1433 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001434 reply.writeNoException();
1435 reply.writeInt(result);
1436 return true;
1437 }
1438
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001439 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1440 {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 int mode = getFrontActivityScreenCompatMode();
1443 reply.writeNoException();
1444 reply.writeInt(mode);
1445 return true;
1446 }
1447
1448 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1449 {
1450 data.enforceInterface(IActivityManager.descriptor);
1451 int mode = data.readInt();
1452 setFrontActivityScreenCompatMode(mode);
1453 reply.writeNoException();
1454 reply.writeInt(mode);
1455 return true;
1456 }
1457
1458 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1459 {
1460 data.enforceInterface(IActivityManager.descriptor);
1461 String pkg = data.readString();
1462 int mode = getPackageScreenCompatMode(pkg);
1463 reply.writeNoException();
1464 reply.writeInt(mode);
1465 return true;
1466 }
1467
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001468 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1469 {
1470 data.enforceInterface(IActivityManager.descriptor);
1471 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001472 int mode = data.readInt();
1473 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001474 reply.writeNoException();
1475 return true;
1476 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001477
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001478 case SWITCH_USER_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 int userid = data.readInt();
1481 boolean result = switchUser(userid);
1482 reply.writeNoException();
1483 reply.writeInt(result ? 1 : 0);
1484 return true;
1485 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001486
1487 case REMOVE_SUB_TASK_TRANSACTION:
1488 {
1489 data.enforceInterface(IActivityManager.descriptor);
1490 int taskId = data.readInt();
1491 int subTaskIndex = data.readInt();
1492 boolean result = removeSubTask(taskId, subTaskIndex);
1493 reply.writeNoException();
1494 reply.writeInt(result ? 1 : 0);
1495 return true;
1496 }
1497
1498 case REMOVE_TASK_TRANSACTION:
1499 {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 int taskId = data.readInt();
1502 int fl = data.readInt();
1503 boolean result = removeTask(taskId, fl);
1504 reply.writeNoException();
1505 reply.writeInt(result ? 1 : 0);
1506 return true;
1507 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001508
Jeff Sharkeya4620792011-05-20 15:29:23 -07001509 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1512 data.readStrongBinder());
1513 registerProcessObserver(observer);
1514 return true;
1515 }
1516
1517 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1518 data.enforceInterface(IActivityManager.descriptor);
1519 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1520 data.readStrongBinder());
1521 unregisterProcessObserver(observer);
1522 return true;
1523 }
1524
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001525 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1526 {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 String pkg = data.readString();
1529 boolean ask = getPackageAskScreenCompat(pkg);
1530 reply.writeNoException();
1531 reply.writeInt(ask ? 1 : 0);
1532 return true;
1533 }
1534
1535 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1536 {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String pkg = data.readString();
1539 boolean ask = data.readInt() != 0;
1540 setPackageAskScreenCompat(pkg, ask);
1541 reply.writeNoException();
1542 return true;
1543 }
1544
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001545 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1546 data.enforceInterface(IActivityManager.descriptor);
1547 IIntentSender r = IIntentSender.Stub.asInterface(
1548 data.readStrongBinder());
1549 boolean res = isIntentSenderTargetedToPackage(r);
1550 reply.writeNoException();
1551 reply.writeInt(res ? 1 : 0);
1552 return true;
1553 }
1554
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001555 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 Configuration config = Configuration.CREATOR.createFromParcel(data);
1558 updatePersistentConfiguration(config);
1559 reply.writeNoException();
1560 return true;
1561 }
1562
Dianne Hackbornb437e092011-08-05 17:50:29 -07001563 case GET_PROCESS_PSS_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
1565 int[] pids = data.createIntArray();
1566 long[] pss = getProcessPss(pids);
1567 reply.writeNoException();
1568 reply.writeLongArray(pss);
1569 return true;
1570 }
1571
Dianne Hackborn661cd522011-08-22 00:26:20 -07001572 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1575 boolean always = data.readInt() != 0;
1576 showBootMessage(msg, always);
1577 reply.writeNoException();
1578 return true;
1579 }
1580
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001581 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1582 data.enforceInterface(IActivityManager.descriptor);
1583 dismissKeyguardOnNextActivity();
1584 reply.writeNoException();
1585 return true;
1586 }
1587
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001588 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 return super.onTransact(code, data, reply, flags);
1591 }
1592
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001593 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001594 return this;
1595 }
1596
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001597 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1598 protected IActivityManager create() {
1599 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001600 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001601 Log.v("ActivityManager", "default service binder = " + b);
1602 }
1603 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001604 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001605 Log.v("ActivityManager", "default service = " + am);
1606 }
1607 return am;
1608 }
1609 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001610}
1611
1612class ActivityManagerProxy implements IActivityManager
1613{
1614 public ActivityManagerProxy(IBinder remote)
1615 {
1616 mRemote = remote;
1617 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001619 public IBinder asBinder()
1620 {
1621 return mRemote;
1622 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001623
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001624 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001625 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1626 int startFlags, String profileFile,
1627 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001628 Parcel data = Parcel.obtain();
1629 Parcel reply = Parcel.obtain();
1630 data.writeInterfaceToken(IActivityManager.descriptor);
1631 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1632 intent.writeToParcel(data, 0);
1633 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001634 data.writeStrongBinder(resultTo);
1635 data.writeString(resultWho);
1636 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001637 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001638 data.writeString(profileFile);
1639 if (profileFd != null) {
1640 data.writeInt(1);
1641 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1642 } else {
1643 data.writeInt(0);
1644 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001645 if (options != null) {
1646 data.writeInt(1);
1647 options.writeToParcel(data, 0);
1648 } else {
1649 data.writeInt(0);
1650 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001651 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1652 reply.readException();
1653 int result = reply.readInt();
1654 reply.recycle();
1655 data.recycle();
1656 return result;
1657 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001658 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001659 String resolvedType, IBinder resultTo, String resultWho,
1660 int requestCode, int startFlags, String profileFile,
1661 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001662 Parcel data = Parcel.obtain();
1663 Parcel reply = Parcel.obtain();
1664 data.writeInterfaceToken(IActivityManager.descriptor);
1665 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1666 intent.writeToParcel(data, 0);
1667 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001668 data.writeStrongBinder(resultTo);
1669 data.writeString(resultWho);
1670 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001671 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001672 data.writeString(profileFile);
1673 if (profileFd != null) {
1674 data.writeInt(1);
1675 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1676 } else {
1677 data.writeInt(0);
1678 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001679 if (options != null) {
1680 data.writeInt(1);
1681 options.writeToParcel(data, 0);
1682 } else {
1683 data.writeInt(0);
1684 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001685 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1686 reply.readException();
1687 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1688 reply.recycle();
1689 data.recycle();
1690 return result;
1691 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001692 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001693 String resolvedType, IBinder resultTo, String resultWho,
1694 int requestCode, int startFlags, Configuration config,
1695 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001696 Parcel data = Parcel.obtain();
1697 Parcel reply = Parcel.obtain();
1698 data.writeInterfaceToken(IActivityManager.descriptor);
1699 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1700 intent.writeToParcel(data, 0);
1701 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001702 data.writeStrongBinder(resultTo);
1703 data.writeString(resultWho);
1704 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001705 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001706 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001707 if (options != null) {
1708 data.writeInt(1);
1709 options.writeToParcel(data, 0);
1710 } else {
1711 data.writeInt(0);
1712 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001713 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1714 reply.readException();
1715 int result = reply.readInt();
1716 reply.recycle();
1717 data.recycle();
1718 return result;
1719 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001720 public int startActivityIntentSender(IApplicationThread caller,
1721 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001722 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001723 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001724 Parcel data = Parcel.obtain();
1725 Parcel reply = Parcel.obtain();
1726 data.writeInterfaceToken(IActivityManager.descriptor);
1727 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1728 intent.writeToParcel(data, 0);
1729 if (fillInIntent != null) {
1730 data.writeInt(1);
1731 fillInIntent.writeToParcel(data, 0);
1732 } else {
1733 data.writeInt(0);
1734 }
1735 data.writeString(resolvedType);
1736 data.writeStrongBinder(resultTo);
1737 data.writeString(resultWho);
1738 data.writeInt(requestCode);
1739 data.writeInt(flagsMask);
1740 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001741 if (options != null) {
1742 data.writeInt(1);
1743 options.writeToParcel(data, 0);
1744 } else {
1745 data.writeInt(0);
1746 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001747 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001748 reply.readException();
1749 int result = reply.readInt();
1750 reply.recycle();
1751 data.recycle();
1752 return result;
1753 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001754 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001755 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001756 Parcel data = Parcel.obtain();
1757 Parcel reply = Parcel.obtain();
1758 data.writeInterfaceToken(IActivityManager.descriptor);
1759 data.writeStrongBinder(callingActivity);
1760 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001761 if (options != null) {
1762 data.writeInt(1);
1763 options.writeToParcel(data, 0);
1764 } else {
1765 data.writeInt(0);
1766 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001767 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1768 reply.readException();
1769 int result = reply.readInt();
1770 reply.recycle();
1771 data.recycle();
1772 return result != 0;
1773 }
1774 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1775 throws RemoteException {
1776 Parcel data = Parcel.obtain();
1777 Parcel reply = Parcel.obtain();
1778 data.writeInterfaceToken(IActivityManager.descriptor);
1779 data.writeStrongBinder(token);
1780 data.writeInt(resultCode);
1781 if (resultData != null) {
1782 data.writeInt(1);
1783 resultData.writeToParcel(data, 0);
1784 } else {
1785 data.writeInt(0);
1786 }
1787 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1788 reply.readException();
1789 boolean res = reply.readInt() != 0;
1790 data.recycle();
1791 reply.recycle();
1792 return res;
1793 }
1794 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1795 {
1796 Parcel data = Parcel.obtain();
1797 Parcel reply = Parcel.obtain();
1798 data.writeInterfaceToken(IActivityManager.descriptor);
1799 data.writeStrongBinder(token);
1800 data.writeString(resultWho);
1801 data.writeInt(requestCode);
1802 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1803 reply.readException();
1804 data.recycle();
1805 reply.recycle();
1806 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001807 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1808 Parcel data = Parcel.obtain();
1809 Parcel reply = Parcel.obtain();
1810 data.writeInterfaceToken(IActivityManager.descriptor);
1811 data.writeStrongBinder(token);
1812 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1813 reply.readException();
1814 boolean res = reply.readInt() != 0;
1815 data.recycle();
1816 reply.recycle();
1817 return res;
1818 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001819 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001820 IIntentReceiver receiver,
1821 IntentFilter filter, String perm) throws RemoteException
1822 {
1823 Parcel data = Parcel.obtain();
1824 Parcel reply = Parcel.obtain();
1825 data.writeInterfaceToken(IActivityManager.descriptor);
1826 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001827 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001828 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1829 filter.writeToParcel(data, 0);
1830 data.writeString(perm);
1831 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1832 reply.readException();
1833 Intent intent = null;
1834 int haveIntent = reply.readInt();
1835 if (haveIntent != 0) {
1836 intent = Intent.CREATOR.createFromParcel(reply);
1837 }
1838 reply.recycle();
1839 data.recycle();
1840 return intent;
1841 }
1842 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1843 {
1844 Parcel data = Parcel.obtain();
1845 Parcel reply = Parcel.obtain();
1846 data.writeInterfaceToken(IActivityManager.descriptor);
1847 data.writeStrongBinder(receiver.asBinder());
1848 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1849 reply.readException();
1850 data.recycle();
1851 reply.recycle();
1852 }
1853 public int broadcastIntent(IApplicationThread caller,
1854 Intent intent, String resolvedType, IIntentReceiver resultTo,
1855 int resultCode, String resultData, Bundle map,
1856 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001857 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001858 {
1859 Parcel data = Parcel.obtain();
1860 Parcel reply = Parcel.obtain();
1861 data.writeInterfaceToken(IActivityManager.descriptor);
1862 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1863 intent.writeToParcel(data, 0);
1864 data.writeString(resolvedType);
1865 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1866 data.writeInt(resultCode);
1867 data.writeString(resultData);
1868 data.writeBundle(map);
1869 data.writeString(requiredPermission);
1870 data.writeInt(serialized ? 1 : 0);
1871 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001872 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001873 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1874 reply.readException();
1875 int res = reply.readInt();
1876 reply.recycle();
1877 data.recycle();
1878 return res;
1879 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001880 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1881 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001882 {
1883 Parcel data = Parcel.obtain();
1884 Parcel reply = Parcel.obtain();
1885 data.writeInterfaceToken(IActivityManager.descriptor);
1886 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1887 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001888 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001889 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1890 reply.readException();
1891 data.recycle();
1892 reply.recycle();
1893 }
1894 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1895 {
1896 Parcel data = Parcel.obtain();
1897 Parcel reply = Parcel.obtain();
1898 data.writeInterfaceToken(IActivityManager.descriptor);
1899 data.writeStrongBinder(who);
1900 data.writeInt(resultCode);
1901 data.writeString(resultData);
1902 data.writeBundle(map);
1903 data.writeInt(abortBroadcast ? 1 : 0);
1904 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1905 reply.readException();
1906 data.recycle();
1907 reply.recycle();
1908 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001909 public void attachApplication(IApplicationThread app) throws RemoteException
1910 {
1911 Parcel data = Parcel.obtain();
1912 Parcel reply = Parcel.obtain();
1913 data.writeInterfaceToken(IActivityManager.descriptor);
1914 data.writeStrongBinder(app.asBinder());
1915 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1916 reply.readException();
1917 data.recycle();
1918 reply.recycle();
1919 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001920 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1921 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001922 {
1923 Parcel data = Parcel.obtain();
1924 Parcel reply = Parcel.obtain();
1925 data.writeInterfaceToken(IActivityManager.descriptor);
1926 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001927 if (config != null) {
1928 data.writeInt(1);
1929 config.writeToParcel(data, 0);
1930 } else {
1931 data.writeInt(0);
1932 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001933 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001934 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1935 reply.readException();
1936 data.recycle();
1937 reply.recycle();
1938 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001939 public void activityPaused(IBinder token) throws RemoteException
1940 {
1941 Parcel data = Parcel.obtain();
1942 Parcel reply = Parcel.obtain();
1943 data.writeInterfaceToken(IActivityManager.descriptor);
1944 data.writeStrongBinder(token);
1945 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1946 reply.readException();
1947 data.recycle();
1948 reply.recycle();
1949 }
1950 public void activityStopped(IBinder token, Bundle state,
1951 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001952 {
1953 Parcel data = Parcel.obtain();
1954 Parcel reply = Parcel.obtain();
1955 data.writeInterfaceToken(IActivityManager.descriptor);
1956 data.writeStrongBinder(token);
1957 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001958 if (thumbnail != null) {
1959 data.writeInt(1);
1960 thumbnail.writeToParcel(data, 0);
1961 } else {
1962 data.writeInt(0);
1963 }
1964 TextUtils.writeToParcel(description, data, 0);
1965 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1966 reply.readException();
1967 data.recycle();
1968 reply.recycle();
1969 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001970 public void activitySlept(IBinder token) throws RemoteException
1971 {
1972 Parcel data = Parcel.obtain();
1973 Parcel reply = Parcel.obtain();
1974 data.writeInterfaceToken(IActivityManager.descriptor);
1975 data.writeStrongBinder(token);
1976 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1977 reply.readException();
1978 data.recycle();
1979 reply.recycle();
1980 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001981 public void activityDestroyed(IBinder token) throws RemoteException
1982 {
1983 Parcel data = Parcel.obtain();
1984 Parcel reply = Parcel.obtain();
1985 data.writeInterfaceToken(IActivityManager.descriptor);
1986 data.writeStrongBinder(token);
1987 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1988 reply.readException();
1989 data.recycle();
1990 reply.recycle();
1991 }
1992 public String getCallingPackage(IBinder token) throws RemoteException
1993 {
1994 Parcel data = Parcel.obtain();
1995 Parcel reply = Parcel.obtain();
1996 data.writeInterfaceToken(IActivityManager.descriptor);
1997 data.writeStrongBinder(token);
1998 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
1999 reply.readException();
2000 String res = reply.readString();
2001 data.recycle();
2002 reply.recycle();
2003 return res;
2004 }
2005 public ComponentName getCallingActivity(IBinder token)
2006 throws RemoteException {
2007 Parcel data = Parcel.obtain();
2008 Parcel reply = Parcel.obtain();
2009 data.writeInterfaceToken(IActivityManager.descriptor);
2010 data.writeStrongBinder(token);
2011 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2012 reply.readException();
2013 ComponentName res = ComponentName.readFromParcel(reply);
2014 data.recycle();
2015 reply.recycle();
2016 return res;
2017 }
2018 public List getTasks(int maxNum, int flags,
2019 IThumbnailReceiver receiver) throws RemoteException {
2020 Parcel data = Parcel.obtain();
2021 Parcel reply = Parcel.obtain();
2022 data.writeInterfaceToken(IActivityManager.descriptor);
2023 data.writeInt(maxNum);
2024 data.writeInt(flags);
2025 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2026 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2027 reply.readException();
2028 ArrayList list = null;
2029 int N = reply.readInt();
2030 if (N >= 0) {
2031 list = new ArrayList();
2032 while (N > 0) {
2033 ActivityManager.RunningTaskInfo info =
2034 ActivityManager.RunningTaskInfo.CREATOR
2035 .createFromParcel(reply);
2036 list.add(info);
2037 N--;
2038 }
2039 }
2040 data.recycle();
2041 reply.recycle();
2042 return list;
2043 }
2044 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2045 int flags) throws RemoteException {
2046 Parcel data = Parcel.obtain();
2047 Parcel reply = Parcel.obtain();
2048 data.writeInterfaceToken(IActivityManager.descriptor);
2049 data.writeInt(maxNum);
2050 data.writeInt(flags);
2051 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2052 reply.readException();
2053 ArrayList<ActivityManager.RecentTaskInfo> list
2054 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2055 data.recycle();
2056 reply.recycle();
2057 return list;
2058 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002059 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002060 Parcel data = Parcel.obtain();
2061 Parcel reply = Parcel.obtain();
2062 data.writeInterfaceToken(IActivityManager.descriptor);
2063 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002064 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002065 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002066 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002067 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002068 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002069 }
2070 data.recycle();
2071 reply.recycle();
2072 return bm;
2073 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002074 public List getServices(int maxNum, int flags) throws RemoteException {
2075 Parcel data = Parcel.obtain();
2076 Parcel reply = Parcel.obtain();
2077 data.writeInterfaceToken(IActivityManager.descriptor);
2078 data.writeInt(maxNum);
2079 data.writeInt(flags);
2080 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2081 reply.readException();
2082 ArrayList list = null;
2083 int N = reply.readInt();
2084 if (N >= 0) {
2085 list = new ArrayList();
2086 while (N > 0) {
2087 ActivityManager.RunningServiceInfo info =
2088 ActivityManager.RunningServiceInfo.CREATOR
2089 .createFromParcel(reply);
2090 list.add(info);
2091 N--;
2092 }
2093 }
2094 data.recycle();
2095 reply.recycle();
2096 return list;
2097 }
2098 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2099 throws RemoteException {
2100 Parcel data = Parcel.obtain();
2101 Parcel reply = Parcel.obtain();
2102 data.writeInterfaceToken(IActivityManager.descriptor);
2103 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2104 reply.readException();
2105 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2106 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2107 data.recycle();
2108 reply.recycle();
2109 return list;
2110 }
2111 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2112 throws RemoteException {
2113 Parcel data = Parcel.obtain();
2114 Parcel reply = Parcel.obtain();
2115 data.writeInterfaceToken(IActivityManager.descriptor);
2116 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2117 reply.readException();
2118 ArrayList<ActivityManager.RunningAppProcessInfo> list
2119 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2120 data.recycle();
2121 reply.recycle();
2122 return list;
2123 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002124 public List<ApplicationInfo> getRunningExternalApplications()
2125 throws RemoteException {
2126 Parcel data = Parcel.obtain();
2127 Parcel reply = Parcel.obtain();
2128 data.writeInterfaceToken(IActivityManager.descriptor);
2129 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2130 reply.readException();
2131 ArrayList<ApplicationInfo> list
2132 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2133 data.recycle();
2134 reply.recycle();
2135 return list;
2136 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002137 public void moveTaskToFront(int task, int flags) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002138 {
2139 Parcel data = Parcel.obtain();
2140 Parcel reply = Parcel.obtain();
2141 data.writeInterfaceToken(IActivityManager.descriptor);
2142 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002143 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002144 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2145 reply.readException();
2146 data.recycle();
2147 reply.recycle();
2148 }
2149 public void moveTaskToBack(int task) throws RemoteException
2150 {
2151 Parcel data = Parcel.obtain();
2152 Parcel reply = Parcel.obtain();
2153 data.writeInterfaceToken(IActivityManager.descriptor);
2154 data.writeInt(task);
2155 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2156 reply.readException();
2157 data.recycle();
2158 reply.recycle();
2159 }
2160 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2161 throws RemoteException {
2162 Parcel data = Parcel.obtain();
2163 Parcel reply = Parcel.obtain();
2164 data.writeInterfaceToken(IActivityManager.descriptor);
2165 data.writeStrongBinder(token);
2166 data.writeInt(nonRoot ? 1 : 0);
2167 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2168 reply.readException();
2169 boolean res = reply.readInt() != 0;
2170 data.recycle();
2171 reply.recycle();
2172 return res;
2173 }
2174 public void moveTaskBackwards(int task) throws RemoteException
2175 {
2176 Parcel data = Parcel.obtain();
2177 Parcel reply = Parcel.obtain();
2178 data.writeInterfaceToken(IActivityManager.descriptor);
2179 data.writeInt(task);
2180 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2181 reply.readException();
2182 data.recycle();
2183 reply.recycle();
2184 }
2185 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2186 {
2187 Parcel data = Parcel.obtain();
2188 Parcel reply = Parcel.obtain();
2189 data.writeInterfaceToken(IActivityManager.descriptor);
2190 data.writeStrongBinder(token);
2191 data.writeInt(onlyRoot ? 1 : 0);
2192 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2193 reply.readException();
2194 int res = reply.readInt();
2195 data.recycle();
2196 reply.recycle();
2197 return res;
2198 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002199 public void reportThumbnail(IBinder token,
2200 Bitmap thumbnail, CharSequence description) throws RemoteException
2201 {
2202 Parcel data = Parcel.obtain();
2203 Parcel reply = Parcel.obtain();
2204 data.writeInterfaceToken(IActivityManager.descriptor);
2205 data.writeStrongBinder(token);
2206 if (thumbnail != null) {
2207 data.writeInt(1);
2208 thumbnail.writeToParcel(data, 0);
2209 } else {
2210 data.writeInt(0);
2211 }
2212 TextUtils.writeToParcel(description, data, 0);
2213 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2214 reply.readException();
2215 data.recycle();
2216 reply.recycle();
2217 }
2218 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2219 String name) throws RemoteException
2220 {
2221 Parcel data = Parcel.obtain();
2222 Parcel reply = Parcel.obtain();
2223 data.writeInterfaceToken(IActivityManager.descriptor);
2224 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2225 data.writeString(name);
2226 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2227 reply.readException();
2228 int res = reply.readInt();
2229 ContentProviderHolder cph = null;
2230 if (res != 0) {
2231 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2232 }
2233 data.recycle();
2234 reply.recycle();
2235 return cph;
2236 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002237 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2238 throws RemoteException
2239 {
2240 Parcel data = Parcel.obtain();
2241 Parcel reply = Parcel.obtain();
2242 data.writeInterfaceToken(IActivityManager.descriptor);
2243 data.writeString(name);
2244 data.writeStrongBinder(token);
2245 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2246 reply.readException();
2247 int res = reply.readInt();
2248 ContentProviderHolder cph = null;
2249 if (res != 0) {
2250 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2251 }
2252 data.recycle();
2253 reply.recycle();
2254 return cph;
2255 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002256 public void publishContentProviders(IApplicationThread caller,
2257 List<ContentProviderHolder> providers) throws RemoteException
2258 {
2259 Parcel data = Parcel.obtain();
2260 Parcel reply = Parcel.obtain();
2261 data.writeInterfaceToken(IActivityManager.descriptor);
2262 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2263 data.writeTypedList(providers);
2264 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2265 reply.readException();
2266 data.recycle();
2267 reply.recycle();
2268 }
2269
2270 public void removeContentProvider(IApplicationThread caller,
2271 String name) throws RemoteException {
2272 Parcel data = Parcel.obtain();
2273 Parcel reply = Parcel.obtain();
2274 data.writeInterfaceToken(IActivityManager.descriptor);
2275 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2276 data.writeString(name);
2277 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2278 reply.readException();
2279 data.recycle();
2280 reply.recycle();
2281 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002282
2283 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2284 Parcel data = Parcel.obtain();
2285 Parcel reply = Parcel.obtain();
2286 data.writeInterfaceToken(IActivityManager.descriptor);
2287 data.writeString(name);
2288 data.writeStrongBinder(token);
2289 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2290 reply.readException();
2291 data.recycle();
2292 reply.recycle();
2293 }
2294
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002295 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2296 throws RemoteException
2297 {
2298 Parcel data = Parcel.obtain();
2299 Parcel reply = Parcel.obtain();
2300 data.writeInterfaceToken(IActivityManager.descriptor);
2301 service.writeToParcel(data, 0);
2302 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2303 reply.readException();
2304 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2305 data.recycle();
2306 reply.recycle();
2307 return res;
2308 }
2309
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002310 public ComponentName startService(IApplicationThread caller, Intent service,
2311 String resolvedType) throws RemoteException
2312 {
2313 Parcel data = Parcel.obtain();
2314 Parcel reply = Parcel.obtain();
2315 data.writeInterfaceToken(IActivityManager.descriptor);
2316 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2317 service.writeToParcel(data, 0);
2318 data.writeString(resolvedType);
2319 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2320 reply.readException();
2321 ComponentName res = ComponentName.readFromParcel(reply);
2322 data.recycle();
2323 reply.recycle();
2324 return res;
2325 }
2326 public int stopService(IApplicationThread caller, Intent service,
2327 String resolvedType) throws RemoteException
2328 {
2329 Parcel data = Parcel.obtain();
2330 Parcel reply = Parcel.obtain();
2331 data.writeInterfaceToken(IActivityManager.descriptor);
2332 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2333 service.writeToParcel(data, 0);
2334 data.writeString(resolvedType);
2335 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2336 reply.readException();
2337 int res = reply.readInt();
2338 reply.recycle();
2339 data.recycle();
2340 return res;
2341 }
2342 public boolean stopServiceToken(ComponentName className, IBinder token,
2343 int startId) throws RemoteException {
2344 Parcel data = Parcel.obtain();
2345 Parcel reply = Parcel.obtain();
2346 data.writeInterfaceToken(IActivityManager.descriptor);
2347 ComponentName.writeToParcel(className, data);
2348 data.writeStrongBinder(token);
2349 data.writeInt(startId);
2350 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2351 reply.readException();
2352 boolean res = reply.readInt() != 0;
2353 data.recycle();
2354 reply.recycle();
2355 return res;
2356 }
2357 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002358 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002359 Parcel data = Parcel.obtain();
2360 Parcel reply = Parcel.obtain();
2361 data.writeInterfaceToken(IActivityManager.descriptor);
2362 ComponentName.writeToParcel(className, data);
2363 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002364 data.writeInt(id);
2365 if (notification != null) {
2366 data.writeInt(1);
2367 notification.writeToParcel(data, 0);
2368 } else {
2369 data.writeInt(0);
2370 }
2371 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002372 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2373 reply.readException();
2374 data.recycle();
2375 reply.recycle();
2376 }
2377 public int bindService(IApplicationThread caller, IBinder token,
2378 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002379 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2384 data.writeStrongBinder(token);
2385 service.writeToParcel(data, 0);
2386 data.writeString(resolvedType);
2387 data.writeStrongBinder(connection.asBinder());
2388 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002389 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002390 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2391 reply.readException();
2392 int res = reply.readInt();
2393 data.recycle();
2394 reply.recycle();
2395 return res;
2396 }
2397 public boolean unbindService(IServiceConnection connection) throws RemoteException
2398 {
2399 Parcel data = Parcel.obtain();
2400 Parcel reply = Parcel.obtain();
2401 data.writeInterfaceToken(IActivityManager.descriptor);
2402 data.writeStrongBinder(connection.asBinder());
2403 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2404 reply.readException();
2405 boolean res = reply.readInt() != 0;
2406 data.recycle();
2407 reply.recycle();
2408 return res;
2409 }
2410
2411 public void publishService(IBinder token,
2412 Intent intent, IBinder service) throws RemoteException {
2413 Parcel data = Parcel.obtain();
2414 Parcel reply = Parcel.obtain();
2415 data.writeInterfaceToken(IActivityManager.descriptor);
2416 data.writeStrongBinder(token);
2417 intent.writeToParcel(data, 0);
2418 data.writeStrongBinder(service);
2419 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2420 reply.readException();
2421 data.recycle();
2422 reply.recycle();
2423 }
2424
2425 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2426 throws RemoteException {
2427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 data.writeStrongBinder(token);
2431 intent.writeToParcel(data, 0);
2432 data.writeInt(doRebind ? 1 : 0);
2433 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2434 reply.readException();
2435 data.recycle();
2436 reply.recycle();
2437 }
2438
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002439 public void serviceDoneExecuting(IBinder token, int type, int startId,
2440 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441 Parcel data = Parcel.obtain();
2442 Parcel reply = Parcel.obtain();
2443 data.writeInterfaceToken(IActivityManager.descriptor);
2444 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002445 data.writeInt(type);
2446 data.writeInt(startId);
2447 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002448 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2449 reply.readException();
2450 data.recycle();
2451 reply.recycle();
2452 }
2453
2454 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2455 Parcel data = Parcel.obtain();
2456 Parcel reply = Parcel.obtain();
2457 data.writeInterfaceToken(IActivityManager.descriptor);
2458 service.writeToParcel(data, 0);
2459 data.writeString(resolvedType);
2460 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2461 reply.readException();
2462 IBinder binder = reply.readStrongBinder();
2463 reply.recycle();
2464 data.recycle();
2465 return binder;
2466 }
2467
Christopher Tate181fafa2009-05-14 11:12:14 -07002468 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2469 throws RemoteException {
2470 Parcel data = Parcel.obtain();
2471 Parcel reply = Parcel.obtain();
2472 data.writeInterfaceToken(IActivityManager.descriptor);
2473 app.writeToParcel(data, 0);
2474 data.writeInt(backupRestoreMode);
2475 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2476 reply.readException();
2477 boolean success = reply.readInt() != 0;
2478 reply.recycle();
2479 data.recycle();
2480 return success;
2481 }
2482
2483 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2484 Parcel data = Parcel.obtain();
2485 Parcel reply = Parcel.obtain();
2486 data.writeInterfaceToken(IActivityManager.descriptor);
2487 data.writeString(packageName);
2488 data.writeStrongBinder(agent);
2489 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2490 reply.recycle();
2491 data.recycle();
2492 }
2493
2494 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2495 Parcel data = Parcel.obtain();
2496 Parcel reply = Parcel.obtain();
2497 data.writeInterfaceToken(IActivityManager.descriptor);
2498 app.writeToParcel(data, 0);
2499 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2500 reply.readException();
2501 reply.recycle();
2502 data.recycle();
2503 }
2504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002505 public boolean startInstrumentation(ComponentName className, String profileFile,
2506 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2507 throws RemoteException {
2508 Parcel data = Parcel.obtain();
2509 Parcel reply = Parcel.obtain();
2510 data.writeInterfaceToken(IActivityManager.descriptor);
2511 ComponentName.writeToParcel(className, data);
2512 data.writeString(profileFile);
2513 data.writeInt(flags);
2514 data.writeBundle(arguments);
2515 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2516 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2517 reply.readException();
2518 boolean res = reply.readInt() != 0;
2519 reply.recycle();
2520 data.recycle();
2521 return res;
2522 }
2523
2524 public void finishInstrumentation(IApplicationThread target,
2525 int resultCode, Bundle results) throws RemoteException {
2526 Parcel data = Parcel.obtain();
2527 Parcel reply = Parcel.obtain();
2528 data.writeInterfaceToken(IActivityManager.descriptor);
2529 data.writeStrongBinder(target != null ? target.asBinder() : null);
2530 data.writeInt(resultCode);
2531 data.writeBundle(results);
2532 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2533 reply.readException();
2534 data.recycle();
2535 reply.recycle();
2536 }
2537 public Configuration getConfiguration() throws RemoteException
2538 {
2539 Parcel data = Parcel.obtain();
2540 Parcel reply = Parcel.obtain();
2541 data.writeInterfaceToken(IActivityManager.descriptor);
2542 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2543 reply.readException();
2544 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2545 reply.recycle();
2546 data.recycle();
2547 return res;
2548 }
2549 public void updateConfiguration(Configuration values) throws RemoteException
2550 {
2551 Parcel data = Parcel.obtain();
2552 Parcel reply = Parcel.obtain();
2553 data.writeInterfaceToken(IActivityManager.descriptor);
2554 values.writeToParcel(data, 0);
2555 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2556 reply.readException();
2557 data.recycle();
2558 reply.recycle();
2559 }
2560 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2561 throws RemoteException {
2562 Parcel data = Parcel.obtain();
2563 Parcel reply = Parcel.obtain();
2564 data.writeInterfaceToken(IActivityManager.descriptor);
2565 data.writeStrongBinder(token);
2566 data.writeInt(requestedOrientation);
2567 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 data.recycle();
2570 reply.recycle();
2571 }
2572 public int getRequestedOrientation(IBinder token) throws RemoteException {
2573 Parcel data = Parcel.obtain();
2574 Parcel reply = Parcel.obtain();
2575 data.writeInterfaceToken(IActivityManager.descriptor);
2576 data.writeStrongBinder(token);
2577 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2578 reply.readException();
2579 int res = reply.readInt();
2580 data.recycle();
2581 reply.recycle();
2582 return res;
2583 }
2584 public ComponentName getActivityClassForToken(IBinder token)
2585 throws RemoteException {
2586 Parcel data = Parcel.obtain();
2587 Parcel reply = Parcel.obtain();
2588 data.writeInterfaceToken(IActivityManager.descriptor);
2589 data.writeStrongBinder(token);
2590 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2591 reply.readException();
2592 ComponentName res = ComponentName.readFromParcel(reply);
2593 data.recycle();
2594 reply.recycle();
2595 return res;
2596 }
2597 public String getPackageForToken(IBinder token) throws RemoteException
2598 {
2599 Parcel data = Parcel.obtain();
2600 Parcel reply = Parcel.obtain();
2601 data.writeInterfaceToken(IActivityManager.descriptor);
2602 data.writeStrongBinder(token);
2603 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2604 reply.readException();
2605 String res = reply.readString();
2606 data.recycle();
2607 reply.recycle();
2608 return res;
2609 }
2610 public IIntentSender getIntentSender(int type,
2611 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002612 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2613 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002614 Parcel data = Parcel.obtain();
2615 Parcel reply = Parcel.obtain();
2616 data.writeInterfaceToken(IActivityManager.descriptor);
2617 data.writeInt(type);
2618 data.writeString(packageName);
2619 data.writeStrongBinder(token);
2620 data.writeString(resultWho);
2621 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002622 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002623 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002624 data.writeTypedArray(intents, 0);
2625 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002626 } else {
2627 data.writeInt(0);
2628 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002629 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002630 if (options != null) {
2631 data.writeInt(1);
2632 options.writeToParcel(data, 0);
2633 } else {
2634 data.writeInt(0);
2635 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002636 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2637 reply.readException();
2638 IIntentSender res = IIntentSender.Stub.asInterface(
2639 reply.readStrongBinder());
2640 data.recycle();
2641 reply.recycle();
2642 return res;
2643 }
2644 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2645 Parcel data = Parcel.obtain();
2646 Parcel reply = Parcel.obtain();
2647 data.writeInterfaceToken(IActivityManager.descriptor);
2648 data.writeStrongBinder(sender.asBinder());
2649 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2650 reply.readException();
2651 data.recycle();
2652 reply.recycle();
2653 }
2654 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 data.writeStrongBinder(sender.asBinder());
2659 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2660 reply.readException();
2661 String res = reply.readString();
2662 data.recycle();
2663 reply.recycle();
2664 return res;
2665 }
2666 public void setProcessLimit(int max) throws RemoteException
2667 {
2668 Parcel data = Parcel.obtain();
2669 Parcel reply = Parcel.obtain();
2670 data.writeInterfaceToken(IActivityManager.descriptor);
2671 data.writeInt(max);
2672 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2673 reply.readException();
2674 data.recycle();
2675 reply.recycle();
2676 }
2677 public int getProcessLimit() throws RemoteException
2678 {
2679 Parcel data = Parcel.obtain();
2680 Parcel reply = Parcel.obtain();
2681 data.writeInterfaceToken(IActivityManager.descriptor);
2682 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 int res = reply.readInt();
2685 data.recycle();
2686 reply.recycle();
2687 return res;
2688 }
2689 public void setProcessForeground(IBinder token, int pid,
2690 boolean isForeground) throws RemoteException {
2691 Parcel data = Parcel.obtain();
2692 Parcel reply = Parcel.obtain();
2693 data.writeInterfaceToken(IActivityManager.descriptor);
2694 data.writeStrongBinder(token);
2695 data.writeInt(pid);
2696 data.writeInt(isForeground ? 1 : 0);
2697 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2698 reply.readException();
2699 data.recycle();
2700 reply.recycle();
2701 }
2702 public int checkPermission(String permission, int pid, int uid)
2703 throws RemoteException {
2704 Parcel data = Parcel.obtain();
2705 Parcel reply = Parcel.obtain();
2706 data.writeInterfaceToken(IActivityManager.descriptor);
2707 data.writeString(permission);
2708 data.writeInt(pid);
2709 data.writeInt(uid);
2710 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2711 reply.readException();
2712 int res = reply.readInt();
2713 data.recycle();
2714 reply.recycle();
2715 return res;
2716 }
2717 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002718 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
2721 data.writeInterfaceToken(IActivityManager.descriptor);
2722 data.writeString(packageName);
2723 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002724 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002725 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2726 reply.readException();
2727 boolean res = reply.readInt() != 0;
2728 data.recycle();
2729 reply.recycle();
2730 return res;
2731 }
2732 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2733 throws RemoteException {
2734 Parcel data = Parcel.obtain();
2735 Parcel reply = Parcel.obtain();
2736 data.writeInterfaceToken(IActivityManager.descriptor);
2737 uri.writeToParcel(data, 0);
2738 data.writeInt(pid);
2739 data.writeInt(uid);
2740 data.writeInt(mode);
2741 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 int res = reply.readInt();
2744 data.recycle();
2745 reply.recycle();
2746 return res;
2747 }
2748 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2749 Uri uri, int mode) throws RemoteException {
2750 Parcel data = Parcel.obtain();
2751 Parcel reply = Parcel.obtain();
2752 data.writeInterfaceToken(IActivityManager.descriptor);
2753 data.writeStrongBinder(caller.asBinder());
2754 data.writeString(targetPkg);
2755 uri.writeToParcel(data, 0);
2756 data.writeInt(mode);
2757 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2758 reply.readException();
2759 data.recycle();
2760 reply.recycle();
2761 }
2762 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2763 int mode) throws RemoteException {
2764 Parcel data = Parcel.obtain();
2765 Parcel reply = Parcel.obtain();
2766 data.writeInterfaceToken(IActivityManager.descriptor);
2767 data.writeStrongBinder(caller.asBinder());
2768 uri.writeToParcel(data, 0);
2769 data.writeInt(mode);
2770 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2771 reply.readException();
2772 data.recycle();
2773 reply.recycle();
2774 }
2775 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2776 throws RemoteException {
2777 Parcel data = Parcel.obtain();
2778 Parcel reply = Parcel.obtain();
2779 data.writeInterfaceToken(IActivityManager.descriptor);
2780 data.writeStrongBinder(who.asBinder());
2781 data.writeInt(waiting ? 1 : 0);
2782 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2783 reply.readException();
2784 data.recycle();
2785 reply.recycle();
2786 }
2787 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2788 Parcel data = Parcel.obtain();
2789 Parcel reply = Parcel.obtain();
2790 data.writeInterfaceToken(IActivityManager.descriptor);
2791 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2792 reply.readException();
2793 outInfo.readFromParcel(reply);
2794 data.recycle();
2795 reply.recycle();
2796 }
2797 public void unhandledBack() throws RemoteException
2798 {
2799 Parcel data = Parcel.obtain();
2800 Parcel reply = Parcel.obtain();
2801 data.writeInterfaceToken(IActivityManager.descriptor);
2802 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2803 reply.readException();
2804 data.recycle();
2805 reply.recycle();
2806 }
2807 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2808 {
2809 Parcel data = Parcel.obtain();
2810 Parcel reply = Parcel.obtain();
2811 data.writeInterfaceToken(IActivityManager.descriptor);
2812 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2813 reply.readException();
2814 ParcelFileDescriptor pfd = null;
2815 if (reply.readInt() != 0) {
2816 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2817 }
2818 data.recycle();
2819 reply.recycle();
2820 return pfd;
2821 }
2822 public void goingToSleep() throws RemoteException
2823 {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 data.recycle();
2830 reply.recycle();
2831 }
2832 public void wakingUp() throws RemoteException
2833 {
2834 Parcel data = Parcel.obtain();
2835 Parcel reply = Parcel.obtain();
2836 data.writeInterfaceToken(IActivityManager.descriptor);
2837 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 data.recycle();
2840 reply.recycle();
2841 }
2842 public void setDebugApp(
2843 String packageName, boolean waitForDebugger, boolean persistent)
2844 throws RemoteException
2845 {
2846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeString(packageName);
2850 data.writeInt(waitForDebugger ? 1 : 0);
2851 data.writeInt(persistent ? 1 : 0);
2852 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2853 reply.readException();
2854 data.recycle();
2855 reply.recycle();
2856 }
2857 public void setAlwaysFinish(boolean enabled) throws RemoteException
2858 {
2859 Parcel data = Parcel.obtain();
2860 Parcel reply = Parcel.obtain();
2861 data.writeInterfaceToken(IActivityManager.descriptor);
2862 data.writeInt(enabled ? 1 : 0);
2863 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 data.recycle();
2866 reply.recycle();
2867 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002868 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 {
2870 Parcel data = Parcel.obtain();
2871 Parcel reply = Parcel.obtain();
2872 data.writeInterfaceToken(IActivityManager.descriptor);
2873 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002874 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002875 reply.readException();
2876 data.recycle();
2877 reply.recycle();
2878 }
2879 public void enterSafeMode() throws RemoteException {
2880 Parcel data = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
2882 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2883 data.recycle();
2884 }
2885 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2886 Parcel data = Parcel.obtain();
2887 data.writeStrongBinder(sender.asBinder());
2888 data.writeInterfaceToken(IActivityManager.descriptor);
2889 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2890 data.recycle();
2891 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002892 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002897 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002898 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002899 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002900 boolean res = reply.readInt() != 0;
2901 data.recycle();
2902 reply.recycle();
2903 return res;
2904 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002905 public void startRunning(String pkg, String cls, String action,
2906 String indata) throws RemoteException {
2907 Parcel data = Parcel.obtain();
2908 Parcel reply = Parcel.obtain();
2909 data.writeInterfaceToken(IActivityManager.descriptor);
2910 data.writeString(pkg);
2911 data.writeString(cls);
2912 data.writeString(action);
2913 data.writeString(indata);
2914 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2915 reply.readException();
2916 data.recycle();
2917 reply.recycle();
2918 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002919 public boolean testIsSystemReady()
2920 {
2921 /* this base class version is never called */
2922 return true;
2923 }
Dan Egnor60d87622009-12-16 16:32:58 -08002924 public void handleApplicationCrash(IBinder app,
2925 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2926 {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(app);
2931 crashInfo.writeToParcel(data, 0);
2932 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2933 reply.readException();
2934 reply.recycle();
2935 data.recycle();
2936 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002937
Dan Egnor60d87622009-12-16 16:32:58 -08002938 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002939 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002940 {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002945 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002946 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002947 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002949 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002950 reply.recycle();
2951 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002952 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002953 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002954
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002955 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002956 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002957 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002958 {
2959 Parcel data = Parcel.obtain();
2960 Parcel reply = Parcel.obtain();
2961 data.writeInterfaceToken(IActivityManager.descriptor);
2962 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002963 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002964 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002965 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2966 reply.readException();
2967 reply.recycle();
2968 data.recycle();
2969 }
2970
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 public void signalPersistentProcesses(int sig) throws RemoteException {
2972 Parcel data = Parcel.obtain();
2973 Parcel reply = Parcel.obtain();
2974 data.writeInterfaceToken(IActivityManager.descriptor);
2975 data.writeInt(sig);
2976 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2977 reply.readException();
2978 data.recycle();
2979 reply.recycle();
2980 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08002981
Dianne Hackborn03abb812010-01-04 18:43:19 -08002982 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002983 Parcel data = Parcel.obtain();
2984 Parcel reply = Parcel.obtain();
2985 data.writeInterfaceToken(IActivityManager.descriptor);
2986 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002987 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2988 reply.readException();
2989 data.recycle();
2990 reply.recycle();
2991 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08002992
2993 public void killAllBackgroundProcesses() throws RemoteException {
2994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2998 reply.readException();
2999 data.recycle();
3000 reply.recycle();
3001 }
3002
Dianne Hackborn03abb812010-01-04 18:43:19 -08003003 public void forceStopPackage(String packageName) throws RemoteException {
3004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 data.writeString(packageName);
3008 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003009 reply.readException();
3010 data.recycle();
3011 reply.recycle();
3012 }
3013
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003014 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3015 throws RemoteException
3016 {
3017 Parcel data = Parcel.obtain();
3018 Parcel reply = Parcel.obtain();
3019 data.writeInterfaceToken(IActivityManager.descriptor);
3020 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3021 reply.readException();
3022 outInfo.readFromParcel(reply);
3023 reply.recycle();
3024 data.recycle();
3025 }
3026
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003027 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3028 {
3029 Parcel data = Parcel.obtain();
3030 Parcel reply = Parcel.obtain();
3031 data.writeInterfaceToken(IActivityManager.descriptor);
3032 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3033 reply.readException();
3034 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3035 reply.recycle();
3036 data.recycle();
3037 return res;
3038 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003039
3040 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003041 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003042 {
3043 Parcel data = Parcel.obtain();
3044 Parcel reply = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 data.writeString(process);
3047 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003048 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003049 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003050 if (fd != null) {
3051 data.writeInt(1);
3052 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3053 } else {
3054 data.writeInt(0);
3055 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003056 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3057 reply.readException();
3058 boolean res = reply.readInt() != 0;
3059 reply.recycle();
3060 data.recycle();
3061 return res;
3062 }
3063
Dianne Hackborn55280a92009-05-07 15:53:46 -07003064 public boolean shutdown(int timeout) throws RemoteException
3065 {
3066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
3069 data.writeInt(timeout);
3070 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 boolean res = reply.readInt() != 0;
3073 reply.recycle();
3074 data.recycle();
3075 return res;
3076 }
3077
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003078 public void stopAppSwitches() throws RemoteException {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 reply.recycle();
3085 data.recycle();
3086 }
3087
3088 public void resumeAppSwitches() throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3093 reply.readException();
3094 reply.recycle();
3095 data.recycle();
3096 }
3097
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003098 public int startActivityInPackage(int uid,
3099 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003100 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003101 throws RemoteException {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeInt(uid);
3106 intent.writeToParcel(data, 0);
3107 data.writeString(resolvedType);
3108 data.writeStrongBinder(resultTo);
3109 data.writeString(resultWho);
3110 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003111 data.writeInt(startFlags);
3112 if (options != null) {
3113 data.writeInt(1);
3114 options.writeToParcel(data, 0);
3115 } else {
3116 data.writeInt(0);
3117 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003118 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3119 reply.readException();
3120 int result = reply.readInt();
3121 reply.recycle();
3122 data.recycle();
3123 return result;
3124 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003125
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003126 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 data.writeString(pkg);
3131 data.writeInt(uid);
3132 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3133 reply.readException();
3134 data.recycle();
3135 reply.recycle();
3136 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003137
3138 public void closeSystemDialogs(String reason) throws RemoteException {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeString(reason);
3143 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3144 reply.readException();
3145 data.recycle();
3146 reply.recycle();
3147 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003148
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003149 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003150 throws RemoteException {
3151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003154 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003155 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3156 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003157 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003158 data.recycle();
3159 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003160 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003161 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003162
3163 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeString(processName);
3168 data.writeInt(uid);
3169 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 data.recycle();
3172 reply.recycle();
3173 }
3174
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003175 public void overridePendingTransition(IBinder token, String packageName,
3176 int enterAnim, int exitAnim) throws RemoteException {
3177 Parcel data = Parcel.obtain();
3178 Parcel reply = Parcel.obtain();
3179 data.writeInterfaceToken(IActivityManager.descriptor);
3180 data.writeStrongBinder(token);
3181 data.writeString(packageName);
3182 data.writeInt(enterAnim);
3183 data.writeInt(exitAnim);
3184 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3185 reply.readException();
3186 data.recycle();
3187 reply.recycle();
3188 }
3189
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003190 public boolean isUserAMonkey() throws RemoteException {
3191 Parcel data = Parcel.obtain();
3192 Parcel reply = Parcel.obtain();
3193 data.writeInterfaceToken(IActivityManager.descriptor);
3194 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3195 reply.readException();
3196 boolean res = reply.readInt() != 0;
3197 data.recycle();
3198 reply.recycle();
3199 return res;
3200 }
3201
Dianne Hackborn860755f2010-06-03 18:47:52 -07003202 public void finishHeavyWeightApp() throws RemoteException {
3203 Parcel data = Parcel.obtain();
3204 Parcel reply = Parcel.obtain();
3205 data.writeInterfaceToken(IActivityManager.descriptor);
3206 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3207 reply.readException();
3208 data.recycle();
3209 reply.recycle();
3210 }
3211
Daniel Sandler69a48172010-06-23 16:29:36 -04003212 public void setImmersive(IBinder token, boolean immersive)
3213 throws RemoteException {
3214 Parcel data = Parcel.obtain();
3215 Parcel reply = Parcel.obtain();
3216 data.writeInterfaceToken(IActivityManager.descriptor);
3217 data.writeStrongBinder(token);
3218 data.writeInt(immersive ? 1 : 0);
3219 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3220 reply.readException();
3221 data.recycle();
3222 reply.recycle();
3223 }
3224
3225 public boolean isImmersive(IBinder token)
3226 throws RemoteException {
3227 Parcel data = Parcel.obtain();
3228 Parcel reply = Parcel.obtain();
3229 data.writeInterfaceToken(IActivityManager.descriptor);
3230 data.writeStrongBinder(token);
3231 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003232 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003233 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003234 data.recycle();
3235 reply.recycle();
3236 return res;
3237 }
3238
3239 public boolean isTopActivityImmersive()
3240 throws RemoteException {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003245 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003246 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003247 data.recycle();
3248 reply.recycle();
3249 return res;
3250 }
3251
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003252 public void crashApplication(int uid, int initialPid, String packageName,
3253 String message) throws RemoteException {
3254 Parcel data = Parcel.obtain();
3255 Parcel reply = Parcel.obtain();
3256 data.writeInterfaceToken(IActivityManager.descriptor);
3257 data.writeInt(uid);
3258 data.writeInt(initialPid);
3259 data.writeString(packageName);
3260 data.writeString(message);
3261 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3262 reply.readException();
3263 data.recycle();
3264 reply.recycle();
3265 }
Andy McFadden824c5102010-07-09 16:26:57 -07003266
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003267 public String getProviderMimeType(Uri uri)
3268 throws RemoteException {
3269 Parcel data = Parcel.obtain();
3270 Parcel reply = Parcel.obtain();
3271 data.writeInterfaceToken(IActivityManager.descriptor);
3272 uri.writeToParcel(data, 0);
3273 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3274 reply.readException();
3275 String res = reply.readString();
3276 data.recycle();
3277 reply.recycle();
3278 return res;
3279 }
3280
Dianne Hackborn7e269642010-08-25 19:50:20 -07003281 public IBinder newUriPermissionOwner(String name)
3282 throws RemoteException {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeString(name);
3287 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3288 reply.readException();
3289 IBinder res = reply.readStrongBinder();
3290 data.recycle();
3291 reply.recycle();
3292 return res;
3293 }
3294
3295 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3296 Uri uri, int mode) throws RemoteException {
3297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 data.writeStrongBinder(owner);
3301 data.writeInt(fromUid);
3302 data.writeString(targetPkg);
3303 uri.writeToParcel(data, 0);
3304 data.writeInt(mode);
3305 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3306 reply.readException();
3307 data.recycle();
3308 reply.recycle();
3309 }
3310
3311 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3312 int mode) throws RemoteException {
3313 Parcel data = Parcel.obtain();
3314 Parcel reply = Parcel.obtain();
3315 data.writeInterfaceToken(IActivityManager.descriptor);
3316 data.writeStrongBinder(owner);
3317 if (uri != null) {
3318 data.writeInt(1);
3319 uri.writeToParcel(data, 0);
3320 } else {
3321 data.writeInt(0);
3322 }
3323 data.writeInt(mode);
3324 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3325 reply.readException();
3326 data.recycle();
3327 reply.recycle();
3328 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003329
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003330 public int checkGrantUriPermission(int callingUid, String targetPkg,
3331 Uri uri, int modeFlags) throws RemoteException {
3332 Parcel data = Parcel.obtain();
3333 Parcel reply = Parcel.obtain();
3334 data.writeInterfaceToken(IActivityManager.descriptor);
3335 data.writeInt(callingUid);
3336 data.writeString(targetPkg);
3337 uri.writeToParcel(data, 0);
3338 data.writeInt(modeFlags);
3339 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 int res = reply.readInt();
3342 data.recycle();
3343 reply.recycle();
3344 return res;
3345 }
3346
Andy McFadden824c5102010-07-09 16:26:57 -07003347 public boolean dumpHeap(String process, boolean managed,
3348 String path, ParcelFileDescriptor fd) throws RemoteException {
3349 Parcel data = Parcel.obtain();
3350 Parcel reply = Parcel.obtain();
3351 data.writeInterfaceToken(IActivityManager.descriptor);
3352 data.writeString(process);
3353 data.writeInt(managed ? 1 : 0);
3354 data.writeString(path);
3355 if (fd != null) {
3356 data.writeInt(1);
3357 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3358 } else {
3359 data.writeInt(0);
3360 }
3361 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3362 reply.readException();
3363 boolean res = reply.readInt() != 0;
3364 reply.recycle();
3365 data.recycle();
3366 return res;
3367 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003368
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003369 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003370 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3371 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3376 data.writeTypedArray(intents, 0);
3377 data.writeStringArray(resolvedTypes);
3378 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003379 if (options != null) {
3380 data.writeInt(1);
3381 options.writeToParcel(data, 0);
3382 } else {
3383 data.writeInt(0);
3384 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003385 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3386 reply.readException();
3387 int result = reply.readInt();
3388 reply.recycle();
3389 data.recycle();
3390 return result;
3391 }
3392
3393 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003394 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3395 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeInt(uid);
3400 data.writeTypedArray(intents, 0);
3401 data.writeStringArray(resolvedTypes);
3402 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003403 if (options != null) {
3404 data.writeInt(1);
3405 options.writeToParcel(data, 0);
3406 } else {
3407 data.writeInt(0);
3408 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003409 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 int result = reply.readInt();
3412 reply.recycle();
3413 data.recycle();
3414 return result;
3415 }
3416
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003417 public int getFrontActivityScreenCompatMode() throws RemoteException {
3418 Parcel data = Parcel.obtain();
3419 Parcel reply = Parcel.obtain();
3420 data.writeInterfaceToken(IActivityManager.descriptor);
3421 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3422 reply.readException();
3423 int mode = reply.readInt();
3424 reply.recycle();
3425 data.recycle();
3426 return mode;
3427 }
3428
3429 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 data.writeInt(mode);
3434 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3435 reply.readException();
3436 reply.recycle();
3437 data.recycle();
3438 }
3439
3440 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003444 data.writeString(packageName);
3445 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003446 reply.readException();
3447 int mode = reply.readInt();
3448 reply.recycle();
3449 data.recycle();
3450 return mode;
3451 }
3452
3453 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003454 throws RemoteException {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003459 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003460 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3461 reply.readException();
3462 reply.recycle();
3463 data.recycle();
3464 }
3465
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003466 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 data.writeString(packageName);
3471 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3472 reply.readException();
3473 boolean ask = reply.readInt() != 0;
3474 reply.recycle();
3475 data.recycle();
3476 return ask;
3477 }
3478
3479 public void setPackageAskScreenCompat(String packageName, boolean ask)
3480 throws RemoteException {
3481 Parcel data = Parcel.obtain();
3482 Parcel reply = Parcel.obtain();
3483 data.writeInterfaceToken(IActivityManager.descriptor);
3484 data.writeString(packageName);
3485 data.writeInt(ask ? 1 : 0);
3486 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 reply.recycle();
3489 data.recycle();
3490 }
3491
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003492 public boolean switchUser(int userid) throws RemoteException {
3493 Parcel data = Parcel.obtain();
3494 Parcel reply = Parcel.obtain();
3495 data.writeInterfaceToken(IActivityManager.descriptor);
3496 data.writeInt(userid);
3497 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 boolean result = reply.readInt() != 0;
3500 reply.recycle();
3501 data.recycle();
3502 return result;
3503 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003504
3505 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3506 Parcel data = Parcel.obtain();
3507 Parcel reply = Parcel.obtain();
3508 data.writeInterfaceToken(IActivityManager.descriptor);
3509 data.writeInt(taskId);
3510 data.writeInt(subTaskIndex);
3511 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3512 reply.readException();
3513 boolean result = reply.readInt() != 0;
3514 reply.recycle();
3515 data.recycle();
3516 return result;
3517 }
3518
3519 public boolean removeTask(int taskId, int flags) throws RemoteException {
3520 Parcel data = Parcel.obtain();
3521 Parcel reply = Parcel.obtain();
3522 data.writeInterfaceToken(IActivityManager.descriptor);
3523 data.writeInt(taskId);
3524 data.writeInt(flags);
3525 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 boolean result = reply.readInt() != 0;
3528 reply.recycle();
3529 data.recycle();
3530 return result;
3531 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003532
Jeff Sharkeya4620792011-05-20 15:29:23 -07003533 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3538 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3539 reply.readException();
3540 data.recycle();
3541 reply.recycle();
3542 }
3543
3544 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3549 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 data.recycle();
3552 reply.recycle();
3553 }
3554
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003555 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3556 Parcel data = Parcel.obtain();
3557 Parcel reply = Parcel.obtain();
3558 data.writeInterfaceToken(IActivityManager.descriptor);
3559 data.writeStrongBinder(sender.asBinder());
3560 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3561 reply.readException();
3562 boolean res = reply.readInt() != 0;
3563 data.recycle();
3564 reply.recycle();
3565 return res;
3566 }
3567
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003568 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3569 {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 values.writeToParcel(data, 0);
3574 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 data.recycle();
3577 reply.recycle();
3578 }
3579
Dianne Hackbornb437e092011-08-05 17:50:29 -07003580 public long[] getProcessPss(int[] pids) throws RemoteException {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 data.writeIntArray(pids);
3585 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3586 reply.readException();
3587 long[] res = reply.createLongArray();
3588 data.recycle();
3589 reply.recycle();
3590 return res;
3591 }
3592
Dianne Hackborn661cd522011-08-22 00:26:20 -07003593 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 TextUtils.writeToParcel(msg, data, 0);
3598 data.writeInt(always ? 1 : 0);
3599 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 data.recycle();
3602 reply.recycle();
3603 }
3604
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003605 public void dismissKeyguardOnNextActivity() throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3610 reply.readException();
3611 data.recycle();
3612 reply.recycle();
3613 }
3614
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003615 private IBinder mRemote;
3616}