blob: c000bdfcb11c375c16e2bcd5c5c967044fc7f902 [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();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700513 Bundle options = data.readInt() != 0
514 ? Bundle.CREATOR.createFromParcel(data) : null;
515 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800516 reply.writeNoException();
517 return true;
518 }
519
520 case MOVE_TASK_TO_BACK_TRANSACTION: {
521 data.enforceInterface(IActivityManager.descriptor);
522 int task = data.readInt();
523 moveTaskToBack(task);
524 reply.writeNoException();
525 return true;
526 }
527
528 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
529 data.enforceInterface(IActivityManager.descriptor);
530 IBinder token = data.readStrongBinder();
531 boolean nonRoot = data.readInt() != 0;
532 boolean res = moveActivityTaskToBack(token, nonRoot);
533 reply.writeNoException();
534 reply.writeInt(res ? 1 : 0);
535 return true;
536 }
537
538 case MOVE_TASK_BACKWARDS_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 int task = data.readInt();
541 moveTaskBackwards(task);
542 reply.writeNoException();
543 return true;
544 }
545
546 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
547 data.enforceInterface(IActivityManager.descriptor);
548 IBinder token = data.readStrongBinder();
549 boolean onlyRoot = data.readInt() != 0;
550 int res = token != null
551 ? getTaskForActivity(token, onlyRoot) : -1;
552 reply.writeNoException();
553 reply.writeInt(res);
554 return true;
555 }
556
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800557 case REPORT_THUMBNAIL_TRANSACTION: {
558 data.enforceInterface(IActivityManager.descriptor);
559 IBinder token = data.readStrongBinder();
560 Bitmap thumbnail = data.readInt() != 0
561 ? Bitmap.CREATOR.createFromParcel(data) : null;
562 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
563 reportThumbnail(token, thumbnail, description);
564 reply.writeNoException();
565 return true;
566 }
567
568 case GET_CONTENT_PROVIDER_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 IBinder b = data.readStrongBinder();
571 IApplicationThread app = ApplicationThreadNative.asInterface(b);
572 String name = data.readString();
573 ContentProviderHolder cph = getContentProvider(app, name);
574 reply.writeNoException();
575 if (cph != null) {
576 reply.writeInt(1);
577 cph.writeToParcel(reply, 0);
578 } else {
579 reply.writeInt(0);
580 }
581 return true;
582 }
583
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800584 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
585 data.enforceInterface(IActivityManager.descriptor);
586 String name = data.readString();
587 IBinder token = data.readStrongBinder();
588 ContentProviderHolder cph = getContentProviderExternal(name, token);
589 reply.writeNoException();
590 if (cph != null) {
591 reply.writeInt(1);
592 cph.writeToParcel(reply, 0);
593 } else {
594 reply.writeInt(0);
595 }
596 return true;
597 }
598
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
600 data.enforceInterface(IActivityManager.descriptor);
601 IBinder b = data.readStrongBinder();
602 IApplicationThread app = ApplicationThreadNative.asInterface(b);
603 ArrayList<ContentProviderHolder> providers =
604 data.createTypedArrayList(ContentProviderHolder.CREATOR);
605 publishContentProviders(app, providers);
606 reply.writeNoException();
607 return true;
608 }
609
610 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
611 data.enforceInterface(IActivityManager.descriptor);
612 IBinder b = data.readStrongBinder();
613 IApplicationThread app = ApplicationThreadNative.asInterface(b);
614 String name = data.readString();
615 removeContentProvider(app, name);
616 reply.writeNoException();
617 return true;
618 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800619
620 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 String name = data.readString();
623 IBinder token = data.readStrongBinder();
624 removeContentProviderExternal(name, token);
625 reply.writeNoException();
626 return true;
627 }
628
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700629 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
630 data.enforceInterface(IActivityManager.descriptor);
631 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
632 PendingIntent pi = getRunningServiceControlPanel(comp);
633 reply.writeNoException();
634 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
635 return true;
636 }
637
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 case START_SERVICE_TRANSACTION: {
639 data.enforceInterface(IActivityManager.descriptor);
640 IBinder b = data.readStrongBinder();
641 IApplicationThread app = ApplicationThreadNative.asInterface(b);
642 Intent service = Intent.CREATOR.createFromParcel(data);
643 String resolvedType = data.readString();
644 ComponentName cn = startService(app, service, resolvedType);
645 reply.writeNoException();
646 ComponentName.writeToParcel(cn, reply);
647 return true;
648 }
649
650 case STOP_SERVICE_TRANSACTION: {
651 data.enforceInterface(IActivityManager.descriptor);
652 IBinder b = data.readStrongBinder();
653 IApplicationThread app = ApplicationThreadNative.asInterface(b);
654 Intent service = Intent.CREATOR.createFromParcel(data);
655 String resolvedType = data.readString();
656 int res = stopService(app, service, resolvedType);
657 reply.writeNoException();
658 reply.writeInt(res);
659 return true;
660 }
661
662 case STOP_SERVICE_TOKEN_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 ComponentName className = ComponentName.readFromParcel(data);
665 IBinder token = data.readStrongBinder();
666 int startId = data.readInt();
667 boolean res = stopServiceToken(className, token, startId);
668 reply.writeNoException();
669 reply.writeInt(res ? 1 : 0);
670 return true;
671 }
672
673 case SET_SERVICE_FOREGROUND_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 ComponentName className = ComponentName.readFromParcel(data);
676 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700677 int id = data.readInt();
678 Notification notification = null;
679 if (data.readInt() != 0) {
680 notification = Notification.CREATOR.createFromParcel(data);
681 }
682 boolean removeNotification = data.readInt() != 0;
683 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800684 reply.writeNoException();
685 return true;
686 }
687
688 case BIND_SERVICE_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 IBinder b = data.readStrongBinder();
691 IApplicationThread app = ApplicationThreadNative.asInterface(b);
692 IBinder token = data.readStrongBinder();
693 Intent service = Intent.CREATOR.createFromParcel(data);
694 String resolvedType = data.readString();
695 b = data.readStrongBinder();
696 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800697 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800698 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800699 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800700 reply.writeNoException();
701 reply.writeInt(res);
702 return true;
703 }
704
705 case UNBIND_SERVICE_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 IBinder b = data.readStrongBinder();
708 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
709 boolean res = unbindService(conn);
710 reply.writeNoException();
711 reply.writeInt(res ? 1 : 0);
712 return true;
713 }
714
715 case PUBLISH_SERVICE_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 IBinder token = data.readStrongBinder();
718 Intent intent = Intent.CREATOR.createFromParcel(data);
719 IBinder service = data.readStrongBinder();
720 publishService(token, intent, service);
721 reply.writeNoException();
722 return true;
723 }
724
725 case UNBIND_FINISHED_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 IBinder token = data.readStrongBinder();
728 Intent intent = Intent.CREATOR.createFromParcel(data);
729 boolean doRebind = data.readInt() != 0;
730 unbindFinished(token, intent, doRebind);
731 reply.writeNoException();
732 return true;
733 }
734
735 case SERVICE_DONE_EXECUTING_TRANSACTION: {
736 data.enforceInterface(IActivityManager.descriptor);
737 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700738 int type = data.readInt();
739 int startId = data.readInt();
740 int res = data.readInt();
741 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742 reply.writeNoException();
743 return true;
744 }
745
746 case START_INSTRUMENTATION_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 ComponentName className = ComponentName.readFromParcel(data);
749 String profileFile = data.readString();
750 int fl = data.readInt();
751 Bundle arguments = data.readBundle();
752 IBinder b = data.readStrongBinder();
753 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
754 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
755 reply.writeNoException();
756 reply.writeInt(res ? 1 : 0);
757 return true;
758 }
759
760
761 case FINISH_INSTRUMENTATION_TRANSACTION: {
762 data.enforceInterface(IActivityManager.descriptor);
763 IBinder b = data.readStrongBinder();
764 IApplicationThread app = ApplicationThreadNative.asInterface(b);
765 int resultCode = data.readInt();
766 Bundle results = data.readBundle();
767 finishInstrumentation(app, resultCode, results);
768 reply.writeNoException();
769 return true;
770 }
771
772 case GET_CONFIGURATION_TRANSACTION: {
773 data.enforceInterface(IActivityManager.descriptor);
774 Configuration config = getConfiguration();
775 reply.writeNoException();
776 config.writeToParcel(reply, 0);
777 return true;
778 }
779
780 case UPDATE_CONFIGURATION_TRANSACTION: {
781 data.enforceInterface(IActivityManager.descriptor);
782 Configuration config = Configuration.CREATOR.createFromParcel(data);
783 updateConfiguration(config);
784 reply.writeNoException();
785 return true;
786 }
787
788 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder token = data.readStrongBinder();
791 int requestedOrientation = data.readInt();
792 setRequestedOrientation(token, requestedOrientation);
793 reply.writeNoException();
794 return true;
795 }
796
797 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
798 data.enforceInterface(IActivityManager.descriptor);
799 IBinder token = data.readStrongBinder();
800 int req = getRequestedOrientation(token);
801 reply.writeNoException();
802 reply.writeInt(req);
803 return true;
804 }
805
806 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
807 data.enforceInterface(IActivityManager.descriptor);
808 IBinder token = data.readStrongBinder();
809 ComponentName cn = getActivityClassForToken(token);
810 reply.writeNoException();
811 ComponentName.writeToParcel(cn, reply);
812 return true;
813 }
814
815 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 IBinder token = data.readStrongBinder();
818 reply.writeNoException();
819 reply.writeString(getPackageForToken(token));
820 return true;
821 }
822
823 case GET_INTENT_SENDER_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 int type = data.readInt();
826 String packageName = data.readString();
827 IBinder token = data.readStrongBinder();
828 String resultWho = data.readString();
829 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800830 Intent[] requestIntents;
831 String[] requestResolvedTypes;
832 if (data.readInt() != 0) {
833 requestIntents = data.createTypedArray(Intent.CREATOR);
834 requestResolvedTypes = data.createStringArray();
835 } else {
836 requestIntents = null;
837 requestResolvedTypes = null;
838 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800839 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700840 Bundle options = data.readInt() != 0
841 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800842 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800843 resultWho, requestCode, requestIntents,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700844 requestResolvedTypes, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800845 reply.writeNoException();
846 reply.writeStrongBinder(res != null ? res.asBinder() : null);
847 return true;
848 }
849
850 case CANCEL_INTENT_SENDER_TRANSACTION: {
851 data.enforceInterface(IActivityManager.descriptor);
852 IIntentSender r = IIntentSender.Stub.asInterface(
853 data.readStrongBinder());
854 cancelIntentSender(r);
855 reply.writeNoException();
856 return true;
857 }
858
859 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 IIntentSender r = IIntentSender.Stub.asInterface(
862 data.readStrongBinder());
863 String res = getPackageForIntentSender(r);
864 reply.writeNoException();
865 reply.writeString(res);
866 return true;
867 }
868
869 case SET_PROCESS_LIMIT_TRANSACTION: {
870 data.enforceInterface(IActivityManager.descriptor);
871 int max = data.readInt();
872 setProcessLimit(max);
873 reply.writeNoException();
874 return true;
875 }
876
877 case GET_PROCESS_LIMIT_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 int limit = getProcessLimit();
880 reply.writeNoException();
881 reply.writeInt(limit);
882 return true;
883 }
884
885 case SET_PROCESS_FOREGROUND_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder token = data.readStrongBinder();
888 int pid = data.readInt();
889 boolean isForeground = data.readInt() != 0;
890 setProcessForeground(token, pid, isForeground);
891 reply.writeNoException();
892 return true;
893 }
894
895 case CHECK_PERMISSION_TRANSACTION: {
896 data.enforceInterface(IActivityManager.descriptor);
897 String perm = data.readString();
898 int pid = data.readInt();
899 int uid = data.readInt();
900 int res = checkPermission(perm, pid, uid);
901 reply.writeNoException();
902 reply.writeInt(res);
903 return true;
904 }
905
906 case CHECK_URI_PERMISSION_TRANSACTION: {
907 data.enforceInterface(IActivityManager.descriptor);
908 Uri uri = Uri.CREATOR.createFromParcel(data);
909 int pid = data.readInt();
910 int uid = data.readInt();
911 int mode = data.readInt();
912 int res = checkUriPermission(uri, pid, uid, mode);
913 reply.writeNoException();
914 reply.writeInt(res);
915 return true;
916 }
917
918 case CLEAR_APP_DATA_TRANSACTION: {
919 data.enforceInterface(IActivityManager.descriptor);
920 String packageName = data.readString();
921 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
922 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -0700923 int userId = data.readInt();
924 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 reply.writeNoException();
926 reply.writeInt(res ? 1 : 0);
927 return true;
928 }
929
930 case GRANT_URI_PERMISSION_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 IBinder b = data.readStrongBinder();
933 IApplicationThread app = ApplicationThreadNative.asInterface(b);
934 String targetPkg = data.readString();
935 Uri uri = Uri.CREATOR.createFromParcel(data);
936 int mode = data.readInt();
937 grantUriPermission(app, targetPkg, uri, mode);
938 reply.writeNoException();
939 return true;
940 }
941
942 case REVOKE_URI_PERMISSION_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 IBinder b = data.readStrongBinder();
945 IApplicationThread app = ApplicationThreadNative.asInterface(b);
946 Uri uri = Uri.CREATOR.createFromParcel(data);
947 int mode = data.readInt();
948 revokeUriPermission(app, uri, mode);
949 reply.writeNoException();
950 return true;
951 }
952
953 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
954 data.enforceInterface(IActivityManager.descriptor);
955 IBinder b = data.readStrongBinder();
956 IApplicationThread app = ApplicationThreadNative.asInterface(b);
957 boolean waiting = data.readInt() != 0;
958 showWaitingForDebugger(app, waiting);
959 reply.writeNoException();
960 return true;
961 }
962
963 case GET_MEMORY_INFO_TRANSACTION: {
964 data.enforceInterface(IActivityManager.descriptor);
965 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
966 getMemoryInfo(mi);
967 reply.writeNoException();
968 mi.writeToParcel(reply, 0);
969 return true;
970 }
971
972 case UNHANDLED_BACK_TRANSACTION: {
973 data.enforceInterface(IActivityManager.descriptor);
974 unhandledBack();
975 reply.writeNoException();
976 return true;
977 }
978
979 case OPEN_CONTENT_URI_TRANSACTION: {
980 data.enforceInterface(IActivityManager.descriptor);
981 Uri uri = Uri.parse(data.readString());
982 ParcelFileDescriptor pfd = openContentUri(uri);
983 reply.writeNoException();
984 if (pfd != null) {
985 reply.writeInt(1);
986 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
987 } else {
988 reply.writeInt(0);
989 }
990 return true;
991 }
992
993 case GOING_TO_SLEEP_TRANSACTION: {
994 data.enforceInterface(IActivityManager.descriptor);
995 goingToSleep();
996 reply.writeNoException();
997 return true;
998 }
999
1000 case WAKING_UP_TRANSACTION: {
1001 data.enforceInterface(IActivityManager.descriptor);
1002 wakingUp();
1003 reply.writeNoException();
1004 return true;
1005 }
1006
1007 case SET_DEBUG_APP_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 String pn = data.readString();
1010 boolean wfd = data.readInt() != 0;
1011 boolean per = data.readInt() != 0;
1012 setDebugApp(pn, wfd, per);
1013 reply.writeNoException();
1014 return true;
1015 }
1016
1017 case SET_ALWAYS_FINISH_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 boolean enabled = data.readInt() != 0;
1020 setAlwaysFinish(enabled);
1021 reply.writeNoException();
1022 return true;
1023 }
1024
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001025 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001026 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001027 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001028 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001029 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001030 return true;
1031 }
1032
1033 case ENTER_SAFE_MODE_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 enterSafeMode();
1036 reply.writeNoException();
1037 return true;
1038 }
1039
1040 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IIntentSender is = IIntentSender.Stub.asInterface(
1043 data.readStrongBinder());
1044 noteWakeupAlarm(is);
1045 reply.writeNoException();
1046 return true;
1047 }
1048
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001049 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001050 data.enforceInterface(IActivityManager.descriptor);
1051 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001052 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001053 boolean secure = data.readInt() != 0;
1054 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 reply.writeNoException();
1056 reply.writeInt(res ? 1 : 0);
1057 return true;
1058 }
1059
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001060 case START_RUNNING_TRANSACTION: {
1061 data.enforceInterface(IActivityManager.descriptor);
1062 String pkg = data.readString();
1063 String cls = data.readString();
1064 String action = data.readString();
1065 String indata = data.readString();
1066 startRunning(pkg, cls, action, indata);
1067 reply.writeNoException();
1068 return true;
1069 }
1070
Dan Egnor60d87622009-12-16 16:32:58 -08001071 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1072 data.enforceInterface(IActivityManager.descriptor);
1073 IBinder app = data.readStrongBinder();
1074 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1075 handleApplicationCrash(app, ci);
1076 reply.writeNoException();
1077 return true;
1078 }
1079
1080 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001081 data.enforceInterface(IActivityManager.descriptor);
1082 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001083 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001084 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001085 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001086 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001087 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001088 return true;
1089 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001090
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001091 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1092 data.enforceInterface(IActivityManager.descriptor);
1093 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001094 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001095 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1096 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001097 reply.writeNoException();
1098 return true;
1099 }
1100
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001101 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 int sig = data.readInt();
1104 signalPersistentProcesses(sig);
1105 reply.writeNoException();
1106 return true;
1107 }
1108
Dianne Hackborn03abb812010-01-04 18:43:19 -08001109 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1110 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001111 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001112 killBackgroundProcesses(packageName);
1113 reply.writeNoException();
1114 return true;
1115 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001116
1117 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1118 data.enforceInterface(IActivityManager.descriptor);
1119 killAllBackgroundProcesses();
1120 reply.writeNoException();
1121 return true;
1122 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001123
1124 case FORCE_STOP_PACKAGE_TRANSACTION: {
1125 data.enforceInterface(IActivityManager.descriptor);
1126 String packageName = data.readString();
1127 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001128 reply.writeNoException();
1129 return true;
1130 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001131
1132 case GET_MY_MEMORY_STATE_TRANSACTION: {
1133 data.enforceInterface(IActivityManager.descriptor);
1134 ActivityManager.RunningAppProcessInfo info =
1135 new ActivityManager.RunningAppProcessInfo();
1136 getMyMemoryState(info);
1137 reply.writeNoException();
1138 info.writeToParcel(reply, 0);
1139 return true;
1140 }
1141
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 ConfigurationInfo config = getDeviceConfigurationInfo();
1145 reply.writeNoException();
1146 config.writeToParcel(reply, 0);
1147 return true;
1148 }
1149
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001150 case PROFILE_CONTROL_TRANSACTION: {
1151 data.enforceInterface(IActivityManager.descriptor);
1152 String process = data.readString();
1153 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001154 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001155 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001156 ParcelFileDescriptor fd = data.readInt() != 0
1157 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001158 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001159 reply.writeNoException();
1160 reply.writeInt(res ? 1 : 0);
1161 return true;
1162 }
1163
Dianne Hackborn55280a92009-05-07 15:53:46 -07001164 case SHUTDOWN_TRANSACTION: {
1165 data.enforceInterface(IActivityManager.descriptor);
1166 boolean res = shutdown(data.readInt());
1167 reply.writeNoException();
1168 reply.writeInt(res ? 1 : 0);
1169 return true;
1170 }
1171
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001172 case STOP_APP_SWITCHES_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 stopAppSwitches();
1175 reply.writeNoException();
1176 return true;
1177 }
1178
1179 case RESUME_APP_SWITCHES_TRANSACTION: {
1180 data.enforceInterface(IActivityManager.descriptor);
1181 resumeAppSwitches();
1182 reply.writeNoException();
1183 return true;
1184 }
1185
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 case PEEK_SERVICE_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 Intent service = Intent.CREATOR.createFromParcel(data);
1189 String resolvedType = data.readString();
1190 IBinder binder = peekService(service, resolvedType);
1191 reply.writeNoException();
1192 reply.writeStrongBinder(binder);
1193 return true;
1194 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001195
1196 case START_BACKUP_AGENT_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1199 int backupRestoreMode = data.readInt();
1200 boolean success = bindBackupAgent(info, backupRestoreMode);
1201 reply.writeNoException();
1202 reply.writeInt(success ? 1 : 0);
1203 return true;
1204 }
1205
1206 case BACKUP_AGENT_CREATED_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 String packageName = data.readString();
1209 IBinder agent = data.readStrongBinder();
1210 backupAgentCreated(packageName, agent);
1211 reply.writeNoException();
1212 return true;
1213 }
1214
1215 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1216 data.enforceInterface(IActivityManager.descriptor);
1217 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1218 unbindBackupAgent(info);
1219 reply.writeNoException();
1220 return true;
1221 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001222
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001223 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1224 {
1225 data.enforceInterface(IActivityManager.descriptor);
1226 int uid = data.readInt();
1227 Intent intent = Intent.CREATOR.createFromParcel(data);
1228 String resolvedType = data.readString();
1229 IBinder resultTo = data.readStrongBinder();
1230 String resultWho = data.readString();
1231 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001232 int startFlags = data.readInt();
1233 Bundle options = data.readInt() != 0
1234 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001235 int result = startActivityInPackage(uid, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001236 resultTo, resultWho, requestCode, startFlags, options);
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001237 reply.writeNoException();
1238 reply.writeInt(result);
1239 return true;
1240 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001241
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001242 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 String pkg = data.readString();
1245 int uid = data.readInt();
1246 killApplicationWithUid(pkg, uid);
1247 reply.writeNoException();
1248 return true;
1249 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001250
1251 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1252 data.enforceInterface(IActivityManager.descriptor);
1253 String reason = data.readString();
1254 closeSystemDialogs(reason);
1255 reply.writeNoException();
1256 return true;
1257 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001258
1259 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001261 int[] pids = data.createIntArray();
1262 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001263 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001264 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001265 return true;
1266 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001267
1268 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 String processName = data.readString();
1271 int uid = data.readInt();
1272 killApplicationProcess(processName, uid);
1273 reply.writeNoException();
1274 return true;
1275 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001276
1277 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 IBinder token = data.readStrongBinder();
1280 String packageName = data.readString();
1281 int enterAnim = data.readInt();
1282 int exitAnim = data.readInt();
1283 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001284 reply.writeNoException();
1285 return true;
1286 }
1287
1288 case IS_USER_A_MONKEY_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001290 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001291 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001292 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001293 return true;
1294 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001295
1296 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 finishHeavyWeightApp();
1299 reply.writeNoException();
1300 return true;
1301 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001302
1303 case IS_IMMERSIVE_TRANSACTION: {
1304 data.enforceInterface(IActivityManager.descriptor);
1305 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001306 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001307 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001308 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001309 return true;
1310 }
1311
1312 case SET_IMMERSIVE_TRANSACTION: {
1313 data.enforceInterface(IActivityManager.descriptor);
1314 IBinder token = data.readStrongBinder();
1315 boolean imm = data.readInt() == 1;
1316 setImmersive(token, imm);
1317 reply.writeNoException();
1318 return true;
1319 }
1320
1321 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1322 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001323 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001324 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001325 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001326 return true;
1327 }
1328
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001329 case CRASH_APPLICATION_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 int uid = data.readInt();
1332 int initialPid = data.readInt();
1333 String packageName = data.readString();
1334 String message = data.readString();
1335 crashApplication(uid, initialPid, packageName, message);
1336 reply.writeNoException();
1337 return true;
1338 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001339
1340 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1341 data.enforceInterface(IActivityManager.descriptor);
1342 Uri uri = Uri.CREATOR.createFromParcel(data);
1343 String type = getProviderMimeType(uri);
1344 reply.writeNoException();
1345 reply.writeString(type);
1346 return true;
1347 }
1348
Dianne Hackborn7e269642010-08-25 19:50:20 -07001349 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1350 data.enforceInterface(IActivityManager.descriptor);
1351 String name = data.readString();
1352 IBinder perm = newUriPermissionOwner(name);
1353 reply.writeNoException();
1354 reply.writeStrongBinder(perm);
1355 return true;
1356 }
1357
1358 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1359 data.enforceInterface(IActivityManager.descriptor);
1360 IBinder owner = data.readStrongBinder();
1361 int fromUid = data.readInt();
1362 String targetPkg = data.readString();
1363 Uri uri = Uri.CREATOR.createFromParcel(data);
1364 int mode = data.readInt();
1365 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1366 reply.writeNoException();
1367 return true;
1368 }
1369
1370 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1371 data.enforceInterface(IActivityManager.descriptor);
1372 IBinder owner = data.readStrongBinder();
1373 Uri uri = null;
1374 if (data.readInt() != 0) {
1375 Uri.CREATOR.createFromParcel(data);
1376 }
1377 int mode = data.readInt();
1378 revokeUriPermissionFromOwner(owner, uri, mode);
1379 reply.writeNoException();
1380 return true;
1381 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001382
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001383 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1384 data.enforceInterface(IActivityManager.descriptor);
1385 int callingUid = data.readInt();
1386 String targetPkg = data.readString();
1387 Uri uri = Uri.CREATOR.createFromParcel(data);
1388 int modeFlags = data.readInt();
1389 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1390 reply.writeNoException();
1391 reply.writeInt(res);
1392 return true;
1393 }
1394
Andy McFadden824c5102010-07-09 16:26:57 -07001395 case DUMP_HEAP_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 String process = data.readString();
1398 boolean managed = data.readInt() != 0;
1399 String path = data.readString();
1400 ParcelFileDescriptor fd = data.readInt() != 0
1401 ? data.readFileDescriptor() : null;
1402 boolean res = dumpHeap(process, managed, path, fd);
1403 reply.writeNoException();
1404 reply.writeInt(res ? 1 : 0);
1405 return true;
1406 }
1407
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001408 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1409 {
1410 data.enforceInterface(IActivityManager.descriptor);
1411 int uid = data.readInt();
1412 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1413 String[] resolvedTypes = data.createStringArray();
1414 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001415 Bundle options = data.readInt() != 0
1416 ? Bundle.CREATOR.createFromParcel(data) : null;
1417 int result = startActivitiesInPackage(uid, intents, resolvedTypes,
1418 resultTo, options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001419 reply.writeNoException();
1420 reply.writeInt(result);
1421 return true;
1422 }
1423
1424 case START_ACTIVITIES_TRANSACTION:
1425 {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 IBinder b = data.readStrongBinder();
1428 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1429 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1430 String[] resolvedTypes = data.createStringArray();
1431 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001432 Bundle options = data.readInt() != 0
1433 ? Bundle.CREATOR.createFromParcel(data) : null;
1434 int result = startActivities(app, intents, resolvedTypes, resultTo,
1435 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001436 reply.writeNoException();
1437 reply.writeInt(result);
1438 return true;
1439 }
1440
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001441 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1442 {
1443 data.enforceInterface(IActivityManager.descriptor);
1444 int mode = getFrontActivityScreenCompatMode();
1445 reply.writeNoException();
1446 reply.writeInt(mode);
1447 return true;
1448 }
1449
1450 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1451 {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 int mode = data.readInt();
1454 setFrontActivityScreenCompatMode(mode);
1455 reply.writeNoException();
1456 reply.writeInt(mode);
1457 return true;
1458 }
1459
1460 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1461 {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 String pkg = data.readString();
1464 int mode = getPackageScreenCompatMode(pkg);
1465 reply.writeNoException();
1466 reply.writeInt(mode);
1467 return true;
1468 }
1469
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001470 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1471 {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001474 int mode = data.readInt();
1475 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001476 reply.writeNoException();
1477 return true;
1478 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001479
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001480 case SWITCH_USER_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 int userid = data.readInt();
1483 boolean result = switchUser(userid);
1484 reply.writeNoException();
1485 reply.writeInt(result ? 1 : 0);
1486 return true;
1487 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001488
1489 case REMOVE_SUB_TASK_TRANSACTION:
1490 {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 int taskId = data.readInt();
1493 int subTaskIndex = data.readInt();
1494 boolean result = removeSubTask(taskId, subTaskIndex);
1495 reply.writeNoException();
1496 reply.writeInt(result ? 1 : 0);
1497 return true;
1498 }
1499
1500 case REMOVE_TASK_TRANSACTION:
1501 {
1502 data.enforceInterface(IActivityManager.descriptor);
1503 int taskId = data.readInt();
1504 int fl = data.readInt();
1505 boolean result = removeTask(taskId, fl);
1506 reply.writeNoException();
1507 reply.writeInt(result ? 1 : 0);
1508 return true;
1509 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001510
Jeff Sharkeya4620792011-05-20 15:29:23 -07001511 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1512 data.enforceInterface(IActivityManager.descriptor);
1513 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1514 data.readStrongBinder());
1515 registerProcessObserver(observer);
1516 return true;
1517 }
1518
1519 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1520 data.enforceInterface(IActivityManager.descriptor);
1521 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1522 data.readStrongBinder());
1523 unregisterProcessObserver(observer);
1524 return true;
1525 }
1526
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001527 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1528 {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 String pkg = data.readString();
1531 boolean ask = getPackageAskScreenCompat(pkg);
1532 reply.writeNoException();
1533 reply.writeInt(ask ? 1 : 0);
1534 return true;
1535 }
1536
1537 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1538 {
1539 data.enforceInterface(IActivityManager.descriptor);
1540 String pkg = data.readString();
1541 boolean ask = data.readInt() != 0;
1542 setPackageAskScreenCompat(pkg, ask);
1543 reply.writeNoException();
1544 return true;
1545 }
1546
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001547 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1548 data.enforceInterface(IActivityManager.descriptor);
1549 IIntentSender r = IIntentSender.Stub.asInterface(
1550 data.readStrongBinder());
1551 boolean res = isIntentSenderTargetedToPackage(r);
1552 reply.writeNoException();
1553 reply.writeInt(res ? 1 : 0);
1554 return true;
1555 }
1556
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001557 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1558 data.enforceInterface(IActivityManager.descriptor);
1559 Configuration config = Configuration.CREATOR.createFromParcel(data);
1560 updatePersistentConfiguration(config);
1561 reply.writeNoException();
1562 return true;
1563 }
1564
Dianne Hackbornb437e092011-08-05 17:50:29 -07001565 case GET_PROCESS_PSS_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 int[] pids = data.createIntArray();
1568 long[] pss = getProcessPss(pids);
1569 reply.writeNoException();
1570 reply.writeLongArray(pss);
1571 return true;
1572 }
1573
Dianne Hackborn661cd522011-08-22 00:26:20 -07001574 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1577 boolean always = data.readInt() != 0;
1578 showBootMessage(msg, always);
1579 reply.writeNoException();
1580 return true;
1581 }
1582
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001583 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 dismissKeyguardOnNextActivity();
1586 reply.writeNoException();
1587 return true;
1588 }
1589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001590 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001591
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001592 return super.onTransact(code, data, reply, flags);
1593 }
1594
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001595 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001596 return this;
1597 }
1598
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001599 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1600 protected IActivityManager create() {
1601 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001602 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001603 Log.v("ActivityManager", "default service binder = " + b);
1604 }
1605 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001606 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001607 Log.v("ActivityManager", "default service = " + am);
1608 }
1609 return am;
1610 }
1611 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001612}
1613
1614class ActivityManagerProxy implements IActivityManager
1615{
1616 public ActivityManagerProxy(IBinder remote)
1617 {
1618 mRemote = remote;
1619 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001620
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001621 public IBinder asBinder()
1622 {
1623 return mRemote;
1624 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001625
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001626 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001627 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1628 int startFlags, String profileFile,
1629 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001630 Parcel data = Parcel.obtain();
1631 Parcel reply = Parcel.obtain();
1632 data.writeInterfaceToken(IActivityManager.descriptor);
1633 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1634 intent.writeToParcel(data, 0);
1635 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001636 data.writeStrongBinder(resultTo);
1637 data.writeString(resultWho);
1638 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001639 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001640 data.writeString(profileFile);
1641 if (profileFd != null) {
1642 data.writeInt(1);
1643 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1644 } else {
1645 data.writeInt(0);
1646 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001647 if (options != null) {
1648 data.writeInt(1);
1649 options.writeToParcel(data, 0);
1650 } else {
1651 data.writeInt(0);
1652 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001653 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1654 reply.readException();
1655 int result = reply.readInt();
1656 reply.recycle();
1657 data.recycle();
1658 return result;
1659 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001660 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001661 String resolvedType, IBinder resultTo, String resultWho,
1662 int requestCode, int startFlags, String profileFile,
1663 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001664 Parcel data = Parcel.obtain();
1665 Parcel reply = Parcel.obtain();
1666 data.writeInterfaceToken(IActivityManager.descriptor);
1667 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1668 intent.writeToParcel(data, 0);
1669 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001670 data.writeStrongBinder(resultTo);
1671 data.writeString(resultWho);
1672 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001673 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001674 data.writeString(profileFile);
1675 if (profileFd != null) {
1676 data.writeInt(1);
1677 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1678 } else {
1679 data.writeInt(0);
1680 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001681 if (options != null) {
1682 data.writeInt(1);
1683 options.writeToParcel(data, 0);
1684 } else {
1685 data.writeInt(0);
1686 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001687 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1688 reply.readException();
1689 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1690 reply.recycle();
1691 data.recycle();
1692 return result;
1693 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001694 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001695 String resolvedType, IBinder resultTo, String resultWho,
1696 int requestCode, int startFlags, Configuration config,
1697 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001698 Parcel data = Parcel.obtain();
1699 Parcel reply = Parcel.obtain();
1700 data.writeInterfaceToken(IActivityManager.descriptor);
1701 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1702 intent.writeToParcel(data, 0);
1703 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001704 data.writeStrongBinder(resultTo);
1705 data.writeString(resultWho);
1706 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001707 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001708 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001709 if (options != null) {
1710 data.writeInt(1);
1711 options.writeToParcel(data, 0);
1712 } else {
1713 data.writeInt(0);
1714 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001715 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1716 reply.readException();
1717 int result = reply.readInt();
1718 reply.recycle();
1719 data.recycle();
1720 return result;
1721 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001722 public int startActivityIntentSender(IApplicationThread caller,
1723 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001724 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001725 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001726 Parcel data = Parcel.obtain();
1727 Parcel reply = Parcel.obtain();
1728 data.writeInterfaceToken(IActivityManager.descriptor);
1729 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1730 intent.writeToParcel(data, 0);
1731 if (fillInIntent != null) {
1732 data.writeInt(1);
1733 fillInIntent.writeToParcel(data, 0);
1734 } else {
1735 data.writeInt(0);
1736 }
1737 data.writeString(resolvedType);
1738 data.writeStrongBinder(resultTo);
1739 data.writeString(resultWho);
1740 data.writeInt(requestCode);
1741 data.writeInt(flagsMask);
1742 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001743 if (options != null) {
1744 data.writeInt(1);
1745 options.writeToParcel(data, 0);
1746 } else {
1747 data.writeInt(0);
1748 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001749 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001750 reply.readException();
1751 int result = reply.readInt();
1752 reply.recycle();
1753 data.recycle();
1754 return result;
1755 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001756 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001757 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001758 Parcel data = Parcel.obtain();
1759 Parcel reply = Parcel.obtain();
1760 data.writeInterfaceToken(IActivityManager.descriptor);
1761 data.writeStrongBinder(callingActivity);
1762 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001763 if (options != null) {
1764 data.writeInt(1);
1765 options.writeToParcel(data, 0);
1766 } else {
1767 data.writeInt(0);
1768 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001769 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1770 reply.readException();
1771 int result = reply.readInt();
1772 reply.recycle();
1773 data.recycle();
1774 return result != 0;
1775 }
1776 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1777 throws RemoteException {
1778 Parcel data = Parcel.obtain();
1779 Parcel reply = Parcel.obtain();
1780 data.writeInterfaceToken(IActivityManager.descriptor);
1781 data.writeStrongBinder(token);
1782 data.writeInt(resultCode);
1783 if (resultData != null) {
1784 data.writeInt(1);
1785 resultData.writeToParcel(data, 0);
1786 } else {
1787 data.writeInt(0);
1788 }
1789 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1790 reply.readException();
1791 boolean res = reply.readInt() != 0;
1792 data.recycle();
1793 reply.recycle();
1794 return res;
1795 }
1796 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1797 {
1798 Parcel data = Parcel.obtain();
1799 Parcel reply = Parcel.obtain();
1800 data.writeInterfaceToken(IActivityManager.descriptor);
1801 data.writeStrongBinder(token);
1802 data.writeString(resultWho);
1803 data.writeInt(requestCode);
1804 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1805 reply.readException();
1806 data.recycle();
1807 reply.recycle();
1808 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001809 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1810 Parcel data = Parcel.obtain();
1811 Parcel reply = Parcel.obtain();
1812 data.writeInterfaceToken(IActivityManager.descriptor);
1813 data.writeStrongBinder(token);
1814 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1815 reply.readException();
1816 boolean res = reply.readInt() != 0;
1817 data.recycle();
1818 reply.recycle();
1819 return res;
1820 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001821 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001822 IIntentReceiver receiver,
1823 IntentFilter filter, String perm) throws RemoteException
1824 {
1825 Parcel data = Parcel.obtain();
1826 Parcel reply = Parcel.obtain();
1827 data.writeInterfaceToken(IActivityManager.descriptor);
1828 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001829 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001830 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1831 filter.writeToParcel(data, 0);
1832 data.writeString(perm);
1833 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1834 reply.readException();
1835 Intent intent = null;
1836 int haveIntent = reply.readInt();
1837 if (haveIntent != 0) {
1838 intent = Intent.CREATOR.createFromParcel(reply);
1839 }
1840 reply.recycle();
1841 data.recycle();
1842 return intent;
1843 }
1844 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1845 {
1846 Parcel data = Parcel.obtain();
1847 Parcel reply = Parcel.obtain();
1848 data.writeInterfaceToken(IActivityManager.descriptor);
1849 data.writeStrongBinder(receiver.asBinder());
1850 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1851 reply.readException();
1852 data.recycle();
1853 reply.recycle();
1854 }
1855 public int broadcastIntent(IApplicationThread caller,
1856 Intent intent, String resolvedType, IIntentReceiver resultTo,
1857 int resultCode, String resultData, Bundle map,
1858 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001859 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001860 {
1861 Parcel data = Parcel.obtain();
1862 Parcel reply = Parcel.obtain();
1863 data.writeInterfaceToken(IActivityManager.descriptor);
1864 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1865 intent.writeToParcel(data, 0);
1866 data.writeString(resolvedType);
1867 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1868 data.writeInt(resultCode);
1869 data.writeString(resultData);
1870 data.writeBundle(map);
1871 data.writeString(requiredPermission);
1872 data.writeInt(serialized ? 1 : 0);
1873 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001874 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001875 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1876 reply.readException();
1877 int res = reply.readInt();
1878 reply.recycle();
1879 data.recycle();
1880 return res;
1881 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001882 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1883 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001884 {
1885 Parcel data = Parcel.obtain();
1886 Parcel reply = Parcel.obtain();
1887 data.writeInterfaceToken(IActivityManager.descriptor);
1888 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1889 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001890 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001891 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1892 reply.readException();
1893 data.recycle();
1894 reply.recycle();
1895 }
1896 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1897 {
1898 Parcel data = Parcel.obtain();
1899 Parcel reply = Parcel.obtain();
1900 data.writeInterfaceToken(IActivityManager.descriptor);
1901 data.writeStrongBinder(who);
1902 data.writeInt(resultCode);
1903 data.writeString(resultData);
1904 data.writeBundle(map);
1905 data.writeInt(abortBroadcast ? 1 : 0);
1906 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1907 reply.readException();
1908 data.recycle();
1909 reply.recycle();
1910 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001911 public void attachApplication(IApplicationThread app) throws RemoteException
1912 {
1913 Parcel data = Parcel.obtain();
1914 Parcel reply = Parcel.obtain();
1915 data.writeInterfaceToken(IActivityManager.descriptor);
1916 data.writeStrongBinder(app.asBinder());
1917 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
1918 reply.readException();
1919 data.recycle();
1920 reply.recycle();
1921 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001922 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
1923 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001924 {
1925 Parcel data = Parcel.obtain();
1926 Parcel reply = Parcel.obtain();
1927 data.writeInterfaceToken(IActivityManager.descriptor);
1928 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07001929 if (config != null) {
1930 data.writeInt(1);
1931 config.writeToParcel(data, 0);
1932 } else {
1933 data.writeInt(0);
1934 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001935 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001936 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1937 reply.readException();
1938 data.recycle();
1939 reply.recycle();
1940 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08001941 public void activityPaused(IBinder token) throws RemoteException
1942 {
1943 Parcel data = Parcel.obtain();
1944 Parcel reply = Parcel.obtain();
1945 data.writeInterfaceToken(IActivityManager.descriptor);
1946 data.writeStrongBinder(token);
1947 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
1948 reply.readException();
1949 data.recycle();
1950 reply.recycle();
1951 }
1952 public void activityStopped(IBinder token, Bundle state,
1953 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 {
1955 Parcel data = Parcel.obtain();
1956 Parcel reply = Parcel.obtain();
1957 data.writeInterfaceToken(IActivityManager.descriptor);
1958 data.writeStrongBinder(token);
1959 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001960 if (thumbnail != null) {
1961 data.writeInt(1);
1962 thumbnail.writeToParcel(data, 0);
1963 } else {
1964 data.writeInt(0);
1965 }
1966 TextUtils.writeToParcel(description, data, 0);
1967 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1968 reply.readException();
1969 data.recycle();
1970 reply.recycle();
1971 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08001972 public void activitySlept(IBinder token) throws RemoteException
1973 {
1974 Parcel data = Parcel.obtain();
1975 Parcel reply = Parcel.obtain();
1976 data.writeInterfaceToken(IActivityManager.descriptor);
1977 data.writeStrongBinder(token);
1978 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1979 reply.readException();
1980 data.recycle();
1981 reply.recycle();
1982 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001983 public void activityDestroyed(IBinder token) throws RemoteException
1984 {
1985 Parcel data = Parcel.obtain();
1986 Parcel reply = Parcel.obtain();
1987 data.writeInterfaceToken(IActivityManager.descriptor);
1988 data.writeStrongBinder(token);
1989 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1990 reply.readException();
1991 data.recycle();
1992 reply.recycle();
1993 }
1994 public String getCallingPackage(IBinder token) throws RemoteException
1995 {
1996 Parcel data = Parcel.obtain();
1997 Parcel reply = Parcel.obtain();
1998 data.writeInterfaceToken(IActivityManager.descriptor);
1999 data.writeStrongBinder(token);
2000 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2001 reply.readException();
2002 String res = reply.readString();
2003 data.recycle();
2004 reply.recycle();
2005 return res;
2006 }
2007 public ComponentName getCallingActivity(IBinder token)
2008 throws RemoteException {
2009 Parcel data = Parcel.obtain();
2010 Parcel reply = Parcel.obtain();
2011 data.writeInterfaceToken(IActivityManager.descriptor);
2012 data.writeStrongBinder(token);
2013 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2014 reply.readException();
2015 ComponentName res = ComponentName.readFromParcel(reply);
2016 data.recycle();
2017 reply.recycle();
2018 return res;
2019 }
2020 public List getTasks(int maxNum, int flags,
2021 IThumbnailReceiver receiver) throws RemoteException {
2022 Parcel data = Parcel.obtain();
2023 Parcel reply = Parcel.obtain();
2024 data.writeInterfaceToken(IActivityManager.descriptor);
2025 data.writeInt(maxNum);
2026 data.writeInt(flags);
2027 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2028 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2029 reply.readException();
2030 ArrayList list = null;
2031 int N = reply.readInt();
2032 if (N >= 0) {
2033 list = new ArrayList();
2034 while (N > 0) {
2035 ActivityManager.RunningTaskInfo info =
2036 ActivityManager.RunningTaskInfo.CREATOR
2037 .createFromParcel(reply);
2038 list.add(info);
2039 N--;
2040 }
2041 }
2042 data.recycle();
2043 reply.recycle();
2044 return list;
2045 }
2046 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2047 int flags) throws RemoteException {
2048 Parcel data = Parcel.obtain();
2049 Parcel reply = Parcel.obtain();
2050 data.writeInterfaceToken(IActivityManager.descriptor);
2051 data.writeInt(maxNum);
2052 data.writeInt(flags);
2053 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2054 reply.readException();
2055 ArrayList<ActivityManager.RecentTaskInfo> list
2056 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2057 data.recycle();
2058 reply.recycle();
2059 return list;
2060 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002061 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002062 Parcel data = Parcel.obtain();
2063 Parcel reply = Parcel.obtain();
2064 data.writeInterfaceToken(IActivityManager.descriptor);
2065 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002066 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002067 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002068 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002069 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002070 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002071 }
2072 data.recycle();
2073 reply.recycle();
2074 return bm;
2075 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002076 public List getServices(int maxNum, int flags) throws RemoteException {
2077 Parcel data = Parcel.obtain();
2078 Parcel reply = Parcel.obtain();
2079 data.writeInterfaceToken(IActivityManager.descriptor);
2080 data.writeInt(maxNum);
2081 data.writeInt(flags);
2082 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2083 reply.readException();
2084 ArrayList list = null;
2085 int N = reply.readInt();
2086 if (N >= 0) {
2087 list = new ArrayList();
2088 while (N > 0) {
2089 ActivityManager.RunningServiceInfo info =
2090 ActivityManager.RunningServiceInfo.CREATOR
2091 .createFromParcel(reply);
2092 list.add(info);
2093 N--;
2094 }
2095 }
2096 data.recycle();
2097 reply.recycle();
2098 return list;
2099 }
2100 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2101 throws RemoteException {
2102 Parcel data = Parcel.obtain();
2103 Parcel reply = Parcel.obtain();
2104 data.writeInterfaceToken(IActivityManager.descriptor);
2105 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2106 reply.readException();
2107 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2108 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2109 data.recycle();
2110 reply.recycle();
2111 return list;
2112 }
2113 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2114 throws RemoteException {
2115 Parcel data = Parcel.obtain();
2116 Parcel reply = Parcel.obtain();
2117 data.writeInterfaceToken(IActivityManager.descriptor);
2118 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2119 reply.readException();
2120 ArrayList<ActivityManager.RunningAppProcessInfo> list
2121 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2122 data.recycle();
2123 reply.recycle();
2124 return list;
2125 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002126 public List<ApplicationInfo> getRunningExternalApplications()
2127 throws RemoteException {
2128 Parcel data = Parcel.obtain();
2129 Parcel reply = Parcel.obtain();
2130 data.writeInterfaceToken(IActivityManager.descriptor);
2131 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2132 reply.readException();
2133 ArrayList<ApplicationInfo> list
2134 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2135 data.recycle();
2136 reply.recycle();
2137 return list;
2138 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002139 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002140 {
2141 Parcel data = Parcel.obtain();
2142 Parcel reply = Parcel.obtain();
2143 data.writeInterfaceToken(IActivityManager.descriptor);
2144 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002145 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002146 if (options != null) {
2147 data.writeInt(1);
2148 options.writeToParcel(data, 0);
2149 } else {
2150 data.writeInt(0);
2151 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2153 reply.readException();
2154 data.recycle();
2155 reply.recycle();
2156 }
2157 public void moveTaskToBack(int task) throws RemoteException
2158 {
2159 Parcel data = Parcel.obtain();
2160 Parcel reply = Parcel.obtain();
2161 data.writeInterfaceToken(IActivityManager.descriptor);
2162 data.writeInt(task);
2163 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2164 reply.readException();
2165 data.recycle();
2166 reply.recycle();
2167 }
2168 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2169 throws RemoteException {
2170 Parcel data = Parcel.obtain();
2171 Parcel reply = Parcel.obtain();
2172 data.writeInterfaceToken(IActivityManager.descriptor);
2173 data.writeStrongBinder(token);
2174 data.writeInt(nonRoot ? 1 : 0);
2175 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2176 reply.readException();
2177 boolean res = reply.readInt() != 0;
2178 data.recycle();
2179 reply.recycle();
2180 return res;
2181 }
2182 public void moveTaskBackwards(int task) throws RemoteException
2183 {
2184 Parcel data = Parcel.obtain();
2185 Parcel reply = Parcel.obtain();
2186 data.writeInterfaceToken(IActivityManager.descriptor);
2187 data.writeInt(task);
2188 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2189 reply.readException();
2190 data.recycle();
2191 reply.recycle();
2192 }
2193 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2194 {
2195 Parcel data = Parcel.obtain();
2196 Parcel reply = Parcel.obtain();
2197 data.writeInterfaceToken(IActivityManager.descriptor);
2198 data.writeStrongBinder(token);
2199 data.writeInt(onlyRoot ? 1 : 0);
2200 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2201 reply.readException();
2202 int res = reply.readInt();
2203 data.recycle();
2204 reply.recycle();
2205 return res;
2206 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002207 public void reportThumbnail(IBinder token,
2208 Bitmap thumbnail, CharSequence description) throws RemoteException
2209 {
2210 Parcel data = Parcel.obtain();
2211 Parcel reply = Parcel.obtain();
2212 data.writeInterfaceToken(IActivityManager.descriptor);
2213 data.writeStrongBinder(token);
2214 if (thumbnail != null) {
2215 data.writeInt(1);
2216 thumbnail.writeToParcel(data, 0);
2217 } else {
2218 data.writeInt(0);
2219 }
2220 TextUtils.writeToParcel(description, data, 0);
2221 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2222 reply.readException();
2223 data.recycle();
2224 reply.recycle();
2225 }
2226 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2227 String name) throws RemoteException
2228 {
2229 Parcel data = Parcel.obtain();
2230 Parcel reply = Parcel.obtain();
2231 data.writeInterfaceToken(IActivityManager.descriptor);
2232 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2233 data.writeString(name);
2234 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2235 reply.readException();
2236 int res = reply.readInt();
2237 ContentProviderHolder cph = null;
2238 if (res != 0) {
2239 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2240 }
2241 data.recycle();
2242 reply.recycle();
2243 return cph;
2244 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002245 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2246 throws RemoteException
2247 {
2248 Parcel data = Parcel.obtain();
2249 Parcel reply = Parcel.obtain();
2250 data.writeInterfaceToken(IActivityManager.descriptor);
2251 data.writeString(name);
2252 data.writeStrongBinder(token);
2253 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2254 reply.readException();
2255 int res = reply.readInt();
2256 ContentProviderHolder cph = null;
2257 if (res != 0) {
2258 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2259 }
2260 data.recycle();
2261 reply.recycle();
2262 return cph;
2263 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002264 public void publishContentProviders(IApplicationThread caller,
2265 List<ContentProviderHolder> providers) throws RemoteException
2266 {
2267 Parcel data = Parcel.obtain();
2268 Parcel reply = Parcel.obtain();
2269 data.writeInterfaceToken(IActivityManager.descriptor);
2270 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2271 data.writeTypedList(providers);
2272 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2273 reply.readException();
2274 data.recycle();
2275 reply.recycle();
2276 }
2277
2278 public void removeContentProvider(IApplicationThread caller,
2279 String name) throws RemoteException {
2280 Parcel data = Parcel.obtain();
2281 Parcel reply = Parcel.obtain();
2282 data.writeInterfaceToken(IActivityManager.descriptor);
2283 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2284 data.writeString(name);
2285 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2286 reply.readException();
2287 data.recycle();
2288 reply.recycle();
2289 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002290
2291 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2292 Parcel data = Parcel.obtain();
2293 Parcel reply = Parcel.obtain();
2294 data.writeInterfaceToken(IActivityManager.descriptor);
2295 data.writeString(name);
2296 data.writeStrongBinder(token);
2297 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2298 reply.readException();
2299 data.recycle();
2300 reply.recycle();
2301 }
2302
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002303 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2304 throws RemoteException
2305 {
2306 Parcel data = Parcel.obtain();
2307 Parcel reply = Parcel.obtain();
2308 data.writeInterfaceToken(IActivityManager.descriptor);
2309 service.writeToParcel(data, 0);
2310 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2311 reply.readException();
2312 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2313 data.recycle();
2314 reply.recycle();
2315 return res;
2316 }
2317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002318 public ComponentName startService(IApplicationThread caller, Intent service,
2319 String resolvedType) throws RemoteException
2320 {
2321 Parcel data = Parcel.obtain();
2322 Parcel reply = Parcel.obtain();
2323 data.writeInterfaceToken(IActivityManager.descriptor);
2324 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2325 service.writeToParcel(data, 0);
2326 data.writeString(resolvedType);
2327 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2328 reply.readException();
2329 ComponentName res = ComponentName.readFromParcel(reply);
2330 data.recycle();
2331 reply.recycle();
2332 return res;
2333 }
2334 public int stopService(IApplicationThread caller, Intent service,
2335 String resolvedType) throws RemoteException
2336 {
2337 Parcel data = Parcel.obtain();
2338 Parcel reply = Parcel.obtain();
2339 data.writeInterfaceToken(IActivityManager.descriptor);
2340 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2341 service.writeToParcel(data, 0);
2342 data.writeString(resolvedType);
2343 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 int res = reply.readInt();
2346 reply.recycle();
2347 data.recycle();
2348 return res;
2349 }
2350 public boolean stopServiceToken(ComponentName className, IBinder token,
2351 int startId) throws RemoteException {
2352 Parcel data = Parcel.obtain();
2353 Parcel reply = Parcel.obtain();
2354 data.writeInterfaceToken(IActivityManager.descriptor);
2355 ComponentName.writeToParcel(className, data);
2356 data.writeStrongBinder(token);
2357 data.writeInt(startId);
2358 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2359 reply.readException();
2360 boolean res = reply.readInt() != 0;
2361 data.recycle();
2362 reply.recycle();
2363 return res;
2364 }
2365 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002366 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367 Parcel data = Parcel.obtain();
2368 Parcel reply = Parcel.obtain();
2369 data.writeInterfaceToken(IActivityManager.descriptor);
2370 ComponentName.writeToParcel(className, data);
2371 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002372 data.writeInt(id);
2373 if (notification != null) {
2374 data.writeInt(1);
2375 notification.writeToParcel(data, 0);
2376 } else {
2377 data.writeInt(0);
2378 }
2379 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002380 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2381 reply.readException();
2382 data.recycle();
2383 reply.recycle();
2384 }
2385 public int bindService(IApplicationThread caller, IBinder token,
2386 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002387 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002388 Parcel data = Parcel.obtain();
2389 Parcel reply = Parcel.obtain();
2390 data.writeInterfaceToken(IActivityManager.descriptor);
2391 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2392 data.writeStrongBinder(token);
2393 service.writeToParcel(data, 0);
2394 data.writeString(resolvedType);
2395 data.writeStrongBinder(connection.asBinder());
2396 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002397 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002398 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2399 reply.readException();
2400 int res = reply.readInt();
2401 data.recycle();
2402 reply.recycle();
2403 return res;
2404 }
2405 public boolean unbindService(IServiceConnection connection) throws RemoteException
2406 {
2407 Parcel data = Parcel.obtain();
2408 Parcel reply = Parcel.obtain();
2409 data.writeInterfaceToken(IActivityManager.descriptor);
2410 data.writeStrongBinder(connection.asBinder());
2411 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2412 reply.readException();
2413 boolean res = reply.readInt() != 0;
2414 data.recycle();
2415 reply.recycle();
2416 return res;
2417 }
2418
2419 public void publishService(IBinder token,
2420 Intent intent, IBinder service) throws RemoteException {
2421 Parcel data = Parcel.obtain();
2422 Parcel reply = Parcel.obtain();
2423 data.writeInterfaceToken(IActivityManager.descriptor);
2424 data.writeStrongBinder(token);
2425 intent.writeToParcel(data, 0);
2426 data.writeStrongBinder(service);
2427 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2428 reply.readException();
2429 data.recycle();
2430 reply.recycle();
2431 }
2432
2433 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2434 throws RemoteException {
2435 Parcel data = Parcel.obtain();
2436 Parcel reply = Parcel.obtain();
2437 data.writeInterfaceToken(IActivityManager.descriptor);
2438 data.writeStrongBinder(token);
2439 intent.writeToParcel(data, 0);
2440 data.writeInt(doRebind ? 1 : 0);
2441 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 data.recycle();
2444 reply.recycle();
2445 }
2446
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002447 public void serviceDoneExecuting(IBinder token, int type, int startId,
2448 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002449 Parcel data = Parcel.obtain();
2450 Parcel reply = Parcel.obtain();
2451 data.writeInterfaceToken(IActivityManager.descriptor);
2452 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002453 data.writeInt(type);
2454 data.writeInt(startId);
2455 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002456 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2457 reply.readException();
2458 data.recycle();
2459 reply.recycle();
2460 }
2461
2462 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2463 Parcel data = Parcel.obtain();
2464 Parcel reply = Parcel.obtain();
2465 data.writeInterfaceToken(IActivityManager.descriptor);
2466 service.writeToParcel(data, 0);
2467 data.writeString(resolvedType);
2468 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2469 reply.readException();
2470 IBinder binder = reply.readStrongBinder();
2471 reply.recycle();
2472 data.recycle();
2473 return binder;
2474 }
2475
Christopher Tate181fafa2009-05-14 11:12:14 -07002476 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2477 throws RemoteException {
2478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 app.writeToParcel(data, 0);
2482 data.writeInt(backupRestoreMode);
2483 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 boolean success = reply.readInt() != 0;
2486 reply.recycle();
2487 data.recycle();
2488 return success;
2489 }
2490
2491 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2492 Parcel data = Parcel.obtain();
2493 Parcel reply = Parcel.obtain();
2494 data.writeInterfaceToken(IActivityManager.descriptor);
2495 data.writeString(packageName);
2496 data.writeStrongBinder(agent);
2497 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2498 reply.recycle();
2499 data.recycle();
2500 }
2501
2502 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2503 Parcel data = Parcel.obtain();
2504 Parcel reply = Parcel.obtain();
2505 data.writeInterfaceToken(IActivityManager.descriptor);
2506 app.writeToParcel(data, 0);
2507 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2508 reply.readException();
2509 reply.recycle();
2510 data.recycle();
2511 }
2512
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002513 public boolean startInstrumentation(ComponentName className, String profileFile,
2514 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2515 throws RemoteException {
2516 Parcel data = Parcel.obtain();
2517 Parcel reply = Parcel.obtain();
2518 data.writeInterfaceToken(IActivityManager.descriptor);
2519 ComponentName.writeToParcel(className, data);
2520 data.writeString(profileFile);
2521 data.writeInt(flags);
2522 data.writeBundle(arguments);
2523 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2524 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2525 reply.readException();
2526 boolean res = reply.readInt() != 0;
2527 reply.recycle();
2528 data.recycle();
2529 return res;
2530 }
2531
2532 public void finishInstrumentation(IApplicationThread target,
2533 int resultCode, Bundle results) throws RemoteException {
2534 Parcel data = Parcel.obtain();
2535 Parcel reply = Parcel.obtain();
2536 data.writeInterfaceToken(IActivityManager.descriptor);
2537 data.writeStrongBinder(target != null ? target.asBinder() : null);
2538 data.writeInt(resultCode);
2539 data.writeBundle(results);
2540 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2541 reply.readException();
2542 data.recycle();
2543 reply.recycle();
2544 }
2545 public Configuration getConfiguration() throws RemoteException
2546 {
2547 Parcel data = Parcel.obtain();
2548 Parcel reply = Parcel.obtain();
2549 data.writeInterfaceToken(IActivityManager.descriptor);
2550 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2551 reply.readException();
2552 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2553 reply.recycle();
2554 data.recycle();
2555 return res;
2556 }
2557 public void updateConfiguration(Configuration values) throws RemoteException
2558 {
2559 Parcel data = Parcel.obtain();
2560 Parcel reply = Parcel.obtain();
2561 data.writeInterfaceToken(IActivityManager.descriptor);
2562 values.writeToParcel(data, 0);
2563 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 data.recycle();
2566 reply.recycle();
2567 }
2568 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2569 throws RemoteException {
2570 Parcel data = Parcel.obtain();
2571 Parcel reply = Parcel.obtain();
2572 data.writeInterfaceToken(IActivityManager.descriptor);
2573 data.writeStrongBinder(token);
2574 data.writeInt(requestedOrientation);
2575 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2576 reply.readException();
2577 data.recycle();
2578 reply.recycle();
2579 }
2580 public int getRequestedOrientation(IBinder token) throws RemoteException {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 data.writeStrongBinder(token);
2585 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2586 reply.readException();
2587 int res = reply.readInt();
2588 data.recycle();
2589 reply.recycle();
2590 return res;
2591 }
2592 public ComponentName getActivityClassForToken(IBinder token)
2593 throws RemoteException {
2594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeStrongBinder(token);
2598 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2599 reply.readException();
2600 ComponentName res = ComponentName.readFromParcel(reply);
2601 data.recycle();
2602 reply.recycle();
2603 return res;
2604 }
2605 public String getPackageForToken(IBinder token) throws RemoteException
2606 {
2607 Parcel data = Parcel.obtain();
2608 Parcel reply = Parcel.obtain();
2609 data.writeInterfaceToken(IActivityManager.descriptor);
2610 data.writeStrongBinder(token);
2611 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2612 reply.readException();
2613 String res = reply.readString();
2614 data.recycle();
2615 reply.recycle();
2616 return res;
2617 }
2618 public IIntentSender getIntentSender(int type,
2619 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002620 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2621 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 Parcel data = Parcel.obtain();
2623 Parcel reply = Parcel.obtain();
2624 data.writeInterfaceToken(IActivityManager.descriptor);
2625 data.writeInt(type);
2626 data.writeString(packageName);
2627 data.writeStrongBinder(token);
2628 data.writeString(resultWho);
2629 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002630 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002631 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002632 data.writeTypedArray(intents, 0);
2633 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002634 } else {
2635 data.writeInt(0);
2636 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002638 if (options != null) {
2639 data.writeInt(1);
2640 options.writeToParcel(data, 0);
2641 } else {
2642 data.writeInt(0);
2643 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002644 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2645 reply.readException();
2646 IIntentSender res = IIntentSender.Stub.asInterface(
2647 reply.readStrongBinder());
2648 data.recycle();
2649 reply.recycle();
2650 return res;
2651 }
2652 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2653 Parcel data = Parcel.obtain();
2654 Parcel reply = Parcel.obtain();
2655 data.writeInterfaceToken(IActivityManager.descriptor);
2656 data.writeStrongBinder(sender.asBinder());
2657 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2658 reply.readException();
2659 data.recycle();
2660 reply.recycle();
2661 }
2662 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2663 Parcel data = Parcel.obtain();
2664 Parcel reply = Parcel.obtain();
2665 data.writeInterfaceToken(IActivityManager.descriptor);
2666 data.writeStrongBinder(sender.asBinder());
2667 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2668 reply.readException();
2669 String res = reply.readString();
2670 data.recycle();
2671 reply.recycle();
2672 return res;
2673 }
2674 public void setProcessLimit(int max) throws RemoteException
2675 {
2676 Parcel data = Parcel.obtain();
2677 Parcel reply = Parcel.obtain();
2678 data.writeInterfaceToken(IActivityManager.descriptor);
2679 data.writeInt(max);
2680 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 data.recycle();
2683 reply.recycle();
2684 }
2685 public int getProcessLimit() throws RemoteException
2686 {
2687 Parcel data = Parcel.obtain();
2688 Parcel reply = Parcel.obtain();
2689 data.writeInterfaceToken(IActivityManager.descriptor);
2690 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2691 reply.readException();
2692 int res = reply.readInt();
2693 data.recycle();
2694 reply.recycle();
2695 return res;
2696 }
2697 public void setProcessForeground(IBinder token, int pid,
2698 boolean isForeground) throws RemoteException {
2699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 data.writeStrongBinder(token);
2703 data.writeInt(pid);
2704 data.writeInt(isForeground ? 1 : 0);
2705 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2706 reply.readException();
2707 data.recycle();
2708 reply.recycle();
2709 }
2710 public int checkPermission(String permission, int pid, int uid)
2711 throws RemoteException {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeString(permission);
2716 data.writeInt(pid);
2717 data.writeInt(uid);
2718 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2719 reply.readException();
2720 int res = reply.readInt();
2721 data.recycle();
2722 reply.recycle();
2723 return res;
2724 }
2725 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002726 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002727 Parcel data = Parcel.obtain();
2728 Parcel reply = Parcel.obtain();
2729 data.writeInterfaceToken(IActivityManager.descriptor);
2730 data.writeString(packageName);
2731 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002732 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002733 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 boolean res = reply.readInt() != 0;
2736 data.recycle();
2737 reply.recycle();
2738 return res;
2739 }
2740 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2741 throws RemoteException {
2742 Parcel data = Parcel.obtain();
2743 Parcel reply = Parcel.obtain();
2744 data.writeInterfaceToken(IActivityManager.descriptor);
2745 uri.writeToParcel(data, 0);
2746 data.writeInt(pid);
2747 data.writeInt(uid);
2748 data.writeInt(mode);
2749 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2750 reply.readException();
2751 int res = reply.readInt();
2752 data.recycle();
2753 reply.recycle();
2754 return res;
2755 }
2756 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2757 Uri uri, int mode) throws RemoteException {
2758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
2760 data.writeInterfaceToken(IActivityManager.descriptor);
2761 data.writeStrongBinder(caller.asBinder());
2762 data.writeString(targetPkg);
2763 uri.writeToParcel(data, 0);
2764 data.writeInt(mode);
2765 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2766 reply.readException();
2767 data.recycle();
2768 reply.recycle();
2769 }
2770 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2771 int mode) throws RemoteException {
2772 Parcel data = Parcel.obtain();
2773 Parcel reply = Parcel.obtain();
2774 data.writeInterfaceToken(IActivityManager.descriptor);
2775 data.writeStrongBinder(caller.asBinder());
2776 uri.writeToParcel(data, 0);
2777 data.writeInt(mode);
2778 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2779 reply.readException();
2780 data.recycle();
2781 reply.recycle();
2782 }
2783 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2784 throws RemoteException {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
2787 data.writeInterfaceToken(IActivityManager.descriptor);
2788 data.writeStrongBinder(who.asBinder());
2789 data.writeInt(waiting ? 1 : 0);
2790 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 data.recycle();
2793 reply.recycle();
2794 }
2795 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2796 Parcel data = Parcel.obtain();
2797 Parcel reply = Parcel.obtain();
2798 data.writeInterfaceToken(IActivityManager.descriptor);
2799 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2800 reply.readException();
2801 outInfo.readFromParcel(reply);
2802 data.recycle();
2803 reply.recycle();
2804 }
2805 public void unhandledBack() throws RemoteException
2806 {
2807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2811 reply.readException();
2812 data.recycle();
2813 reply.recycle();
2814 }
2815 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2816 {
2817 Parcel data = Parcel.obtain();
2818 Parcel reply = Parcel.obtain();
2819 data.writeInterfaceToken(IActivityManager.descriptor);
2820 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 ParcelFileDescriptor pfd = null;
2823 if (reply.readInt() != 0) {
2824 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2825 }
2826 data.recycle();
2827 reply.recycle();
2828 return pfd;
2829 }
2830 public void goingToSleep() throws RemoteException
2831 {
2832 Parcel data = Parcel.obtain();
2833 Parcel reply = Parcel.obtain();
2834 data.writeInterfaceToken(IActivityManager.descriptor);
2835 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2836 reply.readException();
2837 data.recycle();
2838 reply.recycle();
2839 }
2840 public void wakingUp() throws RemoteException
2841 {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2846 reply.readException();
2847 data.recycle();
2848 reply.recycle();
2849 }
2850 public void setDebugApp(
2851 String packageName, boolean waitForDebugger, boolean persistent)
2852 throws RemoteException
2853 {
2854 Parcel data = Parcel.obtain();
2855 Parcel reply = Parcel.obtain();
2856 data.writeInterfaceToken(IActivityManager.descriptor);
2857 data.writeString(packageName);
2858 data.writeInt(waitForDebugger ? 1 : 0);
2859 data.writeInt(persistent ? 1 : 0);
2860 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2861 reply.readException();
2862 data.recycle();
2863 reply.recycle();
2864 }
2865 public void setAlwaysFinish(boolean enabled) throws RemoteException
2866 {
2867 Parcel data = Parcel.obtain();
2868 Parcel reply = Parcel.obtain();
2869 data.writeInterfaceToken(IActivityManager.descriptor);
2870 data.writeInt(enabled ? 1 : 0);
2871 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2872 reply.readException();
2873 data.recycle();
2874 reply.recycle();
2875 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002876 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002877 {
2878 Parcel data = Parcel.obtain();
2879 Parcel reply = Parcel.obtain();
2880 data.writeInterfaceToken(IActivityManager.descriptor);
2881 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002882 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 reply.readException();
2884 data.recycle();
2885 reply.recycle();
2886 }
2887 public void enterSafeMode() throws RemoteException {
2888 Parcel data = Parcel.obtain();
2889 data.writeInterfaceToken(IActivityManager.descriptor);
2890 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
2891 data.recycle();
2892 }
2893 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
2894 Parcel data = Parcel.obtain();
2895 data.writeStrongBinder(sender.asBinder());
2896 data.writeInterfaceToken(IActivityManager.descriptor);
2897 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
2898 data.recycle();
2899 }
Dianne Hackborn64825172011-03-02 21:32:58 -08002900 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002901 Parcel data = Parcel.obtain();
2902 Parcel reply = Parcel.obtain();
2903 data.writeInterfaceToken(IActivityManager.descriptor);
2904 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002905 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08002906 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07002907 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002908 boolean res = reply.readInt() != 0;
2909 data.recycle();
2910 reply.recycle();
2911 return res;
2912 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002913 public void startRunning(String pkg, String cls, String action,
2914 String indata) throws RemoteException {
2915 Parcel data = Parcel.obtain();
2916 Parcel reply = Parcel.obtain();
2917 data.writeInterfaceToken(IActivityManager.descriptor);
2918 data.writeString(pkg);
2919 data.writeString(cls);
2920 data.writeString(action);
2921 data.writeString(indata);
2922 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
2923 reply.readException();
2924 data.recycle();
2925 reply.recycle();
2926 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002927 public boolean testIsSystemReady()
2928 {
2929 /* this base class version is never called */
2930 return true;
2931 }
Dan Egnor60d87622009-12-16 16:32:58 -08002932 public void handleApplicationCrash(IBinder app,
2933 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
2934 {
2935 Parcel data = Parcel.obtain();
2936 Parcel reply = Parcel.obtain();
2937 data.writeInterfaceToken(IActivityManager.descriptor);
2938 data.writeStrongBinder(app);
2939 crashInfo.writeToParcel(data, 0);
2940 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
2941 reply.readException();
2942 reply.recycle();
2943 data.recycle();
2944 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002945
Dan Egnor60d87622009-12-16 16:32:58 -08002946 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08002947 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 {
2949 Parcel data = Parcel.obtain();
2950 Parcel reply = Parcel.obtain();
2951 data.writeInterfaceToken(IActivityManager.descriptor);
2952 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002953 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08002954 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08002955 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08002957 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002958 reply.recycle();
2959 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08002960 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 }
Dan Egnorb7f03672009-12-09 16:22:32 -08002962
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002963 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002964 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002965 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002966 {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07002971 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07002972 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07002973 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 reply.recycle();
2976 data.recycle();
2977 }
2978
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 public void signalPersistentProcesses(int sig) throws RemoteException {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 data.writeInt(sig);
2984 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
2985 reply.readException();
2986 data.recycle();
2987 reply.recycle();
2988 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08002989
Dianne Hackborn03abb812010-01-04 18:43:19 -08002990 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08002995 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
2996 reply.readException();
2997 data.recycle();
2998 reply.recycle();
2999 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003000
3001 public void killAllBackgroundProcesses() throws RemoteException {
3002 Parcel data = Parcel.obtain();
3003 Parcel reply = Parcel.obtain();
3004 data.writeInterfaceToken(IActivityManager.descriptor);
3005 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3006 reply.readException();
3007 data.recycle();
3008 reply.recycle();
3009 }
3010
Dianne Hackborn03abb812010-01-04 18:43:19 -08003011 public void forceStopPackage(String packageName) throws RemoteException {
3012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
3015 data.writeString(packageName);
3016 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 reply.readException();
3018 data.recycle();
3019 reply.recycle();
3020 }
3021
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003022 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3023 throws RemoteException
3024 {
3025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
3028 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 outInfo.readFromParcel(reply);
3031 reply.recycle();
3032 data.recycle();
3033 }
3034
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003035 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3036 {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3041 reply.readException();
3042 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3043 reply.recycle();
3044 data.recycle();
3045 return res;
3046 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003047
3048 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003049 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003050 {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 data.writeString(process);
3055 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003056 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003057 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003058 if (fd != null) {
3059 data.writeInt(1);
3060 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3061 } else {
3062 data.writeInt(0);
3063 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003064 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 boolean res = reply.readInt() != 0;
3067 reply.recycle();
3068 data.recycle();
3069 return res;
3070 }
3071
Dianne Hackborn55280a92009-05-07 15:53:46 -07003072 public boolean shutdown(int timeout) throws RemoteException
3073 {
3074 Parcel data = Parcel.obtain();
3075 Parcel reply = Parcel.obtain();
3076 data.writeInterfaceToken(IActivityManager.descriptor);
3077 data.writeInt(timeout);
3078 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3079 reply.readException();
3080 boolean res = reply.readInt() != 0;
3081 reply.recycle();
3082 data.recycle();
3083 return res;
3084 }
3085
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003086 public void stopAppSwitches() throws RemoteException {
3087 Parcel data = Parcel.obtain();
3088 Parcel reply = Parcel.obtain();
3089 data.writeInterfaceToken(IActivityManager.descriptor);
3090 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3091 reply.readException();
3092 reply.recycle();
3093 data.recycle();
3094 }
3095
3096 public void resumeAppSwitches() throws RemoteException {
3097 Parcel data = Parcel.obtain();
3098 Parcel reply = Parcel.obtain();
3099 data.writeInterfaceToken(IActivityManager.descriptor);
3100 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3101 reply.readException();
3102 reply.recycle();
3103 data.recycle();
3104 }
3105
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003106 public int startActivityInPackage(int uid,
3107 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003108 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003109 throws RemoteException {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeInt(uid);
3114 intent.writeToParcel(data, 0);
3115 data.writeString(resolvedType);
3116 data.writeStrongBinder(resultTo);
3117 data.writeString(resultWho);
3118 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003119 data.writeInt(startFlags);
3120 if (options != null) {
3121 data.writeInt(1);
3122 options.writeToParcel(data, 0);
3123 } else {
3124 data.writeInt(0);
3125 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003126 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 int result = reply.readInt();
3129 reply.recycle();
3130 data.recycle();
3131 return result;
3132 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003133
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003134 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeString(pkg);
3139 data.writeInt(uid);
3140 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3141 reply.readException();
3142 data.recycle();
3143 reply.recycle();
3144 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003145
3146 public void closeSystemDialogs(String reason) throws RemoteException {
3147 Parcel data = Parcel.obtain();
3148 Parcel reply = Parcel.obtain();
3149 data.writeInterfaceToken(IActivityManager.descriptor);
3150 data.writeString(reason);
3151 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3152 reply.readException();
3153 data.recycle();
3154 reply.recycle();
3155 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003156
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003157 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003158 throws RemoteException {
3159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003162 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003163 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3164 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003165 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003166 data.recycle();
3167 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003168 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003169 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003170
3171 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 data.writeString(processName);
3176 data.writeInt(uid);
3177 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 data.recycle();
3180 reply.recycle();
3181 }
3182
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003183 public void overridePendingTransition(IBinder token, String packageName,
3184 int enterAnim, int exitAnim) throws RemoteException {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeStrongBinder(token);
3189 data.writeString(packageName);
3190 data.writeInt(enterAnim);
3191 data.writeInt(exitAnim);
3192 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 data.recycle();
3195 reply.recycle();
3196 }
3197
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003198 public boolean isUserAMonkey() throws RemoteException {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3203 reply.readException();
3204 boolean res = reply.readInt() != 0;
3205 data.recycle();
3206 reply.recycle();
3207 return res;
3208 }
3209
Dianne Hackborn860755f2010-06-03 18:47:52 -07003210 public void finishHeavyWeightApp() throws RemoteException {
3211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
3213 data.writeInterfaceToken(IActivityManager.descriptor);
3214 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3215 reply.readException();
3216 data.recycle();
3217 reply.recycle();
3218 }
3219
Daniel Sandler69a48172010-06-23 16:29:36 -04003220 public void setImmersive(IBinder token, boolean immersive)
3221 throws RemoteException {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 data.writeStrongBinder(token);
3226 data.writeInt(immersive ? 1 : 0);
3227 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3228 reply.readException();
3229 data.recycle();
3230 reply.recycle();
3231 }
3232
3233 public boolean isImmersive(IBinder token)
3234 throws RemoteException {
3235 Parcel data = Parcel.obtain();
3236 Parcel reply = Parcel.obtain();
3237 data.writeInterfaceToken(IActivityManager.descriptor);
3238 data.writeStrongBinder(token);
3239 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003240 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003241 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003242 data.recycle();
3243 reply.recycle();
3244 return res;
3245 }
3246
3247 public boolean isTopActivityImmersive()
3248 throws RemoteException {
3249 Parcel data = Parcel.obtain();
3250 Parcel reply = Parcel.obtain();
3251 data.writeInterfaceToken(IActivityManager.descriptor);
3252 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003253 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003254 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003255 data.recycle();
3256 reply.recycle();
3257 return res;
3258 }
3259
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003260 public void crashApplication(int uid, int initialPid, String packageName,
3261 String message) throws RemoteException {
3262 Parcel data = Parcel.obtain();
3263 Parcel reply = Parcel.obtain();
3264 data.writeInterfaceToken(IActivityManager.descriptor);
3265 data.writeInt(uid);
3266 data.writeInt(initialPid);
3267 data.writeString(packageName);
3268 data.writeString(message);
3269 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3270 reply.readException();
3271 data.recycle();
3272 reply.recycle();
3273 }
Andy McFadden824c5102010-07-09 16:26:57 -07003274
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003275 public String getProviderMimeType(Uri uri)
3276 throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 uri.writeToParcel(data, 0);
3281 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3282 reply.readException();
3283 String res = reply.readString();
3284 data.recycle();
3285 reply.recycle();
3286 return res;
3287 }
3288
Dianne Hackborn7e269642010-08-25 19:50:20 -07003289 public IBinder newUriPermissionOwner(String name)
3290 throws RemoteException {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeString(name);
3295 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3296 reply.readException();
3297 IBinder res = reply.readStrongBinder();
3298 data.recycle();
3299 reply.recycle();
3300 return res;
3301 }
3302
3303 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3304 Uri uri, int mode) throws RemoteException {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(owner);
3309 data.writeInt(fromUid);
3310 data.writeString(targetPkg);
3311 uri.writeToParcel(data, 0);
3312 data.writeInt(mode);
3313 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3314 reply.readException();
3315 data.recycle();
3316 reply.recycle();
3317 }
3318
3319 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3320 int mode) throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(owner);
3325 if (uri != null) {
3326 data.writeInt(1);
3327 uri.writeToParcel(data, 0);
3328 } else {
3329 data.writeInt(0);
3330 }
3331 data.writeInt(mode);
3332 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 data.recycle();
3335 reply.recycle();
3336 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003337
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003338 public int checkGrantUriPermission(int callingUid, String targetPkg,
3339 Uri uri, int modeFlags) throws RemoteException {
3340 Parcel data = Parcel.obtain();
3341 Parcel reply = Parcel.obtain();
3342 data.writeInterfaceToken(IActivityManager.descriptor);
3343 data.writeInt(callingUid);
3344 data.writeString(targetPkg);
3345 uri.writeToParcel(data, 0);
3346 data.writeInt(modeFlags);
3347 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3348 reply.readException();
3349 int res = reply.readInt();
3350 data.recycle();
3351 reply.recycle();
3352 return res;
3353 }
3354
Andy McFadden824c5102010-07-09 16:26:57 -07003355 public boolean dumpHeap(String process, boolean managed,
3356 String path, ParcelFileDescriptor fd) throws RemoteException {
3357 Parcel data = Parcel.obtain();
3358 Parcel reply = Parcel.obtain();
3359 data.writeInterfaceToken(IActivityManager.descriptor);
3360 data.writeString(process);
3361 data.writeInt(managed ? 1 : 0);
3362 data.writeString(path);
3363 if (fd != null) {
3364 data.writeInt(1);
3365 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3366 } else {
3367 data.writeInt(0);
3368 }
3369 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3370 reply.readException();
3371 boolean res = reply.readInt() != 0;
3372 reply.recycle();
3373 data.recycle();
3374 return res;
3375 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003376
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003377 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003378 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3379 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003380 Parcel data = Parcel.obtain();
3381 Parcel reply = Parcel.obtain();
3382 data.writeInterfaceToken(IActivityManager.descriptor);
3383 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3384 data.writeTypedArray(intents, 0);
3385 data.writeStringArray(resolvedTypes);
3386 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003387 if (options != null) {
3388 data.writeInt(1);
3389 options.writeToParcel(data, 0);
3390 } else {
3391 data.writeInt(0);
3392 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003393 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3394 reply.readException();
3395 int result = reply.readInt();
3396 reply.recycle();
3397 data.recycle();
3398 return result;
3399 }
3400
3401 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003402 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3403 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 data.writeInt(uid);
3408 data.writeTypedArray(intents, 0);
3409 data.writeStringArray(resolvedTypes);
3410 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003411 if (options != null) {
3412 data.writeInt(1);
3413 options.writeToParcel(data, 0);
3414 } else {
3415 data.writeInt(0);
3416 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003417 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 int result = reply.readInt();
3420 reply.recycle();
3421 data.recycle();
3422 return result;
3423 }
3424
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003425 public int getFrontActivityScreenCompatMode() throws RemoteException {
3426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3430 reply.readException();
3431 int mode = reply.readInt();
3432 reply.recycle();
3433 data.recycle();
3434 return mode;
3435 }
3436
3437 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3438 Parcel data = Parcel.obtain();
3439 Parcel reply = Parcel.obtain();
3440 data.writeInterfaceToken(IActivityManager.descriptor);
3441 data.writeInt(mode);
3442 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 reply.recycle();
3445 data.recycle();
3446 }
3447
3448 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003452 data.writeString(packageName);
3453 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003454 reply.readException();
3455 int mode = reply.readInt();
3456 reply.recycle();
3457 data.recycle();
3458 return mode;
3459 }
3460
3461 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003462 throws RemoteException {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003467 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003468 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 reply.recycle();
3471 data.recycle();
3472 }
3473
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003474 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3475 Parcel data = Parcel.obtain();
3476 Parcel reply = Parcel.obtain();
3477 data.writeInterfaceToken(IActivityManager.descriptor);
3478 data.writeString(packageName);
3479 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 boolean ask = reply.readInt() != 0;
3482 reply.recycle();
3483 data.recycle();
3484 return ask;
3485 }
3486
3487 public void setPackageAskScreenCompat(String packageName, boolean ask)
3488 throws RemoteException {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeString(packageName);
3493 data.writeInt(ask ? 1 : 0);
3494 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 reply.recycle();
3497 data.recycle();
3498 }
3499
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003500 public boolean switchUser(int userid) throws RemoteException {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 data.writeInt(userid);
3505 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 boolean result = reply.readInt() != 0;
3508 reply.recycle();
3509 data.recycle();
3510 return result;
3511 }
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003512
3513 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3514 Parcel data = Parcel.obtain();
3515 Parcel reply = Parcel.obtain();
3516 data.writeInterfaceToken(IActivityManager.descriptor);
3517 data.writeInt(taskId);
3518 data.writeInt(subTaskIndex);
3519 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 boolean result = reply.readInt() != 0;
3522 reply.recycle();
3523 data.recycle();
3524 return result;
3525 }
3526
3527 public boolean removeTask(int taskId, int flags) throws RemoteException {
3528 Parcel data = Parcel.obtain();
3529 Parcel reply = Parcel.obtain();
3530 data.writeInterfaceToken(IActivityManager.descriptor);
3531 data.writeInt(taskId);
3532 data.writeInt(flags);
3533 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3534 reply.readException();
3535 boolean result = reply.readInt() != 0;
3536 reply.recycle();
3537 data.recycle();
3538 return result;
3539 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003540
Jeff Sharkeya4620792011-05-20 15:29:23 -07003541 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3542 Parcel data = Parcel.obtain();
3543 Parcel reply = Parcel.obtain();
3544 data.writeInterfaceToken(IActivityManager.descriptor);
3545 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3546 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3547 reply.readException();
3548 data.recycle();
3549 reply.recycle();
3550 }
3551
3552 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3553 Parcel data = Parcel.obtain();
3554 Parcel reply = Parcel.obtain();
3555 data.writeInterfaceToken(IActivityManager.descriptor);
3556 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3557 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 data.recycle();
3560 reply.recycle();
3561 }
3562
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003563 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3564 Parcel data = Parcel.obtain();
3565 Parcel reply = Parcel.obtain();
3566 data.writeInterfaceToken(IActivityManager.descriptor);
3567 data.writeStrongBinder(sender.asBinder());
3568 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 boolean res = reply.readInt() != 0;
3571 data.recycle();
3572 reply.recycle();
3573 return res;
3574 }
3575
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003576 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3577 {
3578 Parcel data = Parcel.obtain();
3579 Parcel reply = Parcel.obtain();
3580 data.writeInterfaceToken(IActivityManager.descriptor);
3581 values.writeToParcel(data, 0);
3582 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3583 reply.readException();
3584 data.recycle();
3585 reply.recycle();
3586 }
3587
Dianne Hackbornb437e092011-08-05 17:50:29 -07003588 public long[] getProcessPss(int[] pids) throws RemoteException {
3589 Parcel data = Parcel.obtain();
3590 Parcel reply = Parcel.obtain();
3591 data.writeInterfaceToken(IActivityManager.descriptor);
3592 data.writeIntArray(pids);
3593 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 long[] res = reply.createLongArray();
3596 data.recycle();
3597 reply.recycle();
3598 return res;
3599 }
3600
Dianne Hackborn661cd522011-08-22 00:26:20 -07003601 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3602 Parcel data = Parcel.obtain();
3603 Parcel reply = Parcel.obtain();
3604 data.writeInterfaceToken(IActivityManager.descriptor);
3605 TextUtils.writeToParcel(msg, data, 0);
3606 data.writeInt(always ? 1 : 0);
3607 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 data.recycle();
3610 reply.recycle();
3611 }
3612
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003613 public void dismissKeyguardOnNextActivity() throws RemoteException {
3614 Parcel data = Parcel.obtain();
3615 Parcel reply = Parcel.obtain();
3616 data.writeInterfaceToken(IActivityManager.descriptor);
3617 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3618 reply.readException();
3619 data.recycle();
3620 reply.recycle();
3621 }
3622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003623 private IBinder mRemote;
3624}