blob: c3f57e8aac7246cf344ed714034c4e27de150d9c [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;
1533 int result = startActivities(app, intents, resolvedTypes, resultTo,
1534 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001535 reply.writeNoException();
1536 reply.writeInt(result);
1537 return true;
1538 }
1539
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001540 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1541 {
1542 data.enforceInterface(IActivityManager.descriptor);
1543 int mode = getFrontActivityScreenCompatMode();
1544 reply.writeNoException();
1545 reply.writeInt(mode);
1546 return true;
1547 }
1548
1549 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1550 {
1551 data.enforceInterface(IActivityManager.descriptor);
1552 int mode = data.readInt();
1553 setFrontActivityScreenCompatMode(mode);
1554 reply.writeNoException();
1555 reply.writeInt(mode);
1556 return true;
1557 }
1558
1559 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1560 {
1561 data.enforceInterface(IActivityManager.descriptor);
1562 String pkg = data.readString();
1563 int mode = getPackageScreenCompatMode(pkg);
1564 reply.writeNoException();
1565 reply.writeInt(mode);
1566 return true;
1567 }
1568
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001569 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1570 {
1571 data.enforceInterface(IActivityManager.descriptor);
1572 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001573 int mode = data.readInt();
1574 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001575 reply.writeNoException();
1576 return true;
1577 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001578
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001579 case SWITCH_USER_TRANSACTION: {
1580 data.enforceInterface(IActivityManager.descriptor);
1581 int userid = data.readInt();
1582 boolean result = switchUser(userid);
1583 reply.writeNoException();
1584 reply.writeInt(result ? 1 : 0);
1585 return true;
1586 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001587
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001588 case STOP_USER_TRANSACTION: {
1589 data.enforceInterface(IActivityManager.descriptor);
1590 int userid = data.readInt();
1591 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1592 data.readStrongBinder());
1593 int result = stopUser(userid, callback);
1594 reply.writeNoException();
1595 reply.writeInt(result);
1596 return true;
1597 }
1598
Amith Yamasani52f1d752012-03-28 18:19:29 -07001599 case GET_CURRENT_USER_TRANSACTION: {
1600 data.enforceInterface(IActivityManager.descriptor);
1601 UserInfo userInfo = getCurrentUser();
1602 reply.writeNoException();
1603 userInfo.writeToParcel(reply, 0);
1604 return true;
1605 }
1606
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001607 case IS_USER_RUNNING_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 int userid = data.readInt();
1610 boolean result = isUserRunning(userid);
1611 reply.writeNoException();
1612 reply.writeInt(result ? 1 : 0);
1613 return true;
1614 }
1615
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001616 case GET_RUNNING_USER_IDS_TRANSACTION: {
1617 data.enforceInterface(IActivityManager.descriptor);
1618 int[] result = getRunningUserIds();
1619 reply.writeNoException();
1620 reply.writeIntArray(result);
1621 return true;
1622 }
1623
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001624 case REMOVE_SUB_TASK_TRANSACTION:
1625 {
1626 data.enforceInterface(IActivityManager.descriptor);
1627 int taskId = data.readInt();
1628 int subTaskIndex = data.readInt();
1629 boolean result = removeSubTask(taskId, subTaskIndex);
1630 reply.writeNoException();
1631 reply.writeInt(result ? 1 : 0);
1632 return true;
1633 }
1634
1635 case REMOVE_TASK_TRANSACTION:
1636 {
1637 data.enforceInterface(IActivityManager.descriptor);
1638 int taskId = data.readInt();
1639 int fl = data.readInt();
1640 boolean result = removeTask(taskId, fl);
1641 reply.writeNoException();
1642 reply.writeInt(result ? 1 : 0);
1643 return true;
1644 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001645
Jeff Sharkeya4620792011-05-20 15:29:23 -07001646 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1647 data.enforceInterface(IActivityManager.descriptor);
1648 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1649 data.readStrongBinder());
1650 registerProcessObserver(observer);
1651 return true;
1652 }
1653
1654 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1655 data.enforceInterface(IActivityManager.descriptor);
1656 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1657 data.readStrongBinder());
1658 unregisterProcessObserver(observer);
1659 return true;
1660 }
1661
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001662 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1663 {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 String pkg = data.readString();
1666 boolean ask = getPackageAskScreenCompat(pkg);
1667 reply.writeNoException();
1668 reply.writeInt(ask ? 1 : 0);
1669 return true;
1670 }
1671
1672 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1673 {
1674 data.enforceInterface(IActivityManager.descriptor);
1675 String pkg = data.readString();
1676 boolean ask = data.readInt() != 0;
1677 setPackageAskScreenCompat(pkg, ask);
1678 reply.writeNoException();
1679 return true;
1680 }
1681
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001682 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
1684 IIntentSender r = IIntentSender.Stub.asInterface(
1685 data.readStrongBinder());
1686 boolean res = isIntentSenderTargetedToPackage(r);
1687 reply.writeNoException();
1688 reply.writeInt(res ? 1 : 0);
1689 return true;
1690 }
1691
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001692 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1693 data.enforceInterface(IActivityManager.descriptor);
1694 IIntentSender r = IIntentSender.Stub.asInterface(
1695 data.readStrongBinder());
1696 boolean res = isIntentSenderAnActivity(r);
1697 reply.writeNoException();
1698 reply.writeInt(res ? 1 : 0);
1699 return true;
1700 }
1701
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001702 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1703 data.enforceInterface(IActivityManager.descriptor);
1704 Configuration config = Configuration.CREATOR.createFromParcel(data);
1705 updatePersistentConfiguration(config);
1706 reply.writeNoException();
1707 return true;
1708 }
1709
Dianne Hackbornb437e092011-08-05 17:50:29 -07001710 case GET_PROCESS_PSS_TRANSACTION: {
1711 data.enforceInterface(IActivityManager.descriptor);
1712 int[] pids = data.createIntArray();
1713 long[] pss = getProcessPss(pids);
1714 reply.writeNoException();
1715 reply.writeLongArray(pss);
1716 return true;
1717 }
1718
Dianne Hackborn661cd522011-08-22 00:26:20 -07001719 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1720 data.enforceInterface(IActivityManager.descriptor);
1721 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1722 boolean always = data.readInt() != 0;
1723 showBootMessage(msg, always);
1724 reply.writeNoException();
1725 return true;
1726 }
1727
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001728 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 dismissKeyguardOnNextActivity();
1731 reply.writeNoException();
1732 return true;
1733 }
1734
Adam Powelldd8fab22012-03-22 17:47:27 -07001735 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 IBinder token = data.readStrongBinder();
1738 String destAffinity = data.readString();
1739 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1740 reply.writeNoException();
1741 reply.writeInt(res ? 1 : 0);
1742 return true;
1743 }
1744
1745 case NAVIGATE_UP_TO_TRANSACTION: {
1746 data.enforceInterface(IActivityManager.descriptor);
1747 IBinder token = data.readStrongBinder();
1748 Intent target = Intent.CREATOR.createFromParcel(data);
1749 int resultCode = data.readInt();
1750 Intent resultData = null;
1751 if (data.readInt() != 0) {
1752 resultData = Intent.CREATOR.createFromParcel(data);
1753 }
1754 boolean res = navigateUpTo(token, target, resultCode, resultData);
1755 reply.writeNoException();
1756 reply.writeInt(res ? 1 : 0);
1757 return true;
1758 }
1759
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001760 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1761 data.enforceInterface(IActivityManager.descriptor);
1762 IBinder token = data.readStrongBinder();
1763 int res = getLaunchedFromUid(token);
1764 reply.writeNoException();
1765 reply.writeInt(res);
1766 return true;
1767 }
1768
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001769 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1772 data.readStrongBinder());
1773 registerUserSwitchObserver(observer);
1774 return true;
1775 }
1776
1777 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1778 data.enforceInterface(IActivityManager.descriptor);
1779 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1780 data.readStrongBinder());
1781 unregisterUserSwitchObserver(observer);
1782 return true;
1783 }
1784
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001785 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001786
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001787 return super.onTransact(code, data, reply, flags);
1788 }
1789
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001790 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001791 return this;
1792 }
1793
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001794 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1795 protected IActivityManager create() {
1796 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001797 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001798 Log.v("ActivityManager", "default service binder = " + b);
1799 }
1800 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001801 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001802 Log.v("ActivityManager", "default service = " + am);
1803 }
1804 return am;
1805 }
1806 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001807}
1808
1809class ActivityManagerProxy implements IActivityManager
1810{
1811 public ActivityManagerProxy(IBinder remote)
1812 {
1813 mRemote = remote;
1814 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001815
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001816 public IBinder asBinder()
1817 {
1818 return mRemote;
1819 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001821 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001822 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1823 int startFlags, String profileFile,
1824 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001825 Parcel data = Parcel.obtain();
1826 Parcel reply = Parcel.obtain();
1827 data.writeInterfaceToken(IActivityManager.descriptor);
1828 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1829 intent.writeToParcel(data, 0);
1830 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001831 data.writeStrongBinder(resultTo);
1832 data.writeString(resultWho);
1833 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001834 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001835 data.writeString(profileFile);
1836 if (profileFd != null) {
1837 data.writeInt(1);
1838 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1839 } else {
1840 data.writeInt(0);
1841 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001842 if (options != null) {
1843 data.writeInt(1);
1844 options.writeToParcel(data, 0);
1845 } else {
1846 data.writeInt(0);
1847 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001848 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1849 reply.readException();
1850 int result = reply.readInt();
1851 reply.recycle();
1852 data.recycle();
1853 return result;
1854 }
Amith Yamasani82644082012-08-03 13:09:11 -07001855
1856 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1857 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1858 int startFlags, String profileFile,
1859 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1860 Parcel data = Parcel.obtain();
1861 Parcel reply = Parcel.obtain();
1862 data.writeInterfaceToken(IActivityManager.descriptor);
1863 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1864 intent.writeToParcel(data, 0);
1865 data.writeString(resolvedType);
1866 data.writeStrongBinder(resultTo);
1867 data.writeString(resultWho);
1868 data.writeInt(requestCode);
1869 data.writeInt(startFlags);
1870 data.writeString(profileFile);
1871 if (profileFd != null) {
1872 data.writeInt(1);
1873 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1874 } else {
1875 data.writeInt(0);
1876 }
1877 if (options != null) {
1878 data.writeInt(1);
1879 options.writeToParcel(data, 0);
1880 } else {
1881 data.writeInt(0);
1882 }
1883 data.writeInt(userId);
1884 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1885 reply.readException();
1886 int result = reply.readInt();
1887 reply.recycle();
1888 data.recycle();
1889 return result;
1890 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001891 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001892 String resolvedType, IBinder resultTo, String resultWho,
1893 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001894 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001895 Parcel data = Parcel.obtain();
1896 Parcel reply = Parcel.obtain();
1897 data.writeInterfaceToken(IActivityManager.descriptor);
1898 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1899 intent.writeToParcel(data, 0);
1900 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001901 data.writeStrongBinder(resultTo);
1902 data.writeString(resultWho);
1903 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001904 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001905 data.writeString(profileFile);
1906 if (profileFd != null) {
1907 data.writeInt(1);
1908 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1909 } else {
1910 data.writeInt(0);
1911 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001912 if (options != null) {
1913 data.writeInt(1);
1914 options.writeToParcel(data, 0);
1915 } else {
1916 data.writeInt(0);
1917 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001918 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001919 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1920 reply.readException();
1921 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1922 reply.recycle();
1923 data.recycle();
1924 return result;
1925 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001926 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001927 String resolvedType, IBinder resultTo, String resultWho,
1928 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001929 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001930 Parcel data = Parcel.obtain();
1931 Parcel reply = Parcel.obtain();
1932 data.writeInterfaceToken(IActivityManager.descriptor);
1933 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1934 intent.writeToParcel(data, 0);
1935 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001936 data.writeStrongBinder(resultTo);
1937 data.writeString(resultWho);
1938 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001939 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001940 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001941 if (options != null) {
1942 data.writeInt(1);
1943 options.writeToParcel(data, 0);
1944 } else {
1945 data.writeInt(0);
1946 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001947 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001948 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1949 reply.readException();
1950 int result = reply.readInt();
1951 reply.recycle();
1952 data.recycle();
1953 return result;
1954 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001955 public int startActivityIntentSender(IApplicationThread caller,
1956 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001957 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001958 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001959 Parcel data = Parcel.obtain();
1960 Parcel reply = Parcel.obtain();
1961 data.writeInterfaceToken(IActivityManager.descriptor);
1962 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1963 intent.writeToParcel(data, 0);
1964 if (fillInIntent != null) {
1965 data.writeInt(1);
1966 fillInIntent.writeToParcel(data, 0);
1967 } else {
1968 data.writeInt(0);
1969 }
1970 data.writeString(resolvedType);
1971 data.writeStrongBinder(resultTo);
1972 data.writeString(resultWho);
1973 data.writeInt(requestCode);
1974 data.writeInt(flagsMask);
1975 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001976 if (options != null) {
1977 data.writeInt(1);
1978 options.writeToParcel(data, 0);
1979 } else {
1980 data.writeInt(0);
1981 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001982 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001983 reply.readException();
1984 int result = reply.readInt();
1985 reply.recycle();
1986 data.recycle();
1987 return result;
1988 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001989 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001990 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001991 Parcel data = Parcel.obtain();
1992 Parcel reply = Parcel.obtain();
1993 data.writeInterfaceToken(IActivityManager.descriptor);
1994 data.writeStrongBinder(callingActivity);
1995 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001996 if (options != null) {
1997 data.writeInt(1);
1998 options.writeToParcel(data, 0);
1999 } else {
2000 data.writeInt(0);
2001 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002002 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2003 reply.readException();
2004 int result = reply.readInt();
2005 reply.recycle();
2006 data.recycle();
2007 return result != 0;
2008 }
2009 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2010 throws RemoteException {
2011 Parcel data = Parcel.obtain();
2012 Parcel reply = Parcel.obtain();
2013 data.writeInterfaceToken(IActivityManager.descriptor);
2014 data.writeStrongBinder(token);
2015 data.writeInt(resultCode);
2016 if (resultData != null) {
2017 data.writeInt(1);
2018 resultData.writeToParcel(data, 0);
2019 } else {
2020 data.writeInt(0);
2021 }
2022 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2023 reply.readException();
2024 boolean res = reply.readInt() != 0;
2025 data.recycle();
2026 reply.recycle();
2027 return res;
2028 }
2029 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2030 {
2031 Parcel data = Parcel.obtain();
2032 Parcel reply = Parcel.obtain();
2033 data.writeInterfaceToken(IActivityManager.descriptor);
2034 data.writeStrongBinder(token);
2035 data.writeString(resultWho);
2036 data.writeInt(requestCode);
2037 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2038 reply.readException();
2039 data.recycle();
2040 reply.recycle();
2041 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002042 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2043 Parcel data = Parcel.obtain();
2044 Parcel reply = Parcel.obtain();
2045 data.writeInterfaceToken(IActivityManager.descriptor);
2046 data.writeStrongBinder(token);
2047 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2048 reply.readException();
2049 boolean res = reply.readInt() != 0;
2050 data.recycle();
2051 reply.recycle();
2052 return res;
2053 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002054 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2055 Parcel data = Parcel.obtain();
2056 Parcel reply = Parcel.obtain();
2057 data.writeInterfaceToken(IActivityManager.descriptor);
2058 data.writeStrongBinder(token);
2059 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2060 reply.readException();
2061 boolean res = reply.readInt() != 0;
2062 data.recycle();
2063 reply.recycle();
2064 return res;
2065 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002066 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002067 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002068 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002069 {
2070 Parcel data = Parcel.obtain();
2071 Parcel reply = Parcel.obtain();
2072 data.writeInterfaceToken(IActivityManager.descriptor);
2073 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002074 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002075 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2076 filter.writeToParcel(data, 0);
2077 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002078 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002079 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2080 reply.readException();
2081 Intent intent = null;
2082 int haveIntent = reply.readInt();
2083 if (haveIntent != 0) {
2084 intent = Intent.CREATOR.createFromParcel(reply);
2085 }
2086 reply.recycle();
2087 data.recycle();
2088 return intent;
2089 }
2090 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2091 {
2092 Parcel data = Parcel.obtain();
2093 Parcel reply = Parcel.obtain();
2094 data.writeInterfaceToken(IActivityManager.descriptor);
2095 data.writeStrongBinder(receiver.asBinder());
2096 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2097 reply.readException();
2098 data.recycle();
2099 reply.recycle();
2100 }
2101 public int broadcastIntent(IApplicationThread caller,
2102 Intent intent, String resolvedType, IIntentReceiver resultTo,
2103 int resultCode, String resultData, Bundle map,
2104 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002105 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002106 {
2107 Parcel data = Parcel.obtain();
2108 Parcel reply = Parcel.obtain();
2109 data.writeInterfaceToken(IActivityManager.descriptor);
2110 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2111 intent.writeToParcel(data, 0);
2112 data.writeString(resolvedType);
2113 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2114 data.writeInt(resultCode);
2115 data.writeString(resultData);
2116 data.writeBundle(map);
2117 data.writeString(requiredPermission);
2118 data.writeInt(serialized ? 1 : 0);
2119 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002120 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002121 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2122 reply.readException();
2123 int res = reply.readInt();
2124 reply.recycle();
2125 data.recycle();
2126 return res;
2127 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002128 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2129 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002130 {
2131 Parcel data = Parcel.obtain();
2132 Parcel reply = Parcel.obtain();
2133 data.writeInterfaceToken(IActivityManager.descriptor);
2134 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2135 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002136 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002137 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2138 reply.readException();
2139 data.recycle();
2140 reply.recycle();
2141 }
2142 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2143 {
2144 Parcel data = Parcel.obtain();
2145 Parcel reply = Parcel.obtain();
2146 data.writeInterfaceToken(IActivityManager.descriptor);
2147 data.writeStrongBinder(who);
2148 data.writeInt(resultCode);
2149 data.writeString(resultData);
2150 data.writeBundle(map);
2151 data.writeInt(abortBroadcast ? 1 : 0);
2152 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2153 reply.readException();
2154 data.recycle();
2155 reply.recycle();
2156 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002157 public void attachApplication(IApplicationThread app) throws RemoteException
2158 {
2159 Parcel data = Parcel.obtain();
2160 Parcel reply = Parcel.obtain();
2161 data.writeInterfaceToken(IActivityManager.descriptor);
2162 data.writeStrongBinder(app.asBinder());
2163 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2164 reply.readException();
2165 data.recycle();
2166 reply.recycle();
2167 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002168 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2169 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 {
2171 Parcel data = Parcel.obtain();
2172 Parcel reply = Parcel.obtain();
2173 data.writeInterfaceToken(IActivityManager.descriptor);
2174 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002175 if (config != null) {
2176 data.writeInt(1);
2177 config.writeToParcel(data, 0);
2178 } else {
2179 data.writeInt(0);
2180 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002181 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002182 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2183 reply.readException();
2184 data.recycle();
2185 reply.recycle();
2186 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002187 public void activityResumed(IBinder token) throws RemoteException
2188 {
2189 Parcel data = Parcel.obtain();
2190 Parcel reply = Parcel.obtain();
2191 data.writeInterfaceToken(IActivityManager.descriptor);
2192 data.writeStrongBinder(token);
2193 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2194 reply.readException();
2195 data.recycle();
2196 reply.recycle();
2197 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002198 public void activityPaused(IBinder token) throws RemoteException
2199 {
2200 Parcel data = Parcel.obtain();
2201 Parcel reply = Parcel.obtain();
2202 data.writeInterfaceToken(IActivityManager.descriptor);
2203 data.writeStrongBinder(token);
2204 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2205 reply.readException();
2206 data.recycle();
2207 reply.recycle();
2208 }
2209 public void activityStopped(IBinder token, Bundle state,
2210 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002211 {
2212 Parcel data = Parcel.obtain();
2213 Parcel reply = Parcel.obtain();
2214 data.writeInterfaceToken(IActivityManager.descriptor);
2215 data.writeStrongBinder(token);
2216 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002217 if (thumbnail != null) {
2218 data.writeInt(1);
2219 thumbnail.writeToParcel(data, 0);
2220 } else {
2221 data.writeInt(0);
2222 }
2223 TextUtils.writeToParcel(description, data, 0);
2224 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2225 reply.readException();
2226 data.recycle();
2227 reply.recycle();
2228 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002229 public void activitySlept(IBinder token) throws RemoteException
2230 {
2231 Parcel data = Parcel.obtain();
2232 Parcel reply = Parcel.obtain();
2233 data.writeInterfaceToken(IActivityManager.descriptor);
2234 data.writeStrongBinder(token);
2235 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2236 reply.readException();
2237 data.recycle();
2238 reply.recycle();
2239 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002240 public void activityDestroyed(IBinder token) throws RemoteException
2241 {
2242 Parcel data = Parcel.obtain();
2243 Parcel reply = Parcel.obtain();
2244 data.writeInterfaceToken(IActivityManager.descriptor);
2245 data.writeStrongBinder(token);
2246 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2247 reply.readException();
2248 data.recycle();
2249 reply.recycle();
2250 }
2251 public String getCallingPackage(IBinder token) throws RemoteException
2252 {
2253 Parcel data = Parcel.obtain();
2254 Parcel reply = Parcel.obtain();
2255 data.writeInterfaceToken(IActivityManager.descriptor);
2256 data.writeStrongBinder(token);
2257 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2258 reply.readException();
2259 String res = reply.readString();
2260 data.recycle();
2261 reply.recycle();
2262 return res;
2263 }
2264 public ComponentName getCallingActivity(IBinder token)
2265 throws RemoteException {
2266 Parcel data = Parcel.obtain();
2267 Parcel reply = Parcel.obtain();
2268 data.writeInterfaceToken(IActivityManager.descriptor);
2269 data.writeStrongBinder(token);
2270 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2271 reply.readException();
2272 ComponentName res = ComponentName.readFromParcel(reply);
2273 data.recycle();
2274 reply.recycle();
2275 return res;
2276 }
2277 public List getTasks(int maxNum, int flags,
2278 IThumbnailReceiver receiver) throws RemoteException {
2279 Parcel data = Parcel.obtain();
2280 Parcel reply = Parcel.obtain();
2281 data.writeInterfaceToken(IActivityManager.descriptor);
2282 data.writeInt(maxNum);
2283 data.writeInt(flags);
2284 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2285 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2286 reply.readException();
2287 ArrayList list = null;
2288 int N = reply.readInt();
2289 if (N >= 0) {
2290 list = new ArrayList();
2291 while (N > 0) {
2292 ActivityManager.RunningTaskInfo info =
2293 ActivityManager.RunningTaskInfo.CREATOR
2294 .createFromParcel(reply);
2295 list.add(info);
2296 N--;
2297 }
2298 }
2299 data.recycle();
2300 reply.recycle();
2301 return list;
2302 }
2303 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002304 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002305 Parcel data = Parcel.obtain();
2306 Parcel reply = Parcel.obtain();
2307 data.writeInterfaceToken(IActivityManager.descriptor);
2308 data.writeInt(maxNum);
2309 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002310 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002311 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2312 reply.readException();
2313 ArrayList<ActivityManager.RecentTaskInfo> list
2314 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2315 data.recycle();
2316 reply.recycle();
2317 return list;
2318 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002319 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002320 Parcel data = Parcel.obtain();
2321 Parcel reply = Parcel.obtain();
2322 data.writeInterfaceToken(IActivityManager.descriptor);
2323 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002324 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002325 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002326 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002327 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002328 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002329 }
2330 data.recycle();
2331 reply.recycle();
2332 return bm;
2333 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002334 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2335 Parcel data = Parcel.obtain();
2336 Parcel reply = Parcel.obtain();
2337 data.writeInterfaceToken(IActivityManager.descriptor);
2338 data.writeInt(id);
2339 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2340 reply.readException();
2341 Bitmap bm = null;
2342 if (reply.readInt() != 0) {
2343 bm = Bitmap.CREATOR.createFromParcel(reply);
2344 }
2345 data.recycle();
2346 reply.recycle();
2347 return bm;
2348 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002349 public List getServices(int maxNum, int flags) throws RemoteException {
2350 Parcel data = Parcel.obtain();
2351 Parcel reply = Parcel.obtain();
2352 data.writeInterfaceToken(IActivityManager.descriptor);
2353 data.writeInt(maxNum);
2354 data.writeInt(flags);
2355 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2356 reply.readException();
2357 ArrayList list = null;
2358 int N = reply.readInt();
2359 if (N >= 0) {
2360 list = new ArrayList();
2361 while (N > 0) {
2362 ActivityManager.RunningServiceInfo info =
2363 ActivityManager.RunningServiceInfo.CREATOR
2364 .createFromParcel(reply);
2365 list.add(info);
2366 N--;
2367 }
2368 }
2369 data.recycle();
2370 reply.recycle();
2371 return list;
2372 }
2373 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2374 throws RemoteException {
2375 Parcel data = Parcel.obtain();
2376 Parcel reply = Parcel.obtain();
2377 data.writeInterfaceToken(IActivityManager.descriptor);
2378 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2379 reply.readException();
2380 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2381 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2382 data.recycle();
2383 reply.recycle();
2384 return list;
2385 }
2386 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2387 throws RemoteException {
2388 Parcel data = Parcel.obtain();
2389 Parcel reply = Parcel.obtain();
2390 data.writeInterfaceToken(IActivityManager.descriptor);
2391 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2392 reply.readException();
2393 ArrayList<ActivityManager.RunningAppProcessInfo> list
2394 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2395 data.recycle();
2396 reply.recycle();
2397 return list;
2398 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002399 public List<ApplicationInfo> getRunningExternalApplications()
2400 throws RemoteException {
2401 Parcel data = Parcel.obtain();
2402 Parcel reply = Parcel.obtain();
2403 data.writeInterfaceToken(IActivityManager.descriptor);
2404 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2405 reply.readException();
2406 ArrayList<ApplicationInfo> list
2407 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2408 data.recycle();
2409 reply.recycle();
2410 return list;
2411 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002412 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002413 {
2414 Parcel data = Parcel.obtain();
2415 Parcel reply = Parcel.obtain();
2416 data.writeInterfaceToken(IActivityManager.descriptor);
2417 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002418 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002419 if (options != null) {
2420 data.writeInt(1);
2421 options.writeToParcel(data, 0);
2422 } else {
2423 data.writeInt(0);
2424 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002425 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2426 reply.readException();
2427 data.recycle();
2428 reply.recycle();
2429 }
2430 public void moveTaskToBack(int task) throws RemoteException
2431 {
2432 Parcel data = Parcel.obtain();
2433 Parcel reply = Parcel.obtain();
2434 data.writeInterfaceToken(IActivityManager.descriptor);
2435 data.writeInt(task);
2436 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2437 reply.readException();
2438 data.recycle();
2439 reply.recycle();
2440 }
2441 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2442 throws RemoteException {
2443 Parcel data = Parcel.obtain();
2444 Parcel reply = Parcel.obtain();
2445 data.writeInterfaceToken(IActivityManager.descriptor);
2446 data.writeStrongBinder(token);
2447 data.writeInt(nonRoot ? 1 : 0);
2448 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 boolean res = reply.readInt() != 0;
2451 data.recycle();
2452 reply.recycle();
2453 return res;
2454 }
2455 public void moveTaskBackwards(int task) throws RemoteException
2456 {
2457 Parcel data = Parcel.obtain();
2458 Parcel reply = Parcel.obtain();
2459 data.writeInterfaceToken(IActivityManager.descriptor);
2460 data.writeInt(task);
2461 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2462 reply.readException();
2463 data.recycle();
2464 reply.recycle();
2465 }
2466 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2467 {
2468 Parcel data = Parcel.obtain();
2469 Parcel reply = Parcel.obtain();
2470 data.writeInterfaceToken(IActivityManager.descriptor);
2471 data.writeStrongBinder(token);
2472 data.writeInt(onlyRoot ? 1 : 0);
2473 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2474 reply.readException();
2475 int res = reply.readInt();
2476 data.recycle();
2477 reply.recycle();
2478 return res;
2479 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002480 public void reportThumbnail(IBinder token,
2481 Bitmap thumbnail, CharSequence description) throws RemoteException
2482 {
2483 Parcel data = Parcel.obtain();
2484 Parcel reply = Parcel.obtain();
2485 data.writeInterfaceToken(IActivityManager.descriptor);
2486 data.writeStrongBinder(token);
2487 if (thumbnail != null) {
2488 data.writeInt(1);
2489 thumbnail.writeToParcel(data, 0);
2490 } else {
2491 data.writeInt(0);
2492 }
2493 TextUtils.writeToParcel(description, data, 0);
2494 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2495 reply.readException();
2496 data.recycle();
2497 reply.recycle();
2498 }
2499 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002500 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 Parcel data = Parcel.obtain();
2502 Parcel reply = Parcel.obtain();
2503 data.writeInterfaceToken(IActivityManager.descriptor);
2504 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2505 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002506 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002507 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002508 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2509 reply.readException();
2510 int res = reply.readInt();
2511 ContentProviderHolder cph = null;
2512 if (res != 0) {
2513 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2514 }
2515 data.recycle();
2516 reply.recycle();
2517 return cph;
2518 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002519 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2520 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002521 Parcel data = Parcel.obtain();
2522 Parcel reply = Parcel.obtain();
2523 data.writeInterfaceToken(IActivityManager.descriptor);
2524 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002525 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002526 data.writeStrongBinder(token);
2527 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2528 reply.readException();
2529 int res = reply.readInt();
2530 ContentProviderHolder cph = null;
2531 if (res != 0) {
2532 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2533 }
2534 data.recycle();
2535 reply.recycle();
2536 return cph;
2537 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002538 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002539 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002540 {
2541 Parcel data = Parcel.obtain();
2542 Parcel reply = Parcel.obtain();
2543 data.writeInterfaceToken(IActivityManager.descriptor);
2544 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2545 data.writeTypedList(providers);
2546 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2547 reply.readException();
2548 data.recycle();
2549 reply.recycle();
2550 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002551 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2552 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002553 Parcel data = Parcel.obtain();
2554 Parcel reply = Parcel.obtain();
2555 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002556 data.writeStrongBinder(connection);
2557 data.writeInt(stable);
2558 data.writeInt(unstable);
2559 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2560 reply.readException();
2561 boolean res = reply.readInt() != 0;
2562 data.recycle();
2563 reply.recycle();
2564 return res;
2565 }
2566 public void unstableProviderDied(IBinder connection) throws RemoteException {
2567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 data.writeStrongBinder(connection);
2571 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2572 reply.readException();
2573 data.recycle();
2574 reply.recycle();
2575 }
2576
2577 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2578 Parcel data = Parcel.obtain();
2579 Parcel reply = Parcel.obtain();
2580 data.writeInterfaceToken(IActivityManager.descriptor);
2581 data.writeStrongBinder(connection);
2582 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 data.recycle();
2586 reply.recycle();
2587 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002588
2589 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeString(name);
2594 data.writeStrongBinder(token);
2595 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2596 reply.readException();
2597 data.recycle();
2598 reply.recycle();
2599 }
2600
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002601 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2602 throws RemoteException
2603 {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 service.writeToParcel(data, 0);
2608 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2609 reply.readException();
2610 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2611 data.recycle();
2612 reply.recycle();
2613 return res;
2614 }
2615
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002617 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002618 {
2619 Parcel data = Parcel.obtain();
2620 Parcel reply = Parcel.obtain();
2621 data.writeInterfaceToken(IActivityManager.descriptor);
2622 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2623 service.writeToParcel(data, 0);
2624 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002625 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002626 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2627 reply.readException();
2628 ComponentName res = ComponentName.readFromParcel(reply);
2629 data.recycle();
2630 reply.recycle();
2631 return res;
2632 }
2633 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002634 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002635 {
2636 Parcel data = Parcel.obtain();
2637 Parcel reply = Parcel.obtain();
2638 data.writeInterfaceToken(IActivityManager.descriptor);
2639 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2640 service.writeToParcel(data, 0);
2641 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002642 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2644 reply.readException();
2645 int res = reply.readInt();
2646 reply.recycle();
2647 data.recycle();
2648 return res;
2649 }
2650 public boolean stopServiceToken(ComponentName className, IBinder token,
2651 int startId) throws RemoteException {
2652 Parcel data = Parcel.obtain();
2653 Parcel reply = Parcel.obtain();
2654 data.writeInterfaceToken(IActivityManager.descriptor);
2655 ComponentName.writeToParcel(className, data);
2656 data.writeStrongBinder(token);
2657 data.writeInt(startId);
2658 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 boolean res = reply.readInt() != 0;
2661 data.recycle();
2662 reply.recycle();
2663 return res;
2664 }
2665 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002666 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 ComponentName.writeToParcel(className, data);
2671 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002672 data.writeInt(id);
2673 if (notification != null) {
2674 data.writeInt(1);
2675 notification.writeToParcel(data, 0);
2676 } else {
2677 data.writeInt(0);
2678 }
2679 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002680 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 data.recycle();
2683 reply.recycle();
2684 }
2685 public int bindService(IApplicationThread caller, IBinder token,
2686 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002687 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2692 data.writeStrongBinder(token);
2693 service.writeToParcel(data, 0);
2694 data.writeString(resolvedType);
2695 data.writeStrongBinder(connection.asBinder());
2696 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002697 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002698 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2699 reply.readException();
2700 int res = reply.readInt();
2701 data.recycle();
2702 reply.recycle();
2703 return res;
2704 }
2705 public boolean unbindService(IServiceConnection connection) throws RemoteException
2706 {
2707 Parcel data = Parcel.obtain();
2708 Parcel reply = Parcel.obtain();
2709 data.writeInterfaceToken(IActivityManager.descriptor);
2710 data.writeStrongBinder(connection.asBinder());
2711 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2712 reply.readException();
2713 boolean res = reply.readInt() != 0;
2714 data.recycle();
2715 reply.recycle();
2716 return res;
2717 }
2718
2719 public void publishService(IBinder token,
2720 Intent intent, IBinder service) throws RemoteException {
2721 Parcel data = Parcel.obtain();
2722 Parcel reply = Parcel.obtain();
2723 data.writeInterfaceToken(IActivityManager.descriptor);
2724 data.writeStrongBinder(token);
2725 intent.writeToParcel(data, 0);
2726 data.writeStrongBinder(service);
2727 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2728 reply.readException();
2729 data.recycle();
2730 reply.recycle();
2731 }
2732
2733 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2734 throws RemoteException {
2735 Parcel data = Parcel.obtain();
2736 Parcel reply = Parcel.obtain();
2737 data.writeInterfaceToken(IActivityManager.descriptor);
2738 data.writeStrongBinder(token);
2739 intent.writeToParcel(data, 0);
2740 data.writeInt(doRebind ? 1 : 0);
2741 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 data.recycle();
2744 reply.recycle();
2745 }
2746
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002747 public void serviceDoneExecuting(IBinder token, int type, int startId,
2748 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002749 Parcel data = Parcel.obtain();
2750 Parcel reply = Parcel.obtain();
2751 data.writeInterfaceToken(IActivityManager.descriptor);
2752 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002753 data.writeInt(type);
2754 data.writeInt(startId);
2755 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002756 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2757 reply.readException();
2758 data.recycle();
2759 reply.recycle();
2760 }
2761
2762 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2763 Parcel data = Parcel.obtain();
2764 Parcel reply = Parcel.obtain();
2765 data.writeInterfaceToken(IActivityManager.descriptor);
2766 service.writeToParcel(data, 0);
2767 data.writeString(resolvedType);
2768 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2769 reply.readException();
2770 IBinder binder = reply.readStrongBinder();
2771 reply.recycle();
2772 data.recycle();
2773 return binder;
2774 }
2775
Christopher Tate181fafa2009-05-14 11:12:14 -07002776 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2777 throws RemoteException {
2778 Parcel data = Parcel.obtain();
2779 Parcel reply = Parcel.obtain();
2780 data.writeInterfaceToken(IActivityManager.descriptor);
2781 app.writeToParcel(data, 0);
2782 data.writeInt(backupRestoreMode);
2783 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2784 reply.readException();
2785 boolean success = reply.readInt() != 0;
2786 reply.recycle();
2787 data.recycle();
2788 return success;
2789 }
2790
2791 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeString(packageName);
2796 data.writeStrongBinder(agent);
2797 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2798 reply.recycle();
2799 data.recycle();
2800 }
2801
2802 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2803 Parcel data = Parcel.obtain();
2804 Parcel reply = Parcel.obtain();
2805 data.writeInterfaceToken(IActivityManager.descriptor);
2806 app.writeToParcel(data, 0);
2807 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2808 reply.readException();
2809 reply.recycle();
2810 data.recycle();
2811 }
2812
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002814 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002815 throws RemoteException {
2816 Parcel data = Parcel.obtain();
2817 Parcel reply = Parcel.obtain();
2818 data.writeInterfaceToken(IActivityManager.descriptor);
2819 ComponentName.writeToParcel(className, data);
2820 data.writeString(profileFile);
2821 data.writeInt(flags);
2822 data.writeBundle(arguments);
2823 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002824 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002825 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2826 reply.readException();
2827 boolean res = reply.readInt() != 0;
2828 reply.recycle();
2829 data.recycle();
2830 return res;
2831 }
2832
2833 public void finishInstrumentation(IApplicationThread target,
2834 int resultCode, Bundle results) throws RemoteException {
2835 Parcel data = Parcel.obtain();
2836 Parcel reply = Parcel.obtain();
2837 data.writeInterfaceToken(IActivityManager.descriptor);
2838 data.writeStrongBinder(target != null ? target.asBinder() : null);
2839 data.writeInt(resultCode);
2840 data.writeBundle(results);
2841 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2842 reply.readException();
2843 data.recycle();
2844 reply.recycle();
2845 }
2846 public Configuration getConfiguration() throws RemoteException
2847 {
2848 Parcel data = Parcel.obtain();
2849 Parcel reply = Parcel.obtain();
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2852 reply.readException();
2853 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2854 reply.recycle();
2855 data.recycle();
2856 return res;
2857 }
2858 public void updateConfiguration(Configuration values) throws RemoteException
2859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 values.writeToParcel(data, 0);
2864 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2865 reply.readException();
2866 data.recycle();
2867 reply.recycle();
2868 }
2869 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2870 throws RemoteException {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(token);
2875 data.writeInt(requestedOrientation);
2876 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 data.recycle();
2879 reply.recycle();
2880 }
2881 public int getRequestedOrientation(IBinder token) throws RemoteException {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeStrongBinder(token);
2886 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 int res = reply.readInt();
2889 data.recycle();
2890 reply.recycle();
2891 return res;
2892 }
2893 public ComponentName getActivityClassForToken(IBinder token)
2894 throws RemoteException {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeStrongBinder(token);
2899 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 ComponentName res = ComponentName.readFromParcel(reply);
2902 data.recycle();
2903 reply.recycle();
2904 return res;
2905 }
2906 public String getPackageForToken(IBinder token) throws RemoteException
2907 {
2908 Parcel data = Parcel.obtain();
2909 Parcel reply = Parcel.obtain();
2910 data.writeInterfaceToken(IActivityManager.descriptor);
2911 data.writeStrongBinder(token);
2912 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2913 reply.readException();
2914 String res = reply.readString();
2915 data.recycle();
2916 reply.recycle();
2917 return res;
2918 }
2919 public IIntentSender getIntentSender(int type,
2920 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002921 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002922 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002923 Parcel data = Parcel.obtain();
2924 Parcel reply = Parcel.obtain();
2925 data.writeInterfaceToken(IActivityManager.descriptor);
2926 data.writeInt(type);
2927 data.writeString(packageName);
2928 data.writeStrongBinder(token);
2929 data.writeString(resultWho);
2930 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002931 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002932 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002933 data.writeTypedArray(intents, 0);
2934 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 } else {
2936 data.writeInt(0);
2937 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002938 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002939 if (options != null) {
2940 data.writeInt(1);
2941 options.writeToParcel(data, 0);
2942 } else {
2943 data.writeInt(0);
2944 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002945 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 IIntentSender res = IIntentSender.Stub.asInterface(
2949 reply.readStrongBinder());
2950 data.recycle();
2951 reply.recycle();
2952 return res;
2953 }
2954 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 data.writeStrongBinder(sender.asBinder());
2959 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2960 reply.readException();
2961 data.recycle();
2962 reply.recycle();
2963 }
2964 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeStrongBinder(sender.asBinder());
2969 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2970 reply.readException();
2971 String res = reply.readString();
2972 data.recycle();
2973 reply.recycle();
2974 return res;
2975 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002976 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2977 Parcel data = Parcel.obtain();
2978 Parcel reply = Parcel.obtain();
2979 data.writeInterfaceToken(IActivityManager.descriptor);
2980 data.writeStrongBinder(sender.asBinder());
2981 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2982 reply.readException();
2983 int res = reply.readInt();
2984 data.recycle();
2985 reply.recycle();
2986 return res;
2987 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002988 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2989 boolean requireFull, String name, String callerPackage) throws RemoteException {
2990 Parcel data = Parcel.obtain();
2991 Parcel reply = Parcel.obtain();
2992 data.writeInterfaceToken(IActivityManager.descriptor);
2993 data.writeInt(callingPid);
2994 data.writeInt(callingUid);
2995 data.writeInt(userId);
2996 data.writeInt(allowAll ? 1 : 0);
2997 data.writeInt(requireFull ? 1 : 0);
2998 data.writeString(name);
2999 data.writeString(callerPackage);
3000 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3001 reply.readException();
3002 int res = reply.readInt();
3003 data.recycle();
3004 reply.recycle();
3005 return res;
3006 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 public void setProcessLimit(int max) throws RemoteException
3008 {
3009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
3011 data.writeInterfaceToken(IActivityManager.descriptor);
3012 data.writeInt(max);
3013 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3014 reply.readException();
3015 data.recycle();
3016 reply.recycle();
3017 }
3018 public int getProcessLimit() throws RemoteException
3019 {
3020 Parcel data = Parcel.obtain();
3021 Parcel reply = Parcel.obtain();
3022 data.writeInterfaceToken(IActivityManager.descriptor);
3023 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3024 reply.readException();
3025 int res = reply.readInt();
3026 data.recycle();
3027 reply.recycle();
3028 return res;
3029 }
3030 public void setProcessForeground(IBinder token, int pid,
3031 boolean isForeground) throws RemoteException {
3032 Parcel data = Parcel.obtain();
3033 Parcel reply = Parcel.obtain();
3034 data.writeInterfaceToken(IActivityManager.descriptor);
3035 data.writeStrongBinder(token);
3036 data.writeInt(pid);
3037 data.writeInt(isForeground ? 1 : 0);
3038 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3039 reply.readException();
3040 data.recycle();
3041 reply.recycle();
3042 }
3043 public int checkPermission(String permission, int pid, int uid)
3044 throws RemoteException {
3045 Parcel data = Parcel.obtain();
3046 Parcel reply = Parcel.obtain();
3047 data.writeInterfaceToken(IActivityManager.descriptor);
3048 data.writeString(permission);
3049 data.writeInt(pid);
3050 data.writeInt(uid);
3051 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3052 reply.readException();
3053 int res = reply.readInt();
3054 data.recycle();
3055 reply.recycle();
3056 return res;
3057 }
3058 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003059 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 data.writeString(packageName);
3064 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003065 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003066 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3067 reply.readException();
3068 boolean res = reply.readInt() != 0;
3069 data.recycle();
3070 reply.recycle();
3071 return res;
3072 }
3073 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3074 throws RemoteException {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 uri.writeToParcel(data, 0);
3079 data.writeInt(pid);
3080 data.writeInt(uid);
3081 data.writeInt(mode);
3082 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 int res = reply.readInt();
3085 data.recycle();
3086 reply.recycle();
3087 return res;
3088 }
3089 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3090 Uri uri, int mode) throws RemoteException {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 data.writeStrongBinder(caller.asBinder());
3095 data.writeString(targetPkg);
3096 uri.writeToParcel(data, 0);
3097 data.writeInt(mode);
3098 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3099 reply.readException();
3100 data.recycle();
3101 reply.recycle();
3102 }
3103 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3104 int mode) throws RemoteException {
3105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
3107 data.writeInterfaceToken(IActivityManager.descriptor);
3108 data.writeStrongBinder(caller.asBinder());
3109 uri.writeToParcel(data, 0);
3110 data.writeInt(mode);
3111 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3112 reply.readException();
3113 data.recycle();
3114 reply.recycle();
3115 }
3116 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3117 throws RemoteException {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 data.writeStrongBinder(who.asBinder());
3122 data.writeInt(waiting ? 1 : 0);
3123 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3124 reply.readException();
3125 data.recycle();
3126 reply.recycle();
3127 }
3128 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3133 reply.readException();
3134 outInfo.readFromParcel(reply);
3135 data.recycle();
3136 reply.recycle();
3137 }
3138 public void unhandledBack() throws RemoteException
3139 {
3140 Parcel data = Parcel.obtain();
3141 Parcel reply = Parcel.obtain();
3142 data.writeInterfaceToken(IActivityManager.descriptor);
3143 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3144 reply.readException();
3145 data.recycle();
3146 reply.recycle();
3147 }
3148 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3149 {
3150 Parcel data = Parcel.obtain();
3151 Parcel reply = Parcel.obtain();
3152 data.writeInterfaceToken(IActivityManager.descriptor);
3153 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3154 reply.readException();
3155 ParcelFileDescriptor pfd = null;
3156 if (reply.readInt() != 0) {
3157 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3158 }
3159 data.recycle();
3160 reply.recycle();
3161 return pfd;
3162 }
3163 public void goingToSleep() throws RemoteException
3164 {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3169 reply.readException();
3170 data.recycle();
3171 reply.recycle();
3172 }
3173 public void wakingUp() throws RemoteException
3174 {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
3177 data.writeInterfaceToken(IActivityManager.descriptor);
3178 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3179 reply.readException();
3180 data.recycle();
3181 reply.recycle();
3182 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003183 public void setLockScreenShown(boolean shown) throws RemoteException
3184 {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeInt(shown ? 1 : 0);
3189 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3190 reply.readException();
3191 data.recycle();
3192 reply.recycle();
3193 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003194 public void setDebugApp(
3195 String packageName, boolean waitForDebugger, boolean persistent)
3196 throws RemoteException
3197 {
3198 Parcel data = Parcel.obtain();
3199 Parcel reply = Parcel.obtain();
3200 data.writeInterfaceToken(IActivityManager.descriptor);
3201 data.writeString(packageName);
3202 data.writeInt(waitForDebugger ? 1 : 0);
3203 data.writeInt(persistent ? 1 : 0);
3204 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3205 reply.readException();
3206 data.recycle();
3207 reply.recycle();
3208 }
3209 public void setAlwaysFinish(boolean enabled) throws RemoteException
3210 {
3211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
3213 data.writeInterfaceToken(IActivityManager.descriptor);
3214 data.writeInt(enabled ? 1 : 0);
3215 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 data.recycle();
3218 reply.recycle();
3219 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003220 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003221 {
3222 Parcel data = Parcel.obtain();
3223 Parcel reply = Parcel.obtain();
3224 data.writeInterfaceToken(IActivityManager.descriptor);
3225 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003226 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003227 reply.readException();
3228 data.recycle();
3229 reply.recycle();
3230 }
3231 public void enterSafeMode() throws RemoteException {
3232 Parcel data = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3235 data.recycle();
3236 }
3237 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3238 Parcel data = Parcel.obtain();
3239 data.writeStrongBinder(sender.asBinder());
3240 data.writeInterfaceToken(IActivityManager.descriptor);
3241 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3242 data.recycle();
3243 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003244 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003245 Parcel data = Parcel.obtain();
3246 Parcel reply = Parcel.obtain();
3247 data.writeInterfaceToken(IActivityManager.descriptor);
3248 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003249 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003250 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003251 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003252 boolean res = reply.readInt() != 0;
3253 data.recycle();
3254 reply.recycle();
3255 return res;
3256 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003257 @Override
3258 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3259 Parcel data = Parcel.obtain();
3260 Parcel reply = Parcel.obtain();
3261 data.writeInterfaceToken(IActivityManager.descriptor);
3262 data.writeString(reason);
3263 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3264 boolean res = reply.readInt() != 0;
3265 data.recycle();
3266 reply.recycle();
3267 return res;
3268 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 public void startRunning(String pkg, String cls, String action,
3270 String indata) throws RemoteException {
3271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeString(pkg);
3275 data.writeString(cls);
3276 data.writeString(action);
3277 data.writeString(indata);
3278 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3279 reply.readException();
3280 data.recycle();
3281 reply.recycle();
3282 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003283 public boolean testIsSystemReady()
3284 {
3285 /* this base class version is never called */
3286 return true;
3287 }
Dan Egnor60d87622009-12-16 16:32:58 -08003288 public void handleApplicationCrash(IBinder app,
3289 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3290 {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 data.writeStrongBinder(app);
3295 crashInfo.writeToParcel(data, 0);
3296 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3297 reply.readException();
3298 reply.recycle();
3299 data.recycle();
3300 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003301
Dan Egnor60d87622009-12-16 16:32:58 -08003302 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003303 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003304 {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003309 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003310 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003311 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003312 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003313 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 reply.recycle();
3315 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003316 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003318
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003319 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003320 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003321 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003322 {
3323 Parcel data = Parcel.obtain();
3324 Parcel reply = Parcel.obtain();
3325 data.writeInterfaceToken(IActivityManager.descriptor);
3326 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003327 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003328 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003329 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 reply.recycle();
3332 data.recycle();
3333 }
3334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 public void signalPersistentProcesses(int sig) throws RemoteException {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 data.writeInt(sig);
3340 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3341 reply.readException();
3342 data.recycle();
3343 reply.recycle();
3344 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003345
Dianne Hackborn1676c852012-09-10 14:52:30 -07003346 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003351 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003352 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3353 reply.readException();
3354 data.recycle();
3355 reply.recycle();
3356 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003357
3358 public void killAllBackgroundProcesses() throws RemoteException {
3359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 data.recycle();
3365 reply.recycle();
3366 }
3367
Dianne Hackborn1676c852012-09-10 14:52:30 -07003368 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003373 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003374 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003375 reply.readException();
3376 data.recycle();
3377 reply.recycle();
3378 }
3379
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003380 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3381 throws RemoteException
3382 {
3383 Parcel data = Parcel.obtain();
3384 Parcel reply = Parcel.obtain();
3385 data.writeInterfaceToken(IActivityManager.descriptor);
3386 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 outInfo.readFromParcel(reply);
3389 reply.recycle();
3390 data.recycle();
3391 }
3392
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003393 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3394 {
3395 Parcel data = Parcel.obtain();
3396 Parcel reply = Parcel.obtain();
3397 data.writeInterfaceToken(IActivityManager.descriptor);
3398 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3399 reply.readException();
3400 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3401 reply.recycle();
3402 data.recycle();
3403 return res;
3404 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003405
Dianne Hackborn1676c852012-09-10 14:52:30 -07003406 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003407 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003408 {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003413 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003414 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003415 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003416 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003417 if (fd != null) {
3418 data.writeInt(1);
3419 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3420 } else {
3421 data.writeInt(0);
3422 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003423 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3424 reply.readException();
3425 boolean res = reply.readInt() != 0;
3426 reply.recycle();
3427 data.recycle();
3428 return res;
3429 }
3430
Dianne Hackborn55280a92009-05-07 15:53:46 -07003431 public boolean shutdown(int timeout) throws RemoteException
3432 {
3433 Parcel data = Parcel.obtain();
3434 Parcel reply = Parcel.obtain();
3435 data.writeInterfaceToken(IActivityManager.descriptor);
3436 data.writeInt(timeout);
3437 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 boolean res = reply.readInt() != 0;
3440 reply.recycle();
3441 data.recycle();
3442 return res;
3443 }
3444
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003445 public void stopAppSwitches() throws RemoteException {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 reply.recycle();
3452 data.recycle();
3453 }
3454
3455 public void resumeAppSwitches() throws RemoteException {
3456 Parcel data = Parcel.obtain();
3457 Parcel reply = Parcel.obtain();
3458 data.writeInterfaceToken(IActivityManager.descriptor);
3459 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3460 reply.readException();
3461 reply.recycle();
3462 data.recycle();
3463 }
3464
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003465 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003470 data.writeInt(appid);
3471 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003472 reply.readException();
3473 data.recycle();
3474 reply.recycle();
3475 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003476
3477 public void closeSystemDialogs(String reason) throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeString(reason);
3482 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3483 reply.readException();
3484 data.recycle();
3485 reply.recycle();
3486 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003487
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003488 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003489 throws RemoteException {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003493 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003494 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3495 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003496 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003497 data.recycle();
3498 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003499 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003500 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003501
3502 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3503 Parcel data = Parcel.obtain();
3504 Parcel reply = Parcel.obtain();
3505 data.writeInterfaceToken(IActivityManager.descriptor);
3506 data.writeString(processName);
3507 data.writeInt(uid);
3508 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3509 reply.readException();
3510 data.recycle();
3511 reply.recycle();
3512 }
3513
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003514 public void overridePendingTransition(IBinder token, String packageName,
3515 int enterAnim, int exitAnim) throws RemoteException {
3516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 data.writeStrongBinder(token);
3520 data.writeString(packageName);
3521 data.writeInt(enterAnim);
3522 data.writeInt(exitAnim);
3523 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3524 reply.readException();
3525 data.recycle();
3526 reply.recycle();
3527 }
3528
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003529 public boolean isUserAMonkey() throws RemoteException {
3530 Parcel data = Parcel.obtain();
3531 Parcel reply = Parcel.obtain();
3532 data.writeInterfaceToken(IActivityManager.descriptor);
3533 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3534 reply.readException();
3535 boolean res = reply.readInt() != 0;
3536 data.recycle();
3537 reply.recycle();
3538 return res;
3539 }
3540
Dianne Hackborn860755f2010-06-03 18:47:52 -07003541 public void finishHeavyWeightApp() throws RemoteException {
3542 Parcel data = Parcel.obtain();
3543 Parcel reply = Parcel.obtain();
3544 data.writeInterfaceToken(IActivityManager.descriptor);
3545 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3546 reply.readException();
3547 data.recycle();
3548 reply.recycle();
3549 }
3550
Daniel Sandler69a48172010-06-23 16:29:36 -04003551 public void setImmersive(IBinder token, boolean immersive)
3552 throws RemoteException {
3553 Parcel data = Parcel.obtain();
3554 Parcel reply = Parcel.obtain();
3555 data.writeInterfaceToken(IActivityManager.descriptor);
3556 data.writeStrongBinder(token);
3557 data.writeInt(immersive ? 1 : 0);
3558 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3559 reply.readException();
3560 data.recycle();
3561 reply.recycle();
3562 }
3563
3564 public boolean isImmersive(IBinder token)
3565 throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeStrongBinder(token);
3570 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003571 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003572 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003573 data.recycle();
3574 reply.recycle();
3575 return res;
3576 }
3577
3578 public boolean isTopActivityImmersive()
3579 throws RemoteException {
3580 Parcel data = Parcel.obtain();
3581 Parcel reply = Parcel.obtain();
3582 data.writeInterfaceToken(IActivityManager.descriptor);
3583 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003584 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003585 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003586 data.recycle();
3587 reply.recycle();
3588 return res;
3589 }
3590
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003591 public void crashApplication(int uid, int initialPid, String packageName,
3592 String message) throws RemoteException {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
3596 data.writeInt(uid);
3597 data.writeInt(initialPid);
3598 data.writeString(packageName);
3599 data.writeString(message);
3600 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 data.recycle();
3603 reply.recycle();
3604 }
Andy McFadden824c5102010-07-09 16:26:57 -07003605
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003606 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003607 Parcel data = Parcel.obtain();
3608 Parcel reply = Parcel.obtain();
3609 data.writeInterfaceToken(IActivityManager.descriptor);
3610 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003611 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003612 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3613 reply.readException();
3614 String res = reply.readString();
3615 data.recycle();
3616 reply.recycle();
3617 return res;
3618 }
3619
Dianne Hackborn7e269642010-08-25 19:50:20 -07003620 public IBinder newUriPermissionOwner(String name)
3621 throws RemoteException {
3622 Parcel data = Parcel.obtain();
3623 Parcel reply = Parcel.obtain();
3624 data.writeInterfaceToken(IActivityManager.descriptor);
3625 data.writeString(name);
3626 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 IBinder res = reply.readStrongBinder();
3629 data.recycle();
3630 reply.recycle();
3631 return res;
3632 }
3633
3634 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3635 Uri uri, int mode) throws RemoteException {
3636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
3639 data.writeStrongBinder(owner);
3640 data.writeInt(fromUid);
3641 data.writeString(targetPkg);
3642 uri.writeToParcel(data, 0);
3643 data.writeInt(mode);
3644 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3645 reply.readException();
3646 data.recycle();
3647 reply.recycle();
3648 }
3649
3650 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3651 int mode) throws RemoteException {
3652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeStrongBinder(owner);
3656 if (uri != null) {
3657 data.writeInt(1);
3658 uri.writeToParcel(data, 0);
3659 } else {
3660 data.writeInt(0);
3661 }
3662 data.writeInt(mode);
3663 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3664 reply.readException();
3665 data.recycle();
3666 reply.recycle();
3667 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003668
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003669 public int checkGrantUriPermission(int callingUid, String targetPkg,
3670 Uri uri, int modeFlags) throws RemoteException {
3671 Parcel data = Parcel.obtain();
3672 Parcel reply = Parcel.obtain();
3673 data.writeInterfaceToken(IActivityManager.descriptor);
3674 data.writeInt(callingUid);
3675 data.writeString(targetPkg);
3676 uri.writeToParcel(data, 0);
3677 data.writeInt(modeFlags);
3678 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3679 reply.readException();
3680 int res = reply.readInt();
3681 data.recycle();
3682 reply.recycle();
3683 return res;
3684 }
3685
Dianne Hackborn1676c852012-09-10 14:52:30 -07003686 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003687 String path, ParcelFileDescriptor fd) throws RemoteException {
3688 Parcel data = Parcel.obtain();
3689 Parcel reply = Parcel.obtain();
3690 data.writeInterfaceToken(IActivityManager.descriptor);
3691 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003692 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003693 data.writeInt(managed ? 1 : 0);
3694 data.writeString(path);
3695 if (fd != null) {
3696 data.writeInt(1);
3697 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3698 } else {
3699 data.writeInt(0);
3700 }
3701 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3702 reply.readException();
3703 boolean res = reply.readInt() != 0;
3704 reply.recycle();
3705 data.recycle();
3706 return res;
3707 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003708
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003709 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003710 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3711 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3716 data.writeTypedArray(intents, 0);
3717 data.writeStringArray(resolvedTypes);
3718 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003719 if (options != null) {
3720 data.writeInt(1);
3721 options.writeToParcel(data, 0);
3722 } else {
3723 data.writeInt(0);
3724 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003725 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3726 reply.readException();
3727 int result = reply.readInt();
3728 reply.recycle();
3729 data.recycle();
3730 return result;
3731 }
3732
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003733 public int getFrontActivityScreenCompatMode() throws RemoteException {
3734 Parcel data = Parcel.obtain();
3735 Parcel reply = Parcel.obtain();
3736 data.writeInterfaceToken(IActivityManager.descriptor);
3737 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3738 reply.readException();
3739 int mode = reply.readInt();
3740 reply.recycle();
3741 data.recycle();
3742 return mode;
3743 }
3744
3745 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3746 Parcel data = Parcel.obtain();
3747 Parcel reply = Parcel.obtain();
3748 data.writeInterfaceToken(IActivityManager.descriptor);
3749 data.writeInt(mode);
3750 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3751 reply.readException();
3752 reply.recycle();
3753 data.recycle();
3754 }
3755
3756 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003760 data.writeString(packageName);
3761 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003762 reply.readException();
3763 int mode = reply.readInt();
3764 reply.recycle();
3765 data.recycle();
3766 return mode;
3767 }
3768
3769 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003770 throws RemoteException {
3771 Parcel data = Parcel.obtain();
3772 Parcel reply = Parcel.obtain();
3773 data.writeInterfaceToken(IActivityManager.descriptor);
3774 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003775 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003776 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3777 reply.readException();
3778 reply.recycle();
3779 data.recycle();
3780 }
3781
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003782 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3783 Parcel data = Parcel.obtain();
3784 Parcel reply = Parcel.obtain();
3785 data.writeInterfaceToken(IActivityManager.descriptor);
3786 data.writeString(packageName);
3787 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 boolean ask = reply.readInt() != 0;
3790 reply.recycle();
3791 data.recycle();
3792 return ask;
3793 }
3794
3795 public void setPackageAskScreenCompat(String packageName, boolean ask)
3796 throws RemoteException {
3797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeString(packageName);
3801 data.writeInt(ask ? 1 : 0);
3802 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3803 reply.readException();
3804 reply.recycle();
3805 data.recycle();
3806 }
3807
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003808 public boolean switchUser(int userid) throws RemoteException {
3809 Parcel data = Parcel.obtain();
3810 Parcel reply = Parcel.obtain();
3811 data.writeInterfaceToken(IActivityManager.descriptor);
3812 data.writeInt(userid);
3813 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3814 reply.readException();
3815 boolean result = reply.readInt() != 0;
3816 reply.recycle();
3817 data.recycle();
3818 return result;
3819 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003820
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003821 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
3824 data.writeInterfaceToken(IActivityManager.descriptor);
3825 data.writeInt(userid);
3826 data.writeStrongInterface(callback);
3827 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3828 reply.readException();
3829 int result = reply.readInt();
3830 reply.recycle();
3831 data.recycle();
3832 return result;
3833 }
3834
Amith Yamasani52f1d752012-03-28 18:19:29 -07003835 public UserInfo getCurrentUser() throws RemoteException {
3836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003839 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003840 reply.readException();
3841 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3842 reply.recycle();
3843 data.recycle();
3844 return userInfo;
3845 }
3846
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003847 public boolean isUserRunning(int userid) throws RemoteException {
3848 Parcel data = Parcel.obtain();
3849 Parcel reply = Parcel.obtain();
3850 data.writeInterfaceToken(IActivityManager.descriptor);
3851 data.writeInt(userid);
3852 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3853 reply.readException();
3854 boolean result = reply.readInt() != 0;
3855 reply.recycle();
3856 data.recycle();
3857 return result;
3858 }
3859
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003860 public int[] getRunningUserIds() throws RemoteException {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 int[] result = reply.createIntArray();
3867 reply.recycle();
3868 data.recycle();
3869 return result;
3870 }
3871
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003872 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 data.writeInt(taskId);
3877 data.writeInt(subTaskIndex);
3878 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 boolean result = reply.readInt() != 0;
3881 reply.recycle();
3882 data.recycle();
3883 return result;
3884 }
3885
3886 public boolean removeTask(int taskId, int flags) throws RemoteException {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 data.writeInt(taskId);
3891 data.writeInt(flags);
3892 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3893 reply.readException();
3894 boolean result = reply.readInt() != 0;
3895 reply.recycle();
3896 data.recycle();
3897 return result;
3898 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003899
Jeff Sharkeya4620792011-05-20 15:29:23 -07003900 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3901 Parcel data = Parcel.obtain();
3902 Parcel reply = Parcel.obtain();
3903 data.writeInterfaceToken(IActivityManager.descriptor);
3904 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3905 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3906 reply.readException();
3907 data.recycle();
3908 reply.recycle();
3909 }
3910
3911 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3912 Parcel data = Parcel.obtain();
3913 Parcel reply = Parcel.obtain();
3914 data.writeInterfaceToken(IActivityManager.descriptor);
3915 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3916 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3917 reply.readException();
3918 data.recycle();
3919 reply.recycle();
3920 }
3921
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003922 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeStrongBinder(sender.asBinder());
3927 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 boolean res = reply.readInt() != 0;
3930 data.recycle();
3931 reply.recycle();
3932 return res;
3933 }
3934
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003935 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeStrongBinder(sender.asBinder());
3940 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3941 reply.readException();
3942 boolean res = reply.readInt() != 0;
3943 data.recycle();
3944 reply.recycle();
3945 return res;
3946 }
3947
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003948 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3949 {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 values.writeToParcel(data, 0);
3954 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3955 reply.readException();
3956 data.recycle();
3957 reply.recycle();
3958 }
3959
Dianne Hackbornb437e092011-08-05 17:50:29 -07003960 public long[] getProcessPss(int[] pids) throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 data.writeIntArray(pids);
3965 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3966 reply.readException();
3967 long[] res = reply.createLongArray();
3968 data.recycle();
3969 reply.recycle();
3970 return res;
3971 }
3972
Dianne Hackborn661cd522011-08-22 00:26:20 -07003973 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 TextUtils.writeToParcel(msg, data, 0);
3978 data.writeInt(always ? 1 : 0);
3979 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 data.recycle();
3982 reply.recycle();
3983 }
3984
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003985 public void dismissKeyguardOnNextActivity() throws RemoteException {
3986 Parcel data = Parcel.obtain();
3987 Parcel reply = Parcel.obtain();
3988 data.writeInterfaceToken(IActivityManager.descriptor);
3989 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 data.recycle();
3992 reply.recycle();
3993 }
3994
Adam Powelldd8fab22012-03-22 17:47:27 -07003995 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3996 throws RemoteException {
3997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
4000 data.writeStrongBinder(token);
4001 data.writeString(destAffinity);
4002 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4003 reply.readException();
4004 boolean result = reply.readInt() != 0;
4005 data.recycle();
4006 reply.recycle();
4007 return result;
4008 }
4009
4010 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4011 throws RemoteException {
4012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 data.writeStrongBinder(token);
4016 target.writeToParcel(data, 0);
4017 data.writeInt(resultCode);
4018 if (resultData != null) {
4019 data.writeInt(1);
4020 resultData.writeToParcel(data, 0);
4021 } else {
4022 data.writeInt(0);
4023 }
4024 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4025 reply.readException();
4026 boolean result = reply.readInt() != 0;
4027 data.recycle();
4028 reply.recycle();
4029 return result;
4030 }
4031
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004032 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4033 Parcel data = Parcel.obtain();
4034 Parcel reply = Parcel.obtain();
4035 data.writeInterfaceToken(IActivityManager.descriptor);
4036 data.writeStrongBinder(activityToken);
4037 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4038 reply.readException();
4039 int result = reply.readInt();
4040 data.recycle();
4041 reply.recycle();
4042 return result;
4043 }
4044
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004045 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4050 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4051 reply.readException();
4052 data.recycle();
4053 reply.recycle();
4054 }
4055
4056 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4057 Parcel data = Parcel.obtain();
4058 Parcel reply = Parcel.obtain();
4059 data.writeInterfaceToken(IActivityManager.descriptor);
4060 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4061 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4062 reply.readException();
4063 data.recycle();
4064 reply.recycle();
4065 }
4066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067 private IBinder mRemote;
4068}