blob: 67d39304366890927409ea08aa0e01141a9d7e14 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
19import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070020import android.content.IIntentReceiver;
21import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022import android.content.Intent;
23import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070024import android.content.IntentSender;
Christopher Tate181fafa2009-05-14 11:12:14 -070025import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.pm.ConfigurationInfo;
27import android.content.pm.IPackageDataObserver;
Amith Yamasani52f1d752012-03-28 18:19:29 -070028import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029import android.content.res.Configuration;
30import android.graphics.Bitmap;
31import android.net.Uri;
32import android.os.Binder;
33import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070034import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.os.IBinder;
36import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070037import android.os.ParcelFileDescriptor;
38import android.os.Parcelable;
39import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070041import android.os.StrictMode;
Dianne Hackbornf02b60a2012-08-16 10:48:27 -070042import android.os.UserHandle;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080045import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.ArrayList;
48import java.util.List;
49
50/** {@hide} */
51public abstract class ActivityManagerNative extends Binder implements IActivityManager
52{
53 /**
54 * Cast a Binder object into an activity manager interface, generating
55 * a proxy if needed.
56 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080057 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080058 if (obj == null) {
59 return null;
60 }
61 IActivityManager in =
62 (IActivityManager)obj.queryLocalInterface(descriptor);
63 if (in != null) {
64 return in;
65 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067 return new ActivityManagerProxy(obj);
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 /**
71 * Retrieve the system's default/global activity manager.
72 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080073 static public IActivityManager getDefault() {
74 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080075 }
76
77 /**
78 * Convenience for checking whether the system is ready. For internal use only.
79 */
80 static public boolean isSystemReady() {
81 if (!sSystemReady) {
82 sSystemReady = getDefault().testIsSystemReady();
83 }
84 return sSystemReady;
85 }
86 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 /**
89 * Convenience for sending a sticky broadcast. For internal use only.
90 * If you don't care about permission, use null.
91 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070092 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 try {
94 getDefault().broadcastIntent(
95 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070096 null /*permission*/, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 } catch (RemoteException ex) {
98 }
99 }
100
101 static public void noteWakeupAlarm(PendingIntent ps) {
102 try {
103 getDefault().noteWakeupAlarm(ps.getTarget());
104 } catch (RemoteException ex) {
105 }
106 }
107
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800108 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800109 attachInterface(this, descriptor);
110 }
111
112 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
113 throws RemoteException {
114 switch (code) {
115 case START_ACTIVITY_TRANSACTION:
116 {
117 data.enforceInterface(IActivityManager.descriptor);
118 IBinder b = data.readStrongBinder();
119 IApplicationThread app = ApplicationThreadNative.asInterface(b);
120 Intent intent = Intent.CREATOR.createFromParcel(data);
121 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800123 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800124 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700125 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700126 String profileFile = data.readString();
127 ParcelFileDescriptor profileFd = data.readInt() != 0
128 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700129 Bundle options = data.readInt() != 0
130 ? Bundle.CREATOR.createFromParcel(data) : null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800131 int result = startActivity(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700132 resultTo, resultWho, requestCode, startFlags,
133 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 reply.writeNoException();
135 reply.writeInt(result);
136 return true;
137 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700138
Amith Yamasani82644082012-08-03 13:09:11 -0700139 case START_ACTIVITY_AS_USER_TRANSACTION:
140 {
141 data.enforceInterface(IActivityManager.descriptor);
142 IBinder b = data.readStrongBinder();
143 IApplicationThread app = ApplicationThreadNative.asInterface(b);
144 Intent intent = Intent.CREATOR.createFromParcel(data);
145 String resolvedType = data.readString();
146 IBinder resultTo = data.readStrongBinder();
147 String resultWho = data.readString();
148 int requestCode = data.readInt();
149 int startFlags = data.readInt();
150 String profileFile = data.readString();
151 ParcelFileDescriptor profileFd = data.readInt() != 0
152 ? data.readFileDescriptor() : null;
153 Bundle options = data.readInt() != 0
154 ? Bundle.CREATOR.createFromParcel(data) : null;
155 int userId = data.readInt();
156 int result = startActivityAsUser(app, intent, resolvedType,
157 resultTo, resultWho, requestCode, startFlags,
158 profileFile, profileFd, options, userId);
159 reply.writeNoException();
160 reply.writeInt(result);
161 return true;
162 }
163
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800164 case START_ACTIVITY_AND_WAIT_TRANSACTION:
165 {
166 data.enforceInterface(IActivityManager.descriptor);
167 IBinder b = data.readStrongBinder();
168 IApplicationThread app = ApplicationThreadNative.asInterface(b);
169 Intent intent = Intent.CREATOR.createFromParcel(data);
170 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800171 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800172 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700174 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700175 String profileFile = data.readString();
176 ParcelFileDescriptor profileFd = data.readInt() != 0
177 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700178 Bundle options = data.readInt() != 0
179 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700180 int userId = data.readInt();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700182 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700183 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800184 reply.writeNoException();
185 result.writeToParcel(reply, 0);
186 return true;
187 }
188
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700189 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
190 {
191 data.enforceInterface(IActivityManager.descriptor);
192 IBinder b = data.readStrongBinder();
193 IApplicationThread app = ApplicationThreadNative.asInterface(b);
194 Intent intent = Intent.CREATOR.createFromParcel(data);
195 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700196 IBinder resultTo = data.readStrongBinder();
197 String resultWho = data.readString();
198 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700199 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700200 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700201 Bundle options = data.readInt() != 0
202 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700203 int userId = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700205 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 reply.writeNoException();
207 reply.writeInt(result);
208 return true;
209 }
210
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700211 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700212 {
213 data.enforceInterface(IActivityManager.descriptor);
214 IBinder b = data.readStrongBinder();
215 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700216 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700217 Intent fillInIntent = null;
218 if (data.readInt() != 0) {
219 fillInIntent = Intent.CREATOR.createFromParcel(data);
220 }
221 String resolvedType = data.readString();
222 IBinder resultTo = data.readStrongBinder();
223 String resultWho = data.readString();
224 int requestCode = data.readInt();
225 int flagsMask = data.readInt();
226 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700227 Bundle options = data.readInt() != 0
228 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700229 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700230 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700231 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700232 reply.writeNoException();
233 reply.writeInt(result);
234 return true;
235 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800236
237 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
238 {
239 data.enforceInterface(IActivityManager.descriptor);
240 IBinder callingActivity = data.readStrongBinder();
241 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 Bundle options = data.readInt() != 0
243 ? Bundle.CREATOR.createFromParcel(data) : null;
244 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 reply.writeNoException();
246 reply.writeInt(result ? 1 : 0);
247 return true;
248 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700249
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 case FINISH_ACTIVITY_TRANSACTION: {
251 data.enforceInterface(IActivityManager.descriptor);
252 IBinder token = data.readStrongBinder();
253 Intent resultData = null;
254 int resultCode = data.readInt();
255 if (data.readInt() != 0) {
256 resultData = Intent.CREATOR.createFromParcel(data);
257 }
258 boolean res = finishActivity(token, resultCode, resultData);
259 reply.writeNoException();
260 reply.writeInt(res ? 1 : 0);
261 return true;
262 }
263
264 case FINISH_SUB_ACTIVITY_TRANSACTION: {
265 data.enforceInterface(IActivityManager.descriptor);
266 IBinder token = data.readStrongBinder();
267 String resultWho = data.readString();
268 int requestCode = data.readInt();
269 finishSubActivity(token, resultWho, requestCode);
270 reply.writeNoException();
271 return true;
272 }
273
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700274 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
275 data.enforceInterface(IActivityManager.descriptor);
276 IBinder token = data.readStrongBinder();
277 boolean res = finishActivityAffinity(token);
278 reply.writeNoException();
279 reply.writeInt(res ? 1 : 0);
280 return true;
281 }
282
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800283 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
284 data.enforceInterface(IActivityManager.descriptor);
285 IBinder token = data.readStrongBinder();
286 boolean res = willActivityBeVisible(token);
287 reply.writeNoException();
288 reply.writeInt(res ? 1 : 0);
289 return true;
290 }
291
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800292 case REGISTER_RECEIVER_TRANSACTION:
293 {
294 data.enforceInterface(IActivityManager.descriptor);
295 IBinder b = data.readStrongBinder();
296 IApplicationThread app =
297 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700298 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800299 b = data.readStrongBinder();
300 IIntentReceiver rec
301 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
302 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
303 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700304 int userId = data.readInt();
305 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800306 reply.writeNoException();
307 if (intent != null) {
308 reply.writeInt(1);
309 intent.writeToParcel(reply, 0);
310 } else {
311 reply.writeInt(0);
312 }
313 return true;
314 }
315
316 case UNREGISTER_RECEIVER_TRANSACTION:
317 {
318 data.enforceInterface(IActivityManager.descriptor);
319 IBinder b = data.readStrongBinder();
320 if (b == null) {
321 return true;
322 }
323 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
324 unregisterReceiver(rec);
325 reply.writeNoException();
326 return true;
327 }
328
329 case BROADCAST_INTENT_TRANSACTION:
330 {
331 data.enforceInterface(IActivityManager.descriptor);
332 IBinder b = data.readStrongBinder();
333 IApplicationThread app =
334 b != null ? ApplicationThreadNative.asInterface(b) : null;
335 Intent intent = Intent.CREATOR.createFromParcel(data);
336 String resolvedType = data.readString();
337 b = data.readStrongBinder();
338 IIntentReceiver resultTo =
339 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
340 int resultCode = data.readInt();
341 String resultData = data.readString();
342 Bundle resultExtras = data.readBundle();
343 String perm = data.readString();
344 boolean serialized = data.readInt() != 0;
345 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700346 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 int res = broadcastIntent(app, intent, resolvedType, resultTo,
348 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700349 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800350 reply.writeNoException();
351 reply.writeInt(res);
352 return true;
353 }
354
355 case UNBROADCAST_INTENT_TRANSACTION:
356 {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder b = data.readStrongBinder();
359 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
360 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700361 int userId = data.readInt();
362 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800363 reply.writeNoException();
364 return true;
365 }
366
367 case FINISH_RECEIVER_TRANSACTION: {
368 data.enforceInterface(IActivityManager.descriptor);
369 IBinder who = data.readStrongBinder();
370 int resultCode = data.readInt();
371 String resultData = data.readString();
372 Bundle resultExtras = data.readBundle();
373 boolean resultAbort = data.readInt() != 0;
374 if (who != null) {
375 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
376 }
377 reply.writeNoException();
378 return true;
379 }
380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 case ATTACH_APPLICATION_TRANSACTION: {
382 data.enforceInterface(IActivityManager.descriptor);
383 IApplicationThread app = ApplicationThreadNative.asInterface(
384 data.readStrongBinder());
385 if (app != null) {
386 attachApplication(app);
387 }
388 reply.writeNoException();
389 return true;
390 }
391
392 case ACTIVITY_IDLE_TRANSACTION: {
393 data.enforceInterface(IActivityManager.descriptor);
394 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700395 Configuration config = null;
396 if (data.readInt() != 0) {
397 config = Configuration.CREATOR.createFromParcel(data);
398 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700399 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700401 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800402 }
403 reply.writeNoException();
404 return true;
405 }
406
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700407 case ACTIVITY_RESUMED_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder token = data.readStrongBinder();
410 activityResumed(token);
411 reply.writeNoException();
412 return true;
413 }
414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800415 case ACTIVITY_PAUSED_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800418 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 reply.writeNoException();
420 return true;
421 }
422
423 case ACTIVITY_STOPPED_TRANSACTION: {
424 data.enforceInterface(IActivityManager.descriptor);
425 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800426 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 Bitmap thumbnail = data.readInt() != 0
428 ? Bitmap.CREATOR.createFromParcel(data) : null;
429 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800430 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 reply.writeNoException();
432 return true;
433 }
434
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800435 case ACTIVITY_SLEPT_TRANSACTION: {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder token = data.readStrongBinder();
438 activitySlept(token);
439 reply.writeNoException();
440 return true;
441 }
442
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800443 case ACTIVITY_DESTROYED_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 IBinder token = data.readStrongBinder();
446 activityDestroyed(token);
447 reply.writeNoException();
448 return true;
449 }
450
451 case GET_CALLING_PACKAGE_TRANSACTION: {
452 data.enforceInterface(IActivityManager.descriptor);
453 IBinder token = data.readStrongBinder();
454 String res = token != null ? getCallingPackage(token) : null;
455 reply.writeNoException();
456 reply.writeString(res);
457 return true;
458 }
459
460 case GET_CALLING_ACTIVITY_TRANSACTION: {
461 data.enforceInterface(IActivityManager.descriptor);
462 IBinder token = data.readStrongBinder();
463 ComponentName cn = getCallingActivity(token);
464 reply.writeNoException();
465 ComponentName.writeToParcel(cn, reply);
466 return true;
467 }
468
469 case GET_TASKS_TRANSACTION: {
470 data.enforceInterface(IActivityManager.descriptor);
471 int maxNum = data.readInt();
472 int fl = data.readInt();
473 IBinder receiverBinder = data.readStrongBinder();
474 IThumbnailReceiver receiver = receiverBinder != null
475 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
476 : null;
477 List list = getTasks(maxNum, fl, receiver);
478 reply.writeNoException();
479 int N = list != null ? list.size() : -1;
480 reply.writeInt(N);
481 int i;
482 for (i=0; i<N; i++) {
483 ActivityManager.RunningTaskInfo info =
484 (ActivityManager.RunningTaskInfo)list.get(i);
485 info.writeToParcel(reply, 0);
486 }
487 return true;
488 }
489
490 case GET_RECENT_TASKS_TRANSACTION: {
491 data.enforceInterface(IActivityManager.descriptor);
492 int maxNum = data.readInt();
493 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700494 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700496 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800497 reply.writeNoException();
498 reply.writeTypedList(list);
499 return true;
500 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700501
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700502 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800503 data.enforceInterface(IActivityManager.descriptor);
504 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700505 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800506 reply.writeNoException();
507 if (bm != null) {
508 reply.writeInt(1);
509 bm.writeToParcel(reply, 0);
510 } else {
511 reply.writeInt(0);
512 }
513 return true;
514 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700515
516 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
517 data.enforceInterface(IActivityManager.descriptor);
518 int id = data.readInt();
519 Bitmap bm = getTaskTopThumbnail(id);
520 reply.writeNoException();
521 if (bm != null) {
522 reply.writeInt(1);
523 bm.writeToParcel(reply, 0);
524 } else {
525 reply.writeInt(0);
526 }
527 return true;
528 }
529
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800530 case GET_SERVICES_TRANSACTION: {
531 data.enforceInterface(IActivityManager.descriptor);
532 int maxNum = data.readInt();
533 int fl = data.readInt();
534 List list = getServices(maxNum, fl);
535 reply.writeNoException();
536 int N = list != null ? list.size() : -1;
537 reply.writeInt(N);
538 int i;
539 for (i=0; i<N; i++) {
540 ActivityManager.RunningServiceInfo info =
541 (ActivityManager.RunningServiceInfo)list.get(i);
542 info.writeToParcel(reply, 0);
543 }
544 return true;
545 }
546
547 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
550 reply.writeNoException();
551 reply.writeTypedList(list);
552 return true;
553 }
554
555 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
556 data.enforceInterface(IActivityManager.descriptor);
557 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
558 reply.writeNoException();
559 reply.writeTypedList(list);
560 return true;
561 }
562
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700563 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
564 data.enforceInterface(IActivityManager.descriptor);
565 List<ApplicationInfo> list = getRunningExternalApplications();
566 reply.writeNoException();
567 reply.writeTypedList(list);
568 return true;
569 }
570
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800571 case MOVE_TASK_TO_FRONT_TRANSACTION: {
572 data.enforceInterface(IActivityManager.descriptor);
573 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800574 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700575 Bundle options = data.readInt() != 0
576 ? Bundle.CREATOR.createFromParcel(data) : null;
577 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 reply.writeNoException();
579 return true;
580 }
581
582 case MOVE_TASK_TO_BACK_TRANSACTION: {
583 data.enforceInterface(IActivityManager.descriptor);
584 int task = data.readInt();
585 moveTaskToBack(task);
586 reply.writeNoException();
587 return true;
588 }
589
590 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 IBinder token = data.readStrongBinder();
593 boolean nonRoot = data.readInt() != 0;
594 boolean res = moveActivityTaskToBack(token, nonRoot);
595 reply.writeNoException();
596 reply.writeInt(res ? 1 : 0);
597 return true;
598 }
599
600 case MOVE_TASK_BACKWARDS_TRANSACTION: {
601 data.enforceInterface(IActivityManager.descriptor);
602 int task = data.readInt();
603 moveTaskBackwards(task);
604 reply.writeNoException();
605 return true;
606 }
607
608 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
609 data.enforceInterface(IActivityManager.descriptor);
610 IBinder token = data.readStrongBinder();
611 boolean onlyRoot = data.readInt() != 0;
612 int res = token != null
613 ? getTaskForActivity(token, onlyRoot) : -1;
614 reply.writeNoException();
615 reply.writeInt(res);
616 return true;
617 }
618
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 case REPORT_THUMBNAIL_TRANSACTION: {
620 data.enforceInterface(IActivityManager.descriptor);
621 IBinder token = data.readStrongBinder();
622 Bitmap thumbnail = data.readInt() != 0
623 ? Bitmap.CREATOR.createFromParcel(data) : null;
624 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
625 reportThumbnail(token, thumbnail, description);
626 reply.writeNoException();
627 return true;
628 }
629
630 case GET_CONTENT_PROVIDER_TRANSACTION: {
631 data.enforceInterface(IActivityManager.descriptor);
632 IBinder b = data.readStrongBinder();
633 IApplicationThread app = ApplicationThreadNative.asInterface(b);
634 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700635 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700636 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700637 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 reply.writeNoException();
639 if (cph != null) {
640 reply.writeInt(1);
641 cph.writeToParcel(reply, 0);
642 } else {
643 reply.writeInt(0);
644 }
645 return true;
646 }
647
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800648 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
649 data.enforceInterface(IActivityManager.descriptor);
650 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700651 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800652 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700653 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800654 reply.writeNoException();
655 if (cph != null) {
656 reply.writeInt(1);
657 cph.writeToParcel(reply, 0);
658 } else {
659 reply.writeInt(0);
660 }
661 return true;
662 }
663
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800664 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
665 data.enforceInterface(IActivityManager.descriptor);
666 IBinder b = data.readStrongBinder();
667 IApplicationThread app = ApplicationThreadNative.asInterface(b);
668 ArrayList<ContentProviderHolder> providers =
669 data.createTypedArrayList(ContentProviderHolder.CREATOR);
670 publishContentProviders(app, providers);
671 reply.writeNoException();
672 return true;
673 }
674
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700675 case REF_CONTENT_PROVIDER_TRANSACTION: {
676 data.enforceInterface(IActivityManager.descriptor);
677 IBinder b = data.readStrongBinder();
678 int stable = data.readInt();
679 int unstable = data.readInt();
680 boolean res = refContentProvider(b, stable, unstable);
681 reply.writeNoException();
682 reply.writeInt(res ? 1 : 0);
683 return true;
684 }
685
686 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 IBinder b = data.readStrongBinder();
689 unstableProviderDied(b);
690 reply.writeNoException();
691 return true;
692 }
693
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800694 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
695 data.enforceInterface(IActivityManager.descriptor);
696 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700697 boolean stable = data.readInt() != 0;
698 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800699 reply.writeNoException();
700 return true;
701 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800702
703 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
704 data.enforceInterface(IActivityManager.descriptor);
705 String name = data.readString();
706 IBinder token = data.readStrongBinder();
707 removeContentProviderExternal(name, token);
708 reply.writeNoException();
709 return true;
710 }
711
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700712 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
713 data.enforceInterface(IActivityManager.descriptor);
714 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
715 PendingIntent pi = getRunningServiceControlPanel(comp);
716 reply.writeNoException();
717 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case START_SERVICE_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder b = data.readStrongBinder();
724 IApplicationThread app = ApplicationThreadNative.asInterface(b);
725 Intent service = Intent.CREATOR.createFromParcel(data);
726 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700727 int userId = data.readInt();
728 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 reply.writeNoException();
730 ComponentName.writeToParcel(cn, reply);
731 return true;
732 }
733
734 case STOP_SERVICE_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 IBinder b = data.readStrongBinder();
737 IApplicationThread app = ApplicationThreadNative.asInterface(b);
738 Intent service = Intent.CREATOR.createFromParcel(data);
739 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700740 int userId = data.readInt();
741 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800742 reply.writeNoException();
743 reply.writeInt(res);
744 return true;
745 }
746
747 case STOP_SERVICE_TOKEN_TRANSACTION: {
748 data.enforceInterface(IActivityManager.descriptor);
749 ComponentName className = ComponentName.readFromParcel(data);
750 IBinder token = data.readStrongBinder();
751 int startId = data.readInt();
752 boolean res = stopServiceToken(className, token, startId);
753 reply.writeNoException();
754 reply.writeInt(res ? 1 : 0);
755 return true;
756 }
757
758 case SET_SERVICE_FOREGROUND_TRANSACTION: {
759 data.enforceInterface(IActivityManager.descriptor);
760 ComponentName className = ComponentName.readFromParcel(data);
761 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700762 int id = data.readInt();
763 Notification notification = null;
764 if (data.readInt() != 0) {
765 notification = Notification.CREATOR.createFromParcel(data);
766 }
767 boolean removeNotification = data.readInt() != 0;
768 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800769 reply.writeNoException();
770 return true;
771 }
772
773 case BIND_SERVICE_TRANSACTION: {
774 data.enforceInterface(IActivityManager.descriptor);
775 IBinder b = data.readStrongBinder();
776 IApplicationThread app = ApplicationThreadNative.asInterface(b);
777 IBinder token = data.readStrongBinder();
778 Intent service = Intent.CREATOR.createFromParcel(data);
779 String resolvedType = data.readString();
780 b = data.readStrongBinder();
781 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800782 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800783 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800784 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800785 reply.writeNoException();
786 reply.writeInt(res);
787 return true;
788 }
789
790 case UNBIND_SERVICE_TRANSACTION: {
791 data.enforceInterface(IActivityManager.descriptor);
792 IBinder b = data.readStrongBinder();
793 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
794 boolean res = unbindService(conn);
795 reply.writeNoException();
796 reply.writeInt(res ? 1 : 0);
797 return true;
798 }
799
800 case PUBLISH_SERVICE_TRANSACTION: {
801 data.enforceInterface(IActivityManager.descriptor);
802 IBinder token = data.readStrongBinder();
803 Intent intent = Intent.CREATOR.createFromParcel(data);
804 IBinder service = data.readStrongBinder();
805 publishService(token, intent, service);
806 reply.writeNoException();
807 return true;
808 }
809
810 case UNBIND_FINISHED_TRANSACTION: {
811 data.enforceInterface(IActivityManager.descriptor);
812 IBinder token = data.readStrongBinder();
813 Intent intent = Intent.CREATOR.createFromParcel(data);
814 boolean doRebind = data.readInt() != 0;
815 unbindFinished(token, intent, doRebind);
816 reply.writeNoException();
817 return true;
818 }
819
820 case SERVICE_DONE_EXECUTING_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700823 int type = data.readInt();
824 int startId = data.readInt();
825 int res = data.readInt();
826 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800827 reply.writeNoException();
828 return true;
829 }
830
831 case START_INSTRUMENTATION_TRANSACTION: {
832 data.enforceInterface(IActivityManager.descriptor);
833 ComponentName className = ComponentName.readFromParcel(data);
834 String profileFile = data.readString();
835 int fl = data.readInt();
836 Bundle arguments = data.readBundle();
837 IBinder b = data.readStrongBinder();
838 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700839 int userId = data.readInt();
840 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 reply.writeNoException();
842 reply.writeInt(res ? 1 : 0);
843 return true;
844 }
845
846
847 case FINISH_INSTRUMENTATION_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 IBinder b = data.readStrongBinder();
850 IApplicationThread app = ApplicationThreadNative.asInterface(b);
851 int resultCode = data.readInt();
852 Bundle results = data.readBundle();
853 finishInstrumentation(app, resultCode, results);
854 reply.writeNoException();
855 return true;
856 }
857
858 case GET_CONFIGURATION_TRANSACTION: {
859 data.enforceInterface(IActivityManager.descriptor);
860 Configuration config = getConfiguration();
861 reply.writeNoException();
862 config.writeToParcel(reply, 0);
863 return true;
864 }
865
866 case UPDATE_CONFIGURATION_TRANSACTION: {
867 data.enforceInterface(IActivityManager.descriptor);
868 Configuration config = Configuration.CREATOR.createFromParcel(data);
869 updateConfiguration(config);
870 reply.writeNoException();
871 return true;
872 }
873
874 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
875 data.enforceInterface(IActivityManager.descriptor);
876 IBinder token = data.readStrongBinder();
877 int requestedOrientation = data.readInt();
878 setRequestedOrientation(token, requestedOrientation);
879 reply.writeNoException();
880 return true;
881 }
882
883 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
884 data.enforceInterface(IActivityManager.descriptor);
885 IBinder token = data.readStrongBinder();
886 int req = getRequestedOrientation(token);
887 reply.writeNoException();
888 reply.writeInt(req);
889 return true;
890 }
891
892 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
893 data.enforceInterface(IActivityManager.descriptor);
894 IBinder token = data.readStrongBinder();
895 ComponentName cn = getActivityClassForToken(token);
896 reply.writeNoException();
897 ComponentName.writeToParcel(cn, reply);
898 return true;
899 }
900
901 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
902 data.enforceInterface(IActivityManager.descriptor);
903 IBinder token = data.readStrongBinder();
904 reply.writeNoException();
905 reply.writeString(getPackageForToken(token));
906 return true;
907 }
908
909 case GET_INTENT_SENDER_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 int type = data.readInt();
912 String packageName = data.readString();
913 IBinder token = data.readStrongBinder();
914 String resultWho = data.readString();
915 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800916 Intent[] requestIntents;
917 String[] requestResolvedTypes;
918 if (data.readInt() != 0) {
919 requestIntents = data.createTypedArray(Intent.CREATOR);
920 requestResolvedTypes = data.createStringArray();
921 } else {
922 requestIntents = null;
923 requestResolvedTypes = null;
924 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700926 Bundle options = data.readInt() != 0
927 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700928 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800929 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800930 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700931 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800932 reply.writeNoException();
933 reply.writeStrongBinder(res != null ? res.asBinder() : null);
934 return true;
935 }
936
937 case CANCEL_INTENT_SENDER_TRANSACTION: {
938 data.enforceInterface(IActivityManager.descriptor);
939 IIntentSender r = IIntentSender.Stub.asInterface(
940 data.readStrongBinder());
941 cancelIntentSender(r);
942 reply.writeNoException();
943 return true;
944 }
945
946 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
947 data.enforceInterface(IActivityManager.descriptor);
948 IIntentSender r = IIntentSender.Stub.asInterface(
949 data.readStrongBinder());
950 String res = getPackageForIntentSender(r);
951 reply.writeNoException();
952 reply.writeString(res);
953 return true;
954 }
955
Christopher Tatec4a07d12012-04-06 14:19:13 -0700956 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
957 data.enforceInterface(IActivityManager.descriptor);
958 IIntentSender r = IIntentSender.Stub.asInterface(
959 data.readStrongBinder());
960 int res = getUidForIntentSender(r);
961 reply.writeNoException();
962 reply.writeInt(res);
963 return true;
964 }
965
Dianne Hackborn41203752012-08-31 14:05:51 -0700966 case HANDLE_INCOMING_USER_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 int callingPid = data.readInt();
969 int callingUid = data.readInt();
970 int userId = data.readInt();
971 boolean allowAll = data.readInt() != 0 ;
972 boolean requireFull = data.readInt() != 0;
973 String name = data.readString();
974 String callerPackage = data.readString();
975 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
976 requireFull, name, callerPackage);
977 reply.writeNoException();
978 reply.writeInt(res);
979 return true;
980 }
981
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800982 case SET_PROCESS_LIMIT_TRANSACTION: {
983 data.enforceInterface(IActivityManager.descriptor);
984 int max = data.readInt();
985 setProcessLimit(max);
986 reply.writeNoException();
987 return true;
988 }
989
990 case GET_PROCESS_LIMIT_TRANSACTION: {
991 data.enforceInterface(IActivityManager.descriptor);
992 int limit = getProcessLimit();
993 reply.writeNoException();
994 reply.writeInt(limit);
995 return true;
996 }
997
998 case SET_PROCESS_FOREGROUND_TRANSACTION: {
999 data.enforceInterface(IActivityManager.descriptor);
1000 IBinder token = data.readStrongBinder();
1001 int pid = data.readInt();
1002 boolean isForeground = data.readInt() != 0;
1003 setProcessForeground(token, pid, isForeground);
1004 reply.writeNoException();
1005 return true;
1006 }
1007
1008 case CHECK_PERMISSION_TRANSACTION: {
1009 data.enforceInterface(IActivityManager.descriptor);
1010 String perm = data.readString();
1011 int pid = data.readInt();
1012 int uid = data.readInt();
1013 int res = checkPermission(perm, pid, uid);
1014 reply.writeNoException();
1015 reply.writeInt(res);
1016 return true;
1017 }
1018
1019 case CHECK_URI_PERMISSION_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 Uri uri = Uri.CREATOR.createFromParcel(data);
1022 int pid = data.readInt();
1023 int uid = data.readInt();
1024 int mode = data.readInt();
1025 int res = checkUriPermission(uri, pid, uid, mode);
1026 reply.writeNoException();
1027 reply.writeInt(res);
1028 return true;
1029 }
1030
1031 case CLEAR_APP_DATA_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 String packageName = data.readString();
1034 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1035 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001036 int userId = data.readInt();
1037 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001038 reply.writeNoException();
1039 reply.writeInt(res ? 1 : 0);
1040 return true;
1041 }
1042
1043 case GRANT_URI_PERMISSION_TRANSACTION: {
1044 data.enforceInterface(IActivityManager.descriptor);
1045 IBinder b = data.readStrongBinder();
1046 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1047 String targetPkg = data.readString();
1048 Uri uri = Uri.CREATOR.createFromParcel(data);
1049 int mode = data.readInt();
1050 grantUriPermission(app, targetPkg, uri, mode);
1051 reply.writeNoException();
1052 return true;
1053 }
1054
1055 case REVOKE_URI_PERMISSION_TRANSACTION: {
1056 data.enforceInterface(IActivityManager.descriptor);
1057 IBinder b = data.readStrongBinder();
1058 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1059 Uri uri = Uri.CREATOR.createFromParcel(data);
1060 int mode = data.readInt();
1061 revokeUriPermission(app, uri, mode);
1062 reply.writeNoException();
1063 return true;
1064 }
1065
1066 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 IBinder b = data.readStrongBinder();
1069 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1070 boolean waiting = data.readInt() != 0;
1071 showWaitingForDebugger(app, waiting);
1072 reply.writeNoException();
1073 return true;
1074 }
1075
1076 case GET_MEMORY_INFO_TRANSACTION: {
1077 data.enforceInterface(IActivityManager.descriptor);
1078 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1079 getMemoryInfo(mi);
1080 reply.writeNoException();
1081 mi.writeToParcel(reply, 0);
1082 return true;
1083 }
1084
1085 case UNHANDLED_BACK_TRANSACTION: {
1086 data.enforceInterface(IActivityManager.descriptor);
1087 unhandledBack();
1088 reply.writeNoException();
1089 return true;
1090 }
1091
1092 case OPEN_CONTENT_URI_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 Uri uri = Uri.parse(data.readString());
1095 ParcelFileDescriptor pfd = openContentUri(uri);
1096 reply.writeNoException();
1097 if (pfd != null) {
1098 reply.writeInt(1);
1099 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1100 } else {
1101 reply.writeInt(0);
1102 }
1103 return true;
1104 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001105
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 case GOING_TO_SLEEP_TRANSACTION: {
1107 data.enforceInterface(IActivityManager.descriptor);
1108 goingToSleep();
1109 reply.writeNoException();
1110 return true;
1111 }
1112
1113 case WAKING_UP_TRANSACTION: {
1114 data.enforceInterface(IActivityManager.descriptor);
1115 wakingUp();
1116 reply.writeNoException();
1117 return true;
1118 }
1119
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001120 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1121 data.enforceInterface(IActivityManager.descriptor);
1122 setLockScreenShown(data.readInt() != 0);
1123 reply.writeNoException();
1124 return true;
1125 }
1126
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001127 case SET_DEBUG_APP_TRANSACTION: {
1128 data.enforceInterface(IActivityManager.descriptor);
1129 String pn = data.readString();
1130 boolean wfd = data.readInt() != 0;
1131 boolean per = data.readInt() != 0;
1132 setDebugApp(pn, wfd, per);
1133 reply.writeNoException();
1134 return true;
1135 }
1136
1137 case SET_ALWAYS_FINISH_TRANSACTION: {
1138 data.enforceInterface(IActivityManager.descriptor);
1139 boolean enabled = data.readInt() != 0;
1140 setAlwaysFinish(enabled);
1141 reply.writeNoException();
1142 return true;
1143 }
1144
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001145 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001147 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001149 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001150 return true;
1151 }
1152
1153 case ENTER_SAFE_MODE_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 enterSafeMode();
1156 reply.writeNoException();
1157 return true;
1158 }
1159
1160 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 IIntentSender is = IIntentSender.Stub.asInterface(
1163 data.readStrongBinder());
1164 noteWakeupAlarm(is);
1165 reply.writeNoException();
1166 return true;
1167 }
1168
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001169 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001170 data.enforceInterface(IActivityManager.descriptor);
1171 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001172 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001173 boolean secure = data.readInt() != 0;
1174 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 reply.writeNoException();
1176 reply.writeInt(res ? 1 : 0);
1177 return true;
1178 }
1179
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001180 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1181 data.enforceInterface(IActivityManager.descriptor);
1182 String reason = data.readString();
1183 boolean res = killProcessesBelowForeground(reason);
1184 reply.writeNoException();
1185 reply.writeInt(res ? 1 : 0);
1186 return true;
1187 }
1188
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001189 case START_RUNNING_TRANSACTION: {
1190 data.enforceInterface(IActivityManager.descriptor);
1191 String pkg = data.readString();
1192 String cls = data.readString();
1193 String action = data.readString();
1194 String indata = data.readString();
1195 startRunning(pkg, cls, action, indata);
1196 reply.writeNoException();
1197 return true;
1198 }
1199
Dan Egnor60d87622009-12-16 16:32:58 -08001200 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1201 data.enforceInterface(IActivityManager.descriptor);
1202 IBinder app = data.readStrongBinder();
1203 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1204 handleApplicationCrash(app, ci);
1205 reply.writeNoException();
1206 return true;
1207 }
1208
1209 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001210 data.enforceInterface(IActivityManager.descriptor);
1211 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001212 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001213 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001214 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001215 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001216 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001217 return true;
1218 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001219
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001220 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001223 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001224 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1225 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001226 reply.writeNoException();
1227 return true;
1228 }
1229
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1231 data.enforceInterface(IActivityManager.descriptor);
1232 int sig = data.readInt();
1233 signalPersistentProcesses(sig);
1234 reply.writeNoException();
1235 return true;
1236 }
1237
Dianne Hackborn03abb812010-01-04 18:43:19 -08001238 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1239 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001241 int userId = data.readInt();
1242 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001243 reply.writeNoException();
1244 return true;
1245 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001246
1247 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1248 data.enforceInterface(IActivityManager.descriptor);
1249 killAllBackgroundProcesses();
1250 reply.writeNoException();
1251 return true;
1252 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001253
1254 case FORCE_STOP_PACKAGE_TRANSACTION: {
1255 data.enforceInterface(IActivityManager.descriptor);
1256 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001257 int userId = data.readInt();
1258 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 reply.writeNoException();
1260 return true;
1261 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001262
1263 case GET_MY_MEMORY_STATE_TRANSACTION: {
1264 data.enforceInterface(IActivityManager.descriptor);
1265 ActivityManager.RunningAppProcessInfo info =
1266 new ActivityManager.RunningAppProcessInfo();
1267 getMyMemoryState(info);
1268 reply.writeNoException();
1269 info.writeToParcel(reply, 0);
1270 return true;
1271 }
1272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1274 data.enforceInterface(IActivityManager.descriptor);
1275 ConfigurationInfo config = getDeviceConfigurationInfo();
1276 reply.writeNoException();
1277 config.writeToParcel(reply, 0);
1278 return true;
1279 }
1280
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001281 case PROFILE_CONTROL_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001284 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001285 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001286 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001287 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001288 ParcelFileDescriptor fd = data.readInt() != 0
1289 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001290 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001291 reply.writeNoException();
1292 reply.writeInt(res ? 1 : 0);
1293 return true;
1294 }
1295
Dianne Hackborn55280a92009-05-07 15:53:46 -07001296 case SHUTDOWN_TRANSACTION: {
1297 data.enforceInterface(IActivityManager.descriptor);
1298 boolean res = shutdown(data.readInt());
1299 reply.writeNoException();
1300 reply.writeInt(res ? 1 : 0);
1301 return true;
1302 }
1303
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001304 case STOP_APP_SWITCHES_TRANSACTION: {
1305 data.enforceInterface(IActivityManager.descriptor);
1306 stopAppSwitches();
1307 reply.writeNoException();
1308 return true;
1309 }
1310
1311 case RESUME_APP_SWITCHES_TRANSACTION: {
1312 data.enforceInterface(IActivityManager.descriptor);
1313 resumeAppSwitches();
1314 reply.writeNoException();
1315 return true;
1316 }
1317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 case PEEK_SERVICE_TRANSACTION: {
1319 data.enforceInterface(IActivityManager.descriptor);
1320 Intent service = Intent.CREATOR.createFromParcel(data);
1321 String resolvedType = data.readString();
1322 IBinder binder = peekService(service, resolvedType);
1323 reply.writeNoException();
1324 reply.writeStrongBinder(binder);
1325 return true;
1326 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001327
1328 case START_BACKUP_AGENT_TRANSACTION: {
1329 data.enforceInterface(IActivityManager.descriptor);
1330 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1331 int backupRestoreMode = data.readInt();
1332 boolean success = bindBackupAgent(info, backupRestoreMode);
1333 reply.writeNoException();
1334 reply.writeInt(success ? 1 : 0);
1335 return true;
1336 }
1337
1338 case BACKUP_AGENT_CREATED_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 String packageName = data.readString();
1341 IBinder agent = data.readStrongBinder();
1342 backupAgentCreated(packageName, agent);
1343 reply.writeNoException();
1344 return true;
1345 }
1346
1347 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1348 data.enforceInterface(IActivityManager.descriptor);
1349 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1350 unbindBackupAgent(info);
1351 reply.writeNoException();
1352 return true;
1353 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001354
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001355 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001356 data.enforceInterface(IActivityManager.descriptor);
1357 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001358 int appid = data.readInt();
1359 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001360 reply.writeNoException();
1361 return true;
1362 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001363
1364 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1365 data.enforceInterface(IActivityManager.descriptor);
1366 String reason = data.readString();
1367 closeSystemDialogs(reason);
1368 reply.writeNoException();
1369 return true;
1370 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001371
1372 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001374 int[] pids = data.createIntArray();
1375 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001376 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001377 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001378 return true;
1379 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001380
1381 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 String processName = data.readString();
1384 int uid = data.readInt();
1385 killApplicationProcess(processName, uid);
1386 reply.writeNoException();
1387 return true;
1388 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001389
1390 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1391 data.enforceInterface(IActivityManager.descriptor);
1392 IBinder token = data.readStrongBinder();
1393 String packageName = data.readString();
1394 int enterAnim = data.readInt();
1395 int exitAnim = data.readInt();
1396 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001397 reply.writeNoException();
1398 return true;
1399 }
1400
1401 case IS_USER_A_MONKEY_TRANSACTION: {
1402 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001403 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001404 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001405 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001406 return true;
1407 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001408
1409 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1410 data.enforceInterface(IActivityManager.descriptor);
1411 finishHeavyWeightApp();
1412 reply.writeNoException();
1413 return true;
1414 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001415
1416 case IS_IMMERSIVE_TRANSACTION: {
1417 data.enforceInterface(IActivityManager.descriptor);
1418 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001419 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001420 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001421 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001422 return true;
1423 }
1424
1425 case SET_IMMERSIVE_TRANSACTION: {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 IBinder token = data.readStrongBinder();
1428 boolean imm = data.readInt() == 1;
1429 setImmersive(token, imm);
1430 reply.writeNoException();
1431 return true;
1432 }
1433
1434 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1435 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001436 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001437 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001438 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001439 return true;
1440 }
1441
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001442 case CRASH_APPLICATION_TRANSACTION: {
1443 data.enforceInterface(IActivityManager.descriptor);
1444 int uid = data.readInt();
1445 int initialPid = data.readInt();
1446 String packageName = data.readString();
1447 String message = data.readString();
1448 crashApplication(uid, initialPid, packageName, message);
1449 reply.writeNoException();
1450 return true;
1451 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001452
1453 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001456 int userId = data.readInt();
1457 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001458 reply.writeNoException();
1459 reply.writeString(type);
1460 return true;
1461 }
1462
Dianne Hackborn7e269642010-08-25 19:50:20 -07001463 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1464 data.enforceInterface(IActivityManager.descriptor);
1465 String name = data.readString();
1466 IBinder perm = newUriPermissionOwner(name);
1467 reply.writeNoException();
1468 reply.writeStrongBinder(perm);
1469 return true;
1470 }
1471
1472 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
1474 IBinder owner = data.readStrongBinder();
1475 int fromUid = data.readInt();
1476 String targetPkg = data.readString();
1477 Uri uri = Uri.CREATOR.createFromParcel(data);
1478 int mode = data.readInt();
1479 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1480 reply.writeNoException();
1481 return true;
1482 }
1483
1484 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1485 data.enforceInterface(IActivityManager.descriptor);
1486 IBinder owner = data.readStrongBinder();
1487 Uri uri = null;
1488 if (data.readInt() != 0) {
1489 Uri.CREATOR.createFromParcel(data);
1490 }
1491 int mode = data.readInt();
1492 revokeUriPermissionFromOwner(owner, uri, mode);
1493 reply.writeNoException();
1494 return true;
1495 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001496
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001497 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 int callingUid = data.readInt();
1500 String targetPkg = data.readString();
1501 Uri uri = Uri.CREATOR.createFromParcel(data);
1502 int modeFlags = data.readInt();
1503 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1504 reply.writeNoException();
1505 reply.writeInt(res);
1506 return true;
1507 }
1508
Andy McFadden824c5102010-07-09 16:26:57 -07001509 case DUMP_HEAP_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001512 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001513 boolean managed = data.readInt() != 0;
1514 String path = data.readString();
1515 ParcelFileDescriptor fd = data.readInt() != 0
1516 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001517 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001518 reply.writeNoException();
1519 reply.writeInt(res ? 1 : 0);
1520 return true;
1521 }
1522
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001523 case START_ACTIVITIES_TRANSACTION:
1524 {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IBinder b = data.readStrongBinder();
1527 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1528 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1529 String[] resolvedTypes = data.createStringArray();
1530 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001531 Bundle options = data.readInt() != 0
1532 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001533 int userId = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001534 int result = startActivities(app, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001535 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001536 reply.writeNoException();
1537 reply.writeInt(result);
1538 return true;
1539 }
1540
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001541 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1542 {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 int mode = getFrontActivityScreenCompatMode();
1545 reply.writeNoException();
1546 reply.writeInt(mode);
1547 return true;
1548 }
1549
1550 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1551 {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 int mode = data.readInt();
1554 setFrontActivityScreenCompatMode(mode);
1555 reply.writeNoException();
1556 reply.writeInt(mode);
1557 return true;
1558 }
1559
1560 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1561 {
1562 data.enforceInterface(IActivityManager.descriptor);
1563 String pkg = data.readString();
1564 int mode = getPackageScreenCompatMode(pkg);
1565 reply.writeNoException();
1566 reply.writeInt(mode);
1567 return true;
1568 }
1569
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001570 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1571 {
1572 data.enforceInterface(IActivityManager.descriptor);
1573 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001574 int mode = data.readInt();
1575 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001576 reply.writeNoException();
1577 return true;
1578 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001579
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001580 case SWITCH_USER_TRANSACTION: {
1581 data.enforceInterface(IActivityManager.descriptor);
1582 int userid = data.readInt();
1583 boolean result = switchUser(userid);
1584 reply.writeNoException();
1585 reply.writeInt(result ? 1 : 0);
1586 return true;
1587 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001588
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001589 case STOP_USER_TRANSACTION: {
1590 data.enforceInterface(IActivityManager.descriptor);
1591 int userid = data.readInt();
1592 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1593 data.readStrongBinder());
1594 int result = stopUser(userid, callback);
1595 reply.writeNoException();
1596 reply.writeInt(result);
1597 return true;
1598 }
1599
Amith Yamasani52f1d752012-03-28 18:19:29 -07001600 case GET_CURRENT_USER_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 UserInfo userInfo = getCurrentUser();
1603 reply.writeNoException();
1604 userInfo.writeToParcel(reply, 0);
1605 return true;
1606 }
1607
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001608 case IS_USER_RUNNING_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001611 boolean orStopping = data.readInt() != 0;
1612 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001613 reply.writeNoException();
1614 reply.writeInt(result ? 1 : 0);
1615 return true;
1616 }
1617
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001618 case GET_RUNNING_USER_IDS_TRANSACTION: {
1619 data.enforceInterface(IActivityManager.descriptor);
1620 int[] result = getRunningUserIds();
1621 reply.writeNoException();
1622 reply.writeIntArray(result);
1623 return true;
1624 }
1625
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001626 case REMOVE_SUB_TASK_TRANSACTION:
1627 {
1628 data.enforceInterface(IActivityManager.descriptor);
1629 int taskId = data.readInt();
1630 int subTaskIndex = data.readInt();
1631 boolean result = removeSubTask(taskId, subTaskIndex);
1632 reply.writeNoException();
1633 reply.writeInt(result ? 1 : 0);
1634 return true;
1635 }
1636
1637 case REMOVE_TASK_TRANSACTION:
1638 {
1639 data.enforceInterface(IActivityManager.descriptor);
1640 int taskId = data.readInt();
1641 int fl = data.readInt();
1642 boolean result = removeTask(taskId, fl);
1643 reply.writeNoException();
1644 reply.writeInt(result ? 1 : 0);
1645 return true;
1646 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001647
Jeff Sharkeya4620792011-05-20 15:29:23 -07001648 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1651 data.readStrongBinder());
1652 registerProcessObserver(observer);
1653 return true;
1654 }
1655
1656 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1657 data.enforceInterface(IActivityManager.descriptor);
1658 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1659 data.readStrongBinder());
1660 unregisterProcessObserver(observer);
1661 return true;
1662 }
1663
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001664 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1665 {
1666 data.enforceInterface(IActivityManager.descriptor);
1667 String pkg = data.readString();
1668 boolean ask = getPackageAskScreenCompat(pkg);
1669 reply.writeNoException();
1670 reply.writeInt(ask ? 1 : 0);
1671 return true;
1672 }
1673
1674 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1675 {
1676 data.enforceInterface(IActivityManager.descriptor);
1677 String pkg = data.readString();
1678 boolean ask = data.readInt() != 0;
1679 setPackageAskScreenCompat(pkg, ask);
1680 reply.writeNoException();
1681 return true;
1682 }
1683
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001684 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1685 data.enforceInterface(IActivityManager.descriptor);
1686 IIntentSender r = IIntentSender.Stub.asInterface(
1687 data.readStrongBinder());
1688 boolean res = isIntentSenderTargetedToPackage(r);
1689 reply.writeNoException();
1690 reply.writeInt(res ? 1 : 0);
1691 return true;
1692 }
1693
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001694 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 IIntentSender r = IIntentSender.Stub.asInterface(
1697 data.readStrongBinder());
1698 boolean res = isIntentSenderAnActivity(r);
1699 reply.writeNoException();
1700 reply.writeInt(res ? 1 : 0);
1701 return true;
1702 }
1703
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001704 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 Configuration config = Configuration.CREATOR.createFromParcel(data);
1707 updatePersistentConfiguration(config);
1708 reply.writeNoException();
1709 return true;
1710 }
1711
Dianne Hackbornb437e092011-08-05 17:50:29 -07001712 case GET_PROCESS_PSS_TRANSACTION: {
1713 data.enforceInterface(IActivityManager.descriptor);
1714 int[] pids = data.createIntArray();
1715 long[] pss = getProcessPss(pids);
1716 reply.writeNoException();
1717 reply.writeLongArray(pss);
1718 return true;
1719 }
1720
Dianne Hackborn661cd522011-08-22 00:26:20 -07001721 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1722 data.enforceInterface(IActivityManager.descriptor);
1723 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1724 boolean always = data.readInt() != 0;
1725 showBootMessage(msg, always);
1726 reply.writeNoException();
1727 return true;
1728 }
1729
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001730 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1731 data.enforceInterface(IActivityManager.descriptor);
1732 dismissKeyguardOnNextActivity();
1733 reply.writeNoException();
1734 return true;
1735 }
1736
Adam Powelldd8fab22012-03-22 17:47:27 -07001737 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1738 data.enforceInterface(IActivityManager.descriptor);
1739 IBinder token = data.readStrongBinder();
1740 String destAffinity = data.readString();
1741 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1742 reply.writeNoException();
1743 reply.writeInt(res ? 1 : 0);
1744 return true;
1745 }
1746
1747 case NAVIGATE_UP_TO_TRANSACTION: {
1748 data.enforceInterface(IActivityManager.descriptor);
1749 IBinder token = data.readStrongBinder();
1750 Intent target = Intent.CREATOR.createFromParcel(data);
1751 int resultCode = data.readInt();
1752 Intent resultData = null;
1753 if (data.readInt() != 0) {
1754 resultData = Intent.CREATOR.createFromParcel(data);
1755 }
1756 boolean res = navigateUpTo(token, target, resultCode, resultData);
1757 reply.writeNoException();
1758 reply.writeInt(res ? 1 : 0);
1759 return true;
1760 }
1761
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001762 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1763 data.enforceInterface(IActivityManager.descriptor);
1764 IBinder token = data.readStrongBinder();
1765 int res = getLaunchedFromUid(token);
1766 reply.writeNoException();
1767 reply.writeInt(res);
1768 return true;
1769 }
1770
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001771 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1774 data.readStrongBinder());
1775 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001776 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001777 return true;
1778 }
1779
1780 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1783 data.readStrongBinder());
1784 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001785 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001786 return true;
1787 }
1788
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001789 case REQUEST_BUG_REPORT_TRANSACTION: {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001792 reply.writeNoException();
1793 return true;
1794 }
1795
1796 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1797 data.enforceInterface(IActivityManager.descriptor);
1798 int pid = data.readInt();
1799 boolean aboveSystem = data.readInt() != 0;
1800 long res = inputDispatchingTimedOut(pid, aboveSystem);
1801 reply.writeNoException();
1802 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001803 return true;
1804 }
1805
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001806 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001807
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001808 return super.onTransact(code, data, reply, flags);
1809 }
1810
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001811 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001812 return this;
1813 }
1814
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001815 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1816 protected IActivityManager create() {
1817 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001818 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001819 Log.v("ActivityManager", "default service binder = " + b);
1820 }
1821 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001822 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001823 Log.v("ActivityManager", "default service = " + am);
1824 }
1825 return am;
1826 }
1827 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001828}
1829
1830class ActivityManagerProxy implements IActivityManager
1831{
1832 public ActivityManagerProxy(IBinder remote)
1833 {
1834 mRemote = remote;
1835 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001836
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001837 public IBinder asBinder()
1838 {
1839 return mRemote;
1840 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001841
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001842 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001843 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1844 int startFlags, String profileFile,
1845 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001846 Parcel data = Parcel.obtain();
1847 Parcel reply = Parcel.obtain();
1848 data.writeInterfaceToken(IActivityManager.descriptor);
1849 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1850 intent.writeToParcel(data, 0);
1851 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001852 data.writeStrongBinder(resultTo);
1853 data.writeString(resultWho);
1854 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001855 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001856 data.writeString(profileFile);
1857 if (profileFd != null) {
1858 data.writeInt(1);
1859 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1860 } else {
1861 data.writeInt(0);
1862 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001863 if (options != null) {
1864 data.writeInt(1);
1865 options.writeToParcel(data, 0);
1866 } else {
1867 data.writeInt(0);
1868 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001869 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1870 reply.readException();
1871 int result = reply.readInt();
1872 reply.recycle();
1873 data.recycle();
1874 return result;
1875 }
Amith Yamasani82644082012-08-03 13:09:11 -07001876
1877 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1878 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1879 int startFlags, String profileFile,
1880 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1881 Parcel data = Parcel.obtain();
1882 Parcel reply = Parcel.obtain();
1883 data.writeInterfaceToken(IActivityManager.descriptor);
1884 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1885 intent.writeToParcel(data, 0);
1886 data.writeString(resolvedType);
1887 data.writeStrongBinder(resultTo);
1888 data.writeString(resultWho);
1889 data.writeInt(requestCode);
1890 data.writeInt(startFlags);
1891 data.writeString(profileFile);
1892 if (profileFd != null) {
1893 data.writeInt(1);
1894 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1895 } else {
1896 data.writeInt(0);
1897 }
1898 if (options != null) {
1899 data.writeInt(1);
1900 options.writeToParcel(data, 0);
1901 } else {
1902 data.writeInt(0);
1903 }
1904 data.writeInt(userId);
1905 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1906 reply.readException();
1907 int result = reply.readInt();
1908 reply.recycle();
1909 data.recycle();
1910 return result;
1911 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001912 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001913 String resolvedType, IBinder resultTo, String resultWho,
1914 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001915 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001916 Parcel data = Parcel.obtain();
1917 Parcel reply = Parcel.obtain();
1918 data.writeInterfaceToken(IActivityManager.descriptor);
1919 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1920 intent.writeToParcel(data, 0);
1921 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001922 data.writeStrongBinder(resultTo);
1923 data.writeString(resultWho);
1924 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001925 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001926 data.writeString(profileFile);
1927 if (profileFd != null) {
1928 data.writeInt(1);
1929 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1930 } else {
1931 data.writeInt(0);
1932 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001933 if (options != null) {
1934 data.writeInt(1);
1935 options.writeToParcel(data, 0);
1936 } else {
1937 data.writeInt(0);
1938 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001939 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001940 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1941 reply.readException();
1942 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1943 reply.recycle();
1944 data.recycle();
1945 return result;
1946 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001947 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001948 String resolvedType, IBinder resultTo, String resultWho,
1949 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001950 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001951 Parcel data = Parcel.obtain();
1952 Parcel reply = Parcel.obtain();
1953 data.writeInterfaceToken(IActivityManager.descriptor);
1954 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1955 intent.writeToParcel(data, 0);
1956 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001957 data.writeStrongBinder(resultTo);
1958 data.writeString(resultWho);
1959 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001960 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001961 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001962 if (options != null) {
1963 data.writeInt(1);
1964 options.writeToParcel(data, 0);
1965 } else {
1966 data.writeInt(0);
1967 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001968 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001969 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1970 reply.readException();
1971 int result = reply.readInt();
1972 reply.recycle();
1973 data.recycle();
1974 return result;
1975 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001976 public int startActivityIntentSender(IApplicationThread caller,
1977 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001978 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001979 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001980 Parcel data = Parcel.obtain();
1981 Parcel reply = Parcel.obtain();
1982 data.writeInterfaceToken(IActivityManager.descriptor);
1983 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1984 intent.writeToParcel(data, 0);
1985 if (fillInIntent != null) {
1986 data.writeInt(1);
1987 fillInIntent.writeToParcel(data, 0);
1988 } else {
1989 data.writeInt(0);
1990 }
1991 data.writeString(resolvedType);
1992 data.writeStrongBinder(resultTo);
1993 data.writeString(resultWho);
1994 data.writeInt(requestCode);
1995 data.writeInt(flagsMask);
1996 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001997 if (options != null) {
1998 data.writeInt(1);
1999 options.writeToParcel(data, 0);
2000 } else {
2001 data.writeInt(0);
2002 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002003 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002004 reply.readException();
2005 int result = reply.readInt();
2006 reply.recycle();
2007 data.recycle();
2008 return result;
2009 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002010 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002011 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002012 Parcel data = Parcel.obtain();
2013 Parcel reply = Parcel.obtain();
2014 data.writeInterfaceToken(IActivityManager.descriptor);
2015 data.writeStrongBinder(callingActivity);
2016 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002017 if (options != null) {
2018 data.writeInt(1);
2019 options.writeToParcel(data, 0);
2020 } else {
2021 data.writeInt(0);
2022 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002023 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2024 reply.readException();
2025 int result = reply.readInt();
2026 reply.recycle();
2027 data.recycle();
2028 return result != 0;
2029 }
2030 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2031 throws RemoteException {
2032 Parcel data = Parcel.obtain();
2033 Parcel reply = Parcel.obtain();
2034 data.writeInterfaceToken(IActivityManager.descriptor);
2035 data.writeStrongBinder(token);
2036 data.writeInt(resultCode);
2037 if (resultData != null) {
2038 data.writeInt(1);
2039 resultData.writeToParcel(data, 0);
2040 } else {
2041 data.writeInt(0);
2042 }
2043 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2044 reply.readException();
2045 boolean res = reply.readInt() != 0;
2046 data.recycle();
2047 reply.recycle();
2048 return res;
2049 }
2050 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2051 {
2052 Parcel data = Parcel.obtain();
2053 Parcel reply = Parcel.obtain();
2054 data.writeInterfaceToken(IActivityManager.descriptor);
2055 data.writeStrongBinder(token);
2056 data.writeString(resultWho);
2057 data.writeInt(requestCode);
2058 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2059 reply.readException();
2060 data.recycle();
2061 reply.recycle();
2062 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002063 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 data.writeStrongBinder(token);
2068 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2069 reply.readException();
2070 boolean res = reply.readInt() != 0;
2071 data.recycle();
2072 reply.recycle();
2073 return res;
2074 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002075 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2076 Parcel data = Parcel.obtain();
2077 Parcel reply = Parcel.obtain();
2078 data.writeInterfaceToken(IActivityManager.descriptor);
2079 data.writeStrongBinder(token);
2080 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2081 reply.readException();
2082 boolean res = reply.readInt() != 0;
2083 data.recycle();
2084 reply.recycle();
2085 return res;
2086 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002087 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002088 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002089 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002090 {
2091 Parcel data = Parcel.obtain();
2092 Parcel reply = Parcel.obtain();
2093 data.writeInterfaceToken(IActivityManager.descriptor);
2094 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002095 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002096 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2097 filter.writeToParcel(data, 0);
2098 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002099 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002100 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2101 reply.readException();
2102 Intent intent = null;
2103 int haveIntent = reply.readInt();
2104 if (haveIntent != 0) {
2105 intent = Intent.CREATOR.createFromParcel(reply);
2106 }
2107 reply.recycle();
2108 data.recycle();
2109 return intent;
2110 }
2111 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2112 {
2113 Parcel data = Parcel.obtain();
2114 Parcel reply = Parcel.obtain();
2115 data.writeInterfaceToken(IActivityManager.descriptor);
2116 data.writeStrongBinder(receiver.asBinder());
2117 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2118 reply.readException();
2119 data.recycle();
2120 reply.recycle();
2121 }
2122 public int broadcastIntent(IApplicationThread caller,
2123 Intent intent, String resolvedType, IIntentReceiver resultTo,
2124 int resultCode, String resultData, Bundle map,
2125 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002126 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002127 {
2128 Parcel data = Parcel.obtain();
2129 Parcel reply = Parcel.obtain();
2130 data.writeInterfaceToken(IActivityManager.descriptor);
2131 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2132 intent.writeToParcel(data, 0);
2133 data.writeString(resolvedType);
2134 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2135 data.writeInt(resultCode);
2136 data.writeString(resultData);
2137 data.writeBundle(map);
2138 data.writeString(requiredPermission);
2139 data.writeInt(serialized ? 1 : 0);
2140 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002141 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002142 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2143 reply.readException();
2144 int res = reply.readInt();
2145 reply.recycle();
2146 data.recycle();
2147 return res;
2148 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002149 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2150 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002151 {
2152 Parcel data = Parcel.obtain();
2153 Parcel reply = Parcel.obtain();
2154 data.writeInterfaceToken(IActivityManager.descriptor);
2155 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2156 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002157 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2159 reply.readException();
2160 data.recycle();
2161 reply.recycle();
2162 }
2163 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2164 {
2165 Parcel data = Parcel.obtain();
2166 Parcel reply = Parcel.obtain();
2167 data.writeInterfaceToken(IActivityManager.descriptor);
2168 data.writeStrongBinder(who);
2169 data.writeInt(resultCode);
2170 data.writeString(resultData);
2171 data.writeBundle(map);
2172 data.writeInt(abortBroadcast ? 1 : 0);
2173 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2174 reply.readException();
2175 data.recycle();
2176 reply.recycle();
2177 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002178 public void attachApplication(IApplicationThread app) throws RemoteException
2179 {
2180 Parcel data = Parcel.obtain();
2181 Parcel reply = Parcel.obtain();
2182 data.writeInterfaceToken(IActivityManager.descriptor);
2183 data.writeStrongBinder(app.asBinder());
2184 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2185 reply.readException();
2186 data.recycle();
2187 reply.recycle();
2188 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002189 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2190 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002191 {
2192 Parcel data = Parcel.obtain();
2193 Parcel reply = Parcel.obtain();
2194 data.writeInterfaceToken(IActivityManager.descriptor);
2195 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002196 if (config != null) {
2197 data.writeInt(1);
2198 config.writeToParcel(data, 0);
2199 } else {
2200 data.writeInt(0);
2201 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002202 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002203 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2204 reply.readException();
2205 data.recycle();
2206 reply.recycle();
2207 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002208 public void activityResumed(IBinder token) throws RemoteException
2209 {
2210 Parcel data = Parcel.obtain();
2211 Parcel reply = Parcel.obtain();
2212 data.writeInterfaceToken(IActivityManager.descriptor);
2213 data.writeStrongBinder(token);
2214 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 data.recycle();
2217 reply.recycle();
2218 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002219 public void activityPaused(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_PAUSED_TRANSACTION, data, reply, 0);
2226 reply.readException();
2227 data.recycle();
2228 reply.recycle();
2229 }
2230 public void activityStopped(IBinder token, Bundle state,
2231 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002232 {
2233 Parcel data = Parcel.obtain();
2234 Parcel reply = Parcel.obtain();
2235 data.writeInterfaceToken(IActivityManager.descriptor);
2236 data.writeStrongBinder(token);
2237 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002238 if (thumbnail != null) {
2239 data.writeInt(1);
2240 thumbnail.writeToParcel(data, 0);
2241 } else {
2242 data.writeInt(0);
2243 }
2244 TextUtils.writeToParcel(description, data, 0);
2245 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2246 reply.readException();
2247 data.recycle();
2248 reply.recycle();
2249 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002250 public void activitySlept(IBinder token) throws RemoteException
2251 {
2252 Parcel data = Parcel.obtain();
2253 Parcel reply = Parcel.obtain();
2254 data.writeInterfaceToken(IActivityManager.descriptor);
2255 data.writeStrongBinder(token);
2256 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2257 reply.readException();
2258 data.recycle();
2259 reply.recycle();
2260 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002261 public void activityDestroyed(IBinder token) throws RemoteException
2262 {
2263 Parcel data = Parcel.obtain();
2264 Parcel reply = Parcel.obtain();
2265 data.writeInterfaceToken(IActivityManager.descriptor);
2266 data.writeStrongBinder(token);
2267 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2268 reply.readException();
2269 data.recycle();
2270 reply.recycle();
2271 }
2272 public String getCallingPackage(IBinder token) throws RemoteException
2273 {
2274 Parcel data = Parcel.obtain();
2275 Parcel reply = Parcel.obtain();
2276 data.writeInterfaceToken(IActivityManager.descriptor);
2277 data.writeStrongBinder(token);
2278 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2279 reply.readException();
2280 String res = reply.readString();
2281 data.recycle();
2282 reply.recycle();
2283 return res;
2284 }
2285 public ComponentName getCallingActivity(IBinder token)
2286 throws RemoteException {
2287 Parcel data = Parcel.obtain();
2288 Parcel reply = Parcel.obtain();
2289 data.writeInterfaceToken(IActivityManager.descriptor);
2290 data.writeStrongBinder(token);
2291 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2292 reply.readException();
2293 ComponentName res = ComponentName.readFromParcel(reply);
2294 data.recycle();
2295 reply.recycle();
2296 return res;
2297 }
2298 public List getTasks(int maxNum, int flags,
2299 IThumbnailReceiver receiver) throws RemoteException {
2300 Parcel data = Parcel.obtain();
2301 Parcel reply = Parcel.obtain();
2302 data.writeInterfaceToken(IActivityManager.descriptor);
2303 data.writeInt(maxNum);
2304 data.writeInt(flags);
2305 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2306 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2307 reply.readException();
2308 ArrayList list = null;
2309 int N = reply.readInt();
2310 if (N >= 0) {
2311 list = new ArrayList();
2312 while (N > 0) {
2313 ActivityManager.RunningTaskInfo info =
2314 ActivityManager.RunningTaskInfo.CREATOR
2315 .createFromParcel(reply);
2316 list.add(info);
2317 N--;
2318 }
2319 }
2320 data.recycle();
2321 reply.recycle();
2322 return list;
2323 }
2324 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002325 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002326 Parcel data = Parcel.obtain();
2327 Parcel reply = Parcel.obtain();
2328 data.writeInterfaceToken(IActivityManager.descriptor);
2329 data.writeInt(maxNum);
2330 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002331 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 ArrayList<ActivityManager.RecentTaskInfo> list
2335 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2336 data.recycle();
2337 reply.recycle();
2338 return list;
2339 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002340 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002345 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002346 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002347 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002348 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002349 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002350 }
2351 data.recycle();
2352 reply.recycle();
2353 return bm;
2354 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002355 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2356 Parcel data = Parcel.obtain();
2357 Parcel reply = Parcel.obtain();
2358 data.writeInterfaceToken(IActivityManager.descriptor);
2359 data.writeInt(id);
2360 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2361 reply.readException();
2362 Bitmap bm = null;
2363 if (reply.readInt() != 0) {
2364 bm = Bitmap.CREATOR.createFromParcel(reply);
2365 }
2366 data.recycle();
2367 reply.recycle();
2368 return bm;
2369 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002370 public List getServices(int maxNum, int flags) throws RemoteException {
2371 Parcel data = Parcel.obtain();
2372 Parcel reply = Parcel.obtain();
2373 data.writeInterfaceToken(IActivityManager.descriptor);
2374 data.writeInt(maxNum);
2375 data.writeInt(flags);
2376 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2377 reply.readException();
2378 ArrayList list = null;
2379 int N = reply.readInt();
2380 if (N >= 0) {
2381 list = new ArrayList();
2382 while (N > 0) {
2383 ActivityManager.RunningServiceInfo info =
2384 ActivityManager.RunningServiceInfo.CREATOR
2385 .createFromParcel(reply);
2386 list.add(info);
2387 N--;
2388 }
2389 }
2390 data.recycle();
2391 reply.recycle();
2392 return list;
2393 }
2394 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2395 throws RemoteException {
2396 Parcel data = Parcel.obtain();
2397 Parcel reply = Parcel.obtain();
2398 data.writeInterfaceToken(IActivityManager.descriptor);
2399 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2400 reply.readException();
2401 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2402 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2403 data.recycle();
2404 reply.recycle();
2405 return list;
2406 }
2407 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2408 throws RemoteException {
2409 Parcel data = Parcel.obtain();
2410 Parcel reply = Parcel.obtain();
2411 data.writeInterfaceToken(IActivityManager.descriptor);
2412 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2413 reply.readException();
2414 ArrayList<ActivityManager.RunningAppProcessInfo> list
2415 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2416 data.recycle();
2417 reply.recycle();
2418 return list;
2419 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002420 public List<ApplicationInfo> getRunningExternalApplications()
2421 throws RemoteException {
2422 Parcel data = Parcel.obtain();
2423 Parcel reply = Parcel.obtain();
2424 data.writeInterfaceToken(IActivityManager.descriptor);
2425 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2426 reply.readException();
2427 ArrayList<ApplicationInfo> list
2428 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2429 data.recycle();
2430 reply.recycle();
2431 return list;
2432 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002433 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002434 {
2435 Parcel data = Parcel.obtain();
2436 Parcel reply = Parcel.obtain();
2437 data.writeInterfaceToken(IActivityManager.descriptor);
2438 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002439 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002440 if (options != null) {
2441 data.writeInt(1);
2442 options.writeToParcel(data, 0);
2443 } else {
2444 data.writeInt(0);
2445 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002446 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2447 reply.readException();
2448 data.recycle();
2449 reply.recycle();
2450 }
2451 public void moveTaskToBack(int task) throws RemoteException
2452 {
2453 Parcel data = Parcel.obtain();
2454 Parcel reply = Parcel.obtain();
2455 data.writeInterfaceToken(IActivityManager.descriptor);
2456 data.writeInt(task);
2457 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2458 reply.readException();
2459 data.recycle();
2460 reply.recycle();
2461 }
2462 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2463 throws RemoteException {
2464 Parcel data = Parcel.obtain();
2465 Parcel reply = Parcel.obtain();
2466 data.writeInterfaceToken(IActivityManager.descriptor);
2467 data.writeStrongBinder(token);
2468 data.writeInt(nonRoot ? 1 : 0);
2469 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2470 reply.readException();
2471 boolean res = reply.readInt() != 0;
2472 data.recycle();
2473 reply.recycle();
2474 return res;
2475 }
2476 public void moveTaskBackwards(int task) throws RemoteException
2477 {
2478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 data.writeInt(task);
2482 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2483 reply.readException();
2484 data.recycle();
2485 reply.recycle();
2486 }
2487 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2488 {
2489 Parcel data = Parcel.obtain();
2490 Parcel reply = Parcel.obtain();
2491 data.writeInterfaceToken(IActivityManager.descriptor);
2492 data.writeStrongBinder(token);
2493 data.writeInt(onlyRoot ? 1 : 0);
2494 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2495 reply.readException();
2496 int res = reply.readInt();
2497 data.recycle();
2498 reply.recycle();
2499 return res;
2500 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002501 public void reportThumbnail(IBinder token,
2502 Bitmap thumbnail, CharSequence description) throws RemoteException
2503 {
2504 Parcel data = Parcel.obtain();
2505 Parcel reply = Parcel.obtain();
2506 data.writeInterfaceToken(IActivityManager.descriptor);
2507 data.writeStrongBinder(token);
2508 if (thumbnail != null) {
2509 data.writeInt(1);
2510 thumbnail.writeToParcel(data, 0);
2511 } else {
2512 data.writeInt(0);
2513 }
2514 TextUtils.writeToParcel(description, data, 0);
2515 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2516 reply.readException();
2517 data.recycle();
2518 reply.recycle();
2519 }
2520 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002521 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002522 Parcel data = Parcel.obtain();
2523 Parcel reply = Parcel.obtain();
2524 data.writeInterfaceToken(IActivityManager.descriptor);
2525 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2526 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002527 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002528 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002529 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2530 reply.readException();
2531 int res = reply.readInt();
2532 ContentProviderHolder cph = null;
2533 if (res != 0) {
2534 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2535 }
2536 data.recycle();
2537 reply.recycle();
2538 return cph;
2539 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002540 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2541 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002546 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002547 data.writeStrongBinder(token);
2548 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2549 reply.readException();
2550 int res = reply.readInt();
2551 ContentProviderHolder cph = null;
2552 if (res != 0) {
2553 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2554 }
2555 data.recycle();
2556 reply.recycle();
2557 return cph;
2558 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002559 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002560 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002561 {
2562 Parcel data = Parcel.obtain();
2563 Parcel reply = Parcel.obtain();
2564 data.writeInterfaceToken(IActivityManager.descriptor);
2565 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2566 data.writeTypedList(providers);
2567 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 data.recycle();
2570 reply.recycle();
2571 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002572 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2573 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002574 Parcel data = Parcel.obtain();
2575 Parcel reply = Parcel.obtain();
2576 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002577 data.writeStrongBinder(connection);
2578 data.writeInt(stable);
2579 data.writeInt(unstable);
2580 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2581 reply.readException();
2582 boolean res = reply.readInt() != 0;
2583 data.recycle();
2584 reply.recycle();
2585 return res;
2586 }
2587 public void unstableProviderDied(IBinder connection) throws RemoteException {
2588 Parcel data = Parcel.obtain();
2589 Parcel reply = Parcel.obtain();
2590 data.writeInterfaceToken(IActivityManager.descriptor);
2591 data.writeStrongBinder(connection);
2592 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2593 reply.readException();
2594 data.recycle();
2595 reply.recycle();
2596 }
2597
2598 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2599 Parcel data = Parcel.obtain();
2600 Parcel reply = Parcel.obtain();
2601 data.writeInterfaceToken(IActivityManager.descriptor);
2602 data.writeStrongBinder(connection);
2603 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002604 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2605 reply.readException();
2606 data.recycle();
2607 reply.recycle();
2608 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002609
2610 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2611 Parcel data = Parcel.obtain();
2612 Parcel reply = Parcel.obtain();
2613 data.writeInterfaceToken(IActivityManager.descriptor);
2614 data.writeString(name);
2615 data.writeStrongBinder(token);
2616 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2617 reply.readException();
2618 data.recycle();
2619 reply.recycle();
2620 }
2621
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002622 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2623 throws RemoteException
2624 {
2625 Parcel data = Parcel.obtain();
2626 Parcel reply = Parcel.obtain();
2627 data.writeInterfaceToken(IActivityManager.descriptor);
2628 service.writeToParcel(data, 0);
2629 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2630 reply.readException();
2631 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2632 data.recycle();
2633 reply.recycle();
2634 return res;
2635 }
2636
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002638 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 {
2640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2644 service.writeToParcel(data, 0);
2645 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002646 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002647 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2648 reply.readException();
2649 ComponentName res = ComponentName.readFromParcel(reply);
2650 data.recycle();
2651 reply.recycle();
2652 return res;
2653 }
2654 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002655 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 {
2657 Parcel data = Parcel.obtain();
2658 Parcel reply = Parcel.obtain();
2659 data.writeInterfaceToken(IActivityManager.descriptor);
2660 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2661 service.writeToParcel(data, 0);
2662 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002663 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002664 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2665 reply.readException();
2666 int res = reply.readInt();
2667 reply.recycle();
2668 data.recycle();
2669 return res;
2670 }
2671 public boolean stopServiceToken(ComponentName className, IBinder token,
2672 int startId) throws RemoteException {
2673 Parcel data = Parcel.obtain();
2674 Parcel reply = Parcel.obtain();
2675 data.writeInterfaceToken(IActivityManager.descriptor);
2676 ComponentName.writeToParcel(className, data);
2677 data.writeStrongBinder(token);
2678 data.writeInt(startId);
2679 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2680 reply.readException();
2681 boolean res = reply.readInt() != 0;
2682 data.recycle();
2683 reply.recycle();
2684 return res;
2685 }
2686 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002687 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 ComponentName.writeToParcel(className, data);
2692 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002693 data.writeInt(id);
2694 if (notification != null) {
2695 data.writeInt(1);
2696 notification.writeToParcel(data, 0);
2697 } else {
2698 data.writeInt(0);
2699 }
2700 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002701 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2702 reply.readException();
2703 data.recycle();
2704 reply.recycle();
2705 }
2706 public int bindService(IApplicationThread caller, IBinder token,
2707 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002708 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2713 data.writeStrongBinder(token);
2714 service.writeToParcel(data, 0);
2715 data.writeString(resolvedType);
2716 data.writeStrongBinder(connection.asBinder());
2717 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002718 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002719 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2720 reply.readException();
2721 int res = reply.readInt();
2722 data.recycle();
2723 reply.recycle();
2724 return res;
2725 }
2726 public boolean unbindService(IServiceConnection connection) throws RemoteException
2727 {
2728 Parcel data = Parcel.obtain();
2729 Parcel reply = Parcel.obtain();
2730 data.writeInterfaceToken(IActivityManager.descriptor);
2731 data.writeStrongBinder(connection.asBinder());
2732 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 boolean res = reply.readInt() != 0;
2735 data.recycle();
2736 reply.recycle();
2737 return res;
2738 }
2739
2740 public void publishService(IBinder token,
2741 Intent intent, IBinder service) throws RemoteException {
2742 Parcel data = Parcel.obtain();
2743 Parcel reply = Parcel.obtain();
2744 data.writeInterfaceToken(IActivityManager.descriptor);
2745 data.writeStrongBinder(token);
2746 intent.writeToParcel(data, 0);
2747 data.writeStrongBinder(service);
2748 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 data.recycle();
2751 reply.recycle();
2752 }
2753
2754 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2755 throws RemoteException {
2756 Parcel data = Parcel.obtain();
2757 Parcel reply = Parcel.obtain();
2758 data.writeInterfaceToken(IActivityManager.descriptor);
2759 data.writeStrongBinder(token);
2760 intent.writeToParcel(data, 0);
2761 data.writeInt(doRebind ? 1 : 0);
2762 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2763 reply.readException();
2764 data.recycle();
2765 reply.recycle();
2766 }
2767
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002768 public void serviceDoneExecuting(IBinder token, int type, int startId,
2769 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 Parcel data = Parcel.obtain();
2771 Parcel reply = Parcel.obtain();
2772 data.writeInterfaceToken(IActivityManager.descriptor);
2773 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002774 data.writeInt(type);
2775 data.writeInt(startId);
2776 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002777 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2778 reply.readException();
2779 data.recycle();
2780 reply.recycle();
2781 }
2782
2783 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2784 Parcel data = Parcel.obtain();
2785 Parcel reply = Parcel.obtain();
2786 data.writeInterfaceToken(IActivityManager.descriptor);
2787 service.writeToParcel(data, 0);
2788 data.writeString(resolvedType);
2789 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2790 reply.readException();
2791 IBinder binder = reply.readStrongBinder();
2792 reply.recycle();
2793 data.recycle();
2794 return binder;
2795 }
2796
Christopher Tate181fafa2009-05-14 11:12:14 -07002797 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2798 throws RemoteException {
2799 Parcel data = Parcel.obtain();
2800 Parcel reply = Parcel.obtain();
2801 data.writeInterfaceToken(IActivityManager.descriptor);
2802 app.writeToParcel(data, 0);
2803 data.writeInt(backupRestoreMode);
2804 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 boolean success = reply.readInt() != 0;
2807 reply.recycle();
2808 data.recycle();
2809 return success;
2810 }
2811
Christopher Tate346acb12012-10-15 19:20:25 -07002812 public void clearPendingBackup() throws RemoteException {
2813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2817 reply.recycle();
2818 data.recycle();
2819 }
2820
Christopher Tate181fafa2009-05-14 11:12:14 -07002821 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2822 Parcel data = Parcel.obtain();
2823 Parcel reply = Parcel.obtain();
2824 data.writeInterfaceToken(IActivityManager.descriptor);
2825 data.writeString(packageName);
2826 data.writeStrongBinder(agent);
2827 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2828 reply.recycle();
2829 data.recycle();
2830 }
2831
2832 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2833 Parcel data = Parcel.obtain();
2834 Parcel reply = Parcel.obtain();
2835 data.writeInterfaceToken(IActivityManager.descriptor);
2836 app.writeToParcel(data, 0);
2837 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 reply.recycle();
2840 data.recycle();
2841 }
2842
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002844 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002845 throws RemoteException {
2846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 ComponentName.writeToParcel(className, data);
2850 data.writeString(profileFile);
2851 data.writeInt(flags);
2852 data.writeBundle(arguments);
2853 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002854 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2856 reply.readException();
2857 boolean res = reply.readInt() != 0;
2858 reply.recycle();
2859 data.recycle();
2860 return res;
2861 }
2862
2863 public void finishInstrumentation(IApplicationThread target,
2864 int resultCode, Bundle results) throws RemoteException {
2865 Parcel data = Parcel.obtain();
2866 Parcel reply = Parcel.obtain();
2867 data.writeInterfaceToken(IActivityManager.descriptor);
2868 data.writeStrongBinder(target != null ? target.asBinder() : null);
2869 data.writeInt(resultCode);
2870 data.writeBundle(results);
2871 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2872 reply.readException();
2873 data.recycle();
2874 reply.recycle();
2875 }
2876 public Configuration getConfiguration() throws RemoteException
2877 {
2878 Parcel data = Parcel.obtain();
2879 Parcel reply = Parcel.obtain();
2880 data.writeInterfaceToken(IActivityManager.descriptor);
2881 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2882 reply.readException();
2883 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2884 reply.recycle();
2885 data.recycle();
2886 return res;
2887 }
2888 public void updateConfiguration(Configuration values) throws RemoteException
2889 {
2890 Parcel data = Parcel.obtain();
2891 Parcel reply = Parcel.obtain();
2892 data.writeInterfaceToken(IActivityManager.descriptor);
2893 values.writeToParcel(data, 0);
2894 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 data.recycle();
2897 reply.recycle();
2898 }
2899 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2900 throws RemoteException {
2901 Parcel data = Parcel.obtain();
2902 Parcel reply = Parcel.obtain();
2903 data.writeInterfaceToken(IActivityManager.descriptor);
2904 data.writeStrongBinder(token);
2905 data.writeInt(requestedOrientation);
2906 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2907 reply.readException();
2908 data.recycle();
2909 reply.recycle();
2910 }
2911 public int getRequestedOrientation(IBinder token) throws RemoteException {
2912 Parcel data = Parcel.obtain();
2913 Parcel reply = Parcel.obtain();
2914 data.writeInterfaceToken(IActivityManager.descriptor);
2915 data.writeStrongBinder(token);
2916 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2917 reply.readException();
2918 int res = reply.readInt();
2919 data.recycle();
2920 reply.recycle();
2921 return res;
2922 }
2923 public ComponentName getActivityClassForToken(IBinder token)
2924 throws RemoteException {
2925 Parcel data = Parcel.obtain();
2926 Parcel reply = Parcel.obtain();
2927 data.writeInterfaceToken(IActivityManager.descriptor);
2928 data.writeStrongBinder(token);
2929 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2930 reply.readException();
2931 ComponentName res = ComponentName.readFromParcel(reply);
2932 data.recycle();
2933 reply.recycle();
2934 return res;
2935 }
2936 public String getPackageForToken(IBinder token) throws RemoteException
2937 {
2938 Parcel data = Parcel.obtain();
2939 Parcel reply = Parcel.obtain();
2940 data.writeInterfaceToken(IActivityManager.descriptor);
2941 data.writeStrongBinder(token);
2942 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2943 reply.readException();
2944 String res = reply.readString();
2945 data.recycle();
2946 reply.recycle();
2947 return res;
2948 }
2949 public IIntentSender getIntentSender(int type,
2950 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002951 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002952 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
2956 data.writeInt(type);
2957 data.writeString(packageName);
2958 data.writeStrongBinder(token);
2959 data.writeString(resultWho);
2960 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002961 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002962 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002963 data.writeTypedArray(intents, 0);
2964 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002965 } else {
2966 data.writeInt(0);
2967 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002969 if (options != null) {
2970 data.writeInt(1);
2971 options.writeToParcel(data, 0);
2972 } else {
2973 data.writeInt(0);
2974 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002975 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002976 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2977 reply.readException();
2978 IIntentSender res = IIntentSender.Stub.asInterface(
2979 reply.readStrongBinder());
2980 data.recycle();
2981 reply.recycle();
2982 return res;
2983 }
2984 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2985 Parcel data = Parcel.obtain();
2986 Parcel reply = Parcel.obtain();
2987 data.writeInterfaceToken(IActivityManager.descriptor);
2988 data.writeStrongBinder(sender.asBinder());
2989 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 data.recycle();
2992 reply.recycle();
2993 }
2994 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2995 Parcel data = Parcel.obtain();
2996 Parcel reply = Parcel.obtain();
2997 data.writeInterfaceToken(IActivityManager.descriptor);
2998 data.writeStrongBinder(sender.asBinder());
2999 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3000 reply.readException();
3001 String res = reply.readString();
3002 data.recycle();
3003 reply.recycle();
3004 return res;
3005 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003006 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3007 Parcel data = Parcel.obtain();
3008 Parcel reply = Parcel.obtain();
3009 data.writeInterfaceToken(IActivityManager.descriptor);
3010 data.writeStrongBinder(sender.asBinder());
3011 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 int res = reply.readInt();
3014 data.recycle();
3015 reply.recycle();
3016 return res;
3017 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003018 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3019 boolean requireFull, String name, String callerPackage) throws RemoteException {
3020 Parcel data = Parcel.obtain();
3021 Parcel reply = Parcel.obtain();
3022 data.writeInterfaceToken(IActivityManager.descriptor);
3023 data.writeInt(callingPid);
3024 data.writeInt(callingUid);
3025 data.writeInt(userId);
3026 data.writeInt(allowAll ? 1 : 0);
3027 data.writeInt(requireFull ? 1 : 0);
3028 data.writeString(name);
3029 data.writeString(callerPackage);
3030 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 int res = reply.readInt();
3033 data.recycle();
3034 reply.recycle();
3035 return res;
3036 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003037 public void setProcessLimit(int max) throws RemoteException
3038 {
3039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 data.writeInt(max);
3043 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 data.recycle();
3046 reply.recycle();
3047 }
3048 public int getProcessLimit() throws RemoteException
3049 {
3050 Parcel data = Parcel.obtain();
3051 Parcel reply = Parcel.obtain();
3052 data.writeInterfaceToken(IActivityManager.descriptor);
3053 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3054 reply.readException();
3055 int res = reply.readInt();
3056 data.recycle();
3057 reply.recycle();
3058 return res;
3059 }
3060 public void setProcessForeground(IBinder token, int pid,
3061 boolean isForeground) throws RemoteException {
3062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
3065 data.writeStrongBinder(token);
3066 data.writeInt(pid);
3067 data.writeInt(isForeground ? 1 : 0);
3068 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3069 reply.readException();
3070 data.recycle();
3071 reply.recycle();
3072 }
3073 public int checkPermission(String permission, int pid, int uid)
3074 throws RemoteException {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 data.writeString(permission);
3079 data.writeInt(pid);
3080 data.writeInt(uid);
3081 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3082 reply.readException();
3083 int res = reply.readInt();
3084 data.recycle();
3085 reply.recycle();
3086 return res;
3087 }
3088 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003089 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 data.writeString(packageName);
3094 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003095 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003096 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 boolean res = reply.readInt() != 0;
3099 data.recycle();
3100 reply.recycle();
3101 return res;
3102 }
3103 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3104 throws RemoteException {
3105 Parcel data = Parcel.obtain();
3106 Parcel reply = Parcel.obtain();
3107 data.writeInterfaceToken(IActivityManager.descriptor);
3108 uri.writeToParcel(data, 0);
3109 data.writeInt(pid);
3110 data.writeInt(uid);
3111 data.writeInt(mode);
3112 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3113 reply.readException();
3114 int res = reply.readInt();
3115 data.recycle();
3116 reply.recycle();
3117 return res;
3118 }
3119 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3120 Uri uri, int mode) throws RemoteException {
3121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeStrongBinder(caller.asBinder());
3125 data.writeString(targetPkg);
3126 uri.writeToParcel(data, 0);
3127 data.writeInt(mode);
3128 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
3133 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3134 int mode) throws RemoteException {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(caller.asBinder());
3139 uri.writeToParcel(data, 0);
3140 data.writeInt(mode);
3141 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3142 reply.readException();
3143 data.recycle();
3144 reply.recycle();
3145 }
3146 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3147 throws RemoteException {
3148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 data.writeStrongBinder(who.asBinder());
3152 data.writeInt(waiting ? 1 : 0);
3153 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3154 reply.readException();
3155 data.recycle();
3156 reply.recycle();
3157 }
3158 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3159 Parcel data = Parcel.obtain();
3160 Parcel reply = Parcel.obtain();
3161 data.writeInterfaceToken(IActivityManager.descriptor);
3162 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 outInfo.readFromParcel(reply);
3165 data.recycle();
3166 reply.recycle();
3167 }
3168 public void unhandledBack() throws RemoteException
3169 {
3170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3174 reply.readException();
3175 data.recycle();
3176 reply.recycle();
3177 }
3178 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3179 {
3180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
3182 data.writeInterfaceToken(IActivityManager.descriptor);
3183 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3184 reply.readException();
3185 ParcelFileDescriptor pfd = null;
3186 if (reply.readInt() != 0) {
3187 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3188 }
3189 data.recycle();
3190 reply.recycle();
3191 return pfd;
3192 }
3193 public void goingToSleep() throws RemoteException
3194 {
3195 Parcel data = Parcel.obtain();
3196 Parcel reply = Parcel.obtain();
3197 data.writeInterfaceToken(IActivityManager.descriptor);
3198 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 data.recycle();
3201 reply.recycle();
3202 }
3203 public void wakingUp() throws RemoteException
3204 {
3205 Parcel data = Parcel.obtain();
3206 Parcel reply = Parcel.obtain();
3207 data.writeInterfaceToken(IActivityManager.descriptor);
3208 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3209 reply.readException();
3210 data.recycle();
3211 reply.recycle();
3212 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003213 public void setLockScreenShown(boolean shown) throws RemoteException
3214 {
3215 Parcel data = Parcel.obtain();
3216 Parcel reply = Parcel.obtain();
3217 data.writeInterfaceToken(IActivityManager.descriptor);
3218 data.writeInt(shown ? 1 : 0);
3219 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3220 reply.readException();
3221 data.recycle();
3222 reply.recycle();
3223 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003224 public void setDebugApp(
3225 String packageName, boolean waitForDebugger, boolean persistent)
3226 throws RemoteException
3227 {
3228 Parcel data = Parcel.obtain();
3229 Parcel reply = Parcel.obtain();
3230 data.writeInterfaceToken(IActivityManager.descriptor);
3231 data.writeString(packageName);
3232 data.writeInt(waitForDebugger ? 1 : 0);
3233 data.writeInt(persistent ? 1 : 0);
3234 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3235 reply.readException();
3236 data.recycle();
3237 reply.recycle();
3238 }
3239 public void setAlwaysFinish(boolean enabled) throws RemoteException
3240 {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 data.writeInt(enabled ? 1 : 0);
3245 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003250 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003256 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003257 reply.readException();
3258 data.recycle();
3259 reply.recycle();
3260 }
3261 public void enterSafeMode() throws RemoteException {
3262 Parcel data = Parcel.obtain();
3263 data.writeInterfaceToken(IActivityManager.descriptor);
3264 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3265 data.recycle();
3266 }
3267 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3268 Parcel data = Parcel.obtain();
3269 data.writeStrongBinder(sender.asBinder());
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3272 data.recycle();
3273 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003274 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003279 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003280 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003281 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 boolean res = reply.readInt() != 0;
3283 data.recycle();
3284 reply.recycle();
3285 return res;
3286 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003287 @Override
3288 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3289 Parcel data = Parcel.obtain();
3290 Parcel reply = Parcel.obtain();
3291 data.writeInterfaceToken(IActivityManager.descriptor);
3292 data.writeString(reason);
3293 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3294 boolean res = reply.readInt() != 0;
3295 data.recycle();
3296 reply.recycle();
3297 return res;
3298 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 public void startRunning(String pkg, String cls, String action,
3300 String indata) throws RemoteException {
3301 Parcel data = Parcel.obtain();
3302 Parcel reply = Parcel.obtain();
3303 data.writeInterfaceToken(IActivityManager.descriptor);
3304 data.writeString(pkg);
3305 data.writeString(cls);
3306 data.writeString(action);
3307 data.writeString(indata);
3308 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3309 reply.readException();
3310 data.recycle();
3311 reply.recycle();
3312 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003313 public boolean testIsSystemReady()
3314 {
3315 /* this base class version is never called */
3316 return true;
3317 }
Dan Egnor60d87622009-12-16 16:32:58 -08003318 public void handleApplicationCrash(IBinder app,
3319 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3320 {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(app);
3325 crashInfo.writeToParcel(data, 0);
3326 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3327 reply.readException();
3328 reply.recycle();
3329 data.recycle();
3330 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003331
Dan Egnor60d87622009-12-16 16:32:58 -08003332 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003333 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003334 {
3335 Parcel data = Parcel.obtain();
3336 Parcel reply = Parcel.obtain();
3337 data.writeInterfaceToken(IActivityManager.descriptor);
3338 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003340 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003341 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003342 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003343 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003344 reply.recycle();
3345 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003346 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003347 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003348
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003349 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003350 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003351 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003352 {
3353 Parcel data = Parcel.obtain();
3354 Parcel reply = Parcel.obtain();
3355 data.writeInterfaceToken(IActivityManager.descriptor);
3356 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003357 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003358 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003359 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3360 reply.readException();
3361 reply.recycle();
3362 data.recycle();
3363 }
3364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003365 public void signalPersistentProcesses(int sig) throws RemoteException {
3366 Parcel data = Parcel.obtain();
3367 Parcel reply = Parcel.obtain();
3368 data.writeInterfaceToken(IActivityManager.descriptor);
3369 data.writeInt(sig);
3370 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 data.recycle();
3373 reply.recycle();
3374 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003375
Dianne Hackborn1676c852012-09-10 14:52:30 -07003376 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003377 Parcel data = Parcel.obtain();
3378 Parcel reply = Parcel.obtain();
3379 data.writeInterfaceToken(IActivityManager.descriptor);
3380 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003381 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003382 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 data.recycle();
3385 reply.recycle();
3386 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003387
3388 public void killAllBackgroundProcesses() throws RemoteException {
3389 Parcel data = Parcel.obtain();
3390 Parcel reply = Parcel.obtain();
3391 data.writeInterfaceToken(IActivityManager.descriptor);
3392 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 data.recycle();
3395 reply.recycle();
3396 }
3397
Dianne Hackborn1676c852012-09-10 14:52:30 -07003398 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
3401 data.writeInterfaceToken(IActivityManager.descriptor);
3402 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003403 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003404 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003405 reply.readException();
3406 data.recycle();
3407 reply.recycle();
3408 }
3409
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003410 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3411 throws RemoteException
3412 {
3413 Parcel data = Parcel.obtain();
3414 Parcel reply = Parcel.obtain();
3415 data.writeInterfaceToken(IActivityManager.descriptor);
3416 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3417 reply.readException();
3418 outInfo.readFromParcel(reply);
3419 reply.recycle();
3420 data.recycle();
3421 }
3422
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003423 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3424 {
3425 Parcel data = Parcel.obtain();
3426 Parcel reply = Parcel.obtain();
3427 data.writeInterfaceToken(IActivityManager.descriptor);
3428 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3429 reply.readException();
3430 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3431 reply.recycle();
3432 data.recycle();
3433 return res;
3434 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003435
Dianne Hackborn1676c852012-09-10 14:52:30 -07003436 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003437 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003438 {
3439 Parcel data = Parcel.obtain();
3440 Parcel reply = Parcel.obtain();
3441 data.writeInterfaceToken(IActivityManager.descriptor);
3442 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003443 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003444 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003445 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003446 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003447 if (fd != null) {
3448 data.writeInt(1);
3449 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3450 } else {
3451 data.writeInt(0);
3452 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003453 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3454 reply.readException();
3455 boolean res = reply.readInt() != 0;
3456 reply.recycle();
3457 data.recycle();
3458 return res;
3459 }
3460
Dianne Hackborn55280a92009-05-07 15:53:46 -07003461 public boolean shutdown(int timeout) throws RemoteException
3462 {
3463 Parcel data = Parcel.obtain();
3464 Parcel reply = Parcel.obtain();
3465 data.writeInterfaceToken(IActivityManager.descriptor);
3466 data.writeInt(timeout);
3467 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3468 reply.readException();
3469 boolean res = reply.readInt() != 0;
3470 reply.recycle();
3471 data.recycle();
3472 return res;
3473 }
3474
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003475 public void stopAppSwitches() throws RemoteException {
3476 Parcel data = Parcel.obtain();
3477 Parcel reply = Parcel.obtain();
3478 data.writeInterfaceToken(IActivityManager.descriptor);
3479 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3480 reply.readException();
3481 reply.recycle();
3482 data.recycle();
3483 }
3484
3485 public void resumeAppSwitches() throws RemoteException {
3486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3490 reply.readException();
3491 reply.recycle();
3492 data.recycle();
3493 }
3494
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003495 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
3498 data.writeInterfaceToken(IActivityManager.descriptor);
3499 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003500 data.writeInt(appid);
3501 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003502 reply.readException();
3503 data.recycle();
3504 reply.recycle();
3505 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003506
3507 public void closeSystemDialogs(String reason) throws RemoteException {
3508 Parcel data = Parcel.obtain();
3509 Parcel reply = Parcel.obtain();
3510 data.writeInterfaceToken(IActivityManager.descriptor);
3511 data.writeString(reason);
3512 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3513 reply.readException();
3514 data.recycle();
3515 reply.recycle();
3516 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003517
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003518 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003519 throws RemoteException {
3520 Parcel data = Parcel.obtain();
3521 Parcel reply = Parcel.obtain();
3522 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003523 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003524 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3525 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003526 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003527 data.recycle();
3528 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003529 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003530 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003531
3532 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3533 Parcel data = Parcel.obtain();
3534 Parcel reply = Parcel.obtain();
3535 data.writeInterfaceToken(IActivityManager.descriptor);
3536 data.writeString(processName);
3537 data.writeInt(uid);
3538 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3539 reply.readException();
3540 data.recycle();
3541 reply.recycle();
3542 }
3543
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003544 public void overridePendingTransition(IBinder token, String packageName,
3545 int enterAnim, int exitAnim) throws RemoteException {
3546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 data.writeStrongBinder(token);
3550 data.writeString(packageName);
3551 data.writeInt(enterAnim);
3552 data.writeInt(exitAnim);
3553 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3554 reply.readException();
3555 data.recycle();
3556 reply.recycle();
3557 }
3558
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003559 public boolean isUserAMonkey() throws RemoteException {
3560 Parcel data = Parcel.obtain();
3561 Parcel reply = Parcel.obtain();
3562 data.writeInterfaceToken(IActivityManager.descriptor);
3563 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3564 reply.readException();
3565 boolean res = reply.readInt() != 0;
3566 data.recycle();
3567 reply.recycle();
3568 return res;
3569 }
3570
Dianne Hackborn860755f2010-06-03 18:47:52 -07003571 public void finishHeavyWeightApp() throws RemoteException {
3572 Parcel data = Parcel.obtain();
3573 Parcel reply = Parcel.obtain();
3574 data.writeInterfaceToken(IActivityManager.descriptor);
3575 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3576 reply.readException();
3577 data.recycle();
3578 reply.recycle();
3579 }
3580
Daniel Sandler69a48172010-06-23 16:29:36 -04003581 public void setImmersive(IBinder token, boolean immersive)
3582 throws RemoteException {
3583 Parcel data = Parcel.obtain();
3584 Parcel reply = Parcel.obtain();
3585 data.writeInterfaceToken(IActivityManager.descriptor);
3586 data.writeStrongBinder(token);
3587 data.writeInt(immersive ? 1 : 0);
3588 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3589 reply.readException();
3590 data.recycle();
3591 reply.recycle();
3592 }
3593
3594 public boolean isImmersive(IBinder token)
3595 throws RemoteException {
3596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 data.writeStrongBinder(token);
3600 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003601 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003602 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003603 data.recycle();
3604 reply.recycle();
3605 return res;
3606 }
3607
3608 public boolean isTopActivityImmersive()
3609 throws RemoteException {
3610 Parcel data = Parcel.obtain();
3611 Parcel reply = Parcel.obtain();
3612 data.writeInterfaceToken(IActivityManager.descriptor);
3613 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003614 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003615 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003616 data.recycle();
3617 reply.recycle();
3618 return res;
3619 }
3620
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003621 public void crashApplication(int uid, int initialPid, String packageName,
3622 String message) throws RemoteException {
3623 Parcel data = Parcel.obtain();
3624 Parcel reply = Parcel.obtain();
3625 data.writeInterfaceToken(IActivityManager.descriptor);
3626 data.writeInt(uid);
3627 data.writeInt(initialPid);
3628 data.writeString(packageName);
3629 data.writeString(message);
3630 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3631 reply.readException();
3632 data.recycle();
3633 reply.recycle();
3634 }
Andy McFadden824c5102010-07-09 16:26:57 -07003635
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003636 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003641 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003642 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3643 reply.readException();
3644 String res = reply.readString();
3645 data.recycle();
3646 reply.recycle();
3647 return res;
3648 }
3649
Dianne Hackborn7e269642010-08-25 19:50:20 -07003650 public IBinder newUriPermissionOwner(String name)
3651 throws RemoteException {
3652 Parcel data = Parcel.obtain();
3653 Parcel reply = Parcel.obtain();
3654 data.writeInterfaceToken(IActivityManager.descriptor);
3655 data.writeString(name);
3656 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3657 reply.readException();
3658 IBinder res = reply.readStrongBinder();
3659 data.recycle();
3660 reply.recycle();
3661 return res;
3662 }
3663
3664 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3665 Uri uri, int mode) throws RemoteException {
3666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 data.writeStrongBinder(owner);
3670 data.writeInt(fromUid);
3671 data.writeString(targetPkg);
3672 uri.writeToParcel(data, 0);
3673 data.writeInt(mode);
3674 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3675 reply.readException();
3676 data.recycle();
3677 reply.recycle();
3678 }
3679
3680 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3681 int mode) throws RemoteException {
3682 Parcel data = Parcel.obtain();
3683 Parcel reply = Parcel.obtain();
3684 data.writeInterfaceToken(IActivityManager.descriptor);
3685 data.writeStrongBinder(owner);
3686 if (uri != null) {
3687 data.writeInt(1);
3688 uri.writeToParcel(data, 0);
3689 } else {
3690 data.writeInt(0);
3691 }
3692 data.writeInt(mode);
3693 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3694 reply.readException();
3695 data.recycle();
3696 reply.recycle();
3697 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003698
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003699 public int checkGrantUriPermission(int callingUid, String targetPkg,
3700 Uri uri, int modeFlags) throws RemoteException {
3701 Parcel data = Parcel.obtain();
3702 Parcel reply = Parcel.obtain();
3703 data.writeInterfaceToken(IActivityManager.descriptor);
3704 data.writeInt(callingUid);
3705 data.writeString(targetPkg);
3706 uri.writeToParcel(data, 0);
3707 data.writeInt(modeFlags);
3708 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 int res = reply.readInt();
3711 data.recycle();
3712 reply.recycle();
3713 return res;
3714 }
3715
Dianne Hackborn1676c852012-09-10 14:52:30 -07003716 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003717 String path, ParcelFileDescriptor fd) throws RemoteException {
3718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003722 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003723 data.writeInt(managed ? 1 : 0);
3724 data.writeString(path);
3725 if (fd != null) {
3726 data.writeInt(1);
3727 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3728 } else {
3729 data.writeInt(0);
3730 }
3731 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3732 reply.readException();
3733 boolean res = reply.readInt() != 0;
3734 reply.recycle();
3735 data.recycle();
3736 return res;
3737 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003738
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003739 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003740 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003741 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003742 Parcel data = Parcel.obtain();
3743 Parcel reply = Parcel.obtain();
3744 data.writeInterfaceToken(IActivityManager.descriptor);
3745 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3746 data.writeTypedArray(intents, 0);
3747 data.writeStringArray(resolvedTypes);
3748 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003749 if (options != null) {
3750 data.writeInt(1);
3751 options.writeToParcel(data, 0);
3752 } else {
3753 data.writeInt(0);
3754 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003755 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003756 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 int result = reply.readInt();
3759 reply.recycle();
3760 data.recycle();
3761 return result;
3762 }
3763
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003764 public int getFrontActivityScreenCompatMode() throws RemoteException {
3765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 int mode = reply.readInt();
3771 reply.recycle();
3772 data.recycle();
3773 return mode;
3774 }
3775
3776 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 data.writeInt(mode);
3781 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 reply.recycle();
3784 data.recycle();
3785 }
3786
3787 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3788 Parcel data = Parcel.obtain();
3789 Parcel reply = Parcel.obtain();
3790 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003791 data.writeString(packageName);
3792 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003793 reply.readException();
3794 int mode = reply.readInt();
3795 reply.recycle();
3796 data.recycle();
3797 return mode;
3798 }
3799
3800 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003801 throws RemoteException {
3802 Parcel data = Parcel.obtain();
3803 Parcel reply = Parcel.obtain();
3804 data.writeInterfaceToken(IActivityManager.descriptor);
3805 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003806 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003807 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3808 reply.readException();
3809 reply.recycle();
3810 data.recycle();
3811 }
3812
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003813 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3814 Parcel data = Parcel.obtain();
3815 Parcel reply = Parcel.obtain();
3816 data.writeInterfaceToken(IActivityManager.descriptor);
3817 data.writeString(packageName);
3818 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3819 reply.readException();
3820 boolean ask = reply.readInt() != 0;
3821 reply.recycle();
3822 data.recycle();
3823 return ask;
3824 }
3825
3826 public void setPackageAskScreenCompat(String packageName, boolean ask)
3827 throws RemoteException {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 data.writeString(packageName);
3832 data.writeInt(ask ? 1 : 0);
3833 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3834 reply.readException();
3835 reply.recycle();
3836 data.recycle();
3837 }
3838
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003839 public boolean switchUser(int userid) throws RemoteException {
3840 Parcel data = Parcel.obtain();
3841 Parcel reply = Parcel.obtain();
3842 data.writeInterfaceToken(IActivityManager.descriptor);
3843 data.writeInt(userid);
3844 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3845 reply.readException();
3846 boolean result = reply.readInt() != 0;
3847 reply.recycle();
3848 data.recycle();
3849 return result;
3850 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003851
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003852 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3853 Parcel data = Parcel.obtain();
3854 Parcel reply = Parcel.obtain();
3855 data.writeInterfaceToken(IActivityManager.descriptor);
3856 data.writeInt(userid);
3857 data.writeStrongInterface(callback);
3858 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3859 reply.readException();
3860 int result = reply.readInt();
3861 reply.recycle();
3862 data.recycle();
3863 return result;
3864 }
3865
Amith Yamasani52f1d752012-03-28 18:19:29 -07003866 public UserInfo getCurrentUser() throws RemoteException {
3867 Parcel data = Parcel.obtain();
3868 Parcel reply = Parcel.obtain();
3869 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003870 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003871 reply.readException();
3872 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3873 reply.recycle();
3874 data.recycle();
3875 return userInfo;
3876 }
3877
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003878 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003879 Parcel data = Parcel.obtain();
3880 Parcel reply = Parcel.obtain();
3881 data.writeInterfaceToken(IActivityManager.descriptor);
3882 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003883 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003884 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3885 reply.readException();
3886 boolean result = reply.readInt() != 0;
3887 reply.recycle();
3888 data.recycle();
3889 return result;
3890 }
3891
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003892 public int[] getRunningUserIds() throws RemoteException {
3893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3897 reply.readException();
3898 int[] result = reply.createIntArray();
3899 reply.recycle();
3900 data.recycle();
3901 return result;
3902 }
3903
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003904 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3905 Parcel data = Parcel.obtain();
3906 Parcel reply = Parcel.obtain();
3907 data.writeInterfaceToken(IActivityManager.descriptor);
3908 data.writeInt(taskId);
3909 data.writeInt(subTaskIndex);
3910 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 boolean result = reply.readInt() != 0;
3913 reply.recycle();
3914 data.recycle();
3915 return result;
3916 }
3917
3918 public boolean removeTask(int taskId, int flags) throws RemoteException {
3919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 data.writeInt(taskId);
3923 data.writeInt(flags);
3924 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3925 reply.readException();
3926 boolean result = reply.readInt() != 0;
3927 reply.recycle();
3928 data.recycle();
3929 return result;
3930 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003931
Jeff Sharkeya4620792011-05-20 15:29:23 -07003932 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3937 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 data.recycle();
3940 reply.recycle();
3941 }
3942
3943 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3944 Parcel data = Parcel.obtain();
3945 Parcel reply = Parcel.obtain();
3946 data.writeInterfaceToken(IActivityManager.descriptor);
3947 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3948 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3949 reply.readException();
3950 data.recycle();
3951 reply.recycle();
3952 }
3953
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003954 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3955 Parcel data = Parcel.obtain();
3956 Parcel reply = Parcel.obtain();
3957 data.writeInterfaceToken(IActivityManager.descriptor);
3958 data.writeStrongBinder(sender.asBinder());
3959 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3960 reply.readException();
3961 boolean res = reply.readInt() != 0;
3962 data.recycle();
3963 reply.recycle();
3964 return res;
3965 }
3966
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003967 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3968 Parcel data = Parcel.obtain();
3969 Parcel reply = Parcel.obtain();
3970 data.writeInterfaceToken(IActivityManager.descriptor);
3971 data.writeStrongBinder(sender.asBinder());
3972 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3973 reply.readException();
3974 boolean res = reply.readInt() != 0;
3975 data.recycle();
3976 reply.recycle();
3977 return res;
3978 }
3979
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003980 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3981 {
3982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 values.writeToParcel(data, 0);
3986 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3987 reply.readException();
3988 data.recycle();
3989 reply.recycle();
3990 }
3991
Dianne Hackbornb437e092011-08-05 17:50:29 -07003992 public long[] getProcessPss(int[] pids) throws RemoteException {
3993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 data.writeIntArray(pids);
3997 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3998 reply.readException();
3999 long[] res = reply.createLongArray();
4000 data.recycle();
4001 reply.recycle();
4002 return res;
4003 }
4004
Dianne Hackborn661cd522011-08-22 00:26:20 -07004005 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4006 Parcel data = Parcel.obtain();
4007 Parcel reply = Parcel.obtain();
4008 data.writeInterfaceToken(IActivityManager.descriptor);
4009 TextUtils.writeToParcel(msg, data, 0);
4010 data.writeInt(always ? 1 : 0);
4011 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4012 reply.readException();
4013 data.recycle();
4014 reply.recycle();
4015 }
4016
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004017 public void dismissKeyguardOnNextActivity() throws RemoteException {
4018 Parcel data = Parcel.obtain();
4019 Parcel reply = Parcel.obtain();
4020 data.writeInterfaceToken(IActivityManager.descriptor);
4021 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4022 reply.readException();
4023 data.recycle();
4024 reply.recycle();
4025 }
4026
Adam Powelldd8fab22012-03-22 17:47:27 -07004027 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4028 throws RemoteException {
4029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 data.writeStrongBinder(token);
4033 data.writeString(destAffinity);
4034 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 boolean result = reply.readInt() != 0;
4037 data.recycle();
4038 reply.recycle();
4039 return result;
4040 }
4041
4042 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4043 throws RemoteException {
4044 Parcel data = Parcel.obtain();
4045 Parcel reply = Parcel.obtain();
4046 data.writeInterfaceToken(IActivityManager.descriptor);
4047 data.writeStrongBinder(token);
4048 target.writeToParcel(data, 0);
4049 data.writeInt(resultCode);
4050 if (resultData != null) {
4051 data.writeInt(1);
4052 resultData.writeToParcel(data, 0);
4053 } else {
4054 data.writeInt(0);
4055 }
4056 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4057 reply.readException();
4058 boolean result = reply.readInt() != 0;
4059 data.recycle();
4060 reply.recycle();
4061 return result;
4062 }
4063
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004064 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4065 Parcel data = Parcel.obtain();
4066 Parcel reply = Parcel.obtain();
4067 data.writeInterfaceToken(IActivityManager.descriptor);
4068 data.writeStrongBinder(activityToken);
4069 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4070 reply.readException();
4071 int result = reply.readInt();
4072 data.recycle();
4073 reply.recycle();
4074 return result;
4075 }
4076
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004077 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4078 Parcel data = Parcel.obtain();
4079 Parcel reply = Parcel.obtain();
4080 data.writeInterfaceToken(IActivityManager.descriptor);
4081 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4082 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 data.recycle();
4085 reply.recycle();
4086 }
4087
4088 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4089 Parcel data = Parcel.obtain();
4090 Parcel reply = Parcel.obtain();
4091 data.writeInterfaceToken(IActivityManager.descriptor);
4092 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4093 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4094 reply.readException();
4095 data.recycle();
4096 reply.recycle();
4097 }
4098
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004099 public void requestBugReport() throws RemoteException {
4100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
4103 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4104 reply.readException();
4105 data.recycle();
4106 reply.recycle();
4107 }
4108
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004109 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4110 Parcel data = Parcel.obtain();
4111 Parcel reply = Parcel.obtain();
4112 data.writeInterfaceToken(IActivityManager.descriptor);
4113 data.writeInt(pid);
4114 data.writeInt(aboveSystem ? 1 : 0);
4115 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4116 reply.readException();
4117 long res = reply.readInt();
4118 data.recycle();
4119 reply.recycle();
4120 return res;
4121 }
4122
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004123 private IBinder mRemote;
4124}