blob: 8436b2c0b560ae25a8d82f389a256ef2b890088a [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
Dianne Hackbornf02b60a2012-08-16 10:48:27 -070042import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080045import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.List;
49
50/** {@hide} */
51public abstract class ActivityManagerNative extends Binder implements IActivityManager
52{
53 /**
54 * Cast a Binder object into an activity manager interface, generating
55 * a proxy if needed.
56 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080057 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 if (obj == null) {
59 return null;
60 }
61 IActivityManager in =
62 (IActivityManager)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ActivityManagerProxy(obj);
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 /**
71 * Retrieve the system's default/global activity manager.
72 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073 static public IActivityManager getDefault() {
74 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
78 * Convenience for checking whether the system is ready. For internal use only.
79 */
80 static public boolean isSystemReady() {
81 if (!sSystemReady) {
82 sSystemReady = getDefault().testIsSystemReady();
83 }
84 return sSystemReady;
85 }
86 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 /**
89 * Convenience for sending a sticky broadcast. For internal use only.
90 * If you don't care about permission, use null.
91 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070092 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 try {
94 getDefault().broadcastIntent(
95 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070096 null /*permission*/, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 } catch (RemoteException ex) {
98 }
99 }
100
101 static public void noteWakeupAlarm(PendingIntent ps) {
102 try {
103 getDefault().noteWakeupAlarm(ps.getTarget());
104 } catch (RemoteException ex) {
105 }
106 }
107
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800108 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 attachInterface(this, descriptor);
110 }
111
112 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
113 throws RemoteException {
114 switch (code) {
115 case START_ACTIVITY_TRANSACTION:
116 {
117 data.enforceInterface(IActivityManager.descriptor);
118 IBinder b = data.readStrongBinder();
119 IApplicationThread app = ApplicationThreadNative.asInterface(b);
120 Intent intent = Intent.CREATOR.createFromParcel(data);
121 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800123 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700125 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700126 String profileFile = data.readString();
127 ParcelFileDescriptor profileFd = data.readInt() != 0
128 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 Bundle options = data.readInt() != 0
130 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int result = startActivity(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 resultTo, resultWho, requestCode, startFlags,
133 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Amith Yamasani82644082012-08-03 13:09:11 -0700139 case START_ACTIVITY_AS_USER_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
144 Intent intent = Intent.CREATOR.createFromParcel(data);
145 String resolvedType = data.readString();
146 IBinder resultTo = data.readStrongBinder();
147 String resultWho = data.readString();
148 int requestCode = data.readInt();
149 int startFlags = data.readInt();
150 String profileFile = data.readString();
151 ParcelFileDescriptor profileFd = data.readInt() != 0
152 ? data.readFileDescriptor() : null;
153 Bundle options = data.readInt() != 0
154 ? Bundle.CREATOR.createFromParcel(data) : null;
155 int userId = data.readInt();
156 int result = startActivityAsUser(app, intent, resolvedType,
157 resultTo, resultWho, requestCode, startFlags,
158 profileFile, profileFd, options, userId);
159 reply.writeNoException();
160 reply.writeInt(result);
161 return true;
162 }
163
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800164 case START_ACTIVITY_AND_WAIT_TRANSACTION:
165 {
166 data.enforceInterface(IActivityManager.descriptor);
167 IBinder b = data.readStrongBinder();
168 IApplicationThread app = ApplicationThreadNative.asInterface(b);
169 Intent intent = Intent.CREATOR.createFromParcel(data);
170 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800172 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700174 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700175 String profileFile = data.readString();
176 ParcelFileDescriptor profileFd = data.readInt() != 0
177 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700178 Bundle options = data.readInt() != 0
179 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700180 int userId = data.readInt();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700182 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700183 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800184 reply.writeNoException();
185 result.writeToParcel(reply, 0);
186 return true;
187 }
188
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700189 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
190 {
191 data.enforceInterface(IActivityManager.descriptor);
192 IBinder b = data.readStrongBinder();
193 IApplicationThread app = ApplicationThreadNative.asInterface(b);
194 Intent intent = Intent.CREATOR.createFromParcel(data);
195 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700196 IBinder resultTo = data.readStrongBinder();
197 String resultWho = data.readString();
198 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700199 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700200 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700201 Bundle options = data.readInt() != 0
202 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700203 int userId = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700205 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 reply.writeNoException();
207 reply.writeInt(result);
208 return true;
209 }
210
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700211 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700212 {
213 data.enforceInterface(IActivityManager.descriptor);
214 IBinder b = data.readStrongBinder();
215 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700216 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700217 Intent fillInIntent = null;
218 if (data.readInt() != 0) {
219 fillInIntent = Intent.CREATOR.createFromParcel(data);
220 }
221 String resolvedType = data.readString();
222 IBinder resultTo = data.readStrongBinder();
223 String resultWho = data.readString();
224 int requestCode = data.readInt();
225 int flagsMask = data.readInt();
226 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700227 Bundle options = data.readInt() != 0
228 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700229 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700230 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700232 reply.writeNoException();
233 reply.writeInt(result);
234 return true;
235 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800236
237 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
238 {
239 data.enforceInterface(IActivityManager.descriptor);
240 IBinder callingActivity = data.readStrongBinder();
241 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 Bundle options = data.readInt() != 0
243 ? Bundle.CREATOR.createFromParcel(data) : null;
244 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 reply.writeNoException();
246 reply.writeInt(result ? 1 : 0);
247 return true;
248 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700249
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 case FINISH_ACTIVITY_TRANSACTION: {
251 data.enforceInterface(IActivityManager.descriptor);
252 IBinder token = data.readStrongBinder();
253 Intent resultData = null;
254 int resultCode = data.readInt();
255 if (data.readInt() != 0) {
256 resultData = Intent.CREATOR.createFromParcel(data);
257 }
258 boolean res = finishActivity(token, resultCode, resultData);
259 reply.writeNoException();
260 reply.writeInt(res ? 1 : 0);
261 return true;
262 }
263
264 case FINISH_SUB_ACTIVITY_TRANSACTION: {
265 data.enforceInterface(IActivityManager.descriptor);
266 IBinder token = data.readStrongBinder();
267 String resultWho = data.readString();
268 int requestCode = data.readInt();
269 finishSubActivity(token, resultWho, requestCode);
270 reply.writeNoException();
271 return true;
272 }
273
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700274 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
275 data.enforceInterface(IActivityManager.descriptor);
276 IBinder token = data.readStrongBinder();
277 boolean res = finishActivityAffinity(token);
278 reply.writeNoException();
279 reply.writeInt(res ? 1 : 0);
280 return true;
281 }
282
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800283 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
284 data.enforceInterface(IActivityManager.descriptor);
285 IBinder token = data.readStrongBinder();
286 boolean res = willActivityBeVisible(token);
287 reply.writeNoException();
288 reply.writeInt(res ? 1 : 0);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case REGISTER_RECEIVER_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder b = data.readStrongBinder();
296 IApplicationThread app =
297 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700298 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299 b = data.readStrongBinder();
300 IIntentReceiver rec
301 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
302 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
303 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700304 int userId = data.readInt();
305 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 reply.writeNoException();
307 if (intent != null) {
308 reply.writeInt(1);
309 intent.writeToParcel(reply, 0);
310 } else {
311 reply.writeInt(0);
312 }
313 return true;
314 }
315
316 case UNREGISTER_RECEIVER_TRANSACTION:
317 {
318 data.enforceInterface(IActivityManager.descriptor);
319 IBinder b = data.readStrongBinder();
320 if (b == null) {
321 return true;
322 }
323 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
324 unregisterReceiver(rec);
325 reply.writeNoException();
326 return true;
327 }
328
329 case BROADCAST_INTENT_TRANSACTION:
330 {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder b = data.readStrongBinder();
333 IApplicationThread app =
334 b != null ? ApplicationThreadNative.asInterface(b) : null;
335 Intent intent = Intent.CREATOR.createFromParcel(data);
336 String resolvedType = data.readString();
337 b = data.readStrongBinder();
338 IIntentReceiver resultTo =
339 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
340 int resultCode = data.readInt();
341 String resultData = data.readString();
342 Bundle resultExtras = data.readBundle();
343 String perm = data.readString();
344 boolean serialized = data.readInt() != 0;
345 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700346 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 int res = broadcastIntent(app, intent, resolvedType, resultTo,
348 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700349 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 reply.writeNoException();
351 reply.writeInt(res);
352 return true;
353 }
354
355 case UNBROADCAST_INTENT_TRANSACTION:
356 {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder b = data.readStrongBinder();
359 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
360 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700361 int userId = data.readInt();
362 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 reply.writeNoException();
364 return true;
365 }
366
367 case FINISH_RECEIVER_TRANSACTION: {
368 data.enforceInterface(IActivityManager.descriptor);
369 IBinder who = data.readStrongBinder();
370 int resultCode = data.readInt();
371 String resultData = data.readString();
372 Bundle resultExtras = data.readBundle();
373 boolean resultAbort = data.readInt() != 0;
374 if (who != null) {
375 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
376 }
377 reply.writeNoException();
378 return true;
379 }
380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 case ATTACH_APPLICATION_TRANSACTION: {
382 data.enforceInterface(IActivityManager.descriptor);
383 IApplicationThread app = ApplicationThreadNative.asInterface(
384 data.readStrongBinder());
385 if (app != null) {
386 attachApplication(app);
387 }
388 reply.writeNoException();
389 return true;
390 }
391
392 case ACTIVITY_IDLE_TRANSACTION: {
393 data.enforceInterface(IActivityManager.descriptor);
394 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700395 Configuration config = null;
396 if (data.readInt() != 0) {
397 config = Configuration.CREATOR.createFromParcel(data);
398 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700399 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700401 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 }
403 reply.writeNoException();
404 return true;
405 }
406
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700407 case ACTIVITY_RESUMED_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder token = data.readStrongBinder();
410 activityResumed(token);
411 reply.writeNoException();
412 return true;
413 }
414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 case ACTIVITY_PAUSED_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800418 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 reply.writeNoException();
420 return true;
421 }
422
423 case ACTIVITY_STOPPED_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800426 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 Bitmap thumbnail = data.readInt() != 0
428 ? Bitmap.CREATOR.createFromParcel(data) : null;
429 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800430 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 reply.writeNoException();
432 return true;
433 }
434
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800435 case ACTIVITY_SLEPT_TRANSACTION: {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder token = data.readStrongBinder();
438 activitySlept(token);
439 reply.writeNoException();
440 return true;
441 }
442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 case ACTIVITY_DESTROYED_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 IBinder token = data.readStrongBinder();
446 activityDestroyed(token);
447 reply.writeNoException();
448 return true;
449 }
450
451 case GET_CALLING_PACKAGE_TRANSACTION: {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder token = data.readStrongBinder();
454 String res = token != null ? getCallingPackage(token) : null;
455 reply.writeNoException();
456 reply.writeString(res);
457 return true;
458 }
459
460 case GET_CALLING_ACTIVITY_TRANSACTION: {
461 data.enforceInterface(IActivityManager.descriptor);
462 IBinder token = data.readStrongBinder();
463 ComponentName cn = getCallingActivity(token);
464 reply.writeNoException();
465 ComponentName.writeToParcel(cn, reply);
466 return true;
467 }
468
469 case GET_TASKS_TRANSACTION: {
470 data.enforceInterface(IActivityManager.descriptor);
471 int maxNum = data.readInt();
472 int fl = data.readInt();
473 IBinder receiverBinder = data.readStrongBinder();
474 IThumbnailReceiver receiver = receiverBinder != null
475 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
476 : null;
477 List list = getTasks(maxNum, fl, receiver);
478 reply.writeNoException();
479 int N = list != null ? list.size() : -1;
480 reply.writeInt(N);
481 int i;
482 for (i=0; i<N; i++) {
483 ActivityManager.RunningTaskInfo info =
484 (ActivityManager.RunningTaskInfo)list.get(i);
485 info.writeToParcel(reply, 0);
486 }
487 return true;
488 }
489
490 case GET_RECENT_TASKS_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 int maxNum = data.readInt();
493 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700494 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700496 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 reply.writeNoException();
498 reply.writeTypedList(list);
499 return true;
500 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700501
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700502 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800503 data.enforceInterface(IActivityManager.descriptor);
504 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700505 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800506 reply.writeNoException();
507 if (bm != null) {
508 reply.writeInt(1);
509 bm.writeToParcel(reply, 0);
510 } else {
511 reply.writeInt(0);
512 }
513 return true;
514 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700515
516 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 int id = data.readInt();
519 Bitmap bm = getTaskTopThumbnail(id);
520 reply.writeNoException();
521 if (bm != null) {
522 reply.writeInt(1);
523 bm.writeToParcel(reply, 0);
524 } else {
525 reply.writeInt(0);
526 }
527 return true;
528 }
529
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 case GET_SERVICES_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 int maxNum = data.readInt();
533 int fl = data.readInt();
534 List list = getServices(maxNum, fl);
535 reply.writeNoException();
536 int N = list != null ? list.size() : -1;
537 reply.writeInt(N);
538 int i;
539 for (i=0; i<N; i++) {
540 ActivityManager.RunningServiceInfo info =
541 (ActivityManager.RunningServiceInfo)list.get(i);
542 info.writeToParcel(reply, 0);
543 }
544 return true;
545 }
546
547 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
550 reply.writeNoException();
551 reply.writeTypedList(list);
552 return true;
553 }
554
555 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
558 reply.writeNoException();
559 reply.writeTypedList(list);
560 return true;
561 }
562
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700563 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
565 List<ApplicationInfo> list = getRunningExternalApplications();
566 reply.writeNoException();
567 reply.writeTypedList(list);
568 return true;
569 }
570
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571 case MOVE_TASK_TO_FRONT_TRANSACTION: {
572 data.enforceInterface(IActivityManager.descriptor);
573 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800574 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700575 Bundle options = data.readInt() != 0
576 ? Bundle.CREATOR.createFromParcel(data) : null;
577 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 reply.writeNoException();
579 return true;
580 }
581
582 case MOVE_TASK_TO_BACK_TRANSACTION: {
583 data.enforceInterface(IActivityManager.descriptor);
584 int task = data.readInt();
585 moveTaskToBack(task);
586 reply.writeNoException();
587 return true;
588 }
589
590 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 IBinder token = data.readStrongBinder();
593 boolean nonRoot = data.readInt() != 0;
594 boolean res = moveActivityTaskToBack(token, nonRoot);
595 reply.writeNoException();
596 reply.writeInt(res ? 1 : 0);
597 return true;
598 }
599
600 case MOVE_TASK_BACKWARDS_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 int task = data.readInt();
603 moveTaskBackwards(task);
604 reply.writeNoException();
605 return true;
606 }
607
608 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
609 data.enforceInterface(IActivityManager.descriptor);
610 IBinder token = data.readStrongBinder();
611 boolean onlyRoot = data.readInt() != 0;
612 int res = token != null
613 ? getTaskForActivity(token, onlyRoot) : -1;
614 reply.writeNoException();
615 reply.writeInt(res);
616 return true;
617 }
618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 case REPORT_THUMBNAIL_TRANSACTION: {
620 data.enforceInterface(IActivityManager.descriptor);
621 IBinder token = data.readStrongBinder();
622 Bitmap thumbnail = data.readInt() != 0
623 ? Bitmap.CREATOR.createFromParcel(data) : null;
624 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
625 reportThumbnail(token, thumbnail, description);
626 reply.writeNoException();
627 return true;
628 }
629
630 case GET_CONTENT_PROVIDER_TRANSACTION: {
631 data.enforceInterface(IActivityManager.descriptor);
632 IBinder b = data.readStrongBinder();
633 IApplicationThread app = ApplicationThreadNative.asInterface(b);
634 String name = data.readString();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700635 boolean stable = data.readInt() != 0;
636 ContentProviderHolder cph = getContentProvider(app, name, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800637 reply.writeNoException();
638 if (cph != null) {
639 reply.writeInt(1);
640 cph.writeToParcel(reply, 0);
641 } else {
642 reply.writeInt(0);
643 }
644 return true;
645 }
646
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800647 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
648 data.enforceInterface(IActivityManager.descriptor);
649 String name = data.readString();
650 IBinder token = data.readStrongBinder();
651 ContentProviderHolder cph = getContentProviderExternal(name, token);
652 reply.writeNoException();
653 if (cph != null) {
654 reply.writeInt(1);
655 cph.writeToParcel(reply, 0);
656 } else {
657 reply.writeInt(0);
658 }
659 return true;
660 }
661
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800662 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 IBinder b = data.readStrongBinder();
665 IApplicationThread app = ApplicationThreadNative.asInterface(b);
666 ArrayList<ContentProviderHolder> providers =
667 data.createTypedArrayList(ContentProviderHolder.CREATOR);
668 publishContentProviders(app, providers);
669 reply.writeNoException();
670 return true;
671 }
672
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700673 case REF_CONTENT_PROVIDER_TRANSACTION: {
674 data.enforceInterface(IActivityManager.descriptor);
675 IBinder b = data.readStrongBinder();
676 int stable = data.readInt();
677 int unstable = data.readInt();
678 boolean res = refContentProvider(b, stable, unstable);
679 reply.writeNoException();
680 reply.writeInt(res ? 1 : 0);
681 return true;
682 }
683
684 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 IBinder b = data.readStrongBinder();
687 unstableProviderDied(b);
688 reply.writeNoException();
689 return true;
690 }
691
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800692 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
693 data.enforceInterface(IActivityManager.descriptor);
694 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700695 boolean stable = data.readInt() != 0;
696 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 reply.writeNoException();
698 return true;
699 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800700
701 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 String name = data.readString();
704 IBinder token = data.readStrongBinder();
705 removeContentProviderExternal(name, token);
706 reply.writeNoException();
707 return true;
708 }
709
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700710 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
713 PendingIntent pi = getRunningServiceControlPanel(comp);
714 reply.writeNoException();
715 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
716 return true;
717 }
718
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800719 case START_SERVICE_TRANSACTION: {
720 data.enforceInterface(IActivityManager.descriptor);
721 IBinder b = data.readStrongBinder();
722 IApplicationThread app = ApplicationThreadNative.asInterface(b);
723 Intent service = Intent.CREATOR.createFromParcel(data);
724 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700725 int userId = data.readInt();
726 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800727 reply.writeNoException();
728 ComponentName.writeToParcel(cn, reply);
729 return true;
730 }
731
732 case STOP_SERVICE_TRANSACTION: {
733 data.enforceInterface(IActivityManager.descriptor);
734 IBinder b = data.readStrongBinder();
735 IApplicationThread app = ApplicationThreadNative.asInterface(b);
736 Intent service = Intent.CREATOR.createFromParcel(data);
737 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700738 int userId = data.readInt();
739 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800740 reply.writeNoException();
741 reply.writeInt(res);
742 return true;
743 }
744
745 case STOP_SERVICE_TOKEN_TRANSACTION: {
746 data.enforceInterface(IActivityManager.descriptor);
747 ComponentName className = ComponentName.readFromParcel(data);
748 IBinder token = data.readStrongBinder();
749 int startId = data.readInt();
750 boolean res = stopServiceToken(className, token, startId);
751 reply.writeNoException();
752 reply.writeInt(res ? 1 : 0);
753 return true;
754 }
755
756 case SET_SERVICE_FOREGROUND_TRANSACTION: {
757 data.enforceInterface(IActivityManager.descriptor);
758 ComponentName className = ComponentName.readFromParcel(data);
759 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700760 int id = data.readInt();
761 Notification notification = null;
762 if (data.readInt() != 0) {
763 notification = Notification.CREATOR.createFromParcel(data);
764 }
765 boolean removeNotification = data.readInt() != 0;
766 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800767 reply.writeNoException();
768 return true;
769 }
770
771 case BIND_SERVICE_TRANSACTION: {
772 data.enforceInterface(IActivityManager.descriptor);
773 IBinder b = data.readStrongBinder();
774 IApplicationThread app = ApplicationThreadNative.asInterface(b);
775 IBinder token = data.readStrongBinder();
776 Intent service = Intent.CREATOR.createFromParcel(data);
777 String resolvedType = data.readString();
778 b = data.readStrongBinder();
779 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800780 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800781 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800782 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800783 reply.writeNoException();
784 reply.writeInt(res);
785 return true;
786 }
787
788 case UNBIND_SERVICE_TRANSACTION: {
789 data.enforceInterface(IActivityManager.descriptor);
790 IBinder b = data.readStrongBinder();
791 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
792 boolean res = unbindService(conn);
793 reply.writeNoException();
794 reply.writeInt(res ? 1 : 0);
795 return true;
796 }
797
798 case PUBLISH_SERVICE_TRANSACTION: {
799 data.enforceInterface(IActivityManager.descriptor);
800 IBinder token = data.readStrongBinder();
801 Intent intent = Intent.CREATOR.createFromParcel(data);
802 IBinder service = data.readStrongBinder();
803 publishService(token, intent, service);
804 reply.writeNoException();
805 return true;
806 }
807
808 case UNBIND_FINISHED_TRANSACTION: {
809 data.enforceInterface(IActivityManager.descriptor);
810 IBinder token = data.readStrongBinder();
811 Intent intent = Intent.CREATOR.createFromParcel(data);
812 boolean doRebind = data.readInt() != 0;
813 unbindFinished(token, intent, doRebind);
814 reply.writeNoException();
815 return true;
816 }
817
818 case SERVICE_DONE_EXECUTING_TRANSACTION: {
819 data.enforceInterface(IActivityManager.descriptor);
820 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700821 int type = data.readInt();
822 int startId = data.readInt();
823 int res = data.readInt();
824 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800825 reply.writeNoException();
826 return true;
827 }
828
829 case START_INSTRUMENTATION_TRANSACTION: {
830 data.enforceInterface(IActivityManager.descriptor);
831 ComponentName className = ComponentName.readFromParcel(data);
832 String profileFile = data.readString();
833 int fl = data.readInt();
834 Bundle arguments = data.readBundle();
835 IBinder b = data.readStrongBinder();
836 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700837 int userId = data.readInt();
838 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800839 reply.writeNoException();
840 reply.writeInt(res ? 1 : 0);
841 return true;
842 }
843
844
845 case FINISH_INSTRUMENTATION_TRANSACTION: {
846 data.enforceInterface(IActivityManager.descriptor);
847 IBinder b = data.readStrongBinder();
848 IApplicationThread app = ApplicationThreadNative.asInterface(b);
849 int resultCode = data.readInt();
850 Bundle results = data.readBundle();
851 finishInstrumentation(app, resultCode, results);
852 reply.writeNoException();
853 return true;
854 }
855
856 case GET_CONFIGURATION_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 Configuration config = getConfiguration();
859 reply.writeNoException();
860 config.writeToParcel(reply, 0);
861 return true;
862 }
863
864 case UPDATE_CONFIGURATION_TRANSACTION: {
865 data.enforceInterface(IActivityManager.descriptor);
866 Configuration config = Configuration.CREATOR.createFromParcel(data);
867 updateConfiguration(config);
868 reply.writeNoException();
869 return true;
870 }
871
872 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 IBinder token = data.readStrongBinder();
875 int requestedOrientation = data.readInt();
876 setRequestedOrientation(token, requestedOrientation);
877 reply.writeNoException();
878 return true;
879 }
880
881 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
882 data.enforceInterface(IActivityManager.descriptor);
883 IBinder token = data.readStrongBinder();
884 int req = getRequestedOrientation(token);
885 reply.writeNoException();
886 reply.writeInt(req);
887 return true;
888 }
889
890 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
891 data.enforceInterface(IActivityManager.descriptor);
892 IBinder token = data.readStrongBinder();
893 ComponentName cn = getActivityClassForToken(token);
894 reply.writeNoException();
895 ComponentName.writeToParcel(cn, reply);
896 return true;
897 }
898
899 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder token = data.readStrongBinder();
902 reply.writeNoException();
903 reply.writeString(getPackageForToken(token));
904 return true;
905 }
906
907 case GET_INTENT_SENDER_TRANSACTION: {
908 data.enforceInterface(IActivityManager.descriptor);
909 int type = data.readInt();
910 String packageName = data.readString();
911 IBinder token = data.readStrongBinder();
912 String resultWho = data.readString();
913 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800914 Intent[] requestIntents;
915 String[] requestResolvedTypes;
916 if (data.readInt() != 0) {
917 requestIntents = data.createTypedArray(Intent.CREATOR);
918 requestResolvedTypes = data.createStringArray();
919 } else {
920 requestIntents = null;
921 requestResolvedTypes = null;
922 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800923 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700924 Bundle options = data.readInt() != 0
925 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700926 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800927 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800928 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700929 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800930 reply.writeNoException();
931 reply.writeStrongBinder(res != null ? res.asBinder() : null);
932 return true;
933 }
934
935 case CANCEL_INTENT_SENDER_TRANSACTION: {
936 data.enforceInterface(IActivityManager.descriptor);
937 IIntentSender r = IIntentSender.Stub.asInterface(
938 data.readStrongBinder());
939 cancelIntentSender(r);
940 reply.writeNoException();
941 return true;
942 }
943
944 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
945 data.enforceInterface(IActivityManager.descriptor);
946 IIntentSender r = IIntentSender.Stub.asInterface(
947 data.readStrongBinder());
948 String res = getPackageForIntentSender(r);
949 reply.writeNoException();
950 reply.writeString(res);
951 return true;
952 }
953
Christopher Tatec4a07d12012-04-06 14:19:13 -0700954 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
955 data.enforceInterface(IActivityManager.descriptor);
956 IIntentSender r = IIntentSender.Stub.asInterface(
957 data.readStrongBinder());
958 int res = getUidForIntentSender(r);
959 reply.writeNoException();
960 reply.writeInt(res);
961 return true;
962 }
963
Dianne Hackborn41203752012-08-31 14:05:51 -0700964 case HANDLE_INCOMING_USER_TRANSACTION: {
965 data.enforceInterface(IActivityManager.descriptor);
966 int callingPid = data.readInt();
967 int callingUid = data.readInt();
968 int userId = data.readInt();
969 boolean allowAll = data.readInt() != 0 ;
970 boolean requireFull = data.readInt() != 0;
971 String name = data.readString();
972 String callerPackage = data.readString();
973 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
974 requireFull, name, callerPackage);
975 reply.writeNoException();
976 reply.writeInt(res);
977 return true;
978 }
979
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980 case SET_PROCESS_LIMIT_TRANSACTION: {
981 data.enforceInterface(IActivityManager.descriptor);
982 int max = data.readInt();
983 setProcessLimit(max);
984 reply.writeNoException();
985 return true;
986 }
987
988 case GET_PROCESS_LIMIT_TRANSACTION: {
989 data.enforceInterface(IActivityManager.descriptor);
990 int limit = getProcessLimit();
991 reply.writeNoException();
992 reply.writeInt(limit);
993 return true;
994 }
995
996 case SET_PROCESS_FOREGROUND_TRANSACTION: {
997 data.enforceInterface(IActivityManager.descriptor);
998 IBinder token = data.readStrongBinder();
999 int pid = data.readInt();
1000 boolean isForeground = data.readInt() != 0;
1001 setProcessForeground(token, pid, isForeground);
1002 reply.writeNoException();
1003 return true;
1004 }
1005
1006 case CHECK_PERMISSION_TRANSACTION: {
1007 data.enforceInterface(IActivityManager.descriptor);
1008 String perm = data.readString();
1009 int pid = data.readInt();
1010 int uid = data.readInt();
1011 int res = checkPermission(perm, pid, uid);
1012 reply.writeNoException();
1013 reply.writeInt(res);
1014 return true;
1015 }
1016
1017 case CHECK_URI_PERMISSION_TRANSACTION: {
1018 data.enforceInterface(IActivityManager.descriptor);
1019 Uri uri = Uri.CREATOR.createFromParcel(data);
1020 int pid = data.readInt();
1021 int uid = data.readInt();
1022 int mode = data.readInt();
1023 int res = checkUriPermission(uri, pid, uid, mode);
1024 reply.writeNoException();
1025 reply.writeInt(res);
1026 return true;
1027 }
1028
1029 case CLEAR_APP_DATA_TRANSACTION: {
1030 data.enforceInterface(IActivityManager.descriptor);
1031 String packageName = data.readString();
1032 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1033 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001034 int userId = data.readInt();
1035 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001036 reply.writeNoException();
1037 reply.writeInt(res ? 1 : 0);
1038 return true;
1039 }
1040
1041 case GRANT_URI_PERMISSION_TRANSACTION: {
1042 data.enforceInterface(IActivityManager.descriptor);
1043 IBinder b = data.readStrongBinder();
1044 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1045 String targetPkg = data.readString();
1046 Uri uri = Uri.CREATOR.createFromParcel(data);
1047 int mode = data.readInt();
1048 grantUriPermission(app, targetPkg, uri, mode);
1049 reply.writeNoException();
1050 return true;
1051 }
1052
1053 case REVOKE_URI_PERMISSION_TRANSACTION: {
1054 data.enforceInterface(IActivityManager.descriptor);
1055 IBinder b = data.readStrongBinder();
1056 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1057 Uri uri = Uri.CREATOR.createFromParcel(data);
1058 int mode = data.readInt();
1059 revokeUriPermission(app, uri, mode);
1060 reply.writeNoException();
1061 return true;
1062 }
1063
1064 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1065 data.enforceInterface(IActivityManager.descriptor);
1066 IBinder b = data.readStrongBinder();
1067 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1068 boolean waiting = data.readInt() != 0;
1069 showWaitingForDebugger(app, waiting);
1070 reply.writeNoException();
1071 return true;
1072 }
1073
1074 case GET_MEMORY_INFO_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1077 getMemoryInfo(mi);
1078 reply.writeNoException();
1079 mi.writeToParcel(reply, 0);
1080 return true;
1081 }
1082
1083 case UNHANDLED_BACK_TRANSACTION: {
1084 data.enforceInterface(IActivityManager.descriptor);
1085 unhandledBack();
1086 reply.writeNoException();
1087 return true;
1088 }
1089
1090 case OPEN_CONTENT_URI_TRANSACTION: {
1091 data.enforceInterface(IActivityManager.descriptor);
1092 Uri uri = Uri.parse(data.readString());
1093 ParcelFileDescriptor pfd = openContentUri(uri);
1094 reply.writeNoException();
1095 if (pfd != null) {
1096 reply.writeInt(1);
1097 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1098 } else {
1099 reply.writeInt(0);
1100 }
1101 return true;
1102 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001103
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001104 case GOING_TO_SLEEP_TRANSACTION: {
1105 data.enforceInterface(IActivityManager.descriptor);
1106 goingToSleep();
1107 reply.writeNoException();
1108 return true;
1109 }
1110
1111 case WAKING_UP_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 wakingUp();
1114 reply.writeNoException();
1115 return true;
1116 }
1117
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001118 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1119 data.enforceInterface(IActivityManager.descriptor);
1120 setLockScreenShown(data.readInt() != 0);
1121 reply.writeNoException();
1122 return true;
1123 }
1124
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 case SET_DEBUG_APP_TRANSACTION: {
1126 data.enforceInterface(IActivityManager.descriptor);
1127 String pn = data.readString();
1128 boolean wfd = data.readInt() != 0;
1129 boolean per = data.readInt() != 0;
1130 setDebugApp(pn, wfd, per);
1131 reply.writeNoException();
1132 return true;
1133 }
1134
1135 case SET_ALWAYS_FINISH_TRANSACTION: {
1136 data.enforceInterface(IActivityManager.descriptor);
1137 boolean enabled = data.readInt() != 0;
1138 setAlwaysFinish(enabled);
1139 reply.writeNoException();
1140 return true;
1141 }
1142
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001143 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001145 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001147 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 return true;
1149 }
1150
1151 case ENTER_SAFE_MODE_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 enterSafeMode();
1154 reply.writeNoException();
1155 return true;
1156 }
1157
1158 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1159 data.enforceInterface(IActivityManager.descriptor);
1160 IIntentSender is = IIntentSender.Stub.asInterface(
1161 data.readStrongBinder());
1162 noteWakeupAlarm(is);
1163 reply.writeNoException();
1164 return true;
1165 }
1166
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001167 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 data.enforceInterface(IActivityManager.descriptor);
1169 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001170 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001171 boolean secure = data.readInt() != 0;
1172 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 reply.writeNoException();
1174 reply.writeInt(res ? 1 : 0);
1175 return true;
1176 }
1177
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001178 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1179 data.enforceInterface(IActivityManager.descriptor);
1180 String reason = data.readString();
1181 boolean res = killProcessesBelowForeground(reason);
1182 reply.writeNoException();
1183 reply.writeInt(res ? 1 : 0);
1184 return true;
1185 }
1186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001187 case START_RUNNING_TRANSACTION: {
1188 data.enforceInterface(IActivityManager.descriptor);
1189 String pkg = data.readString();
1190 String cls = data.readString();
1191 String action = data.readString();
1192 String indata = data.readString();
1193 startRunning(pkg, cls, action, indata);
1194 reply.writeNoException();
1195 return true;
1196 }
1197
Dan Egnor60d87622009-12-16 16:32:58 -08001198 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1199 data.enforceInterface(IActivityManager.descriptor);
1200 IBinder app = data.readStrongBinder();
1201 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1202 handleApplicationCrash(app, ci);
1203 reply.writeNoException();
1204 return true;
1205 }
1206
1207 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 data.enforceInterface(IActivityManager.descriptor);
1209 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001210 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001211 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001212 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001214 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 return true;
1216 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001217
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001218 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001221 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001222 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1223 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001224 reply.writeNoException();
1225 return true;
1226 }
1227
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001228 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1229 data.enforceInterface(IActivityManager.descriptor);
1230 int sig = data.readInt();
1231 signalPersistentProcesses(sig);
1232 reply.writeNoException();
1233 return true;
1234 }
1235
Dianne Hackborn03abb812010-01-04 18:43:19 -08001236 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1237 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001239 int userId = data.readInt();
1240 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001241 reply.writeNoException();
1242 return true;
1243 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001244
1245 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1246 data.enforceInterface(IActivityManager.descriptor);
1247 killAllBackgroundProcesses();
1248 reply.writeNoException();
1249 return true;
1250 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001251
1252 case FORCE_STOP_PACKAGE_TRANSACTION: {
1253 data.enforceInterface(IActivityManager.descriptor);
1254 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001255 int userId = data.readInt();
1256 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001257 reply.writeNoException();
1258 return true;
1259 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001260
1261 case GET_MY_MEMORY_STATE_TRANSACTION: {
1262 data.enforceInterface(IActivityManager.descriptor);
1263 ActivityManager.RunningAppProcessInfo info =
1264 new ActivityManager.RunningAppProcessInfo();
1265 getMyMemoryState(info);
1266 reply.writeNoException();
1267 info.writeToParcel(reply, 0);
1268 return true;
1269 }
1270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1272 data.enforceInterface(IActivityManager.descriptor);
1273 ConfigurationInfo config = getDeviceConfigurationInfo();
1274 reply.writeNoException();
1275 config.writeToParcel(reply, 0);
1276 return true;
1277 }
1278
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001279 case PROFILE_CONTROL_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001282 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001283 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001284 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001285 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001286 ParcelFileDescriptor fd = data.readInt() != 0
1287 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001288 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001289 reply.writeNoException();
1290 reply.writeInt(res ? 1 : 0);
1291 return true;
1292 }
1293
Dianne Hackborn55280a92009-05-07 15:53:46 -07001294 case SHUTDOWN_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 boolean res = shutdown(data.readInt());
1297 reply.writeNoException();
1298 reply.writeInt(res ? 1 : 0);
1299 return true;
1300 }
1301
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001302 case STOP_APP_SWITCHES_TRANSACTION: {
1303 data.enforceInterface(IActivityManager.descriptor);
1304 stopAppSwitches();
1305 reply.writeNoException();
1306 return true;
1307 }
1308
1309 case RESUME_APP_SWITCHES_TRANSACTION: {
1310 data.enforceInterface(IActivityManager.descriptor);
1311 resumeAppSwitches();
1312 reply.writeNoException();
1313 return true;
1314 }
1315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 case PEEK_SERVICE_TRANSACTION: {
1317 data.enforceInterface(IActivityManager.descriptor);
1318 Intent service = Intent.CREATOR.createFromParcel(data);
1319 String resolvedType = data.readString();
1320 IBinder binder = peekService(service, resolvedType);
1321 reply.writeNoException();
1322 reply.writeStrongBinder(binder);
1323 return true;
1324 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001325
1326 case START_BACKUP_AGENT_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1329 int backupRestoreMode = data.readInt();
1330 boolean success = bindBackupAgent(info, backupRestoreMode);
1331 reply.writeNoException();
1332 reply.writeInt(success ? 1 : 0);
1333 return true;
1334 }
1335
1336 case BACKUP_AGENT_CREATED_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 String packageName = data.readString();
1339 IBinder agent = data.readStrongBinder();
1340 backupAgentCreated(packageName, agent);
1341 reply.writeNoException();
1342 return true;
1343 }
1344
1345 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1348 unbindBackupAgent(info);
1349 reply.writeNoException();
1350 return true;
1351 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001352
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001353 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001354 data.enforceInterface(IActivityManager.descriptor);
1355 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001356 int appid = data.readInt();
1357 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001361
1362 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 String reason = data.readString();
1365 closeSystemDialogs(reason);
1366 reply.writeNoException();
1367 return true;
1368 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001369
1370 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1371 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001372 int[] pids = data.createIntArray();
1373 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001374 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001375 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001376 return true;
1377 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001378
1379 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
1381 String processName = data.readString();
1382 int uid = data.readInt();
1383 killApplicationProcess(processName, uid);
1384 reply.writeNoException();
1385 return true;
1386 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001387
1388 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 IBinder token = data.readStrongBinder();
1391 String packageName = data.readString();
1392 int enterAnim = data.readInt();
1393 int exitAnim = data.readInt();
1394 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001395 reply.writeNoException();
1396 return true;
1397 }
1398
1399 case IS_USER_A_MONKEY_TRANSACTION: {
1400 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001401 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001402 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001403 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001404 return true;
1405 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001406
1407 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1408 data.enforceInterface(IActivityManager.descriptor);
1409 finishHeavyWeightApp();
1410 reply.writeNoException();
1411 return true;
1412 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001413
1414 case IS_IMMERSIVE_TRANSACTION: {
1415 data.enforceInterface(IActivityManager.descriptor);
1416 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001417 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001418 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001419 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001420 return true;
1421 }
1422
1423 case SET_IMMERSIVE_TRANSACTION: {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 IBinder token = data.readStrongBinder();
1426 boolean imm = data.readInt() == 1;
1427 setImmersive(token, imm);
1428 reply.writeNoException();
1429 return true;
1430 }
1431
1432 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1433 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001434 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001435 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001436 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001437 return true;
1438 }
1439
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001440 case CRASH_APPLICATION_TRANSACTION: {
1441 data.enforceInterface(IActivityManager.descriptor);
1442 int uid = data.readInt();
1443 int initialPid = data.readInt();
1444 String packageName = data.readString();
1445 String message = data.readString();
1446 crashApplication(uid, initialPid, packageName, message);
1447 reply.writeNoException();
1448 return true;
1449 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001450
1451 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1452 data.enforceInterface(IActivityManager.descriptor);
1453 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001454 int userId = data.readInt();
1455 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001456 reply.writeNoException();
1457 reply.writeString(type);
1458 return true;
1459 }
1460
Dianne Hackborn7e269642010-08-25 19:50:20 -07001461 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1462 data.enforceInterface(IActivityManager.descriptor);
1463 String name = data.readString();
1464 IBinder perm = newUriPermissionOwner(name);
1465 reply.writeNoException();
1466 reply.writeStrongBinder(perm);
1467 return true;
1468 }
1469
1470 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
1472 IBinder owner = data.readStrongBinder();
1473 int fromUid = data.readInt();
1474 String targetPkg = data.readString();
1475 Uri uri = Uri.CREATOR.createFromParcel(data);
1476 int mode = data.readInt();
1477 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1478 reply.writeNoException();
1479 return true;
1480 }
1481
1482 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1483 data.enforceInterface(IActivityManager.descriptor);
1484 IBinder owner = data.readStrongBinder();
1485 Uri uri = null;
1486 if (data.readInt() != 0) {
1487 Uri.CREATOR.createFromParcel(data);
1488 }
1489 int mode = data.readInt();
1490 revokeUriPermissionFromOwner(owner, uri, mode);
1491 reply.writeNoException();
1492 return true;
1493 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001494
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001495 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1496 data.enforceInterface(IActivityManager.descriptor);
1497 int callingUid = data.readInt();
1498 String targetPkg = data.readString();
1499 Uri uri = Uri.CREATOR.createFromParcel(data);
1500 int modeFlags = data.readInt();
1501 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1502 reply.writeNoException();
1503 reply.writeInt(res);
1504 return true;
1505 }
1506
Andy McFadden824c5102010-07-09 16:26:57 -07001507 case DUMP_HEAP_TRANSACTION: {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 String process = data.readString();
1510 boolean managed = data.readInt() != 0;
1511 String path = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001512 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001513 ParcelFileDescriptor fd = data.readInt() != 0
1514 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001515 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001516 reply.writeNoException();
1517 reply.writeInt(res ? 1 : 0);
1518 return true;
1519 }
1520
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001521 case START_ACTIVITIES_TRANSACTION:
1522 {
1523 data.enforceInterface(IActivityManager.descriptor);
1524 IBinder b = data.readStrongBinder();
1525 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1526 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1527 String[] resolvedTypes = data.createStringArray();
1528 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001529 Bundle options = data.readInt() != 0
1530 ? Bundle.CREATOR.createFromParcel(data) : null;
1531 int result = startActivities(app, intents, resolvedTypes, resultTo,
1532 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001533 reply.writeNoException();
1534 reply.writeInt(result);
1535 return true;
1536 }
1537
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001538 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1539 {
1540 data.enforceInterface(IActivityManager.descriptor);
1541 int mode = getFrontActivityScreenCompatMode();
1542 reply.writeNoException();
1543 reply.writeInt(mode);
1544 return true;
1545 }
1546
1547 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1548 {
1549 data.enforceInterface(IActivityManager.descriptor);
1550 int mode = data.readInt();
1551 setFrontActivityScreenCompatMode(mode);
1552 reply.writeNoException();
1553 reply.writeInt(mode);
1554 return true;
1555 }
1556
1557 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1558 {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 String pkg = data.readString();
1561 int mode = getPackageScreenCompatMode(pkg);
1562 reply.writeNoException();
1563 reply.writeInt(mode);
1564 return true;
1565 }
1566
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001567 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1568 {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001571 int mode = data.readInt();
1572 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001573 reply.writeNoException();
1574 return true;
1575 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001576
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001577 case SWITCH_USER_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 int userid = data.readInt();
1580 boolean result = switchUser(userid);
1581 reply.writeNoException();
1582 reply.writeInt(result ? 1 : 0);
1583 return true;
1584 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001585
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001586 case STOP_USER_TRANSACTION: {
1587 data.enforceInterface(IActivityManager.descriptor);
1588 int userid = data.readInt();
1589 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1590 data.readStrongBinder());
1591 int result = stopUser(userid, callback);
1592 reply.writeNoException();
1593 reply.writeInt(result);
1594 return true;
1595 }
1596
Amith Yamasani52f1d752012-03-28 18:19:29 -07001597 case GET_CURRENT_USER_TRANSACTION: {
1598 data.enforceInterface(IActivityManager.descriptor);
1599 UserInfo userInfo = getCurrentUser();
1600 reply.writeNoException();
1601 userInfo.writeToParcel(reply, 0);
1602 return true;
1603 }
1604
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001605 case IS_USER_RUNNING_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 int userid = data.readInt();
1608 boolean result = isUserRunning(userid);
1609 reply.writeNoException();
1610 reply.writeInt(result ? 1 : 0);
1611 return true;
1612 }
1613
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001614 case REMOVE_SUB_TASK_TRANSACTION:
1615 {
1616 data.enforceInterface(IActivityManager.descriptor);
1617 int taskId = data.readInt();
1618 int subTaskIndex = data.readInt();
1619 boolean result = removeSubTask(taskId, subTaskIndex);
1620 reply.writeNoException();
1621 reply.writeInt(result ? 1 : 0);
1622 return true;
1623 }
1624
1625 case REMOVE_TASK_TRANSACTION:
1626 {
1627 data.enforceInterface(IActivityManager.descriptor);
1628 int taskId = data.readInt();
1629 int fl = data.readInt();
1630 boolean result = removeTask(taskId, fl);
1631 reply.writeNoException();
1632 reply.writeInt(result ? 1 : 0);
1633 return true;
1634 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001635
Jeff Sharkeya4620792011-05-20 15:29:23 -07001636 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1637 data.enforceInterface(IActivityManager.descriptor);
1638 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1639 data.readStrongBinder());
1640 registerProcessObserver(observer);
1641 return true;
1642 }
1643
1644 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1647 data.readStrongBinder());
1648 unregisterProcessObserver(observer);
1649 return true;
1650 }
1651
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001652 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1653 {
1654 data.enforceInterface(IActivityManager.descriptor);
1655 String pkg = data.readString();
1656 boolean ask = getPackageAskScreenCompat(pkg);
1657 reply.writeNoException();
1658 reply.writeInt(ask ? 1 : 0);
1659 return true;
1660 }
1661
1662 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1663 {
1664 data.enforceInterface(IActivityManager.descriptor);
1665 String pkg = data.readString();
1666 boolean ask = data.readInt() != 0;
1667 setPackageAskScreenCompat(pkg, ask);
1668 reply.writeNoException();
1669 return true;
1670 }
1671
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001672 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1673 data.enforceInterface(IActivityManager.descriptor);
1674 IIntentSender r = IIntentSender.Stub.asInterface(
1675 data.readStrongBinder());
1676 boolean res = isIntentSenderTargetedToPackage(r);
1677 reply.writeNoException();
1678 reply.writeInt(res ? 1 : 0);
1679 return true;
1680 }
1681
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001682 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1683 data.enforceInterface(IActivityManager.descriptor);
1684 IIntentSender r = IIntentSender.Stub.asInterface(
1685 data.readStrongBinder());
1686 boolean res = isIntentSenderAnActivity(r);
1687 reply.writeNoException();
1688 reply.writeInt(res ? 1 : 0);
1689 return true;
1690 }
1691
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001692 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1693 data.enforceInterface(IActivityManager.descriptor);
1694 Configuration config = Configuration.CREATOR.createFromParcel(data);
1695 updatePersistentConfiguration(config);
1696 reply.writeNoException();
1697 return true;
1698 }
1699
Dianne Hackbornb437e092011-08-05 17:50:29 -07001700 case GET_PROCESS_PSS_TRANSACTION: {
1701 data.enforceInterface(IActivityManager.descriptor);
1702 int[] pids = data.createIntArray();
1703 long[] pss = getProcessPss(pids);
1704 reply.writeNoException();
1705 reply.writeLongArray(pss);
1706 return true;
1707 }
1708
Dianne Hackborn661cd522011-08-22 00:26:20 -07001709 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1710 data.enforceInterface(IActivityManager.descriptor);
1711 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1712 boolean always = data.readInt() != 0;
1713 showBootMessage(msg, always);
1714 reply.writeNoException();
1715 return true;
1716 }
1717
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001718 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1719 data.enforceInterface(IActivityManager.descriptor);
1720 dismissKeyguardOnNextActivity();
1721 reply.writeNoException();
1722 return true;
1723 }
1724
Adam Powelldd8fab22012-03-22 17:47:27 -07001725 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 IBinder token = data.readStrongBinder();
1728 String destAffinity = data.readString();
1729 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1730 reply.writeNoException();
1731 reply.writeInt(res ? 1 : 0);
1732 return true;
1733 }
1734
1735 case NAVIGATE_UP_TO_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 IBinder token = data.readStrongBinder();
1738 Intent target = Intent.CREATOR.createFromParcel(data);
1739 int resultCode = data.readInt();
1740 Intent resultData = null;
1741 if (data.readInt() != 0) {
1742 resultData = Intent.CREATOR.createFromParcel(data);
1743 }
1744 boolean res = navigateUpTo(token, target, resultCode, resultData);
1745 reply.writeNoException();
1746 reply.writeInt(res ? 1 : 0);
1747 return true;
1748 }
1749
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001750 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1751 data.enforceInterface(IActivityManager.descriptor);
1752 IBinder token = data.readStrongBinder();
1753 int res = getLaunchedFromUid(token);
1754 reply.writeNoException();
1755 reply.writeInt(res);
1756 return true;
1757 }
1758
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001759 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1760 data.enforceInterface(IActivityManager.descriptor);
1761 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1762 data.readStrongBinder());
1763 registerUserSwitchObserver(observer);
1764 return true;
1765 }
1766
1767 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1768 data.enforceInterface(IActivityManager.descriptor);
1769 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1770 data.readStrongBinder());
1771 unregisterUserSwitchObserver(observer);
1772 return true;
1773 }
1774
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001775 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001776
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001777 return super.onTransact(code, data, reply, flags);
1778 }
1779
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001780 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001781 return this;
1782 }
1783
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001784 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1785 protected IActivityManager create() {
1786 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001787 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001788 Log.v("ActivityManager", "default service binder = " + b);
1789 }
1790 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001791 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001792 Log.v("ActivityManager", "default service = " + am);
1793 }
1794 return am;
1795 }
1796 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001797}
1798
1799class ActivityManagerProxy implements IActivityManager
1800{
1801 public ActivityManagerProxy(IBinder remote)
1802 {
1803 mRemote = remote;
1804 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001805
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001806 public IBinder asBinder()
1807 {
1808 return mRemote;
1809 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001810
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001811 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001812 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1813 int startFlags, String profileFile,
1814 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001815 Parcel data = Parcel.obtain();
1816 Parcel reply = Parcel.obtain();
1817 data.writeInterfaceToken(IActivityManager.descriptor);
1818 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1819 intent.writeToParcel(data, 0);
1820 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001821 data.writeStrongBinder(resultTo);
1822 data.writeString(resultWho);
1823 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001824 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001825 data.writeString(profileFile);
1826 if (profileFd != null) {
1827 data.writeInt(1);
1828 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1829 } else {
1830 data.writeInt(0);
1831 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001832 if (options != null) {
1833 data.writeInt(1);
1834 options.writeToParcel(data, 0);
1835 } else {
1836 data.writeInt(0);
1837 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001838 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1839 reply.readException();
1840 int result = reply.readInt();
1841 reply.recycle();
1842 data.recycle();
1843 return result;
1844 }
Amith Yamasani82644082012-08-03 13:09:11 -07001845
1846 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1847 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1848 int startFlags, String profileFile,
1849 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1850 Parcel data = Parcel.obtain();
1851 Parcel reply = Parcel.obtain();
1852 data.writeInterfaceToken(IActivityManager.descriptor);
1853 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1854 intent.writeToParcel(data, 0);
1855 data.writeString(resolvedType);
1856 data.writeStrongBinder(resultTo);
1857 data.writeString(resultWho);
1858 data.writeInt(requestCode);
1859 data.writeInt(startFlags);
1860 data.writeString(profileFile);
1861 if (profileFd != null) {
1862 data.writeInt(1);
1863 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1864 } else {
1865 data.writeInt(0);
1866 }
1867 if (options != null) {
1868 data.writeInt(1);
1869 options.writeToParcel(data, 0);
1870 } else {
1871 data.writeInt(0);
1872 }
1873 data.writeInt(userId);
1874 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1875 reply.readException();
1876 int result = reply.readInt();
1877 reply.recycle();
1878 data.recycle();
1879 return result;
1880 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001881 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001882 String resolvedType, IBinder resultTo, String resultWho,
1883 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001884 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001885 Parcel data = Parcel.obtain();
1886 Parcel reply = Parcel.obtain();
1887 data.writeInterfaceToken(IActivityManager.descriptor);
1888 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1889 intent.writeToParcel(data, 0);
1890 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001891 data.writeStrongBinder(resultTo);
1892 data.writeString(resultWho);
1893 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001894 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001895 data.writeString(profileFile);
1896 if (profileFd != null) {
1897 data.writeInt(1);
1898 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1899 } else {
1900 data.writeInt(0);
1901 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001902 if (options != null) {
1903 data.writeInt(1);
1904 options.writeToParcel(data, 0);
1905 } else {
1906 data.writeInt(0);
1907 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001908 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001909 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1910 reply.readException();
1911 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1912 reply.recycle();
1913 data.recycle();
1914 return result;
1915 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001916 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001917 String resolvedType, IBinder resultTo, String resultWho,
1918 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001919 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001920 Parcel data = Parcel.obtain();
1921 Parcel reply = Parcel.obtain();
1922 data.writeInterfaceToken(IActivityManager.descriptor);
1923 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1924 intent.writeToParcel(data, 0);
1925 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001926 data.writeStrongBinder(resultTo);
1927 data.writeString(resultWho);
1928 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001929 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001930 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001931 if (options != null) {
1932 data.writeInt(1);
1933 options.writeToParcel(data, 0);
1934 } else {
1935 data.writeInt(0);
1936 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001937 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001938 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1939 reply.readException();
1940 int result = reply.readInt();
1941 reply.recycle();
1942 data.recycle();
1943 return result;
1944 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001945 public int startActivityIntentSender(IApplicationThread caller,
1946 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001947 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001948 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001949 Parcel data = Parcel.obtain();
1950 Parcel reply = Parcel.obtain();
1951 data.writeInterfaceToken(IActivityManager.descriptor);
1952 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1953 intent.writeToParcel(data, 0);
1954 if (fillInIntent != null) {
1955 data.writeInt(1);
1956 fillInIntent.writeToParcel(data, 0);
1957 } else {
1958 data.writeInt(0);
1959 }
1960 data.writeString(resolvedType);
1961 data.writeStrongBinder(resultTo);
1962 data.writeString(resultWho);
1963 data.writeInt(requestCode);
1964 data.writeInt(flagsMask);
1965 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001966 if (options != null) {
1967 data.writeInt(1);
1968 options.writeToParcel(data, 0);
1969 } else {
1970 data.writeInt(0);
1971 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001972 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001973 reply.readException();
1974 int result = reply.readInt();
1975 reply.recycle();
1976 data.recycle();
1977 return result;
1978 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001979 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001980 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001981 Parcel data = Parcel.obtain();
1982 Parcel reply = Parcel.obtain();
1983 data.writeInterfaceToken(IActivityManager.descriptor);
1984 data.writeStrongBinder(callingActivity);
1985 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001986 if (options != null) {
1987 data.writeInt(1);
1988 options.writeToParcel(data, 0);
1989 } else {
1990 data.writeInt(0);
1991 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001992 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1993 reply.readException();
1994 int result = reply.readInt();
1995 reply.recycle();
1996 data.recycle();
1997 return result != 0;
1998 }
1999 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2000 throws RemoteException {
2001 Parcel data = Parcel.obtain();
2002 Parcel reply = Parcel.obtain();
2003 data.writeInterfaceToken(IActivityManager.descriptor);
2004 data.writeStrongBinder(token);
2005 data.writeInt(resultCode);
2006 if (resultData != null) {
2007 data.writeInt(1);
2008 resultData.writeToParcel(data, 0);
2009 } else {
2010 data.writeInt(0);
2011 }
2012 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2013 reply.readException();
2014 boolean res = reply.readInt() != 0;
2015 data.recycle();
2016 reply.recycle();
2017 return res;
2018 }
2019 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2020 {
2021 Parcel data = Parcel.obtain();
2022 Parcel reply = Parcel.obtain();
2023 data.writeInterfaceToken(IActivityManager.descriptor);
2024 data.writeStrongBinder(token);
2025 data.writeString(resultWho);
2026 data.writeInt(requestCode);
2027 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2028 reply.readException();
2029 data.recycle();
2030 reply.recycle();
2031 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002032 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2033 Parcel data = Parcel.obtain();
2034 Parcel reply = Parcel.obtain();
2035 data.writeInterfaceToken(IActivityManager.descriptor);
2036 data.writeStrongBinder(token);
2037 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2038 reply.readException();
2039 boolean res = reply.readInt() != 0;
2040 data.recycle();
2041 reply.recycle();
2042 return res;
2043 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002044 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2045 Parcel data = Parcel.obtain();
2046 Parcel reply = Parcel.obtain();
2047 data.writeInterfaceToken(IActivityManager.descriptor);
2048 data.writeStrongBinder(token);
2049 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2050 reply.readException();
2051 boolean res = reply.readInt() != 0;
2052 data.recycle();
2053 reply.recycle();
2054 return res;
2055 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002056 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002057 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002058 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002059 {
2060 Parcel data = Parcel.obtain();
2061 Parcel reply = Parcel.obtain();
2062 data.writeInterfaceToken(IActivityManager.descriptor);
2063 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002064 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002065 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2066 filter.writeToParcel(data, 0);
2067 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002068 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002069 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2070 reply.readException();
2071 Intent intent = null;
2072 int haveIntent = reply.readInt();
2073 if (haveIntent != 0) {
2074 intent = Intent.CREATOR.createFromParcel(reply);
2075 }
2076 reply.recycle();
2077 data.recycle();
2078 return intent;
2079 }
2080 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2081 {
2082 Parcel data = Parcel.obtain();
2083 Parcel reply = Parcel.obtain();
2084 data.writeInterfaceToken(IActivityManager.descriptor);
2085 data.writeStrongBinder(receiver.asBinder());
2086 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2087 reply.readException();
2088 data.recycle();
2089 reply.recycle();
2090 }
2091 public int broadcastIntent(IApplicationThread caller,
2092 Intent intent, String resolvedType, IIntentReceiver resultTo,
2093 int resultCode, String resultData, Bundle map,
2094 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002095 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002096 {
2097 Parcel data = Parcel.obtain();
2098 Parcel reply = Parcel.obtain();
2099 data.writeInterfaceToken(IActivityManager.descriptor);
2100 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2101 intent.writeToParcel(data, 0);
2102 data.writeString(resolvedType);
2103 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2104 data.writeInt(resultCode);
2105 data.writeString(resultData);
2106 data.writeBundle(map);
2107 data.writeString(requiredPermission);
2108 data.writeInt(serialized ? 1 : 0);
2109 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002110 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002111 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2112 reply.readException();
2113 int res = reply.readInt();
2114 reply.recycle();
2115 data.recycle();
2116 return res;
2117 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002118 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2119 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002120 {
2121 Parcel data = Parcel.obtain();
2122 Parcel reply = Parcel.obtain();
2123 data.writeInterfaceToken(IActivityManager.descriptor);
2124 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2125 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002126 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002127 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2128 reply.readException();
2129 data.recycle();
2130 reply.recycle();
2131 }
2132 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2133 {
2134 Parcel data = Parcel.obtain();
2135 Parcel reply = Parcel.obtain();
2136 data.writeInterfaceToken(IActivityManager.descriptor);
2137 data.writeStrongBinder(who);
2138 data.writeInt(resultCode);
2139 data.writeString(resultData);
2140 data.writeBundle(map);
2141 data.writeInt(abortBroadcast ? 1 : 0);
2142 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2143 reply.readException();
2144 data.recycle();
2145 reply.recycle();
2146 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002147 public void attachApplication(IApplicationThread app) throws RemoteException
2148 {
2149 Parcel data = Parcel.obtain();
2150 Parcel reply = Parcel.obtain();
2151 data.writeInterfaceToken(IActivityManager.descriptor);
2152 data.writeStrongBinder(app.asBinder());
2153 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2154 reply.readException();
2155 data.recycle();
2156 reply.recycle();
2157 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002158 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2159 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002160 {
2161 Parcel data = Parcel.obtain();
2162 Parcel reply = Parcel.obtain();
2163 data.writeInterfaceToken(IActivityManager.descriptor);
2164 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002165 if (config != null) {
2166 data.writeInt(1);
2167 config.writeToParcel(data, 0);
2168 } else {
2169 data.writeInt(0);
2170 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002171 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002172 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2173 reply.readException();
2174 data.recycle();
2175 reply.recycle();
2176 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002177 public void activityResumed(IBinder token) throws RemoteException
2178 {
2179 Parcel data = Parcel.obtain();
2180 Parcel reply = Parcel.obtain();
2181 data.writeInterfaceToken(IActivityManager.descriptor);
2182 data.writeStrongBinder(token);
2183 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2184 reply.readException();
2185 data.recycle();
2186 reply.recycle();
2187 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002188 public void activityPaused(IBinder token) throws RemoteException
2189 {
2190 Parcel data = Parcel.obtain();
2191 Parcel reply = Parcel.obtain();
2192 data.writeInterfaceToken(IActivityManager.descriptor);
2193 data.writeStrongBinder(token);
2194 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2195 reply.readException();
2196 data.recycle();
2197 reply.recycle();
2198 }
2199 public void activityStopped(IBinder token, Bundle state,
2200 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201 {
2202 Parcel data = Parcel.obtain();
2203 Parcel reply = Parcel.obtain();
2204 data.writeInterfaceToken(IActivityManager.descriptor);
2205 data.writeStrongBinder(token);
2206 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002207 if (thumbnail != null) {
2208 data.writeInt(1);
2209 thumbnail.writeToParcel(data, 0);
2210 } else {
2211 data.writeInt(0);
2212 }
2213 TextUtils.writeToParcel(description, data, 0);
2214 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2215 reply.readException();
2216 data.recycle();
2217 reply.recycle();
2218 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002219 public void activitySlept(IBinder token) throws RemoteException
2220 {
2221 Parcel data = Parcel.obtain();
2222 Parcel reply = Parcel.obtain();
2223 data.writeInterfaceToken(IActivityManager.descriptor);
2224 data.writeStrongBinder(token);
2225 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2226 reply.readException();
2227 data.recycle();
2228 reply.recycle();
2229 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002230 public void activityDestroyed(IBinder token) throws RemoteException
2231 {
2232 Parcel data = Parcel.obtain();
2233 Parcel reply = Parcel.obtain();
2234 data.writeInterfaceToken(IActivityManager.descriptor);
2235 data.writeStrongBinder(token);
2236 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2237 reply.readException();
2238 data.recycle();
2239 reply.recycle();
2240 }
2241 public String getCallingPackage(IBinder token) throws RemoteException
2242 {
2243 Parcel data = Parcel.obtain();
2244 Parcel reply = Parcel.obtain();
2245 data.writeInterfaceToken(IActivityManager.descriptor);
2246 data.writeStrongBinder(token);
2247 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2248 reply.readException();
2249 String res = reply.readString();
2250 data.recycle();
2251 reply.recycle();
2252 return res;
2253 }
2254 public ComponentName getCallingActivity(IBinder token)
2255 throws RemoteException {
2256 Parcel data = Parcel.obtain();
2257 Parcel reply = Parcel.obtain();
2258 data.writeInterfaceToken(IActivityManager.descriptor);
2259 data.writeStrongBinder(token);
2260 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2261 reply.readException();
2262 ComponentName res = ComponentName.readFromParcel(reply);
2263 data.recycle();
2264 reply.recycle();
2265 return res;
2266 }
2267 public List getTasks(int maxNum, int flags,
2268 IThumbnailReceiver receiver) throws RemoteException {
2269 Parcel data = Parcel.obtain();
2270 Parcel reply = Parcel.obtain();
2271 data.writeInterfaceToken(IActivityManager.descriptor);
2272 data.writeInt(maxNum);
2273 data.writeInt(flags);
2274 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2275 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2276 reply.readException();
2277 ArrayList list = null;
2278 int N = reply.readInt();
2279 if (N >= 0) {
2280 list = new ArrayList();
2281 while (N > 0) {
2282 ActivityManager.RunningTaskInfo info =
2283 ActivityManager.RunningTaskInfo.CREATOR
2284 .createFromParcel(reply);
2285 list.add(info);
2286 N--;
2287 }
2288 }
2289 data.recycle();
2290 reply.recycle();
2291 return list;
2292 }
2293 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002294 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002295 Parcel data = Parcel.obtain();
2296 Parcel reply = Parcel.obtain();
2297 data.writeInterfaceToken(IActivityManager.descriptor);
2298 data.writeInt(maxNum);
2299 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002300 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002301 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2302 reply.readException();
2303 ArrayList<ActivityManager.RecentTaskInfo> list
2304 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2305 data.recycle();
2306 reply.recycle();
2307 return list;
2308 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002309 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002314 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002315 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002316 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002317 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002318 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002319 }
2320 data.recycle();
2321 reply.recycle();
2322 return bm;
2323 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002324 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2325 Parcel data = Parcel.obtain();
2326 Parcel reply = Parcel.obtain();
2327 data.writeInterfaceToken(IActivityManager.descriptor);
2328 data.writeInt(id);
2329 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2330 reply.readException();
2331 Bitmap bm = null;
2332 if (reply.readInt() != 0) {
2333 bm = Bitmap.CREATOR.createFromParcel(reply);
2334 }
2335 data.recycle();
2336 reply.recycle();
2337 return bm;
2338 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 public List getServices(int maxNum, int flags) throws RemoteException {
2340 Parcel data = Parcel.obtain();
2341 Parcel reply = Parcel.obtain();
2342 data.writeInterfaceToken(IActivityManager.descriptor);
2343 data.writeInt(maxNum);
2344 data.writeInt(flags);
2345 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2346 reply.readException();
2347 ArrayList list = null;
2348 int N = reply.readInt();
2349 if (N >= 0) {
2350 list = new ArrayList();
2351 while (N > 0) {
2352 ActivityManager.RunningServiceInfo info =
2353 ActivityManager.RunningServiceInfo.CREATOR
2354 .createFromParcel(reply);
2355 list.add(info);
2356 N--;
2357 }
2358 }
2359 data.recycle();
2360 reply.recycle();
2361 return list;
2362 }
2363 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2364 throws RemoteException {
2365 Parcel data = Parcel.obtain();
2366 Parcel reply = Parcel.obtain();
2367 data.writeInterfaceToken(IActivityManager.descriptor);
2368 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2369 reply.readException();
2370 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2371 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2372 data.recycle();
2373 reply.recycle();
2374 return list;
2375 }
2376 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2377 throws RemoteException {
2378 Parcel data = Parcel.obtain();
2379 Parcel reply = Parcel.obtain();
2380 data.writeInterfaceToken(IActivityManager.descriptor);
2381 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2382 reply.readException();
2383 ArrayList<ActivityManager.RunningAppProcessInfo> list
2384 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2385 data.recycle();
2386 reply.recycle();
2387 return list;
2388 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002389 public List<ApplicationInfo> getRunningExternalApplications()
2390 throws RemoteException {
2391 Parcel data = Parcel.obtain();
2392 Parcel reply = Parcel.obtain();
2393 data.writeInterfaceToken(IActivityManager.descriptor);
2394 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2395 reply.readException();
2396 ArrayList<ApplicationInfo> list
2397 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2398 data.recycle();
2399 reply.recycle();
2400 return list;
2401 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002402 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002403 {
2404 Parcel data = Parcel.obtain();
2405 Parcel reply = Parcel.obtain();
2406 data.writeInterfaceToken(IActivityManager.descriptor);
2407 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002408 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002409 if (options != null) {
2410 data.writeInt(1);
2411 options.writeToParcel(data, 0);
2412 } else {
2413 data.writeInt(0);
2414 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002415 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2416 reply.readException();
2417 data.recycle();
2418 reply.recycle();
2419 }
2420 public void moveTaskToBack(int task) throws RemoteException
2421 {
2422 Parcel data = Parcel.obtain();
2423 Parcel reply = Parcel.obtain();
2424 data.writeInterfaceToken(IActivityManager.descriptor);
2425 data.writeInt(task);
2426 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2427 reply.readException();
2428 data.recycle();
2429 reply.recycle();
2430 }
2431 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2432 throws RemoteException {
2433 Parcel data = Parcel.obtain();
2434 Parcel reply = Parcel.obtain();
2435 data.writeInterfaceToken(IActivityManager.descriptor);
2436 data.writeStrongBinder(token);
2437 data.writeInt(nonRoot ? 1 : 0);
2438 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2439 reply.readException();
2440 boolean res = reply.readInt() != 0;
2441 data.recycle();
2442 reply.recycle();
2443 return res;
2444 }
2445 public void moveTaskBackwards(int task) throws RemoteException
2446 {
2447 Parcel data = Parcel.obtain();
2448 Parcel reply = Parcel.obtain();
2449 data.writeInterfaceToken(IActivityManager.descriptor);
2450 data.writeInt(task);
2451 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2452 reply.readException();
2453 data.recycle();
2454 reply.recycle();
2455 }
2456 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2457 {
2458 Parcel data = Parcel.obtain();
2459 Parcel reply = Parcel.obtain();
2460 data.writeInterfaceToken(IActivityManager.descriptor);
2461 data.writeStrongBinder(token);
2462 data.writeInt(onlyRoot ? 1 : 0);
2463 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2464 reply.readException();
2465 int res = reply.readInt();
2466 data.recycle();
2467 reply.recycle();
2468 return res;
2469 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002470 public void reportThumbnail(IBinder token,
2471 Bitmap thumbnail, CharSequence description) throws RemoteException
2472 {
2473 Parcel data = Parcel.obtain();
2474 Parcel reply = Parcel.obtain();
2475 data.writeInterfaceToken(IActivityManager.descriptor);
2476 data.writeStrongBinder(token);
2477 if (thumbnail != null) {
2478 data.writeInt(1);
2479 thumbnail.writeToParcel(data, 0);
2480 } else {
2481 data.writeInt(0);
2482 }
2483 TextUtils.writeToParcel(description, data, 0);
2484 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2485 reply.readException();
2486 data.recycle();
2487 reply.recycle();
2488 }
2489 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002490 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002491 Parcel data = Parcel.obtain();
2492 Parcel reply = Parcel.obtain();
2493 data.writeInterfaceToken(IActivityManager.descriptor);
2494 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2495 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002496 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002497 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2498 reply.readException();
2499 int res = reply.readInt();
2500 ContentProviderHolder cph = null;
2501 if (res != 0) {
2502 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2503 }
2504 data.recycle();
2505 reply.recycle();
2506 return cph;
2507 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002508 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2509 throws RemoteException
2510 {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeString(name);
2515 data.writeStrongBinder(token);
2516 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2517 reply.readException();
2518 int res = reply.readInt();
2519 ContentProviderHolder cph = null;
2520 if (res != 0) {
2521 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2522 }
2523 data.recycle();
2524 reply.recycle();
2525 return cph;
2526 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002527 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002528 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002529 {
2530 Parcel data = Parcel.obtain();
2531 Parcel reply = Parcel.obtain();
2532 data.writeInterfaceToken(IActivityManager.descriptor);
2533 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2534 data.writeTypedList(providers);
2535 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2536 reply.readException();
2537 data.recycle();
2538 reply.recycle();
2539 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002540 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2541 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002545 data.writeStrongBinder(connection);
2546 data.writeInt(stable);
2547 data.writeInt(unstable);
2548 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2549 reply.readException();
2550 boolean res = reply.readInt() != 0;
2551 data.recycle();
2552 reply.recycle();
2553 return res;
2554 }
2555 public void unstableProviderDied(IBinder connection) throws RemoteException {
2556 Parcel data = Parcel.obtain();
2557 Parcel reply = Parcel.obtain();
2558 data.writeInterfaceToken(IActivityManager.descriptor);
2559 data.writeStrongBinder(connection);
2560 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2561 reply.readException();
2562 data.recycle();
2563 reply.recycle();
2564 }
2565
2566 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2567 Parcel data = Parcel.obtain();
2568 Parcel reply = Parcel.obtain();
2569 data.writeInterfaceToken(IActivityManager.descriptor);
2570 data.writeStrongBinder(connection);
2571 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002572 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2573 reply.readException();
2574 data.recycle();
2575 reply.recycle();
2576 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002577
2578 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2579 Parcel data = Parcel.obtain();
2580 Parcel reply = Parcel.obtain();
2581 data.writeInterfaceToken(IActivityManager.descriptor);
2582 data.writeString(name);
2583 data.writeStrongBinder(token);
2584 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2585 reply.readException();
2586 data.recycle();
2587 reply.recycle();
2588 }
2589
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002590 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2591 throws RemoteException
2592 {
2593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 service.writeToParcel(data, 0);
2597 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2598 reply.readException();
2599 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2600 data.recycle();
2601 reply.recycle();
2602 return res;
2603 }
2604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002606 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002607 {
2608 Parcel data = Parcel.obtain();
2609 Parcel reply = Parcel.obtain();
2610 data.writeInterfaceToken(IActivityManager.descriptor);
2611 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2612 service.writeToParcel(data, 0);
2613 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002614 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002615 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2616 reply.readException();
2617 ComponentName res = ComponentName.readFromParcel(reply);
2618 data.recycle();
2619 reply.recycle();
2620 return res;
2621 }
2622 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002623 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002624 {
2625 Parcel data = Parcel.obtain();
2626 Parcel reply = Parcel.obtain();
2627 data.writeInterfaceToken(IActivityManager.descriptor);
2628 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2629 service.writeToParcel(data, 0);
2630 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002631 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002632 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2633 reply.readException();
2634 int res = reply.readInt();
2635 reply.recycle();
2636 data.recycle();
2637 return res;
2638 }
2639 public boolean stopServiceToken(ComponentName className, IBinder token,
2640 int startId) throws RemoteException {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 ComponentName.writeToParcel(className, data);
2645 data.writeStrongBinder(token);
2646 data.writeInt(startId);
2647 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2648 reply.readException();
2649 boolean res = reply.readInt() != 0;
2650 data.recycle();
2651 reply.recycle();
2652 return res;
2653 }
2654 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002655 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 ComponentName.writeToParcel(className, data);
2660 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002661 data.writeInt(id);
2662 if (notification != null) {
2663 data.writeInt(1);
2664 notification.writeToParcel(data, 0);
2665 } else {
2666 data.writeInt(0);
2667 }
2668 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002669 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2670 reply.readException();
2671 data.recycle();
2672 reply.recycle();
2673 }
2674 public int bindService(IApplicationThread caller, IBinder token,
2675 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002676 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002677 Parcel data = Parcel.obtain();
2678 Parcel reply = Parcel.obtain();
2679 data.writeInterfaceToken(IActivityManager.descriptor);
2680 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2681 data.writeStrongBinder(token);
2682 service.writeToParcel(data, 0);
2683 data.writeString(resolvedType);
2684 data.writeStrongBinder(connection.asBinder());
2685 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002686 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002687 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2688 reply.readException();
2689 int res = reply.readInt();
2690 data.recycle();
2691 reply.recycle();
2692 return res;
2693 }
2694 public boolean unbindService(IServiceConnection connection) throws RemoteException
2695 {
2696 Parcel data = Parcel.obtain();
2697 Parcel reply = Parcel.obtain();
2698 data.writeInterfaceToken(IActivityManager.descriptor);
2699 data.writeStrongBinder(connection.asBinder());
2700 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2701 reply.readException();
2702 boolean res = reply.readInt() != 0;
2703 data.recycle();
2704 reply.recycle();
2705 return res;
2706 }
2707
2708 public void publishService(IBinder token,
2709 Intent intent, IBinder service) throws RemoteException {
2710 Parcel data = Parcel.obtain();
2711 Parcel reply = Parcel.obtain();
2712 data.writeInterfaceToken(IActivityManager.descriptor);
2713 data.writeStrongBinder(token);
2714 intent.writeToParcel(data, 0);
2715 data.writeStrongBinder(service);
2716 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2717 reply.readException();
2718 data.recycle();
2719 reply.recycle();
2720 }
2721
2722 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2723 throws RemoteException {
2724 Parcel data = Parcel.obtain();
2725 Parcel reply = Parcel.obtain();
2726 data.writeInterfaceToken(IActivityManager.descriptor);
2727 data.writeStrongBinder(token);
2728 intent.writeToParcel(data, 0);
2729 data.writeInt(doRebind ? 1 : 0);
2730 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2731 reply.readException();
2732 data.recycle();
2733 reply.recycle();
2734 }
2735
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002736 public void serviceDoneExecuting(IBinder token, int type, int startId,
2737 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 Parcel data = Parcel.obtain();
2739 Parcel reply = Parcel.obtain();
2740 data.writeInterfaceToken(IActivityManager.descriptor);
2741 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002742 data.writeInt(type);
2743 data.writeInt(startId);
2744 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002745 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2746 reply.readException();
2747 data.recycle();
2748 reply.recycle();
2749 }
2750
2751 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 service.writeToParcel(data, 0);
2756 data.writeString(resolvedType);
2757 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2758 reply.readException();
2759 IBinder binder = reply.readStrongBinder();
2760 reply.recycle();
2761 data.recycle();
2762 return binder;
2763 }
2764
Christopher Tate181fafa2009-05-14 11:12:14 -07002765 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2766 throws RemoteException {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 app.writeToParcel(data, 0);
2771 data.writeInt(backupRestoreMode);
2772 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 boolean success = reply.readInt() != 0;
2775 reply.recycle();
2776 data.recycle();
2777 return success;
2778 }
2779
2780 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2781 Parcel data = Parcel.obtain();
2782 Parcel reply = Parcel.obtain();
2783 data.writeInterfaceToken(IActivityManager.descriptor);
2784 data.writeString(packageName);
2785 data.writeStrongBinder(agent);
2786 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2787 reply.recycle();
2788 data.recycle();
2789 }
2790
2791 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 app.writeToParcel(data, 0);
2796 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2797 reply.readException();
2798 reply.recycle();
2799 data.recycle();
2800 }
2801
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002802 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002803 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002804 throws RemoteException {
2805 Parcel data = Parcel.obtain();
2806 Parcel reply = Parcel.obtain();
2807 data.writeInterfaceToken(IActivityManager.descriptor);
2808 ComponentName.writeToParcel(className, data);
2809 data.writeString(profileFile);
2810 data.writeInt(flags);
2811 data.writeBundle(arguments);
2812 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002813 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002814 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 boolean res = reply.readInt() != 0;
2817 reply.recycle();
2818 data.recycle();
2819 return res;
2820 }
2821
2822 public void finishInstrumentation(IApplicationThread target,
2823 int resultCode, Bundle results) throws RemoteException {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 data.writeStrongBinder(target != null ? target.asBinder() : null);
2828 data.writeInt(resultCode);
2829 data.writeBundle(results);
2830 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2831 reply.readException();
2832 data.recycle();
2833 reply.recycle();
2834 }
2835 public Configuration getConfiguration() throws RemoteException
2836 {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2841 reply.readException();
2842 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2843 reply.recycle();
2844 data.recycle();
2845 return res;
2846 }
2847 public void updateConfiguration(Configuration values) throws RemoteException
2848 {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 values.writeToParcel(data, 0);
2853 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
2858 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2859 throws RemoteException {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(token);
2864 data.writeInt(requestedOrientation);
2865 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2866 reply.readException();
2867 data.recycle();
2868 reply.recycle();
2869 }
2870 public int getRequestedOrientation(IBinder token) throws RemoteException {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(token);
2875 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2876 reply.readException();
2877 int res = reply.readInt();
2878 data.recycle();
2879 reply.recycle();
2880 return res;
2881 }
2882 public ComponentName getActivityClassForToken(IBinder token)
2883 throws RemoteException {
2884 Parcel data = Parcel.obtain();
2885 Parcel reply = Parcel.obtain();
2886 data.writeInterfaceToken(IActivityManager.descriptor);
2887 data.writeStrongBinder(token);
2888 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2889 reply.readException();
2890 ComponentName res = ComponentName.readFromParcel(reply);
2891 data.recycle();
2892 reply.recycle();
2893 return res;
2894 }
2895 public String getPackageForToken(IBinder token) throws RemoteException
2896 {
2897 Parcel data = Parcel.obtain();
2898 Parcel reply = Parcel.obtain();
2899 data.writeInterfaceToken(IActivityManager.descriptor);
2900 data.writeStrongBinder(token);
2901 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2902 reply.readException();
2903 String res = reply.readString();
2904 data.recycle();
2905 reply.recycle();
2906 return res;
2907 }
2908 public IIntentSender getIntentSender(int type,
2909 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002910 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002911 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 Parcel data = Parcel.obtain();
2913 Parcel reply = Parcel.obtain();
2914 data.writeInterfaceToken(IActivityManager.descriptor);
2915 data.writeInt(type);
2916 data.writeString(packageName);
2917 data.writeStrongBinder(token);
2918 data.writeString(resultWho);
2919 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002920 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002922 data.writeTypedArray(intents, 0);
2923 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002924 } else {
2925 data.writeInt(0);
2926 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002927 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002928 if (options != null) {
2929 data.writeInt(1);
2930 options.writeToParcel(data, 0);
2931 } else {
2932 data.writeInt(0);
2933 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002934 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2936 reply.readException();
2937 IIntentSender res = IIntentSender.Stub.asInterface(
2938 reply.readStrongBinder());
2939 data.recycle();
2940 reply.recycle();
2941 return res;
2942 }
2943 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 data.writeStrongBinder(sender.asBinder());
2948 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2949 reply.readException();
2950 data.recycle();
2951 reply.recycle();
2952 }
2953 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeStrongBinder(sender.asBinder());
2958 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 String res = reply.readString();
2961 data.recycle();
2962 reply.recycle();
2963 return res;
2964 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002965 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2966 Parcel data = Parcel.obtain();
2967 Parcel reply = Parcel.obtain();
2968 data.writeInterfaceToken(IActivityManager.descriptor);
2969 data.writeStrongBinder(sender.asBinder());
2970 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2971 reply.readException();
2972 int res = reply.readInt();
2973 data.recycle();
2974 reply.recycle();
2975 return res;
2976 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002977 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2978 boolean requireFull, String name, String callerPackage) throws RemoteException {
2979 Parcel data = Parcel.obtain();
2980 Parcel reply = Parcel.obtain();
2981 data.writeInterfaceToken(IActivityManager.descriptor);
2982 data.writeInt(callingPid);
2983 data.writeInt(callingUid);
2984 data.writeInt(userId);
2985 data.writeInt(allowAll ? 1 : 0);
2986 data.writeInt(requireFull ? 1 : 0);
2987 data.writeString(name);
2988 data.writeString(callerPackage);
2989 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 int res = reply.readInt();
2992 data.recycle();
2993 reply.recycle();
2994 return res;
2995 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002996 public void setProcessLimit(int max) throws RemoteException
2997 {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeInt(max);
3002 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 data.recycle();
3005 reply.recycle();
3006 }
3007 public int getProcessLimit() throws RemoteException
3008 {
3009 Parcel data = Parcel.obtain();
3010 Parcel reply = Parcel.obtain();
3011 data.writeInterfaceToken(IActivityManager.descriptor);
3012 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3013 reply.readException();
3014 int res = reply.readInt();
3015 data.recycle();
3016 reply.recycle();
3017 return res;
3018 }
3019 public void setProcessForeground(IBinder token, int pid,
3020 boolean isForeground) throws RemoteException {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeStrongBinder(token);
3025 data.writeInt(pid);
3026 data.writeInt(isForeground ? 1 : 0);
3027 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 data.recycle();
3030 reply.recycle();
3031 }
3032 public int checkPermission(String permission, int pid, int uid)
3033 throws RemoteException {
3034 Parcel data = Parcel.obtain();
3035 Parcel reply = Parcel.obtain();
3036 data.writeInterfaceToken(IActivityManager.descriptor);
3037 data.writeString(permission);
3038 data.writeInt(pid);
3039 data.writeInt(uid);
3040 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3041 reply.readException();
3042 int res = reply.readInt();
3043 data.recycle();
3044 reply.recycle();
3045 return res;
3046 }
3047 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003048 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 data.writeString(packageName);
3053 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003054 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003055 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 boolean res = reply.readInt() != 0;
3058 data.recycle();
3059 reply.recycle();
3060 return res;
3061 }
3062 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3063 throws RemoteException {
3064 Parcel data = Parcel.obtain();
3065 Parcel reply = Parcel.obtain();
3066 data.writeInterfaceToken(IActivityManager.descriptor);
3067 uri.writeToParcel(data, 0);
3068 data.writeInt(pid);
3069 data.writeInt(uid);
3070 data.writeInt(mode);
3071 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3072 reply.readException();
3073 int res = reply.readInt();
3074 data.recycle();
3075 reply.recycle();
3076 return res;
3077 }
3078 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3079 Uri uri, int mode) throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeStrongBinder(caller.asBinder());
3084 data.writeString(targetPkg);
3085 uri.writeToParcel(data, 0);
3086 data.writeInt(mode);
3087 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3088 reply.readException();
3089 data.recycle();
3090 reply.recycle();
3091 }
3092 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3093 int mode) throws RemoteException {
3094 Parcel data = Parcel.obtain();
3095 Parcel reply = Parcel.obtain();
3096 data.writeInterfaceToken(IActivityManager.descriptor);
3097 data.writeStrongBinder(caller.asBinder());
3098 uri.writeToParcel(data, 0);
3099 data.writeInt(mode);
3100 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3101 reply.readException();
3102 data.recycle();
3103 reply.recycle();
3104 }
3105 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3106 throws RemoteException {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeStrongBinder(who.asBinder());
3111 data.writeInt(waiting ? 1 : 0);
3112 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3113 reply.readException();
3114 data.recycle();
3115 reply.recycle();
3116 }
3117 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3122 reply.readException();
3123 outInfo.readFromParcel(reply);
3124 data.recycle();
3125 reply.recycle();
3126 }
3127 public void unhandledBack() throws RemoteException
3128 {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3133 reply.readException();
3134 data.recycle();
3135 reply.recycle();
3136 }
3137 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3138 {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 ParcelFileDescriptor pfd = null;
3145 if (reply.readInt() != 0) {
3146 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3147 }
3148 data.recycle();
3149 reply.recycle();
3150 return pfd;
3151 }
3152 public void goingToSleep() throws RemoteException
3153 {
3154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 data.recycle();
3160 reply.recycle();
3161 }
3162 public void wakingUp() throws RemoteException
3163 {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3168 reply.readException();
3169 data.recycle();
3170 reply.recycle();
3171 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003172 public void setLockScreenShown(boolean shown) throws RemoteException
3173 {
3174 Parcel data = Parcel.obtain();
3175 Parcel reply = Parcel.obtain();
3176 data.writeInterfaceToken(IActivityManager.descriptor);
3177 data.writeInt(shown ? 1 : 0);
3178 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3179 reply.readException();
3180 data.recycle();
3181 reply.recycle();
3182 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003183 public void setDebugApp(
3184 String packageName, boolean waitForDebugger, boolean persistent)
3185 throws RemoteException
3186 {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeString(packageName);
3191 data.writeInt(waitForDebugger ? 1 : 0);
3192 data.writeInt(persistent ? 1 : 0);
3193 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3194 reply.readException();
3195 data.recycle();
3196 reply.recycle();
3197 }
3198 public void setAlwaysFinish(boolean enabled) throws RemoteException
3199 {
3200 Parcel data = Parcel.obtain();
3201 Parcel reply = Parcel.obtain();
3202 data.writeInterfaceToken(IActivityManager.descriptor);
3203 data.writeInt(enabled ? 1 : 0);
3204 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3205 reply.readException();
3206 data.recycle();
3207 reply.recycle();
3208 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003209 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 {
3211 Parcel data = Parcel.obtain();
3212 Parcel reply = Parcel.obtain();
3213 data.writeInterfaceToken(IActivityManager.descriptor);
3214 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003215 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 reply.readException();
3217 data.recycle();
3218 reply.recycle();
3219 }
3220 public void enterSafeMode() throws RemoteException {
3221 Parcel data = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3224 data.recycle();
3225 }
3226 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3227 Parcel data = Parcel.obtain();
3228 data.writeStrongBinder(sender.asBinder());
3229 data.writeInterfaceToken(IActivityManager.descriptor);
3230 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3231 data.recycle();
3232 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003233 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003234 Parcel data = Parcel.obtain();
3235 Parcel reply = Parcel.obtain();
3236 data.writeInterfaceToken(IActivityManager.descriptor);
3237 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003238 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003239 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003240 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 boolean res = reply.readInt() != 0;
3242 data.recycle();
3243 reply.recycle();
3244 return res;
3245 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003246 @Override
3247 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeString(reason);
3252 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3253 boolean res = reply.readInt() != 0;
3254 data.recycle();
3255 reply.recycle();
3256 return res;
3257 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 public void startRunning(String pkg, String cls, String action,
3259 String indata) throws RemoteException {
3260 Parcel data = Parcel.obtain();
3261 Parcel reply = Parcel.obtain();
3262 data.writeInterfaceToken(IActivityManager.descriptor);
3263 data.writeString(pkg);
3264 data.writeString(cls);
3265 data.writeString(action);
3266 data.writeString(indata);
3267 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3268 reply.readException();
3269 data.recycle();
3270 reply.recycle();
3271 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 public boolean testIsSystemReady()
3273 {
3274 /* this base class version is never called */
3275 return true;
3276 }
Dan Egnor60d87622009-12-16 16:32:58 -08003277 public void handleApplicationCrash(IBinder app,
3278 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3279 {
3280 Parcel data = Parcel.obtain();
3281 Parcel reply = Parcel.obtain();
3282 data.writeInterfaceToken(IActivityManager.descriptor);
3283 data.writeStrongBinder(app);
3284 crashInfo.writeToParcel(data, 0);
3285 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 reply.recycle();
3288 data.recycle();
3289 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003290
Dan Egnor60d87622009-12-16 16:32:58 -08003291 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003292 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003293 {
3294 Parcel data = Parcel.obtain();
3295 Parcel reply = Parcel.obtain();
3296 data.writeInterfaceToken(IActivityManager.descriptor);
3297 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003298 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003299 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003300 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003302 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003303 reply.recycle();
3304 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003305 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003306 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003307
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003308 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003309 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003310 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003311 {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003316 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003317 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003318 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3319 reply.readException();
3320 reply.recycle();
3321 data.recycle();
3322 }
3323
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003324 public void signalPersistentProcesses(int sig) throws RemoteException {
3325 Parcel data = Parcel.obtain();
3326 Parcel reply = Parcel.obtain();
3327 data.writeInterfaceToken(IActivityManager.descriptor);
3328 data.writeInt(sig);
3329 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 data.recycle();
3332 reply.recycle();
3333 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003334
Dianne Hackborn1676c852012-09-10 14:52:30 -07003335 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003340 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003341 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 data.recycle();
3344 reply.recycle();
3345 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003346
3347 public void killAllBackgroundProcesses() throws RemoteException {
3348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3352 reply.readException();
3353 data.recycle();
3354 reply.recycle();
3355 }
3356
Dianne Hackborn1676c852012-09-10 14:52:30 -07003357 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003362 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003363 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003364 reply.readException();
3365 data.recycle();
3366 reply.recycle();
3367 }
3368
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003369 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3370 throws RemoteException
3371 {
3372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3376 reply.readException();
3377 outInfo.readFromParcel(reply);
3378 reply.recycle();
3379 data.recycle();
3380 }
3381
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003382 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3383 {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3388 reply.readException();
3389 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3390 reply.recycle();
3391 data.recycle();
3392 return res;
3393 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003394
Dianne Hackborn1676c852012-09-10 14:52:30 -07003395 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003396 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003397 {
3398 Parcel data = Parcel.obtain();
3399 Parcel reply = Parcel.obtain();
3400 data.writeInterfaceToken(IActivityManager.descriptor);
3401 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003402 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003403 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003404 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003405 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003406 if (fd != null) {
3407 data.writeInt(1);
3408 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3409 } else {
3410 data.writeInt(0);
3411 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003412 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 boolean res = reply.readInt() != 0;
3415 reply.recycle();
3416 data.recycle();
3417 return res;
3418 }
3419
Dianne Hackborn55280a92009-05-07 15:53:46 -07003420 public boolean shutdown(int timeout) throws RemoteException
3421 {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 data.writeInt(timeout);
3426 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 boolean res = reply.readInt() != 0;
3429 reply.recycle();
3430 data.recycle();
3431 return res;
3432 }
3433
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003434 public void stopAppSwitches() throws RemoteException {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3439 reply.readException();
3440 reply.recycle();
3441 data.recycle();
3442 }
3443
3444 public void resumeAppSwitches() throws RemoteException {
3445 Parcel data = Parcel.obtain();
3446 Parcel reply = Parcel.obtain();
3447 data.writeInterfaceToken(IActivityManager.descriptor);
3448 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 reply.recycle();
3451 data.recycle();
3452 }
3453
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003454 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003459 data.writeInt(appid);
3460 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003461 reply.readException();
3462 data.recycle();
3463 reply.recycle();
3464 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003465
3466 public void closeSystemDialogs(String reason) throws RemoteException {
3467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 data.writeString(reason);
3471 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3472 reply.readException();
3473 data.recycle();
3474 reply.recycle();
3475 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003476
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003477 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003478 throws RemoteException {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003482 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003483 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3484 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003485 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003486 data.recycle();
3487 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003488 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003489 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003490
3491 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 data.writeString(processName);
3496 data.writeInt(uid);
3497 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 data.recycle();
3500 reply.recycle();
3501 }
3502
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003503 public void overridePendingTransition(IBinder token, String packageName,
3504 int enterAnim, int exitAnim) throws RemoteException {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 data.writeStrongBinder(token);
3509 data.writeString(packageName);
3510 data.writeInt(enterAnim);
3511 data.writeInt(exitAnim);
3512 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3513 reply.readException();
3514 data.recycle();
3515 reply.recycle();
3516 }
3517
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003518 public boolean isUserAMonkey() throws RemoteException {
3519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
3522 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3523 reply.readException();
3524 boolean res = reply.readInt() != 0;
3525 data.recycle();
3526 reply.recycle();
3527 return res;
3528 }
3529
Dianne Hackborn860755f2010-06-03 18:47:52 -07003530 public void finishHeavyWeightApp() throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 data.recycle();
3537 reply.recycle();
3538 }
3539
Daniel Sandler69a48172010-06-23 16:29:36 -04003540 public void setImmersive(IBinder token, boolean immersive)
3541 throws RemoteException {
3542 Parcel data = Parcel.obtain();
3543 Parcel reply = Parcel.obtain();
3544 data.writeInterfaceToken(IActivityManager.descriptor);
3545 data.writeStrongBinder(token);
3546 data.writeInt(immersive ? 1 : 0);
3547 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 data.recycle();
3550 reply.recycle();
3551 }
3552
3553 public boolean isImmersive(IBinder token)
3554 throws RemoteException {
3555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
3558 data.writeStrongBinder(token);
3559 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003560 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003561 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003562 data.recycle();
3563 reply.recycle();
3564 return res;
3565 }
3566
3567 public boolean isTopActivityImmersive()
3568 throws RemoteException {
3569 Parcel data = Parcel.obtain();
3570 Parcel reply = Parcel.obtain();
3571 data.writeInterfaceToken(IActivityManager.descriptor);
3572 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003573 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003574 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003575 data.recycle();
3576 reply.recycle();
3577 return res;
3578 }
3579
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003580 public void crashApplication(int uid, int initialPid, String packageName,
3581 String message) throws RemoteException {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 data.writeInt(uid);
3586 data.writeInt(initialPid);
3587 data.writeString(packageName);
3588 data.writeString(message);
3589 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3590 reply.readException();
3591 data.recycle();
3592 reply.recycle();
3593 }
Andy McFadden824c5102010-07-09 16:26:57 -07003594
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003595 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003600 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003601 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3602 reply.readException();
3603 String res = reply.readString();
3604 data.recycle();
3605 reply.recycle();
3606 return res;
3607 }
3608
Dianne Hackborn7e269642010-08-25 19:50:20 -07003609 public IBinder newUriPermissionOwner(String name)
3610 throws RemoteException {
3611 Parcel data = Parcel.obtain();
3612 Parcel reply = Parcel.obtain();
3613 data.writeInterfaceToken(IActivityManager.descriptor);
3614 data.writeString(name);
3615 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3616 reply.readException();
3617 IBinder res = reply.readStrongBinder();
3618 data.recycle();
3619 reply.recycle();
3620 return res;
3621 }
3622
3623 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3624 Uri uri, int mode) throws RemoteException {
3625 Parcel data = Parcel.obtain();
3626 Parcel reply = Parcel.obtain();
3627 data.writeInterfaceToken(IActivityManager.descriptor);
3628 data.writeStrongBinder(owner);
3629 data.writeInt(fromUid);
3630 data.writeString(targetPkg);
3631 uri.writeToParcel(data, 0);
3632 data.writeInt(mode);
3633 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3634 reply.readException();
3635 data.recycle();
3636 reply.recycle();
3637 }
3638
3639 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3640 int mode) throws RemoteException {
3641 Parcel data = Parcel.obtain();
3642 Parcel reply = Parcel.obtain();
3643 data.writeInterfaceToken(IActivityManager.descriptor);
3644 data.writeStrongBinder(owner);
3645 if (uri != null) {
3646 data.writeInt(1);
3647 uri.writeToParcel(data, 0);
3648 } else {
3649 data.writeInt(0);
3650 }
3651 data.writeInt(mode);
3652 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3653 reply.readException();
3654 data.recycle();
3655 reply.recycle();
3656 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003657
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003658 public int checkGrantUriPermission(int callingUid, String targetPkg,
3659 Uri uri, int modeFlags) throws RemoteException {
3660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
3663 data.writeInt(callingUid);
3664 data.writeString(targetPkg);
3665 uri.writeToParcel(data, 0);
3666 data.writeInt(modeFlags);
3667 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3668 reply.readException();
3669 int res = reply.readInt();
3670 data.recycle();
3671 reply.recycle();
3672 return res;
3673 }
3674
Dianne Hackborn1676c852012-09-10 14:52:30 -07003675 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003676 String path, ParcelFileDescriptor fd) throws RemoteException {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003681 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003682 data.writeInt(managed ? 1 : 0);
3683 data.writeString(path);
3684 if (fd != null) {
3685 data.writeInt(1);
3686 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3687 } else {
3688 data.writeInt(0);
3689 }
3690 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 boolean res = reply.readInt() != 0;
3693 reply.recycle();
3694 data.recycle();
3695 return res;
3696 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003697
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003698 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003699 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3700 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003701 Parcel data = Parcel.obtain();
3702 Parcel reply = Parcel.obtain();
3703 data.writeInterfaceToken(IActivityManager.descriptor);
3704 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3705 data.writeTypedArray(intents, 0);
3706 data.writeStringArray(resolvedTypes);
3707 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003708 if (options != null) {
3709 data.writeInt(1);
3710 options.writeToParcel(data, 0);
3711 } else {
3712 data.writeInt(0);
3713 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003714 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3715 reply.readException();
3716 int result = reply.readInt();
3717 reply.recycle();
3718 data.recycle();
3719 return result;
3720 }
3721
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003722 public int getFrontActivityScreenCompatMode() throws RemoteException {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3727 reply.readException();
3728 int mode = reply.readInt();
3729 reply.recycle();
3730 data.recycle();
3731 return mode;
3732 }
3733
3734 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 data.writeInt(mode);
3739 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3740 reply.readException();
3741 reply.recycle();
3742 data.recycle();
3743 }
3744
3745 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3746 Parcel data = Parcel.obtain();
3747 Parcel reply = Parcel.obtain();
3748 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003749 data.writeString(packageName);
3750 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003751 reply.readException();
3752 int mode = reply.readInt();
3753 reply.recycle();
3754 data.recycle();
3755 return mode;
3756 }
3757
3758 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003759 throws RemoteException {
3760 Parcel data = Parcel.obtain();
3761 Parcel reply = Parcel.obtain();
3762 data.writeInterfaceToken(IActivityManager.descriptor);
3763 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003764 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003765 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3766 reply.readException();
3767 reply.recycle();
3768 data.recycle();
3769 }
3770
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003771 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3772 Parcel data = Parcel.obtain();
3773 Parcel reply = Parcel.obtain();
3774 data.writeInterfaceToken(IActivityManager.descriptor);
3775 data.writeString(packageName);
3776 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3777 reply.readException();
3778 boolean ask = reply.readInt() != 0;
3779 reply.recycle();
3780 data.recycle();
3781 return ask;
3782 }
3783
3784 public void setPackageAskScreenCompat(String packageName, boolean ask)
3785 throws RemoteException {
3786 Parcel data = Parcel.obtain();
3787 Parcel reply = Parcel.obtain();
3788 data.writeInterfaceToken(IActivityManager.descriptor);
3789 data.writeString(packageName);
3790 data.writeInt(ask ? 1 : 0);
3791 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3792 reply.readException();
3793 reply.recycle();
3794 data.recycle();
3795 }
3796
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003797 public boolean switchUser(int userid) throws RemoteException {
3798 Parcel data = Parcel.obtain();
3799 Parcel reply = Parcel.obtain();
3800 data.writeInterfaceToken(IActivityManager.descriptor);
3801 data.writeInt(userid);
3802 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3803 reply.readException();
3804 boolean result = reply.readInt() != 0;
3805 reply.recycle();
3806 data.recycle();
3807 return result;
3808 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003809
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003810 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3811 Parcel data = Parcel.obtain();
3812 Parcel reply = Parcel.obtain();
3813 data.writeInterfaceToken(IActivityManager.descriptor);
3814 data.writeInt(userid);
3815 data.writeStrongInterface(callback);
3816 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3817 reply.readException();
3818 int result = reply.readInt();
3819 reply.recycle();
3820 data.recycle();
3821 return result;
3822 }
3823
Amith Yamasani52f1d752012-03-28 18:19:29 -07003824 public UserInfo getCurrentUser() throws RemoteException {
3825 Parcel data = Parcel.obtain();
3826 Parcel reply = Parcel.obtain();
3827 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003828 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003829 reply.readException();
3830 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3831 reply.recycle();
3832 data.recycle();
3833 return userInfo;
3834 }
3835
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003836 public boolean isUserRunning(int userid) throws RemoteException {
3837 Parcel data = Parcel.obtain();
3838 Parcel reply = Parcel.obtain();
3839 data.writeInterfaceToken(IActivityManager.descriptor);
3840 data.writeInt(userid);
3841 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 boolean result = reply.readInt() != 0;
3844 reply.recycle();
3845 data.recycle();
3846 return result;
3847 }
3848
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003849 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 data.writeInt(taskId);
3854 data.writeInt(subTaskIndex);
3855 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3856 reply.readException();
3857 boolean result = reply.readInt() != 0;
3858 reply.recycle();
3859 data.recycle();
3860 return result;
3861 }
3862
3863 public boolean removeTask(int taskId, int flags) throws RemoteException {
3864 Parcel data = Parcel.obtain();
3865 Parcel reply = Parcel.obtain();
3866 data.writeInterfaceToken(IActivityManager.descriptor);
3867 data.writeInt(taskId);
3868 data.writeInt(flags);
3869 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3870 reply.readException();
3871 boolean result = reply.readInt() != 0;
3872 reply.recycle();
3873 data.recycle();
3874 return result;
3875 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003876
Jeff Sharkeya4620792011-05-20 15:29:23 -07003877 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3878 Parcel data = Parcel.obtain();
3879 Parcel reply = Parcel.obtain();
3880 data.writeInterfaceToken(IActivityManager.descriptor);
3881 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3882 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3883 reply.readException();
3884 data.recycle();
3885 reply.recycle();
3886 }
3887
3888 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3889 Parcel data = Parcel.obtain();
3890 Parcel reply = Parcel.obtain();
3891 data.writeInterfaceToken(IActivityManager.descriptor);
3892 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3893 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3894 reply.readException();
3895 data.recycle();
3896 reply.recycle();
3897 }
3898
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003899 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3900 Parcel data = Parcel.obtain();
3901 Parcel reply = Parcel.obtain();
3902 data.writeInterfaceToken(IActivityManager.descriptor);
3903 data.writeStrongBinder(sender.asBinder());
3904 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3905 reply.readException();
3906 boolean res = reply.readInt() != 0;
3907 data.recycle();
3908 reply.recycle();
3909 return res;
3910 }
3911
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003912 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3913 Parcel data = Parcel.obtain();
3914 Parcel reply = Parcel.obtain();
3915 data.writeInterfaceToken(IActivityManager.descriptor);
3916 data.writeStrongBinder(sender.asBinder());
3917 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3918 reply.readException();
3919 boolean res = reply.readInt() != 0;
3920 data.recycle();
3921 reply.recycle();
3922 return res;
3923 }
3924
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003925 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3926 {
3927 Parcel data = Parcel.obtain();
3928 Parcel reply = Parcel.obtain();
3929 data.writeInterfaceToken(IActivityManager.descriptor);
3930 values.writeToParcel(data, 0);
3931 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3932 reply.readException();
3933 data.recycle();
3934 reply.recycle();
3935 }
3936
Dianne Hackbornb437e092011-08-05 17:50:29 -07003937 public long[] getProcessPss(int[] pids) throws RemoteException {
3938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 data.writeIntArray(pids);
3942 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3943 reply.readException();
3944 long[] res = reply.createLongArray();
3945 data.recycle();
3946 reply.recycle();
3947 return res;
3948 }
3949
Dianne Hackborn661cd522011-08-22 00:26:20 -07003950 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 TextUtils.writeToParcel(msg, data, 0);
3955 data.writeInt(always ? 1 : 0);
3956 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3957 reply.readException();
3958 data.recycle();
3959 reply.recycle();
3960 }
3961
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003962 public void dismissKeyguardOnNextActivity() throws RemoteException {
3963 Parcel data = Parcel.obtain();
3964 Parcel reply = Parcel.obtain();
3965 data.writeInterfaceToken(IActivityManager.descriptor);
3966 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 data.recycle();
3969 reply.recycle();
3970 }
3971
Adam Powelldd8fab22012-03-22 17:47:27 -07003972 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3973 throws RemoteException {
3974 Parcel data = Parcel.obtain();
3975 Parcel reply = Parcel.obtain();
3976 data.writeInterfaceToken(IActivityManager.descriptor);
3977 data.writeStrongBinder(token);
3978 data.writeString(destAffinity);
3979 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3980 reply.readException();
3981 boolean result = reply.readInt() != 0;
3982 data.recycle();
3983 reply.recycle();
3984 return result;
3985 }
3986
3987 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3988 throws RemoteException {
3989 Parcel data = Parcel.obtain();
3990 Parcel reply = Parcel.obtain();
3991 data.writeInterfaceToken(IActivityManager.descriptor);
3992 data.writeStrongBinder(token);
3993 target.writeToParcel(data, 0);
3994 data.writeInt(resultCode);
3995 if (resultData != null) {
3996 data.writeInt(1);
3997 resultData.writeToParcel(data, 0);
3998 } else {
3999 data.writeInt(0);
4000 }
4001 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4002 reply.readException();
4003 boolean result = reply.readInt() != 0;
4004 data.recycle();
4005 reply.recycle();
4006 return result;
4007 }
4008
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004009 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4010 Parcel data = Parcel.obtain();
4011 Parcel reply = Parcel.obtain();
4012 data.writeInterfaceToken(IActivityManager.descriptor);
4013 data.writeStrongBinder(activityToken);
4014 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4015 reply.readException();
4016 int result = reply.readInt();
4017 data.recycle();
4018 reply.recycle();
4019 return result;
4020 }
4021
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004022 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4023 Parcel data = Parcel.obtain();
4024 Parcel reply = Parcel.obtain();
4025 data.writeInterfaceToken(IActivityManager.descriptor);
4026 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4027 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4028 reply.readException();
4029 data.recycle();
4030 reply.recycle();
4031 }
4032
4033 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4038 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4039 reply.readException();
4040 data.recycle();
4041 reply.recycle();
4042 }
4043
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004044 private IBinder mRemote;
4045}