blob: 9b08493f037912c565dcc5de3fe91233b5a5efe7 [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
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700407 case ACTIVITY_RESUMED_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder token = data.readStrongBinder();
410 activityResumed(token);
411 reply.writeNoException();
412 return true;
413 }
414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 case ACTIVITY_PAUSED_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800418 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 reply.writeNoException();
420 return true;
421 }
422
423 case ACTIVITY_STOPPED_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800426 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 Bitmap thumbnail = data.readInt() != 0
428 ? Bitmap.CREATOR.createFromParcel(data) : null;
429 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800430 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 reply.writeNoException();
432 return true;
433 }
434
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800435 case ACTIVITY_SLEPT_TRANSACTION: {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder token = data.readStrongBinder();
438 activitySlept(token);
439 reply.writeNoException();
440 return true;
441 }
442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 case ACTIVITY_DESTROYED_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 IBinder token = data.readStrongBinder();
446 activityDestroyed(token);
447 reply.writeNoException();
448 return true;
449 }
450
451 case GET_CALLING_PACKAGE_TRANSACTION: {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder token = data.readStrongBinder();
454 String res = token != null ? getCallingPackage(token) : null;
455 reply.writeNoException();
456 reply.writeString(res);
457 return true;
458 }
459
460 case GET_CALLING_ACTIVITY_TRANSACTION: {
461 data.enforceInterface(IActivityManager.descriptor);
462 IBinder token = data.readStrongBinder();
463 ComponentName cn = getCallingActivity(token);
464 reply.writeNoException();
465 ComponentName.writeToParcel(cn, reply);
466 return true;
467 }
468
469 case GET_TASKS_TRANSACTION: {
470 data.enforceInterface(IActivityManager.descriptor);
471 int maxNum = data.readInt();
472 int fl = data.readInt();
473 IBinder receiverBinder = data.readStrongBinder();
474 IThumbnailReceiver receiver = receiverBinder != null
475 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
476 : null;
477 List list = getTasks(maxNum, fl, receiver);
478 reply.writeNoException();
479 int N = list != null ? list.size() : -1;
480 reply.writeInt(N);
481 int i;
482 for (i=0; i<N; i++) {
483 ActivityManager.RunningTaskInfo info =
484 (ActivityManager.RunningTaskInfo)list.get(i);
485 info.writeToParcel(reply, 0);
486 }
487 return true;
488 }
489
490 case GET_RECENT_TASKS_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 int maxNum = data.readInt();
493 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700494 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700496 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 reply.writeNoException();
498 reply.writeTypedList(list);
499 return true;
500 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700501
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700502 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800503 data.enforceInterface(IActivityManager.descriptor);
504 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700505 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800506 reply.writeNoException();
507 if (bm != null) {
508 reply.writeInt(1);
509 bm.writeToParcel(reply, 0);
510 } else {
511 reply.writeInt(0);
512 }
513 return true;
514 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700515
516 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 int id = data.readInt();
519 Bitmap bm = getTaskTopThumbnail(id);
520 reply.writeNoException();
521 if (bm != null) {
522 reply.writeInt(1);
523 bm.writeToParcel(reply, 0);
524 } else {
525 reply.writeInt(0);
526 }
527 return true;
528 }
529
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 case GET_SERVICES_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 int maxNum = data.readInt();
533 int fl = data.readInt();
534 List list = getServices(maxNum, fl);
535 reply.writeNoException();
536 int N = list != null ? list.size() : -1;
537 reply.writeInt(N);
538 int i;
539 for (i=0; i<N; i++) {
540 ActivityManager.RunningServiceInfo info =
541 (ActivityManager.RunningServiceInfo)list.get(i);
542 info.writeToParcel(reply, 0);
543 }
544 return true;
545 }
546
547 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
550 reply.writeNoException();
551 reply.writeTypedList(list);
552 return true;
553 }
554
555 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
558 reply.writeNoException();
559 reply.writeTypedList(list);
560 return true;
561 }
562
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700563 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
565 List<ApplicationInfo> list = getRunningExternalApplications();
566 reply.writeNoException();
567 reply.writeTypedList(list);
568 return true;
569 }
570
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571 case MOVE_TASK_TO_FRONT_TRANSACTION: {
572 data.enforceInterface(IActivityManager.descriptor);
573 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800574 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700575 Bundle options = data.readInt() != 0
576 ? Bundle.CREATOR.createFromParcel(data) : null;
577 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 reply.writeNoException();
579 return true;
580 }
581
582 case MOVE_TASK_TO_BACK_TRANSACTION: {
583 data.enforceInterface(IActivityManager.descriptor);
584 int task = data.readInt();
585 moveTaskToBack(task);
586 reply.writeNoException();
587 return true;
588 }
589
590 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 IBinder token = data.readStrongBinder();
593 boolean nonRoot = data.readInt() != 0;
594 boolean res = moveActivityTaskToBack(token, nonRoot);
595 reply.writeNoException();
596 reply.writeInt(res ? 1 : 0);
597 return true;
598 }
599
600 case MOVE_TASK_BACKWARDS_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 int task = data.readInt();
603 moveTaskBackwards(task);
604 reply.writeNoException();
605 return true;
606 }
607
608 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
609 data.enforceInterface(IActivityManager.descriptor);
610 IBinder token = data.readStrongBinder();
611 boolean onlyRoot = data.readInt() != 0;
612 int res = token != null
613 ? getTaskForActivity(token, onlyRoot) : -1;
614 reply.writeNoException();
615 reply.writeInt(res);
616 return true;
617 }
618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 case REPORT_THUMBNAIL_TRANSACTION: {
620 data.enforceInterface(IActivityManager.descriptor);
621 IBinder token = data.readStrongBinder();
622 Bitmap thumbnail = data.readInt() != 0
623 ? Bitmap.CREATOR.createFromParcel(data) : null;
624 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
625 reportThumbnail(token, thumbnail, description);
626 reply.writeNoException();
627 return true;
628 }
629
630 case GET_CONTENT_PROVIDER_TRANSACTION: {
631 data.enforceInterface(IActivityManager.descriptor);
632 IBinder b = data.readStrongBinder();
633 IApplicationThread app = ApplicationThreadNative.asInterface(b);
634 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700635 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700636 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700637 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 reply.writeNoException();
639 if (cph != null) {
640 reply.writeInt(1);
641 cph.writeToParcel(reply, 0);
642 } else {
643 reply.writeInt(0);
644 }
645 return true;
646 }
647
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800648 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700651 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800652 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700653 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800654 reply.writeNoException();
655 if (cph != null) {
656 reply.writeInt(1);
657 cph.writeToParcel(reply, 0);
658 } else {
659 reply.writeInt(0);
660 }
661 return true;
662 }
663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 IBinder b = data.readStrongBinder();
667 IApplicationThread app = ApplicationThreadNative.asInterface(b);
668 ArrayList<ContentProviderHolder> providers =
669 data.createTypedArrayList(ContentProviderHolder.CREATOR);
670 publishContentProviders(app, providers);
671 reply.writeNoException();
672 return true;
673 }
674
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700675 case REF_CONTENT_PROVIDER_TRANSACTION: {
676 data.enforceInterface(IActivityManager.descriptor);
677 IBinder b = data.readStrongBinder();
678 int stable = data.readInt();
679 int unstable = data.readInt();
680 boolean res = refContentProvider(b, stable, unstable);
681 reply.writeNoException();
682 reply.writeInt(res ? 1 : 0);
683 return true;
684 }
685
686 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 IBinder b = data.readStrongBinder();
689 unstableProviderDied(b);
690 reply.writeNoException();
691 return true;
692 }
693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700697 boolean stable = data.readInt() != 0;
698 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800699 reply.writeNoException();
700 return true;
701 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800702
703 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
704 data.enforceInterface(IActivityManager.descriptor);
705 String name = data.readString();
706 IBinder token = data.readStrongBinder();
707 removeContentProviderExternal(name, token);
708 reply.writeNoException();
709 return true;
710 }
711
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700712 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
713 data.enforceInterface(IActivityManager.descriptor);
714 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
715 PendingIntent pi = getRunningServiceControlPanel(comp);
716 reply.writeNoException();
717 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case START_SERVICE_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder b = data.readStrongBinder();
724 IApplicationThread app = ApplicationThreadNative.asInterface(b);
725 Intent service = Intent.CREATOR.createFromParcel(data);
726 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700727 int userId = data.readInt();
728 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 reply.writeNoException();
730 ComponentName.writeToParcel(cn, reply);
731 return true;
732 }
733
734 case STOP_SERVICE_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 IBinder b = data.readStrongBinder();
737 IApplicationThread app = ApplicationThreadNative.asInterface(b);
738 Intent service = Intent.CREATOR.createFromParcel(data);
739 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700740 int userId = data.readInt();
741 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742 reply.writeNoException();
743 reply.writeInt(res);
744 return true;
745 }
746
747 case STOP_SERVICE_TOKEN_TRANSACTION: {
748 data.enforceInterface(IActivityManager.descriptor);
749 ComponentName className = ComponentName.readFromParcel(data);
750 IBinder token = data.readStrongBinder();
751 int startId = data.readInt();
752 boolean res = stopServiceToken(className, token, startId);
753 reply.writeNoException();
754 reply.writeInt(res ? 1 : 0);
755 return true;
756 }
757
758 case SET_SERVICE_FOREGROUND_TRANSACTION: {
759 data.enforceInterface(IActivityManager.descriptor);
760 ComponentName className = ComponentName.readFromParcel(data);
761 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700762 int id = data.readInt();
763 Notification notification = null;
764 if (data.readInt() != 0) {
765 notification = Notification.CREATOR.createFromParcel(data);
766 }
767 boolean removeNotification = data.readInt() != 0;
768 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800769 reply.writeNoException();
770 return true;
771 }
772
773 case BIND_SERVICE_TRANSACTION: {
774 data.enforceInterface(IActivityManager.descriptor);
775 IBinder b = data.readStrongBinder();
776 IApplicationThread app = ApplicationThreadNative.asInterface(b);
777 IBinder token = data.readStrongBinder();
778 Intent service = Intent.CREATOR.createFromParcel(data);
779 String resolvedType = data.readString();
780 b = data.readStrongBinder();
781 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800782 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800783 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800784 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800785 reply.writeNoException();
786 reply.writeInt(res);
787 return true;
788 }
789
790 case UNBIND_SERVICE_TRANSACTION: {
791 data.enforceInterface(IActivityManager.descriptor);
792 IBinder b = data.readStrongBinder();
793 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
794 boolean res = unbindService(conn);
795 reply.writeNoException();
796 reply.writeInt(res ? 1 : 0);
797 return true;
798 }
799
800 case PUBLISH_SERVICE_TRANSACTION: {
801 data.enforceInterface(IActivityManager.descriptor);
802 IBinder token = data.readStrongBinder();
803 Intent intent = Intent.CREATOR.createFromParcel(data);
804 IBinder service = data.readStrongBinder();
805 publishService(token, intent, service);
806 reply.writeNoException();
807 return true;
808 }
809
810 case UNBIND_FINISHED_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
812 IBinder token = data.readStrongBinder();
813 Intent intent = Intent.CREATOR.createFromParcel(data);
814 boolean doRebind = data.readInt() != 0;
815 unbindFinished(token, intent, doRebind);
816 reply.writeNoException();
817 return true;
818 }
819
820 case SERVICE_DONE_EXECUTING_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700823 int type = data.readInt();
824 int startId = data.readInt();
825 int res = data.readInt();
826 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 reply.writeNoException();
828 return true;
829 }
830
831 case START_INSTRUMENTATION_TRANSACTION: {
832 data.enforceInterface(IActivityManager.descriptor);
833 ComponentName className = ComponentName.readFromParcel(data);
834 String profileFile = data.readString();
835 int fl = data.readInt();
836 Bundle arguments = data.readBundle();
837 IBinder b = data.readStrongBinder();
838 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700839 int userId = data.readInt();
840 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 reply.writeNoException();
842 reply.writeInt(res ? 1 : 0);
843 return true;
844 }
845
846
847 case FINISH_INSTRUMENTATION_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 IBinder b = data.readStrongBinder();
850 IApplicationThread app = ApplicationThreadNative.asInterface(b);
851 int resultCode = data.readInt();
852 Bundle results = data.readBundle();
853 finishInstrumentation(app, resultCode, results);
854 reply.writeNoException();
855 return true;
856 }
857
858 case GET_CONFIGURATION_TRANSACTION: {
859 data.enforceInterface(IActivityManager.descriptor);
860 Configuration config = getConfiguration();
861 reply.writeNoException();
862 config.writeToParcel(reply, 0);
863 return true;
864 }
865
866 case UPDATE_CONFIGURATION_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 Configuration config = Configuration.CREATOR.createFromParcel(data);
869 updateConfiguration(config);
870 reply.writeNoException();
871 return true;
872 }
873
874 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
875 data.enforceInterface(IActivityManager.descriptor);
876 IBinder token = data.readStrongBinder();
877 int requestedOrientation = data.readInt();
878 setRequestedOrientation(token, requestedOrientation);
879 reply.writeNoException();
880 return true;
881 }
882
883 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 IBinder token = data.readStrongBinder();
886 int req = getRequestedOrientation(token);
887 reply.writeNoException();
888 reply.writeInt(req);
889 return true;
890 }
891
892 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
893 data.enforceInterface(IActivityManager.descriptor);
894 IBinder token = data.readStrongBinder();
895 ComponentName cn = getActivityClassForToken(token);
896 reply.writeNoException();
897 ComponentName.writeToParcel(cn, reply);
898 return true;
899 }
900
901 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 IBinder token = data.readStrongBinder();
904 reply.writeNoException();
905 reply.writeString(getPackageForToken(token));
906 return true;
907 }
908
909 case GET_INTENT_SENDER_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 int type = data.readInt();
912 String packageName = data.readString();
913 IBinder token = data.readStrongBinder();
914 String resultWho = data.readString();
915 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800916 Intent[] requestIntents;
917 String[] requestResolvedTypes;
918 if (data.readInt() != 0) {
919 requestIntents = data.createTypedArray(Intent.CREATOR);
920 requestResolvedTypes = data.createStringArray();
921 } else {
922 requestIntents = null;
923 requestResolvedTypes = null;
924 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700926 Bundle options = data.readInt() != 0
927 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700928 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800930 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700931 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800932 reply.writeNoException();
933 reply.writeStrongBinder(res != null ? res.asBinder() : null);
934 return true;
935 }
936
937 case CANCEL_INTENT_SENDER_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 IIntentSender r = IIntentSender.Stub.asInterface(
940 data.readStrongBinder());
941 cancelIntentSender(r);
942 reply.writeNoException();
943 return true;
944 }
945
946 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
947 data.enforceInterface(IActivityManager.descriptor);
948 IIntentSender r = IIntentSender.Stub.asInterface(
949 data.readStrongBinder());
950 String res = getPackageForIntentSender(r);
951 reply.writeNoException();
952 reply.writeString(res);
953 return true;
954 }
955
Christopher Tatec4a07d12012-04-06 14:19:13 -0700956 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 IIntentSender r = IIntentSender.Stub.asInterface(
959 data.readStrongBinder());
960 int res = getUidForIntentSender(r);
961 reply.writeNoException();
962 reply.writeInt(res);
963 return true;
964 }
965
Dianne Hackborn41203752012-08-31 14:05:51 -0700966 case HANDLE_INCOMING_USER_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 int callingPid = data.readInt();
969 int callingUid = data.readInt();
970 int userId = data.readInt();
971 boolean allowAll = data.readInt() != 0 ;
972 boolean requireFull = data.readInt() != 0;
973 String name = data.readString();
974 String callerPackage = data.readString();
975 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
976 requireFull, name, callerPackage);
977 reply.writeNoException();
978 reply.writeInt(res);
979 return true;
980 }
981
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800982 case SET_PROCESS_LIMIT_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 int max = data.readInt();
985 setProcessLimit(max);
986 reply.writeNoException();
987 return true;
988 }
989
990 case GET_PROCESS_LIMIT_TRANSACTION: {
991 data.enforceInterface(IActivityManager.descriptor);
992 int limit = getProcessLimit();
993 reply.writeNoException();
994 reply.writeInt(limit);
995 return true;
996 }
997
998 case SET_PROCESS_FOREGROUND_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 IBinder token = data.readStrongBinder();
1001 int pid = data.readInt();
1002 boolean isForeground = data.readInt() != 0;
1003 setProcessForeground(token, pid, isForeground);
1004 reply.writeNoException();
1005 return true;
1006 }
1007
1008 case CHECK_PERMISSION_TRANSACTION: {
1009 data.enforceInterface(IActivityManager.descriptor);
1010 String perm = data.readString();
1011 int pid = data.readInt();
1012 int uid = data.readInt();
1013 int res = checkPermission(perm, pid, uid);
1014 reply.writeNoException();
1015 reply.writeInt(res);
1016 return true;
1017 }
1018
1019 case CHECK_URI_PERMISSION_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 Uri uri = Uri.CREATOR.createFromParcel(data);
1022 int pid = data.readInt();
1023 int uid = data.readInt();
1024 int mode = data.readInt();
1025 int res = checkUriPermission(uri, pid, uid, mode);
1026 reply.writeNoException();
1027 reply.writeInt(res);
1028 return true;
1029 }
1030
1031 case CLEAR_APP_DATA_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 String packageName = data.readString();
1034 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1035 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001036 int userId = data.readInt();
1037 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 reply.writeNoException();
1039 reply.writeInt(res ? 1 : 0);
1040 return true;
1041 }
1042
1043 case GRANT_URI_PERMISSION_TRANSACTION: {
1044 data.enforceInterface(IActivityManager.descriptor);
1045 IBinder b = data.readStrongBinder();
1046 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1047 String targetPkg = data.readString();
1048 Uri uri = Uri.CREATOR.createFromParcel(data);
1049 int mode = data.readInt();
1050 grantUriPermission(app, targetPkg, uri, mode);
1051 reply.writeNoException();
1052 return true;
1053 }
1054
1055 case REVOKE_URI_PERMISSION_TRANSACTION: {
1056 data.enforceInterface(IActivityManager.descriptor);
1057 IBinder b = data.readStrongBinder();
1058 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1059 Uri uri = Uri.CREATOR.createFromParcel(data);
1060 int mode = data.readInt();
1061 revokeUriPermission(app, uri, mode);
1062 reply.writeNoException();
1063 return true;
1064 }
1065
1066 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 IBinder b = data.readStrongBinder();
1069 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1070 boolean waiting = data.readInt() != 0;
1071 showWaitingForDebugger(app, waiting);
1072 reply.writeNoException();
1073 return true;
1074 }
1075
1076 case GET_MEMORY_INFO_TRANSACTION: {
1077 data.enforceInterface(IActivityManager.descriptor);
1078 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1079 getMemoryInfo(mi);
1080 reply.writeNoException();
1081 mi.writeToParcel(reply, 0);
1082 return true;
1083 }
1084
1085 case UNHANDLED_BACK_TRANSACTION: {
1086 data.enforceInterface(IActivityManager.descriptor);
1087 unhandledBack();
1088 reply.writeNoException();
1089 return true;
1090 }
1091
1092 case OPEN_CONTENT_URI_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 Uri uri = Uri.parse(data.readString());
1095 ParcelFileDescriptor pfd = openContentUri(uri);
1096 reply.writeNoException();
1097 if (pfd != null) {
1098 reply.writeInt(1);
1099 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1100 } else {
1101 reply.writeInt(0);
1102 }
1103 return true;
1104 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001105
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 case GOING_TO_SLEEP_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 goingToSleep();
1109 reply.writeNoException();
1110 return true;
1111 }
1112
1113 case WAKING_UP_TRANSACTION: {
1114 data.enforceInterface(IActivityManager.descriptor);
1115 wakingUp();
1116 reply.writeNoException();
1117 return true;
1118 }
1119
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001120 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1121 data.enforceInterface(IActivityManager.descriptor);
1122 setLockScreenShown(data.readInt() != 0);
1123 reply.writeNoException();
1124 return true;
1125 }
1126
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001127 case SET_DEBUG_APP_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 String pn = data.readString();
1130 boolean wfd = data.readInt() != 0;
1131 boolean per = data.readInt() != 0;
1132 setDebugApp(pn, wfd, per);
1133 reply.writeNoException();
1134 return true;
1135 }
1136
1137 case SET_ALWAYS_FINISH_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 boolean enabled = data.readInt() != 0;
1140 setAlwaysFinish(enabled);
1141 reply.writeNoException();
1142 return true;
1143 }
1144
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001145 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001147 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001149 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001150 return true;
1151 }
1152
1153 case ENTER_SAFE_MODE_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 enterSafeMode();
1156 reply.writeNoException();
1157 return true;
1158 }
1159
1160 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 IIntentSender is = IIntentSender.Stub.asInterface(
1163 data.readStrongBinder());
1164 noteWakeupAlarm(is);
1165 reply.writeNoException();
1166 return true;
1167 }
1168
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001169 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001170 data.enforceInterface(IActivityManager.descriptor);
1171 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001172 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001173 boolean secure = data.readInt() != 0;
1174 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 reply.writeNoException();
1176 reply.writeInt(res ? 1 : 0);
1177 return true;
1178 }
1179
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001180 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 String reason = data.readString();
1183 boolean res = killProcessesBelowForeground(reason);
1184 reply.writeNoException();
1185 reply.writeInt(res ? 1 : 0);
1186 return true;
1187 }
1188
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001189 case START_RUNNING_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 String pkg = data.readString();
1192 String cls = data.readString();
1193 String action = data.readString();
1194 String indata = data.readString();
1195 startRunning(pkg, cls, action, indata);
1196 reply.writeNoException();
1197 return true;
1198 }
1199
Dan Egnor60d87622009-12-16 16:32:58 -08001200 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1201 data.enforceInterface(IActivityManager.descriptor);
1202 IBinder app = data.readStrongBinder();
1203 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1204 handleApplicationCrash(app, ci);
1205 reply.writeNoException();
1206 return true;
1207 }
1208
1209 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001210 data.enforceInterface(IActivityManager.descriptor);
1211 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001212 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001213 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001214 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001216 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 return true;
1218 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001219
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001220 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001223 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001224 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1225 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001226 reply.writeNoException();
1227 return true;
1228 }
1229
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1231 data.enforceInterface(IActivityManager.descriptor);
1232 int sig = data.readInt();
1233 signalPersistentProcesses(sig);
1234 reply.writeNoException();
1235 return true;
1236 }
1237
Dianne Hackborn03abb812010-01-04 18:43:19 -08001238 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001241 int userId = data.readInt();
1242 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001243 reply.writeNoException();
1244 return true;
1245 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001246
1247 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1248 data.enforceInterface(IActivityManager.descriptor);
1249 killAllBackgroundProcesses();
1250 reply.writeNoException();
1251 return true;
1252 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001253
1254 case FORCE_STOP_PACKAGE_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001257 int userId = data.readInt();
1258 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 reply.writeNoException();
1260 return true;
1261 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001262
1263 case GET_MY_MEMORY_STATE_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 ActivityManager.RunningAppProcessInfo info =
1266 new ActivityManager.RunningAppProcessInfo();
1267 getMyMemoryState(info);
1268 reply.writeNoException();
1269 info.writeToParcel(reply, 0);
1270 return true;
1271 }
1272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1274 data.enforceInterface(IActivityManager.descriptor);
1275 ConfigurationInfo config = getDeviceConfigurationInfo();
1276 reply.writeNoException();
1277 config.writeToParcel(reply, 0);
1278 return true;
1279 }
1280
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001281 case PROFILE_CONTROL_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001284 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001285 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001286 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001287 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001288 ParcelFileDescriptor fd = data.readInt() != 0
1289 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001290 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001291 reply.writeNoException();
1292 reply.writeInt(res ? 1 : 0);
1293 return true;
1294 }
1295
Dianne Hackborn55280a92009-05-07 15:53:46 -07001296 case SHUTDOWN_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 boolean res = shutdown(data.readInt());
1299 reply.writeNoException();
1300 reply.writeInt(res ? 1 : 0);
1301 return true;
1302 }
1303
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001304 case STOP_APP_SWITCHES_TRANSACTION: {
1305 data.enforceInterface(IActivityManager.descriptor);
1306 stopAppSwitches();
1307 reply.writeNoException();
1308 return true;
1309 }
1310
1311 case RESUME_APP_SWITCHES_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 resumeAppSwitches();
1314 reply.writeNoException();
1315 return true;
1316 }
1317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 case PEEK_SERVICE_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 Intent service = Intent.CREATOR.createFromParcel(data);
1321 String resolvedType = data.readString();
1322 IBinder binder = peekService(service, resolvedType);
1323 reply.writeNoException();
1324 reply.writeStrongBinder(binder);
1325 return true;
1326 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001327
1328 case START_BACKUP_AGENT_TRANSACTION: {
1329 data.enforceInterface(IActivityManager.descriptor);
1330 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1331 int backupRestoreMode = data.readInt();
1332 boolean success = bindBackupAgent(info, backupRestoreMode);
1333 reply.writeNoException();
1334 reply.writeInt(success ? 1 : 0);
1335 return true;
1336 }
1337
1338 case BACKUP_AGENT_CREATED_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 String packageName = data.readString();
1341 IBinder agent = data.readStrongBinder();
1342 backupAgentCreated(packageName, agent);
1343 reply.writeNoException();
1344 return true;
1345 }
1346
1347 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1350 unbindBackupAgent(info);
1351 reply.writeNoException();
1352 return true;
1353 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001354
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001355 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001356 data.enforceInterface(IActivityManager.descriptor);
1357 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001358 int appid = data.readInt();
1359 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001360 reply.writeNoException();
1361 return true;
1362 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001363
1364 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1365 data.enforceInterface(IActivityManager.descriptor);
1366 String reason = data.readString();
1367 closeSystemDialogs(reason);
1368 reply.writeNoException();
1369 return true;
1370 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001371
1372 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001374 int[] pids = data.createIntArray();
1375 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001376 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001377 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001378 return true;
1379 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001380
1381 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 String processName = data.readString();
1384 int uid = data.readInt();
1385 killApplicationProcess(processName, uid);
1386 reply.writeNoException();
1387 return true;
1388 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001389
1390 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1391 data.enforceInterface(IActivityManager.descriptor);
1392 IBinder token = data.readStrongBinder();
1393 String packageName = data.readString();
1394 int enterAnim = data.readInt();
1395 int exitAnim = data.readInt();
1396 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001397 reply.writeNoException();
1398 return true;
1399 }
1400
1401 case IS_USER_A_MONKEY_TRANSACTION: {
1402 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001403 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001404 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001405 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001406 return true;
1407 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001408
1409 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1410 data.enforceInterface(IActivityManager.descriptor);
1411 finishHeavyWeightApp();
1412 reply.writeNoException();
1413 return true;
1414 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001415
1416 case IS_IMMERSIVE_TRANSACTION: {
1417 data.enforceInterface(IActivityManager.descriptor);
1418 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001419 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001420 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001421 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001422 return true;
1423 }
1424
1425 case SET_IMMERSIVE_TRANSACTION: {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 IBinder token = data.readStrongBinder();
1428 boolean imm = data.readInt() == 1;
1429 setImmersive(token, imm);
1430 reply.writeNoException();
1431 return true;
1432 }
1433
1434 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1435 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001436 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001437 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001438 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001439 return true;
1440 }
1441
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001442 case CRASH_APPLICATION_TRANSACTION: {
1443 data.enforceInterface(IActivityManager.descriptor);
1444 int uid = data.readInt();
1445 int initialPid = data.readInt();
1446 String packageName = data.readString();
1447 String message = data.readString();
1448 crashApplication(uid, initialPid, packageName, message);
1449 reply.writeNoException();
1450 return true;
1451 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001452
1453 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001456 int userId = data.readInt();
1457 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001458 reply.writeNoException();
1459 reply.writeString(type);
1460 return true;
1461 }
1462
Dianne Hackborn7e269642010-08-25 19:50:20 -07001463 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String name = data.readString();
1466 IBinder perm = newUriPermissionOwner(name);
1467 reply.writeNoException();
1468 reply.writeStrongBinder(perm);
1469 return true;
1470 }
1471
1472 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
1474 IBinder owner = data.readStrongBinder();
1475 int fromUid = data.readInt();
1476 String targetPkg = data.readString();
1477 Uri uri = Uri.CREATOR.createFromParcel(data);
1478 int mode = data.readInt();
1479 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1480 reply.writeNoException();
1481 return true;
1482 }
1483
1484 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1485 data.enforceInterface(IActivityManager.descriptor);
1486 IBinder owner = data.readStrongBinder();
1487 Uri uri = null;
1488 if (data.readInt() != 0) {
1489 Uri.CREATOR.createFromParcel(data);
1490 }
1491 int mode = data.readInt();
1492 revokeUriPermissionFromOwner(owner, uri, mode);
1493 reply.writeNoException();
1494 return true;
1495 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001496
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001497 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 int callingUid = data.readInt();
1500 String targetPkg = data.readString();
1501 Uri uri = Uri.CREATOR.createFromParcel(data);
1502 int modeFlags = data.readInt();
1503 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1504 reply.writeNoException();
1505 reply.writeInt(res);
1506 return true;
1507 }
1508
Andy McFadden824c5102010-07-09 16:26:57 -07001509 case DUMP_HEAP_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 String process = data.readString();
1512 boolean managed = data.readInt() != 0;
1513 String path = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001514 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001515 ParcelFileDescriptor fd = data.readInt() != 0
1516 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001517 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001518 reply.writeNoException();
1519 reply.writeInt(res ? 1 : 0);
1520 return true;
1521 }
1522
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001523 case START_ACTIVITIES_TRANSACTION:
1524 {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IBinder b = data.readStrongBinder();
1527 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1528 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1529 String[] resolvedTypes = data.createStringArray();
1530 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001531 Bundle options = data.readInt() != 0
1532 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001533 int userId = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001534 int result = startActivities(app, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001535 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001536 reply.writeNoException();
1537 reply.writeInt(result);
1538 return true;
1539 }
1540
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001541 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1542 {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 int mode = getFrontActivityScreenCompatMode();
1545 reply.writeNoException();
1546 reply.writeInt(mode);
1547 return true;
1548 }
1549
1550 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1551 {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 int mode = data.readInt();
1554 setFrontActivityScreenCompatMode(mode);
1555 reply.writeNoException();
1556 reply.writeInt(mode);
1557 return true;
1558 }
1559
1560 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1561 {
1562 data.enforceInterface(IActivityManager.descriptor);
1563 String pkg = data.readString();
1564 int mode = getPackageScreenCompatMode(pkg);
1565 reply.writeNoException();
1566 reply.writeInt(mode);
1567 return true;
1568 }
1569
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001570 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1571 {
1572 data.enforceInterface(IActivityManager.descriptor);
1573 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001574 int mode = data.readInt();
1575 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001576 reply.writeNoException();
1577 return true;
1578 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001579
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001580 case SWITCH_USER_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 int userid = data.readInt();
1583 boolean result = switchUser(userid);
1584 reply.writeNoException();
1585 reply.writeInt(result ? 1 : 0);
1586 return true;
1587 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001588
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001589 case STOP_USER_TRANSACTION: {
1590 data.enforceInterface(IActivityManager.descriptor);
1591 int userid = data.readInt();
1592 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1593 data.readStrongBinder());
1594 int result = stopUser(userid, callback);
1595 reply.writeNoException();
1596 reply.writeInt(result);
1597 return true;
1598 }
1599
Amith Yamasani52f1d752012-03-28 18:19:29 -07001600 case GET_CURRENT_USER_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 UserInfo userInfo = getCurrentUser();
1603 reply.writeNoException();
1604 userInfo.writeToParcel(reply, 0);
1605 return true;
1606 }
1607
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001608 case IS_USER_RUNNING_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 int userid = data.readInt();
1611 boolean result = isUserRunning(userid);
1612 reply.writeNoException();
1613 reply.writeInt(result ? 1 : 0);
1614 return true;
1615 }
1616
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001617 case GET_RUNNING_USER_IDS_TRANSACTION: {
1618 data.enforceInterface(IActivityManager.descriptor);
1619 int[] result = getRunningUserIds();
1620 reply.writeNoException();
1621 reply.writeIntArray(result);
1622 return true;
1623 }
1624
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001625 case REMOVE_SUB_TASK_TRANSACTION:
1626 {
1627 data.enforceInterface(IActivityManager.descriptor);
1628 int taskId = data.readInt();
1629 int subTaskIndex = data.readInt();
1630 boolean result = removeSubTask(taskId, subTaskIndex);
1631 reply.writeNoException();
1632 reply.writeInt(result ? 1 : 0);
1633 return true;
1634 }
1635
1636 case REMOVE_TASK_TRANSACTION:
1637 {
1638 data.enforceInterface(IActivityManager.descriptor);
1639 int taskId = data.readInt();
1640 int fl = data.readInt();
1641 boolean result = removeTask(taskId, fl);
1642 reply.writeNoException();
1643 reply.writeInt(result ? 1 : 0);
1644 return true;
1645 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001646
Jeff Sharkeya4620792011-05-20 15:29:23 -07001647 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1648 data.enforceInterface(IActivityManager.descriptor);
1649 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1650 data.readStrongBinder());
1651 registerProcessObserver(observer);
1652 return true;
1653 }
1654
1655 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1656 data.enforceInterface(IActivityManager.descriptor);
1657 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1658 data.readStrongBinder());
1659 unregisterProcessObserver(observer);
1660 return true;
1661 }
1662
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001663 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1664 {
1665 data.enforceInterface(IActivityManager.descriptor);
1666 String pkg = data.readString();
1667 boolean ask = getPackageAskScreenCompat(pkg);
1668 reply.writeNoException();
1669 reply.writeInt(ask ? 1 : 0);
1670 return true;
1671 }
1672
1673 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1674 {
1675 data.enforceInterface(IActivityManager.descriptor);
1676 String pkg = data.readString();
1677 boolean ask = data.readInt() != 0;
1678 setPackageAskScreenCompat(pkg, ask);
1679 reply.writeNoException();
1680 return true;
1681 }
1682
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001683 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1684 data.enforceInterface(IActivityManager.descriptor);
1685 IIntentSender r = IIntentSender.Stub.asInterface(
1686 data.readStrongBinder());
1687 boolean res = isIntentSenderTargetedToPackage(r);
1688 reply.writeNoException();
1689 reply.writeInt(res ? 1 : 0);
1690 return true;
1691 }
1692
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001693 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1694 data.enforceInterface(IActivityManager.descriptor);
1695 IIntentSender r = IIntentSender.Stub.asInterface(
1696 data.readStrongBinder());
1697 boolean res = isIntentSenderAnActivity(r);
1698 reply.writeNoException();
1699 reply.writeInt(res ? 1 : 0);
1700 return true;
1701 }
1702
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001703 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1704 data.enforceInterface(IActivityManager.descriptor);
1705 Configuration config = Configuration.CREATOR.createFromParcel(data);
1706 updatePersistentConfiguration(config);
1707 reply.writeNoException();
1708 return true;
1709 }
1710
Dianne Hackbornb437e092011-08-05 17:50:29 -07001711 case GET_PROCESS_PSS_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
1713 int[] pids = data.createIntArray();
1714 long[] pss = getProcessPss(pids);
1715 reply.writeNoException();
1716 reply.writeLongArray(pss);
1717 return true;
1718 }
1719
Dianne Hackborn661cd522011-08-22 00:26:20 -07001720 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1721 data.enforceInterface(IActivityManager.descriptor);
1722 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1723 boolean always = data.readInt() != 0;
1724 showBootMessage(msg, always);
1725 reply.writeNoException();
1726 return true;
1727 }
1728
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001729 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1730 data.enforceInterface(IActivityManager.descriptor);
1731 dismissKeyguardOnNextActivity();
1732 reply.writeNoException();
1733 return true;
1734 }
1735
Adam Powelldd8fab22012-03-22 17:47:27 -07001736 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1737 data.enforceInterface(IActivityManager.descriptor);
1738 IBinder token = data.readStrongBinder();
1739 String destAffinity = data.readString();
1740 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1741 reply.writeNoException();
1742 reply.writeInt(res ? 1 : 0);
1743 return true;
1744 }
1745
1746 case NAVIGATE_UP_TO_TRANSACTION: {
1747 data.enforceInterface(IActivityManager.descriptor);
1748 IBinder token = data.readStrongBinder();
1749 Intent target = Intent.CREATOR.createFromParcel(data);
1750 int resultCode = data.readInt();
1751 Intent resultData = null;
1752 if (data.readInt() != 0) {
1753 resultData = Intent.CREATOR.createFromParcel(data);
1754 }
1755 boolean res = navigateUpTo(token, target, resultCode, resultData);
1756 reply.writeNoException();
1757 reply.writeInt(res ? 1 : 0);
1758 return true;
1759 }
1760
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001761 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1762 data.enforceInterface(IActivityManager.descriptor);
1763 IBinder token = data.readStrongBinder();
1764 int res = getLaunchedFromUid(token);
1765 reply.writeNoException();
1766 reply.writeInt(res);
1767 return true;
1768 }
1769
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001770 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1773 data.readStrongBinder());
1774 registerUserSwitchObserver(observer);
1775 return true;
1776 }
1777
1778 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1779 data.enforceInterface(IActivityManager.descriptor);
1780 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1781 data.readStrongBinder());
1782 unregisterUserSwitchObserver(observer);
1783 return true;
1784 }
1785
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001786 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001788 return super.onTransact(code, data, reply, flags);
1789 }
1790
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001791 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001792 return this;
1793 }
1794
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001795 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1796 protected IActivityManager create() {
1797 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001798 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001799 Log.v("ActivityManager", "default service binder = " + b);
1800 }
1801 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001802 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001803 Log.v("ActivityManager", "default service = " + am);
1804 }
1805 return am;
1806 }
1807 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001808}
1809
1810class ActivityManagerProxy implements IActivityManager
1811{
1812 public ActivityManagerProxy(IBinder remote)
1813 {
1814 mRemote = remote;
1815 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001816
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001817 public IBinder asBinder()
1818 {
1819 return mRemote;
1820 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001822 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001823 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1824 int startFlags, String profileFile,
1825 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001826 Parcel data = Parcel.obtain();
1827 Parcel reply = Parcel.obtain();
1828 data.writeInterfaceToken(IActivityManager.descriptor);
1829 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1830 intent.writeToParcel(data, 0);
1831 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001832 data.writeStrongBinder(resultTo);
1833 data.writeString(resultWho);
1834 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001835 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001836 data.writeString(profileFile);
1837 if (profileFd != null) {
1838 data.writeInt(1);
1839 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1840 } else {
1841 data.writeInt(0);
1842 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001843 if (options != null) {
1844 data.writeInt(1);
1845 options.writeToParcel(data, 0);
1846 } else {
1847 data.writeInt(0);
1848 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001849 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1850 reply.readException();
1851 int result = reply.readInt();
1852 reply.recycle();
1853 data.recycle();
1854 return result;
1855 }
Amith Yamasani82644082012-08-03 13:09:11 -07001856
1857 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1858 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1859 int startFlags, String profileFile,
1860 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1861 Parcel data = Parcel.obtain();
1862 Parcel reply = Parcel.obtain();
1863 data.writeInterfaceToken(IActivityManager.descriptor);
1864 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1865 intent.writeToParcel(data, 0);
1866 data.writeString(resolvedType);
1867 data.writeStrongBinder(resultTo);
1868 data.writeString(resultWho);
1869 data.writeInt(requestCode);
1870 data.writeInt(startFlags);
1871 data.writeString(profileFile);
1872 if (profileFd != null) {
1873 data.writeInt(1);
1874 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1875 } else {
1876 data.writeInt(0);
1877 }
1878 if (options != null) {
1879 data.writeInt(1);
1880 options.writeToParcel(data, 0);
1881 } else {
1882 data.writeInt(0);
1883 }
1884 data.writeInt(userId);
1885 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1886 reply.readException();
1887 int result = reply.readInt();
1888 reply.recycle();
1889 data.recycle();
1890 return result;
1891 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001892 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001893 String resolvedType, IBinder resultTo, String resultWho,
1894 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001895 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001896 Parcel data = Parcel.obtain();
1897 Parcel reply = Parcel.obtain();
1898 data.writeInterfaceToken(IActivityManager.descriptor);
1899 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1900 intent.writeToParcel(data, 0);
1901 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001902 data.writeStrongBinder(resultTo);
1903 data.writeString(resultWho);
1904 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001905 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001906 data.writeString(profileFile);
1907 if (profileFd != null) {
1908 data.writeInt(1);
1909 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1910 } else {
1911 data.writeInt(0);
1912 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001913 if (options != null) {
1914 data.writeInt(1);
1915 options.writeToParcel(data, 0);
1916 } else {
1917 data.writeInt(0);
1918 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001919 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001920 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1921 reply.readException();
1922 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1923 reply.recycle();
1924 data.recycle();
1925 return result;
1926 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001927 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001928 String resolvedType, IBinder resultTo, String resultWho,
1929 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001930 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001931 Parcel data = Parcel.obtain();
1932 Parcel reply = Parcel.obtain();
1933 data.writeInterfaceToken(IActivityManager.descriptor);
1934 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1935 intent.writeToParcel(data, 0);
1936 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001937 data.writeStrongBinder(resultTo);
1938 data.writeString(resultWho);
1939 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001940 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001941 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001942 if (options != null) {
1943 data.writeInt(1);
1944 options.writeToParcel(data, 0);
1945 } else {
1946 data.writeInt(0);
1947 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001948 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001949 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1950 reply.readException();
1951 int result = reply.readInt();
1952 reply.recycle();
1953 data.recycle();
1954 return result;
1955 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001956 public int startActivityIntentSender(IApplicationThread caller,
1957 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001958 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001959 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001960 Parcel data = Parcel.obtain();
1961 Parcel reply = Parcel.obtain();
1962 data.writeInterfaceToken(IActivityManager.descriptor);
1963 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1964 intent.writeToParcel(data, 0);
1965 if (fillInIntent != null) {
1966 data.writeInt(1);
1967 fillInIntent.writeToParcel(data, 0);
1968 } else {
1969 data.writeInt(0);
1970 }
1971 data.writeString(resolvedType);
1972 data.writeStrongBinder(resultTo);
1973 data.writeString(resultWho);
1974 data.writeInt(requestCode);
1975 data.writeInt(flagsMask);
1976 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001977 if (options != null) {
1978 data.writeInt(1);
1979 options.writeToParcel(data, 0);
1980 } else {
1981 data.writeInt(0);
1982 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001983 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001984 reply.readException();
1985 int result = reply.readInt();
1986 reply.recycle();
1987 data.recycle();
1988 return result;
1989 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001990 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001991 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001992 Parcel data = Parcel.obtain();
1993 Parcel reply = Parcel.obtain();
1994 data.writeInterfaceToken(IActivityManager.descriptor);
1995 data.writeStrongBinder(callingActivity);
1996 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001997 if (options != null) {
1998 data.writeInt(1);
1999 options.writeToParcel(data, 0);
2000 } else {
2001 data.writeInt(0);
2002 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002003 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2004 reply.readException();
2005 int result = reply.readInt();
2006 reply.recycle();
2007 data.recycle();
2008 return result != 0;
2009 }
2010 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2011 throws RemoteException {
2012 Parcel data = Parcel.obtain();
2013 Parcel reply = Parcel.obtain();
2014 data.writeInterfaceToken(IActivityManager.descriptor);
2015 data.writeStrongBinder(token);
2016 data.writeInt(resultCode);
2017 if (resultData != null) {
2018 data.writeInt(1);
2019 resultData.writeToParcel(data, 0);
2020 } else {
2021 data.writeInt(0);
2022 }
2023 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2024 reply.readException();
2025 boolean res = reply.readInt() != 0;
2026 data.recycle();
2027 reply.recycle();
2028 return res;
2029 }
2030 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2031 {
2032 Parcel data = Parcel.obtain();
2033 Parcel reply = Parcel.obtain();
2034 data.writeInterfaceToken(IActivityManager.descriptor);
2035 data.writeStrongBinder(token);
2036 data.writeString(resultWho);
2037 data.writeInt(requestCode);
2038 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2039 reply.readException();
2040 data.recycle();
2041 reply.recycle();
2042 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002043 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2044 Parcel data = Parcel.obtain();
2045 Parcel reply = Parcel.obtain();
2046 data.writeInterfaceToken(IActivityManager.descriptor);
2047 data.writeStrongBinder(token);
2048 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2049 reply.readException();
2050 boolean res = reply.readInt() != 0;
2051 data.recycle();
2052 reply.recycle();
2053 return res;
2054 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002055 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2056 Parcel data = Parcel.obtain();
2057 Parcel reply = Parcel.obtain();
2058 data.writeInterfaceToken(IActivityManager.descriptor);
2059 data.writeStrongBinder(token);
2060 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2061 reply.readException();
2062 boolean res = reply.readInt() != 0;
2063 data.recycle();
2064 reply.recycle();
2065 return res;
2066 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002067 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002068 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002069 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002070 {
2071 Parcel data = Parcel.obtain();
2072 Parcel reply = Parcel.obtain();
2073 data.writeInterfaceToken(IActivityManager.descriptor);
2074 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002075 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002076 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2077 filter.writeToParcel(data, 0);
2078 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002079 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002080 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2081 reply.readException();
2082 Intent intent = null;
2083 int haveIntent = reply.readInt();
2084 if (haveIntent != 0) {
2085 intent = Intent.CREATOR.createFromParcel(reply);
2086 }
2087 reply.recycle();
2088 data.recycle();
2089 return intent;
2090 }
2091 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2092 {
2093 Parcel data = Parcel.obtain();
2094 Parcel reply = Parcel.obtain();
2095 data.writeInterfaceToken(IActivityManager.descriptor);
2096 data.writeStrongBinder(receiver.asBinder());
2097 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2098 reply.readException();
2099 data.recycle();
2100 reply.recycle();
2101 }
2102 public int broadcastIntent(IApplicationThread caller,
2103 Intent intent, String resolvedType, IIntentReceiver resultTo,
2104 int resultCode, String resultData, Bundle map,
2105 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002106 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002107 {
2108 Parcel data = Parcel.obtain();
2109 Parcel reply = Parcel.obtain();
2110 data.writeInterfaceToken(IActivityManager.descriptor);
2111 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2112 intent.writeToParcel(data, 0);
2113 data.writeString(resolvedType);
2114 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2115 data.writeInt(resultCode);
2116 data.writeString(resultData);
2117 data.writeBundle(map);
2118 data.writeString(requiredPermission);
2119 data.writeInt(serialized ? 1 : 0);
2120 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002121 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002122 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2123 reply.readException();
2124 int res = reply.readInt();
2125 reply.recycle();
2126 data.recycle();
2127 return res;
2128 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002129 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2130 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002131 {
2132 Parcel data = Parcel.obtain();
2133 Parcel reply = Parcel.obtain();
2134 data.writeInterfaceToken(IActivityManager.descriptor);
2135 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2136 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002137 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002138 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2139 reply.readException();
2140 data.recycle();
2141 reply.recycle();
2142 }
2143 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2144 {
2145 Parcel data = Parcel.obtain();
2146 Parcel reply = Parcel.obtain();
2147 data.writeInterfaceToken(IActivityManager.descriptor);
2148 data.writeStrongBinder(who);
2149 data.writeInt(resultCode);
2150 data.writeString(resultData);
2151 data.writeBundle(map);
2152 data.writeInt(abortBroadcast ? 1 : 0);
2153 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2154 reply.readException();
2155 data.recycle();
2156 reply.recycle();
2157 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 public void attachApplication(IApplicationThread app) throws RemoteException
2159 {
2160 Parcel data = Parcel.obtain();
2161 Parcel reply = Parcel.obtain();
2162 data.writeInterfaceToken(IActivityManager.descriptor);
2163 data.writeStrongBinder(app.asBinder());
2164 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2165 reply.readException();
2166 data.recycle();
2167 reply.recycle();
2168 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002169 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2170 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002171 {
2172 Parcel data = Parcel.obtain();
2173 Parcel reply = Parcel.obtain();
2174 data.writeInterfaceToken(IActivityManager.descriptor);
2175 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002176 if (config != null) {
2177 data.writeInt(1);
2178 config.writeToParcel(data, 0);
2179 } else {
2180 data.writeInt(0);
2181 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002182 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002183 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2184 reply.readException();
2185 data.recycle();
2186 reply.recycle();
2187 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002188 public void activityResumed(IBinder token) throws RemoteException
2189 {
2190 Parcel data = Parcel.obtain();
2191 Parcel reply = Parcel.obtain();
2192 data.writeInterfaceToken(IActivityManager.descriptor);
2193 data.writeStrongBinder(token);
2194 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2195 reply.readException();
2196 data.recycle();
2197 reply.recycle();
2198 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002199 public void activityPaused(IBinder token) throws RemoteException
2200 {
2201 Parcel data = Parcel.obtain();
2202 Parcel reply = Parcel.obtain();
2203 data.writeInterfaceToken(IActivityManager.descriptor);
2204 data.writeStrongBinder(token);
2205 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2206 reply.readException();
2207 data.recycle();
2208 reply.recycle();
2209 }
2210 public void activityStopped(IBinder token, Bundle state,
2211 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002212 {
2213 Parcel data = Parcel.obtain();
2214 Parcel reply = Parcel.obtain();
2215 data.writeInterfaceToken(IActivityManager.descriptor);
2216 data.writeStrongBinder(token);
2217 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002218 if (thumbnail != null) {
2219 data.writeInt(1);
2220 thumbnail.writeToParcel(data, 0);
2221 } else {
2222 data.writeInt(0);
2223 }
2224 TextUtils.writeToParcel(description, data, 0);
2225 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2226 reply.readException();
2227 data.recycle();
2228 reply.recycle();
2229 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002230 public void activitySlept(IBinder token) throws RemoteException
2231 {
2232 Parcel data = Parcel.obtain();
2233 Parcel reply = Parcel.obtain();
2234 data.writeInterfaceToken(IActivityManager.descriptor);
2235 data.writeStrongBinder(token);
2236 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2237 reply.readException();
2238 data.recycle();
2239 reply.recycle();
2240 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002241 public void activityDestroyed(IBinder token) throws RemoteException
2242 {
2243 Parcel data = Parcel.obtain();
2244 Parcel reply = Parcel.obtain();
2245 data.writeInterfaceToken(IActivityManager.descriptor);
2246 data.writeStrongBinder(token);
2247 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2248 reply.readException();
2249 data.recycle();
2250 reply.recycle();
2251 }
2252 public String getCallingPackage(IBinder token) throws RemoteException
2253 {
2254 Parcel data = Parcel.obtain();
2255 Parcel reply = Parcel.obtain();
2256 data.writeInterfaceToken(IActivityManager.descriptor);
2257 data.writeStrongBinder(token);
2258 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2259 reply.readException();
2260 String res = reply.readString();
2261 data.recycle();
2262 reply.recycle();
2263 return res;
2264 }
2265 public ComponentName getCallingActivity(IBinder token)
2266 throws RemoteException {
2267 Parcel data = Parcel.obtain();
2268 Parcel reply = Parcel.obtain();
2269 data.writeInterfaceToken(IActivityManager.descriptor);
2270 data.writeStrongBinder(token);
2271 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2272 reply.readException();
2273 ComponentName res = ComponentName.readFromParcel(reply);
2274 data.recycle();
2275 reply.recycle();
2276 return res;
2277 }
2278 public List getTasks(int maxNum, int flags,
2279 IThumbnailReceiver receiver) throws RemoteException {
2280 Parcel data = Parcel.obtain();
2281 Parcel reply = Parcel.obtain();
2282 data.writeInterfaceToken(IActivityManager.descriptor);
2283 data.writeInt(maxNum);
2284 data.writeInt(flags);
2285 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2286 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2287 reply.readException();
2288 ArrayList list = null;
2289 int N = reply.readInt();
2290 if (N >= 0) {
2291 list = new ArrayList();
2292 while (N > 0) {
2293 ActivityManager.RunningTaskInfo info =
2294 ActivityManager.RunningTaskInfo.CREATOR
2295 .createFromParcel(reply);
2296 list.add(info);
2297 N--;
2298 }
2299 }
2300 data.recycle();
2301 reply.recycle();
2302 return list;
2303 }
2304 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002305 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002306 Parcel data = Parcel.obtain();
2307 Parcel reply = Parcel.obtain();
2308 data.writeInterfaceToken(IActivityManager.descriptor);
2309 data.writeInt(maxNum);
2310 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002311 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002312 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2313 reply.readException();
2314 ArrayList<ActivityManager.RecentTaskInfo> list
2315 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2316 data.recycle();
2317 reply.recycle();
2318 return list;
2319 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002320 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002321 Parcel data = Parcel.obtain();
2322 Parcel reply = Parcel.obtain();
2323 data.writeInterfaceToken(IActivityManager.descriptor);
2324 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002325 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002326 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002327 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002328 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002329 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002330 }
2331 data.recycle();
2332 reply.recycle();
2333 return bm;
2334 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002335 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2336 Parcel data = Parcel.obtain();
2337 Parcel reply = Parcel.obtain();
2338 data.writeInterfaceToken(IActivityManager.descriptor);
2339 data.writeInt(id);
2340 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2341 reply.readException();
2342 Bitmap bm = null;
2343 if (reply.readInt() != 0) {
2344 bm = Bitmap.CREATOR.createFromParcel(reply);
2345 }
2346 data.recycle();
2347 reply.recycle();
2348 return bm;
2349 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002350 public List getServices(int maxNum, int flags) throws RemoteException {
2351 Parcel data = Parcel.obtain();
2352 Parcel reply = Parcel.obtain();
2353 data.writeInterfaceToken(IActivityManager.descriptor);
2354 data.writeInt(maxNum);
2355 data.writeInt(flags);
2356 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2357 reply.readException();
2358 ArrayList list = null;
2359 int N = reply.readInt();
2360 if (N >= 0) {
2361 list = new ArrayList();
2362 while (N > 0) {
2363 ActivityManager.RunningServiceInfo info =
2364 ActivityManager.RunningServiceInfo.CREATOR
2365 .createFromParcel(reply);
2366 list.add(info);
2367 N--;
2368 }
2369 }
2370 data.recycle();
2371 reply.recycle();
2372 return list;
2373 }
2374 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2375 throws RemoteException {
2376 Parcel data = Parcel.obtain();
2377 Parcel reply = Parcel.obtain();
2378 data.writeInterfaceToken(IActivityManager.descriptor);
2379 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2380 reply.readException();
2381 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2382 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2383 data.recycle();
2384 reply.recycle();
2385 return list;
2386 }
2387 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2388 throws RemoteException {
2389 Parcel data = Parcel.obtain();
2390 Parcel reply = Parcel.obtain();
2391 data.writeInterfaceToken(IActivityManager.descriptor);
2392 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2393 reply.readException();
2394 ArrayList<ActivityManager.RunningAppProcessInfo> list
2395 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2396 data.recycle();
2397 reply.recycle();
2398 return list;
2399 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002400 public List<ApplicationInfo> getRunningExternalApplications()
2401 throws RemoteException {
2402 Parcel data = Parcel.obtain();
2403 Parcel reply = Parcel.obtain();
2404 data.writeInterfaceToken(IActivityManager.descriptor);
2405 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2406 reply.readException();
2407 ArrayList<ApplicationInfo> list
2408 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2409 data.recycle();
2410 reply.recycle();
2411 return list;
2412 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002413 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002414 {
2415 Parcel data = Parcel.obtain();
2416 Parcel reply = Parcel.obtain();
2417 data.writeInterfaceToken(IActivityManager.descriptor);
2418 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002419 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002420 if (options != null) {
2421 data.writeInt(1);
2422 options.writeToParcel(data, 0);
2423 } else {
2424 data.writeInt(0);
2425 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002426 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2427 reply.readException();
2428 data.recycle();
2429 reply.recycle();
2430 }
2431 public void moveTaskToBack(int task) throws RemoteException
2432 {
2433 Parcel data = Parcel.obtain();
2434 Parcel reply = Parcel.obtain();
2435 data.writeInterfaceToken(IActivityManager.descriptor);
2436 data.writeInt(task);
2437 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2438 reply.readException();
2439 data.recycle();
2440 reply.recycle();
2441 }
2442 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2443 throws RemoteException {
2444 Parcel data = Parcel.obtain();
2445 Parcel reply = Parcel.obtain();
2446 data.writeInterfaceToken(IActivityManager.descriptor);
2447 data.writeStrongBinder(token);
2448 data.writeInt(nonRoot ? 1 : 0);
2449 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2450 reply.readException();
2451 boolean res = reply.readInt() != 0;
2452 data.recycle();
2453 reply.recycle();
2454 return res;
2455 }
2456 public void moveTaskBackwards(int task) throws RemoteException
2457 {
2458 Parcel data = Parcel.obtain();
2459 Parcel reply = Parcel.obtain();
2460 data.writeInterfaceToken(IActivityManager.descriptor);
2461 data.writeInt(task);
2462 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2463 reply.readException();
2464 data.recycle();
2465 reply.recycle();
2466 }
2467 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2468 {
2469 Parcel data = Parcel.obtain();
2470 Parcel reply = Parcel.obtain();
2471 data.writeInterfaceToken(IActivityManager.descriptor);
2472 data.writeStrongBinder(token);
2473 data.writeInt(onlyRoot ? 1 : 0);
2474 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2475 reply.readException();
2476 int res = reply.readInt();
2477 data.recycle();
2478 reply.recycle();
2479 return res;
2480 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002481 public void reportThumbnail(IBinder token,
2482 Bitmap thumbnail, CharSequence description) throws RemoteException
2483 {
2484 Parcel data = Parcel.obtain();
2485 Parcel reply = Parcel.obtain();
2486 data.writeInterfaceToken(IActivityManager.descriptor);
2487 data.writeStrongBinder(token);
2488 if (thumbnail != null) {
2489 data.writeInt(1);
2490 thumbnail.writeToParcel(data, 0);
2491 } else {
2492 data.writeInt(0);
2493 }
2494 TextUtils.writeToParcel(description, data, 0);
2495 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2496 reply.readException();
2497 data.recycle();
2498 reply.recycle();
2499 }
2500 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002501 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002502 Parcel data = Parcel.obtain();
2503 Parcel reply = Parcel.obtain();
2504 data.writeInterfaceToken(IActivityManager.descriptor);
2505 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2506 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002507 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002508 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002509 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 int res = reply.readInt();
2512 ContentProviderHolder cph = null;
2513 if (res != 0) {
2514 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2515 }
2516 data.recycle();
2517 reply.recycle();
2518 return cph;
2519 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002520 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2521 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002522 Parcel data = Parcel.obtain();
2523 Parcel reply = Parcel.obtain();
2524 data.writeInterfaceToken(IActivityManager.descriptor);
2525 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002526 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002527 data.writeStrongBinder(token);
2528 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2529 reply.readException();
2530 int res = reply.readInt();
2531 ContentProviderHolder cph = null;
2532 if (res != 0) {
2533 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2534 }
2535 data.recycle();
2536 reply.recycle();
2537 return cph;
2538 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002539 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002540 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002541 {
2542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2546 data.writeTypedList(providers);
2547 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2548 reply.readException();
2549 data.recycle();
2550 reply.recycle();
2551 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002552 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2553 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002554 Parcel data = Parcel.obtain();
2555 Parcel reply = Parcel.obtain();
2556 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002557 data.writeStrongBinder(connection);
2558 data.writeInt(stable);
2559 data.writeInt(unstable);
2560 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2561 reply.readException();
2562 boolean res = reply.readInt() != 0;
2563 data.recycle();
2564 reply.recycle();
2565 return res;
2566 }
2567 public void unstableProviderDied(IBinder connection) throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 data.writeStrongBinder(connection);
2572 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2573 reply.readException();
2574 data.recycle();
2575 reply.recycle();
2576 }
2577
2578 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2579 Parcel data = Parcel.obtain();
2580 Parcel reply = Parcel.obtain();
2581 data.writeInterfaceToken(IActivityManager.descriptor);
2582 data.writeStrongBinder(connection);
2583 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002584 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 data.recycle();
2587 reply.recycle();
2588 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002589
2590 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2591 Parcel data = Parcel.obtain();
2592 Parcel reply = Parcel.obtain();
2593 data.writeInterfaceToken(IActivityManager.descriptor);
2594 data.writeString(name);
2595 data.writeStrongBinder(token);
2596 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2597 reply.readException();
2598 data.recycle();
2599 reply.recycle();
2600 }
2601
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002602 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2603 throws RemoteException
2604 {
2605 Parcel data = Parcel.obtain();
2606 Parcel reply = Parcel.obtain();
2607 data.writeInterfaceToken(IActivityManager.descriptor);
2608 service.writeToParcel(data, 0);
2609 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2610 reply.readException();
2611 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2612 data.recycle();
2613 reply.recycle();
2614 return res;
2615 }
2616
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002617 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002618 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002619 {
2620 Parcel data = Parcel.obtain();
2621 Parcel reply = Parcel.obtain();
2622 data.writeInterfaceToken(IActivityManager.descriptor);
2623 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2624 service.writeToParcel(data, 0);
2625 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002626 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002627 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2628 reply.readException();
2629 ComponentName res = ComponentName.readFromParcel(reply);
2630 data.recycle();
2631 reply.recycle();
2632 return res;
2633 }
2634 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002635 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002636 {
2637 Parcel data = Parcel.obtain();
2638 Parcel reply = Parcel.obtain();
2639 data.writeInterfaceToken(IActivityManager.descriptor);
2640 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2641 service.writeToParcel(data, 0);
2642 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002643 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002644 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2645 reply.readException();
2646 int res = reply.readInt();
2647 reply.recycle();
2648 data.recycle();
2649 return res;
2650 }
2651 public boolean stopServiceToken(ComponentName className, IBinder token,
2652 int startId) throws RemoteException {
2653 Parcel data = Parcel.obtain();
2654 Parcel reply = Parcel.obtain();
2655 data.writeInterfaceToken(IActivityManager.descriptor);
2656 ComponentName.writeToParcel(className, data);
2657 data.writeStrongBinder(token);
2658 data.writeInt(startId);
2659 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2660 reply.readException();
2661 boolean res = reply.readInt() != 0;
2662 data.recycle();
2663 reply.recycle();
2664 return res;
2665 }
2666 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002667 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002668 Parcel data = Parcel.obtain();
2669 Parcel reply = Parcel.obtain();
2670 data.writeInterfaceToken(IActivityManager.descriptor);
2671 ComponentName.writeToParcel(className, data);
2672 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002673 data.writeInt(id);
2674 if (notification != null) {
2675 data.writeInt(1);
2676 notification.writeToParcel(data, 0);
2677 } else {
2678 data.writeInt(0);
2679 }
2680 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002681 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2682 reply.readException();
2683 data.recycle();
2684 reply.recycle();
2685 }
2686 public int bindService(IApplicationThread caller, IBinder token,
2687 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002688 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2693 data.writeStrongBinder(token);
2694 service.writeToParcel(data, 0);
2695 data.writeString(resolvedType);
2696 data.writeStrongBinder(connection.asBinder());
2697 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002698 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002699 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2700 reply.readException();
2701 int res = reply.readInt();
2702 data.recycle();
2703 reply.recycle();
2704 return res;
2705 }
2706 public boolean unbindService(IServiceConnection connection) throws RemoteException
2707 {
2708 Parcel data = Parcel.obtain();
2709 Parcel reply = Parcel.obtain();
2710 data.writeInterfaceToken(IActivityManager.descriptor);
2711 data.writeStrongBinder(connection.asBinder());
2712 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 boolean res = reply.readInt() != 0;
2715 data.recycle();
2716 reply.recycle();
2717 return res;
2718 }
2719
2720 public void publishService(IBinder token,
2721 Intent intent, IBinder service) throws RemoteException {
2722 Parcel data = Parcel.obtain();
2723 Parcel reply = Parcel.obtain();
2724 data.writeInterfaceToken(IActivityManager.descriptor);
2725 data.writeStrongBinder(token);
2726 intent.writeToParcel(data, 0);
2727 data.writeStrongBinder(service);
2728 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 data.recycle();
2731 reply.recycle();
2732 }
2733
2734 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2735 throws RemoteException {
2736 Parcel data = Parcel.obtain();
2737 Parcel reply = Parcel.obtain();
2738 data.writeInterfaceToken(IActivityManager.descriptor);
2739 data.writeStrongBinder(token);
2740 intent.writeToParcel(data, 0);
2741 data.writeInt(doRebind ? 1 : 0);
2742 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2743 reply.readException();
2744 data.recycle();
2745 reply.recycle();
2746 }
2747
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002748 public void serviceDoneExecuting(IBinder token, int type, int startId,
2749 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002750 Parcel data = Parcel.obtain();
2751 Parcel reply = Parcel.obtain();
2752 data.writeInterfaceToken(IActivityManager.descriptor);
2753 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002754 data.writeInt(type);
2755 data.writeInt(startId);
2756 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002757 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2758 reply.readException();
2759 data.recycle();
2760 reply.recycle();
2761 }
2762
2763 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2764 Parcel data = Parcel.obtain();
2765 Parcel reply = Parcel.obtain();
2766 data.writeInterfaceToken(IActivityManager.descriptor);
2767 service.writeToParcel(data, 0);
2768 data.writeString(resolvedType);
2769 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2770 reply.readException();
2771 IBinder binder = reply.readStrongBinder();
2772 reply.recycle();
2773 data.recycle();
2774 return binder;
2775 }
2776
Christopher Tate181fafa2009-05-14 11:12:14 -07002777 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2778 throws RemoteException {
2779 Parcel data = Parcel.obtain();
2780 Parcel reply = Parcel.obtain();
2781 data.writeInterfaceToken(IActivityManager.descriptor);
2782 app.writeToParcel(data, 0);
2783 data.writeInt(backupRestoreMode);
2784 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2785 reply.readException();
2786 boolean success = reply.readInt() != 0;
2787 reply.recycle();
2788 data.recycle();
2789 return success;
2790 }
2791
2792 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2793 Parcel data = Parcel.obtain();
2794 Parcel reply = Parcel.obtain();
2795 data.writeInterfaceToken(IActivityManager.descriptor);
2796 data.writeString(packageName);
2797 data.writeStrongBinder(agent);
2798 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2799 reply.recycle();
2800 data.recycle();
2801 }
2802
2803 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2804 Parcel data = Parcel.obtain();
2805 Parcel reply = Parcel.obtain();
2806 data.writeInterfaceToken(IActivityManager.descriptor);
2807 app.writeToParcel(data, 0);
2808 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 reply.recycle();
2811 data.recycle();
2812 }
2813
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002814 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002815 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 throws RemoteException {
2817 Parcel data = Parcel.obtain();
2818 Parcel reply = Parcel.obtain();
2819 data.writeInterfaceToken(IActivityManager.descriptor);
2820 ComponentName.writeToParcel(className, data);
2821 data.writeString(profileFile);
2822 data.writeInt(flags);
2823 data.writeBundle(arguments);
2824 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002825 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002826 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 boolean res = reply.readInt() != 0;
2829 reply.recycle();
2830 data.recycle();
2831 return res;
2832 }
2833
2834 public void finishInstrumentation(IApplicationThread target,
2835 int resultCode, Bundle results) throws RemoteException {
2836 Parcel data = Parcel.obtain();
2837 Parcel reply = Parcel.obtain();
2838 data.writeInterfaceToken(IActivityManager.descriptor);
2839 data.writeStrongBinder(target != null ? target.asBinder() : null);
2840 data.writeInt(resultCode);
2841 data.writeBundle(results);
2842 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2843 reply.readException();
2844 data.recycle();
2845 reply.recycle();
2846 }
2847 public Configuration getConfiguration() throws RemoteException
2848 {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2853 reply.readException();
2854 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2855 reply.recycle();
2856 data.recycle();
2857 return res;
2858 }
2859 public void updateConfiguration(Configuration values) throws RemoteException
2860 {
2861 Parcel data = Parcel.obtain();
2862 Parcel reply = Parcel.obtain();
2863 data.writeInterfaceToken(IActivityManager.descriptor);
2864 values.writeToParcel(data, 0);
2865 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2866 reply.readException();
2867 data.recycle();
2868 reply.recycle();
2869 }
2870 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2871 throws RemoteException {
2872 Parcel data = Parcel.obtain();
2873 Parcel reply = Parcel.obtain();
2874 data.writeInterfaceToken(IActivityManager.descriptor);
2875 data.writeStrongBinder(token);
2876 data.writeInt(requestedOrientation);
2877 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2878 reply.readException();
2879 data.recycle();
2880 reply.recycle();
2881 }
2882 public int getRequestedOrientation(IBinder token) throws RemoteException {
2883 Parcel data = Parcel.obtain();
2884 Parcel reply = Parcel.obtain();
2885 data.writeInterfaceToken(IActivityManager.descriptor);
2886 data.writeStrongBinder(token);
2887 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2888 reply.readException();
2889 int res = reply.readInt();
2890 data.recycle();
2891 reply.recycle();
2892 return res;
2893 }
2894 public ComponentName getActivityClassForToken(IBinder token)
2895 throws RemoteException {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeStrongBinder(token);
2900 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 ComponentName res = ComponentName.readFromParcel(reply);
2903 data.recycle();
2904 reply.recycle();
2905 return res;
2906 }
2907 public String getPackageForToken(IBinder token) throws RemoteException
2908 {
2909 Parcel data = Parcel.obtain();
2910 Parcel reply = Parcel.obtain();
2911 data.writeInterfaceToken(IActivityManager.descriptor);
2912 data.writeStrongBinder(token);
2913 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2914 reply.readException();
2915 String res = reply.readString();
2916 data.recycle();
2917 reply.recycle();
2918 return res;
2919 }
2920 public IIntentSender getIntentSender(int type,
2921 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002922 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002923 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002924 Parcel data = Parcel.obtain();
2925 Parcel reply = Parcel.obtain();
2926 data.writeInterfaceToken(IActivityManager.descriptor);
2927 data.writeInt(type);
2928 data.writeString(packageName);
2929 data.writeStrongBinder(token);
2930 data.writeString(resultWho);
2931 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002932 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002934 data.writeTypedArray(intents, 0);
2935 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002936 } else {
2937 data.writeInt(0);
2938 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002939 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002940 if (options != null) {
2941 data.writeInt(1);
2942 options.writeToParcel(data, 0);
2943 } else {
2944 data.writeInt(0);
2945 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002946 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002947 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 IIntentSender res = IIntentSender.Stub.asInterface(
2950 reply.readStrongBinder());
2951 data.recycle();
2952 reply.recycle();
2953 return res;
2954 }
2955 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
2958 data.writeInterfaceToken(IActivityManager.descriptor);
2959 data.writeStrongBinder(sender.asBinder());
2960 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2961 reply.readException();
2962 data.recycle();
2963 reply.recycle();
2964 }
2965 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
2969 data.writeStrongBinder(sender.asBinder());
2970 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2971 reply.readException();
2972 String res = reply.readString();
2973 data.recycle();
2974 reply.recycle();
2975 return res;
2976 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002977 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2978 Parcel data = Parcel.obtain();
2979 Parcel reply = Parcel.obtain();
2980 data.writeInterfaceToken(IActivityManager.descriptor);
2981 data.writeStrongBinder(sender.asBinder());
2982 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2983 reply.readException();
2984 int res = reply.readInt();
2985 data.recycle();
2986 reply.recycle();
2987 return res;
2988 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002989 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2990 boolean requireFull, String name, String callerPackage) throws RemoteException {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeInt(callingPid);
2995 data.writeInt(callingUid);
2996 data.writeInt(userId);
2997 data.writeInt(allowAll ? 1 : 0);
2998 data.writeInt(requireFull ? 1 : 0);
2999 data.writeString(name);
3000 data.writeString(callerPackage);
3001 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3002 reply.readException();
3003 int res = reply.readInt();
3004 data.recycle();
3005 reply.recycle();
3006 return res;
3007 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 public void setProcessLimit(int max) throws RemoteException
3009 {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeInt(max);
3014 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3015 reply.readException();
3016 data.recycle();
3017 reply.recycle();
3018 }
3019 public int getProcessLimit() throws RemoteException
3020 {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3025 reply.readException();
3026 int res = reply.readInt();
3027 data.recycle();
3028 reply.recycle();
3029 return res;
3030 }
3031 public void setProcessForeground(IBinder token, int pid,
3032 boolean isForeground) throws RemoteException {
3033 Parcel data = Parcel.obtain();
3034 Parcel reply = Parcel.obtain();
3035 data.writeInterfaceToken(IActivityManager.descriptor);
3036 data.writeStrongBinder(token);
3037 data.writeInt(pid);
3038 data.writeInt(isForeground ? 1 : 0);
3039 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3040 reply.readException();
3041 data.recycle();
3042 reply.recycle();
3043 }
3044 public int checkPermission(String permission, int pid, int uid)
3045 throws RemoteException {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 data.writeString(permission);
3050 data.writeInt(pid);
3051 data.writeInt(uid);
3052 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 int res = reply.readInt();
3055 data.recycle();
3056 reply.recycle();
3057 return res;
3058 }
3059 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003060 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 data.writeString(packageName);
3065 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003066 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003067 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3068 reply.readException();
3069 boolean res = reply.readInt() != 0;
3070 data.recycle();
3071 reply.recycle();
3072 return res;
3073 }
3074 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3075 throws RemoteException {
3076 Parcel data = Parcel.obtain();
3077 Parcel reply = Parcel.obtain();
3078 data.writeInterfaceToken(IActivityManager.descriptor);
3079 uri.writeToParcel(data, 0);
3080 data.writeInt(pid);
3081 data.writeInt(uid);
3082 data.writeInt(mode);
3083 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 int res = reply.readInt();
3086 data.recycle();
3087 reply.recycle();
3088 return res;
3089 }
3090 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3091 Uri uri, int mode) throws RemoteException {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeStrongBinder(caller.asBinder());
3096 data.writeString(targetPkg);
3097 uri.writeToParcel(data, 0);
3098 data.writeInt(mode);
3099 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3100 reply.readException();
3101 data.recycle();
3102 reply.recycle();
3103 }
3104 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3105 int mode) throws RemoteException {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 data.writeStrongBinder(caller.asBinder());
3110 uri.writeToParcel(data, 0);
3111 data.writeInt(mode);
3112 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3113 reply.readException();
3114 data.recycle();
3115 reply.recycle();
3116 }
3117 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3118 throws RemoteException {
3119 Parcel data = Parcel.obtain();
3120 Parcel reply = Parcel.obtain();
3121 data.writeInterfaceToken(IActivityManager.descriptor);
3122 data.writeStrongBinder(who.asBinder());
3123 data.writeInt(waiting ? 1 : 0);
3124 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3125 reply.readException();
3126 data.recycle();
3127 reply.recycle();
3128 }
3129 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3130 Parcel data = Parcel.obtain();
3131 Parcel reply = Parcel.obtain();
3132 data.writeInterfaceToken(IActivityManager.descriptor);
3133 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3134 reply.readException();
3135 outInfo.readFromParcel(reply);
3136 data.recycle();
3137 reply.recycle();
3138 }
3139 public void unhandledBack() throws RemoteException
3140 {
3141 Parcel data = Parcel.obtain();
3142 Parcel reply = Parcel.obtain();
3143 data.writeInterfaceToken(IActivityManager.descriptor);
3144 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 data.recycle();
3147 reply.recycle();
3148 }
3149 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3150 {
3151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
3154 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3155 reply.readException();
3156 ParcelFileDescriptor pfd = null;
3157 if (reply.readInt() != 0) {
3158 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3159 }
3160 data.recycle();
3161 reply.recycle();
3162 return pfd;
3163 }
3164 public void goingToSleep() throws RemoteException
3165 {
3166 Parcel data = Parcel.obtain();
3167 Parcel reply = Parcel.obtain();
3168 data.writeInterfaceToken(IActivityManager.descriptor);
3169 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3170 reply.readException();
3171 data.recycle();
3172 reply.recycle();
3173 }
3174 public void wakingUp() throws RemoteException
3175 {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 data.recycle();
3182 reply.recycle();
3183 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003184 public void setLockScreenShown(boolean shown) throws RemoteException
3185 {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 data.writeInt(shown ? 1 : 0);
3190 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3191 reply.readException();
3192 data.recycle();
3193 reply.recycle();
3194 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003195 public void setDebugApp(
3196 String packageName, boolean waitForDebugger, boolean persistent)
3197 throws RemoteException
3198 {
3199 Parcel data = Parcel.obtain();
3200 Parcel reply = Parcel.obtain();
3201 data.writeInterfaceToken(IActivityManager.descriptor);
3202 data.writeString(packageName);
3203 data.writeInt(waitForDebugger ? 1 : 0);
3204 data.writeInt(persistent ? 1 : 0);
3205 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3206 reply.readException();
3207 data.recycle();
3208 reply.recycle();
3209 }
3210 public void setAlwaysFinish(boolean enabled) throws RemoteException
3211 {
3212 Parcel data = Parcel.obtain();
3213 Parcel reply = Parcel.obtain();
3214 data.writeInterfaceToken(IActivityManager.descriptor);
3215 data.writeInt(enabled ? 1 : 0);
3216 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3217 reply.readException();
3218 data.recycle();
3219 reply.recycle();
3220 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003221 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 {
3223 Parcel data = Parcel.obtain();
3224 Parcel reply = Parcel.obtain();
3225 data.writeInterfaceToken(IActivityManager.descriptor);
3226 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003227 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003228 reply.readException();
3229 data.recycle();
3230 reply.recycle();
3231 }
3232 public void enterSafeMode() throws RemoteException {
3233 Parcel data = Parcel.obtain();
3234 data.writeInterfaceToken(IActivityManager.descriptor);
3235 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3236 data.recycle();
3237 }
3238 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3239 Parcel data = Parcel.obtain();
3240 data.writeStrongBinder(sender.asBinder());
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3243 data.recycle();
3244 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003245 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003246 Parcel data = Parcel.obtain();
3247 Parcel reply = Parcel.obtain();
3248 data.writeInterfaceToken(IActivityManager.descriptor);
3249 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003250 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003251 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003252 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003253 boolean res = reply.readInt() != 0;
3254 data.recycle();
3255 reply.recycle();
3256 return res;
3257 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003258 @Override
3259 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 data.writeString(reason);
3264 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3265 boolean res = reply.readInt() != 0;
3266 data.recycle();
3267 reply.recycle();
3268 return res;
3269 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003270 public void startRunning(String pkg, String cls, String action,
3271 String indata) throws RemoteException {
3272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeString(pkg);
3276 data.writeString(cls);
3277 data.writeString(action);
3278 data.writeString(indata);
3279 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3280 reply.readException();
3281 data.recycle();
3282 reply.recycle();
3283 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003284 public boolean testIsSystemReady()
3285 {
3286 /* this base class version is never called */
3287 return true;
3288 }
Dan Egnor60d87622009-12-16 16:32:58 -08003289 public void handleApplicationCrash(IBinder app,
3290 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3291 {
3292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeStrongBinder(app);
3296 crashInfo.writeToParcel(data, 0);
3297 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3298 reply.readException();
3299 reply.recycle();
3300 data.recycle();
3301 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003302
Dan Egnor60d87622009-12-16 16:32:58 -08003303 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003304 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003305 {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
3309 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003310 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003311 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003312 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003313 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003314 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003315 reply.recycle();
3316 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003317 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003319
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003320 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003321 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003322 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003323 {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003328 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003329 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003330 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3331 reply.readException();
3332 reply.recycle();
3333 data.recycle();
3334 }
3335
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003336 public void signalPersistentProcesses(int sig) throws RemoteException {
3337 Parcel data = Parcel.obtain();
3338 Parcel reply = Parcel.obtain();
3339 data.writeInterfaceToken(IActivityManager.descriptor);
3340 data.writeInt(sig);
3341 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 data.recycle();
3344 reply.recycle();
3345 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003346
Dianne Hackborn1676c852012-09-10 14:52:30 -07003347 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003352 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003353 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3354 reply.readException();
3355 data.recycle();
3356 reply.recycle();
3357 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003358
3359 public void killAllBackgroundProcesses() throws RemoteException {
3360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 data.recycle();
3366 reply.recycle();
3367 }
3368
Dianne Hackborn1676c852012-09-10 14:52:30 -07003369 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003370 Parcel data = Parcel.obtain();
3371 Parcel reply = Parcel.obtain();
3372 data.writeInterfaceToken(IActivityManager.descriptor);
3373 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003374 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003375 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003376 reply.readException();
3377 data.recycle();
3378 reply.recycle();
3379 }
3380
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003381 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3382 throws RemoteException
3383 {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3388 reply.readException();
3389 outInfo.readFromParcel(reply);
3390 reply.recycle();
3391 data.recycle();
3392 }
3393
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003394 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3395 {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3400 reply.readException();
3401 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3402 reply.recycle();
3403 data.recycle();
3404 return res;
3405 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003406
Dianne Hackborn1676c852012-09-10 14:52:30 -07003407 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003408 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003409 {
3410 Parcel data = Parcel.obtain();
3411 Parcel reply = Parcel.obtain();
3412 data.writeInterfaceToken(IActivityManager.descriptor);
3413 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003414 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003415 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003416 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003417 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003418 if (fd != null) {
3419 data.writeInt(1);
3420 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3421 } else {
3422 data.writeInt(0);
3423 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003424 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 boolean res = reply.readInt() != 0;
3427 reply.recycle();
3428 data.recycle();
3429 return res;
3430 }
3431
Dianne Hackborn55280a92009-05-07 15:53:46 -07003432 public boolean shutdown(int timeout) throws RemoteException
3433 {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 data.writeInt(timeout);
3438 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3439 reply.readException();
3440 boolean res = reply.readInt() != 0;
3441 reply.recycle();
3442 data.recycle();
3443 return res;
3444 }
3445
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003446 public void stopAppSwitches() throws RemoteException {
3447 Parcel data = Parcel.obtain();
3448 Parcel reply = Parcel.obtain();
3449 data.writeInterfaceToken(IActivityManager.descriptor);
3450 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3451 reply.readException();
3452 reply.recycle();
3453 data.recycle();
3454 }
3455
3456 public void resumeAppSwitches() throws RemoteException {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3461 reply.readException();
3462 reply.recycle();
3463 data.recycle();
3464 }
3465
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003466 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003471 data.writeInt(appid);
3472 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003473 reply.readException();
3474 data.recycle();
3475 reply.recycle();
3476 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003477
3478 public void closeSystemDialogs(String reason) throws RemoteException {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
3482 data.writeString(reason);
3483 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 data.recycle();
3486 reply.recycle();
3487 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003488
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003489 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003490 throws RemoteException {
3491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003494 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003495 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3496 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003497 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003498 data.recycle();
3499 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003500 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003501 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003502
3503 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3504 Parcel data = Parcel.obtain();
3505 Parcel reply = Parcel.obtain();
3506 data.writeInterfaceToken(IActivityManager.descriptor);
3507 data.writeString(processName);
3508 data.writeInt(uid);
3509 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3510 reply.readException();
3511 data.recycle();
3512 reply.recycle();
3513 }
3514
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003515 public void overridePendingTransition(IBinder token, String packageName,
3516 int enterAnim, int exitAnim) throws RemoteException {
3517 Parcel data = Parcel.obtain();
3518 Parcel reply = Parcel.obtain();
3519 data.writeInterfaceToken(IActivityManager.descriptor);
3520 data.writeStrongBinder(token);
3521 data.writeString(packageName);
3522 data.writeInt(enterAnim);
3523 data.writeInt(exitAnim);
3524 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 data.recycle();
3527 reply.recycle();
3528 }
3529
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003530 public boolean isUserAMonkey() throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 boolean res = reply.readInt() != 0;
3537 data.recycle();
3538 reply.recycle();
3539 return res;
3540 }
3541
Dianne Hackborn860755f2010-06-03 18:47:52 -07003542 public void finishHeavyWeightApp() throws RemoteException {
3543 Parcel data = Parcel.obtain();
3544 Parcel reply = Parcel.obtain();
3545 data.writeInterfaceToken(IActivityManager.descriptor);
3546 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3547 reply.readException();
3548 data.recycle();
3549 reply.recycle();
3550 }
3551
Daniel Sandler69a48172010-06-23 16:29:36 -04003552 public void setImmersive(IBinder token, boolean immersive)
3553 throws RemoteException {
3554 Parcel data = Parcel.obtain();
3555 Parcel reply = Parcel.obtain();
3556 data.writeInterfaceToken(IActivityManager.descriptor);
3557 data.writeStrongBinder(token);
3558 data.writeInt(immersive ? 1 : 0);
3559 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3560 reply.readException();
3561 data.recycle();
3562 reply.recycle();
3563 }
3564
3565 public boolean isImmersive(IBinder token)
3566 throws RemoteException {
3567 Parcel data = Parcel.obtain();
3568 Parcel reply = Parcel.obtain();
3569 data.writeInterfaceToken(IActivityManager.descriptor);
3570 data.writeStrongBinder(token);
3571 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003572 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003573 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003574 data.recycle();
3575 reply.recycle();
3576 return res;
3577 }
3578
3579 public boolean isTopActivityImmersive()
3580 throws RemoteException {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003585 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003586 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003587 data.recycle();
3588 reply.recycle();
3589 return res;
3590 }
3591
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003592 public void crashApplication(int uid, int initialPid, String packageName,
3593 String message) throws RemoteException {
3594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 data.writeInt(uid);
3598 data.writeInt(initialPid);
3599 data.writeString(packageName);
3600 data.writeString(message);
3601 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3602 reply.readException();
3603 data.recycle();
3604 reply.recycle();
3605 }
Andy McFadden824c5102010-07-09 16:26:57 -07003606
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003607 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003612 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003613 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 String res = reply.readString();
3616 data.recycle();
3617 reply.recycle();
3618 return res;
3619 }
3620
Dianne Hackborn7e269642010-08-25 19:50:20 -07003621 public IBinder newUriPermissionOwner(String name)
3622 throws RemoteException {
3623 Parcel data = Parcel.obtain();
3624 Parcel reply = Parcel.obtain();
3625 data.writeInterfaceToken(IActivityManager.descriptor);
3626 data.writeString(name);
3627 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3628 reply.readException();
3629 IBinder res = reply.readStrongBinder();
3630 data.recycle();
3631 reply.recycle();
3632 return res;
3633 }
3634
3635 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3636 Uri uri, int mode) throws RemoteException {
3637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 data.writeStrongBinder(owner);
3641 data.writeInt(fromUid);
3642 data.writeString(targetPkg);
3643 uri.writeToParcel(data, 0);
3644 data.writeInt(mode);
3645 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3646 reply.readException();
3647 data.recycle();
3648 reply.recycle();
3649 }
3650
3651 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3652 int mode) throws RemoteException {
3653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeStrongBinder(owner);
3657 if (uri != null) {
3658 data.writeInt(1);
3659 uri.writeToParcel(data, 0);
3660 } else {
3661 data.writeInt(0);
3662 }
3663 data.writeInt(mode);
3664 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3665 reply.readException();
3666 data.recycle();
3667 reply.recycle();
3668 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003669
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003670 public int checkGrantUriPermission(int callingUid, String targetPkg,
3671 Uri uri, int modeFlags) throws RemoteException {
3672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 data.writeInt(callingUid);
3676 data.writeString(targetPkg);
3677 uri.writeToParcel(data, 0);
3678 data.writeInt(modeFlags);
3679 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3680 reply.readException();
3681 int res = reply.readInt();
3682 data.recycle();
3683 reply.recycle();
3684 return res;
3685 }
3686
Dianne Hackborn1676c852012-09-10 14:52:30 -07003687 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003688 String path, ParcelFileDescriptor fd) throws RemoteException {
3689 Parcel data = Parcel.obtain();
3690 Parcel reply = Parcel.obtain();
3691 data.writeInterfaceToken(IActivityManager.descriptor);
3692 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003693 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003694 data.writeInt(managed ? 1 : 0);
3695 data.writeString(path);
3696 if (fd != null) {
3697 data.writeInt(1);
3698 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3699 } else {
3700 data.writeInt(0);
3701 }
3702 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3703 reply.readException();
3704 boolean res = reply.readInt() != 0;
3705 reply.recycle();
3706 data.recycle();
3707 return res;
3708 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003709
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003710 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003711 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003712 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003713 Parcel data = Parcel.obtain();
3714 Parcel reply = Parcel.obtain();
3715 data.writeInterfaceToken(IActivityManager.descriptor);
3716 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3717 data.writeTypedArray(intents, 0);
3718 data.writeStringArray(resolvedTypes);
3719 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003720 if (options != null) {
3721 data.writeInt(1);
3722 options.writeToParcel(data, 0);
3723 } else {
3724 data.writeInt(0);
3725 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003726 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003727 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 int result = reply.readInt();
3730 reply.recycle();
3731 data.recycle();
3732 return result;
3733 }
3734
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003735 public int getFrontActivityScreenCompatMode() throws RemoteException {
3736 Parcel data = Parcel.obtain();
3737 Parcel reply = Parcel.obtain();
3738 data.writeInterfaceToken(IActivityManager.descriptor);
3739 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3740 reply.readException();
3741 int mode = reply.readInt();
3742 reply.recycle();
3743 data.recycle();
3744 return mode;
3745 }
3746
3747 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
3750 data.writeInterfaceToken(IActivityManager.descriptor);
3751 data.writeInt(mode);
3752 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3753 reply.readException();
3754 reply.recycle();
3755 data.recycle();
3756 }
3757
3758 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003762 data.writeString(packageName);
3763 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003764 reply.readException();
3765 int mode = reply.readInt();
3766 reply.recycle();
3767 data.recycle();
3768 return mode;
3769 }
3770
3771 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003772 throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003777 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003778 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3779 reply.readException();
3780 reply.recycle();
3781 data.recycle();
3782 }
3783
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003784 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3785 Parcel data = Parcel.obtain();
3786 Parcel reply = Parcel.obtain();
3787 data.writeInterfaceToken(IActivityManager.descriptor);
3788 data.writeString(packageName);
3789 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 boolean ask = reply.readInt() != 0;
3792 reply.recycle();
3793 data.recycle();
3794 return ask;
3795 }
3796
3797 public void setPackageAskScreenCompat(String packageName, boolean ask)
3798 throws RemoteException {
3799 Parcel data = Parcel.obtain();
3800 Parcel reply = Parcel.obtain();
3801 data.writeInterfaceToken(IActivityManager.descriptor);
3802 data.writeString(packageName);
3803 data.writeInt(ask ? 1 : 0);
3804 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 reply.recycle();
3807 data.recycle();
3808 }
3809
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003810 public boolean switchUser(int userid) throws RemoteException {
3811 Parcel data = Parcel.obtain();
3812 Parcel reply = Parcel.obtain();
3813 data.writeInterfaceToken(IActivityManager.descriptor);
3814 data.writeInt(userid);
3815 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3816 reply.readException();
3817 boolean result = reply.readInt() != 0;
3818 reply.recycle();
3819 data.recycle();
3820 return result;
3821 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003822
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003823 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3824 Parcel data = Parcel.obtain();
3825 Parcel reply = Parcel.obtain();
3826 data.writeInterfaceToken(IActivityManager.descriptor);
3827 data.writeInt(userid);
3828 data.writeStrongInterface(callback);
3829 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 int result = reply.readInt();
3832 reply.recycle();
3833 data.recycle();
3834 return result;
3835 }
3836
Amith Yamasani52f1d752012-03-28 18:19:29 -07003837 public UserInfo getCurrentUser() throws RemoteException {
3838 Parcel data = Parcel.obtain();
3839 Parcel reply = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003841 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003842 reply.readException();
3843 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3844 reply.recycle();
3845 data.recycle();
3846 return userInfo;
3847 }
3848
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003849 public boolean isUserRunning(int userid) throws RemoteException {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 data.writeInt(userid);
3854 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3855 reply.readException();
3856 boolean result = reply.readInt() != 0;
3857 reply.recycle();
3858 data.recycle();
3859 return result;
3860 }
3861
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003862 public int[] getRunningUserIds() throws RemoteException {
3863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3867 reply.readException();
3868 int[] result = reply.createIntArray();
3869 reply.recycle();
3870 data.recycle();
3871 return result;
3872 }
3873
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003874 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3875 Parcel data = Parcel.obtain();
3876 Parcel reply = Parcel.obtain();
3877 data.writeInterfaceToken(IActivityManager.descriptor);
3878 data.writeInt(taskId);
3879 data.writeInt(subTaskIndex);
3880 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3881 reply.readException();
3882 boolean result = reply.readInt() != 0;
3883 reply.recycle();
3884 data.recycle();
3885 return result;
3886 }
3887
3888 public boolean removeTask(int taskId, int flags) throws RemoteException {
3889 Parcel data = Parcel.obtain();
3890 Parcel reply = Parcel.obtain();
3891 data.writeInterfaceToken(IActivityManager.descriptor);
3892 data.writeInt(taskId);
3893 data.writeInt(flags);
3894 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3895 reply.readException();
3896 boolean result = reply.readInt() != 0;
3897 reply.recycle();
3898 data.recycle();
3899 return result;
3900 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003901
Jeff Sharkeya4620792011-05-20 15:29:23 -07003902 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3903 Parcel data = Parcel.obtain();
3904 Parcel reply = Parcel.obtain();
3905 data.writeInterfaceToken(IActivityManager.descriptor);
3906 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3907 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3908 reply.readException();
3909 data.recycle();
3910 reply.recycle();
3911 }
3912
3913 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
3917 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3918 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3919 reply.readException();
3920 data.recycle();
3921 reply.recycle();
3922 }
3923
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003924 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3925 Parcel data = Parcel.obtain();
3926 Parcel reply = Parcel.obtain();
3927 data.writeInterfaceToken(IActivityManager.descriptor);
3928 data.writeStrongBinder(sender.asBinder());
3929 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3930 reply.readException();
3931 boolean res = reply.readInt() != 0;
3932 data.recycle();
3933 reply.recycle();
3934 return res;
3935 }
3936
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003937 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 data.writeStrongBinder(sender.asBinder());
3942 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3943 reply.readException();
3944 boolean res = reply.readInt() != 0;
3945 data.recycle();
3946 reply.recycle();
3947 return res;
3948 }
3949
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003950 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3951 {
3952 Parcel data = Parcel.obtain();
3953 Parcel reply = Parcel.obtain();
3954 data.writeInterfaceToken(IActivityManager.descriptor);
3955 values.writeToParcel(data, 0);
3956 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3957 reply.readException();
3958 data.recycle();
3959 reply.recycle();
3960 }
3961
Dianne Hackbornb437e092011-08-05 17:50:29 -07003962 public long[] getProcessPss(int[] pids) throws RemoteException {
3963 Parcel data = Parcel.obtain();
3964 Parcel reply = Parcel.obtain();
3965 data.writeInterfaceToken(IActivityManager.descriptor);
3966 data.writeIntArray(pids);
3967 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3968 reply.readException();
3969 long[] res = reply.createLongArray();
3970 data.recycle();
3971 reply.recycle();
3972 return res;
3973 }
3974
Dianne Hackborn661cd522011-08-22 00:26:20 -07003975 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3976 Parcel data = Parcel.obtain();
3977 Parcel reply = Parcel.obtain();
3978 data.writeInterfaceToken(IActivityManager.descriptor);
3979 TextUtils.writeToParcel(msg, data, 0);
3980 data.writeInt(always ? 1 : 0);
3981 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3982 reply.readException();
3983 data.recycle();
3984 reply.recycle();
3985 }
3986
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003987 public void dismissKeyguardOnNextActivity() throws RemoteException {
3988 Parcel data = Parcel.obtain();
3989 Parcel reply = Parcel.obtain();
3990 data.writeInterfaceToken(IActivityManager.descriptor);
3991 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3992 reply.readException();
3993 data.recycle();
3994 reply.recycle();
3995 }
3996
Adam Powelldd8fab22012-03-22 17:47:27 -07003997 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3998 throws RemoteException {
3999 Parcel data = Parcel.obtain();
4000 Parcel reply = Parcel.obtain();
4001 data.writeInterfaceToken(IActivityManager.descriptor);
4002 data.writeStrongBinder(token);
4003 data.writeString(destAffinity);
4004 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 boolean result = reply.readInt() != 0;
4007 data.recycle();
4008 reply.recycle();
4009 return result;
4010 }
4011
4012 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4013 throws RemoteException {
4014 Parcel data = Parcel.obtain();
4015 Parcel reply = Parcel.obtain();
4016 data.writeInterfaceToken(IActivityManager.descriptor);
4017 data.writeStrongBinder(token);
4018 target.writeToParcel(data, 0);
4019 data.writeInt(resultCode);
4020 if (resultData != null) {
4021 data.writeInt(1);
4022 resultData.writeToParcel(data, 0);
4023 } else {
4024 data.writeInt(0);
4025 }
4026 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 boolean result = reply.readInt() != 0;
4029 data.recycle();
4030 reply.recycle();
4031 return result;
4032 }
4033
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004034 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 data.writeStrongBinder(activityToken);
4039 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4040 reply.readException();
4041 int result = reply.readInt();
4042 data.recycle();
4043 reply.recycle();
4044 return result;
4045 }
4046
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004047 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4052 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4053 reply.readException();
4054 data.recycle();
4055 reply.recycle();
4056 }
4057
4058 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4063 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4064 reply.readException();
4065 data.recycle();
4066 reply.recycle();
4067 }
4068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004069 private IBinder mRemote;
4070}