blob: eae3b1f9bb177994aaab708d64c9786187e815ca [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;
Dianne Hackbornf02b60a2012-08-16 10:48:27 -070042import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080045import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.List;
49
50/** {@hide} */
51public abstract class ActivityManagerNative extends Binder implements IActivityManager
52{
53 /**
54 * Cast a Binder object into an activity manager interface, generating
55 * a proxy if needed.
56 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080057 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 if (obj == null) {
59 return null;
60 }
61 IActivityManager in =
62 (IActivityManager)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ActivityManagerProxy(obj);
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 /**
71 * Retrieve the system's default/global activity manager.
72 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073 static public IActivityManager getDefault() {
74 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
78 * Convenience for checking whether the system is ready. For internal use only.
79 */
80 static public boolean isSystemReady() {
81 if (!sSystemReady) {
82 sSystemReady = getDefault().testIsSystemReady();
83 }
84 return sSystemReady;
85 }
86 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 /**
89 * Convenience for sending a sticky broadcast. For internal use only.
90 * If you don't care about permission, use null.
91 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070092 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 try {
94 getDefault().broadcastIntent(
95 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070096 null /*permission*/, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 } catch (RemoteException ex) {
98 }
99 }
100
101 static public void noteWakeupAlarm(PendingIntent ps) {
102 try {
103 getDefault().noteWakeupAlarm(ps.getTarget());
104 } catch (RemoteException ex) {
105 }
106 }
107
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800108 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 attachInterface(this, descriptor);
110 }
111
112 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
113 throws RemoteException {
114 switch (code) {
115 case START_ACTIVITY_TRANSACTION:
116 {
117 data.enforceInterface(IActivityManager.descriptor);
118 IBinder b = data.readStrongBinder();
119 IApplicationThread app = ApplicationThreadNative.asInterface(b);
120 Intent intent = Intent.CREATOR.createFromParcel(data);
121 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800123 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700125 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700126 String profileFile = data.readString();
127 ParcelFileDescriptor profileFd = data.readInt() != 0
128 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 Bundle options = data.readInt() != 0
130 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int result = startActivity(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 resultTo, resultWho, requestCode, startFlags,
133 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Amith Yamasani82644082012-08-03 13:09:11 -0700139 case START_ACTIVITY_AS_USER_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
144 Intent intent = Intent.CREATOR.createFromParcel(data);
145 String resolvedType = data.readString();
146 IBinder resultTo = data.readStrongBinder();
147 String resultWho = data.readString();
148 int requestCode = data.readInt();
149 int startFlags = data.readInt();
150 String profileFile = data.readString();
151 ParcelFileDescriptor profileFd = data.readInt() != 0
152 ? data.readFileDescriptor() : null;
153 Bundle options = data.readInt() != 0
154 ? Bundle.CREATOR.createFromParcel(data) : null;
155 int userId = data.readInt();
156 int result = startActivityAsUser(app, intent, resolvedType,
157 resultTo, resultWho, requestCode, startFlags,
158 profileFile, profileFd, options, userId);
159 reply.writeNoException();
160 reply.writeInt(result);
161 return true;
162 }
163
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800164 case START_ACTIVITY_AND_WAIT_TRANSACTION:
165 {
166 data.enforceInterface(IActivityManager.descriptor);
167 IBinder b = data.readStrongBinder();
168 IApplicationThread app = ApplicationThreadNative.asInterface(b);
169 Intent intent = Intent.CREATOR.createFromParcel(data);
170 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800172 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700174 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700175 String profileFile = data.readString();
176 ParcelFileDescriptor profileFd = data.readInt() != 0
177 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700178 Bundle options = data.readInt() != 0
179 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700180 int userId = data.readInt();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700182 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700183 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800184 reply.writeNoException();
185 result.writeToParcel(reply, 0);
186 return true;
187 }
188
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700189 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
190 {
191 data.enforceInterface(IActivityManager.descriptor);
192 IBinder b = data.readStrongBinder();
193 IApplicationThread app = ApplicationThreadNative.asInterface(b);
194 Intent intent = Intent.CREATOR.createFromParcel(data);
195 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700196 IBinder resultTo = data.readStrongBinder();
197 String resultWho = data.readString();
198 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700199 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700200 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700201 Bundle options = data.readInt() != 0
202 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700203 int userId = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700205 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 reply.writeNoException();
207 reply.writeInt(result);
208 return true;
209 }
210
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700211 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700212 {
213 data.enforceInterface(IActivityManager.descriptor);
214 IBinder b = data.readStrongBinder();
215 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700216 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700217 Intent fillInIntent = null;
218 if (data.readInt() != 0) {
219 fillInIntent = Intent.CREATOR.createFromParcel(data);
220 }
221 String resolvedType = data.readString();
222 IBinder resultTo = data.readStrongBinder();
223 String resultWho = data.readString();
224 int requestCode = data.readInt();
225 int flagsMask = data.readInt();
226 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700227 Bundle options = data.readInt() != 0
228 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700229 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700230 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700232 reply.writeNoException();
233 reply.writeInt(result);
234 return true;
235 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800236
237 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
238 {
239 data.enforceInterface(IActivityManager.descriptor);
240 IBinder callingActivity = data.readStrongBinder();
241 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 Bundle options = data.readInt() != 0
243 ? Bundle.CREATOR.createFromParcel(data) : null;
244 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 reply.writeNoException();
246 reply.writeInt(result ? 1 : 0);
247 return true;
248 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700249
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 case FINISH_ACTIVITY_TRANSACTION: {
251 data.enforceInterface(IActivityManager.descriptor);
252 IBinder token = data.readStrongBinder();
253 Intent resultData = null;
254 int resultCode = data.readInt();
255 if (data.readInt() != 0) {
256 resultData = Intent.CREATOR.createFromParcel(data);
257 }
258 boolean res = finishActivity(token, resultCode, resultData);
259 reply.writeNoException();
260 reply.writeInt(res ? 1 : 0);
261 return true;
262 }
263
264 case FINISH_SUB_ACTIVITY_TRANSACTION: {
265 data.enforceInterface(IActivityManager.descriptor);
266 IBinder token = data.readStrongBinder();
267 String resultWho = data.readString();
268 int requestCode = data.readInt();
269 finishSubActivity(token, resultWho, requestCode);
270 reply.writeNoException();
271 return true;
272 }
273
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700274 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
275 data.enforceInterface(IActivityManager.descriptor);
276 IBinder token = data.readStrongBinder();
277 boolean res = finishActivityAffinity(token);
278 reply.writeNoException();
279 reply.writeInt(res ? 1 : 0);
280 return true;
281 }
282
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800283 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
284 data.enforceInterface(IActivityManager.descriptor);
285 IBinder token = data.readStrongBinder();
286 boolean res = willActivityBeVisible(token);
287 reply.writeNoException();
288 reply.writeInt(res ? 1 : 0);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case REGISTER_RECEIVER_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder b = data.readStrongBinder();
296 IApplicationThread app =
297 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700298 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299 b = data.readStrongBinder();
300 IIntentReceiver rec
301 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
302 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
303 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700304 int userId = data.readInt();
305 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 reply.writeNoException();
307 if (intent != null) {
308 reply.writeInt(1);
309 intent.writeToParcel(reply, 0);
310 } else {
311 reply.writeInt(0);
312 }
313 return true;
314 }
315
316 case UNREGISTER_RECEIVER_TRANSACTION:
317 {
318 data.enforceInterface(IActivityManager.descriptor);
319 IBinder b = data.readStrongBinder();
320 if (b == null) {
321 return true;
322 }
323 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
324 unregisterReceiver(rec);
325 reply.writeNoException();
326 return true;
327 }
328
329 case BROADCAST_INTENT_TRANSACTION:
330 {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder b = data.readStrongBinder();
333 IApplicationThread app =
334 b != null ? ApplicationThreadNative.asInterface(b) : null;
335 Intent intent = Intent.CREATOR.createFromParcel(data);
336 String resolvedType = data.readString();
337 b = data.readStrongBinder();
338 IIntentReceiver resultTo =
339 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
340 int resultCode = data.readInt();
341 String resultData = data.readString();
342 Bundle resultExtras = data.readBundle();
343 String perm = data.readString();
344 boolean serialized = data.readInt() != 0;
345 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700346 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 int res = broadcastIntent(app, intent, resolvedType, resultTo,
348 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700349 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 reply.writeNoException();
351 reply.writeInt(res);
352 return true;
353 }
354
355 case UNBROADCAST_INTENT_TRANSACTION:
356 {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder b = data.readStrongBinder();
359 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
360 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700361 int userId = data.readInt();
362 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 reply.writeNoException();
364 return true;
365 }
366
367 case FINISH_RECEIVER_TRANSACTION: {
368 data.enforceInterface(IActivityManager.descriptor);
369 IBinder who = data.readStrongBinder();
370 int resultCode = data.readInt();
371 String resultData = data.readString();
372 Bundle resultExtras = data.readBundle();
373 boolean resultAbort = data.readInt() != 0;
374 if (who != null) {
375 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
376 }
377 reply.writeNoException();
378 return true;
379 }
380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 case ATTACH_APPLICATION_TRANSACTION: {
382 data.enforceInterface(IActivityManager.descriptor);
383 IApplicationThread app = ApplicationThreadNative.asInterface(
384 data.readStrongBinder());
385 if (app != null) {
386 attachApplication(app);
387 }
388 reply.writeNoException();
389 return true;
390 }
391
392 case ACTIVITY_IDLE_TRANSACTION: {
393 data.enforceInterface(IActivityManager.descriptor);
394 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700395 Configuration config = null;
396 if (data.readInt() != 0) {
397 config = Configuration.CREATOR.createFromParcel(data);
398 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700399 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700401 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 }
403 reply.writeNoException();
404 return true;
405 }
406
407 case ACTIVITY_PAUSED_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800410 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 reply.writeNoException();
412 return true;
413 }
414
415 case ACTIVITY_STOPPED_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800418 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 Bitmap thumbnail = data.readInt() != 0
420 ? Bitmap.CREATOR.createFromParcel(data) : null;
421 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800422 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 reply.writeNoException();
424 return true;
425 }
426
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800427 case ACTIVITY_SLEPT_TRANSACTION: {
428 data.enforceInterface(IActivityManager.descriptor);
429 IBinder token = data.readStrongBinder();
430 activitySlept(token);
431 reply.writeNoException();
432 return true;
433 }
434
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 case ACTIVITY_DESTROYED_TRANSACTION: {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder token = data.readStrongBinder();
438 activityDestroyed(token);
439 reply.writeNoException();
440 return true;
441 }
442
443 case GET_CALLING_PACKAGE_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 IBinder token = data.readStrongBinder();
446 String res = token != null ? getCallingPackage(token) : null;
447 reply.writeNoException();
448 reply.writeString(res);
449 return true;
450 }
451
452 case GET_CALLING_ACTIVITY_TRANSACTION: {
453 data.enforceInterface(IActivityManager.descriptor);
454 IBinder token = data.readStrongBinder();
455 ComponentName cn = getCallingActivity(token);
456 reply.writeNoException();
457 ComponentName.writeToParcel(cn, reply);
458 return true;
459 }
460
461 case GET_TASKS_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 int maxNum = data.readInt();
464 int fl = data.readInt();
465 IBinder receiverBinder = data.readStrongBinder();
466 IThumbnailReceiver receiver = receiverBinder != null
467 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
468 : null;
469 List list = getTasks(maxNum, fl, receiver);
470 reply.writeNoException();
471 int N = list != null ? list.size() : -1;
472 reply.writeInt(N);
473 int i;
474 for (i=0; i<N; i++) {
475 ActivityManager.RunningTaskInfo info =
476 (ActivityManager.RunningTaskInfo)list.get(i);
477 info.writeToParcel(reply, 0);
478 }
479 return true;
480 }
481
482 case GET_RECENT_TASKS_TRANSACTION: {
483 data.enforceInterface(IActivityManager.descriptor);
484 int maxNum = data.readInt();
485 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700486 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700488 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 reply.writeNoException();
490 reply.writeTypedList(list);
491 return true;
492 }
493
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700494 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800495 data.enforceInterface(IActivityManager.descriptor);
496 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700497 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800498 reply.writeNoException();
499 if (bm != null) {
500 reply.writeInt(1);
501 bm.writeToParcel(reply, 0);
502 } else {
503 reply.writeInt(0);
504 }
505 return true;
506 }
507
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800508 case GET_SERVICES_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 int maxNum = data.readInt();
511 int fl = data.readInt();
512 List list = getServices(maxNum, fl);
513 reply.writeNoException();
514 int N = list != null ? list.size() : -1;
515 reply.writeInt(N);
516 int i;
517 for (i=0; i<N; i++) {
518 ActivityManager.RunningServiceInfo info =
519 (ActivityManager.RunningServiceInfo)list.get(i);
520 info.writeToParcel(reply, 0);
521 }
522 return true;
523 }
524
525 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
526 data.enforceInterface(IActivityManager.descriptor);
527 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
528 reply.writeNoException();
529 reply.writeTypedList(list);
530 return true;
531 }
532
533 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
534 data.enforceInterface(IActivityManager.descriptor);
535 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
536 reply.writeNoException();
537 reply.writeTypedList(list);
538 return true;
539 }
540
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700541 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
542 data.enforceInterface(IActivityManager.descriptor);
543 List<ApplicationInfo> list = getRunningExternalApplications();
544 reply.writeNoException();
545 reply.writeTypedList(list);
546 return true;
547 }
548
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 case MOVE_TASK_TO_FRONT_TRANSACTION: {
550 data.enforceInterface(IActivityManager.descriptor);
551 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800552 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700553 Bundle options = data.readInt() != 0
554 ? Bundle.CREATOR.createFromParcel(data) : null;
555 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800556 reply.writeNoException();
557 return true;
558 }
559
560 case MOVE_TASK_TO_BACK_TRANSACTION: {
561 data.enforceInterface(IActivityManager.descriptor);
562 int task = data.readInt();
563 moveTaskToBack(task);
564 reply.writeNoException();
565 return true;
566 }
567
568 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 IBinder token = data.readStrongBinder();
571 boolean nonRoot = data.readInt() != 0;
572 boolean res = moveActivityTaskToBack(token, nonRoot);
573 reply.writeNoException();
574 reply.writeInt(res ? 1 : 0);
575 return true;
576 }
577
578 case MOVE_TASK_BACKWARDS_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 int task = data.readInt();
581 moveTaskBackwards(task);
582 reply.writeNoException();
583 return true;
584 }
585
586 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 IBinder token = data.readStrongBinder();
589 boolean onlyRoot = data.readInt() != 0;
590 int res = token != null
591 ? getTaskForActivity(token, onlyRoot) : -1;
592 reply.writeNoException();
593 reply.writeInt(res);
594 return true;
595 }
596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 case REPORT_THUMBNAIL_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 IBinder token = data.readStrongBinder();
600 Bitmap thumbnail = data.readInt() != 0
601 ? Bitmap.CREATOR.createFromParcel(data) : null;
602 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
603 reportThumbnail(token, thumbnail, description);
604 reply.writeNoException();
605 return true;
606 }
607
608 case GET_CONTENT_PROVIDER_TRANSACTION: {
609 data.enforceInterface(IActivityManager.descriptor);
610 IBinder b = data.readStrongBinder();
611 IApplicationThread app = ApplicationThreadNative.asInterface(b);
612 String name = data.readString();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700613 boolean stable = data.readInt() != 0;
614 ContentProviderHolder cph = getContentProvider(app, name, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800615 reply.writeNoException();
616 if (cph != null) {
617 reply.writeInt(1);
618 cph.writeToParcel(reply, 0);
619 } else {
620 reply.writeInt(0);
621 }
622 return true;
623 }
624
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800625 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 String name = data.readString();
628 IBinder token = data.readStrongBinder();
629 ContentProviderHolder cph = getContentProviderExternal(name, token);
630 reply.writeNoException();
631 if (cph != null) {
632 reply.writeInt(1);
633 cph.writeToParcel(reply, 0);
634 } else {
635 reply.writeInt(0);
636 }
637 return true;
638 }
639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
641 data.enforceInterface(IActivityManager.descriptor);
642 IBinder b = data.readStrongBinder();
643 IApplicationThread app = ApplicationThreadNative.asInterface(b);
644 ArrayList<ContentProviderHolder> providers =
645 data.createTypedArrayList(ContentProviderHolder.CREATOR);
646 publishContentProviders(app, providers);
647 reply.writeNoException();
648 return true;
649 }
650
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700651 case REF_CONTENT_PROVIDER_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 IBinder b = data.readStrongBinder();
654 int stable = data.readInt();
655 int unstable = data.readInt();
656 boolean res = refContentProvider(b, stable, unstable);
657 reply.writeNoException();
658 reply.writeInt(res ? 1 : 0);
659 return true;
660 }
661
662 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 IBinder b = data.readStrongBinder();
665 unstableProviderDied(b);
666 reply.writeNoException();
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700673 boolean stable = data.readInt() != 0;
674 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 return true;
677 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800678
679 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 String name = data.readString();
682 IBinder token = data.readStrongBinder();
683 removeContentProviderExternal(name, token);
684 reply.writeNoException();
685 return true;
686 }
687
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700688 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
691 PendingIntent pi = getRunningServiceControlPanel(comp);
692 reply.writeNoException();
693 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
694 return true;
695 }
696
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 case START_SERVICE_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 IBinder b = data.readStrongBinder();
700 IApplicationThread app = ApplicationThreadNative.asInterface(b);
701 Intent service = Intent.CREATOR.createFromParcel(data);
702 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700703 int userId = data.readInt();
704 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 reply.writeNoException();
706 ComponentName.writeToParcel(cn, reply);
707 return true;
708 }
709
710 case STOP_SERVICE_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 IBinder b = data.readStrongBinder();
713 IApplicationThread app = ApplicationThreadNative.asInterface(b);
714 Intent service = Intent.CREATOR.createFromParcel(data);
715 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700716 int userId = data.readInt();
717 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 reply.writeNoException();
719 reply.writeInt(res);
720 return true;
721 }
722
723 case STOP_SERVICE_TOKEN_TRANSACTION: {
724 data.enforceInterface(IActivityManager.descriptor);
725 ComponentName className = ComponentName.readFromParcel(data);
726 IBinder token = data.readStrongBinder();
727 int startId = data.readInt();
728 boolean res = stopServiceToken(className, token, startId);
729 reply.writeNoException();
730 reply.writeInt(res ? 1 : 0);
731 return true;
732 }
733
734 case SET_SERVICE_FOREGROUND_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 ComponentName className = ComponentName.readFromParcel(data);
737 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700738 int id = data.readInt();
739 Notification notification = null;
740 if (data.readInt() != 0) {
741 notification = Notification.CREATOR.createFromParcel(data);
742 }
743 boolean removeNotification = data.readInt() != 0;
744 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 reply.writeNoException();
746 return true;
747 }
748
749 case BIND_SERVICE_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 IBinder b = data.readStrongBinder();
752 IApplicationThread app = ApplicationThreadNative.asInterface(b);
753 IBinder token = data.readStrongBinder();
754 Intent service = Intent.CREATOR.createFromParcel(data);
755 String resolvedType = data.readString();
756 b = data.readStrongBinder();
757 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800758 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800760 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800761 reply.writeNoException();
762 reply.writeInt(res);
763 return true;
764 }
765
766 case UNBIND_SERVICE_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 IBinder b = data.readStrongBinder();
769 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
770 boolean res = unbindService(conn);
771 reply.writeNoException();
772 reply.writeInt(res ? 1 : 0);
773 return true;
774 }
775
776 case PUBLISH_SERVICE_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder token = data.readStrongBinder();
779 Intent intent = Intent.CREATOR.createFromParcel(data);
780 IBinder service = data.readStrongBinder();
781 publishService(token, intent, service);
782 reply.writeNoException();
783 return true;
784 }
785
786 case UNBIND_FINISHED_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder token = data.readStrongBinder();
789 Intent intent = Intent.CREATOR.createFromParcel(data);
790 boolean doRebind = data.readInt() != 0;
791 unbindFinished(token, intent, doRebind);
792 reply.writeNoException();
793 return true;
794 }
795
796 case SERVICE_DONE_EXECUTING_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700799 int type = data.readInt();
800 int startId = data.readInt();
801 int res = data.readInt();
802 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 reply.writeNoException();
804 return true;
805 }
806
807 case START_INSTRUMENTATION_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 ComponentName className = ComponentName.readFromParcel(data);
810 String profileFile = data.readString();
811 int fl = data.readInt();
812 Bundle arguments = data.readBundle();
813 IBinder b = data.readStrongBinder();
814 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700815 int userId = data.readInt();
816 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800817 reply.writeNoException();
818 reply.writeInt(res ? 1 : 0);
819 return true;
820 }
821
822
823 case FINISH_INSTRUMENTATION_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 IBinder b = data.readStrongBinder();
826 IApplicationThread app = ApplicationThreadNative.asInterface(b);
827 int resultCode = data.readInt();
828 Bundle results = data.readBundle();
829 finishInstrumentation(app, resultCode, results);
830 reply.writeNoException();
831 return true;
832 }
833
834 case GET_CONFIGURATION_TRANSACTION: {
835 data.enforceInterface(IActivityManager.descriptor);
836 Configuration config = getConfiguration();
837 reply.writeNoException();
838 config.writeToParcel(reply, 0);
839 return true;
840 }
841
842 case UPDATE_CONFIGURATION_TRANSACTION: {
843 data.enforceInterface(IActivityManager.descriptor);
844 Configuration config = Configuration.CREATOR.createFromParcel(data);
845 updateConfiguration(config);
846 reply.writeNoException();
847 return true;
848 }
849
850 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
851 data.enforceInterface(IActivityManager.descriptor);
852 IBinder token = data.readStrongBinder();
853 int requestedOrientation = data.readInt();
854 setRequestedOrientation(token, requestedOrientation);
855 reply.writeNoException();
856 return true;
857 }
858
859 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 IBinder token = data.readStrongBinder();
862 int req = getRequestedOrientation(token);
863 reply.writeNoException();
864 reply.writeInt(req);
865 return true;
866 }
867
868 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 IBinder token = data.readStrongBinder();
871 ComponentName cn = getActivityClassForToken(token);
872 reply.writeNoException();
873 ComponentName.writeToParcel(cn, reply);
874 return true;
875 }
876
877 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 IBinder token = data.readStrongBinder();
880 reply.writeNoException();
881 reply.writeString(getPackageForToken(token));
882 return true;
883 }
884
885 case GET_INTENT_SENDER_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 int type = data.readInt();
888 String packageName = data.readString();
889 IBinder token = data.readStrongBinder();
890 String resultWho = data.readString();
891 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800892 Intent[] requestIntents;
893 String[] requestResolvedTypes;
894 if (data.readInt() != 0) {
895 requestIntents = data.createTypedArray(Intent.CREATOR);
896 requestResolvedTypes = data.createStringArray();
897 } else {
898 requestIntents = null;
899 requestResolvedTypes = null;
900 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700902 Bundle options = data.readInt() != 0
903 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700904 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800906 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700907 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeStrongBinder(res != null ? res.asBinder() : null);
910 return true;
911 }
912
913 case CANCEL_INTENT_SENDER_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 IIntentSender r = IIntentSender.Stub.asInterface(
916 data.readStrongBinder());
917 cancelIntentSender(r);
918 reply.writeNoException();
919 return true;
920 }
921
922 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
923 data.enforceInterface(IActivityManager.descriptor);
924 IIntentSender r = IIntentSender.Stub.asInterface(
925 data.readStrongBinder());
926 String res = getPackageForIntentSender(r);
927 reply.writeNoException();
928 reply.writeString(res);
929 return true;
930 }
931
Christopher Tatec4a07d12012-04-06 14:19:13 -0700932 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IIntentSender r = IIntentSender.Stub.asInterface(
935 data.readStrongBinder());
936 int res = getUidForIntentSender(r);
937 reply.writeNoException();
938 reply.writeInt(res);
939 return true;
940 }
941
Dianne Hackborn41203752012-08-31 14:05:51 -0700942 case HANDLE_INCOMING_USER_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 int callingPid = data.readInt();
945 int callingUid = data.readInt();
946 int userId = data.readInt();
947 boolean allowAll = data.readInt() != 0 ;
948 boolean requireFull = data.readInt() != 0;
949 String name = data.readString();
950 String callerPackage = data.readString();
951 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
952 requireFull, name, callerPackage);
953 reply.writeNoException();
954 reply.writeInt(res);
955 return true;
956 }
957
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800958 case SET_PROCESS_LIMIT_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 int max = data.readInt();
961 setProcessLimit(max);
962 reply.writeNoException();
963 return true;
964 }
965
966 case GET_PROCESS_LIMIT_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 int limit = getProcessLimit();
969 reply.writeNoException();
970 reply.writeInt(limit);
971 return true;
972 }
973
974 case SET_PROCESS_FOREGROUND_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 IBinder token = data.readStrongBinder();
977 int pid = data.readInt();
978 boolean isForeground = data.readInt() != 0;
979 setProcessForeground(token, pid, isForeground);
980 reply.writeNoException();
981 return true;
982 }
983
984 case CHECK_PERMISSION_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 String perm = data.readString();
987 int pid = data.readInt();
988 int uid = data.readInt();
989 int res = checkPermission(perm, pid, uid);
990 reply.writeNoException();
991 reply.writeInt(res);
992 return true;
993 }
994
995 case CHECK_URI_PERMISSION_TRANSACTION: {
996 data.enforceInterface(IActivityManager.descriptor);
997 Uri uri = Uri.CREATOR.createFromParcel(data);
998 int pid = data.readInt();
999 int uid = data.readInt();
1000 int mode = data.readInt();
1001 int res = checkUriPermission(uri, pid, uid, mode);
1002 reply.writeNoException();
1003 reply.writeInt(res);
1004 return true;
1005 }
1006
1007 case CLEAR_APP_DATA_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 String packageName = data.readString();
1010 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1011 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001012 int userId = data.readInt();
1013 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001014 reply.writeNoException();
1015 reply.writeInt(res ? 1 : 0);
1016 return true;
1017 }
1018
1019 case GRANT_URI_PERMISSION_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 IBinder b = data.readStrongBinder();
1022 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1023 String targetPkg = data.readString();
1024 Uri uri = Uri.CREATOR.createFromParcel(data);
1025 int mode = data.readInt();
1026 grantUriPermission(app, targetPkg, uri, mode);
1027 reply.writeNoException();
1028 return true;
1029 }
1030
1031 case REVOKE_URI_PERMISSION_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 IBinder b = data.readStrongBinder();
1034 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1035 Uri uri = Uri.CREATOR.createFromParcel(data);
1036 int mode = data.readInt();
1037 revokeUriPermission(app, uri, mode);
1038 reply.writeNoException();
1039 return true;
1040 }
1041
1042 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 IBinder b = data.readStrongBinder();
1045 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1046 boolean waiting = data.readInt() != 0;
1047 showWaitingForDebugger(app, waiting);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case GET_MEMORY_INFO_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1055 getMemoryInfo(mi);
1056 reply.writeNoException();
1057 mi.writeToParcel(reply, 0);
1058 return true;
1059 }
1060
1061 case UNHANDLED_BACK_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 unhandledBack();
1064 reply.writeNoException();
1065 return true;
1066 }
1067
1068 case OPEN_CONTENT_URI_TRANSACTION: {
1069 data.enforceInterface(IActivityManager.descriptor);
1070 Uri uri = Uri.parse(data.readString());
1071 ParcelFileDescriptor pfd = openContentUri(uri);
1072 reply.writeNoException();
1073 if (pfd != null) {
1074 reply.writeInt(1);
1075 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1076 } else {
1077 reply.writeInt(0);
1078 }
1079 return true;
1080 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001081
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001082 case GOING_TO_SLEEP_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 goingToSleep();
1085 reply.writeNoException();
1086 return true;
1087 }
1088
1089 case WAKING_UP_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 wakingUp();
1092 reply.writeNoException();
1093 return true;
1094 }
1095
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001096 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1097 data.enforceInterface(IActivityManager.descriptor);
1098 setLockScreenShown(data.readInt() != 0);
1099 reply.writeNoException();
1100 return true;
1101 }
1102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001103 case SET_DEBUG_APP_TRANSACTION: {
1104 data.enforceInterface(IActivityManager.descriptor);
1105 String pn = data.readString();
1106 boolean wfd = data.readInt() != 0;
1107 boolean per = data.readInt() != 0;
1108 setDebugApp(pn, wfd, per);
1109 reply.writeNoException();
1110 return true;
1111 }
1112
1113 case SET_ALWAYS_FINISH_TRANSACTION: {
1114 data.enforceInterface(IActivityManager.descriptor);
1115 boolean enabled = data.readInt() != 0;
1116 setAlwaysFinish(enabled);
1117 reply.writeNoException();
1118 return true;
1119 }
1120
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001121 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001123 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001125 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001126 return true;
1127 }
1128
1129 case ENTER_SAFE_MODE_TRANSACTION: {
1130 data.enforceInterface(IActivityManager.descriptor);
1131 enterSafeMode();
1132 reply.writeNoException();
1133 return true;
1134 }
1135
1136 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 IIntentSender is = IIntentSender.Stub.asInterface(
1139 data.readStrongBinder());
1140 noteWakeupAlarm(is);
1141 reply.writeNoException();
1142 return true;
1143 }
1144
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001145 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 data.enforceInterface(IActivityManager.descriptor);
1147 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001148 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001149 boolean secure = data.readInt() != 0;
1150 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 reply.writeNoException();
1152 reply.writeInt(res ? 1 : 0);
1153 return true;
1154 }
1155
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001156 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 String reason = data.readString();
1159 boolean res = killProcessesBelowForeground(reason);
1160 reply.writeNoException();
1161 reply.writeInt(res ? 1 : 0);
1162 return true;
1163 }
1164
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001165 case START_RUNNING_TRANSACTION: {
1166 data.enforceInterface(IActivityManager.descriptor);
1167 String pkg = data.readString();
1168 String cls = data.readString();
1169 String action = data.readString();
1170 String indata = data.readString();
1171 startRunning(pkg, cls, action, indata);
1172 reply.writeNoException();
1173 return true;
1174 }
1175
Dan Egnor60d87622009-12-16 16:32:58 -08001176 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1177 data.enforceInterface(IActivityManager.descriptor);
1178 IBinder app = data.readStrongBinder();
1179 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1180 handleApplicationCrash(app, ci);
1181 reply.writeNoException();
1182 return true;
1183 }
1184
1185 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 data.enforceInterface(IActivityManager.descriptor);
1187 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001189 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001190 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001191 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001192 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 return true;
1194 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001195
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001196 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001199 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001200 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1201 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001202 reply.writeNoException();
1203 return true;
1204 }
1205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 int sig = data.readInt();
1209 signalPersistentProcesses(sig);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
Dianne Hackborn03abb812010-01-04 18:43:19 -08001214 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001217 int userId = data.readInt();
1218 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001219 reply.writeNoException();
1220 return true;
1221 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001222
1223 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1224 data.enforceInterface(IActivityManager.descriptor);
1225 killAllBackgroundProcesses();
1226 reply.writeNoException();
1227 return true;
1228 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001229
1230 case FORCE_STOP_PACKAGE_TRANSACTION: {
1231 data.enforceInterface(IActivityManager.descriptor);
1232 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001233 int userId = data.readInt();
1234 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 reply.writeNoException();
1236 return true;
1237 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001238
1239 case GET_MY_MEMORY_STATE_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
1241 ActivityManager.RunningAppProcessInfo info =
1242 new ActivityManager.RunningAppProcessInfo();
1243 getMyMemoryState(info);
1244 reply.writeNoException();
1245 info.writeToParcel(reply, 0);
1246 return true;
1247 }
1248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 ConfigurationInfo config = getDeviceConfigurationInfo();
1252 reply.writeNoException();
1253 config.writeToParcel(reply, 0);
1254 return true;
1255 }
1256
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001257 case PROFILE_CONTROL_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001260 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001261 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001262 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001263 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001264 ParcelFileDescriptor fd = data.readInt() != 0
1265 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001266 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001267 reply.writeNoException();
1268 reply.writeInt(res ? 1 : 0);
1269 return true;
1270 }
1271
Dianne Hackborn55280a92009-05-07 15:53:46 -07001272 case SHUTDOWN_TRANSACTION: {
1273 data.enforceInterface(IActivityManager.descriptor);
1274 boolean res = shutdown(data.readInt());
1275 reply.writeNoException();
1276 reply.writeInt(res ? 1 : 0);
1277 return true;
1278 }
1279
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001280 case STOP_APP_SWITCHES_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 stopAppSwitches();
1283 reply.writeNoException();
1284 return true;
1285 }
1286
1287 case RESUME_APP_SWITCHES_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 resumeAppSwitches();
1290 reply.writeNoException();
1291 return true;
1292 }
1293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 case PEEK_SERVICE_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 Intent service = Intent.CREATOR.createFromParcel(data);
1297 String resolvedType = data.readString();
1298 IBinder binder = peekService(service, resolvedType);
1299 reply.writeNoException();
1300 reply.writeStrongBinder(binder);
1301 return true;
1302 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001303
1304 case START_BACKUP_AGENT_TRANSACTION: {
1305 data.enforceInterface(IActivityManager.descriptor);
1306 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1307 int backupRestoreMode = data.readInt();
1308 boolean success = bindBackupAgent(info, backupRestoreMode);
1309 reply.writeNoException();
1310 reply.writeInt(success ? 1 : 0);
1311 return true;
1312 }
1313
1314 case BACKUP_AGENT_CREATED_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
1316 String packageName = data.readString();
1317 IBinder agent = data.readStrongBinder();
1318 backupAgentCreated(packageName, agent);
1319 reply.writeNoException();
1320 return true;
1321 }
1322
1323 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1326 unbindBackupAgent(info);
1327 reply.writeNoException();
1328 return true;
1329 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001330
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001331 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001332 data.enforceInterface(IActivityManager.descriptor);
1333 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001334 int appid = data.readInt();
1335 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001336 reply.writeNoException();
1337 return true;
1338 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001339
1340 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1341 data.enforceInterface(IActivityManager.descriptor);
1342 String reason = data.readString();
1343 closeSystemDialogs(reason);
1344 reply.writeNoException();
1345 return true;
1346 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001347
1348 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001350 int[] pids = data.createIntArray();
1351 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001352 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001353 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001354 return true;
1355 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001356
1357 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1358 data.enforceInterface(IActivityManager.descriptor);
1359 String processName = data.readString();
1360 int uid = data.readInt();
1361 killApplicationProcess(processName, uid);
1362 reply.writeNoException();
1363 return true;
1364 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001365
1366 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 IBinder token = data.readStrongBinder();
1369 String packageName = data.readString();
1370 int enterAnim = data.readInt();
1371 int exitAnim = data.readInt();
1372 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001373 reply.writeNoException();
1374 return true;
1375 }
1376
1377 case IS_USER_A_MONKEY_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001379 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001380 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001381 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001382 return true;
1383 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001384
1385 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 finishHeavyWeightApp();
1388 reply.writeNoException();
1389 return true;
1390 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001391
1392 case IS_IMMERSIVE_TRANSACTION: {
1393 data.enforceInterface(IActivityManager.descriptor);
1394 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001395 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001396 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001397 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001398 return true;
1399 }
1400
1401 case SET_IMMERSIVE_TRANSACTION: {
1402 data.enforceInterface(IActivityManager.descriptor);
1403 IBinder token = data.readStrongBinder();
1404 boolean imm = data.readInt() == 1;
1405 setImmersive(token, imm);
1406 reply.writeNoException();
1407 return true;
1408 }
1409
1410 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001412 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001413 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001414 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001415 return true;
1416 }
1417
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001418 case CRASH_APPLICATION_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 int uid = data.readInt();
1421 int initialPid = data.readInt();
1422 String packageName = data.readString();
1423 String message = data.readString();
1424 crashApplication(uid, initialPid, packageName, message);
1425 reply.writeNoException();
1426 return true;
1427 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001428
1429 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001432 int userId = data.readInt();
1433 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001434 reply.writeNoException();
1435 reply.writeString(type);
1436 return true;
1437 }
1438
Dianne Hackborn7e269642010-08-25 19:50:20 -07001439 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
1441 String name = data.readString();
1442 IBinder perm = newUriPermissionOwner(name);
1443 reply.writeNoException();
1444 reply.writeStrongBinder(perm);
1445 return true;
1446 }
1447
1448 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1449 data.enforceInterface(IActivityManager.descriptor);
1450 IBinder owner = data.readStrongBinder();
1451 int fromUid = data.readInt();
1452 String targetPkg = data.readString();
1453 Uri uri = Uri.CREATOR.createFromParcel(data);
1454 int mode = data.readInt();
1455 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1456 reply.writeNoException();
1457 return true;
1458 }
1459
1460 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1461 data.enforceInterface(IActivityManager.descriptor);
1462 IBinder owner = data.readStrongBinder();
1463 Uri uri = null;
1464 if (data.readInt() != 0) {
1465 Uri.CREATOR.createFromParcel(data);
1466 }
1467 int mode = data.readInt();
1468 revokeUriPermissionFromOwner(owner, uri, mode);
1469 reply.writeNoException();
1470 return true;
1471 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001472
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001473 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 int callingUid = data.readInt();
1476 String targetPkg = data.readString();
1477 Uri uri = Uri.CREATOR.createFromParcel(data);
1478 int modeFlags = data.readInt();
1479 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1480 reply.writeNoException();
1481 reply.writeInt(res);
1482 return true;
1483 }
1484
Andy McFadden824c5102010-07-09 16:26:57 -07001485 case DUMP_HEAP_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 String process = data.readString();
1488 boolean managed = data.readInt() != 0;
1489 String path = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001490 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001491 ParcelFileDescriptor fd = data.readInt() != 0
1492 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001493 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001494 reply.writeNoException();
1495 reply.writeInt(res ? 1 : 0);
1496 return true;
1497 }
1498
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001499 case START_ACTIVITIES_TRANSACTION:
1500 {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 IBinder b = data.readStrongBinder();
1503 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1504 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1505 String[] resolvedTypes = data.createStringArray();
1506 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001507 Bundle options = data.readInt() != 0
1508 ? Bundle.CREATOR.createFromParcel(data) : null;
1509 int result = startActivities(app, intents, resolvedTypes, resultTo,
1510 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001511 reply.writeNoException();
1512 reply.writeInt(result);
1513 return true;
1514 }
1515
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001516 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1517 {
1518 data.enforceInterface(IActivityManager.descriptor);
1519 int mode = getFrontActivityScreenCompatMode();
1520 reply.writeNoException();
1521 reply.writeInt(mode);
1522 return true;
1523 }
1524
1525 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1526 {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 int mode = data.readInt();
1529 setFrontActivityScreenCompatMode(mode);
1530 reply.writeNoException();
1531 reply.writeInt(mode);
1532 return true;
1533 }
1534
1535 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1536 {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String pkg = data.readString();
1539 int mode = getPackageScreenCompatMode(pkg);
1540 reply.writeNoException();
1541 reply.writeInt(mode);
1542 return true;
1543 }
1544
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001545 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1546 {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001549 int mode = data.readInt();
1550 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001551 reply.writeNoException();
1552 return true;
1553 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001554
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001555 case SWITCH_USER_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 int userid = data.readInt();
1558 boolean result = switchUser(userid);
1559 reply.writeNoException();
1560 reply.writeInt(result ? 1 : 0);
1561 return true;
1562 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001563
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001564 case STOP_USER_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 int userid = data.readInt();
1567 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1568 data.readStrongBinder());
1569 int result = stopUser(userid, callback);
1570 reply.writeNoException();
1571 reply.writeInt(result);
1572 return true;
1573 }
1574
Amith Yamasani52f1d752012-03-28 18:19:29 -07001575 case GET_CURRENT_USER_TRANSACTION: {
1576 data.enforceInterface(IActivityManager.descriptor);
1577 UserInfo userInfo = getCurrentUser();
1578 reply.writeNoException();
1579 userInfo.writeToParcel(reply, 0);
1580 return true;
1581 }
1582
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001583 case IS_USER_RUNNING_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 int userid = data.readInt();
1586 boolean result = isUserRunning(userid);
1587 reply.writeNoException();
1588 reply.writeInt(result ? 1 : 0);
1589 return true;
1590 }
1591
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001592 case REMOVE_SUB_TASK_TRANSACTION:
1593 {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 int taskId = data.readInt();
1596 int subTaskIndex = data.readInt();
1597 boolean result = removeSubTask(taskId, subTaskIndex);
1598 reply.writeNoException();
1599 reply.writeInt(result ? 1 : 0);
1600 return true;
1601 }
1602
1603 case REMOVE_TASK_TRANSACTION:
1604 {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 int taskId = data.readInt();
1607 int fl = data.readInt();
1608 boolean result = removeTask(taskId, fl);
1609 reply.writeNoException();
1610 reply.writeInt(result ? 1 : 0);
1611 return true;
1612 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001613
Jeff Sharkeya4620792011-05-20 15:29:23 -07001614 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1617 data.readStrongBinder());
1618 registerProcessObserver(observer);
1619 return true;
1620 }
1621
1622 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1623 data.enforceInterface(IActivityManager.descriptor);
1624 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1625 data.readStrongBinder());
1626 unregisterProcessObserver(observer);
1627 return true;
1628 }
1629
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001630 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1631 {
1632 data.enforceInterface(IActivityManager.descriptor);
1633 String pkg = data.readString();
1634 boolean ask = getPackageAskScreenCompat(pkg);
1635 reply.writeNoException();
1636 reply.writeInt(ask ? 1 : 0);
1637 return true;
1638 }
1639
1640 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1641 {
1642 data.enforceInterface(IActivityManager.descriptor);
1643 String pkg = data.readString();
1644 boolean ask = data.readInt() != 0;
1645 setPackageAskScreenCompat(pkg, ask);
1646 reply.writeNoException();
1647 return true;
1648 }
1649
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001650 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1651 data.enforceInterface(IActivityManager.descriptor);
1652 IIntentSender r = IIntentSender.Stub.asInterface(
1653 data.readStrongBinder());
1654 boolean res = isIntentSenderTargetedToPackage(r);
1655 reply.writeNoException();
1656 reply.writeInt(res ? 1 : 0);
1657 return true;
1658 }
1659
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001660 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1661 data.enforceInterface(IActivityManager.descriptor);
1662 IIntentSender r = IIntentSender.Stub.asInterface(
1663 data.readStrongBinder());
1664 boolean res = isIntentSenderAnActivity(r);
1665 reply.writeNoException();
1666 reply.writeInt(res ? 1 : 0);
1667 return true;
1668 }
1669
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001670 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1671 data.enforceInterface(IActivityManager.descriptor);
1672 Configuration config = Configuration.CREATOR.createFromParcel(data);
1673 updatePersistentConfiguration(config);
1674 reply.writeNoException();
1675 return true;
1676 }
1677
Dianne Hackbornb437e092011-08-05 17:50:29 -07001678 case GET_PROCESS_PSS_TRANSACTION: {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 int[] pids = data.createIntArray();
1681 long[] pss = getProcessPss(pids);
1682 reply.writeNoException();
1683 reply.writeLongArray(pss);
1684 return true;
1685 }
1686
Dianne Hackborn661cd522011-08-22 00:26:20 -07001687 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1690 boolean always = data.readInt() != 0;
1691 showBootMessage(msg, always);
1692 reply.writeNoException();
1693 return true;
1694 }
1695
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001696 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 dismissKeyguardOnNextActivity();
1699 reply.writeNoException();
1700 return true;
1701 }
1702
Adam Powelldd8fab22012-03-22 17:47:27 -07001703 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1704 data.enforceInterface(IActivityManager.descriptor);
1705 IBinder token = data.readStrongBinder();
1706 String destAffinity = data.readString();
1707 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1708 reply.writeNoException();
1709 reply.writeInt(res ? 1 : 0);
1710 return true;
1711 }
1712
1713 case NAVIGATE_UP_TO_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 IBinder token = data.readStrongBinder();
1716 Intent target = Intent.CREATOR.createFromParcel(data);
1717 int resultCode = data.readInt();
1718 Intent resultData = null;
1719 if (data.readInt() != 0) {
1720 resultData = Intent.CREATOR.createFromParcel(data);
1721 }
1722 boolean res = navigateUpTo(token, target, resultCode, resultData);
1723 reply.writeNoException();
1724 reply.writeInt(res ? 1 : 0);
1725 return true;
1726 }
1727
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001728 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 IBinder token = data.readStrongBinder();
1731 int res = getLaunchedFromUid(token);
1732 reply.writeNoException();
1733 reply.writeInt(res);
1734 return true;
1735 }
1736
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001737 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1738 data.enforceInterface(IActivityManager.descriptor);
1739 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1740 data.readStrongBinder());
1741 registerUserSwitchObserver(observer);
1742 return true;
1743 }
1744
1745 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1746 data.enforceInterface(IActivityManager.descriptor);
1747 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1748 data.readStrongBinder());
1749 unregisterUserSwitchObserver(observer);
1750 return true;
1751 }
1752
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001753 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001754
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001755 return super.onTransact(code, data, reply, flags);
1756 }
1757
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001758 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001759 return this;
1760 }
1761
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001762 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1763 protected IActivityManager create() {
1764 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001765 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001766 Log.v("ActivityManager", "default service binder = " + b);
1767 }
1768 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001769 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001770 Log.v("ActivityManager", "default service = " + am);
1771 }
1772 return am;
1773 }
1774 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001775}
1776
1777class ActivityManagerProxy implements IActivityManager
1778{
1779 public ActivityManagerProxy(IBinder remote)
1780 {
1781 mRemote = remote;
1782 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001783
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001784 public IBinder asBinder()
1785 {
1786 return mRemote;
1787 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001788
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001789 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001790 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1791 int startFlags, String profileFile,
1792 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001793 Parcel data = Parcel.obtain();
1794 Parcel reply = Parcel.obtain();
1795 data.writeInterfaceToken(IActivityManager.descriptor);
1796 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1797 intent.writeToParcel(data, 0);
1798 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001799 data.writeStrongBinder(resultTo);
1800 data.writeString(resultWho);
1801 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001802 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001803 data.writeString(profileFile);
1804 if (profileFd != null) {
1805 data.writeInt(1);
1806 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1807 } else {
1808 data.writeInt(0);
1809 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001810 if (options != null) {
1811 data.writeInt(1);
1812 options.writeToParcel(data, 0);
1813 } else {
1814 data.writeInt(0);
1815 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001816 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1817 reply.readException();
1818 int result = reply.readInt();
1819 reply.recycle();
1820 data.recycle();
1821 return result;
1822 }
Amith Yamasani82644082012-08-03 13:09:11 -07001823
1824 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1825 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1826 int startFlags, String profileFile,
1827 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1828 Parcel data = Parcel.obtain();
1829 Parcel reply = Parcel.obtain();
1830 data.writeInterfaceToken(IActivityManager.descriptor);
1831 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1832 intent.writeToParcel(data, 0);
1833 data.writeString(resolvedType);
1834 data.writeStrongBinder(resultTo);
1835 data.writeString(resultWho);
1836 data.writeInt(requestCode);
1837 data.writeInt(startFlags);
1838 data.writeString(profileFile);
1839 if (profileFd != null) {
1840 data.writeInt(1);
1841 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1842 } else {
1843 data.writeInt(0);
1844 }
1845 if (options != null) {
1846 data.writeInt(1);
1847 options.writeToParcel(data, 0);
1848 } else {
1849 data.writeInt(0);
1850 }
1851 data.writeInt(userId);
1852 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1853 reply.readException();
1854 int result = reply.readInt();
1855 reply.recycle();
1856 data.recycle();
1857 return result;
1858 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001859 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001860 String resolvedType, IBinder resultTo, String resultWho,
1861 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001862 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001863 Parcel data = Parcel.obtain();
1864 Parcel reply = Parcel.obtain();
1865 data.writeInterfaceToken(IActivityManager.descriptor);
1866 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1867 intent.writeToParcel(data, 0);
1868 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001869 data.writeStrongBinder(resultTo);
1870 data.writeString(resultWho);
1871 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001872 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001873 data.writeString(profileFile);
1874 if (profileFd != null) {
1875 data.writeInt(1);
1876 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1877 } else {
1878 data.writeInt(0);
1879 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001880 if (options != null) {
1881 data.writeInt(1);
1882 options.writeToParcel(data, 0);
1883 } else {
1884 data.writeInt(0);
1885 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001886 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001887 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1888 reply.readException();
1889 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1890 reply.recycle();
1891 data.recycle();
1892 return result;
1893 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001894 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001895 String resolvedType, IBinder resultTo, String resultWho,
1896 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001897 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001898 Parcel data = Parcel.obtain();
1899 Parcel reply = Parcel.obtain();
1900 data.writeInterfaceToken(IActivityManager.descriptor);
1901 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1902 intent.writeToParcel(data, 0);
1903 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001904 data.writeStrongBinder(resultTo);
1905 data.writeString(resultWho);
1906 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001907 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001908 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001909 if (options != null) {
1910 data.writeInt(1);
1911 options.writeToParcel(data, 0);
1912 } else {
1913 data.writeInt(0);
1914 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001915 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001916 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1917 reply.readException();
1918 int result = reply.readInt();
1919 reply.recycle();
1920 data.recycle();
1921 return result;
1922 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001923 public int startActivityIntentSender(IApplicationThread caller,
1924 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001925 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001926 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001927 Parcel data = Parcel.obtain();
1928 Parcel reply = Parcel.obtain();
1929 data.writeInterfaceToken(IActivityManager.descriptor);
1930 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1931 intent.writeToParcel(data, 0);
1932 if (fillInIntent != null) {
1933 data.writeInt(1);
1934 fillInIntent.writeToParcel(data, 0);
1935 } else {
1936 data.writeInt(0);
1937 }
1938 data.writeString(resolvedType);
1939 data.writeStrongBinder(resultTo);
1940 data.writeString(resultWho);
1941 data.writeInt(requestCode);
1942 data.writeInt(flagsMask);
1943 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001944 if (options != null) {
1945 data.writeInt(1);
1946 options.writeToParcel(data, 0);
1947 } else {
1948 data.writeInt(0);
1949 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001950 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001951 reply.readException();
1952 int result = reply.readInt();
1953 reply.recycle();
1954 data.recycle();
1955 return result;
1956 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001957 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001958 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001959 Parcel data = Parcel.obtain();
1960 Parcel reply = Parcel.obtain();
1961 data.writeInterfaceToken(IActivityManager.descriptor);
1962 data.writeStrongBinder(callingActivity);
1963 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001964 if (options != null) {
1965 data.writeInt(1);
1966 options.writeToParcel(data, 0);
1967 } else {
1968 data.writeInt(0);
1969 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001970 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1971 reply.readException();
1972 int result = reply.readInt();
1973 reply.recycle();
1974 data.recycle();
1975 return result != 0;
1976 }
1977 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1978 throws RemoteException {
1979 Parcel data = Parcel.obtain();
1980 Parcel reply = Parcel.obtain();
1981 data.writeInterfaceToken(IActivityManager.descriptor);
1982 data.writeStrongBinder(token);
1983 data.writeInt(resultCode);
1984 if (resultData != null) {
1985 data.writeInt(1);
1986 resultData.writeToParcel(data, 0);
1987 } else {
1988 data.writeInt(0);
1989 }
1990 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1991 reply.readException();
1992 boolean res = reply.readInt() != 0;
1993 data.recycle();
1994 reply.recycle();
1995 return res;
1996 }
1997 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1998 {
1999 Parcel data = Parcel.obtain();
2000 Parcel reply = Parcel.obtain();
2001 data.writeInterfaceToken(IActivityManager.descriptor);
2002 data.writeStrongBinder(token);
2003 data.writeString(resultWho);
2004 data.writeInt(requestCode);
2005 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2006 reply.readException();
2007 data.recycle();
2008 reply.recycle();
2009 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002010 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2011 Parcel data = Parcel.obtain();
2012 Parcel reply = Parcel.obtain();
2013 data.writeInterfaceToken(IActivityManager.descriptor);
2014 data.writeStrongBinder(token);
2015 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2016 reply.readException();
2017 boolean res = reply.readInt() != 0;
2018 data.recycle();
2019 reply.recycle();
2020 return res;
2021 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002022 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2023 Parcel data = Parcel.obtain();
2024 Parcel reply = Parcel.obtain();
2025 data.writeInterfaceToken(IActivityManager.descriptor);
2026 data.writeStrongBinder(token);
2027 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2028 reply.readException();
2029 boolean res = reply.readInt() != 0;
2030 data.recycle();
2031 reply.recycle();
2032 return res;
2033 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002034 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002035 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002036 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002037 {
2038 Parcel data = Parcel.obtain();
2039 Parcel reply = Parcel.obtain();
2040 data.writeInterfaceToken(IActivityManager.descriptor);
2041 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002042 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002043 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2044 filter.writeToParcel(data, 0);
2045 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002046 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002047 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2048 reply.readException();
2049 Intent intent = null;
2050 int haveIntent = reply.readInt();
2051 if (haveIntent != 0) {
2052 intent = Intent.CREATOR.createFromParcel(reply);
2053 }
2054 reply.recycle();
2055 data.recycle();
2056 return intent;
2057 }
2058 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2059 {
2060 Parcel data = Parcel.obtain();
2061 Parcel reply = Parcel.obtain();
2062 data.writeInterfaceToken(IActivityManager.descriptor);
2063 data.writeStrongBinder(receiver.asBinder());
2064 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2065 reply.readException();
2066 data.recycle();
2067 reply.recycle();
2068 }
2069 public int broadcastIntent(IApplicationThread caller,
2070 Intent intent, String resolvedType, IIntentReceiver resultTo,
2071 int resultCode, String resultData, Bundle map,
2072 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002073 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002074 {
2075 Parcel data = Parcel.obtain();
2076 Parcel reply = Parcel.obtain();
2077 data.writeInterfaceToken(IActivityManager.descriptor);
2078 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2079 intent.writeToParcel(data, 0);
2080 data.writeString(resolvedType);
2081 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2082 data.writeInt(resultCode);
2083 data.writeString(resultData);
2084 data.writeBundle(map);
2085 data.writeString(requiredPermission);
2086 data.writeInt(serialized ? 1 : 0);
2087 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002088 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002089 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2090 reply.readException();
2091 int res = reply.readInt();
2092 reply.recycle();
2093 data.recycle();
2094 return res;
2095 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002096 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2097 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002098 {
2099 Parcel data = Parcel.obtain();
2100 Parcel reply = Parcel.obtain();
2101 data.writeInterfaceToken(IActivityManager.descriptor);
2102 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2103 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002104 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002105 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2106 reply.readException();
2107 data.recycle();
2108 reply.recycle();
2109 }
2110 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2111 {
2112 Parcel data = Parcel.obtain();
2113 Parcel reply = Parcel.obtain();
2114 data.writeInterfaceToken(IActivityManager.descriptor);
2115 data.writeStrongBinder(who);
2116 data.writeInt(resultCode);
2117 data.writeString(resultData);
2118 data.writeBundle(map);
2119 data.writeInt(abortBroadcast ? 1 : 0);
2120 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2121 reply.readException();
2122 data.recycle();
2123 reply.recycle();
2124 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002125 public void attachApplication(IApplicationThread app) throws RemoteException
2126 {
2127 Parcel data = Parcel.obtain();
2128 Parcel reply = Parcel.obtain();
2129 data.writeInterfaceToken(IActivityManager.descriptor);
2130 data.writeStrongBinder(app.asBinder());
2131 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2132 reply.readException();
2133 data.recycle();
2134 reply.recycle();
2135 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002136 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2137 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002138 {
2139 Parcel data = Parcel.obtain();
2140 Parcel reply = Parcel.obtain();
2141 data.writeInterfaceToken(IActivityManager.descriptor);
2142 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002143 if (config != null) {
2144 data.writeInt(1);
2145 config.writeToParcel(data, 0);
2146 } else {
2147 data.writeInt(0);
2148 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002149 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2151 reply.readException();
2152 data.recycle();
2153 reply.recycle();
2154 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002155 public void activityPaused(IBinder token) throws RemoteException
2156 {
2157 Parcel data = Parcel.obtain();
2158 Parcel reply = Parcel.obtain();
2159 data.writeInterfaceToken(IActivityManager.descriptor);
2160 data.writeStrongBinder(token);
2161 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2162 reply.readException();
2163 data.recycle();
2164 reply.recycle();
2165 }
2166 public void activityStopped(IBinder token, Bundle state,
2167 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002168 {
2169 Parcel data = Parcel.obtain();
2170 Parcel reply = Parcel.obtain();
2171 data.writeInterfaceToken(IActivityManager.descriptor);
2172 data.writeStrongBinder(token);
2173 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 if (thumbnail != null) {
2175 data.writeInt(1);
2176 thumbnail.writeToParcel(data, 0);
2177 } else {
2178 data.writeInt(0);
2179 }
2180 TextUtils.writeToParcel(description, data, 0);
2181 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2182 reply.readException();
2183 data.recycle();
2184 reply.recycle();
2185 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002186 public void activitySlept(IBinder token) throws RemoteException
2187 {
2188 Parcel data = Parcel.obtain();
2189 Parcel reply = Parcel.obtain();
2190 data.writeInterfaceToken(IActivityManager.descriptor);
2191 data.writeStrongBinder(token);
2192 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2193 reply.readException();
2194 data.recycle();
2195 reply.recycle();
2196 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002197 public void activityDestroyed(IBinder token) throws RemoteException
2198 {
2199 Parcel data = Parcel.obtain();
2200 Parcel reply = Parcel.obtain();
2201 data.writeInterfaceToken(IActivityManager.descriptor);
2202 data.writeStrongBinder(token);
2203 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2204 reply.readException();
2205 data.recycle();
2206 reply.recycle();
2207 }
2208 public String getCallingPackage(IBinder token) throws RemoteException
2209 {
2210 Parcel data = Parcel.obtain();
2211 Parcel reply = Parcel.obtain();
2212 data.writeInterfaceToken(IActivityManager.descriptor);
2213 data.writeStrongBinder(token);
2214 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 String res = reply.readString();
2217 data.recycle();
2218 reply.recycle();
2219 return res;
2220 }
2221 public ComponentName getCallingActivity(IBinder token)
2222 throws RemoteException {
2223 Parcel data = Parcel.obtain();
2224 Parcel reply = Parcel.obtain();
2225 data.writeInterfaceToken(IActivityManager.descriptor);
2226 data.writeStrongBinder(token);
2227 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2228 reply.readException();
2229 ComponentName res = ComponentName.readFromParcel(reply);
2230 data.recycle();
2231 reply.recycle();
2232 return res;
2233 }
2234 public List getTasks(int maxNum, int flags,
2235 IThumbnailReceiver receiver) throws RemoteException {
2236 Parcel data = Parcel.obtain();
2237 Parcel reply = Parcel.obtain();
2238 data.writeInterfaceToken(IActivityManager.descriptor);
2239 data.writeInt(maxNum);
2240 data.writeInt(flags);
2241 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2242 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2243 reply.readException();
2244 ArrayList list = null;
2245 int N = reply.readInt();
2246 if (N >= 0) {
2247 list = new ArrayList();
2248 while (N > 0) {
2249 ActivityManager.RunningTaskInfo info =
2250 ActivityManager.RunningTaskInfo.CREATOR
2251 .createFromParcel(reply);
2252 list.add(info);
2253 N--;
2254 }
2255 }
2256 data.recycle();
2257 reply.recycle();
2258 return list;
2259 }
2260 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002261 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002262 Parcel data = Parcel.obtain();
2263 Parcel reply = Parcel.obtain();
2264 data.writeInterfaceToken(IActivityManager.descriptor);
2265 data.writeInt(maxNum);
2266 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002267 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002268 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2269 reply.readException();
2270 ArrayList<ActivityManager.RecentTaskInfo> list
2271 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2272 data.recycle();
2273 reply.recycle();
2274 return list;
2275 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002276 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002277 Parcel data = Parcel.obtain();
2278 Parcel reply = Parcel.obtain();
2279 data.writeInterfaceToken(IActivityManager.descriptor);
2280 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002281 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002282 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002283 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002284 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002285 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002286 }
2287 data.recycle();
2288 reply.recycle();
2289 return bm;
2290 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002291 public List getServices(int maxNum, int flags) throws RemoteException {
2292 Parcel data = Parcel.obtain();
2293 Parcel reply = Parcel.obtain();
2294 data.writeInterfaceToken(IActivityManager.descriptor);
2295 data.writeInt(maxNum);
2296 data.writeInt(flags);
2297 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2298 reply.readException();
2299 ArrayList list = null;
2300 int N = reply.readInt();
2301 if (N >= 0) {
2302 list = new ArrayList();
2303 while (N > 0) {
2304 ActivityManager.RunningServiceInfo info =
2305 ActivityManager.RunningServiceInfo.CREATOR
2306 .createFromParcel(reply);
2307 list.add(info);
2308 N--;
2309 }
2310 }
2311 data.recycle();
2312 reply.recycle();
2313 return list;
2314 }
2315 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2316 throws RemoteException {
2317 Parcel data = Parcel.obtain();
2318 Parcel reply = Parcel.obtain();
2319 data.writeInterfaceToken(IActivityManager.descriptor);
2320 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2321 reply.readException();
2322 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2323 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2324 data.recycle();
2325 reply.recycle();
2326 return list;
2327 }
2328 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2329 throws RemoteException {
2330 Parcel data = Parcel.obtain();
2331 Parcel reply = Parcel.obtain();
2332 data.writeInterfaceToken(IActivityManager.descriptor);
2333 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2334 reply.readException();
2335 ArrayList<ActivityManager.RunningAppProcessInfo> list
2336 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2337 data.recycle();
2338 reply.recycle();
2339 return list;
2340 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002341 public List<ApplicationInfo> getRunningExternalApplications()
2342 throws RemoteException {
2343 Parcel data = Parcel.obtain();
2344 Parcel reply = Parcel.obtain();
2345 data.writeInterfaceToken(IActivityManager.descriptor);
2346 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2347 reply.readException();
2348 ArrayList<ApplicationInfo> list
2349 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2350 data.recycle();
2351 reply.recycle();
2352 return list;
2353 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002354 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002355 {
2356 Parcel data = Parcel.obtain();
2357 Parcel reply = Parcel.obtain();
2358 data.writeInterfaceToken(IActivityManager.descriptor);
2359 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002360 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002361 if (options != null) {
2362 data.writeInt(1);
2363 options.writeToParcel(data, 0);
2364 } else {
2365 data.writeInt(0);
2366 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2368 reply.readException();
2369 data.recycle();
2370 reply.recycle();
2371 }
2372 public void moveTaskToBack(int task) throws RemoteException
2373 {
2374 Parcel data = Parcel.obtain();
2375 Parcel reply = Parcel.obtain();
2376 data.writeInterfaceToken(IActivityManager.descriptor);
2377 data.writeInt(task);
2378 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2379 reply.readException();
2380 data.recycle();
2381 reply.recycle();
2382 }
2383 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2384 throws RemoteException {
2385 Parcel data = Parcel.obtain();
2386 Parcel reply = Parcel.obtain();
2387 data.writeInterfaceToken(IActivityManager.descriptor);
2388 data.writeStrongBinder(token);
2389 data.writeInt(nonRoot ? 1 : 0);
2390 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2391 reply.readException();
2392 boolean res = reply.readInt() != 0;
2393 data.recycle();
2394 reply.recycle();
2395 return res;
2396 }
2397 public void moveTaskBackwards(int task) throws RemoteException
2398 {
2399 Parcel data = Parcel.obtain();
2400 Parcel reply = Parcel.obtain();
2401 data.writeInterfaceToken(IActivityManager.descriptor);
2402 data.writeInt(task);
2403 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2404 reply.readException();
2405 data.recycle();
2406 reply.recycle();
2407 }
2408 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2409 {
2410 Parcel data = Parcel.obtain();
2411 Parcel reply = Parcel.obtain();
2412 data.writeInterfaceToken(IActivityManager.descriptor);
2413 data.writeStrongBinder(token);
2414 data.writeInt(onlyRoot ? 1 : 0);
2415 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2416 reply.readException();
2417 int res = reply.readInt();
2418 data.recycle();
2419 reply.recycle();
2420 return res;
2421 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002422 public void reportThumbnail(IBinder token,
2423 Bitmap thumbnail, CharSequence description) throws RemoteException
2424 {
2425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 data.writeStrongBinder(token);
2429 if (thumbnail != null) {
2430 data.writeInt(1);
2431 thumbnail.writeToParcel(data, 0);
2432 } else {
2433 data.writeInt(0);
2434 }
2435 TextUtils.writeToParcel(description, data, 0);
2436 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2437 reply.readException();
2438 data.recycle();
2439 reply.recycle();
2440 }
2441 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002442 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002443 Parcel data = Parcel.obtain();
2444 Parcel reply = Parcel.obtain();
2445 data.writeInterfaceToken(IActivityManager.descriptor);
2446 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2447 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002448 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002449 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2450 reply.readException();
2451 int res = reply.readInt();
2452 ContentProviderHolder cph = null;
2453 if (res != 0) {
2454 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2455 }
2456 data.recycle();
2457 reply.recycle();
2458 return cph;
2459 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002460 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2461 throws RemoteException
2462 {
2463 Parcel data = Parcel.obtain();
2464 Parcel reply = Parcel.obtain();
2465 data.writeInterfaceToken(IActivityManager.descriptor);
2466 data.writeString(name);
2467 data.writeStrongBinder(token);
2468 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2469 reply.readException();
2470 int res = reply.readInt();
2471 ContentProviderHolder cph = null;
2472 if (res != 0) {
2473 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2474 }
2475 data.recycle();
2476 reply.recycle();
2477 return cph;
2478 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002479 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002480 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002481 {
2482 Parcel data = Parcel.obtain();
2483 Parcel reply = Parcel.obtain();
2484 data.writeInterfaceToken(IActivityManager.descriptor);
2485 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2486 data.writeTypedList(providers);
2487 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2488 reply.readException();
2489 data.recycle();
2490 reply.recycle();
2491 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002492 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2493 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002494 Parcel data = Parcel.obtain();
2495 Parcel reply = Parcel.obtain();
2496 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002497 data.writeStrongBinder(connection);
2498 data.writeInt(stable);
2499 data.writeInt(unstable);
2500 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2501 reply.readException();
2502 boolean res = reply.readInt() != 0;
2503 data.recycle();
2504 reply.recycle();
2505 return res;
2506 }
2507 public void unstableProviderDied(IBinder connection) throws RemoteException {
2508 Parcel data = Parcel.obtain();
2509 Parcel reply = Parcel.obtain();
2510 data.writeInterfaceToken(IActivityManager.descriptor);
2511 data.writeStrongBinder(connection);
2512 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2513 reply.readException();
2514 data.recycle();
2515 reply.recycle();
2516 }
2517
2518 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2519 Parcel data = Parcel.obtain();
2520 Parcel reply = Parcel.obtain();
2521 data.writeInterfaceToken(IActivityManager.descriptor);
2522 data.writeStrongBinder(connection);
2523 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002524 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2525 reply.readException();
2526 data.recycle();
2527 reply.recycle();
2528 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002529
2530 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2531 Parcel data = Parcel.obtain();
2532 Parcel reply = Parcel.obtain();
2533 data.writeInterfaceToken(IActivityManager.descriptor);
2534 data.writeString(name);
2535 data.writeStrongBinder(token);
2536 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2537 reply.readException();
2538 data.recycle();
2539 reply.recycle();
2540 }
2541
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002542 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2543 throws RemoteException
2544 {
2545 Parcel data = Parcel.obtain();
2546 Parcel reply = Parcel.obtain();
2547 data.writeInterfaceToken(IActivityManager.descriptor);
2548 service.writeToParcel(data, 0);
2549 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2550 reply.readException();
2551 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2552 data.recycle();
2553 reply.recycle();
2554 return res;
2555 }
2556
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002557 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002558 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002559 {
2560 Parcel data = Parcel.obtain();
2561 Parcel reply = Parcel.obtain();
2562 data.writeInterfaceToken(IActivityManager.descriptor);
2563 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2564 service.writeToParcel(data, 0);
2565 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002566 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002567 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 ComponentName res = ComponentName.readFromParcel(reply);
2570 data.recycle();
2571 reply.recycle();
2572 return res;
2573 }
2574 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002575 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002576 {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2581 service.writeToParcel(data, 0);
2582 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002583 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002584 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 int res = reply.readInt();
2587 reply.recycle();
2588 data.recycle();
2589 return res;
2590 }
2591 public boolean stopServiceToken(ComponentName className, IBinder token,
2592 int startId) throws RemoteException {
2593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 ComponentName.writeToParcel(className, data);
2597 data.writeStrongBinder(token);
2598 data.writeInt(startId);
2599 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2600 reply.readException();
2601 boolean res = reply.readInt() != 0;
2602 data.recycle();
2603 reply.recycle();
2604 return res;
2605 }
2606 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002607 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002608 Parcel data = Parcel.obtain();
2609 Parcel reply = Parcel.obtain();
2610 data.writeInterfaceToken(IActivityManager.descriptor);
2611 ComponentName.writeToParcel(className, data);
2612 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002613 data.writeInt(id);
2614 if (notification != null) {
2615 data.writeInt(1);
2616 notification.writeToParcel(data, 0);
2617 } else {
2618 data.writeInt(0);
2619 }
2620 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002621 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2622 reply.readException();
2623 data.recycle();
2624 reply.recycle();
2625 }
2626 public int bindService(IApplicationThread caller, IBinder token,
2627 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002628 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002629 Parcel data = Parcel.obtain();
2630 Parcel reply = Parcel.obtain();
2631 data.writeInterfaceToken(IActivityManager.descriptor);
2632 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2633 data.writeStrongBinder(token);
2634 service.writeToParcel(data, 0);
2635 data.writeString(resolvedType);
2636 data.writeStrongBinder(connection.asBinder());
2637 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002638 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2640 reply.readException();
2641 int res = reply.readInt();
2642 data.recycle();
2643 reply.recycle();
2644 return res;
2645 }
2646 public boolean unbindService(IServiceConnection connection) throws RemoteException
2647 {
2648 Parcel data = Parcel.obtain();
2649 Parcel reply = Parcel.obtain();
2650 data.writeInterfaceToken(IActivityManager.descriptor);
2651 data.writeStrongBinder(connection.asBinder());
2652 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2653 reply.readException();
2654 boolean res = reply.readInt() != 0;
2655 data.recycle();
2656 reply.recycle();
2657 return res;
2658 }
2659
2660 public void publishService(IBinder token,
2661 Intent intent, IBinder service) throws RemoteException {
2662 Parcel data = Parcel.obtain();
2663 Parcel reply = Parcel.obtain();
2664 data.writeInterfaceToken(IActivityManager.descriptor);
2665 data.writeStrongBinder(token);
2666 intent.writeToParcel(data, 0);
2667 data.writeStrongBinder(service);
2668 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2669 reply.readException();
2670 data.recycle();
2671 reply.recycle();
2672 }
2673
2674 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2675 throws RemoteException {
2676 Parcel data = Parcel.obtain();
2677 Parcel reply = Parcel.obtain();
2678 data.writeInterfaceToken(IActivityManager.descriptor);
2679 data.writeStrongBinder(token);
2680 intent.writeToParcel(data, 0);
2681 data.writeInt(doRebind ? 1 : 0);
2682 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2683 reply.readException();
2684 data.recycle();
2685 reply.recycle();
2686 }
2687
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002688 public void serviceDoneExecuting(IBinder token, int type, int startId,
2689 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002694 data.writeInt(type);
2695 data.writeInt(startId);
2696 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002697 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2698 reply.readException();
2699 data.recycle();
2700 reply.recycle();
2701 }
2702
2703 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2704 Parcel data = Parcel.obtain();
2705 Parcel reply = Parcel.obtain();
2706 data.writeInterfaceToken(IActivityManager.descriptor);
2707 service.writeToParcel(data, 0);
2708 data.writeString(resolvedType);
2709 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2710 reply.readException();
2711 IBinder binder = reply.readStrongBinder();
2712 reply.recycle();
2713 data.recycle();
2714 return binder;
2715 }
2716
Christopher Tate181fafa2009-05-14 11:12:14 -07002717 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2718 throws RemoteException {
2719 Parcel data = Parcel.obtain();
2720 Parcel reply = Parcel.obtain();
2721 data.writeInterfaceToken(IActivityManager.descriptor);
2722 app.writeToParcel(data, 0);
2723 data.writeInt(backupRestoreMode);
2724 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2725 reply.readException();
2726 boolean success = reply.readInt() != 0;
2727 reply.recycle();
2728 data.recycle();
2729 return success;
2730 }
2731
2732 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2733 Parcel data = Parcel.obtain();
2734 Parcel reply = Parcel.obtain();
2735 data.writeInterfaceToken(IActivityManager.descriptor);
2736 data.writeString(packageName);
2737 data.writeStrongBinder(agent);
2738 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2739 reply.recycle();
2740 data.recycle();
2741 }
2742
2743 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2744 Parcel data = Parcel.obtain();
2745 Parcel reply = Parcel.obtain();
2746 data.writeInterfaceToken(IActivityManager.descriptor);
2747 app.writeToParcel(data, 0);
2748 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 reply.recycle();
2751 data.recycle();
2752 }
2753
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002754 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002755 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002756 throws RemoteException {
2757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 ComponentName.writeToParcel(className, data);
2761 data.writeString(profileFile);
2762 data.writeInt(flags);
2763 data.writeBundle(arguments);
2764 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002765 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002766 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2767 reply.readException();
2768 boolean res = reply.readInt() != 0;
2769 reply.recycle();
2770 data.recycle();
2771 return res;
2772 }
2773
2774 public void finishInstrumentation(IApplicationThread target,
2775 int resultCode, Bundle results) throws RemoteException {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
2779 data.writeStrongBinder(target != null ? target.asBinder() : null);
2780 data.writeInt(resultCode);
2781 data.writeBundle(results);
2782 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2783 reply.readException();
2784 data.recycle();
2785 reply.recycle();
2786 }
2787 public Configuration getConfiguration() throws RemoteException
2788 {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
2792 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2793 reply.readException();
2794 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2795 reply.recycle();
2796 data.recycle();
2797 return res;
2798 }
2799 public void updateConfiguration(Configuration values) throws RemoteException
2800 {
2801 Parcel data = Parcel.obtain();
2802 Parcel reply = Parcel.obtain();
2803 data.writeInterfaceToken(IActivityManager.descriptor);
2804 values.writeToParcel(data, 0);
2805 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2806 reply.readException();
2807 data.recycle();
2808 reply.recycle();
2809 }
2810 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2811 throws RemoteException {
2812 Parcel data = Parcel.obtain();
2813 Parcel reply = Parcel.obtain();
2814 data.writeInterfaceToken(IActivityManager.descriptor);
2815 data.writeStrongBinder(token);
2816 data.writeInt(requestedOrientation);
2817 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2818 reply.readException();
2819 data.recycle();
2820 reply.recycle();
2821 }
2822 public int getRequestedOrientation(IBinder token) throws RemoteException {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeStrongBinder(token);
2827 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 int res = reply.readInt();
2830 data.recycle();
2831 reply.recycle();
2832 return res;
2833 }
2834 public ComponentName getActivityClassForToken(IBinder token)
2835 throws RemoteException {
2836 Parcel data = Parcel.obtain();
2837 Parcel reply = Parcel.obtain();
2838 data.writeInterfaceToken(IActivityManager.descriptor);
2839 data.writeStrongBinder(token);
2840 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2841 reply.readException();
2842 ComponentName res = ComponentName.readFromParcel(reply);
2843 data.recycle();
2844 reply.recycle();
2845 return res;
2846 }
2847 public String getPackageForToken(IBinder token) throws RemoteException
2848 {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeStrongBinder(token);
2853 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 String res = reply.readString();
2856 data.recycle();
2857 reply.recycle();
2858 return res;
2859 }
2860 public IIntentSender getIntentSender(int type,
2861 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002862 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002863 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002864 Parcel data = Parcel.obtain();
2865 Parcel reply = Parcel.obtain();
2866 data.writeInterfaceToken(IActivityManager.descriptor);
2867 data.writeInt(type);
2868 data.writeString(packageName);
2869 data.writeStrongBinder(token);
2870 data.writeString(resultWho);
2871 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002872 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002873 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002874 data.writeTypedArray(intents, 0);
2875 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002876 } else {
2877 data.writeInt(0);
2878 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002879 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002880 if (options != null) {
2881 data.writeInt(1);
2882 options.writeToParcel(data, 0);
2883 } else {
2884 data.writeInt(0);
2885 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002886 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002887 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2888 reply.readException();
2889 IIntentSender res = IIntentSender.Stub.asInterface(
2890 reply.readStrongBinder());
2891 data.recycle();
2892 reply.recycle();
2893 return res;
2894 }
2895 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeStrongBinder(sender.asBinder());
2900 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 data.recycle();
2903 reply.recycle();
2904 }
2905 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2906 Parcel data = Parcel.obtain();
2907 Parcel reply = Parcel.obtain();
2908 data.writeInterfaceToken(IActivityManager.descriptor);
2909 data.writeStrongBinder(sender.asBinder());
2910 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2911 reply.readException();
2912 String res = reply.readString();
2913 data.recycle();
2914 reply.recycle();
2915 return res;
2916 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002917 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeStrongBinder(sender.asBinder());
2922 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2923 reply.readException();
2924 int res = reply.readInt();
2925 data.recycle();
2926 reply.recycle();
2927 return res;
2928 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002929 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2930 boolean requireFull, String name, String callerPackage) throws RemoteException {
2931 Parcel data = Parcel.obtain();
2932 Parcel reply = Parcel.obtain();
2933 data.writeInterfaceToken(IActivityManager.descriptor);
2934 data.writeInt(callingPid);
2935 data.writeInt(callingUid);
2936 data.writeInt(userId);
2937 data.writeInt(allowAll ? 1 : 0);
2938 data.writeInt(requireFull ? 1 : 0);
2939 data.writeString(name);
2940 data.writeString(callerPackage);
2941 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
2942 reply.readException();
2943 int res = reply.readInt();
2944 data.recycle();
2945 reply.recycle();
2946 return res;
2947 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002948 public void setProcessLimit(int max) throws RemoteException
2949 {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeInt(max);
2954 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2955 reply.readException();
2956 data.recycle();
2957 reply.recycle();
2958 }
2959 public int getProcessLimit() throws RemoteException
2960 {
2961 Parcel data = Parcel.obtain();
2962 Parcel reply = Parcel.obtain();
2963 data.writeInterfaceToken(IActivityManager.descriptor);
2964 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2965 reply.readException();
2966 int res = reply.readInt();
2967 data.recycle();
2968 reply.recycle();
2969 return res;
2970 }
2971 public void setProcessForeground(IBinder token, int pid,
2972 boolean isForeground) throws RemoteException {
2973 Parcel data = Parcel.obtain();
2974 Parcel reply = Parcel.obtain();
2975 data.writeInterfaceToken(IActivityManager.descriptor);
2976 data.writeStrongBinder(token);
2977 data.writeInt(pid);
2978 data.writeInt(isForeground ? 1 : 0);
2979 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2980 reply.readException();
2981 data.recycle();
2982 reply.recycle();
2983 }
2984 public int checkPermission(String permission, int pid, int uid)
2985 throws RemoteException {
2986 Parcel data = Parcel.obtain();
2987 Parcel reply = Parcel.obtain();
2988 data.writeInterfaceToken(IActivityManager.descriptor);
2989 data.writeString(permission);
2990 data.writeInt(pid);
2991 data.writeInt(uid);
2992 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 int res = reply.readInt();
2995 data.recycle();
2996 reply.recycle();
2997 return res;
2998 }
2999 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003000 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 data.writeString(packageName);
3005 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003006 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3008 reply.readException();
3009 boolean res = reply.readInt() != 0;
3010 data.recycle();
3011 reply.recycle();
3012 return res;
3013 }
3014 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3015 throws RemoteException {
3016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
3019 uri.writeToParcel(data, 0);
3020 data.writeInt(pid);
3021 data.writeInt(uid);
3022 data.writeInt(mode);
3023 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3024 reply.readException();
3025 int res = reply.readInt();
3026 data.recycle();
3027 reply.recycle();
3028 return res;
3029 }
3030 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3031 Uri uri, int mode) throws RemoteException {
3032 Parcel data = Parcel.obtain();
3033 Parcel reply = Parcel.obtain();
3034 data.writeInterfaceToken(IActivityManager.descriptor);
3035 data.writeStrongBinder(caller.asBinder());
3036 data.writeString(targetPkg);
3037 uri.writeToParcel(data, 0);
3038 data.writeInt(mode);
3039 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 data.recycle();
3042 reply.recycle();
3043 }
3044 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3045 int mode) throws RemoteException {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 data.writeStrongBinder(caller.asBinder());
3050 uri.writeToParcel(data, 0);
3051 data.writeInt(mode);
3052 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 data.recycle();
3055 reply.recycle();
3056 }
3057 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3058 throws RemoteException {
3059 Parcel data = Parcel.obtain();
3060 Parcel reply = Parcel.obtain();
3061 data.writeInterfaceToken(IActivityManager.descriptor);
3062 data.writeStrongBinder(who.asBinder());
3063 data.writeInt(waiting ? 1 : 0);
3064 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3065 reply.readException();
3066 data.recycle();
3067 reply.recycle();
3068 }
3069 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3074 reply.readException();
3075 outInfo.readFromParcel(reply);
3076 data.recycle();
3077 reply.recycle();
3078 }
3079 public void unhandledBack() throws RemoteException
3080 {
3081 Parcel data = Parcel.obtain();
3082 Parcel reply = Parcel.obtain();
3083 data.writeInterfaceToken(IActivityManager.descriptor);
3084 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 data.recycle();
3087 reply.recycle();
3088 }
3089 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3090 {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3095 reply.readException();
3096 ParcelFileDescriptor pfd = null;
3097 if (reply.readInt() != 0) {
3098 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3099 }
3100 data.recycle();
3101 reply.recycle();
3102 return pfd;
3103 }
3104 public void goingToSleep() throws RemoteException
3105 {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3110 reply.readException();
3111 data.recycle();
3112 reply.recycle();
3113 }
3114 public void wakingUp() throws RemoteException
3115 {
3116 Parcel data = Parcel.obtain();
3117 Parcel reply = Parcel.obtain();
3118 data.writeInterfaceToken(IActivityManager.descriptor);
3119 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3120 reply.readException();
3121 data.recycle();
3122 reply.recycle();
3123 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003124 public void setLockScreenShown(boolean shown) throws RemoteException
3125 {
3126 Parcel data = Parcel.obtain();
3127 Parcel reply = Parcel.obtain();
3128 data.writeInterfaceToken(IActivityManager.descriptor);
3129 data.writeInt(shown ? 1 : 0);
3130 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3131 reply.readException();
3132 data.recycle();
3133 reply.recycle();
3134 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003135 public void setDebugApp(
3136 String packageName, boolean waitForDebugger, boolean persistent)
3137 throws RemoteException
3138 {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeString(packageName);
3143 data.writeInt(waitForDebugger ? 1 : 0);
3144 data.writeInt(persistent ? 1 : 0);
3145 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3146 reply.readException();
3147 data.recycle();
3148 reply.recycle();
3149 }
3150 public void setAlwaysFinish(boolean enabled) throws RemoteException
3151 {
3152 Parcel data = Parcel.obtain();
3153 Parcel reply = Parcel.obtain();
3154 data.writeInterfaceToken(IActivityManager.descriptor);
3155 data.writeInt(enabled ? 1 : 0);
3156 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 data.recycle();
3159 reply.recycle();
3160 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003161 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003162 {
3163 Parcel data = Parcel.obtain();
3164 Parcel reply = Parcel.obtain();
3165 data.writeInterfaceToken(IActivityManager.descriptor);
3166 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003167 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003168 reply.readException();
3169 data.recycle();
3170 reply.recycle();
3171 }
3172 public void enterSafeMode() throws RemoteException {
3173 Parcel data = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3176 data.recycle();
3177 }
3178 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3179 Parcel data = Parcel.obtain();
3180 data.writeStrongBinder(sender.asBinder());
3181 data.writeInterfaceToken(IActivityManager.descriptor);
3182 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3183 data.recycle();
3184 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003185 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003190 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003191 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003192 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003193 boolean res = reply.readInt() != 0;
3194 data.recycle();
3195 reply.recycle();
3196 return res;
3197 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003198 @Override
3199 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3200 Parcel data = Parcel.obtain();
3201 Parcel reply = Parcel.obtain();
3202 data.writeInterfaceToken(IActivityManager.descriptor);
3203 data.writeString(reason);
3204 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3205 boolean res = reply.readInt() != 0;
3206 data.recycle();
3207 reply.recycle();
3208 return res;
3209 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 public void startRunning(String pkg, String cls, String action,
3211 String indata) throws RemoteException {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeString(pkg);
3216 data.writeString(cls);
3217 data.writeString(action);
3218 data.writeString(indata);
3219 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3220 reply.readException();
3221 data.recycle();
3222 reply.recycle();
3223 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 public boolean testIsSystemReady()
3225 {
3226 /* this base class version is never called */
3227 return true;
3228 }
Dan Egnor60d87622009-12-16 16:32:58 -08003229 public void handleApplicationCrash(IBinder app,
3230 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3231 {
3232 Parcel data = Parcel.obtain();
3233 Parcel reply = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 data.writeStrongBinder(app);
3236 crashInfo.writeToParcel(data, 0);
3237 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 reply.recycle();
3240 data.recycle();
3241 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003242
Dan Egnor60d87622009-12-16 16:32:58 -08003243 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003244 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 {
3246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003250 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003251 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003252 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003253 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003254 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003255 reply.recycle();
3256 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003257 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003259
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003260 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003261 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003262 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003263 {
3264 Parcel data = Parcel.obtain();
3265 Parcel reply = Parcel.obtain();
3266 data.writeInterfaceToken(IActivityManager.descriptor);
3267 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003268 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003269 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003270 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3271 reply.readException();
3272 reply.recycle();
3273 data.recycle();
3274 }
3275
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 public void signalPersistentProcesses(int sig) throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeInt(sig);
3281 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3282 reply.readException();
3283 data.recycle();
3284 reply.recycle();
3285 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003286
Dianne Hackborn1676c852012-09-10 14:52:30 -07003287 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003288 Parcel data = Parcel.obtain();
3289 Parcel reply = Parcel.obtain();
3290 data.writeInterfaceToken(IActivityManager.descriptor);
3291 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003292 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003293 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3294 reply.readException();
3295 data.recycle();
3296 reply.recycle();
3297 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003298
3299 public void killAllBackgroundProcesses() throws RemoteException {
3300 Parcel data = Parcel.obtain();
3301 Parcel reply = Parcel.obtain();
3302 data.writeInterfaceToken(IActivityManager.descriptor);
3303 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3304 reply.readException();
3305 data.recycle();
3306 reply.recycle();
3307 }
3308
Dianne Hackborn1676c852012-09-10 14:52:30 -07003309 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003310 Parcel data = Parcel.obtain();
3311 Parcel reply = Parcel.obtain();
3312 data.writeInterfaceToken(IActivityManager.descriptor);
3313 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003314 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003315 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 reply.readException();
3317 data.recycle();
3318 reply.recycle();
3319 }
3320
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003321 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3322 throws RemoteException
3323 {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 outInfo.readFromParcel(reply);
3330 reply.recycle();
3331 data.recycle();
3332 }
3333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003334 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3335 {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3342 reply.recycle();
3343 data.recycle();
3344 return res;
3345 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003346
Dianne Hackborn1676c852012-09-10 14:52:30 -07003347 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003348 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003349 {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003354 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003355 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003356 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003357 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003358 if (fd != null) {
3359 data.writeInt(1);
3360 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3361 } else {
3362 data.writeInt(0);
3363 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003364 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3365 reply.readException();
3366 boolean res = reply.readInt() != 0;
3367 reply.recycle();
3368 data.recycle();
3369 return res;
3370 }
3371
Dianne Hackborn55280a92009-05-07 15:53:46 -07003372 public boolean shutdown(int timeout) throws RemoteException
3373 {
3374 Parcel data = Parcel.obtain();
3375 Parcel reply = Parcel.obtain();
3376 data.writeInterfaceToken(IActivityManager.descriptor);
3377 data.writeInt(timeout);
3378 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3379 reply.readException();
3380 boolean res = reply.readInt() != 0;
3381 reply.recycle();
3382 data.recycle();
3383 return res;
3384 }
3385
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003386 public void stopAppSwitches() throws RemoteException {
3387 Parcel data = Parcel.obtain();
3388 Parcel reply = Parcel.obtain();
3389 data.writeInterfaceToken(IActivityManager.descriptor);
3390 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3391 reply.readException();
3392 reply.recycle();
3393 data.recycle();
3394 }
3395
3396 public void resumeAppSwitches() throws RemoteException {
3397 Parcel data = Parcel.obtain();
3398 Parcel reply = Parcel.obtain();
3399 data.writeInterfaceToken(IActivityManager.descriptor);
3400 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3401 reply.readException();
3402 reply.recycle();
3403 data.recycle();
3404 }
3405
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003406 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003411 data.writeInt(appid);
3412 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003413 reply.readException();
3414 data.recycle();
3415 reply.recycle();
3416 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003417
3418 public void closeSystemDialogs(String reason) throws RemoteException {
3419 Parcel data = Parcel.obtain();
3420 Parcel reply = Parcel.obtain();
3421 data.writeInterfaceToken(IActivityManager.descriptor);
3422 data.writeString(reason);
3423 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 data.recycle();
3426 reply.recycle();
3427 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003428
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003429 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003430 throws RemoteException {
3431 Parcel data = Parcel.obtain();
3432 Parcel reply = Parcel.obtain();
3433 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003434 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003435 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3436 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003437 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003438 data.recycle();
3439 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003440 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003441 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003442
3443 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3444 Parcel data = Parcel.obtain();
3445 Parcel reply = Parcel.obtain();
3446 data.writeInterfaceToken(IActivityManager.descriptor);
3447 data.writeString(processName);
3448 data.writeInt(uid);
3449 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 data.recycle();
3452 reply.recycle();
3453 }
3454
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003455 public void overridePendingTransition(IBinder token, String packageName,
3456 int enterAnim, int exitAnim) throws RemoteException {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 data.writeStrongBinder(token);
3461 data.writeString(packageName);
3462 data.writeInt(enterAnim);
3463 data.writeInt(exitAnim);
3464 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3465 reply.readException();
3466 data.recycle();
3467 reply.recycle();
3468 }
3469
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003470 public boolean isUserAMonkey() throws RemoteException {
3471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3475 reply.readException();
3476 boolean res = reply.readInt() != 0;
3477 data.recycle();
3478 reply.recycle();
3479 return res;
3480 }
3481
Dianne Hackborn860755f2010-06-03 18:47:52 -07003482 public void finishHeavyWeightApp() throws RemoteException {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 data.recycle();
3489 reply.recycle();
3490 }
3491
Daniel Sandler69a48172010-06-23 16:29:36 -04003492 public void setImmersive(IBinder token, boolean immersive)
3493 throws RemoteException {
3494 Parcel data = Parcel.obtain();
3495 Parcel reply = Parcel.obtain();
3496 data.writeInterfaceToken(IActivityManager.descriptor);
3497 data.writeStrongBinder(token);
3498 data.writeInt(immersive ? 1 : 0);
3499 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3500 reply.readException();
3501 data.recycle();
3502 reply.recycle();
3503 }
3504
3505 public boolean isImmersive(IBinder token)
3506 throws RemoteException {
3507 Parcel data = Parcel.obtain();
3508 Parcel reply = Parcel.obtain();
3509 data.writeInterfaceToken(IActivityManager.descriptor);
3510 data.writeStrongBinder(token);
3511 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003512 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003513 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003514 data.recycle();
3515 reply.recycle();
3516 return res;
3517 }
3518
3519 public boolean isTopActivityImmersive()
3520 throws RemoteException {
3521 Parcel data = Parcel.obtain();
3522 Parcel reply = Parcel.obtain();
3523 data.writeInterfaceToken(IActivityManager.descriptor);
3524 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003525 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003526 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003527 data.recycle();
3528 reply.recycle();
3529 return res;
3530 }
3531
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003532 public void crashApplication(int uid, int initialPid, String packageName,
3533 String message) throws RemoteException {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 data.writeInt(uid);
3538 data.writeInt(initialPid);
3539 data.writeString(packageName);
3540 data.writeString(message);
3541 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3542 reply.readException();
3543 data.recycle();
3544 reply.recycle();
3545 }
Andy McFadden824c5102010-07-09 16:26:57 -07003546
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003547 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003548 Parcel data = Parcel.obtain();
3549 Parcel reply = Parcel.obtain();
3550 data.writeInterfaceToken(IActivityManager.descriptor);
3551 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003552 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003553 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3554 reply.readException();
3555 String res = reply.readString();
3556 data.recycle();
3557 reply.recycle();
3558 return res;
3559 }
3560
Dianne Hackborn7e269642010-08-25 19:50:20 -07003561 public IBinder newUriPermissionOwner(String name)
3562 throws RemoteException {
3563 Parcel data = Parcel.obtain();
3564 Parcel reply = Parcel.obtain();
3565 data.writeInterfaceToken(IActivityManager.descriptor);
3566 data.writeString(name);
3567 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3568 reply.readException();
3569 IBinder res = reply.readStrongBinder();
3570 data.recycle();
3571 reply.recycle();
3572 return res;
3573 }
3574
3575 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3576 Uri uri, int mode) throws RemoteException {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 data.writeStrongBinder(owner);
3581 data.writeInt(fromUid);
3582 data.writeString(targetPkg);
3583 uri.writeToParcel(data, 0);
3584 data.writeInt(mode);
3585 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3586 reply.readException();
3587 data.recycle();
3588 reply.recycle();
3589 }
3590
3591 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3592 int mode) throws RemoteException {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
3596 data.writeStrongBinder(owner);
3597 if (uri != null) {
3598 data.writeInt(1);
3599 uri.writeToParcel(data, 0);
3600 } else {
3601 data.writeInt(0);
3602 }
3603 data.writeInt(mode);
3604 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3605 reply.readException();
3606 data.recycle();
3607 reply.recycle();
3608 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003609
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003610 public int checkGrantUriPermission(int callingUid, String targetPkg,
3611 Uri uri, int modeFlags) throws RemoteException {
3612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 data.writeInt(callingUid);
3616 data.writeString(targetPkg);
3617 uri.writeToParcel(data, 0);
3618 data.writeInt(modeFlags);
3619 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3620 reply.readException();
3621 int res = reply.readInt();
3622 data.recycle();
3623 reply.recycle();
3624 return res;
3625 }
3626
Dianne Hackborn1676c852012-09-10 14:52:30 -07003627 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003628 String path, ParcelFileDescriptor fd) throws RemoteException {
3629 Parcel data = Parcel.obtain();
3630 Parcel reply = Parcel.obtain();
3631 data.writeInterfaceToken(IActivityManager.descriptor);
3632 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003633 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003634 data.writeInt(managed ? 1 : 0);
3635 data.writeString(path);
3636 if (fd != null) {
3637 data.writeInt(1);
3638 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3639 } else {
3640 data.writeInt(0);
3641 }
3642 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 boolean res = reply.readInt() != 0;
3645 reply.recycle();
3646 data.recycle();
3647 return res;
3648 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003649
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003650 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003651 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3652 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3657 data.writeTypedArray(intents, 0);
3658 data.writeStringArray(resolvedTypes);
3659 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003660 if (options != null) {
3661 data.writeInt(1);
3662 options.writeToParcel(data, 0);
3663 } else {
3664 data.writeInt(0);
3665 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003666 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3667 reply.readException();
3668 int result = reply.readInt();
3669 reply.recycle();
3670 data.recycle();
3671 return result;
3672 }
3673
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003674 public int getFrontActivityScreenCompatMode() throws RemoteException {
3675 Parcel data = Parcel.obtain();
3676 Parcel reply = Parcel.obtain();
3677 data.writeInterfaceToken(IActivityManager.descriptor);
3678 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3679 reply.readException();
3680 int mode = reply.readInt();
3681 reply.recycle();
3682 data.recycle();
3683 return mode;
3684 }
3685
3686 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3687 Parcel data = Parcel.obtain();
3688 Parcel reply = Parcel.obtain();
3689 data.writeInterfaceToken(IActivityManager.descriptor);
3690 data.writeInt(mode);
3691 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3692 reply.readException();
3693 reply.recycle();
3694 data.recycle();
3695 }
3696
3697 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3698 Parcel data = Parcel.obtain();
3699 Parcel reply = Parcel.obtain();
3700 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003701 data.writeString(packageName);
3702 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003703 reply.readException();
3704 int mode = reply.readInt();
3705 reply.recycle();
3706 data.recycle();
3707 return mode;
3708 }
3709
3710 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003711 throws RemoteException {
3712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003716 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003717 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3718 reply.readException();
3719 reply.recycle();
3720 data.recycle();
3721 }
3722
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003723 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3724 Parcel data = Parcel.obtain();
3725 Parcel reply = Parcel.obtain();
3726 data.writeInterfaceToken(IActivityManager.descriptor);
3727 data.writeString(packageName);
3728 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3729 reply.readException();
3730 boolean ask = reply.readInt() != 0;
3731 reply.recycle();
3732 data.recycle();
3733 return ask;
3734 }
3735
3736 public void setPackageAskScreenCompat(String packageName, boolean ask)
3737 throws RemoteException {
3738 Parcel data = Parcel.obtain();
3739 Parcel reply = Parcel.obtain();
3740 data.writeInterfaceToken(IActivityManager.descriptor);
3741 data.writeString(packageName);
3742 data.writeInt(ask ? 1 : 0);
3743 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3744 reply.readException();
3745 reply.recycle();
3746 data.recycle();
3747 }
3748
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003749 public boolean switchUser(int userid) throws RemoteException {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 data.writeInt(userid);
3754 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 boolean result = reply.readInt() != 0;
3757 reply.recycle();
3758 data.recycle();
3759 return result;
3760 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003761
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003762 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeInt(userid);
3767 data.writeStrongInterface(callback);
3768 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 int result = reply.readInt();
3771 reply.recycle();
3772 data.recycle();
3773 return result;
3774 }
3775
Amith Yamasani52f1d752012-03-28 18:19:29 -07003776 public UserInfo getCurrentUser() throws RemoteException {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003780 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003781 reply.readException();
3782 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3783 reply.recycle();
3784 data.recycle();
3785 return userInfo;
3786 }
3787
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003788 public boolean isUserRunning(int userid) throws RemoteException {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
3792 data.writeInt(userid);
3793 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3794 reply.readException();
3795 boolean result = reply.readInt() != 0;
3796 reply.recycle();
3797 data.recycle();
3798 return result;
3799 }
3800
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003801 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3802 Parcel data = Parcel.obtain();
3803 Parcel reply = Parcel.obtain();
3804 data.writeInterfaceToken(IActivityManager.descriptor);
3805 data.writeInt(taskId);
3806 data.writeInt(subTaskIndex);
3807 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3808 reply.readException();
3809 boolean result = reply.readInt() != 0;
3810 reply.recycle();
3811 data.recycle();
3812 return result;
3813 }
3814
3815 public boolean removeTask(int taskId, int flags) throws RemoteException {
3816 Parcel data = Parcel.obtain();
3817 Parcel reply = Parcel.obtain();
3818 data.writeInterfaceToken(IActivityManager.descriptor);
3819 data.writeInt(taskId);
3820 data.writeInt(flags);
3821 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3822 reply.readException();
3823 boolean result = reply.readInt() != 0;
3824 reply.recycle();
3825 data.recycle();
3826 return result;
3827 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003828
Jeff Sharkeya4620792011-05-20 15:29:23 -07003829 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3830 Parcel data = Parcel.obtain();
3831 Parcel reply = Parcel.obtain();
3832 data.writeInterfaceToken(IActivityManager.descriptor);
3833 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3834 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3835 reply.readException();
3836 data.recycle();
3837 reply.recycle();
3838 }
3839
3840 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3845 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3846 reply.readException();
3847 data.recycle();
3848 reply.recycle();
3849 }
3850
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003851 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3852 Parcel data = Parcel.obtain();
3853 Parcel reply = Parcel.obtain();
3854 data.writeInterfaceToken(IActivityManager.descriptor);
3855 data.writeStrongBinder(sender.asBinder());
3856 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3857 reply.readException();
3858 boolean res = reply.readInt() != 0;
3859 data.recycle();
3860 reply.recycle();
3861 return res;
3862 }
3863
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003864 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3865 Parcel data = Parcel.obtain();
3866 Parcel reply = Parcel.obtain();
3867 data.writeInterfaceToken(IActivityManager.descriptor);
3868 data.writeStrongBinder(sender.asBinder());
3869 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 boolean res = reply.readInt() != 0;
3872 data.recycle();
3873 reply.recycle();
3874 return res;
3875 }
3876
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003877 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3878 {
3879 Parcel data = Parcel.obtain();
3880 Parcel reply = Parcel.obtain();
3881 data.writeInterfaceToken(IActivityManager.descriptor);
3882 values.writeToParcel(data, 0);
3883 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3884 reply.readException();
3885 data.recycle();
3886 reply.recycle();
3887 }
3888
Dianne Hackbornb437e092011-08-05 17:50:29 -07003889 public long[] getProcessPss(int[] pids) throws RemoteException {
3890 Parcel data = Parcel.obtain();
3891 Parcel reply = Parcel.obtain();
3892 data.writeInterfaceToken(IActivityManager.descriptor);
3893 data.writeIntArray(pids);
3894 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3895 reply.readException();
3896 long[] res = reply.createLongArray();
3897 data.recycle();
3898 reply.recycle();
3899 return res;
3900 }
3901
Dianne Hackborn661cd522011-08-22 00:26:20 -07003902 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 TextUtils.writeToParcel(msg, data, 0);
3907 data.writeInt(always ? 1 : 0);
3908 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 data.recycle();
3911 reply.recycle();
3912 }
3913
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003914 public void dismissKeyguardOnNextActivity() throws RemoteException {
3915 Parcel data = Parcel.obtain();
3916 Parcel reply = Parcel.obtain();
3917 data.writeInterfaceToken(IActivityManager.descriptor);
3918 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3919 reply.readException();
3920 data.recycle();
3921 reply.recycle();
3922 }
3923
Adam Powelldd8fab22012-03-22 17:47:27 -07003924 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3925 throws RemoteException {
3926 Parcel data = Parcel.obtain();
3927 Parcel reply = Parcel.obtain();
3928 data.writeInterfaceToken(IActivityManager.descriptor);
3929 data.writeStrongBinder(token);
3930 data.writeString(destAffinity);
3931 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3932 reply.readException();
3933 boolean result = reply.readInt() != 0;
3934 data.recycle();
3935 reply.recycle();
3936 return result;
3937 }
3938
3939 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3940 throws RemoteException {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 data.writeStrongBinder(token);
3945 target.writeToParcel(data, 0);
3946 data.writeInt(resultCode);
3947 if (resultData != null) {
3948 data.writeInt(1);
3949 resultData.writeToParcel(data, 0);
3950 } else {
3951 data.writeInt(0);
3952 }
3953 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 boolean result = reply.readInt() != 0;
3956 data.recycle();
3957 reply.recycle();
3958 return result;
3959 }
3960
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003961 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
3965 data.writeStrongBinder(activityToken);
3966 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 int result = reply.readInt();
3969 data.recycle();
3970 reply.recycle();
3971 return result;
3972 }
3973
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07003974 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3979 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 data.recycle();
3982 reply.recycle();
3983 }
3984
3985 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
3986 Parcel data = Parcel.obtain();
3987 Parcel reply = Parcel.obtain();
3988 data.writeInterfaceToken(IActivityManager.descriptor);
3989 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3990 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
3991 reply.readException();
3992 data.recycle();
3993 reply.recycle();
3994 }
3995
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003996 private IBinder mRemote;
3997}