blob: 773f73cbd1deaf7c9f0a2706885cd0f849734ddf [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 }
501
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 }
515
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800516 case GET_SERVICES_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 int maxNum = data.readInt();
519 int fl = data.readInt();
520 List list = getServices(maxNum, fl);
521 reply.writeNoException();
522 int N = list != null ? list.size() : -1;
523 reply.writeInt(N);
524 int i;
525 for (i=0; i<N; i++) {
526 ActivityManager.RunningServiceInfo info =
527 (ActivityManager.RunningServiceInfo)list.get(i);
528 info.writeToParcel(reply, 0);
529 }
530 return true;
531 }
532
533 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
534 data.enforceInterface(IActivityManager.descriptor);
535 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
536 reply.writeNoException();
537 reply.writeTypedList(list);
538 return true;
539 }
540
541 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
542 data.enforceInterface(IActivityManager.descriptor);
543 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
544 reply.writeNoException();
545 reply.writeTypedList(list);
546 return true;
547 }
548
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700549 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
550 data.enforceInterface(IActivityManager.descriptor);
551 List<ApplicationInfo> list = getRunningExternalApplications();
552 reply.writeNoException();
553 reply.writeTypedList(list);
554 return true;
555 }
556
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800557 case MOVE_TASK_TO_FRONT_TRANSACTION: {
558 data.enforceInterface(IActivityManager.descriptor);
559 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800560 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700561 Bundle options = data.readInt() != 0
562 ? Bundle.CREATOR.createFromParcel(data) : null;
563 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800564 reply.writeNoException();
565 return true;
566 }
567
568 case MOVE_TASK_TO_BACK_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 int task = data.readInt();
571 moveTaskToBack(task);
572 reply.writeNoException();
573 return true;
574 }
575
576 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
577 data.enforceInterface(IActivityManager.descriptor);
578 IBinder token = data.readStrongBinder();
579 boolean nonRoot = data.readInt() != 0;
580 boolean res = moveActivityTaskToBack(token, nonRoot);
581 reply.writeNoException();
582 reply.writeInt(res ? 1 : 0);
583 return true;
584 }
585
586 case MOVE_TASK_BACKWARDS_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 int task = data.readInt();
589 moveTaskBackwards(task);
590 reply.writeNoException();
591 return true;
592 }
593
594 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
595 data.enforceInterface(IActivityManager.descriptor);
596 IBinder token = data.readStrongBinder();
597 boolean onlyRoot = data.readInt() != 0;
598 int res = token != null
599 ? getTaskForActivity(token, onlyRoot) : -1;
600 reply.writeNoException();
601 reply.writeInt(res);
602 return true;
603 }
604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 case REPORT_THUMBNAIL_TRANSACTION: {
606 data.enforceInterface(IActivityManager.descriptor);
607 IBinder token = data.readStrongBinder();
608 Bitmap thumbnail = data.readInt() != 0
609 ? Bitmap.CREATOR.createFromParcel(data) : null;
610 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
611 reportThumbnail(token, thumbnail, description);
612 reply.writeNoException();
613 return true;
614 }
615
616 case GET_CONTENT_PROVIDER_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 IBinder b = data.readStrongBinder();
619 IApplicationThread app = ApplicationThreadNative.asInterface(b);
620 String name = data.readString();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700621 boolean stable = data.readInt() != 0;
622 ContentProviderHolder cph = getContentProvider(app, name, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800623 reply.writeNoException();
624 if (cph != null) {
625 reply.writeInt(1);
626 cph.writeToParcel(reply, 0);
627 } else {
628 reply.writeInt(0);
629 }
630 return true;
631 }
632
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800633 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 String name = data.readString();
636 IBinder token = data.readStrongBinder();
637 ContentProviderHolder cph = getContentProviderExternal(name, token);
638 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 IBinder b = data.readStrongBinder();
651 IApplicationThread app = ApplicationThreadNative.asInterface(b);
652 ArrayList<ContentProviderHolder> providers =
653 data.createTypedArrayList(ContentProviderHolder.CREATOR);
654 publishContentProviders(app, providers);
655 reply.writeNoException();
656 return true;
657 }
658
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700659 case REF_CONTENT_PROVIDER_TRANSACTION: {
660 data.enforceInterface(IActivityManager.descriptor);
661 IBinder b = data.readStrongBinder();
662 int stable = data.readInt();
663 int unstable = data.readInt();
664 boolean res = refContentProvider(b, stable, unstable);
665 reply.writeNoException();
666 reply.writeInt(res ? 1 : 0);
667 return true;
668 }
669
670 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 IBinder b = data.readStrongBinder();
673 unstableProviderDied(b);
674 reply.writeNoException();
675 return true;
676 }
677
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800678 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
679 data.enforceInterface(IActivityManager.descriptor);
680 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700681 boolean stable = data.readInt() != 0;
682 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800683 reply.writeNoException();
684 return true;
685 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800686
687 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
688 data.enforceInterface(IActivityManager.descriptor);
689 String name = data.readString();
690 IBinder token = data.readStrongBinder();
691 removeContentProviderExternal(name, token);
692 reply.writeNoException();
693 return true;
694 }
695
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700696 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
697 data.enforceInterface(IActivityManager.descriptor);
698 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
699 PendingIntent pi = getRunningServiceControlPanel(comp);
700 reply.writeNoException();
701 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
702 return true;
703 }
704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 case START_SERVICE_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 IBinder b = data.readStrongBinder();
708 IApplicationThread app = ApplicationThreadNative.asInterface(b);
709 Intent service = Intent.CREATOR.createFromParcel(data);
710 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700711 int userId = data.readInt();
712 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800713 reply.writeNoException();
714 ComponentName.writeToParcel(cn, reply);
715 return true;
716 }
717
718 case STOP_SERVICE_TRANSACTION: {
719 data.enforceInterface(IActivityManager.descriptor);
720 IBinder b = data.readStrongBinder();
721 IApplicationThread app = ApplicationThreadNative.asInterface(b);
722 Intent service = Intent.CREATOR.createFromParcel(data);
723 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700724 int userId = data.readInt();
725 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800726 reply.writeNoException();
727 reply.writeInt(res);
728 return true;
729 }
730
731 case STOP_SERVICE_TOKEN_TRANSACTION: {
732 data.enforceInterface(IActivityManager.descriptor);
733 ComponentName className = ComponentName.readFromParcel(data);
734 IBinder token = data.readStrongBinder();
735 int startId = data.readInt();
736 boolean res = stopServiceToken(className, token, startId);
737 reply.writeNoException();
738 reply.writeInt(res ? 1 : 0);
739 return true;
740 }
741
742 case SET_SERVICE_FOREGROUND_TRANSACTION: {
743 data.enforceInterface(IActivityManager.descriptor);
744 ComponentName className = ComponentName.readFromParcel(data);
745 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700746 int id = data.readInt();
747 Notification notification = null;
748 if (data.readInt() != 0) {
749 notification = Notification.CREATOR.createFromParcel(data);
750 }
751 boolean removeNotification = data.readInt() != 0;
752 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800753 reply.writeNoException();
754 return true;
755 }
756
757 case BIND_SERVICE_TRANSACTION: {
758 data.enforceInterface(IActivityManager.descriptor);
759 IBinder b = data.readStrongBinder();
760 IApplicationThread app = ApplicationThreadNative.asInterface(b);
761 IBinder token = data.readStrongBinder();
762 Intent service = Intent.CREATOR.createFromParcel(data);
763 String resolvedType = data.readString();
764 b = data.readStrongBinder();
765 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800766 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800767 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800768 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800769 reply.writeNoException();
770 reply.writeInt(res);
771 return true;
772 }
773
774 case UNBIND_SERVICE_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 IBinder b = data.readStrongBinder();
777 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
778 boolean res = unbindService(conn);
779 reply.writeNoException();
780 reply.writeInt(res ? 1 : 0);
781 return true;
782 }
783
784 case PUBLISH_SERVICE_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 IBinder token = data.readStrongBinder();
787 Intent intent = Intent.CREATOR.createFromParcel(data);
788 IBinder service = data.readStrongBinder();
789 publishService(token, intent, service);
790 reply.writeNoException();
791 return true;
792 }
793
794 case UNBIND_FINISHED_TRANSACTION: {
795 data.enforceInterface(IActivityManager.descriptor);
796 IBinder token = data.readStrongBinder();
797 Intent intent = Intent.CREATOR.createFromParcel(data);
798 boolean doRebind = data.readInt() != 0;
799 unbindFinished(token, intent, doRebind);
800 reply.writeNoException();
801 return true;
802 }
803
804 case SERVICE_DONE_EXECUTING_TRANSACTION: {
805 data.enforceInterface(IActivityManager.descriptor);
806 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700807 int type = data.readInt();
808 int startId = data.readInt();
809 int res = data.readInt();
810 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 reply.writeNoException();
812 return true;
813 }
814
815 case START_INSTRUMENTATION_TRANSACTION: {
816 data.enforceInterface(IActivityManager.descriptor);
817 ComponentName className = ComponentName.readFromParcel(data);
818 String profileFile = data.readString();
819 int fl = data.readInt();
820 Bundle arguments = data.readBundle();
821 IBinder b = data.readStrongBinder();
822 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700823 int userId = data.readInt();
824 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 reply.writeNoException();
826 reply.writeInt(res ? 1 : 0);
827 return true;
828 }
829
830
831 case FINISH_INSTRUMENTATION_TRANSACTION: {
832 data.enforceInterface(IActivityManager.descriptor);
833 IBinder b = data.readStrongBinder();
834 IApplicationThread app = ApplicationThreadNative.asInterface(b);
835 int resultCode = data.readInt();
836 Bundle results = data.readBundle();
837 finishInstrumentation(app, resultCode, results);
838 reply.writeNoException();
839 return true;
840 }
841
842 case GET_CONFIGURATION_TRANSACTION: {
843 data.enforceInterface(IActivityManager.descriptor);
844 Configuration config = getConfiguration();
845 reply.writeNoException();
846 config.writeToParcel(reply, 0);
847 return true;
848 }
849
850 case UPDATE_CONFIGURATION_TRANSACTION: {
851 data.enforceInterface(IActivityManager.descriptor);
852 Configuration config = Configuration.CREATOR.createFromParcel(data);
853 updateConfiguration(config);
854 reply.writeNoException();
855 return true;
856 }
857
858 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
859 data.enforceInterface(IActivityManager.descriptor);
860 IBinder token = data.readStrongBinder();
861 int requestedOrientation = data.readInt();
862 setRequestedOrientation(token, requestedOrientation);
863 reply.writeNoException();
864 return true;
865 }
866
867 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
868 data.enforceInterface(IActivityManager.descriptor);
869 IBinder token = data.readStrongBinder();
870 int req = getRequestedOrientation(token);
871 reply.writeNoException();
872 reply.writeInt(req);
873 return true;
874 }
875
876 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
877 data.enforceInterface(IActivityManager.descriptor);
878 IBinder token = data.readStrongBinder();
879 ComponentName cn = getActivityClassForToken(token);
880 reply.writeNoException();
881 ComponentName.writeToParcel(cn, reply);
882 return true;
883 }
884
885 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder token = data.readStrongBinder();
888 reply.writeNoException();
889 reply.writeString(getPackageForToken(token));
890 return true;
891 }
892
893 case GET_INTENT_SENDER_TRANSACTION: {
894 data.enforceInterface(IActivityManager.descriptor);
895 int type = data.readInt();
896 String packageName = data.readString();
897 IBinder token = data.readStrongBinder();
898 String resultWho = data.readString();
899 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800900 Intent[] requestIntents;
901 String[] requestResolvedTypes;
902 if (data.readInt() != 0) {
903 requestIntents = data.createTypedArray(Intent.CREATOR);
904 requestResolvedTypes = data.createStringArray();
905 } else {
906 requestIntents = null;
907 requestResolvedTypes = null;
908 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800909 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700910 Bundle options = data.readInt() != 0
911 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700912 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800913 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800914 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700915 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800916 reply.writeNoException();
917 reply.writeStrongBinder(res != null ? res.asBinder() : null);
918 return true;
919 }
920
921 case CANCEL_INTENT_SENDER_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 IIntentSender r = IIntentSender.Stub.asInterface(
924 data.readStrongBinder());
925 cancelIntentSender(r);
926 reply.writeNoException();
927 return true;
928 }
929
930 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 IIntentSender r = IIntentSender.Stub.asInterface(
933 data.readStrongBinder());
934 String res = getPackageForIntentSender(r);
935 reply.writeNoException();
936 reply.writeString(res);
937 return true;
938 }
939
Christopher Tatec4a07d12012-04-06 14:19:13 -0700940 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
941 data.enforceInterface(IActivityManager.descriptor);
942 IIntentSender r = IIntentSender.Stub.asInterface(
943 data.readStrongBinder());
944 int res = getUidForIntentSender(r);
945 reply.writeNoException();
946 reply.writeInt(res);
947 return true;
948 }
949
Dianne Hackborn41203752012-08-31 14:05:51 -0700950 case HANDLE_INCOMING_USER_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 int callingPid = data.readInt();
953 int callingUid = data.readInt();
954 int userId = data.readInt();
955 boolean allowAll = data.readInt() != 0 ;
956 boolean requireFull = data.readInt() != 0;
957 String name = data.readString();
958 String callerPackage = data.readString();
959 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
960 requireFull, name, callerPackage);
961 reply.writeNoException();
962 reply.writeInt(res);
963 return true;
964 }
965
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800966 case SET_PROCESS_LIMIT_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 int max = data.readInt();
969 setProcessLimit(max);
970 reply.writeNoException();
971 return true;
972 }
973
974 case GET_PROCESS_LIMIT_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 int limit = getProcessLimit();
977 reply.writeNoException();
978 reply.writeInt(limit);
979 return true;
980 }
981
982 case SET_PROCESS_FOREGROUND_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 IBinder token = data.readStrongBinder();
985 int pid = data.readInt();
986 boolean isForeground = data.readInt() != 0;
987 setProcessForeground(token, pid, isForeground);
988 reply.writeNoException();
989 return true;
990 }
991
992 case CHECK_PERMISSION_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 String perm = data.readString();
995 int pid = data.readInt();
996 int uid = data.readInt();
997 int res = checkPermission(perm, pid, uid);
998 reply.writeNoException();
999 reply.writeInt(res);
1000 return true;
1001 }
1002
1003 case CHECK_URI_PERMISSION_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 Uri uri = Uri.CREATOR.createFromParcel(data);
1006 int pid = data.readInt();
1007 int uid = data.readInt();
1008 int mode = data.readInt();
1009 int res = checkUriPermission(uri, pid, uid, mode);
1010 reply.writeNoException();
1011 reply.writeInt(res);
1012 return true;
1013 }
1014
1015 case CLEAR_APP_DATA_TRANSACTION: {
1016 data.enforceInterface(IActivityManager.descriptor);
1017 String packageName = data.readString();
1018 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1019 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001020 int userId = data.readInt();
1021 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001022 reply.writeNoException();
1023 reply.writeInt(res ? 1 : 0);
1024 return true;
1025 }
1026
1027 case GRANT_URI_PERMISSION_TRANSACTION: {
1028 data.enforceInterface(IActivityManager.descriptor);
1029 IBinder b = data.readStrongBinder();
1030 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1031 String targetPkg = data.readString();
1032 Uri uri = Uri.CREATOR.createFromParcel(data);
1033 int mode = data.readInt();
1034 grantUriPermission(app, targetPkg, uri, mode);
1035 reply.writeNoException();
1036 return true;
1037 }
1038
1039 case REVOKE_URI_PERMISSION_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 IBinder b = data.readStrongBinder();
1042 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1043 Uri uri = Uri.CREATOR.createFromParcel(data);
1044 int mode = data.readInt();
1045 revokeUriPermission(app, uri, mode);
1046 reply.writeNoException();
1047 return true;
1048 }
1049
1050 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 IBinder b = data.readStrongBinder();
1053 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1054 boolean waiting = data.readInt() != 0;
1055 showWaitingForDebugger(app, waiting);
1056 reply.writeNoException();
1057 return true;
1058 }
1059
1060 case GET_MEMORY_INFO_TRANSACTION: {
1061 data.enforceInterface(IActivityManager.descriptor);
1062 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1063 getMemoryInfo(mi);
1064 reply.writeNoException();
1065 mi.writeToParcel(reply, 0);
1066 return true;
1067 }
1068
1069 case UNHANDLED_BACK_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 unhandledBack();
1072 reply.writeNoException();
1073 return true;
1074 }
1075
1076 case OPEN_CONTENT_URI_TRANSACTION: {
1077 data.enforceInterface(IActivityManager.descriptor);
1078 Uri uri = Uri.parse(data.readString());
1079 ParcelFileDescriptor pfd = openContentUri(uri);
1080 reply.writeNoException();
1081 if (pfd != null) {
1082 reply.writeInt(1);
1083 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1084 } else {
1085 reply.writeInt(0);
1086 }
1087 return true;
1088 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001089
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001090 case GOING_TO_SLEEP_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 goingToSleep();
1093 reply.writeNoException();
1094 return true;
1095 }
1096
1097 case WAKING_UP_TRANSACTION: {
1098 data.enforceInterface(IActivityManager.descriptor);
1099 wakingUp();
1100 reply.writeNoException();
1101 return true;
1102 }
1103
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001104 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 setLockScreenShown(data.readInt() != 0);
1107 reply.writeNoException();
1108 return true;
1109 }
1110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001111 case SET_DEBUG_APP_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 String pn = data.readString();
1114 boolean wfd = data.readInt() != 0;
1115 boolean per = data.readInt() != 0;
1116 setDebugApp(pn, wfd, per);
1117 reply.writeNoException();
1118 return true;
1119 }
1120
1121 case SET_ALWAYS_FINISH_TRANSACTION: {
1122 data.enforceInterface(IActivityManager.descriptor);
1123 boolean enabled = data.readInt() != 0;
1124 setAlwaysFinish(enabled);
1125 reply.writeNoException();
1126 return true;
1127 }
1128
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001129 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001131 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001133 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001134 return true;
1135 }
1136
1137 case ENTER_SAFE_MODE_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 enterSafeMode();
1140 reply.writeNoException();
1141 return true;
1142 }
1143
1144 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1145 data.enforceInterface(IActivityManager.descriptor);
1146 IIntentSender is = IIntentSender.Stub.asInterface(
1147 data.readStrongBinder());
1148 noteWakeupAlarm(is);
1149 reply.writeNoException();
1150 return true;
1151 }
1152
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001153 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 data.enforceInterface(IActivityManager.descriptor);
1155 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001156 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001157 boolean secure = data.readInt() != 0;
1158 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 reply.writeNoException();
1160 reply.writeInt(res ? 1 : 0);
1161 return true;
1162 }
1163
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001164 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1165 data.enforceInterface(IActivityManager.descriptor);
1166 String reason = data.readString();
1167 boolean res = killProcessesBelowForeground(reason);
1168 reply.writeNoException();
1169 reply.writeInt(res ? 1 : 0);
1170 return true;
1171 }
1172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 case START_RUNNING_TRANSACTION: {
1174 data.enforceInterface(IActivityManager.descriptor);
1175 String pkg = data.readString();
1176 String cls = data.readString();
1177 String action = data.readString();
1178 String indata = data.readString();
1179 startRunning(pkg, cls, action, indata);
1180 reply.writeNoException();
1181 return true;
1182 }
1183
Dan Egnor60d87622009-12-16 16:32:58 -08001184 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1185 data.enforceInterface(IActivityManager.descriptor);
1186 IBinder app = data.readStrongBinder();
1187 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1188 handleApplicationCrash(app, ci);
1189 reply.writeNoException();
1190 return true;
1191 }
1192
1193 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 data.enforceInterface(IActivityManager.descriptor);
1195 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001197 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001198 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001199 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001200 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 return true;
1202 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001203
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001204 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001207 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001208 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1209 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001210 reply.writeNoException();
1211 return true;
1212 }
1213
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
1216 int sig = data.readInt();
1217 signalPersistentProcesses(sig);
1218 reply.writeNoException();
1219 return true;
1220 }
1221
Dianne Hackborn03abb812010-01-04 18:43:19 -08001222 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1223 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001225 int userId = data.readInt();
1226 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001227 reply.writeNoException();
1228 return true;
1229 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001230
1231 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1232 data.enforceInterface(IActivityManager.descriptor);
1233 killAllBackgroundProcesses();
1234 reply.writeNoException();
1235 return true;
1236 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001237
1238 case FORCE_STOP_PACKAGE_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
1240 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001241 int userId = data.readInt();
1242 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 reply.writeNoException();
1244 return true;
1245 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001246
1247 case GET_MY_MEMORY_STATE_TRANSACTION: {
1248 data.enforceInterface(IActivityManager.descriptor);
1249 ActivityManager.RunningAppProcessInfo info =
1250 new ActivityManager.RunningAppProcessInfo();
1251 getMyMemoryState(info);
1252 reply.writeNoException();
1253 info.writeToParcel(reply, 0);
1254 return true;
1255 }
1256
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 ConfigurationInfo config = getDeviceConfigurationInfo();
1260 reply.writeNoException();
1261 config.writeToParcel(reply, 0);
1262 return true;
1263 }
1264
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001265 case PROFILE_CONTROL_TRANSACTION: {
1266 data.enforceInterface(IActivityManager.descriptor);
1267 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001268 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001269 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001270 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001271 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001272 ParcelFileDescriptor fd = data.readInt() != 0
1273 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001274 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001275 reply.writeNoException();
1276 reply.writeInt(res ? 1 : 0);
1277 return true;
1278 }
1279
Dianne Hackborn55280a92009-05-07 15:53:46 -07001280 case SHUTDOWN_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 boolean res = shutdown(data.readInt());
1283 reply.writeNoException();
1284 reply.writeInt(res ? 1 : 0);
1285 return true;
1286 }
1287
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001288 case STOP_APP_SWITCHES_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 stopAppSwitches();
1291 reply.writeNoException();
1292 return true;
1293 }
1294
1295 case RESUME_APP_SWITCHES_TRANSACTION: {
1296 data.enforceInterface(IActivityManager.descriptor);
1297 resumeAppSwitches();
1298 reply.writeNoException();
1299 return true;
1300 }
1301
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 case PEEK_SERVICE_TRANSACTION: {
1303 data.enforceInterface(IActivityManager.descriptor);
1304 Intent service = Intent.CREATOR.createFromParcel(data);
1305 String resolvedType = data.readString();
1306 IBinder binder = peekService(service, resolvedType);
1307 reply.writeNoException();
1308 reply.writeStrongBinder(binder);
1309 return true;
1310 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001311
1312 case START_BACKUP_AGENT_TRANSACTION: {
1313 data.enforceInterface(IActivityManager.descriptor);
1314 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1315 int backupRestoreMode = data.readInt();
1316 boolean success = bindBackupAgent(info, backupRestoreMode);
1317 reply.writeNoException();
1318 reply.writeInt(success ? 1 : 0);
1319 return true;
1320 }
1321
1322 case BACKUP_AGENT_CREATED_TRANSACTION: {
1323 data.enforceInterface(IActivityManager.descriptor);
1324 String packageName = data.readString();
1325 IBinder agent = data.readStrongBinder();
1326 backupAgentCreated(packageName, agent);
1327 reply.writeNoException();
1328 return true;
1329 }
1330
1331 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1332 data.enforceInterface(IActivityManager.descriptor);
1333 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1334 unbindBackupAgent(info);
1335 reply.writeNoException();
1336 return true;
1337 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001338
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001339 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001340 data.enforceInterface(IActivityManager.descriptor);
1341 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001342 int appid = data.readInt();
1343 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001344 reply.writeNoException();
1345 return true;
1346 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001347
1348 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 String reason = data.readString();
1351 closeSystemDialogs(reason);
1352 reply.writeNoException();
1353 return true;
1354 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001355
1356 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1357 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001358 int[] pids = data.createIntArray();
1359 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001360 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001361 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001362 return true;
1363 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001364
1365 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 String processName = data.readString();
1368 int uid = data.readInt();
1369 killApplicationProcess(processName, uid);
1370 reply.writeNoException();
1371 return true;
1372 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001373
1374 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1375 data.enforceInterface(IActivityManager.descriptor);
1376 IBinder token = data.readStrongBinder();
1377 String packageName = data.readString();
1378 int enterAnim = data.readInt();
1379 int exitAnim = data.readInt();
1380 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001381 reply.writeNoException();
1382 return true;
1383 }
1384
1385 case IS_USER_A_MONKEY_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001387 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001388 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001389 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001390 return true;
1391 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001392
1393 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 finishHeavyWeightApp();
1396 reply.writeNoException();
1397 return true;
1398 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001399
1400 case IS_IMMERSIVE_TRANSACTION: {
1401 data.enforceInterface(IActivityManager.descriptor);
1402 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001403 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001404 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001405 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001406 return true;
1407 }
1408
1409 case SET_IMMERSIVE_TRANSACTION: {
1410 data.enforceInterface(IActivityManager.descriptor);
1411 IBinder token = data.readStrongBinder();
1412 boolean imm = data.readInt() == 1;
1413 setImmersive(token, imm);
1414 reply.writeNoException();
1415 return true;
1416 }
1417
1418 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001420 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001421 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001422 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001423 return true;
1424 }
1425
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001426 case CRASH_APPLICATION_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 int uid = data.readInt();
1429 int initialPid = data.readInt();
1430 String packageName = data.readString();
1431 String message = data.readString();
1432 crashApplication(uid, initialPid, packageName, message);
1433 reply.writeNoException();
1434 return true;
1435 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001436
1437 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001440 int userId = data.readInt();
1441 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001442 reply.writeNoException();
1443 reply.writeString(type);
1444 return true;
1445 }
1446
Dianne Hackborn7e269642010-08-25 19:50:20 -07001447 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1448 data.enforceInterface(IActivityManager.descriptor);
1449 String name = data.readString();
1450 IBinder perm = newUriPermissionOwner(name);
1451 reply.writeNoException();
1452 reply.writeStrongBinder(perm);
1453 return true;
1454 }
1455
1456 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1457 data.enforceInterface(IActivityManager.descriptor);
1458 IBinder owner = data.readStrongBinder();
1459 int fromUid = data.readInt();
1460 String targetPkg = data.readString();
1461 Uri uri = Uri.CREATOR.createFromParcel(data);
1462 int mode = data.readInt();
1463 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1464 reply.writeNoException();
1465 return true;
1466 }
1467
1468 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1469 data.enforceInterface(IActivityManager.descriptor);
1470 IBinder owner = data.readStrongBinder();
1471 Uri uri = null;
1472 if (data.readInt() != 0) {
1473 Uri.CREATOR.createFromParcel(data);
1474 }
1475 int mode = data.readInt();
1476 revokeUriPermissionFromOwner(owner, uri, mode);
1477 reply.writeNoException();
1478 return true;
1479 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001480
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001481 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 int callingUid = data.readInt();
1484 String targetPkg = data.readString();
1485 Uri uri = Uri.CREATOR.createFromParcel(data);
1486 int modeFlags = data.readInt();
1487 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1488 reply.writeNoException();
1489 reply.writeInt(res);
1490 return true;
1491 }
1492
Andy McFadden824c5102010-07-09 16:26:57 -07001493 case DUMP_HEAP_TRANSACTION: {
1494 data.enforceInterface(IActivityManager.descriptor);
1495 String process = data.readString();
1496 boolean managed = data.readInt() != 0;
1497 String path = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001498 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001499 ParcelFileDescriptor fd = data.readInt() != 0
1500 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001501 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001502 reply.writeNoException();
1503 reply.writeInt(res ? 1 : 0);
1504 return true;
1505 }
1506
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001507 case START_ACTIVITIES_TRANSACTION:
1508 {
1509 data.enforceInterface(IActivityManager.descriptor);
1510 IBinder b = data.readStrongBinder();
1511 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1512 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1513 String[] resolvedTypes = data.createStringArray();
1514 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001515 Bundle options = data.readInt() != 0
1516 ? Bundle.CREATOR.createFromParcel(data) : null;
1517 int result = startActivities(app, intents, resolvedTypes, resultTo,
1518 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001519 reply.writeNoException();
1520 reply.writeInt(result);
1521 return true;
1522 }
1523
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001524 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1525 {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 int mode = getFrontActivityScreenCompatMode();
1528 reply.writeNoException();
1529 reply.writeInt(mode);
1530 return true;
1531 }
1532
1533 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1534 {
1535 data.enforceInterface(IActivityManager.descriptor);
1536 int mode = data.readInt();
1537 setFrontActivityScreenCompatMode(mode);
1538 reply.writeNoException();
1539 reply.writeInt(mode);
1540 return true;
1541 }
1542
1543 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1544 {
1545 data.enforceInterface(IActivityManager.descriptor);
1546 String pkg = data.readString();
1547 int mode = getPackageScreenCompatMode(pkg);
1548 reply.writeNoException();
1549 reply.writeInt(mode);
1550 return true;
1551 }
1552
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001553 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1554 {
1555 data.enforceInterface(IActivityManager.descriptor);
1556 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001557 int mode = data.readInt();
1558 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001559 reply.writeNoException();
1560 return true;
1561 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001562
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001563 case SWITCH_USER_TRANSACTION: {
1564 data.enforceInterface(IActivityManager.descriptor);
1565 int userid = data.readInt();
1566 boolean result = switchUser(userid);
1567 reply.writeNoException();
1568 reply.writeInt(result ? 1 : 0);
1569 return true;
1570 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001571
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001572 case STOP_USER_TRANSACTION: {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 int userid = data.readInt();
1575 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1576 data.readStrongBinder());
1577 int result = stopUser(userid, callback);
1578 reply.writeNoException();
1579 reply.writeInt(result);
1580 return true;
1581 }
1582
Amith Yamasani52f1d752012-03-28 18:19:29 -07001583 case GET_CURRENT_USER_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 UserInfo userInfo = getCurrentUser();
1586 reply.writeNoException();
1587 userInfo.writeToParcel(reply, 0);
1588 return true;
1589 }
1590
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001591 case IS_USER_RUNNING_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
1593 int userid = data.readInt();
1594 boolean result = isUserRunning(userid);
1595 reply.writeNoException();
1596 reply.writeInt(result ? 1 : 0);
1597 return true;
1598 }
1599
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001600 case REMOVE_SUB_TASK_TRANSACTION:
1601 {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 int taskId = data.readInt();
1604 int subTaskIndex = data.readInt();
1605 boolean result = removeSubTask(taskId, subTaskIndex);
1606 reply.writeNoException();
1607 reply.writeInt(result ? 1 : 0);
1608 return true;
1609 }
1610
1611 case REMOVE_TASK_TRANSACTION:
1612 {
1613 data.enforceInterface(IActivityManager.descriptor);
1614 int taskId = data.readInt();
1615 int fl = data.readInt();
1616 boolean result = removeTask(taskId, fl);
1617 reply.writeNoException();
1618 reply.writeInt(result ? 1 : 0);
1619 return true;
1620 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001621
Jeff Sharkeya4620792011-05-20 15:29:23 -07001622 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1623 data.enforceInterface(IActivityManager.descriptor);
1624 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1625 data.readStrongBinder());
1626 registerProcessObserver(observer);
1627 return true;
1628 }
1629
1630 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1633 data.readStrongBinder());
1634 unregisterProcessObserver(observer);
1635 return true;
1636 }
1637
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001638 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1639 {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 String pkg = data.readString();
1642 boolean ask = getPackageAskScreenCompat(pkg);
1643 reply.writeNoException();
1644 reply.writeInt(ask ? 1 : 0);
1645 return true;
1646 }
1647
1648 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1649 {
1650 data.enforceInterface(IActivityManager.descriptor);
1651 String pkg = data.readString();
1652 boolean ask = data.readInt() != 0;
1653 setPackageAskScreenCompat(pkg, ask);
1654 reply.writeNoException();
1655 return true;
1656 }
1657
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001658 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1659 data.enforceInterface(IActivityManager.descriptor);
1660 IIntentSender r = IIntentSender.Stub.asInterface(
1661 data.readStrongBinder());
1662 boolean res = isIntentSenderTargetedToPackage(r);
1663 reply.writeNoException();
1664 reply.writeInt(res ? 1 : 0);
1665 return true;
1666 }
1667
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001668 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1669 data.enforceInterface(IActivityManager.descriptor);
1670 IIntentSender r = IIntentSender.Stub.asInterface(
1671 data.readStrongBinder());
1672 boolean res = isIntentSenderAnActivity(r);
1673 reply.writeNoException();
1674 reply.writeInt(res ? 1 : 0);
1675 return true;
1676 }
1677
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001678 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 Configuration config = Configuration.CREATOR.createFromParcel(data);
1681 updatePersistentConfiguration(config);
1682 reply.writeNoException();
1683 return true;
1684 }
1685
Dianne Hackbornb437e092011-08-05 17:50:29 -07001686 case GET_PROCESS_PSS_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 int[] pids = data.createIntArray();
1689 long[] pss = getProcessPss(pids);
1690 reply.writeNoException();
1691 reply.writeLongArray(pss);
1692 return true;
1693 }
1694
Dianne Hackborn661cd522011-08-22 00:26:20 -07001695 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1698 boolean always = data.readInt() != 0;
1699 showBootMessage(msg, always);
1700 reply.writeNoException();
1701 return true;
1702 }
1703
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001704 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 dismissKeyguardOnNextActivity();
1707 reply.writeNoException();
1708 return true;
1709 }
1710
Adam Powelldd8fab22012-03-22 17:47:27 -07001711 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
1713 IBinder token = data.readStrongBinder();
1714 String destAffinity = data.readString();
1715 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1716 reply.writeNoException();
1717 reply.writeInt(res ? 1 : 0);
1718 return true;
1719 }
1720
1721 case NAVIGATE_UP_TO_TRANSACTION: {
1722 data.enforceInterface(IActivityManager.descriptor);
1723 IBinder token = data.readStrongBinder();
1724 Intent target = Intent.CREATOR.createFromParcel(data);
1725 int resultCode = data.readInt();
1726 Intent resultData = null;
1727 if (data.readInt() != 0) {
1728 resultData = Intent.CREATOR.createFromParcel(data);
1729 }
1730 boolean res = navigateUpTo(token, target, resultCode, resultData);
1731 reply.writeNoException();
1732 reply.writeInt(res ? 1 : 0);
1733 return true;
1734 }
1735
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001736 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1737 data.enforceInterface(IActivityManager.descriptor);
1738 IBinder token = data.readStrongBinder();
1739 int res = getLaunchedFromUid(token);
1740 reply.writeNoException();
1741 reply.writeInt(res);
1742 return true;
1743 }
1744
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001745 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1746 data.enforceInterface(IActivityManager.descriptor);
1747 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1748 data.readStrongBinder());
1749 registerUserSwitchObserver(observer);
1750 return true;
1751 }
1752
1753 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1754 data.enforceInterface(IActivityManager.descriptor);
1755 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1756 data.readStrongBinder());
1757 unregisterUserSwitchObserver(observer);
1758 return true;
1759 }
1760
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001761 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001762
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001763 return super.onTransact(code, data, reply, flags);
1764 }
1765
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001766 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001767 return this;
1768 }
1769
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001770 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1771 protected IActivityManager create() {
1772 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001773 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001774 Log.v("ActivityManager", "default service binder = " + b);
1775 }
1776 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001777 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001778 Log.v("ActivityManager", "default service = " + am);
1779 }
1780 return am;
1781 }
1782 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001783}
1784
1785class ActivityManagerProxy implements IActivityManager
1786{
1787 public ActivityManagerProxy(IBinder remote)
1788 {
1789 mRemote = remote;
1790 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001791
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001792 public IBinder asBinder()
1793 {
1794 return mRemote;
1795 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001796
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001797 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001798 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1799 int startFlags, String profileFile,
1800 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001801 Parcel data = Parcel.obtain();
1802 Parcel reply = Parcel.obtain();
1803 data.writeInterfaceToken(IActivityManager.descriptor);
1804 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1805 intent.writeToParcel(data, 0);
1806 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001807 data.writeStrongBinder(resultTo);
1808 data.writeString(resultWho);
1809 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001810 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001811 data.writeString(profileFile);
1812 if (profileFd != null) {
1813 data.writeInt(1);
1814 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1815 } else {
1816 data.writeInt(0);
1817 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001818 if (options != null) {
1819 data.writeInt(1);
1820 options.writeToParcel(data, 0);
1821 } else {
1822 data.writeInt(0);
1823 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001824 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1825 reply.readException();
1826 int result = reply.readInt();
1827 reply.recycle();
1828 data.recycle();
1829 return result;
1830 }
Amith Yamasani82644082012-08-03 13:09:11 -07001831
1832 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1833 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1834 int startFlags, String profileFile,
1835 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1836 Parcel data = Parcel.obtain();
1837 Parcel reply = Parcel.obtain();
1838 data.writeInterfaceToken(IActivityManager.descriptor);
1839 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1840 intent.writeToParcel(data, 0);
1841 data.writeString(resolvedType);
1842 data.writeStrongBinder(resultTo);
1843 data.writeString(resultWho);
1844 data.writeInt(requestCode);
1845 data.writeInt(startFlags);
1846 data.writeString(profileFile);
1847 if (profileFd != null) {
1848 data.writeInt(1);
1849 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1850 } else {
1851 data.writeInt(0);
1852 }
1853 if (options != null) {
1854 data.writeInt(1);
1855 options.writeToParcel(data, 0);
1856 } else {
1857 data.writeInt(0);
1858 }
1859 data.writeInt(userId);
1860 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1861 reply.readException();
1862 int result = reply.readInt();
1863 reply.recycle();
1864 data.recycle();
1865 return result;
1866 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001867 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001868 String resolvedType, IBinder resultTo, String resultWho,
1869 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001870 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001871 Parcel data = Parcel.obtain();
1872 Parcel reply = Parcel.obtain();
1873 data.writeInterfaceToken(IActivityManager.descriptor);
1874 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1875 intent.writeToParcel(data, 0);
1876 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001877 data.writeStrongBinder(resultTo);
1878 data.writeString(resultWho);
1879 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001880 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001881 data.writeString(profileFile);
1882 if (profileFd != null) {
1883 data.writeInt(1);
1884 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1885 } else {
1886 data.writeInt(0);
1887 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001888 if (options != null) {
1889 data.writeInt(1);
1890 options.writeToParcel(data, 0);
1891 } else {
1892 data.writeInt(0);
1893 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001894 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001895 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1896 reply.readException();
1897 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1898 reply.recycle();
1899 data.recycle();
1900 return result;
1901 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001902 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001903 String resolvedType, IBinder resultTo, String resultWho,
1904 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001905 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001906 Parcel data = Parcel.obtain();
1907 Parcel reply = Parcel.obtain();
1908 data.writeInterfaceToken(IActivityManager.descriptor);
1909 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1910 intent.writeToParcel(data, 0);
1911 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001912 data.writeStrongBinder(resultTo);
1913 data.writeString(resultWho);
1914 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001915 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001916 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001917 if (options != null) {
1918 data.writeInt(1);
1919 options.writeToParcel(data, 0);
1920 } else {
1921 data.writeInt(0);
1922 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001923 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001924 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1925 reply.readException();
1926 int result = reply.readInt();
1927 reply.recycle();
1928 data.recycle();
1929 return result;
1930 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001931 public int startActivityIntentSender(IApplicationThread caller,
1932 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001933 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001934 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001935 Parcel data = Parcel.obtain();
1936 Parcel reply = Parcel.obtain();
1937 data.writeInterfaceToken(IActivityManager.descriptor);
1938 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1939 intent.writeToParcel(data, 0);
1940 if (fillInIntent != null) {
1941 data.writeInt(1);
1942 fillInIntent.writeToParcel(data, 0);
1943 } else {
1944 data.writeInt(0);
1945 }
1946 data.writeString(resolvedType);
1947 data.writeStrongBinder(resultTo);
1948 data.writeString(resultWho);
1949 data.writeInt(requestCode);
1950 data.writeInt(flagsMask);
1951 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001952 if (options != null) {
1953 data.writeInt(1);
1954 options.writeToParcel(data, 0);
1955 } else {
1956 data.writeInt(0);
1957 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001958 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001959 reply.readException();
1960 int result = reply.readInt();
1961 reply.recycle();
1962 data.recycle();
1963 return result;
1964 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001965 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001966 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001967 Parcel data = Parcel.obtain();
1968 Parcel reply = Parcel.obtain();
1969 data.writeInterfaceToken(IActivityManager.descriptor);
1970 data.writeStrongBinder(callingActivity);
1971 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001972 if (options != null) {
1973 data.writeInt(1);
1974 options.writeToParcel(data, 0);
1975 } else {
1976 data.writeInt(0);
1977 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001978 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1979 reply.readException();
1980 int result = reply.readInt();
1981 reply.recycle();
1982 data.recycle();
1983 return result != 0;
1984 }
1985 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1986 throws RemoteException {
1987 Parcel data = Parcel.obtain();
1988 Parcel reply = Parcel.obtain();
1989 data.writeInterfaceToken(IActivityManager.descriptor);
1990 data.writeStrongBinder(token);
1991 data.writeInt(resultCode);
1992 if (resultData != null) {
1993 data.writeInt(1);
1994 resultData.writeToParcel(data, 0);
1995 } else {
1996 data.writeInt(0);
1997 }
1998 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1999 reply.readException();
2000 boolean res = reply.readInt() != 0;
2001 data.recycle();
2002 reply.recycle();
2003 return res;
2004 }
2005 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2006 {
2007 Parcel data = Parcel.obtain();
2008 Parcel reply = Parcel.obtain();
2009 data.writeInterfaceToken(IActivityManager.descriptor);
2010 data.writeStrongBinder(token);
2011 data.writeString(resultWho);
2012 data.writeInt(requestCode);
2013 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2014 reply.readException();
2015 data.recycle();
2016 reply.recycle();
2017 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002018 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2019 Parcel data = Parcel.obtain();
2020 Parcel reply = Parcel.obtain();
2021 data.writeInterfaceToken(IActivityManager.descriptor);
2022 data.writeStrongBinder(token);
2023 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2024 reply.readException();
2025 boolean res = reply.readInt() != 0;
2026 data.recycle();
2027 reply.recycle();
2028 return res;
2029 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002030 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2031 Parcel data = Parcel.obtain();
2032 Parcel reply = Parcel.obtain();
2033 data.writeInterfaceToken(IActivityManager.descriptor);
2034 data.writeStrongBinder(token);
2035 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2036 reply.readException();
2037 boolean res = reply.readInt() != 0;
2038 data.recycle();
2039 reply.recycle();
2040 return res;
2041 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002042 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002043 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002044 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002045 {
2046 Parcel data = Parcel.obtain();
2047 Parcel reply = Parcel.obtain();
2048 data.writeInterfaceToken(IActivityManager.descriptor);
2049 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002050 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002051 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2052 filter.writeToParcel(data, 0);
2053 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002054 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002055 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2056 reply.readException();
2057 Intent intent = null;
2058 int haveIntent = reply.readInt();
2059 if (haveIntent != 0) {
2060 intent = Intent.CREATOR.createFromParcel(reply);
2061 }
2062 reply.recycle();
2063 data.recycle();
2064 return intent;
2065 }
2066 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2067 {
2068 Parcel data = Parcel.obtain();
2069 Parcel reply = Parcel.obtain();
2070 data.writeInterfaceToken(IActivityManager.descriptor);
2071 data.writeStrongBinder(receiver.asBinder());
2072 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2073 reply.readException();
2074 data.recycle();
2075 reply.recycle();
2076 }
2077 public int broadcastIntent(IApplicationThread caller,
2078 Intent intent, String resolvedType, IIntentReceiver resultTo,
2079 int resultCode, String resultData, Bundle map,
2080 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002081 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002082 {
2083 Parcel data = Parcel.obtain();
2084 Parcel reply = Parcel.obtain();
2085 data.writeInterfaceToken(IActivityManager.descriptor);
2086 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2087 intent.writeToParcel(data, 0);
2088 data.writeString(resolvedType);
2089 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2090 data.writeInt(resultCode);
2091 data.writeString(resultData);
2092 data.writeBundle(map);
2093 data.writeString(requiredPermission);
2094 data.writeInt(serialized ? 1 : 0);
2095 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002096 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002097 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2098 reply.readException();
2099 int res = reply.readInt();
2100 reply.recycle();
2101 data.recycle();
2102 return res;
2103 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002104 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2105 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);
Amith Yamasani742a6712011-05-04 14:49:28 -07002112 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002113 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2114 reply.readException();
2115 data.recycle();
2116 reply.recycle();
2117 }
2118 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2119 {
2120 Parcel data = Parcel.obtain();
2121 Parcel reply = Parcel.obtain();
2122 data.writeInterfaceToken(IActivityManager.descriptor);
2123 data.writeStrongBinder(who);
2124 data.writeInt(resultCode);
2125 data.writeString(resultData);
2126 data.writeBundle(map);
2127 data.writeInt(abortBroadcast ? 1 : 0);
2128 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2129 reply.readException();
2130 data.recycle();
2131 reply.recycle();
2132 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002133 public void attachApplication(IApplicationThread app) throws RemoteException
2134 {
2135 Parcel data = Parcel.obtain();
2136 Parcel reply = Parcel.obtain();
2137 data.writeInterfaceToken(IActivityManager.descriptor);
2138 data.writeStrongBinder(app.asBinder());
2139 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2140 reply.readException();
2141 data.recycle();
2142 reply.recycle();
2143 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002144 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2145 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002146 {
2147 Parcel data = Parcel.obtain();
2148 Parcel reply = Parcel.obtain();
2149 data.writeInterfaceToken(IActivityManager.descriptor);
2150 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002151 if (config != null) {
2152 data.writeInt(1);
2153 config.writeToParcel(data, 0);
2154 } else {
2155 data.writeInt(0);
2156 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002157 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2159 reply.readException();
2160 data.recycle();
2161 reply.recycle();
2162 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002163 public void activityResumed(IBinder token) throws RemoteException
2164 {
2165 Parcel data = Parcel.obtain();
2166 Parcel reply = Parcel.obtain();
2167 data.writeInterfaceToken(IActivityManager.descriptor);
2168 data.writeStrongBinder(token);
2169 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2170 reply.readException();
2171 data.recycle();
2172 reply.recycle();
2173 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002174 public void activityPaused(IBinder token) throws RemoteException
2175 {
2176 Parcel data = Parcel.obtain();
2177 Parcel reply = Parcel.obtain();
2178 data.writeInterfaceToken(IActivityManager.descriptor);
2179 data.writeStrongBinder(token);
2180 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2181 reply.readException();
2182 data.recycle();
2183 reply.recycle();
2184 }
2185 public void activityStopped(IBinder token, Bundle state,
2186 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002187 {
2188 Parcel data = Parcel.obtain();
2189 Parcel reply = Parcel.obtain();
2190 data.writeInterfaceToken(IActivityManager.descriptor);
2191 data.writeStrongBinder(token);
2192 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002193 if (thumbnail != null) {
2194 data.writeInt(1);
2195 thumbnail.writeToParcel(data, 0);
2196 } else {
2197 data.writeInt(0);
2198 }
2199 TextUtils.writeToParcel(description, data, 0);
2200 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2201 reply.readException();
2202 data.recycle();
2203 reply.recycle();
2204 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002205 public void activitySlept(IBinder token) throws RemoteException
2206 {
2207 Parcel data = Parcel.obtain();
2208 Parcel reply = Parcel.obtain();
2209 data.writeInterfaceToken(IActivityManager.descriptor);
2210 data.writeStrongBinder(token);
2211 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2212 reply.readException();
2213 data.recycle();
2214 reply.recycle();
2215 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002216 public void activityDestroyed(IBinder token) throws RemoteException
2217 {
2218 Parcel data = Parcel.obtain();
2219 Parcel reply = Parcel.obtain();
2220 data.writeInterfaceToken(IActivityManager.descriptor);
2221 data.writeStrongBinder(token);
2222 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2223 reply.readException();
2224 data.recycle();
2225 reply.recycle();
2226 }
2227 public String getCallingPackage(IBinder token) throws RemoteException
2228 {
2229 Parcel data = Parcel.obtain();
2230 Parcel reply = Parcel.obtain();
2231 data.writeInterfaceToken(IActivityManager.descriptor);
2232 data.writeStrongBinder(token);
2233 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2234 reply.readException();
2235 String res = reply.readString();
2236 data.recycle();
2237 reply.recycle();
2238 return res;
2239 }
2240 public ComponentName getCallingActivity(IBinder token)
2241 throws RemoteException {
2242 Parcel data = Parcel.obtain();
2243 Parcel reply = Parcel.obtain();
2244 data.writeInterfaceToken(IActivityManager.descriptor);
2245 data.writeStrongBinder(token);
2246 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2247 reply.readException();
2248 ComponentName res = ComponentName.readFromParcel(reply);
2249 data.recycle();
2250 reply.recycle();
2251 return res;
2252 }
2253 public List getTasks(int maxNum, int flags,
2254 IThumbnailReceiver receiver) throws RemoteException {
2255 Parcel data = Parcel.obtain();
2256 Parcel reply = Parcel.obtain();
2257 data.writeInterfaceToken(IActivityManager.descriptor);
2258 data.writeInt(maxNum);
2259 data.writeInt(flags);
2260 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2261 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2262 reply.readException();
2263 ArrayList list = null;
2264 int N = reply.readInt();
2265 if (N >= 0) {
2266 list = new ArrayList();
2267 while (N > 0) {
2268 ActivityManager.RunningTaskInfo info =
2269 ActivityManager.RunningTaskInfo.CREATOR
2270 .createFromParcel(reply);
2271 list.add(info);
2272 N--;
2273 }
2274 }
2275 data.recycle();
2276 reply.recycle();
2277 return list;
2278 }
2279 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002280 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002281 Parcel data = Parcel.obtain();
2282 Parcel reply = Parcel.obtain();
2283 data.writeInterfaceToken(IActivityManager.descriptor);
2284 data.writeInt(maxNum);
2285 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002286 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002287 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2288 reply.readException();
2289 ArrayList<ActivityManager.RecentTaskInfo> list
2290 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2291 data.recycle();
2292 reply.recycle();
2293 return list;
2294 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002295 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002296 Parcel data = Parcel.obtain();
2297 Parcel reply = Parcel.obtain();
2298 data.writeInterfaceToken(IActivityManager.descriptor);
2299 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002300 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002301 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002302 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002303 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002304 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002305 }
2306 data.recycle();
2307 reply.recycle();
2308 return bm;
2309 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002310 public List getServices(int maxNum, int flags) throws RemoteException {
2311 Parcel data = Parcel.obtain();
2312 Parcel reply = Parcel.obtain();
2313 data.writeInterfaceToken(IActivityManager.descriptor);
2314 data.writeInt(maxNum);
2315 data.writeInt(flags);
2316 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2317 reply.readException();
2318 ArrayList list = null;
2319 int N = reply.readInt();
2320 if (N >= 0) {
2321 list = new ArrayList();
2322 while (N > 0) {
2323 ActivityManager.RunningServiceInfo info =
2324 ActivityManager.RunningServiceInfo.CREATOR
2325 .createFromParcel(reply);
2326 list.add(info);
2327 N--;
2328 }
2329 }
2330 data.recycle();
2331 reply.recycle();
2332 return list;
2333 }
2334 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2335 throws RemoteException {
2336 Parcel data = Parcel.obtain();
2337 Parcel reply = Parcel.obtain();
2338 data.writeInterfaceToken(IActivityManager.descriptor);
2339 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2340 reply.readException();
2341 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2342 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2343 data.recycle();
2344 reply.recycle();
2345 return list;
2346 }
2347 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2348 throws RemoteException {
2349 Parcel data = Parcel.obtain();
2350 Parcel reply = Parcel.obtain();
2351 data.writeInterfaceToken(IActivityManager.descriptor);
2352 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2353 reply.readException();
2354 ArrayList<ActivityManager.RunningAppProcessInfo> list
2355 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2356 data.recycle();
2357 reply.recycle();
2358 return list;
2359 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002360 public List<ApplicationInfo> getRunningExternalApplications()
2361 throws RemoteException {
2362 Parcel data = Parcel.obtain();
2363 Parcel reply = Parcel.obtain();
2364 data.writeInterfaceToken(IActivityManager.descriptor);
2365 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2366 reply.readException();
2367 ArrayList<ApplicationInfo> list
2368 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2369 data.recycle();
2370 reply.recycle();
2371 return list;
2372 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002373 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002374 {
2375 Parcel data = Parcel.obtain();
2376 Parcel reply = Parcel.obtain();
2377 data.writeInterfaceToken(IActivityManager.descriptor);
2378 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002379 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002380 if (options != null) {
2381 data.writeInt(1);
2382 options.writeToParcel(data, 0);
2383 } else {
2384 data.writeInt(0);
2385 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002386 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2387 reply.readException();
2388 data.recycle();
2389 reply.recycle();
2390 }
2391 public void moveTaskToBack(int task) throws RemoteException
2392 {
2393 Parcel data = Parcel.obtain();
2394 Parcel reply = Parcel.obtain();
2395 data.writeInterfaceToken(IActivityManager.descriptor);
2396 data.writeInt(task);
2397 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2398 reply.readException();
2399 data.recycle();
2400 reply.recycle();
2401 }
2402 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2403 throws RemoteException {
2404 Parcel data = Parcel.obtain();
2405 Parcel reply = Parcel.obtain();
2406 data.writeInterfaceToken(IActivityManager.descriptor);
2407 data.writeStrongBinder(token);
2408 data.writeInt(nonRoot ? 1 : 0);
2409 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2410 reply.readException();
2411 boolean res = reply.readInt() != 0;
2412 data.recycle();
2413 reply.recycle();
2414 return res;
2415 }
2416 public void moveTaskBackwards(int task) throws RemoteException
2417 {
2418 Parcel data = Parcel.obtain();
2419 Parcel reply = Parcel.obtain();
2420 data.writeInterfaceToken(IActivityManager.descriptor);
2421 data.writeInt(task);
2422 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2423 reply.readException();
2424 data.recycle();
2425 reply.recycle();
2426 }
2427 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2428 {
2429 Parcel data = Parcel.obtain();
2430 Parcel reply = Parcel.obtain();
2431 data.writeInterfaceToken(IActivityManager.descriptor);
2432 data.writeStrongBinder(token);
2433 data.writeInt(onlyRoot ? 1 : 0);
2434 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2435 reply.readException();
2436 int res = reply.readInt();
2437 data.recycle();
2438 reply.recycle();
2439 return res;
2440 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441 public void reportThumbnail(IBinder token,
2442 Bitmap thumbnail, CharSequence description) throws RemoteException
2443 {
2444 Parcel data = Parcel.obtain();
2445 Parcel reply = Parcel.obtain();
2446 data.writeInterfaceToken(IActivityManager.descriptor);
2447 data.writeStrongBinder(token);
2448 if (thumbnail != null) {
2449 data.writeInt(1);
2450 thumbnail.writeToParcel(data, 0);
2451 } else {
2452 data.writeInt(0);
2453 }
2454 TextUtils.writeToParcel(description, data, 0);
2455 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2456 reply.readException();
2457 data.recycle();
2458 reply.recycle();
2459 }
2460 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002461 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002462 Parcel data = Parcel.obtain();
2463 Parcel reply = Parcel.obtain();
2464 data.writeInterfaceToken(IActivityManager.descriptor);
2465 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2466 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002467 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002468 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2469 reply.readException();
2470 int res = reply.readInt();
2471 ContentProviderHolder cph = null;
2472 if (res != 0) {
2473 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2474 }
2475 data.recycle();
2476 reply.recycle();
2477 return cph;
2478 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002479 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2480 throws RemoteException
2481 {
2482 Parcel data = Parcel.obtain();
2483 Parcel reply = Parcel.obtain();
2484 data.writeInterfaceToken(IActivityManager.descriptor);
2485 data.writeString(name);
2486 data.writeStrongBinder(token);
2487 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2488 reply.readException();
2489 int res = reply.readInt();
2490 ContentProviderHolder cph = null;
2491 if (res != 0) {
2492 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2493 }
2494 data.recycle();
2495 reply.recycle();
2496 return cph;
2497 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002498 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002499 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 {
2501 Parcel data = Parcel.obtain();
2502 Parcel reply = Parcel.obtain();
2503 data.writeInterfaceToken(IActivityManager.descriptor);
2504 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2505 data.writeTypedList(providers);
2506 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2507 reply.readException();
2508 data.recycle();
2509 reply.recycle();
2510 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002511 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2512 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002513 Parcel data = Parcel.obtain();
2514 Parcel reply = Parcel.obtain();
2515 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002516 data.writeStrongBinder(connection);
2517 data.writeInt(stable);
2518 data.writeInt(unstable);
2519 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2520 reply.readException();
2521 boolean res = reply.readInt() != 0;
2522 data.recycle();
2523 reply.recycle();
2524 return res;
2525 }
2526 public void unstableProviderDied(IBinder connection) throws RemoteException {
2527 Parcel data = Parcel.obtain();
2528 Parcel reply = Parcel.obtain();
2529 data.writeInterfaceToken(IActivityManager.descriptor);
2530 data.writeStrongBinder(connection);
2531 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2532 reply.readException();
2533 data.recycle();
2534 reply.recycle();
2535 }
2536
2537 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2538 Parcel data = Parcel.obtain();
2539 Parcel reply = Parcel.obtain();
2540 data.writeInterfaceToken(IActivityManager.descriptor);
2541 data.writeStrongBinder(connection);
2542 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002543 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2544 reply.readException();
2545 data.recycle();
2546 reply.recycle();
2547 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002548
2549 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2550 Parcel data = Parcel.obtain();
2551 Parcel reply = Parcel.obtain();
2552 data.writeInterfaceToken(IActivityManager.descriptor);
2553 data.writeString(name);
2554 data.writeStrongBinder(token);
2555 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2556 reply.readException();
2557 data.recycle();
2558 reply.recycle();
2559 }
2560
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002561 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2562 throws RemoteException
2563 {
2564 Parcel data = Parcel.obtain();
2565 Parcel reply = Parcel.obtain();
2566 data.writeInterfaceToken(IActivityManager.descriptor);
2567 service.writeToParcel(data, 0);
2568 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2569 reply.readException();
2570 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2571 data.recycle();
2572 reply.recycle();
2573 return res;
2574 }
2575
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002576 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002577 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 {
2579 Parcel data = Parcel.obtain();
2580 Parcel reply = Parcel.obtain();
2581 data.writeInterfaceToken(IActivityManager.descriptor);
2582 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2583 service.writeToParcel(data, 0);
2584 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002585 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002586 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2587 reply.readException();
2588 ComponentName res = ComponentName.readFromParcel(reply);
2589 data.recycle();
2590 reply.recycle();
2591 return res;
2592 }
2593 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002594 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002595 {
2596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2600 service.writeToParcel(data, 0);
2601 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002602 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2604 reply.readException();
2605 int res = reply.readInt();
2606 reply.recycle();
2607 data.recycle();
2608 return res;
2609 }
2610 public boolean stopServiceToken(ComponentName className, IBinder token,
2611 int startId) throws RemoteException {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 ComponentName.writeToParcel(className, data);
2616 data.writeStrongBinder(token);
2617 data.writeInt(startId);
2618 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2619 reply.readException();
2620 boolean res = reply.readInt() != 0;
2621 data.recycle();
2622 reply.recycle();
2623 return res;
2624 }
2625 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002626 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 ComponentName.writeToParcel(className, data);
2631 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002632 data.writeInt(id);
2633 if (notification != null) {
2634 data.writeInt(1);
2635 notification.writeToParcel(data, 0);
2636 } else {
2637 data.writeInt(0);
2638 }
2639 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2641 reply.readException();
2642 data.recycle();
2643 reply.recycle();
2644 }
2645 public int bindService(IApplicationThread caller, IBinder token,
2646 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002647 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002648 Parcel data = Parcel.obtain();
2649 Parcel reply = Parcel.obtain();
2650 data.writeInterfaceToken(IActivityManager.descriptor);
2651 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2652 data.writeStrongBinder(token);
2653 service.writeToParcel(data, 0);
2654 data.writeString(resolvedType);
2655 data.writeStrongBinder(connection.asBinder());
2656 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002657 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 int res = reply.readInt();
2661 data.recycle();
2662 reply.recycle();
2663 return res;
2664 }
2665 public boolean unbindService(IServiceConnection connection) throws RemoteException
2666 {
2667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 data.writeStrongBinder(connection.asBinder());
2671 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2672 reply.readException();
2673 boolean res = reply.readInt() != 0;
2674 data.recycle();
2675 reply.recycle();
2676 return res;
2677 }
2678
2679 public void publishService(IBinder token,
2680 Intent intent, IBinder service) throws RemoteException {
2681 Parcel data = Parcel.obtain();
2682 Parcel reply = Parcel.obtain();
2683 data.writeInterfaceToken(IActivityManager.descriptor);
2684 data.writeStrongBinder(token);
2685 intent.writeToParcel(data, 0);
2686 data.writeStrongBinder(service);
2687 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2688 reply.readException();
2689 data.recycle();
2690 reply.recycle();
2691 }
2692
2693 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2694 throws RemoteException {
2695 Parcel data = Parcel.obtain();
2696 Parcel reply = Parcel.obtain();
2697 data.writeInterfaceToken(IActivityManager.descriptor);
2698 data.writeStrongBinder(token);
2699 intent.writeToParcel(data, 0);
2700 data.writeInt(doRebind ? 1 : 0);
2701 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 data.recycle();
2704 reply.recycle();
2705 }
2706
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002707 public void serviceDoneExecuting(IBinder token, int type, int startId,
2708 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002713 data.writeInt(type);
2714 data.writeInt(startId);
2715 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002716 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2717 reply.readException();
2718 data.recycle();
2719 reply.recycle();
2720 }
2721
2722 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2723 Parcel data = Parcel.obtain();
2724 Parcel reply = Parcel.obtain();
2725 data.writeInterfaceToken(IActivityManager.descriptor);
2726 service.writeToParcel(data, 0);
2727 data.writeString(resolvedType);
2728 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 IBinder binder = reply.readStrongBinder();
2731 reply.recycle();
2732 data.recycle();
2733 return binder;
2734 }
2735
Christopher Tate181fafa2009-05-14 11:12:14 -07002736 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2737 throws RemoteException {
2738 Parcel data = Parcel.obtain();
2739 Parcel reply = Parcel.obtain();
2740 data.writeInterfaceToken(IActivityManager.descriptor);
2741 app.writeToParcel(data, 0);
2742 data.writeInt(backupRestoreMode);
2743 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2744 reply.readException();
2745 boolean success = reply.readInt() != 0;
2746 reply.recycle();
2747 data.recycle();
2748 return success;
2749 }
2750
2751 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 data.writeString(packageName);
2756 data.writeStrongBinder(agent);
2757 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2758 reply.recycle();
2759 data.recycle();
2760 }
2761
2762 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2763 Parcel data = Parcel.obtain();
2764 Parcel reply = Parcel.obtain();
2765 data.writeInterfaceToken(IActivityManager.descriptor);
2766 app.writeToParcel(data, 0);
2767 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2768 reply.readException();
2769 reply.recycle();
2770 data.recycle();
2771 }
2772
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002773 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002774 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002775 throws RemoteException {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
2779 ComponentName.writeToParcel(className, data);
2780 data.writeString(profileFile);
2781 data.writeInt(flags);
2782 data.writeBundle(arguments);
2783 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002784 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002785 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2786 reply.readException();
2787 boolean res = reply.readInt() != 0;
2788 reply.recycle();
2789 data.recycle();
2790 return res;
2791 }
2792
2793 public void finishInstrumentation(IApplicationThread target,
2794 int resultCode, Bundle results) throws RemoteException {
2795 Parcel data = Parcel.obtain();
2796 Parcel reply = Parcel.obtain();
2797 data.writeInterfaceToken(IActivityManager.descriptor);
2798 data.writeStrongBinder(target != null ? target.asBinder() : null);
2799 data.writeInt(resultCode);
2800 data.writeBundle(results);
2801 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2802 reply.readException();
2803 data.recycle();
2804 reply.recycle();
2805 }
2806 public Configuration getConfiguration() throws RemoteException
2807 {
2808 Parcel data = Parcel.obtain();
2809 Parcel reply = Parcel.obtain();
2810 data.writeInterfaceToken(IActivityManager.descriptor);
2811 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2812 reply.readException();
2813 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2814 reply.recycle();
2815 data.recycle();
2816 return res;
2817 }
2818 public void updateConfiguration(Configuration values) throws RemoteException
2819 {
2820 Parcel data = Parcel.obtain();
2821 Parcel reply = Parcel.obtain();
2822 data.writeInterfaceToken(IActivityManager.descriptor);
2823 values.writeToParcel(data, 0);
2824 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2825 reply.readException();
2826 data.recycle();
2827 reply.recycle();
2828 }
2829 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2830 throws RemoteException {
2831 Parcel data = Parcel.obtain();
2832 Parcel reply = Parcel.obtain();
2833 data.writeInterfaceToken(IActivityManager.descriptor);
2834 data.writeStrongBinder(token);
2835 data.writeInt(requestedOrientation);
2836 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2837 reply.readException();
2838 data.recycle();
2839 reply.recycle();
2840 }
2841 public int getRequestedOrientation(IBinder token) throws RemoteException {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 data.writeStrongBinder(token);
2846 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2847 reply.readException();
2848 int res = reply.readInt();
2849 data.recycle();
2850 reply.recycle();
2851 return res;
2852 }
2853 public ComponentName getActivityClassForToken(IBinder token)
2854 throws RemoteException {
2855 Parcel data = Parcel.obtain();
2856 Parcel reply = Parcel.obtain();
2857 data.writeInterfaceToken(IActivityManager.descriptor);
2858 data.writeStrongBinder(token);
2859 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2860 reply.readException();
2861 ComponentName res = ComponentName.readFromParcel(reply);
2862 data.recycle();
2863 reply.recycle();
2864 return res;
2865 }
2866 public String getPackageForToken(IBinder token) throws RemoteException
2867 {
2868 Parcel data = Parcel.obtain();
2869 Parcel reply = Parcel.obtain();
2870 data.writeInterfaceToken(IActivityManager.descriptor);
2871 data.writeStrongBinder(token);
2872 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 String res = reply.readString();
2875 data.recycle();
2876 reply.recycle();
2877 return res;
2878 }
2879 public IIntentSender getIntentSender(int type,
2880 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002881 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002882 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 Parcel data = Parcel.obtain();
2884 Parcel reply = Parcel.obtain();
2885 data.writeInterfaceToken(IActivityManager.descriptor);
2886 data.writeInt(type);
2887 data.writeString(packageName);
2888 data.writeStrongBinder(token);
2889 data.writeString(resultWho);
2890 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002891 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002892 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002893 data.writeTypedArray(intents, 0);
2894 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002895 } else {
2896 data.writeInt(0);
2897 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002898 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002899 if (options != null) {
2900 data.writeInt(1);
2901 options.writeToParcel(data, 0);
2902 } else {
2903 data.writeInt(0);
2904 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002905 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002906 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2907 reply.readException();
2908 IIntentSender res = IIntentSender.Stub.asInterface(
2909 reply.readStrongBinder());
2910 data.recycle();
2911 reply.recycle();
2912 return res;
2913 }
2914 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2915 Parcel data = Parcel.obtain();
2916 Parcel reply = Parcel.obtain();
2917 data.writeInterfaceToken(IActivityManager.descriptor);
2918 data.writeStrongBinder(sender.asBinder());
2919 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2920 reply.readException();
2921 data.recycle();
2922 reply.recycle();
2923 }
2924 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2925 Parcel data = Parcel.obtain();
2926 Parcel reply = Parcel.obtain();
2927 data.writeInterfaceToken(IActivityManager.descriptor);
2928 data.writeStrongBinder(sender.asBinder());
2929 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2930 reply.readException();
2931 String res = reply.readString();
2932 data.recycle();
2933 reply.recycle();
2934 return res;
2935 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002936 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2937 Parcel data = Parcel.obtain();
2938 Parcel reply = Parcel.obtain();
2939 data.writeInterfaceToken(IActivityManager.descriptor);
2940 data.writeStrongBinder(sender.asBinder());
2941 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2942 reply.readException();
2943 int res = reply.readInt();
2944 data.recycle();
2945 reply.recycle();
2946 return res;
2947 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002948 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2949 boolean requireFull, String name, String callerPackage) throws RemoteException {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeInt(callingPid);
2954 data.writeInt(callingUid);
2955 data.writeInt(userId);
2956 data.writeInt(allowAll ? 1 : 0);
2957 data.writeInt(requireFull ? 1 : 0);
2958 data.writeString(name);
2959 data.writeString(callerPackage);
2960 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
2961 reply.readException();
2962 int res = reply.readInt();
2963 data.recycle();
2964 reply.recycle();
2965 return res;
2966 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002967 public void setProcessLimit(int max) throws RemoteException
2968 {
2969 Parcel data = Parcel.obtain();
2970 Parcel reply = Parcel.obtain();
2971 data.writeInterfaceToken(IActivityManager.descriptor);
2972 data.writeInt(max);
2973 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 data.recycle();
2976 reply.recycle();
2977 }
2978 public int getProcessLimit() throws RemoteException
2979 {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2984 reply.readException();
2985 int res = reply.readInt();
2986 data.recycle();
2987 reply.recycle();
2988 return res;
2989 }
2990 public void setProcessForeground(IBinder token, int pid,
2991 boolean isForeground) throws RemoteException {
2992 Parcel data = Parcel.obtain();
2993 Parcel reply = Parcel.obtain();
2994 data.writeInterfaceToken(IActivityManager.descriptor);
2995 data.writeStrongBinder(token);
2996 data.writeInt(pid);
2997 data.writeInt(isForeground ? 1 : 0);
2998 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2999 reply.readException();
3000 data.recycle();
3001 reply.recycle();
3002 }
3003 public int checkPermission(String permission, int pid, int uid)
3004 throws RemoteException {
3005 Parcel data = Parcel.obtain();
3006 Parcel reply = Parcel.obtain();
3007 data.writeInterfaceToken(IActivityManager.descriptor);
3008 data.writeString(permission);
3009 data.writeInt(pid);
3010 data.writeInt(uid);
3011 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 int res = reply.readInt();
3014 data.recycle();
3015 reply.recycle();
3016 return res;
3017 }
3018 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003019 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 Parcel data = Parcel.obtain();
3021 Parcel reply = Parcel.obtain();
3022 data.writeInterfaceToken(IActivityManager.descriptor);
3023 data.writeString(packageName);
3024 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003025 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003026 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3027 reply.readException();
3028 boolean res = reply.readInt() != 0;
3029 data.recycle();
3030 reply.recycle();
3031 return res;
3032 }
3033 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3034 throws RemoteException {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 uri.writeToParcel(data, 0);
3039 data.writeInt(pid);
3040 data.writeInt(uid);
3041 data.writeInt(mode);
3042 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 int res = reply.readInt();
3045 data.recycle();
3046 reply.recycle();
3047 return res;
3048 }
3049 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3050 Uri uri, int mode) throws RemoteException {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 data.writeStrongBinder(caller.asBinder());
3055 data.writeString(targetPkg);
3056 uri.writeToParcel(data, 0);
3057 data.writeInt(mode);
3058 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 data.recycle();
3061 reply.recycle();
3062 }
3063 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3064 int mode) throws RemoteException {
3065 Parcel data = Parcel.obtain();
3066 Parcel reply = Parcel.obtain();
3067 data.writeInterfaceToken(IActivityManager.descriptor);
3068 data.writeStrongBinder(caller.asBinder());
3069 uri.writeToParcel(data, 0);
3070 data.writeInt(mode);
3071 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 data.recycle();
3074 reply.recycle();
3075 }
3076 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3077 throws RemoteException {
3078 Parcel data = Parcel.obtain();
3079 Parcel reply = Parcel.obtain();
3080 data.writeInterfaceToken(IActivityManager.descriptor);
3081 data.writeStrongBinder(who.asBinder());
3082 data.writeInt(waiting ? 1 : 0);
3083 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 data.recycle();
3086 reply.recycle();
3087 }
3088 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3093 reply.readException();
3094 outInfo.readFromParcel(reply);
3095 data.recycle();
3096 reply.recycle();
3097 }
3098 public void unhandledBack() throws RemoteException
3099 {
3100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3104 reply.readException();
3105 data.recycle();
3106 reply.recycle();
3107 }
3108 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3109 {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3114 reply.readException();
3115 ParcelFileDescriptor pfd = null;
3116 if (reply.readInt() != 0) {
3117 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3118 }
3119 data.recycle();
3120 reply.recycle();
3121 return pfd;
3122 }
3123 public void goingToSleep() throws RemoteException
3124 {
3125 Parcel data = Parcel.obtain();
3126 Parcel reply = Parcel.obtain();
3127 data.writeInterfaceToken(IActivityManager.descriptor);
3128 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
3133 public void wakingUp() throws RemoteException
3134 {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3139 reply.readException();
3140 data.recycle();
3141 reply.recycle();
3142 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003143 public void setLockScreenShown(boolean shown) throws RemoteException
3144 {
3145 Parcel data = Parcel.obtain();
3146 Parcel reply = Parcel.obtain();
3147 data.writeInterfaceToken(IActivityManager.descriptor);
3148 data.writeInt(shown ? 1 : 0);
3149 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3150 reply.readException();
3151 data.recycle();
3152 reply.recycle();
3153 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003154 public void setDebugApp(
3155 String packageName, boolean waitForDebugger, boolean persistent)
3156 throws RemoteException
3157 {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 data.writeString(packageName);
3162 data.writeInt(waitForDebugger ? 1 : 0);
3163 data.writeInt(persistent ? 1 : 0);
3164 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 data.recycle();
3167 reply.recycle();
3168 }
3169 public void setAlwaysFinish(boolean enabled) throws RemoteException
3170 {
3171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 data.writeInt(enabled ? 1 : 0);
3175 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3176 reply.readException();
3177 data.recycle();
3178 reply.recycle();
3179 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003180 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003181 {
3182 Parcel data = Parcel.obtain();
3183 Parcel reply = Parcel.obtain();
3184 data.writeInterfaceToken(IActivityManager.descriptor);
3185 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003186 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003187 reply.readException();
3188 data.recycle();
3189 reply.recycle();
3190 }
3191 public void enterSafeMode() throws RemoteException {
3192 Parcel data = Parcel.obtain();
3193 data.writeInterfaceToken(IActivityManager.descriptor);
3194 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3195 data.recycle();
3196 }
3197 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3198 Parcel data = Parcel.obtain();
3199 data.writeStrongBinder(sender.asBinder());
3200 data.writeInterfaceToken(IActivityManager.descriptor);
3201 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3202 data.recycle();
3203 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003204 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003205 Parcel data = Parcel.obtain();
3206 Parcel reply = Parcel.obtain();
3207 data.writeInterfaceToken(IActivityManager.descriptor);
3208 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003209 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003210 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003211 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003212 boolean res = reply.readInt() != 0;
3213 data.recycle();
3214 reply.recycle();
3215 return res;
3216 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003217 @Override
3218 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3219 Parcel data = Parcel.obtain();
3220 Parcel reply = Parcel.obtain();
3221 data.writeInterfaceToken(IActivityManager.descriptor);
3222 data.writeString(reason);
3223 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3224 boolean res = reply.readInt() != 0;
3225 data.recycle();
3226 reply.recycle();
3227 return res;
3228 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 public void startRunning(String pkg, String cls, String action,
3230 String indata) throws RemoteException {
3231 Parcel data = Parcel.obtain();
3232 Parcel reply = Parcel.obtain();
3233 data.writeInterfaceToken(IActivityManager.descriptor);
3234 data.writeString(pkg);
3235 data.writeString(cls);
3236 data.writeString(action);
3237 data.writeString(indata);
3238 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3239 reply.readException();
3240 data.recycle();
3241 reply.recycle();
3242 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 public boolean testIsSystemReady()
3244 {
3245 /* this base class version is never called */
3246 return true;
3247 }
Dan Egnor60d87622009-12-16 16:32:58 -08003248 public void handleApplicationCrash(IBinder app,
3249 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3250 {
3251 Parcel data = Parcel.obtain();
3252 Parcel reply = Parcel.obtain();
3253 data.writeInterfaceToken(IActivityManager.descriptor);
3254 data.writeStrongBinder(app);
3255 crashInfo.writeToParcel(data, 0);
3256 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3257 reply.readException();
3258 reply.recycle();
3259 data.recycle();
3260 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003261
Dan Egnor60d87622009-12-16 16:32:58 -08003262 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003263 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003264 {
3265 Parcel data = Parcel.obtain();
3266 Parcel reply = Parcel.obtain();
3267 data.writeInterfaceToken(IActivityManager.descriptor);
3268 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003270 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003271 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003273 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003274 reply.recycle();
3275 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003276 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003277 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003278
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003279 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003280 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003281 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003282 {
3283 Parcel data = Parcel.obtain();
3284 Parcel reply = Parcel.obtain();
3285 data.writeInterfaceToken(IActivityManager.descriptor);
3286 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003287 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003288 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003289 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 reply.recycle();
3292 data.recycle();
3293 }
3294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003295 public void signalPersistentProcesses(int sig) throws RemoteException {
3296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 data.writeInt(sig);
3300 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3301 reply.readException();
3302 data.recycle();
3303 reply.recycle();
3304 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003305
Dianne Hackborn1676c852012-09-10 14:52:30 -07003306 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003307 Parcel data = Parcel.obtain();
3308 Parcel reply = Parcel.obtain();
3309 data.writeInterfaceToken(IActivityManager.descriptor);
3310 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003311 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003312 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3313 reply.readException();
3314 data.recycle();
3315 reply.recycle();
3316 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003317
3318 public void killAllBackgroundProcesses() throws RemoteException {
3319 Parcel data = Parcel.obtain();
3320 Parcel reply = Parcel.obtain();
3321 data.writeInterfaceToken(IActivityManager.descriptor);
3322 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3323 reply.readException();
3324 data.recycle();
3325 reply.recycle();
3326 }
3327
Dianne Hackborn1676c852012-09-10 14:52:30 -07003328 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003329 Parcel data = Parcel.obtain();
3330 Parcel reply = Parcel.obtain();
3331 data.writeInterfaceToken(IActivityManager.descriptor);
3332 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003333 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003334 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 reply.readException();
3336 data.recycle();
3337 reply.recycle();
3338 }
3339
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003340 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3341 throws RemoteException
3342 {
3343 Parcel data = Parcel.obtain();
3344 Parcel reply = Parcel.obtain();
3345 data.writeInterfaceToken(IActivityManager.descriptor);
3346 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3347 reply.readException();
3348 outInfo.readFromParcel(reply);
3349 reply.recycle();
3350 data.recycle();
3351 }
3352
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003353 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3354 {
3355 Parcel data = Parcel.obtain();
3356 Parcel reply = Parcel.obtain();
3357 data.writeInterfaceToken(IActivityManager.descriptor);
3358 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3359 reply.readException();
3360 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3361 reply.recycle();
3362 data.recycle();
3363 return res;
3364 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003365
Dianne Hackborn1676c852012-09-10 14:52:30 -07003366 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003367 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003368 {
3369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003373 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003374 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003375 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003376 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003377 if (fd != null) {
3378 data.writeInt(1);
3379 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3380 } else {
3381 data.writeInt(0);
3382 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003383 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3384 reply.readException();
3385 boolean res = reply.readInt() != 0;
3386 reply.recycle();
3387 data.recycle();
3388 return res;
3389 }
3390
Dianne Hackborn55280a92009-05-07 15:53:46 -07003391 public boolean shutdown(int timeout) throws RemoteException
3392 {
3393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 data.writeInt(timeout);
3397 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3398 reply.readException();
3399 boolean res = reply.readInt() != 0;
3400 reply.recycle();
3401 data.recycle();
3402 return res;
3403 }
3404
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003405 public void stopAppSwitches() throws RemoteException {
3406 Parcel data = Parcel.obtain();
3407 Parcel reply = Parcel.obtain();
3408 data.writeInterfaceToken(IActivityManager.descriptor);
3409 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3410 reply.readException();
3411 reply.recycle();
3412 data.recycle();
3413 }
3414
3415 public void resumeAppSwitches() throws RemoteException {
3416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3420 reply.readException();
3421 reply.recycle();
3422 data.recycle();
3423 }
3424
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003425 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003430 data.writeInt(appid);
3431 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003432 reply.readException();
3433 data.recycle();
3434 reply.recycle();
3435 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003436
3437 public void closeSystemDialogs(String reason) throws RemoteException {
3438 Parcel data = Parcel.obtain();
3439 Parcel reply = Parcel.obtain();
3440 data.writeInterfaceToken(IActivityManager.descriptor);
3441 data.writeString(reason);
3442 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 data.recycle();
3445 reply.recycle();
3446 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003447
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003448 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003449 throws RemoteException {
3450 Parcel data = Parcel.obtain();
3451 Parcel reply = Parcel.obtain();
3452 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003453 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003454 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3455 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003456 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003457 data.recycle();
3458 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003459 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003460 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003461
3462 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeString(processName);
3467 data.writeInt(uid);
3468 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 data.recycle();
3471 reply.recycle();
3472 }
3473
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003474 public void overridePendingTransition(IBinder token, String packageName,
3475 int enterAnim, int exitAnim) throws RemoteException {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 data.writeStrongBinder(token);
3480 data.writeString(packageName);
3481 data.writeInt(enterAnim);
3482 data.writeInt(exitAnim);
3483 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 data.recycle();
3486 reply.recycle();
3487 }
3488
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003489 public boolean isUserAMonkey() throws RemoteException {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 boolean res = reply.readInt() != 0;
3496 data.recycle();
3497 reply.recycle();
3498 return res;
3499 }
3500
Dianne Hackborn860755f2010-06-03 18:47:52 -07003501 public void finishHeavyWeightApp() throws RemoteException {
3502 Parcel data = Parcel.obtain();
3503 Parcel reply = Parcel.obtain();
3504 data.writeInterfaceToken(IActivityManager.descriptor);
3505 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3506 reply.readException();
3507 data.recycle();
3508 reply.recycle();
3509 }
3510
Daniel Sandler69a48172010-06-23 16:29:36 -04003511 public void setImmersive(IBinder token, boolean immersive)
3512 throws RemoteException {
3513 Parcel data = Parcel.obtain();
3514 Parcel reply = Parcel.obtain();
3515 data.writeInterfaceToken(IActivityManager.descriptor);
3516 data.writeStrongBinder(token);
3517 data.writeInt(immersive ? 1 : 0);
3518 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3519 reply.readException();
3520 data.recycle();
3521 reply.recycle();
3522 }
3523
3524 public boolean isImmersive(IBinder token)
3525 throws RemoteException {
3526 Parcel data = Parcel.obtain();
3527 Parcel reply = Parcel.obtain();
3528 data.writeInterfaceToken(IActivityManager.descriptor);
3529 data.writeStrongBinder(token);
3530 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003531 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003532 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003533 data.recycle();
3534 reply.recycle();
3535 return res;
3536 }
3537
3538 public boolean isTopActivityImmersive()
3539 throws RemoteException {
3540 Parcel data = Parcel.obtain();
3541 Parcel reply = Parcel.obtain();
3542 data.writeInterfaceToken(IActivityManager.descriptor);
3543 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003544 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003545 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003546 data.recycle();
3547 reply.recycle();
3548 return res;
3549 }
3550
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003551 public void crashApplication(int uid, int initialPid, String packageName,
3552 String message) throws RemoteException {
3553 Parcel data = Parcel.obtain();
3554 Parcel reply = Parcel.obtain();
3555 data.writeInterfaceToken(IActivityManager.descriptor);
3556 data.writeInt(uid);
3557 data.writeInt(initialPid);
3558 data.writeString(packageName);
3559 data.writeString(message);
3560 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3561 reply.readException();
3562 data.recycle();
3563 reply.recycle();
3564 }
Andy McFadden824c5102010-07-09 16:26:57 -07003565
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003566 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003567 Parcel data = Parcel.obtain();
3568 Parcel reply = Parcel.obtain();
3569 data.writeInterfaceToken(IActivityManager.descriptor);
3570 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003571 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003572 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3573 reply.readException();
3574 String res = reply.readString();
3575 data.recycle();
3576 reply.recycle();
3577 return res;
3578 }
3579
Dianne Hackborn7e269642010-08-25 19:50:20 -07003580 public IBinder newUriPermissionOwner(String name)
3581 throws RemoteException {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeString(name);
3586 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3587 reply.readException();
3588 IBinder res = reply.readStrongBinder();
3589 data.recycle();
3590 reply.recycle();
3591 return res;
3592 }
3593
3594 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3595 Uri uri, int mode) throws RemoteException {
3596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 data.writeStrongBinder(owner);
3600 data.writeInt(fromUid);
3601 data.writeString(targetPkg);
3602 uri.writeToParcel(data, 0);
3603 data.writeInt(mode);
3604 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3605 reply.readException();
3606 data.recycle();
3607 reply.recycle();
3608 }
3609
3610 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3611 int mode) throws RemoteException {
3612 Parcel data = Parcel.obtain();
3613 Parcel reply = Parcel.obtain();
3614 data.writeInterfaceToken(IActivityManager.descriptor);
3615 data.writeStrongBinder(owner);
3616 if (uri != null) {
3617 data.writeInt(1);
3618 uri.writeToParcel(data, 0);
3619 } else {
3620 data.writeInt(0);
3621 }
3622 data.writeInt(mode);
3623 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 data.recycle();
3626 reply.recycle();
3627 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003628
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003629 public int checkGrantUriPermission(int callingUid, String targetPkg,
3630 Uri uri, int modeFlags) throws RemoteException {
3631 Parcel data = Parcel.obtain();
3632 Parcel reply = Parcel.obtain();
3633 data.writeInterfaceToken(IActivityManager.descriptor);
3634 data.writeInt(callingUid);
3635 data.writeString(targetPkg);
3636 uri.writeToParcel(data, 0);
3637 data.writeInt(modeFlags);
3638 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 int res = reply.readInt();
3641 data.recycle();
3642 reply.recycle();
3643 return res;
3644 }
3645
Dianne Hackborn1676c852012-09-10 14:52:30 -07003646 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003647 String path, ParcelFileDescriptor fd) throws RemoteException {
3648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003652 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003653 data.writeInt(managed ? 1 : 0);
3654 data.writeString(path);
3655 if (fd != null) {
3656 data.writeInt(1);
3657 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3658 } else {
3659 data.writeInt(0);
3660 }
3661 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3662 reply.readException();
3663 boolean res = reply.readInt() != 0;
3664 reply.recycle();
3665 data.recycle();
3666 return res;
3667 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003668
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003669 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003670 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3671 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3676 data.writeTypedArray(intents, 0);
3677 data.writeStringArray(resolvedTypes);
3678 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003679 if (options != null) {
3680 data.writeInt(1);
3681 options.writeToParcel(data, 0);
3682 } else {
3683 data.writeInt(0);
3684 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003685 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3686 reply.readException();
3687 int result = reply.readInt();
3688 reply.recycle();
3689 data.recycle();
3690 return result;
3691 }
3692
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003693 public int getFrontActivityScreenCompatMode() throws RemoteException {
3694 Parcel data = Parcel.obtain();
3695 Parcel reply = Parcel.obtain();
3696 data.writeInterfaceToken(IActivityManager.descriptor);
3697 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3698 reply.readException();
3699 int mode = reply.readInt();
3700 reply.recycle();
3701 data.recycle();
3702 return mode;
3703 }
3704
3705 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3706 Parcel data = Parcel.obtain();
3707 Parcel reply = Parcel.obtain();
3708 data.writeInterfaceToken(IActivityManager.descriptor);
3709 data.writeInt(mode);
3710 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3711 reply.readException();
3712 reply.recycle();
3713 data.recycle();
3714 }
3715
3716 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3717 Parcel data = Parcel.obtain();
3718 Parcel reply = Parcel.obtain();
3719 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003720 data.writeString(packageName);
3721 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003722 reply.readException();
3723 int mode = reply.readInt();
3724 reply.recycle();
3725 data.recycle();
3726 return mode;
3727 }
3728
3729 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003730 throws RemoteException {
3731 Parcel data = Parcel.obtain();
3732 Parcel reply = Parcel.obtain();
3733 data.writeInterfaceToken(IActivityManager.descriptor);
3734 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003735 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003736 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3737 reply.readException();
3738 reply.recycle();
3739 data.recycle();
3740 }
3741
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003742 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 data.writeString(packageName);
3747 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3748 reply.readException();
3749 boolean ask = reply.readInt() != 0;
3750 reply.recycle();
3751 data.recycle();
3752 return ask;
3753 }
3754
3755 public void setPackageAskScreenCompat(String packageName, boolean ask)
3756 throws RemoteException {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
3760 data.writeString(packageName);
3761 data.writeInt(ask ? 1 : 0);
3762 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3763 reply.readException();
3764 reply.recycle();
3765 data.recycle();
3766 }
3767
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003768 public boolean switchUser(int userid) throws RemoteException {
3769 Parcel data = Parcel.obtain();
3770 Parcel reply = Parcel.obtain();
3771 data.writeInterfaceToken(IActivityManager.descriptor);
3772 data.writeInt(userid);
3773 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3774 reply.readException();
3775 boolean result = reply.readInt() != 0;
3776 reply.recycle();
3777 data.recycle();
3778 return result;
3779 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003780
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003781 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3782 Parcel data = Parcel.obtain();
3783 Parcel reply = Parcel.obtain();
3784 data.writeInterfaceToken(IActivityManager.descriptor);
3785 data.writeInt(userid);
3786 data.writeStrongInterface(callback);
3787 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3788 reply.readException();
3789 int result = reply.readInt();
3790 reply.recycle();
3791 data.recycle();
3792 return result;
3793 }
3794
Amith Yamasani52f1d752012-03-28 18:19:29 -07003795 public UserInfo getCurrentUser() throws RemoteException {
3796 Parcel data = Parcel.obtain();
3797 Parcel reply = Parcel.obtain();
3798 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003799 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003800 reply.readException();
3801 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3802 reply.recycle();
3803 data.recycle();
3804 return userInfo;
3805 }
3806
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003807 public boolean isUserRunning(int userid) throws RemoteException {
3808 Parcel data = Parcel.obtain();
3809 Parcel reply = Parcel.obtain();
3810 data.writeInterfaceToken(IActivityManager.descriptor);
3811 data.writeInt(userid);
3812 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3813 reply.readException();
3814 boolean result = reply.readInt() != 0;
3815 reply.recycle();
3816 data.recycle();
3817 return result;
3818 }
3819
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003820 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 data.writeInt(taskId);
3825 data.writeInt(subTaskIndex);
3826 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3827 reply.readException();
3828 boolean result = reply.readInt() != 0;
3829 reply.recycle();
3830 data.recycle();
3831 return result;
3832 }
3833
3834 public boolean removeTask(int taskId, int flags) throws RemoteException {
3835 Parcel data = Parcel.obtain();
3836 Parcel reply = Parcel.obtain();
3837 data.writeInterfaceToken(IActivityManager.descriptor);
3838 data.writeInt(taskId);
3839 data.writeInt(flags);
3840 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3841 reply.readException();
3842 boolean result = reply.readInt() != 0;
3843 reply.recycle();
3844 data.recycle();
3845 return result;
3846 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003847
Jeff Sharkeya4620792011-05-20 15:29:23 -07003848 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3853 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 data.recycle();
3856 reply.recycle();
3857 }
3858
3859 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3864 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
3869
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003870 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3871 Parcel data = Parcel.obtain();
3872 Parcel reply = Parcel.obtain();
3873 data.writeInterfaceToken(IActivityManager.descriptor);
3874 data.writeStrongBinder(sender.asBinder());
3875 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3876 reply.readException();
3877 boolean res = reply.readInt() != 0;
3878 data.recycle();
3879 reply.recycle();
3880 return res;
3881 }
3882
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003883 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3884 Parcel data = Parcel.obtain();
3885 Parcel reply = Parcel.obtain();
3886 data.writeInterfaceToken(IActivityManager.descriptor);
3887 data.writeStrongBinder(sender.asBinder());
3888 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3889 reply.readException();
3890 boolean res = reply.readInt() != 0;
3891 data.recycle();
3892 reply.recycle();
3893 return res;
3894 }
3895
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003896 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3897 {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 values.writeToParcel(data, 0);
3902 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 data.recycle();
3905 reply.recycle();
3906 }
3907
Dianne Hackbornb437e092011-08-05 17:50:29 -07003908 public long[] getProcessPss(int[] pids) throws RemoteException {
3909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 data.writeIntArray(pids);
3913 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 long[] res = reply.createLongArray();
3916 data.recycle();
3917 reply.recycle();
3918 return res;
3919 }
3920
Dianne Hackborn661cd522011-08-22 00:26:20 -07003921 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
3925 TextUtils.writeToParcel(msg, data, 0);
3926 data.writeInt(always ? 1 : 0);
3927 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 data.recycle();
3930 reply.recycle();
3931 }
3932
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003933 public void dismissKeyguardOnNextActivity() throws RemoteException {
3934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
3937 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 data.recycle();
3940 reply.recycle();
3941 }
3942
Adam Powelldd8fab22012-03-22 17:47:27 -07003943 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3944 throws RemoteException {
3945 Parcel data = Parcel.obtain();
3946 Parcel reply = Parcel.obtain();
3947 data.writeInterfaceToken(IActivityManager.descriptor);
3948 data.writeStrongBinder(token);
3949 data.writeString(destAffinity);
3950 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3951 reply.readException();
3952 boolean result = reply.readInt() != 0;
3953 data.recycle();
3954 reply.recycle();
3955 return result;
3956 }
3957
3958 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3959 throws RemoteException {
3960 Parcel data = Parcel.obtain();
3961 Parcel reply = Parcel.obtain();
3962 data.writeInterfaceToken(IActivityManager.descriptor);
3963 data.writeStrongBinder(token);
3964 target.writeToParcel(data, 0);
3965 data.writeInt(resultCode);
3966 if (resultData != null) {
3967 data.writeInt(1);
3968 resultData.writeToParcel(data, 0);
3969 } else {
3970 data.writeInt(0);
3971 }
3972 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3973 reply.readException();
3974 boolean result = reply.readInt() != 0;
3975 data.recycle();
3976 reply.recycle();
3977 return result;
3978 }
3979
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003980 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3981 Parcel data = Parcel.obtain();
3982 Parcel reply = Parcel.obtain();
3983 data.writeInterfaceToken(IActivityManager.descriptor);
3984 data.writeStrongBinder(activityToken);
3985 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3986 reply.readException();
3987 int result = reply.readInt();
3988 data.recycle();
3989 reply.recycle();
3990 return result;
3991 }
3992
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07003993 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
3994 Parcel data = Parcel.obtain();
3995 Parcel reply = Parcel.obtain();
3996 data.writeInterfaceToken(IActivityManager.descriptor);
3997 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3998 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
3999 reply.readException();
4000 data.recycle();
4001 reply.recycle();
4002 }
4003
4004 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4005 Parcel data = Parcel.obtain();
4006 Parcel reply = Parcel.obtain();
4007 data.writeInterfaceToken(IActivityManager.descriptor);
4008 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4009 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4010 reply.readException();
4011 data.recycle();
4012 reply.recycle();
4013 }
4014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004015 private IBinder mRemote;
4016}