blob: 4506546d02d5b8ba89239ab780fefc59e3e6014c [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;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
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;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080044import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import java.util.ArrayList;
47import java.util.List;
48
49/** {@hide} */
50public abstract class ActivityManagerNative extends Binder implements IActivityManager
51{
52 /**
53 * Cast a Binder object into an activity manager interface, generating
54 * a proxy if needed.
55 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080056 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 if (obj == null) {
58 return null;
59 }
60 IActivityManager in =
61 (IActivityManager)obj.queryLocalInterface(descriptor);
62 if (in != null) {
63 return in;
64 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080065
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066 return new ActivityManagerProxy(obj);
67 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080069 /**
70 * Retrieve the system's default/global activity manager.
71 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072 static public IActivityManager getDefault() {
73 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 }
75
76 /**
77 * Convenience for checking whether the system is ready. For internal use only.
78 */
79 static public boolean isSystemReady() {
80 if (!sSystemReady) {
81 sSystemReady = getDefault().testIsSystemReady();
82 }
83 return sSystemReady;
84 }
85 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 /**
88 * Convenience for sending a sticky broadcast. For internal use only.
89 * If you don't care about permission, use null.
90 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080091 static public void broadcastStickyIntent(Intent intent, String permission) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 try {
93 getDefault().broadcastIntent(
94 null, intent, null, null, Activity.RESULT_OK, null, null,
Amith Yamasani742a6712011-05-04 14:49:28 -070095 null /*permission*/, false, true, Binder.getOrigCallingUser());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 } catch (RemoteException ex) {
97 }
98 }
99
100 static public void noteWakeupAlarm(PendingIntent ps) {
101 try {
102 getDefault().noteWakeupAlarm(ps.getTarget());
103 } catch (RemoteException ex) {
104 }
105 }
106
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800107 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 attachInterface(this, descriptor);
109 }
110
111 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
112 throws RemoteException {
113 switch (code) {
114 case START_ACTIVITY_TRANSACTION:
115 {
116 data.enforceInterface(IActivityManager.descriptor);
117 IBinder b = data.readStrongBinder();
118 IApplicationThread app = ApplicationThreadNative.asInterface(b);
119 Intent intent = Intent.CREATOR.createFromParcel(data);
120 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800122 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800123 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700124 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700125 String profileFile = data.readString();
126 ParcelFileDescriptor profileFd = data.readInt() != 0
127 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700128 Bundle options = data.readInt() != 0
129 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 int result = startActivity(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700131 resultTo, resultWho, requestCode, startFlags,
132 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133 reply.writeNoException();
134 reply.writeInt(result);
135 return true;
136 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700137
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800138 case START_ACTIVITY_AND_WAIT_TRANSACTION:
139 {
140 data.enforceInterface(IActivityManager.descriptor);
141 IBinder b = data.readStrongBinder();
142 IApplicationThread app = ApplicationThreadNative.asInterface(b);
143 Intent intent = Intent.CREATOR.createFromParcel(data);
144 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800145 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800146 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800147 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700148 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700149 String profileFile = data.readString();
150 ParcelFileDescriptor profileFd = data.readInt() != 0
151 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700152 Bundle options = data.readInt() != 0
153 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800154 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700155 resultTo, resultWho, requestCode, startFlags,
156 profileFile, profileFd, options);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800157 reply.writeNoException();
158 result.writeToParcel(reply, 0);
159 return true;
160 }
161
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700162 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
163 {
164 data.enforceInterface(IActivityManager.descriptor);
165 IBinder b = data.readStrongBinder();
166 IApplicationThread app = ApplicationThreadNative.asInterface(b);
167 Intent intent = Intent.CREATOR.createFromParcel(data);
168 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700169 IBinder resultTo = data.readStrongBinder();
170 String resultWho = data.readString();
171 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700172 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700173 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700174 Bundle options = data.readInt() != 0
175 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700176 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700177 resultTo, resultWho, requestCode, startFlags, config, options);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700178 reply.writeNoException();
179 reply.writeInt(result);
180 return true;
181 }
182
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700183 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700184 {
185 data.enforceInterface(IActivityManager.descriptor);
186 IBinder b = data.readStrongBinder();
187 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700188 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700189 Intent fillInIntent = null;
190 if (data.readInt() != 0) {
191 fillInIntent = Intent.CREATOR.createFromParcel(data);
192 }
193 String resolvedType = data.readString();
194 IBinder resultTo = data.readStrongBinder();
195 String resultWho = data.readString();
196 int requestCode = data.readInt();
197 int flagsMask = data.readInt();
198 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700199 Bundle options = data.readInt() != 0
200 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700201 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700202 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700203 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700204 reply.writeNoException();
205 reply.writeInt(result);
206 return true;
207 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208
209 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
210 {
211 data.enforceInterface(IActivityManager.descriptor);
212 IBinder callingActivity = data.readStrongBinder();
213 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700214 Bundle options = data.readInt() != 0
215 ? Bundle.CREATOR.createFromParcel(data) : null;
216 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800217 reply.writeNoException();
218 reply.writeInt(result ? 1 : 0);
219 return true;
220 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700221
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800222 case FINISH_ACTIVITY_TRANSACTION: {
223 data.enforceInterface(IActivityManager.descriptor);
224 IBinder token = data.readStrongBinder();
225 Intent resultData = null;
226 int resultCode = data.readInt();
227 if (data.readInt() != 0) {
228 resultData = Intent.CREATOR.createFromParcel(data);
229 }
230 boolean res = finishActivity(token, resultCode, resultData);
231 reply.writeNoException();
232 reply.writeInt(res ? 1 : 0);
233 return true;
234 }
235
236 case FINISH_SUB_ACTIVITY_TRANSACTION: {
237 data.enforceInterface(IActivityManager.descriptor);
238 IBinder token = data.readStrongBinder();
239 String resultWho = data.readString();
240 int requestCode = data.readInt();
241 finishSubActivity(token, resultWho, requestCode);
242 reply.writeNoException();
243 return true;
244 }
245
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700246 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder token = data.readStrongBinder();
249 boolean res = finishActivityAffinity(token);
250 reply.writeNoException();
251 reply.writeInt(res ? 1 : 0);
252 return true;
253 }
254
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800255 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
256 data.enforceInterface(IActivityManager.descriptor);
257 IBinder token = data.readStrongBinder();
258 boolean res = willActivityBeVisible(token);
259 reply.writeNoException();
260 reply.writeInt(res ? 1 : 0);
261 return true;
262 }
263
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800264 case REGISTER_RECEIVER_TRANSACTION:
265 {
266 data.enforceInterface(IActivityManager.descriptor);
267 IBinder b = data.readStrongBinder();
268 IApplicationThread app =
269 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700270 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800271 b = data.readStrongBinder();
272 IIntentReceiver rec
273 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
274 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
275 String perm = data.readString();
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700276 Intent intent = registerReceiver(app, packageName, rec, filter, perm);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800277 reply.writeNoException();
278 if (intent != null) {
279 reply.writeInt(1);
280 intent.writeToParcel(reply, 0);
281 } else {
282 reply.writeInt(0);
283 }
284 return true;
285 }
286
287 case UNREGISTER_RECEIVER_TRANSACTION:
288 {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder b = data.readStrongBinder();
291 if (b == null) {
292 return true;
293 }
294 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
295 unregisterReceiver(rec);
296 reply.writeNoException();
297 return true;
298 }
299
300 case BROADCAST_INTENT_TRANSACTION:
301 {
302 data.enforceInterface(IActivityManager.descriptor);
303 IBinder b = data.readStrongBinder();
304 IApplicationThread app =
305 b != null ? ApplicationThreadNative.asInterface(b) : null;
306 Intent intent = Intent.CREATOR.createFromParcel(data);
307 String resolvedType = data.readString();
308 b = data.readStrongBinder();
309 IIntentReceiver resultTo =
310 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
311 int resultCode = data.readInt();
312 String resultData = data.readString();
313 Bundle resultExtras = data.readBundle();
314 String perm = data.readString();
315 boolean serialized = data.readInt() != 0;
316 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700317 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800318 int res = broadcastIntent(app, intent, resolvedType, resultTo,
319 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700320 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 reply.writeNoException();
322 reply.writeInt(res);
323 return true;
324 }
325
326 case UNBROADCAST_INTENT_TRANSACTION:
327 {
328 data.enforceInterface(IActivityManager.descriptor);
329 IBinder b = data.readStrongBinder();
330 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
331 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700332 int userId = data.readInt();
333 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800334 reply.writeNoException();
335 return true;
336 }
337
338 case FINISH_RECEIVER_TRANSACTION: {
339 data.enforceInterface(IActivityManager.descriptor);
340 IBinder who = data.readStrongBinder();
341 int resultCode = data.readInt();
342 String resultData = data.readString();
343 Bundle resultExtras = data.readBundle();
344 boolean resultAbort = data.readInt() != 0;
345 if (who != null) {
346 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
347 }
348 reply.writeNoException();
349 return true;
350 }
351
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 case ATTACH_APPLICATION_TRANSACTION: {
353 data.enforceInterface(IActivityManager.descriptor);
354 IApplicationThread app = ApplicationThreadNative.asInterface(
355 data.readStrongBinder());
356 if (app != null) {
357 attachApplication(app);
358 }
359 reply.writeNoException();
360 return true;
361 }
362
363 case ACTIVITY_IDLE_TRANSACTION: {
364 data.enforceInterface(IActivityManager.descriptor);
365 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700366 Configuration config = null;
367 if (data.readInt() != 0) {
368 config = Configuration.CREATOR.createFromParcel(data);
369 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700370 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700372 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800373 }
374 reply.writeNoException();
375 return true;
376 }
377
378 case ACTIVITY_PAUSED_TRANSACTION: {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800381 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800382 reply.writeNoException();
383 return true;
384 }
385
386 case ACTIVITY_STOPPED_TRANSACTION: {
387 data.enforceInterface(IActivityManager.descriptor);
388 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800389 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 Bitmap thumbnail = data.readInt() != 0
391 ? Bitmap.CREATOR.createFromParcel(data) : null;
392 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800393 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800394 reply.writeNoException();
395 return true;
396 }
397
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800398 case ACTIVITY_SLEPT_TRANSACTION: {
399 data.enforceInterface(IActivityManager.descriptor);
400 IBinder token = data.readStrongBinder();
401 activitySlept(token);
402 reply.writeNoException();
403 return true;
404 }
405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 case ACTIVITY_DESTROYED_TRANSACTION: {
407 data.enforceInterface(IActivityManager.descriptor);
408 IBinder token = data.readStrongBinder();
409 activityDestroyed(token);
410 reply.writeNoException();
411 return true;
412 }
413
414 case GET_CALLING_PACKAGE_TRANSACTION: {
415 data.enforceInterface(IActivityManager.descriptor);
416 IBinder token = data.readStrongBinder();
417 String res = token != null ? getCallingPackage(token) : null;
418 reply.writeNoException();
419 reply.writeString(res);
420 return true;
421 }
422
423 case GET_CALLING_ACTIVITY_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder token = data.readStrongBinder();
426 ComponentName cn = getCallingActivity(token);
427 reply.writeNoException();
428 ComponentName.writeToParcel(cn, reply);
429 return true;
430 }
431
432 case GET_TASKS_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 int maxNum = data.readInt();
435 int fl = data.readInt();
436 IBinder receiverBinder = data.readStrongBinder();
437 IThumbnailReceiver receiver = receiverBinder != null
438 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
439 : null;
440 List list = getTasks(maxNum, fl, receiver);
441 reply.writeNoException();
442 int N = list != null ? list.size() : -1;
443 reply.writeInt(N);
444 int i;
445 for (i=0; i<N; i++) {
446 ActivityManager.RunningTaskInfo info =
447 (ActivityManager.RunningTaskInfo)list.get(i);
448 info.writeToParcel(reply, 0);
449 }
450 return true;
451 }
452
453 case GET_RECENT_TASKS_TRANSACTION: {
454 data.enforceInterface(IActivityManager.descriptor);
455 int maxNum = data.readInt();
456 int fl = data.readInt();
457 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
458 fl);
459 reply.writeNoException();
460 reply.writeTypedList(list);
461 return true;
462 }
463
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700464 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800465 data.enforceInterface(IActivityManager.descriptor);
466 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700467 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800468 reply.writeNoException();
469 if (bm != null) {
470 reply.writeInt(1);
471 bm.writeToParcel(reply, 0);
472 } else {
473 reply.writeInt(0);
474 }
475 return true;
476 }
477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 case GET_SERVICES_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 int maxNum = data.readInt();
481 int fl = data.readInt();
482 List list = getServices(maxNum, fl);
483 reply.writeNoException();
484 int N = list != null ? list.size() : -1;
485 reply.writeInt(N);
486 int i;
487 for (i=0; i<N; i++) {
488 ActivityManager.RunningServiceInfo info =
489 (ActivityManager.RunningServiceInfo)list.get(i);
490 info.writeToParcel(reply, 0);
491 }
492 return true;
493 }
494
495 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
496 data.enforceInterface(IActivityManager.descriptor);
497 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
498 reply.writeNoException();
499 reply.writeTypedList(list);
500 return true;
501 }
502
503 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
504 data.enforceInterface(IActivityManager.descriptor);
505 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
506 reply.writeNoException();
507 reply.writeTypedList(list);
508 return true;
509 }
510
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700511 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
512 data.enforceInterface(IActivityManager.descriptor);
513 List<ApplicationInfo> list = getRunningExternalApplications();
514 reply.writeNoException();
515 reply.writeTypedList(list);
516 return true;
517 }
518
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 case MOVE_TASK_TO_FRONT_TRANSACTION: {
520 data.enforceInterface(IActivityManager.descriptor);
521 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800522 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700523 Bundle options = data.readInt() != 0
524 ? Bundle.CREATOR.createFromParcel(data) : null;
525 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 reply.writeNoException();
527 return true;
528 }
529
530 case MOVE_TASK_TO_BACK_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 int task = data.readInt();
533 moveTaskToBack(task);
534 reply.writeNoException();
535 return true;
536 }
537
538 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 IBinder token = data.readStrongBinder();
541 boolean nonRoot = data.readInt() != 0;
542 boolean res = moveActivityTaskToBack(token, nonRoot);
543 reply.writeNoException();
544 reply.writeInt(res ? 1 : 0);
545 return true;
546 }
547
548 case MOVE_TASK_BACKWARDS_TRANSACTION: {
549 data.enforceInterface(IActivityManager.descriptor);
550 int task = data.readInt();
551 moveTaskBackwards(task);
552 reply.writeNoException();
553 return true;
554 }
555
556 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
557 data.enforceInterface(IActivityManager.descriptor);
558 IBinder token = data.readStrongBinder();
559 boolean onlyRoot = data.readInt() != 0;
560 int res = token != null
561 ? getTaskForActivity(token, onlyRoot) : -1;
562 reply.writeNoException();
563 reply.writeInt(res);
564 return true;
565 }
566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800567 case REPORT_THUMBNAIL_TRANSACTION: {
568 data.enforceInterface(IActivityManager.descriptor);
569 IBinder token = data.readStrongBinder();
570 Bitmap thumbnail = data.readInt() != 0
571 ? Bitmap.CREATOR.createFromParcel(data) : null;
572 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
573 reportThumbnail(token, thumbnail, description);
574 reply.writeNoException();
575 return true;
576 }
577
578 case GET_CONTENT_PROVIDER_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 IBinder b = data.readStrongBinder();
581 IApplicationThread app = ApplicationThreadNative.asInterface(b);
582 String name = data.readString();
583 ContentProviderHolder cph = getContentProvider(app, name);
584 reply.writeNoException();
585 if (cph != null) {
586 reply.writeInt(1);
587 cph.writeToParcel(reply, 0);
588 } else {
589 reply.writeInt(0);
590 }
591 return true;
592 }
593
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800594 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 String name = data.readString();
597 IBinder token = data.readStrongBinder();
598 ContentProviderHolder cph = getContentProviderExternal(name, token);
599 reply.writeNoException();
600 if (cph != null) {
601 reply.writeInt(1);
602 cph.writeToParcel(reply, 0);
603 } else {
604 reply.writeInt(0);
605 }
606 return true;
607 }
608
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
610 data.enforceInterface(IActivityManager.descriptor);
611 IBinder b = data.readStrongBinder();
612 IApplicationThread app = ApplicationThreadNative.asInterface(b);
613 ArrayList<ContentProviderHolder> providers =
614 data.createTypedArrayList(ContentProviderHolder.CREATOR);
615 publishContentProviders(app, providers);
616 reply.writeNoException();
617 return true;
618 }
619
620 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
621 data.enforceInterface(IActivityManager.descriptor);
622 IBinder b = data.readStrongBinder();
623 IApplicationThread app = ApplicationThreadNative.asInterface(b);
624 String name = data.readString();
625 removeContentProvider(app, name);
626 reply.writeNoException();
627 return true;
628 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800629
630 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
631 data.enforceInterface(IActivityManager.descriptor);
632 String name = data.readString();
633 IBinder token = data.readStrongBinder();
634 removeContentProviderExternal(name, token);
635 reply.writeNoException();
636 return true;
637 }
638
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700639 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
640 data.enforceInterface(IActivityManager.descriptor);
641 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
642 PendingIntent pi = getRunningServiceControlPanel(comp);
643 reply.writeNoException();
644 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
645 return true;
646 }
647
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 case START_SERVICE_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 IBinder b = data.readStrongBinder();
651 IApplicationThread app = ApplicationThreadNative.asInterface(b);
652 Intent service = Intent.CREATOR.createFromParcel(data);
653 String resolvedType = data.readString();
654 ComponentName cn = startService(app, service, resolvedType);
655 reply.writeNoException();
656 ComponentName.writeToParcel(cn, reply);
657 return true;
658 }
659
660 case STOP_SERVICE_TRANSACTION: {
661 data.enforceInterface(IActivityManager.descriptor);
662 IBinder b = data.readStrongBinder();
663 IApplicationThread app = ApplicationThreadNative.asInterface(b);
664 Intent service = Intent.CREATOR.createFromParcel(data);
665 String resolvedType = data.readString();
666 int res = stopService(app, service, resolvedType);
667 reply.writeNoException();
668 reply.writeInt(res);
669 return true;
670 }
671
672 case STOP_SERVICE_TOKEN_TRANSACTION: {
673 data.enforceInterface(IActivityManager.descriptor);
674 ComponentName className = ComponentName.readFromParcel(data);
675 IBinder token = data.readStrongBinder();
676 int startId = data.readInt();
677 boolean res = stopServiceToken(className, token, startId);
678 reply.writeNoException();
679 reply.writeInt(res ? 1 : 0);
680 return true;
681 }
682
683 case SET_SERVICE_FOREGROUND_TRANSACTION: {
684 data.enforceInterface(IActivityManager.descriptor);
685 ComponentName className = ComponentName.readFromParcel(data);
686 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700687 int id = data.readInt();
688 Notification notification = null;
689 if (data.readInt() != 0) {
690 notification = Notification.CREATOR.createFromParcel(data);
691 }
692 boolean removeNotification = data.readInt() != 0;
693 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 reply.writeNoException();
695 return true;
696 }
697
698 case BIND_SERVICE_TRANSACTION: {
699 data.enforceInterface(IActivityManager.descriptor);
700 IBinder b = data.readStrongBinder();
701 IApplicationThread app = ApplicationThreadNative.asInterface(b);
702 IBinder token = data.readStrongBinder();
703 Intent service = Intent.CREATOR.createFromParcel(data);
704 String resolvedType = data.readString();
705 b = data.readStrongBinder();
706 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800707 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800708 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800709 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 reply.writeNoException();
711 reply.writeInt(res);
712 return true;
713 }
714
715 case UNBIND_SERVICE_TRANSACTION: {
716 data.enforceInterface(IActivityManager.descriptor);
717 IBinder b = data.readStrongBinder();
718 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
719 boolean res = unbindService(conn);
720 reply.writeNoException();
721 reply.writeInt(res ? 1 : 0);
722 return true;
723 }
724
725 case PUBLISH_SERVICE_TRANSACTION: {
726 data.enforceInterface(IActivityManager.descriptor);
727 IBinder token = data.readStrongBinder();
728 Intent intent = Intent.CREATOR.createFromParcel(data);
729 IBinder service = data.readStrongBinder();
730 publishService(token, intent, service);
731 reply.writeNoException();
732 return true;
733 }
734
735 case UNBIND_FINISHED_TRANSACTION: {
736 data.enforceInterface(IActivityManager.descriptor);
737 IBinder token = data.readStrongBinder();
738 Intent intent = Intent.CREATOR.createFromParcel(data);
739 boolean doRebind = data.readInt() != 0;
740 unbindFinished(token, intent, doRebind);
741 reply.writeNoException();
742 return true;
743 }
744
745 case SERVICE_DONE_EXECUTING_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700748 int type = data.readInt();
749 int startId = data.readInt();
750 int res = data.readInt();
751 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800752 reply.writeNoException();
753 return true;
754 }
755
756 case START_INSTRUMENTATION_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 ComponentName className = ComponentName.readFromParcel(data);
759 String profileFile = data.readString();
760 int fl = data.readInt();
761 Bundle arguments = data.readBundle();
762 IBinder b = data.readStrongBinder();
763 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
764 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
765 reply.writeNoException();
766 reply.writeInt(res ? 1 : 0);
767 return true;
768 }
769
770
771 case FINISH_INSTRUMENTATION_TRANSACTION: {
772 data.enforceInterface(IActivityManager.descriptor);
773 IBinder b = data.readStrongBinder();
774 IApplicationThread app = ApplicationThreadNative.asInterface(b);
775 int resultCode = data.readInt();
776 Bundle results = data.readBundle();
777 finishInstrumentation(app, resultCode, results);
778 reply.writeNoException();
779 return true;
780 }
781
782 case GET_CONFIGURATION_TRANSACTION: {
783 data.enforceInterface(IActivityManager.descriptor);
784 Configuration config = getConfiguration();
785 reply.writeNoException();
786 config.writeToParcel(reply, 0);
787 return true;
788 }
789
790 case UPDATE_CONFIGURATION_TRANSACTION: {
791 data.enforceInterface(IActivityManager.descriptor);
792 Configuration config = Configuration.CREATOR.createFromParcel(data);
793 updateConfiguration(config);
794 reply.writeNoException();
795 return true;
796 }
797
798 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
799 data.enforceInterface(IActivityManager.descriptor);
800 IBinder token = data.readStrongBinder();
801 int requestedOrientation = data.readInt();
802 setRequestedOrientation(token, requestedOrientation);
803 reply.writeNoException();
804 return true;
805 }
806
807 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 IBinder token = data.readStrongBinder();
810 int req = getRequestedOrientation(token);
811 reply.writeNoException();
812 reply.writeInt(req);
813 return true;
814 }
815
816 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
817 data.enforceInterface(IActivityManager.descriptor);
818 IBinder token = data.readStrongBinder();
819 ComponentName cn = getActivityClassForToken(token);
820 reply.writeNoException();
821 ComponentName.writeToParcel(cn, reply);
822 return true;
823 }
824
825 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
826 data.enforceInterface(IActivityManager.descriptor);
827 IBinder token = data.readStrongBinder();
828 reply.writeNoException();
829 reply.writeString(getPackageForToken(token));
830 return true;
831 }
832
833 case GET_INTENT_SENDER_TRANSACTION: {
834 data.enforceInterface(IActivityManager.descriptor);
835 int type = data.readInt();
836 String packageName = data.readString();
837 IBinder token = data.readStrongBinder();
838 String resultWho = data.readString();
839 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800840 Intent[] requestIntents;
841 String[] requestResolvedTypes;
842 if (data.readInt() != 0) {
843 requestIntents = data.createTypedArray(Intent.CREATOR);
844 requestResolvedTypes = data.createStringArray();
845 } else {
846 requestIntents = null;
847 requestResolvedTypes = null;
848 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800849 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700850 Bundle options = data.readInt() != 0
851 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800852 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800853 resultWho, requestCode, requestIntents,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700854 requestResolvedTypes, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800855 reply.writeNoException();
856 reply.writeStrongBinder(res != null ? res.asBinder() : null);
857 return true;
858 }
859
860 case CANCEL_INTENT_SENDER_TRANSACTION: {
861 data.enforceInterface(IActivityManager.descriptor);
862 IIntentSender r = IIntentSender.Stub.asInterface(
863 data.readStrongBinder());
864 cancelIntentSender(r);
865 reply.writeNoException();
866 return true;
867 }
868
869 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
870 data.enforceInterface(IActivityManager.descriptor);
871 IIntentSender r = IIntentSender.Stub.asInterface(
872 data.readStrongBinder());
873 String res = getPackageForIntentSender(r);
874 reply.writeNoException();
875 reply.writeString(res);
876 return true;
877 }
878
Christopher Tatec4a07d12012-04-06 14:19:13 -0700879 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
880 data.enforceInterface(IActivityManager.descriptor);
881 IIntentSender r = IIntentSender.Stub.asInterface(
882 data.readStrongBinder());
883 int res = getUidForIntentSender(r);
884 reply.writeNoException();
885 reply.writeInt(res);
886 return true;
887 }
888
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800889 case SET_PROCESS_LIMIT_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 int max = data.readInt();
892 setProcessLimit(max);
893 reply.writeNoException();
894 return true;
895 }
896
897 case GET_PROCESS_LIMIT_TRANSACTION: {
898 data.enforceInterface(IActivityManager.descriptor);
899 int limit = getProcessLimit();
900 reply.writeNoException();
901 reply.writeInt(limit);
902 return true;
903 }
904
905 case SET_PROCESS_FOREGROUND_TRANSACTION: {
906 data.enforceInterface(IActivityManager.descriptor);
907 IBinder token = data.readStrongBinder();
908 int pid = data.readInt();
909 boolean isForeground = data.readInt() != 0;
910 setProcessForeground(token, pid, isForeground);
911 reply.writeNoException();
912 return true;
913 }
914
915 case CHECK_PERMISSION_TRANSACTION: {
916 data.enforceInterface(IActivityManager.descriptor);
917 String perm = data.readString();
918 int pid = data.readInt();
919 int uid = data.readInt();
920 int res = checkPermission(perm, pid, uid);
921 reply.writeNoException();
922 reply.writeInt(res);
923 return true;
924 }
925
926 case CHECK_URI_PERMISSION_TRANSACTION: {
927 data.enforceInterface(IActivityManager.descriptor);
928 Uri uri = Uri.CREATOR.createFromParcel(data);
929 int pid = data.readInt();
930 int uid = data.readInt();
931 int mode = data.readInt();
932 int res = checkUriPermission(uri, pid, uid, mode);
933 reply.writeNoException();
934 reply.writeInt(res);
935 return true;
936 }
937
938 case CLEAR_APP_DATA_TRANSACTION: {
939 data.enforceInterface(IActivityManager.descriptor);
940 String packageName = data.readString();
941 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
942 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -0700943 int userId = data.readInt();
944 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800945 reply.writeNoException();
946 reply.writeInt(res ? 1 : 0);
947 return true;
948 }
949
950 case GRANT_URI_PERMISSION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder b = data.readStrongBinder();
953 IApplicationThread app = ApplicationThreadNative.asInterface(b);
954 String targetPkg = data.readString();
955 Uri uri = Uri.CREATOR.createFromParcel(data);
956 int mode = data.readInt();
957 grantUriPermission(app, targetPkg, uri, mode);
958 reply.writeNoException();
959 return true;
960 }
961
962 case REVOKE_URI_PERMISSION_TRANSACTION: {
963 data.enforceInterface(IActivityManager.descriptor);
964 IBinder b = data.readStrongBinder();
965 IApplicationThread app = ApplicationThreadNative.asInterface(b);
966 Uri uri = Uri.CREATOR.createFromParcel(data);
967 int mode = data.readInt();
968 revokeUriPermission(app, uri, mode);
969 reply.writeNoException();
970 return true;
971 }
972
973 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
974 data.enforceInterface(IActivityManager.descriptor);
975 IBinder b = data.readStrongBinder();
976 IApplicationThread app = ApplicationThreadNative.asInterface(b);
977 boolean waiting = data.readInt() != 0;
978 showWaitingForDebugger(app, waiting);
979 reply.writeNoException();
980 return true;
981 }
982
983 case GET_MEMORY_INFO_TRANSACTION: {
984 data.enforceInterface(IActivityManager.descriptor);
985 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
986 getMemoryInfo(mi);
987 reply.writeNoException();
988 mi.writeToParcel(reply, 0);
989 return true;
990 }
991
992 case UNHANDLED_BACK_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 unhandledBack();
995 reply.writeNoException();
996 return true;
997 }
998
999 case OPEN_CONTENT_URI_TRANSACTION: {
1000 data.enforceInterface(IActivityManager.descriptor);
1001 Uri uri = Uri.parse(data.readString());
1002 ParcelFileDescriptor pfd = openContentUri(uri);
1003 reply.writeNoException();
1004 if (pfd != null) {
1005 reply.writeInt(1);
1006 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1007 } else {
1008 reply.writeInt(0);
1009 }
1010 return true;
1011 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001012
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001013 case GOING_TO_SLEEP_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 goingToSleep();
1016 reply.writeNoException();
1017 return true;
1018 }
1019
1020 case WAKING_UP_TRANSACTION: {
1021 data.enforceInterface(IActivityManager.descriptor);
1022 wakingUp();
1023 reply.writeNoException();
1024 return true;
1025 }
1026
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001027 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 setLockScreenShown(data.readInt() != 0);
1030 reply.writeNoException();
1031 return true;
1032 }
1033
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001034 case SET_DEBUG_APP_TRANSACTION: {
1035 data.enforceInterface(IActivityManager.descriptor);
1036 String pn = data.readString();
1037 boolean wfd = data.readInt() != 0;
1038 boolean per = data.readInt() != 0;
1039 setDebugApp(pn, wfd, per);
1040 reply.writeNoException();
1041 return true;
1042 }
1043
1044 case SET_ALWAYS_FINISH_TRANSACTION: {
1045 data.enforceInterface(IActivityManager.descriptor);
1046 boolean enabled = data.readInt() != 0;
1047 setAlwaysFinish(enabled);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001052 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001053 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001054 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001055 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001056 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001057 return true;
1058 }
1059
1060 case ENTER_SAFE_MODE_TRANSACTION: {
1061 data.enforceInterface(IActivityManager.descriptor);
1062 enterSafeMode();
1063 reply.writeNoException();
1064 return true;
1065 }
1066
1067 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1068 data.enforceInterface(IActivityManager.descriptor);
1069 IIntentSender is = IIntentSender.Stub.asInterface(
1070 data.readStrongBinder());
1071 noteWakeupAlarm(is);
1072 reply.writeNoException();
1073 return true;
1074 }
1075
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001076 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001077 data.enforceInterface(IActivityManager.descriptor);
1078 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001079 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001080 boolean secure = data.readInt() != 0;
1081 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001082 reply.writeNoException();
1083 reply.writeInt(res ? 1 : 0);
1084 return true;
1085 }
1086
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001087 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1088 data.enforceInterface(IActivityManager.descriptor);
1089 String reason = data.readString();
1090 boolean res = killProcessesBelowForeground(reason);
1091 reply.writeNoException();
1092 reply.writeInt(res ? 1 : 0);
1093 return true;
1094 }
1095
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001096 case START_RUNNING_TRANSACTION: {
1097 data.enforceInterface(IActivityManager.descriptor);
1098 String pkg = data.readString();
1099 String cls = data.readString();
1100 String action = data.readString();
1101 String indata = data.readString();
1102 startRunning(pkg, cls, action, indata);
1103 reply.writeNoException();
1104 return true;
1105 }
1106
Dan Egnor60d87622009-12-16 16:32:58 -08001107 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1108 data.enforceInterface(IActivityManager.descriptor);
1109 IBinder app = data.readStrongBinder();
1110 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1111 handleApplicationCrash(app, ci);
1112 reply.writeNoException();
1113 return true;
1114 }
1115
1116 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001117 data.enforceInterface(IActivityManager.descriptor);
1118 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001119 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001120 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001121 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001123 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124 return true;
1125 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001126
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001127 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001130 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001131 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1132 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001133 reply.writeNoException();
1134 return true;
1135 }
1136
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001137 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 int sig = data.readInt();
1140 signalPersistentProcesses(sig);
1141 reply.writeNoException();
1142 return true;
1143 }
1144
Dianne Hackborn03abb812010-01-04 18:43:19 -08001145 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1146 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001148 killBackgroundProcesses(packageName);
1149 reply.writeNoException();
1150 return true;
1151 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001152
1153 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 killAllBackgroundProcesses();
1156 reply.writeNoException();
1157 return true;
1158 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001159
1160 case FORCE_STOP_PACKAGE_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 String packageName = data.readString();
1163 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001164 reply.writeNoException();
1165 return true;
1166 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001167
1168 case GET_MY_MEMORY_STATE_TRANSACTION: {
1169 data.enforceInterface(IActivityManager.descriptor);
1170 ActivityManager.RunningAppProcessInfo info =
1171 new ActivityManager.RunningAppProcessInfo();
1172 getMyMemoryState(info);
1173 reply.writeNoException();
1174 info.writeToParcel(reply, 0);
1175 return true;
1176 }
1177
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1179 data.enforceInterface(IActivityManager.descriptor);
1180 ConfigurationInfo config = getDeviceConfigurationInfo();
1181 reply.writeNoException();
1182 config.writeToParcel(reply, 0);
1183 return true;
1184 }
1185
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001186 case PROFILE_CONTROL_TRANSACTION: {
1187 data.enforceInterface(IActivityManager.descriptor);
1188 String process = data.readString();
1189 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001190 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001191 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001192 ParcelFileDescriptor fd = data.readInt() != 0
1193 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001194 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001195 reply.writeNoException();
1196 reply.writeInt(res ? 1 : 0);
1197 return true;
1198 }
1199
Dianne Hackborn55280a92009-05-07 15:53:46 -07001200 case SHUTDOWN_TRANSACTION: {
1201 data.enforceInterface(IActivityManager.descriptor);
1202 boolean res = shutdown(data.readInt());
1203 reply.writeNoException();
1204 reply.writeInt(res ? 1 : 0);
1205 return true;
1206 }
1207
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001208 case STOP_APP_SWITCHES_TRANSACTION: {
1209 data.enforceInterface(IActivityManager.descriptor);
1210 stopAppSwitches();
1211 reply.writeNoException();
1212 return true;
1213 }
1214
1215 case RESUME_APP_SWITCHES_TRANSACTION: {
1216 data.enforceInterface(IActivityManager.descriptor);
1217 resumeAppSwitches();
1218 reply.writeNoException();
1219 return true;
1220 }
1221
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001222 case PEEK_SERVICE_TRANSACTION: {
1223 data.enforceInterface(IActivityManager.descriptor);
1224 Intent service = Intent.CREATOR.createFromParcel(data);
1225 String resolvedType = data.readString();
1226 IBinder binder = peekService(service, resolvedType);
1227 reply.writeNoException();
1228 reply.writeStrongBinder(binder);
1229 return true;
1230 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001231
1232 case START_BACKUP_AGENT_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1235 int backupRestoreMode = data.readInt();
1236 boolean success = bindBackupAgent(info, backupRestoreMode);
1237 reply.writeNoException();
1238 reply.writeInt(success ? 1 : 0);
1239 return true;
1240 }
1241
1242 case BACKUP_AGENT_CREATED_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 String packageName = data.readString();
1245 IBinder agent = data.readStrongBinder();
1246 backupAgentCreated(packageName, agent);
1247 reply.writeNoException();
1248 return true;
1249 }
1250
1251 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1252 data.enforceInterface(IActivityManager.descriptor);
1253 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1254 unbindBackupAgent(info);
1255 reply.writeNoException();
1256 return true;
1257 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001258
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001259 case START_ACTIVITY_IN_PACKAGE_TRANSACTION:
1260 {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 int uid = data.readInt();
1263 Intent intent = Intent.CREATOR.createFromParcel(data);
1264 String resolvedType = data.readString();
1265 IBinder resultTo = data.readStrongBinder();
1266 String resultWho = data.readString();
1267 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001268 int startFlags = data.readInt();
1269 Bundle options = data.readInt() != 0
1270 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001271 int result = startActivityInPackage(uid, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001272 resultTo, resultWho, requestCode, startFlags, options);
Dianne Hackborn2d91af02009-07-16 13:34:33 -07001273 reply.writeNoException();
1274 reply.writeInt(result);
1275 return true;
1276 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001277
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001278 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1279 data.enforceInterface(IActivityManager.descriptor);
1280 String pkg = data.readString();
1281 int uid = data.readInt();
1282 killApplicationWithUid(pkg, uid);
1283 reply.writeNoException();
1284 return true;
1285 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001286
1287 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 String reason = data.readString();
1290 closeSystemDialogs(reason);
1291 reply.writeNoException();
1292 return true;
1293 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001294
1295 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001297 int[] pids = data.createIntArray();
1298 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001299 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001300 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001301 return true;
1302 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001303
1304 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1305 data.enforceInterface(IActivityManager.descriptor);
1306 String processName = data.readString();
1307 int uid = data.readInt();
1308 killApplicationProcess(processName, uid);
1309 reply.writeNoException();
1310 return true;
1311 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001312
1313 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1314 data.enforceInterface(IActivityManager.descriptor);
1315 IBinder token = data.readStrongBinder();
1316 String packageName = data.readString();
1317 int enterAnim = data.readInt();
1318 int exitAnim = data.readInt();
1319 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001320 reply.writeNoException();
1321 return true;
1322 }
1323
1324 case IS_USER_A_MONKEY_TRANSACTION: {
1325 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001326 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001327 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001328 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001329 return true;
1330 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001331
1332 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1333 data.enforceInterface(IActivityManager.descriptor);
1334 finishHeavyWeightApp();
1335 reply.writeNoException();
1336 return true;
1337 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001338
1339 case IS_IMMERSIVE_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001342 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001343 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001344 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001345 return true;
1346 }
1347
1348 case SET_IMMERSIVE_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 IBinder token = data.readStrongBinder();
1351 boolean imm = data.readInt() == 1;
1352 setImmersive(token, imm);
1353 reply.writeNoException();
1354 return true;
1355 }
1356
1357 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1358 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001359 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001360 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001361 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001362 return true;
1363 }
1364
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001365 case CRASH_APPLICATION_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 int uid = data.readInt();
1368 int initialPid = data.readInt();
1369 String packageName = data.readString();
1370 String message = data.readString();
1371 crashApplication(uid, initialPid, packageName, message);
1372 reply.writeNoException();
1373 return true;
1374 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001375
1376 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1377 data.enforceInterface(IActivityManager.descriptor);
1378 Uri uri = Uri.CREATOR.createFromParcel(data);
1379 String type = getProviderMimeType(uri);
1380 reply.writeNoException();
1381 reply.writeString(type);
1382 return true;
1383 }
1384
Dianne Hackborn7e269642010-08-25 19:50:20 -07001385 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 String name = data.readString();
1388 IBinder perm = newUriPermissionOwner(name);
1389 reply.writeNoException();
1390 reply.writeStrongBinder(perm);
1391 return true;
1392 }
1393
1394 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1395 data.enforceInterface(IActivityManager.descriptor);
1396 IBinder owner = data.readStrongBinder();
1397 int fromUid = data.readInt();
1398 String targetPkg = data.readString();
1399 Uri uri = Uri.CREATOR.createFromParcel(data);
1400 int mode = data.readInt();
1401 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1402 reply.writeNoException();
1403 return true;
1404 }
1405
1406 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1407 data.enforceInterface(IActivityManager.descriptor);
1408 IBinder owner = data.readStrongBinder();
1409 Uri uri = null;
1410 if (data.readInt() != 0) {
1411 Uri.CREATOR.createFromParcel(data);
1412 }
1413 int mode = data.readInt();
1414 revokeUriPermissionFromOwner(owner, uri, mode);
1415 reply.writeNoException();
1416 return true;
1417 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001418
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001419 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 int callingUid = data.readInt();
1422 String targetPkg = data.readString();
1423 Uri uri = Uri.CREATOR.createFromParcel(data);
1424 int modeFlags = data.readInt();
1425 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1426 reply.writeNoException();
1427 reply.writeInt(res);
1428 return true;
1429 }
1430
Andy McFadden824c5102010-07-09 16:26:57 -07001431 case DUMP_HEAP_TRANSACTION: {
1432 data.enforceInterface(IActivityManager.descriptor);
1433 String process = data.readString();
1434 boolean managed = data.readInt() != 0;
1435 String path = data.readString();
1436 ParcelFileDescriptor fd = data.readInt() != 0
1437 ? data.readFileDescriptor() : null;
1438 boolean res = dumpHeap(process, managed, path, fd);
1439 reply.writeNoException();
1440 reply.writeInt(res ? 1 : 0);
1441 return true;
1442 }
1443
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001444 case START_ACTIVITIES_IN_PACKAGE_TRANSACTION:
1445 {
1446 data.enforceInterface(IActivityManager.descriptor);
1447 int uid = data.readInt();
1448 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1449 String[] resolvedTypes = data.createStringArray();
1450 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001451 Bundle options = data.readInt() != 0
1452 ? Bundle.CREATOR.createFromParcel(data) : null;
1453 int result = startActivitiesInPackage(uid, intents, resolvedTypes,
1454 resultTo, options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001455 reply.writeNoException();
1456 reply.writeInt(result);
1457 return true;
1458 }
1459
1460 case START_ACTIVITIES_TRANSACTION:
1461 {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 IBinder b = data.readStrongBinder();
1464 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1465 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1466 String[] resolvedTypes = data.createStringArray();
1467 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001468 Bundle options = data.readInt() != 0
1469 ? Bundle.CREATOR.createFromParcel(data) : null;
1470 int result = startActivities(app, intents, resolvedTypes, resultTo,
1471 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001472 reply.writeNoException();
1473 reply.writeInt(result);
1474 return true;
1475 }
1476
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001477 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1478 {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 int mode = getFrontActivityScreenCompatMode();
1481 reply.writeNoException();
1482 reply.writeInt(mode);
1483 return true;
1484 }
1485
1486 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1487 {
1488 data.enforceInterface(IActivityManager.descriptor);
1489 int mode = data.readInt();
1490 setFrontActivityScreenCompatMode(mode);
1491 reply.writeNoException();
1492 reply.writeInt(mode);
1493 return true;
1494 }
1495
1496 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1497 {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 String pkg = data.readString();
1500 int mode = getPackageScreenCompatMode(pkg);
1501 reply.writeNoException();
1502 reply.writeInt(mode);
1503 return true;
1504 }
1505
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001506 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1507 {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001510 int mode = data.readInt();
1511 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001512 reply.writeNoException();
1513 return true;
1514 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001515
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001516 case SWITCH_USER_TRANSACTION: {
1517 data.enforceInterface(IActivityManager.descriptor);
1518 int userid = data.readInt();
1519 boolean result = switchUser(userid);
1520 reply.writeNoException();
1521 reply.writeInt(result ? 1 : 0);
1522 return true;
1523 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001524
1525 case GET_CURRENT_USER_TRANSACTION: {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 UserInfo userInfo = getCurrentUser();
1528 reply.writeNoException();
1529 userInfo.writeToParcel(reply, 0);
1530 return true;
1531 }
1532
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001533 case REMOVE_SUB_TASK_TRANSACTION:
1534 {
1535 data.enforceInterface(IActivityManager.descriptor);
1536 int taskId = data.readInt();
1537 int subTaskIndex = data.readInt();
1538 boolean result = removeSubTask(taskId, subTaskIndex);
1539 reply.writeNoException();
1540 reply.writeInt(result ? 1 : 0);
1541 return true;
1542 }
1543
1544 case REMOVE_TASK_TRANSACTION:
1545 {
1546 data.enforceInterface(IActivityManager.descriptor);
1547 int taskId = data.readInt();
1548 int fl = data.readInt();
1549 boolean result = removeTask(taskId, fl);
1550 reply.writeNoException();
1551 reply.writeInt(result ? 1 : 0);
1552 return true;
1553 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001554
Jeff Sharkeya4620792011-05-20 15:29:23 -07001555 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1558 data.readStrongBinder());
1559 registerProcessObserver(observer);
1560 return true;
1561 }
1562
1563 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
1565 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1566 data.readStrongBinder());
1567 unregisterProcessObserver(observer);
1568 return true;
1569 }
1570
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001571 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1572 {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 String pkg = data.readString();
1575 boolean ask = getPackageAskScreenCompat(pkg);
1576 reply.writeNoException();
1577 reply.writeInt(ask ? 1 : 0);
1578 return true;
1579 }
1580
1581 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1582 {
1583 data.enforceInterface(IActivityManager.descriptor);
1584 String pkg = data.readString();
1585 boolean ask = data.readInt() != 0;
1586 setPackageAskScreenCompat(pkg, ask);
1587 reply.writeNoException();
1588 return true;
1589 }
1590
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001591 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
1593 IIntentSender r = IIntentSender.Stub.asInterface(
1594 data.readStrongBinder());
1595 boolean res = isIntentSenderTargetedToPackage(r);
1596 reply.writeNoException();
1597 reply.writeInt(res ? 1 : 0);
1598 return true;
1599 }
1600
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001601 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 Configuration config = Configuration.CREATOR.createFromParcel(data);
1604 updatePersistentConfiguration(config);
1605 reply.writeNoException();
1606 return true;
1607 }
1608
Dianne Hackbornb437e092011-08-05 17:50:29 -07001609 case GET_PROCESS_PSS_TRANSACTION: {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 int[] pids = data.createIntArray();
1612 long[] pss = getProcessPss(pids);
1613 reply.writeNoException();
1614 reply.writeLongArray(pss);
1615 return true;
1616 }
1617
Dianne Hackborn661cd522011-08-22 00:26:20 -07001618 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1621 boolean always = data.readInt() != 0;
1622 showBootMessage(msg, always);
1623 reply.writeNoException();
1624 return true;
1625 }
1626
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001627 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1628 data.enforceInterface(IActivityManager.descriptor);
1629 dismissKeyguardOnNextActivity();
1630 reply.writeNoException();
1631 return true;
1632 }
1633
Adam Powelldd8fab22012-03-22 17:47:27 -07001634 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 IBinder token = data.readStrongBinder();
1637 String destAffinity = data.readString();
1638 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1639 reply.writeNoException();
1640 reply.writeInt(res ? 1 : 0);
1641 return true;
1642 }
1643
1644 case NAVIGATE_UP_TO_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 IBinder token = data.readStrongBinder();
1647 Intent target = Intent.CREATOR.createFromParcel(data);
1648 int resultCode = data.readInt();
1649 Intent resultData = null;
1650 if (data.readInt() != 0) {
1651 resultData = Intent.CREATOR.createFromParcel(data);
1652 }
1653 boolean res = navigateUpTo(token, target, resultCode, resultData);
1654 reply.writeNoException();
1655 reply.writeInt(res ? 1 : 0);
1656 return true;
1657 }
1658
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001659 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 IBinder token = data.readStrongBinder();
1662 int res = getLaunchedFromUid(token);
1663 reply.writeNoException();
1664 reply.writeInt(res);
1665 return true;
1666 }
1667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001668 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001670 return super.onTransact(code, data, reply, flags);
1671 }
1672
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001673 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001674 return this;
1675 }
1676
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001677 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1678 protected IActivityManager create() {
1679 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001680 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001681 Log.v("ActivityManager", "default service binder = " + b);
1682 }
1683 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001684 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001685 Log.v("ActivityManager", "default service = " + am);
1686 }
1687 return am;
1688 }
1689 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001690}
1691
1692class ActivityManagerProxy implements IActivityManager
1693{
1694 public ActivityManagerProxy(IBinder remote)
1695 {
1696 mRemote = remote;
1697 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001698
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001699 public IBinder asBinder()
1700 {
1701 return mRemote;
1702 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001703
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001704 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001705 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1706 int startFlags, String profileFile,
1707 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001708 Parcel data = Parcel.obtain();
1709 Parcel reply = Parcel.obtain();
1710 data.writeInterfaceToken(IActivityManager.descriptor);
1711 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1712 intent.writeToParcel(data, 0);
1713 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001714 data.writeStrongBinder(resultTo);
1715 data.writeString(resultWho);
1716 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001717 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001718 data.writeString(profileFile);
1719 if (profileFd != null) {
1720 data.writeInt(1);
1721 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1722 } else {
1723 data.writeInt(0);
1724 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001725 if (options != null) {
1726 data.writeInt(1);
1727 options.writeToParcel(data, 0);
1728 } else {
1729 data.writeInt(0);
1730 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001731 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1732 reply.readException();
1733 int result = reply.readInt();
1734 reply.recycle();
1735 data.recycle();
1736 return result;
1737 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001738 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001739 String resolvedType, IBinder resultTo, String resultWho,
1740 int requestCode, int startFlags, String profileFile,
1741 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001742 Parcel data = Parcel.obtain();
1743 Parcel reply = Parcel.obtain();
1744 data.writeInterfaceToken(IActivityManager.descriptor);
1745 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1746 intent.writeToParcel(data, 0);
1747 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001748 data.writeStrongBinder(resultTo);
1749 data.writeString(resultWho);
1750 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001751 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001752 data.writeString(profileFile);
1753 if (profileFd != null) {
1754 data.writeInt(1);
1755 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1756 } else {
1757 data.writeInt(0);
1758 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001759 if (options != null) {
1760 data.writeInt(1);
1761 options.writeToParcel(data, 0);
1762 } else {
1763 data.writeInt(0);
1764 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001765 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1766 reply.readException();
1767 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1768 reply.recycle();
1769 data.recycle();
1770 return result;
1771 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001772 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001773 String resolvedType, IBinder resultTo, String resultWho,
1774 int requestCode, int startFlags, Configuration config,
1775 Bundle options) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001776 Parcel data = Parcel.obtain();
1777 Parcel reply = Parcel.obtain();
1778 data.writeInterfaceToken(IActivityManager.descriptor);
1779 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1780 intent.writeToParcel(data, 0);
1781 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001782 data.writeStrongBinder(resultTo);
1783 data.writeString(resultWho);
1784 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001785 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001786 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001787 if (options != null) {
1788 data.writeInt(1);
1789 options.writeToParcel(data, 0);
1790 } else {
1791 data.writeInt(0);
1792 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001793 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1794 reply.readException();
1795 int result = reply.readInt();
1796 reply.recycle();
1797 data.recycle();
1798 return result;
1799 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001800 public int startActivityIntentSender(IApplicationThread caller,
1801 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001802 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001803 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001804 Parcel data = Parcel.obtain();
1805 Parcel reply = Parcel.obtain();
1806 data.writeInterfaceToken(IActivityManager.descriptor);
1807 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1808 intent.writeToParcel(data, 0);
1809 if (fillInIntent != null) {
1810 data.writeInt(1);
1811 fillInIntent.writeToParcel(data, 0);
1812 } else {
1813 data.writeInt(0);
1814 }
1815 data.writeString(resolvedType);
1816 data.writeStrongBinder(resultTo);
1817 data.writeString(resultWho);
1818 data.writeInt(requestCode);
1819 data.writeInt(flagsMask);
1820 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001821 if (options != null) {
1822 data.writeInt(1);
1823 options.writeToParcel(data, 0);
1824 } else {
1825 data.writeInt(0);
1826 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001827 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001828 reply.readException();
1829 int result = reply.readInt();
1830 reply.recycle();
1831 data.recycle();
1832 return result;
1833 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001834 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001835 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001836 Parcel data = Parcel.obtain();
1837 Parcel reply = Parcel.obtain();
1838 data.writeInterfaceToken(IActivityManager.descriptor);
1839 data.writeStrongBinder(callingActivity);
1840 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001841 if (options != null) {
1842 data.writeInt(1);
1843 options.writeToParcel(data, 0);
1844 } else {
1845 data.writeInt(0);
1846 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001847 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1848 reply.readException();
1849 int result = reply.readInt();
1850 reply.recycle();
1851 data.recycle();
1852 return result != 0;
1853 }
1854 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1855 throws RemoteException {
1856 Parcel data = Parcel.obtain();
1857 Parcel reply = Parcel.obtain();
1858 data.writeInterfaceToken(IActivityManager.descriptor);
1859 data.writeStrongBinder(token);
1860 data.writeInt(resultCode);
1861 if (resultData != null) {
1862 data.writeInt(1);
1863 resultData.writeToParcel(data, 0);
1864 } else {
1865 data.writeInt(0);
1866 }
1867 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1868 reply.readException();
1869 boolean res = reply.readInt() != 0;
1870 data.recycle();
1871 reply.recycle();
1872 return res;
1873 }
1874 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1875 {
1876 Parcel data = Parcel.obtain();
1877 Parcel reply = Parcel.obtain();
1878 data.writeInterfaceToken(IActivityManager.descriptor);
1879 data.writeStrongBinder(token);
1880 data.writeString(resultWho);
1881 data.writeInt(requestCode);
1882 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1883 reply.readException();
1884 data.recycle();
1885 reply.recycle();
1886 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07001887 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
1888 Parcel data = Parcel.obtain();
1889 Parcel reply = Parcel.obtain();
1890 data.writeInterfaceToken(IActivityManager.descriptor);
1891 data.writeStrongBinder(token);
1892 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
1893 reply.readException();
1894 boolean res = reply.readInt() != 0;
1895 data.recycle();
1896 reply.recycle();
1897 return res;
1898 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001899 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1900 Parcel data = Parcel.obtain();
1901 Parcel reply = Parcel.obtain();
1902 data.writeInterfaceToken(IActivityManager.descriptor);
1903 data.writeStrongBinder(token);
1904 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1905 reply.readException();
1906 boolean res = reply.readInt() != 0;
1907 data.recycle();
1908 reply.recycle();
1909 return res;
1910 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001911 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001912 IIntentReceiver receiver,
1913 IntentFilter filter, String perm) throws RemoteException
1914 {
1915 Parcel data = Parcel.obtain();
1916 Parcel reply = Parcel.obtain();
1917 data.writeInterfaceToken(IActivityManager.descriptor);
1918 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001919 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001920 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
1921 filter.writeToParcel(data, 0);
1922 data.writeString(perm);
1923 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1924 reply.readException();
1925 Intent intent = null;
1926 int haveIntent = reply.readInt();
1927 if (haveIntent != 0) {
1928 intent = Intent.CREATOR.createFromParcel(reply);
1929 }
1930 reply.recycle();
1931 data.recycle();
1932 return intent;
1933 }
1934 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
1935 {
1936 Parcel data = Parcel.obtain();
1937 Parcel reply = Parcel.obtain();
1938 data.writeInterfaceToken(IActivityManager.descriptor);
1939 data.writeStrongBinder(receiver.asBinder());
1940 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
1941 reply.readException();
1942 data.recycle();
1943 reply.recycle();
1944 }
1945 public int broadcastIntent(IApplicationThread caller,
1946 Intent intent, String resolvedType, IIntentReceiver resultTo,
1947 int resultCode, String resultData, Bundle map,
1948 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07001949 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001950 {
1951 Parcel data = Parcel.obtain();
1952 Parcel reply = Parcel.obtain();
1953 data.writeInterfaceToken(IActivityManager.descriptor);
1954 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1955 intent.writeToParcel(data, 0);
1956 data.writeString(resolvedType);
1957 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
1958 data.writeInt(resultCode);
1959 data.writeString(resultData);
1960 data.writeBundle(map);
1961 data.writeString(requiredPermission);
1962 data.writeInt(serialized ? 1 : 0);
1963 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001964 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001965 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
1966 reply.readException();
1967 int res = reply.readInt();
1968 reply.recycle();
1969 data.recycle();
1970 return res;
1971 }
Amith Yamasani742a6712011-05-04 14:49:28 -07001972 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
1973 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001974 {
1975 Parcel data = Parcel.obtain();
1976 Parcel reply = Parcel.obtain();
1977 data.writeInterfaceToken(IActivityManager.descriptor);
1978 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1979 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07001980 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001981 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
1982 reply.readException();
1983 data.recycle();
1984 reply.recycle();
1985 }
1986 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
1987 {
1988 Parcel data = Parcel.obtain();
1989 Parcel reply = Parcel.obtain();
1990 data.writeInterfaceToken(IActivityManager.descriptor);
1991 data.writeStrongBinder(who);
1992 data.writeInt(resultCode);
1993 data.writeString(resultData);
1994 data.writeBundle(map);
1995 data.writeInt(abortBroadcast ? 1 : 0);
1996 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
1997 reply.readException();
1998 data.recycle();
1999 reply.recycle();
2000 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002001 public void attachApplication(IApplicationThread app) throws RemoteException
2002 {
2003 Parcel data = Parcel.obtain();
2004 Parcel reply = Parcel.obtain();
2005 data.writeInterfaceToken(IActivityManager.descriptor);
2006 data.writeStrongBinder(app.asBinder());
2007 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2008 reply.readException();
2009 data.recycle();
2010 reply.recycle();
2011 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002012 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2013 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002014 {
2015 Parcel data = Parcel.obtain();
2016 Parcel reply = Parcel.obtain();
2017 data.writeInterfaceToken(IActivityManager.descriptor);
2018 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002019 if (config != null) {
2020 data.writeInt(1);
2021 config.writeToParcel(data, 0);
2022 } else {
2023 data.writeInt(0);
2024 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002025 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002026 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2027 reply.readException();
2028 data.recycle();
2029 reply.recycle();
2030 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002031 public void activityPaused(IBinder token) throws RemoteException
2032 {
2033 Parcel data = Parcel.obtain();
2034 Parcel reply = Parcel.obtain();
2035 data.writeInterfaceToken(IActivityManager.descriptor);
2036 data.writeStrongBinder(token);
2037 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2038 reply.readException();
2039 data.recycle();
2040 reply.recycle();
2041 }
2042 public void activityStopped(IBinder token, Bundle state,
2043 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002044 {
2045 Parcel data = Parcel.obtain();
2046 Parcel reply = Parcel.obtain();
2047 data.writeInterfaceToken(IActivityManager.descriptor);
2048 data.writeStrongBinder(token);
2049 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002050 if (thumbnail != null) {
2051 data.writeInt(1);
2052 thumbnail.writeToParcel(data, 0);
2053 } else {
2054 data.writeInt(0);
2055 }
2056 TextUtils.writeToParcel(description, data, 0);
2057 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2058 reply.readException();
2059 data.recycle();
2060 reply.recycle();
2061 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002062 public void activitySlept(IBinder token) throws RemoteException
2063 {
2064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 data.writeStrongBinder(token);
2068 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2069 reply.readException();
2070 data.recycle();
2071 reply.recycle();
2072 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002073 public void activityDestroyed(IBinder token) throws RemoteException
2074 {
2075 Parcel data = Parcel.obtain();
2076 Parcel reply = Parcel.obtain();
2077 data.writeInterfaceToken(IActivityManager.descriptor);
2078 data.writeStrongBinder(token);
2079 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2080 reply.readException();
2081 data.recycle();
2082 reply.recycle();
2083 }
2084 public String getCallingPackage(IBinder token) throws RemoteException
2085 {
2086 Parcel data = Parcel.obtain();
2087 Parcel reply = Parcel.obtain();
2088 data.writeInterfaceToken(IActivityManager.descriptor);
2089 data.writeStrongBinder(token);
2090 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2091 reply.readException();
2092 String res = reply.readString();
2093 data.recycle();
2094 reply.recycle();
2095 return res;
2096 }
2097 public ComponentName getCallingActivity(IBinder token)
2098 throws RemoteException {
2099 Parcel data = Parcel.obtain();
2100 Parcel reply = Parcel.obtain();
2101 data.writeInterfaceToken(IActivityManager.descriptor);
2102 data.writeStrongBinder(token);
2103 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2104 reply.readException();
2105 ComponentName res = ComponentName.readFromParcel(reply);
2106 data.recycle();
2107 reply.recycle();
2108 return res;
2109 }
2110 public List getTasks(int maxNum, int flags,
2111 IThumbnailReceiver receiver) throws RemoteException {
2112 Parcel data = Parcel.obtain();
2113 Parcel reply = Parcel.obtain();
2114 data.writeInterfaceToken(IActivityManager.descriptor);
2115 data.writeInt(maxNum);
2116 data.writeInt(flags);
2117 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2118 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2119 reply.readException();
2120 ArrayList list = null;
2121 int N = reply.readInt();
2122 if (N >= 0) {
2123 list = new ArrayList();
2124 while (N > 0) {
2125 ActivityManager.RunningTaskInfo info =
2126 ActivityManager.RunningTaskInfo.CREATOR
2127 .createFromParcel(reply);
2128 list.add(info);
2129 N--;
2130 }
2131 }
2132 data.recycle();
2133 reply.recycle();
2134 return list;
2135 }
2136 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
2137 int flags) throws RemoteException {
2138 Parcel data = Parcel.obtain();
2139 Parcel reply = Parcel.obtain();
2140 data.writeInterfaceToken(IActivityManager.descriptor);
2141 data.writeInt(maxNum);
2142 data.writeInt(flags);
2143 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2144 reply.readException();
2145 ArrayList<ActivityManager.RecentTaskInfo> list
2146 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2147 data.recycle();
2148 reply.recycle();
2149 return list;
2150 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002151 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002152 Parcel data = Parcel.obtain();
2153 Parcel reply = Parcel.obtain();
2154 data.writeInterfaceToken(IActivityManager.descriptor);
2155 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002156 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002157 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002158 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002159 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002160 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002161 }
2162 data.recycle();
2163 reply.recycle();
2164 return bm;
2165 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002166 public List getServices(int maxNum, int flags) throws RemoteException {
2167 Parcel data = Parcel.obtain();
2168 Parcel reply = Parcel.obtain();
2169 data.writeInterfaceToken(IActivityManager.descriptor);
2170 data.writeInt(maxNum);
2171 data.writeInt(flags);
2172 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2173 reply.readException();
2174 ArrayList list = null;
2175 int N = reply.readInt();
2176 if (N >= 0) {
2177 list = new ArrayList();
2178 while (N > 0) {
2179 ActivityManager.RunningServiceInfo info =
2180 ActivityManager.RunningServiceInfo.CREATOR
2181 .createFromParcel(reply);
2182 list.add(info);
2183 N--;
2184 }
2185 }
2186 data.recycle();
2187 reply.recycle();
2188 return list;
2189 }
2190 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2191 throws RemoteException {
2192 Parcel data = Parcel.obtain();
2193 Parcel reply = Parcel.obtain();
2194 data.writeInterfaceToken(IActivityManager.descriptor);
2195 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2196 reply.readException();
2197 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2198 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2199 data.recycle();
2200 reply.recycle();
2201 return list;
2202 }
2203 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2204 throws RemoteException {
2205 Parcel data = Parcel.obtain();
2206 Parcel reply = Parcel.obtain();
2207 data.writeInterfaceToken(IActivityManager.descriptor);
2208 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2209 reply.readException();
2210 ArrayList<ActivityManager.RunningAppProcessInfo> list
2211 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2212 data.recycle();
2213 reply.recycle();
2214 return list;
2215 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002216 public List<ApplicationInfo> getRunningExternalApplications()
2217 throws RemoteException {
2218 Parcel data = Parcel.obtain();
2219 Parcel reply = Parcel.obtain();
2220 data.writeInterfaceToken(IActivityManager.descriptor);
2221 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2222 reply.readException();
2223 ArrayList<ApplicationInfo> list
2224 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2225 data.recycle();
2226 reply.recycle();
2227 return list;
2228 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002229 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 {
2231 Parcel data = Parcel.obtain();
2232 Parcel reply = Parcel.obtain();
2233 data.writeInterfaceToken(IActivityManager.descriptor);
2234 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002235 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002236 if (options != null) {
2237 data.writeInt(1);
2238 options.writeToParcel(data, 0);
2239 } else {
2240 data.writeInt(0);
2241 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002242 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2243 reply.readException();
2244 data.recycle();
2245 reply.recycle();
2246 }
2247 public void moveTaskToBack(int task) throws RemoteException
2248 {
2249 Parcel data = Parcel.obtain();
2250 Parcel reply = Parcel.obtain();
2251 data.writeInterfaceToken(IActivityManager.descriptor);
2252 data.writeInt(task);
2253 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2254 reply.readException();
2255 data.recycle();
2256 reply.recycle();
2257 }
2258 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2259 throws RemoteException {
2260 Parcel data = Parcel.obtain();
2261 Parcel reply = Parcel.obtain();
2262 data.writeInterfaceToken(IActivityManager.descriptor);
2263 data.writeStrongBinder(token);
2264 data.writeInt(nonRoot ? 1 : 0);
2265 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2266 reply.readException();
2267 boolean res = reply.readInt() != 0;
2268 data.recycle();
2269 reply.recycle();
2270 return res;
2271 }
2272 public void moveTaskBackwards(int task) throws RemoteException
2273 {
2274 Parcel data = Parcel.obtain();
2275 Parcel reply = Parcel.obtain();
2276 data.writeInterfaceToken(IActivityManager.descriptor);
2277 data.writeInt(task);
2278 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2279 reply.readException();
2280 data.recycle();
2281 reply.recycle();
2282 }
2283 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2284 {
2285 Parcel data = Parcel.obtain();
2286 Parcel reply = Parcel.obtain();
2287 data.writeInterfaceToken(IActivityManager.descriptor);
2288 data.writeStrongBinder(token);
2289 data.writeInt(onlyRoot ? 1 : 0);
2290 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2291 reply.readException();
2292 int res = reply.readInt();
2293 data.recycle();
2294 reply.recycle();
2295 return res;
2296 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002297 public void reportThumbnail(IBinder token,
2298 Bitmap thumbnail, CharSequence description) throws RemoteException
2299 {
2300 Parcel data = Parcel.obtain();
2301 Parcel reply = Parcel.obtain();
2302 data.writeInterfaceToken(IActivityManager.descriptor);
2303 data.writeStrongBinder(token);
2304 if (thumbnail != null) {
2305 data.writeInt(1);
2306 thumbnail.writeToParcel(data, 0);
2307 } else {
2308 data.writeInt(0);
2309 }
2310 TextUtils.writeToParcel(description, data, 0);
2311 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2312 reply.readException();
2313 data.recycle();
2314 reply.recycle();
2315 }
2316 public ContentProviderHolder getContentProvider(IApplicationThread caller,
2317 String name) throws RemoteException
2318 {
2319 Parcel data = Parcel.obtain();
2320 Parcel reply = Parcel.obtain();
2321 data.writeInterfaceToken(IActivityManager.descriptor);
2322 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2323 data.writeString(name);
2324 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2325 reply.readException();
2326 int res = reply.readInt();
2327 ContentProviderHolder cph = null;
2328 if (res != 0) {
2329 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2330 }
2331 data.recycle();
2332 reply.recycle();
2333 return cph;
2334 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002335 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2336 throws RemoteException
2337 {
2338 Parcel data = Parcel.obtain();
2339 Parcel reply = Parcel.obtain();
2340 data.writeInterfaceToken(IActivityManager.descriptor);
2341 data.writeString(name);
2342 data.writeStrongBinder(token);
2343 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 int res = reply.readInt();
2346 ContentProviderHolder cph = null;
2347 if (res != 0) {
2348 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2349 }
2350 data.recycle();
2351 reply.recycle();
2352 return cph;
2353 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002354 public void publishContentProviders(IApplicationThread caller,
2355 List<ContentProviderHolder> providers) throws RemoteException
2356 {
2357 Parcel data = Parcel.obtain();
2358 Parcel reply = Parcel.obtain();
2359 data.writeInterfaceToken(IActivityManager.descriptor);
2360 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2361 data.writeTypedList(providers);
2362 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2363 reply.readException();
2364 data.recycle();
2365 reply.recycle();
2366 }
2367
2368 public void removeContentProvider(IApplicationThread caller,
2369 String name) throws RemoteException {
2370 Parcel data = Parcel.obtain();
2371 Parcel reply = Parcel.obtain();
2372 data.writeInterfaceToken(IActivityManager.descriptor);
2373 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2374 data.writeString(name);
2375 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2376 reply.readException();
2377 data.recycle();
2378 reply.recycle();
2379 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002380
2381 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2382 Parcel data = Parcel.obtain();
2383 Parcel reply = Parcel.obtain();
2384 data.writeInterfaceToken(IActivityManager.descriptor);
2385 data.writeString(name);
2386 data.writeStrongBinder(token);
2387 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2388 reply.readException();
2389 data.recycle();
2390 reply.recycle();
2391 }
2392
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002393 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2394 throws RemoteException
2395 {
2396 Parcel data = Parcel.obtain();
2397 Parcel reply = Parcel.obtain();
2398 data.writeInterfaceToken(IActivityManager.descriptor);
2399 service.writeToParcel(data, 0);
2400 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2401 reply.readException();
2402 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2403 data.recycle();
2404 reply.recycle();
2405 return res;
2406 }
2407
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002408 public ComponentName startService(IApplicationThread caller, Intent service,
2409 String resolvedType) throws RemoteException
2410 {
2411 Parcel data = Parcel.obtain();
2412 Parcel reply = Parcel.obtain();
2413 data.writeInterfaceToken(IActivityManager.descriptor);
2414 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2415 service.writeToParcel(data, 0);
2416 data.writeString(resolvedType);
2417 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2418 reply.readException();
2419 ComponentName res = ComponentName.readFromParcel(reply);
2420 data.recycle();
2421 reply.recycle();
2422 return res;
2423 }
2424 public int stopService(IApplicationThread caller, Intent service,
2425 String resolvedType) throws RemoteException
2426 {
2427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2431 service.writeToParcel(data, 0);
2432 data.writeString(resolvedType);
2433 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2434 reply.readException();
2435 int res = reply.readInt();
2436 reply.recycle();
2437 data.recycle();
2438 return res;
2439 }
2440 public boolean stopServiceToken(ComponentName className, IBinder token,
2441 int startId) throws RemoteException {
2442 Parcel data = Parcel.obtain();
2443 Parcel reply = Parcel.obtain();
2444 data.writeInterfaceToken(IActivityManager.descriptor);
2445 ComponentName.writeToParcel(className, data);
2446 data.writeStrongBinder(token);
2447 data.writeInt(startId);
2448 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 boolean res = reply.readInt() != 0;
2451 data.recycle();
2452 reply.recycle();
2453 return res;
2454 }
2455 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002456 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 Parcel data = Parcel.obtain();
2458 Parcel reply = Parcel.obtain();
2459 data.writeInterfaceToken(IActivityManager.descriptor);
2460 ComponentName.writeToParcel(className, data);
2461 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002462 data.writeInt(id);
2463 if (notification != null) {
2464 data.writeInt(1);
2465 notification.writeToParcel(data, 0);
2466 } else {
2467 data.writeInt(0);
2468 }
2469 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002470 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2471 reply.readException();
2472 data.recycle();
2473 reply.recycle();
2474 }
2475 public int bindService(IApplicationThread caller, IBinder token,
2476 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002477 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2482 data.writeStrongBinder(token);
2483 service.writeToParcel(data, 0);
2484 data.writeString(resolvedType);
2485 data.writeStrongBinder(connection.asBinder());
2486 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002487 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2489 reply.readException();
2490 int res = reply.readInt();
2491 data.recycle();
2492 reply.recycle();
2493 return res;
2494 }
2495 public boolean unbindService(IServiceConnection connection) throws RemoteException
2496 {
2497 Parcel data = Parcel.obtain();
2498 Parcel reply = Parcel.obtain();
2499 data.writeInterfaceToken(IActivityManager.descriptor);
2500 data.writeStrongBinder(connection.asBinder());
2501 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2502 reply.readException();
2503 boolean res = reply.readInt() != 0;
2504 data.recycle();
2505 reply.recycle();
2506 return res;
2507 }
2508
2509 public void publishService(IBinder token,
2510 Intent intent, IBinder service) throws RemoteException {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(token);
2515 intent.writeToParcel(data, 0);
2516 data.writeStrongBinder(service);
2517 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2518 reply.readException();
2519 data.recycle();
2520 reply.recycle();
2521 }
2522
2523 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2524 throws RemoteException {
2525 Parcel data = Parcel.obtain();
2526 Parcel reply = Parcel.obtain();
2527 data.writeInterfaceToken(IActivityManager.descriptor);
2528 data.writeStrongBinder(token);
2529 intent.writeToParcel(data, 0);
2530 data.writeInt(doRebind ? 1 : 0);
2531 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2532 reply.readException();
2533 data.recycle();
2534 reply.recycle();
2535 }
2536
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002537 public void serviceDoneExecuting(IBinder token, int type, int startId,
2538 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002539 Parcel data = Parcel.obtain();
2540 Parcel reply = Parcel.obtain();
2541 data.writeInterfaceToken(IActivityManager.descriptor);
2542 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002543 data.writeInt(type);
2544 data.writeInt(startId);
2545 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002546 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2547 reply.readException();
2548 data.recycle();
2549 reply.recycle();
2550 }
2551
2552 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2553 Parcel data = Parcel.obtain();
2554 Parcel reply = Parcel.obtain();
2555 data.writeInterfaceToken(IActivityManager.descriptor);
2556 service.writeToParcel(data, 0);
2557 data.writeString(resolvedType);
2558 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 IBinder binder = reply.readStrongBinder();
2561 reply.recycle();
2562 data.recycle();
2563 return binder;
2564 }
2565
Christopher Tate181fafa2009-05-14 11:12:14 -07002566 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2567 throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 app.writeToParcel(data, 0);
2572 data.writeInt(backupRestoreMode);
2573 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2574 reply.readException();
2575 boolean success = reply.readInt() != 0;
2576 reply.recycle();
2577 data.recycle();
2578 return success;
2579 }
2580
2581 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2582 Parcel data = Parcel.obtain();
2583 Parcel reply = Parcel.obtain();
2584 data.writeInterfaceToken(IActivityManager.descriptor);
2585 data.writeString(packageName);
2586 data.writeStrongBinder(agent);
2587 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2588 reply.recycle();
2589 data.recycle();
2590 }
2591
2592 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 app.writeToParcel(data, 0);
2597 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2598 reply.readException();
2599 reply.recycle();
2600 data.recycle();
2601 }
2602
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 public boolean startInstrumentation(ComponentName className, String profileFile,
2604 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2605 throws RemoteException {
2606 Parcel data = Parcel.obtain();
2607 Parcel reply = Parcel.obtain();
2608 data.writeInterfaceToken(IActivityManager.descriptor);
2609 ComponentName.writeToParcel(className, data);
2610 data.writeString(profileFile);
2611 data.writeInt(flags);
2612 data.writeBundle(arguments);
2613 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2614 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2615 reply.readException();
2616 boolean res = reply.readInt() != 0;
2617 reply.recycle();
2618 data.recycle();
2619 return res;
2620 }
2621
2622 public void finishInstrumentation(IApplicationThread target,
2623 int resultCode, Bundle results) throws RemoteException {
2624 Parcel data = Parcel.obtain();
2625 Parcel reply = Parcel.obtain();
2626 data.writeInterfaceToken(IActivityManager.descriptor);
2627 data.writeStrongBinder(target != null ? target.asBinder() : null);
2628 data.writeInt(resultCode);
2629 data.writeBundle(results);
2630 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2631 reply.readException();
2632 data.recycle();
2633 reply.recycle();
2634 }
2635 public Configuration getConfiguration() throws RemoteException
2636 {
2637 Parcel data = Parcel.obtain();
2638 Parcel reply = Parcel.obtain();
2639 data.writeInterfaceToken(IActivityManager.descriptor);
2640 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2641 reply.readException();
2642 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2643 reply.recycle();
2644 data.recycle();
2645 return res;
2646 }
2647 public void updateConfiguration(Configuration values) throws RemoteException
2648 {
2649 Parcel data = Parcel.obtain();
2650 Parcel reply = Parcel.obtain();
2651 data.writeInterfaceToken(IActivityManager.descriptor);
2652 values.writeToParcel(data, 0);
2653 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2654 reply.readException();
2655 data.recycle();
2656 reply.recycle();
2657 }
2658 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2659 throws RemoteException {
2660 Parcel data = Parcel.obtain();
2661 Parcel reply = Parcel.obtain();
2662 data.writeInterfaceToken(IActivityManager.descriptor);
2663 data.writeStrongBinder(token);
2664 data.writeInt(requestedOrientation);
2665 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2666 reply.readException();
2667 data.recycle();
2668 reply.recycle();
2669 }
2670 public int getRequestedOrientation(IBinder token) throws RemoteException {
2671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeStrongBinder(token);
2675 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2676 reply.readException();
2677 int res = reply.readInt();
2678 data.recycle();
2679 reply.recycle();
2680 return res;
2681 }
2682 public ComponentName getActivityClassForToken(IBinder token)
2683 throws RemoteException {
2684 Parcel data = Parcel.obtain();
2685 Parcel reply = Parcel.obtain();
2686 data.writeInterfaceToken(IActivityManager.descriptor);
2687 data.writeStrongBinder(token);
2688 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2689 reply.readException();
2690 ComponentName res = ComponentName.readFromParcel(reply);
2691 data.recycle();
2692 reply.recycle();
2693 return res;
2694 }
2695 public String getPackageForToken(IBinder token) throws RemoteException
2696 {
2697 Parcel data = Parcel.obtain();
2698 Parcel reply = Parcel.obtain();
2699 data.writeInterfaceToken(IActivityManager.descriptor);
2700 data.writeStrongBinder(token);
2701 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 String res = reply.readString();
2704 data.recycle();
2705 reply.recycle();
2706 return res;
2707 }
2708 public IIntentSender getIntentSender(int type,
2709 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002710 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
2711 Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeInt(type);
2716 data.writeString(packageName);
2717 data.writeStrongBinder(token);
2718 data.writeString(resultWho);
2719 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002720 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002721 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002722 data.writeTypedArray(intents, 0);
2723 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002724 } else {
2725 data.writeInt(0);
2726 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002727 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002728 if (options != null) {
2729 data.writeInt(1);
2730 options.writeToParcel(data, 0);
2731 } else {
2732 data.writeInt(0);
2733 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002734 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2735 reply.readException();
2736 IIntentSender res = IIntentSender.Stub.asInterface(
2737 reply.readStrongBinder());
2738 data.recycle();
2739 reply.recycle();
2740 return res;
2741 }
2742 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2743 Parcel data = Parcel.obtain();
2744 Parcel reply = Parcel.obtain();
2745 data.writeInterfaceToken(IActivityManager.descriptor);
2746 data.writeStrongBinder(sender.asBinder());
2747 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2748 reply.readException();
2749 data.recycle();
2750 reply.recycle();
2751 }
2752 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2753 Parcel data = Parcel.obtain();
2754 Parcel reply = Parcel.obtain();
2755 data.writeInterfaceToken(IActivityManager.descriptor);
2756 data.writeStrongBinder(sender.asBinder());
2757 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2758 reply.readException();
2759 String res = reply.readString();
2760 data.recycle();
2761 reply.recycle();
2762 return res;
2763 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002764 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 data.writeStrongBinder(sender.asBinder());
2769 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2770 reply.readException();
2771 int res = reply.readInt();
2772 data.recycle();
2773 reply.recycle();
2774 return res;
2775 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002776 public void setProcessLimit(int max) throws RemoteException
2777 {
2778 Parcel data = Parcel.obtain();
2779 Parcel reply = Parcel.obtain();
2780 data.writeInterfaceToken(IActivityManager.descriptor);
2781 data.writeInt(max);
2782 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2783 reply.readException();
2784 data.recycle();
2785 reply.recycle();
2786 }
2787 public int getProcessLimit() throws RemoteException
2788 {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2793 reply.readException();
2794 int res = reply.readInt();
2795 data.recycle();
2796 reply.recycle();
2797 return res;
2798 }
2799 public void setProcessForeground(IBinder token, int pid,
2800 boolean isForeground) throws RemoteException {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 data.writeStrongBinder(token);
2805 data.writeInt(pid);
2806 data.writeInt(isForeground ? 1 : 0);
2807 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2808 reply.readException();
2809 data.recycle();
2810 reply.recycle();
2811 }
2812 public int checkPermission(String permission, int pid, int uid)
2813 throws RemoteException {
2814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 data.writeString(permission);
2818 data.writeInt(pid);
2819 data.writeInt(uid);
2820 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2821 reply.readException();
2822 int res = reply.readInt();
2823 data.recycle();
2824 reply.recycle();
2825 return res;
2826 }
2827 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002828 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 data.writeString(packageName);
2833 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002834 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002835 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2836 reply.readException();
2837 boolean res = reply.readInt() != 0;
2838 data.recycle();
2839 reply.recycle();
2840 return res;
2841 }
2842 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2843 throws RemoteException {
2844 Parcel data = Parcel.obtain();
2845 Parcel reply = Parcel.obtain();
2846 data.writeInterfaceToken(IActivityManager.descriptor);
2847 uri.writeToParcel(data, 0);
2848 data.writeInt(pid);
2849 data.writeInt(uid);
2850 data.writeInt(mode);
2851 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2852 reply.readException();
2853 int res = reply.readInt();
2854 data.recycle();
2855 reply.recycle();
2856 return res;
2857 }
2858 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2859 Uri uri, int mode) throws RemoteException {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(caller.asBinder());
2864 data.writeString(targetPkg);
2865 uri.writeToParcel(data, 0);
2866 data.writeInt(mode);
2867 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
2868 reply.readException();
2869 data.recycle();
2870 reply.recycle();
2871 }
2872 public void revokeUriPermission(IApplicationThread caller, Uri uri,
2873 int mode) throws RemoteException {
2874 Parcel data = Parcel.obtain();
2875 Parcel reply = Parcel.obtain();
2876 data.writeInterfaceToken(IActivityManager.descriptor);
2877 data.writeStrongBinder(caller.asBinder());
2878 uri.writeToParcel(data, 0);
2879 data.writeInt(mode);
2880 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
2881 reply.readException();
2882 data.recycle();
2883 reply.recycle();
2884 }
2885 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
2886 throws RemoteException {
2887 Parcel data = Parcel.obtain();
2888 Parcel reply = Parcel.obtain();
2889 data.writeInterfaceToken(IActivityManager.descriptor);
2890 data.writeStrongBinder(who.asBinder());
2891 data.writeInt(waiting ? 1 : 0);
2892 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
2893 reply.readException();
2894 data.recycle();
2895 reply.recycle();
2896 }
2897 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
2898 Parcel data = Parcel.obtain();
2899 Parcel reply = Parcel.obtain();
2900 data.writeInterfaceToken(IActivityManager.descriptor);
2901 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
2902 reply.readException();
2903 outInfo.readFromParcel(reply);
2904 data.recycle();
2905 reply.recycle();
2906 }
2907 public void unhandledBack() throws RemoteException
2908 {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
2913 reply.readException();
2914 data.recycle();
2915 reply.recycle();
2916 }
2917 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
2918 {
2919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
2921 data.writeInterfaceToken(IActivityManager.descriptor);
2922 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
2923 reply.readException();
2924 ParcelFileDescriptor pfd = null;
2925 if (reply.readInt() != 0) {
2926 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
2927 }
2928 data.recycle();
2929 reply.recycle();
2930 return pfd;
2931 }
2932 public void goingToSleep() throws RemoteException
2933 {
2934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
2938 reply.readException();
2939 data.recycle();
2940 reply.recycle();
2941 }
2942 public void wakingUp() throws RemoteException
2943 {
2944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 data.recycle();
2950 reply.recycle();
2951 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07002952 public void setLockScreenShown(boolean shown) throws RemoteException
2953 {
2954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeInt(shown ? 1 : 0);
2958 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 data.recycle();
2961 reply.recycle();
2962 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 public void setDebugApp(
2964 String packageName, boolean waitForDebugger, boolean persistent)
2965 throws RemoteException
2966 {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 data.writeString(packageName);
2971 data.writeInt(waitForDebugger ? 1 : 0);
2972 data.writeInt(persistent ? 1 : 0);
2973 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 data.recycle();
2976 reply.recycle();
2977 }
2978 public void setAlwaysFinish(boolean enabled) throws RemoteException
2979 {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 data.writeInt(enabled ? 1 : 0);
2984 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
2985 reply.readException();
2986 data.recycle();
2987 reply.recycle();
2988 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002989 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002990 {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07002995 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002996 reply.readException();
2997 data.recycle();
2998 reply.recycle();
2999 }
3000 public void enterSafeMode() throws RemoteException {
3001 Parcel data = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
3003 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3004 data.recycle();
3005 }
3006 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3007 Parcel data = Parcel.obtain();
3008 data.writeStrongBinder(sender.asBinder());
3009 data.writeInterfaceToken(IActivityManager.descriptor);
3010 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3011 data.recycle();
3012 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003013 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003014 Parcel data = Parcel.obtain();
3015 Parcel reply = Parcel.obtain();
3016 data.writeInterfaceToken(IActivityManager.descriptor);
3017 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003018 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003019 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003020 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003021 boolean res = reply.readInt() != 0;
3022 data.recycle();
3023 reply.recycle();
3024 return res;
3025 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003026 @Override
3027 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3028 Parcel data = Parcel.obtain();
3029 Parcel reply = Parcel.obtain();
3030 data.writeInterfaceToken(IActivityManager.descriptor);
3031 data.writeString(reason);
3032 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3033 boolean res = reply.readInt() != 0;
3034 data.recycle();
3035 reply.recycle();
3036 return res;
3037 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 public void startRunning(String pkg, String cls, String action,
3039 String indata) throws RemoteException {
3040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeString(pkg);
3044 data.writeString(cls);
3045 data.writeString(action);
3046 data.writeString(indata);
3047 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3048 reply.readException();
3049 data.recycle();
3050 reply.recycle();
3051 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003052 public boolean testIsSystemReady()
3053 {
3054 /* this base class version is never called */
3055 return true;
3056 }
Dan Egnor60d87622009-12-16 16:32:58 -08003057 public void handleApplicationCrash(IBinder app,
3058 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3059 {
3060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 data.writeStrongBinder(app);
3064 crashInfo.writeToParcel(data, 0);
3065 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3066 reply.readException();
3067 reply.recycle();
3068 data.recycle();
3069 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003070
Dan Egnor60d87622009-12-16 16:32:58 -08003071 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003072 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 {
3074 Parcel data = Parcel.obtain();
3075 Parcel reply = Parcel.obtain();
3076 data.writeInterfaceToken(IActivityManager.descriptor);
3077 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003078 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003079 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003080 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003081 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003082 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 reply.recycle();
3084 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003085 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003086 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003087
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003088 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003089 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003090 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003096 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003097 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003098 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 reply.recycle();
3101 data.recycle();
3102 }
3103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003104 public void signalPersistentProcesses(int sig) throws RemoteException {
3105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
3107 data.writeInterfaceToken(IActivityManager.descriptor);
3108 data.writeInt(sig);
3109 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3110 reply.readException();
3111 data.recycle();
3112 reply.recycle();
3113 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003114
Dianne Hackborn03abb812010-01-04 18:43:19 -08003115 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003116 Parcel data = Parcel.obtain();
3117 Parcel reply = Parcel.obtain();
3118 data.writeInterfaceToken(IActivityManager.descriptor);
3119 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003120 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3121 reply.readException();
3122 data.recycle();
3123 reply.recycle();
3124 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003125
3126 public void killAllBackgroundProcesses() throws RemoteException {
3127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3131 reply.readException();
3132 data.recycle();
3133 reply.recycle();
3134 }
3135
Dianne Hackborn03abb812010-01-04 18:43:19 -08003136 public void forceStopPackage(String packageName) throws RemoteException {
3137 Parcel data = Parcel.obtain();
3138 Parcel reply = Parcel.obtain();
3139 data.writeInterfaceToken(IActivityManager.descriptor);
3140 data.writeString(packageName);
3141 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003142 reply.readException();
3143 data.recycle();
3144 reply.recycle();
3145 }
3146
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003147 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3148 throws RemoteException
3149 {
3150 Parcel data = Parcel.obtain();
3151 Parcel reply = Parcel.obtain();
3152 data.writeInterfaceToken(IActivityManager.descriptor);
3153 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3154 reply.readException();
3155 outInfo.readFromParcel(reply);
3156 reply.recycle();
3157 data.recycle();
3158 }
3159
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003160 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3161 {
3162 Parcel data = Parcel.obtain();
3163 Parcel reply = Parcel.obtain();
3164 data.writeInterfaceToken(IActivityManager.descriptor);
3165 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3166 reply.readException();
3167 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3168 reply.recycle();
3169 data.recycle();
3170 return res;
3171 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003172
3173 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003174 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 data.writeString(process);
3180 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003181 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003182 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003183 if (fd != null) {
3184 data.writeInt(1);
3185 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3186 } else {
3187 data.writeInt(0);
3188 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003189 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 boolean res = reply.readInt() != 0;
3192 reply.recycle();
3193 data.recycle();
3194 return res;
3195 }
3196
Dianne Hackborn55280a92009-05-07 15:53:46 -07003197 public boolean shutdown(int timeout) throws RemoteException
3198 {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 data.writeInt(timeout);
3203 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 boolean res = reply.readInt() != 0;
3206 reply.recycle();
3207 data.recycle();
3208 return res;
3209 }
3210
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003211 public void stopAppSwitches() throws RemoteException {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 reply.recycle();
3218 data.recycle();
3219 }
3220
3221 public void resumeAppSwitches() throws RemoteException {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3226 reply.readException();
3227 reply.recycle();
3228 data.recycle();
3229 }
3230
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003231 public int startActivityInPackage(int uid,
3232 Intent intent, String resolvedType, IBinder resultTo,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003233 String resultWho, int requestCode, int startFlags, Bundle options)
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003234 throws RemoteException {
3235 Parcel data = Parcel.obtain();
3236 Parcel reply = Parcel.obtain();
3237 data.writeInterfaceToken(IActivityManager.descriptor);
3238 data.writeInt(uid);
3239 intent.writeToParcel(data, 0);
3240 data.writeString(resolvedType);
3241 data.writeStrongBinder(resultTo);
3242 data.writeString(resultWho);
3243 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003244 data.writeInt(startFlags);
3245 if (options != null) {
3246 data.writeInt(1);
3247 options.writeToParcel(data, 0);
3248 } else {
3249 data.writeInt(0);
3250 }
Dianne Hackborn2d91af02009-07-16 13:34:33 -07003251 mRemote.transact(START_ACTIVITY_IN_PACKAGE_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 int result = reply.readInt();
3254 reply.recycle();
3255 data.recycle();
3256 return result;
3257 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003258
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003259 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 data.writeString(pkg);
3264 data.writeInt(uid);
3265 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3266 reply.readException();
3267 data.recycle();
3268 reply.recycle();
3269 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003270
3271 public void closeSystemDialogs(String reason) throws RemoteException {
3272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeString(reason);
3276 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3277 reply.readException();
3278 data.recycle();
3279 reply.recycle();
3280 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003281
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003282 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003283 throws RemoteException {
3284 Parcel data = Parcel.obtain();
3285 Parcel reply = Parcel.obtain();
3286 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003287 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003288 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3289 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003290 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003291 data.recycle();
3292 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003293 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003294 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003295
3296 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 data.writeString(processName);
3301 data.writeInt(uid);
3302 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
3307
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003308 public void overridePendingTransition(IBinder token, String packageName,
3309 int enterAnim, int exitAnim) throws RemoteException {
3310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeStrongBinder(token);
3314 data.writeString(packageName);
3315 data.writeInt(enterAnim);
3316 data.writeInt(exitAnim);
3317 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 data.recycle();
3320 reply.recycle();
3321 }
3322
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003323 public boolean isUserAMonkey() throws RemoteException {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 boolean res = reply.readInt() != 0;
3330 data.recycle();
3331 reply.recycle();
3332 return res;
3333 }
3334
Dianne Hackborn860755f2010-06-03 18:47:52 -07003335 public void finishHeavyWeightApp() throws RemoteException {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 data.recycle();
3342 reply.recycle();
3343 }
3344
Daniel Sandler69a48172010-06-23 16:29:36 -04003345 public void setImmersive(IBinder token, boolean immersive)
3346 throws RemoteException {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 data.writeStrongBinder(token);
3351 data.writeInt(immersive ? 1 : 0);
3352 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3353 reply.readException();
3354 data.recycle();
3355 reply.recycle();
3356 }
3357
3358 public boolean isImmersive(IBinder token)
3359 throws RemoteException {
3360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 data.writeStrongBinder(token);
3364 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003365 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003366 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003367 data.recycle();
3368 reply.recycle();
3369 return res;
3370 }
3371
3372 public boolean isTopActivityImmersive()
3373 throws RemoteException {
3374 Parcel data = Parcel.obtain();
3375 Parcel reply = Parcel.obtain();
3376 data.writeInterfaceToken(IActivityManager.descriptor);
3377 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003378 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003379 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003380 data.recycle();
3381 reply.recycle();
3382 return res;
3383 }
3384
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003385 public void crashApplication(int uid, int initialPid, String packageName,
3386 String message) throws RemoteException {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 data.writeInt(uid);
3391 data.writeInt(initialPid);
3392 data.writeString(packageName);
3393 data.writeString(message);
3394 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3395 reply.readException();
3396 data.recycle();
3397 reply.recycle();
3398 }
Andy McFadden824c5102010-07-09 16:26:57 -07003399
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003400 public String getProviderMimeType(Uri uri)
3401 throws RemoteException {
3402 Parcel data = Parcel.obtain();
3403 Parcel reply = Parcel.obtain();
3404 data.writeInterfaceToken(IActivityManager.descriptor);
3405 uri.writeToParcel(data, 0);
3406 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3407 reply.readException();
3408 String res = reply.readString();
3409 data.recycle();
3410 reply.recycle();
3411 return res;
3412 }
3413
Dianne Hackborn7e269642010-08-25 19:50:20 -07003414 public IBinder newUriPermissionOwner(String name)
3415 throws RemoteException {
3416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 data.writeString(name);
3420 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3421 reply.readException();
3422 IBinder res = reply.readStrongBinder();
3423 data.recycle();
3424 reply.recycle();
3425 return res;
3426 }
3427
3428 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3429 Uri uri, int mode) throws RemoteException {
3430 Parcel data = Parcel.obtain();
3431 Parcel reply = Parcel.obtain();
3432 data.writeInterfaceToken(IActivityManager.descriptor);
3433 data.writeStrongBinder(owner);
3434 data.writeInt(fromUid);
3435 data.writeString(targetPkg);
3436 uri.writeToParcel(data, 0);
3437 data.writeInt(mode);
3438 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3439 reply.readException();
3440 data.recycle();
3441 reply.recycle();
3442 }
3443
3444 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3445 int mode) throws RemoteException {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 data.writeStrongBinder(owner);
3450 if (uri != null) {
3451 data.writeInt(1);
3452 uri.writeToParcel(data, 0);
3453 } else {
3454 data.writeInt(0);
3455 }
3456 data.writeInt(mode);
3457 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 data.recycle();
3460 reply.recycle();
3461 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003462
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003463 public int checkGrantUriPermission(int callingUid, String targetPkg,
3464 Uri uri, int modeFlags) throws RemoteException {
3465 Parcel data = Parcel.obtain();
3466 Parcel reply = Parcel.obtain();
3467 data.writeInterfaceToken(IActivityManager.descriptor);
3468 data.writeInt(callingUid);
3469 data.writeString(targetPkg);
3470 uri.writeToParcel(data, 0);
3471 data.writeInt(modeFlags);
3472 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3473 reply.readException();
3474 int res = reply.readInt();
3475 data.recycle();
3476 reply.recycle();
3477 return res;
3478 }
3479
Andy McFadden824c5102010-07-09 16:26:57 -07003480 public boolean dumpHeap(String process, boolean managed,
3481 String path, ParcelFileDescriptor fd) throws RemoteException {
3482 Parcel data = Parcel.obtain();
3483 Parcel reply = Parcel.obtain();
3484 data.writeInterfaceToken(IActivityManager.descriptor);
3485 data.writeString(process);
3486 data.writeInt(managed ? 1 : 0);
3487 data.writeString(path);
3488 if (fd != null) {
3489 data.writeInt(1);
3490 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3491 } else {
3492 data.writeInt(0);
3493 }
3494 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 boolean res = reply.readInt() != 0;
3497 reply.recycle();
3498 data.recycle();
3499 return res;
3500 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003501
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003502 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003503 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3504 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3509 data.writeTypedArray(intents, 0);
3510 data.writeStringArray(resolvedTypes);
3511 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003512 if (options != null) {
3513 data.writeInt(1);
3514 options.writeToParcel(data, 0);
3515 } else {
3516 data.writeInt(0);
3517 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003518 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3519 reply.readException();
3520 int result = reply.readInt();
3521 reply.recycle();
3522 data.recycle();
3523 return result;
3524 }
3525
3526 public int startActivitiesInPackage(int uid,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003527 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3528 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003529 Parcel data = Parcel.obtain();
3530 Parcel reply = Parcel.obtain();
3531 data.writeInterfaceToken(IActivityManager.descriptor);
3532 data.writeInt(uid);
3533 data.writeTypedArray(intents, 0);
3534 data.writeStringArray(resolvedTypes);
3535 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003536 if (options != null) {
3537 data.writeInt(1);
3538 options.writeToParcel(data, 0);
3539 } else {
3540 data.writeInt(0);
3541 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003542 mRemote.transact(START_ACTIVITIES_IN_PACKAGE_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 int result = reply.readInt();
3545 reply.recycle();
3546 data.recycle();
3547 return result;
3548 }
3549
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003550 public int getFrontActivityScreenCompatMode() throws RemoteException {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3555 reply.readException();
3556 int mode = reply.readInt();
3557 reply.recycle();
3558 data.recycle();
3559 return mode;
3560 }
3561
3562 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 data.writeInt(mode);
3567 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 reply.recycle();
3570 data.recycle();
3571 }
3572
3573 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3574 Parcel data = Parcel.obtain();
3575 Parcel reply = Parcel.obtain();
3576 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003577 data.writeString(packageName);
3578 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003579 reply.readException();
3580 int mode = reply.readInt();
3581 reply.recycle();
3582 data.recycle();
3583 return mode;
3584 }
3585
3586 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003587 throws RemoteException {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003592 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003593 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 reply.recycle();
3596 data.recycle();
3597 }
3598
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003599 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 data.writeString(packageName);
3604 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3605 reply.readException();
3606 boolean ask = reply.readInt() != 0;
3607 reply.recycle();
3608 data.recycle();
3609 return ask;
3610 }
3611
3612 public void setPackageAskScreenCompat(String packageName, boolean ask)
3613 throws RemoteException {
3614 Parcel data = Parcel.obtain();
3615 Parcel reply = Parcel.obtain();
3616 data.writeInterfaceToken(IActivityManager.descriptor);
3617 data.writeString(packageName);
3618 data.writeInt(ask ? 1 : 0);
3619 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 reply.recycle();
3622 data.recycle();
3623 }
3624
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003625 public boolean switchUser(int userid) throws RemoteException {
3626 Parcel data = Parcel.obtain();
3627 Parcel reply = Parcel.obtain();
3628 data.writeInterfaceToken(IActivityManager.descriptor);
3629 data.writeInt(userid);
3630 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3631 reply.readException();
3632 boolean result = reply.readInt() != 0;
3633 reply.recycle();
3634 data.recycle();
3635 return result;
3636 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003637
3638 public UserInfo getCurrentUser() throws RemoteException {
3639 Parcel data = Parcel.obtain();
3640 Parcel reply = Parcel.obtain();
3641 data.writeInterfaceToken(IActivityManager.descriptor);
3642 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3645 reply.recycle();
3646 data.recycle();
3647 return userInfo;
3648 }
3649
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003650 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 data.writeInt(taskId);
3655 data.writeInt(subTaskIndex);
3656 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3657 reply.readException();
3658 boolean result = reply.readInt() != 0;
3659 reply.recycle();
3660 data.recycle();
3661 return result;
3662 }
3663
3664 public boolean removeTask(int taskId, int flags) throws RemoteException {
3665 Parcel data = Parcel.obtain();
3666 Parcel reply = Parcel.obtain();
3667 data.writeInterfaceToken(IActivityManager.descriptor);
3668 data.writeInt(taskId);
3669 data.writeInt(flags);
3670 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3671 reply.readException();
3672 boolean result = reply.readInt() != 0;
3673 reply.recycle();
3674 data.recycle();
3675 return result;
3676 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003677
Jeff Sharkeya4620792011-05-20 15:29:23 -07003678 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3679 Parcel data = Parcel.obtain();
3680 Parcel reply = Parcel.obtain();
3681 data.writeInterfaceToken(IActivityManager.descriptor);
3682 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3683 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 data.recycle();
3686 reply.recycle();
3687 }
3688
3689 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3690 Parcel data = Parcel.obtain();
3691 Parcel reply = Parcel.obtain();
3692 data.writeInterfaceToken(IActivityManager.descriptor);
3693 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3694 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 data.recycle();
3697 reply.recycle();
3698 }
3699
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003700 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3701 Parcel data = Parcel.obtain();
3702 Parcel reply = Parcel.obtain();
3703 data.writeInterfaceToken(IActivityManager.descriptor);
3704 data.writeStrongBinder(sender.asBinder());
3705 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3706 reply.readException();
3707 boolean res = reply.readInt() != 0;
3708 data.recycle();
3709 reply.recycle();
3710 return res;
3711 }
3712
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003713 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3714 {
3715 Parcel data = Parcel.obtain();
3716 Parcel reply = Parcel.obtain();
3717 data.writeInterfaceToken(IActivityManager.descriptor);
3718 values.writeToParcel(data, 0);
3719 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 data.recycle();
3722 reply.recycle();
3723 }
3724
Dianne Hackbornb437e092011-08-05 17:50:29 -07003725 public long[] getProcessPss(int[] pids) throws RemoteException {
3726 Parcel data = Parcel.obtain();
3727 Parcel reply = Parcel.obtain();
3728 data.writeInterfaceToken(IActivityManager.descriptor);
3729 data.writeIntArray(pids);
3730 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3731 reply.readException();
3732 long[] res = reply.createLongArray();
3733 data.recycle();
3734 reply.recycle();
3735 return res;
3736 }
3737
Dianne Hackborn661cd522011-08-22 00:26:20 -07003738 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3739 Parcel data = Parcel.obtain();
3740 Parcel reply = Parcel.obtain();
3741 data.writeInterfaceToken(IActivityManager.descriptor);
3742 TextUtils.writeToParcel(msg, data, 0);
3743 data.writeInt(always ? 1 : 0);
3744 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3745 reply.readException();
3746 data.recycle();
3747 reply.recycle();
3748 }
3749
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003750 public void dismissKeyguardOnNextActivity() throws RemoteException {
3751 Parcel data = Parcel.obtain();
3752 Parcel reply = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 data.recycle();
3757 reply.recycle();
3758 }
3759
Adam Powelldd8fab22012-03-22 17:47:27 -07003760 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3761 throws RemoteException {
3762 Parcel data = Parcel.obtain();
3763 Parcel reply = Parcel.obtain();
3764 data.writeInterfaceToken(IActivityManager.descriptor);
3765 data.writeStrongBinder(token);
3766 data.writeString(destAffinity);
3767 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3768 reply.readException();
3769 boolean result = reply.readInt() != 0;
3770 data.recycle();
3771 reply.recycle();
3772 return result;
3773 }
3774
3775 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3776 throws RemoteException {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 data.writeStrongBinder(token);
3781 target.writeToParcel(data, 0);
3782 data.writeInt(resultCode);
3783 if (resultData != null) {
3784 data.writeInt(1);
3785 resultData.writeToParcel(data, 0);
3786 } else {
3787 data.writeInt(0);
3788 }
3789 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 boolean result = reply.readInt() != 0;
3792 data.recycle();
3793 reply.recycle();
3794 return result;
3795 }
3796
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003797 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3798 Parcel data = Parcel.obtain();
3799 Parcel reply = Parcel.obtain();
3800 data.writeInterfaceToken(IActivityManager.descriptor);
3801 data.writeStrongBinder(activityToken);
3802 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3803 reply.readException();
3804 int result = reply.readInt();
3805 data.recycle();
3806 reply.recycle();
3807 return result;
3808 }
3809
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003810 private IBinder mRemote;
3811}