blob: bc7ac32add7d45e8745b8d667d4332fa18541e93 [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);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001150 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 return true;
1152 }
1153
1154 case ENTER_SAFE_MODE_TRANSACTION: {
1155 data.enforceInterface(IActivityManager.descriptor);
1156 enterSafeMode();
1157 reply.writeNoException();
1158 return true;
1159 }
1160
1161 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1162 data.enforceInterface(IActivityManager.descriptor);
1163 IIntentSender is = IIntentSender.Stub.asInterface(
1164 data.readStrongBinder());
1165 noteWakeupAlarm(is);
1166 reply.writeNoException();
1167 return true;
1168 }
1169
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001170 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 data.enforceInterface(IActivityManager.descriptor);
1172 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001173 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001174 boolean secure = data.readInt() != 0;
1175 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 reply.writeNoException();
1177 reply.writeInt(res ? 1 : 0);
1178 return true;
1179 }
1180
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001181 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 String reason = data.readString();
1184 boolean res = killProcessesBelowForeground(reason);
1185 reply.writeNoException();
1186 reply.writeInt(res ? 1 : 0);
1187 return true;
1188 }
1189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 case START_RUNNING_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 String pkg = data.readString();
1193 String cls = data.readString();
1194 String action = data.readString();
1195 String indata = data.readString();
1196 startRunning(pkg, cls, action, indata);
1197 reply.writeNoException();
1198 return true;
1199 }
1200
Dan Egnor60d87622009-12-16 16:32:58 -08001201 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1202 data.enforceInterface(IActivityManager.descriptor);
1203 IBinder app = data.readStrongBinder();
1204 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1205 handleApplicationCrash(app, ci);
1206 reply.writeNoException();
1207 return true;
1208 }
1209
1210 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 data.enforceInterface(IActivityManager.descriptor);
1212 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001214 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001215 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001217 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 return true;
1219 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001220
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001221 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1222 data.enforceInterface(IActivityManager.descriptor);
1223 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001224 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001225 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1226 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001227 reply.writeNoException();
1228 return true;
1229 }
1230
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1232 data.enforceInterface(IActivityManager.descriptor);
1233 int sig = data.readInt();
1234 signalPersistentProcesses(sig);
1235 reply.writeNoException();
1236 return true;
1237 }
1238
Dianne Hackborn03abb812010-01-04 18:43:19 -08001239 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001242 int userId = data.readInt();
1243 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001244 reply.writeNoException();
1245 return true;
1246 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001247
1248 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1249 data.enforceInterface(IActivityManager.descriptor);
1250 killAllBackgroundProcesses();
1251 reply.writeNoException();
1252 return true;
1253 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001254
1255 case FORCE_STOP_PACKAGE_TRANSACTION: {
1256 data.enforceInterface(IActivityManager.descriptor);
1257 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001258 int userId = data.readInt();
1259 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 reply.writeNoException();
1261 return true;
1262 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001263
1264 case GET_MY_MEMORY_STATE_TRANSACTION: {
1265 data.enforceInterface(IActivityManager.descriptor);
1266 ActivityManager.RunningAppProcessInfo info =
1267 new ActivityManager.RunningAppProcessInfo();
1268 getMyMemoryState(info);
1269 reply.writeNoException();
1270 info.writeToParcel(reply, 0);
1271 return true;
1272 }
1273
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
1276 ConfigurationInfo config = getDeviceConfigurationInfo();
1277 reply.writeNoException();
1278 config.writeToParcel(reply, 0);
1279 return true;
1280 }
1281
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001282 case PROFILE_CONTROL_TRANSACTION: {
1283 data.enforceInterface(IActivityManager.descriptor);
1284 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001285 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001286 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001287 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001288 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001289 ParcelFileDescriptor fd = data.readInt() != 0
1290 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001291 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001292 reply.writeNoException();
1293 reply.writeInt(res ? 1 : 0);
1294 return true;
1295 }
1296
Dianne Hackborn55280a92009-05-07 15:53:46 -07001297 case SHUTDOWN_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 boolean res = shutdown(data.readInt());
1300 reply.writeNoException();
1301 reply.writeInt(res ? 1 : 0);
1302 return true;
1303 }
1304
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001305 case STOP_APP_SWITCHES_TRANSACTION: {
1306 data.enforceInterface(IActivityManager.descriptor);
1307 stopAppSwitches();
1308 reply.writeNoException();
1309 return true;
1310 }
1311
1312 case RESUME_APP_SWITCHES_TRANSACTION: {
1313 data.enforceInterface(IActivityManager.descriptor);
1314 resumeAppSwitches();
1315 reply.writeNoException();
1316 return true;
1317 }
1318
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001319 case PEEK_SERVICE_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 Intent service = Intent.CREATOR.createFromParcel(data);
1322 String resolvedType = data.readString();
1323 IBinder binder = peekService(service, resolvedType);
1324 reply.writeNoException();
1325 reply.writeStrongBinder(binder);
1326 return true;
1327 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001328
1329 case START_BACKUP_AGENT_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1332 int backupRestoreMode = data.readInt();
1333 boolean success = bindBackupAgent(info, backupRestoreMode);
1334 reply.writeNoException();
1335 reply.writeInt(success ? 1 : 0);
1336 return true;
1337 }
1338
1339 case BACKUP_AGENT_CREATED_TRANSACTION: {
1340 data.enforceInterface(IActivityManager.descriptor);
1341 String packageName = data.readString();
1342 IBinder agent = data.readStrongBinder();
1343 backupAgentCreated(packageName, agent);
1344 reply.writeNoException();
1345 return true;
1346 }
1347
1348 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
1350 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1351 unbindBackupAgent(info);
1352 reply.writeNoException();
1353 return true;
1354 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001355
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001356 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001357 data.enforceInterface(IActivityManager.descriptor);
1358 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001359 int appid = data.readInt();
1360 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001361 reply.writeNoException();
1362 return true;
1363 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001364
1365 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1366 data.enforceInterface(IActivityManager.descriptor);
1367 String reason = data.readString();
1368 closeSystemDialogs(reason);
1369 reply.writeNoException();
1370 return true;
1371 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001372
1373 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1374 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001375 int[] pids = data.createIntArray();
1376 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001377 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001378 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001379 return true;
1380 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001381
1382 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1383 data.enforceInterface(IActivityManager.descriptor);
1384 String processName = data.readString();
1385 int uid = data.readInt();
1386 killApplicationProcess(processName, uid);
1387 reply.writeNoException();
1388 return true;
1389 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001390
1391 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1392 data.enforceInterface(IActivityManager.descriptor);
1393 IBinder token = data.readStrongBinder();
1394 String packageName = data.readString();
1395 int enterAnim = data.readInt();
1396 int exitAnim = data.readInt();
1397 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001398 reply.writeNoException();
1399 return true;
1400 }
1401
1402 case IS_USER_A_MONKEY_TRANSACTION: {
1403 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001404 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001405 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001406 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001407 return true;
1408 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001409
1410 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 finishHeavyWeightApp();
1413 reply.writeNoException();
1414 return true;
1415 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001416
1417 case IS_IMMERSIVE_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001420 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001421 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001422 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001423 return true;
1424 }
1425
1426 case SET_IMMERSIVE_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 IBinder token = data.readStrongBinder();
1429 boolean imm = data.readInt() == 1;
1430 setImmersive(token, imm);
1431 reply.writeNoException();
1432 return true;
1433 }
1434
1435 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1436 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001437 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001438 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001439 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001440 return true;
1441 }
1442
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001443 case CRASH_APPLICATION_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
1445 int uid = data.readInt();
1446 int initialPid = data.readInt();
1447 String packageName = data.readString();
1448 String message = data.readString();
1449 crashApplication(uid, initialPid, packageName, message);
1450 reply.writeNoException();
1451 return true;
1452 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001453
1454 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1455 data.enforceInterface(IActivityManager.descriptor);
1456 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001457 int userId = data.readInt();
1458 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001459 reply.writeNoException();
1460 reply.writeString(type);
1461 return true;
1462 }
1463
Dianne Hackborn7e269642010-08-25 19:50:20 -07001464 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 String name = data.readString();
1467 IBinder perm = newUriPermissionOwner(name);
1468 reply.writeNoException();
1469 reply.writeStrongBinder(perm);
1470 return true;
1471 }
1472
1473 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 IBinder owner = data.readStrongBinder();
1476 int fromUid = data.readInt();
1477 String targetPkg = data.readString();
1478 Uri uri = Uri.CREATOR.createFromParcel(data);
1479 int mode = data.readInt();
1480 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1481 reply.writeNoException();
1482 return true;
1483 }
1484
1485 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 IBinder owner = data.readStrongBinder();
1488 Uri uri = null;
1489 if (data.readInt() != 0) {
1490 Uri.CREATOR.createFromParcel(data);
1491 }
1492 int mode = data.readInt();
1493 revokeUriPermissionFromOwner(owner, uri, mode);
1494 reply.writeNoException();
1495 return true;
1496 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001497
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001498 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1499 data.enforceInterface(IActivityManager.descriptor);
1500 int callingUid = data.readInt();
1501 String targetPkg = data.readString();
1502 Uri uri = Uri.CREATOR.createFromParcel(data);
1503 int modeFlags = data.readInt();
1504 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1505 reply.writeNoException();
1506 reply.writeInt(res);
1507 return true;
1508 }
1509
Andy McFadden824c5102010-07-09 16:26:57 -07001510 case DUMP_HEAP_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
1512 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001513 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001514 boolean managed = data.readInt() != 0;
1515 String path = data.readString();
1516 ParcelFileDescriptor fd = data.readInt() != 0
1517 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001518 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001519 reply.writeNoException();
1520 reply.writeInt(res ? 1 : 0);
1521 return true;
1522 }
1523
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001524 case START_ACTIVITIES_TRANSACTION:
1525 {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 IBinder b = data.readStrongBinder();
1528 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1529 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1530 String[] resolvedTypes = data.createStringArray();
1531 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001532 Bundle options = data.readInt() != 0
1533 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001534 int userId = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001535 int result = startActivities(app, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001536 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001537 reply.writeNoException();
1538 reply.writeInt(result);
1539 return true;
1540 }
1541
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001542 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1543 {
1544 data.enforceInterface(IActivityManager.descriptor);
1545 int mode = getFrontActivityScreenCompatMode();
1546 reply.writeNoException();
1547 reply.writeInt(mode);
1548 return true;
1549 }
1550
1551 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1552 {
1553 data.enforceInterface(IActivityManager.descriptor);
1554 int mode = data.readInt();
1555 setFrontActivityScreenCompatMode(mode);
1556 reply.writeNoException();
1557 reply.writeInt(mode);
1558 return true;
1559 }
1560
1561 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1562 {
1563 data.enforceInterface(IActivityManager.descriptor);
1564 String pkg = data.readString();
1565 int mode = getPackageScreenCompatMode(pkg);
1566 reply.writeNoException();
1567 reply.writeInt(mode);
1568 return true;
1569 }
1570
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001571 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1572 {
1573 data.enforceInterface(IActivityManager.descriptor);
1574 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001575 int mode = data.readInt();
1576 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001577 reply.writeNoException();
1578 return true;
1579 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001580
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001581 case SWITCH_USER_TRANSACTION: {
1582 data.enforceInterface(IActivityManager.descriptor);
1583 int userid = data.readInt();
1584 boolean result = switchUser(userid);
1585 reply.writeNoException();
1586 reply.writeInt(result ? 1 : 0);
1587 return true;
1588 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001589
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001590 case STOP_USER_TRANSACTION: {
1591 data.enforceInterface(IActivityManager.descriptor);
1592 int userid = data.readInt();
1593 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1594 data.readStrongBinder());
1595 int result = stopUser(userid, callback);
1596 reply.writeNoException();
1597 reply.writeInt(result);
1598 return true;
1599 }
1600
Amith Yamasani52f1d752012-03-28 18:19:29 -07001601 case GET_CURRENT_USER_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
1603 UserInfo userInfo = getCurrentUser();
1604 reply.writeNoException();
1605 userInfo.writeToParcel(reply, 0);
1606 return true;
1607 }
1608
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001609 case IS_USER_RUNNING_TRANSACTION: {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001612 boolean orStopping = data.readInt() != 0;
1613 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001614 reply.writeNoException();
1615 reply.writeInt(result ? 1 : 0);
1616 return true;
1617 }
1618
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001619 case GET_RUNNING_USER_IDS_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 int[] result = getRunningUserIds();
1622 reply.writeNoException();
1623 reply.writeIntArray(result);
1624 return true;
1625 }
1626
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001627 case REMOVE_SUB_TASK_TRANSACTION:
1628 {
1629 data.enforceInterface(IActivityManager.descriptor);
1630 int taskId = data.readInt();
1631 int subTaskIndex = data.readInt();
1632 boolean result = removeSubTask(taskId, subTaskIndex);
1633 reply.writeNoException();
1634 reply.writeInt(result ? 1 : 0);
1635 return true;
1636 }
1637
1638 case REMOVE_TASK_TRANSACTION:
1639 {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 int taskId = data.readInt();
1642 int fl = data.readInt();
1643 boolean result = removeTask(taskId, fl);
1644 reply.writeNoException();
1645 reply.writeInt(result ? 1 : 0);
1646 return true;
1647 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001648
Jeff Sharkeya4620792011-05-20 15:29:23 -07001649 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1650 data.enforceInterface(IActivityManager.descriptor);
1651 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1652 data.readStrongBinder());
1653 registerProcessObserver(observer);
1654 return true;
1655 }
1656
1657 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1660 data.readStrongBinder());
1661 unregisterProcessObserver(observer);
1662 return true;
1663 }
1664
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001665 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1666 {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 String pkg = data.readString();
1669 boolean ask = getPackageAskScreenCompat(pkg);
1670 reply.writeNoException();
1671 reply.writeInt(ask ? 1 : 0);
1672 return true;
1673 }
1674
1675 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1676 {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 String pkg = data.readString();
1679 boolean ask = data.readInt() != 0;
1680 setPackageAskScreenCompat(pkg, ask);
1681 reply.writeNoException();
1682 return true;
1683 }
1684
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001685 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 IIntentSender r = IIntentSender.Stub.asInterface(
1688 data.readStrongBinder());
1689 boolean res = isIntentSenderTargetedToPackage(r);
1690 reply.writeNoException();
1691 reply.writeInt(res ? 1 : 0);
1692 return true;
1693 }
1694
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001695 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 IIntentSender r = IIntentSender.Stub.asInterface(
1698 data.readStrongBinder());
1699 boolean res = isIntentSenderAnActivity(r);
1700 reply.writeNoException();
1701 reply.writeInt(res ? 1 : 0);
1702 return true;
1703 }
1704
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001705 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 Configuration config = Configuration.CREATOR.createFromParcel(data);
1708 updatePersistentConfiguration(config);
1709 reply.writeNoException();
1710 return true;
1711 }
1712
Dianne Hackbornb437e092011-08-05 17:50:29 -07001713 case GET_PROCESS_PSS_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 int[] pids = data.createIntArray();
1716 long[] pss = getProcessPss(pids);
1717 reply.writeNoException();
1718 reply.writeLongArray(pss);
1719 return true;
1720 }
1721
Dianne Hackborn661cd522011-08-22 00:26:20 -07001722 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1723 data.enforceInterface(IActivityManager.descriptor);
1724 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1725 boolean always = data.readInt() != 0;
1726 showBootMessage(msg, always);
1727 reply.writeNoException();
1728 return true;
1729 }
1730
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001731 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1732 data.enforceInterface(IActivityManager.descriptor);
1733 dismissKeyguardOnNextActivity();
1734 reply.writeNoException();
1735 return true;
1736 }
1737
Adam Powelldd8fab22012-03-22 17:47:27 -07001738 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1739 data.enforceInterface(IActivityManager.descriptor);
1740 IBinder token = data.readStrongBinder();
1741 String destAffinity = data.readString();
1742 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1743 reply.writeNoException();
1744 reply.writeInt(res ? 1 : 0);
1745 return true;
1746 }
1747
1748 case NAVIGATE_UP_TO_TRANSACTION: {
1749 data.enforceInterface(IActivityManager.descriptor);
1750 IBinder token = data.readStrongBinder();
1751 Intent target = Intent.CREATOR.createFromParcel(data);
1752 int resultCode = data.readInt();
1753 Intent resultData = null;
1754 if (data.readInt() != 0) {
1755 resultData = Intent.CREATOR.createFromParcel(data);
1756 }
1757 boolean res = navigateUpTo(token, target, resultCode, resultData);
1758 reply.writeNoException();
1759 reply.writeInt(res ? 1 : 0);
1760 return true;
1761 }
1762
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001763 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 IBinder token = data.readStrongBinder();
1766 int res = getLaunchedFromUid(token);
1767 reply.writeNoException();
1768 reply.writeInt(res);
1769 return true;
1770 }
1771
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001772 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1773 data.enforceInterface(IActivityManager.descriptor);
1774 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1775 data.readStrongBinder());
1776 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001777 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001778 return true;
1779 }
1780
1781 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1782 data.enforceInterface(IActivityManager.descriptor);
1783 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1784 data.readStrongBinder());
1785 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001786 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001787 return true;
1788 }
1789
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001790 case REQUEST_BUG_REPORT_TRANSACTION: {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001793 reply.writeNoException();
1794 return true;
1795 }
1796
1797 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1798 data.enforceInterface(IActivityManager.descriptor);
1799 int pid = data.readInt();
1800 boolean aboveSystem = data.readInt() != 0;
1801 long res = inputDispatchingTimedOut(pid, aboveSystem);
1802 reply.writeNoException();
1803 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001804 return true;
1805 }
1806
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001807 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001808
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001809 return super.onTransact(code, data, reply, flags);
1810 }
1811
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001812 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001813 return this;
1814 }
1815
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001816 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1817 protected IActivityManager create() {
1818 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001819 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001820 Log.v("ActivityManager", "default service binder = " + b);
1821 }
1822 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001823 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001824 Log.v("ActivityManager", "default service = " + am);
1825 }
1826 return am;
1827 }
1828 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001829}
1830
1831class ActivityManagerProxy implements IActivityManager
1832{
1833 public ActivityManagerProxy(IBinder remote)
1834 {
1835 mRemote = remote;
1836 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001837
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001838 public IBinder asBinder()
1839 {
1840 return mRemote;
1841 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001842
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001843 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001844 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1845 int startFlags, String profileFile,
1846 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001847 Parcel data = Parcel.obtain();
1848 Parcel reply = Parcel.obtain();
1849 data.writeInterfaceToken(IActivityManager.descriptor);
1850 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1851 intent.writeToParcel(data, 0);
1852 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001853 data.writeStrongBinder(resultTo);
1854 data.writeString(resultWho);
1855 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001856 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001857 data.writeString(profileFile);
1858 if (profileFd != null) {
1859 data.writeInt(1);
1860 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1861 } else {
1862 data.writeInt(0);
1863 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001864 if (options != null) {
1865 data.writeInt(1);
1866 options.writeToParcel(data, 0);
1867 } else {
1868 data.writeInt(0);
1869 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001870 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1871 reply.readException();
1872 int result = reply.readInt();
1873 reply.recycle();
1874 data.recycle();
1875 return result;
1876 }
Amith Yamasani82644082012-08-03 13:09:11 -07001877
1878 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1879 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1880 int startFlags, String profileFile,
1881 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1882 Parcel data = Parcel.obtain();
1883 Parcel reply = Parcel.obtain();
1884 data.writeInterfaceToken(IActivityManager.descriptor);
1885 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1886 intent.writeToParcel(data, 0);
1887 data.writeString(resolvedType);
1888 data.writeStrongBinder(resultTo);
1889 data.writeString(resultWho);
1890 data.writeInt(requestCode);
1891 data.writeInt(startFlags);
1892 data.writeString(profileFile);
1893 if (profileFd != null) {
1894 data.writeInt(1);
1895 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1896 } else {
1897 data.writeInt(0);
1898 }
1899 if (options != null) {
1900 data.writeInt(1);
1901 options.writeToParcel(data, 0);
1902 } else {
1903 data.writeInt(0);
1904 }
1905 data.writeInt(userId);
1906 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1907 reply.readException();
1908 int result = reply.readInt();
1909 reply.recycle();
1910 data.recycle();
1911 return result;
1912 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001913 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001914 String resolvedType, IBinder resultTo, String resultWho,
1915 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001916 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001917 Parcel data = Parcel.obtain();
1918 Parcel reply = Parcel.obtain();
1919 data.writeInterfaceToken(IActivityManager.descriptor);
1920 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1921 intent.writeToParcel(data, 0);
1922 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001923 data.writeStrongBinder(resultTo);
1924 data.writeString(resultWho);
1925 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001926 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001927 data.writeString(profileFile);
1928 if (profileFd != null) {
1929 data.writeInt(1);
1930 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1931 } else {
1932 data.writeInt(0);
1933 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001934 if (options != null) {
1935 data.writeInt(1);
1936 options.writeToParcel(data, 0);
1937 } else {
1938 data.writeInt(0);
1939 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001940 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001941 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1942 reply.readException();
1943 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1944 reply.recycle();
1945 data.recycle();
1946 return result;
1947 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001948 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001949 String resolvedType, IBinder resultTo, String resultWho,
1950 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001951 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001952 Parcel data = Parcel.obtain();
1953 Parcel reply = Parcel.obtain();
1954 data.writeInterfaceToken(IActivityManager.descriptor);
1955 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1956 intent.writeToParcel(data, 0);
1957 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001958 data.writeStrongBinder(resultTo);
1959 data.writeString(resultWho);
1960 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001961 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001962 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001963 if (options != null) {
1964 data.writeInt(1);
1965 options.writeToParcel(data, 0);
1966 } else {
1967 data.writeInt(0);
1968 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001969 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001970 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1971 reply.readException();
1972 int result = reply.readInt();
1973 reply.recycle();
1974 data.recycle();
1975 return result;
1976 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001977 public int startActivityIntentSender(IApplicationThread caller,
1978 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001979 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001980 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001981 Parcel data = Parcel.obtain();
1982 Parcel reply = Parcel.obtain();
1983 data.writeInterfaceToken(IActivityManager.descriptor);
1984 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1985 intent.writeToParcel(data, 0);
1986 if (fillInIntent != null) {
1987 data.writeInt(1);
1988 fillInIntent.writeToParcel(data, 0);
1989 } else {
1990 data.writeInt(0);
1991 }
1992 data.writeString(resolvedType);
1993 data.writeStrongBinder(resultTo);
1994 data.writeString(resultWho);
1995 data.writeInt(requestCode);
1996 data.writeInt(flagsMask);
1997 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001998 if (options != null) {
1999 data.writeInt(1);
2000 options.writeToParcel(data, 0);
2001 } else {
2002 data.writeInt(0);
2003 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002004 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002005 reply.readException();
2006 int result = reply.readInt();
2007 reply.recycle();
2008 data.recycle();
2009 return result;
2010 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002011 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002012 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002013 Parcel data = Parcel.obtain();
2014 Parcel reply = Parcel.obtain();
2015 data.writeInterfaceToken(IActivityManager.descriptor);
2016 data.writeStrongBinder(callingActivity);
2017 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002018 if (options != null) {
2019 data.writeInt(1);
2020 options.writeToParcel(data, 0);
2021 } else {
2022 data.writeInt(0);
2023 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002024 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2025 reply.readException();
2026 int result = reply.readInt();
2027 reply.recycle();
2028 data.recycle();
2029 return result != 0;
2030 }
2031 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2032 throws RemoteException {
2033 Parcel data = Parcel.obtain();
2034 Parcel reply = Parcel.obtain();
2035 data.writeInterfaceToken(IActivityManager.descriptor);
2036 data.writeStrongBinder(token);
2037 data.writeInt(resultCode);
2038 if (resultData != null) {
2039 data.writeInt(1);
2040 resultData.writeToParcel(data, 0);
2041 } else {
2042 data.writeInt(0);
2043 }
2044 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2045 reply.readException();
2046 boolean res = reply.readInt() != 0;
2047 data.recycle();
2048 reply.recycle();
2049 return res;
2050 }
2051 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2052 {
2053 Parcel data = Parcel.obtain();
2054 Parcel reply = Parcel.obtain();
2055 data.writeInterfaceToken(IActivityManager.descriptor);
2056 data.writeStrongBinder(token);
2057 data.writeString(resultWho);
2058 data.writeInt(requestCode);
2059 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2060 reply.readException();
2061 data.recycle();
2062 reply.recycle();
2063 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002064 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2065 Parcel data = Parcel.obtain();
2066 Parcel reply = Parcel.obtain();
2067 data.writeInterfaceToken(IActivityManager.descriptor);
2068 data.writeStrongBinder(token);
2069 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2070 reply.readException();
2071 boolean res = reply.readInt() != 0;
2072 data.recycle();
2073 reply.recycle();
2074 return res;
2075 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002076 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2077 Parcel data = Parcel.obtain();
2078 Parcel reply = Parcel.obtain();
2079 data.writeInterfaceToken(IActivityManager.descriptor);
2080 data.writeStrongBinder(token);
2081 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2082 reply.readException();
2083 boolean res = reply.readInt() != 0;
2084 data.recycle();
2085 reply.recycle();
2086 return res;
2087 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002088 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002089 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002090 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002091 {
2092 Parcel data = Parcel.obtain();
2093 Parcel reply = Parcel.obtain();
2094 data.writeInterfaceToken(IActivityManager.descriptor);
2095 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002096 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002097 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2098 filter.writeToParcel(data, 0);
2099 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002100 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002101 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2102 reply.readException();
2103 Intent intent = null;
2104 int haveIntent = reply.readInt();
2105 if (haveIntent != 0) {
2106 intent = Intent.CREATOR.createFromParcel(reply);
2107 }
2108 reply.recycle();
2109 data.recycle();
2110 return intent;
2111 }
2112 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2113 {
2114 Parcel data = Parcel.obtain();
2115 Parcel reply = Parcel.obtain();
2116 data.writeInterfaceToken(IActivityManager.descriptor);
2117 data.writeStrongBinder(receiver.asBinder());
2118 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2119 reply.readException();
2120 data.recycle();
2121 reply.recycle();
2122 }
2123 public int broadcastIntent(IApplicationThread caller,
2124 Intent intent, String resolvedType, IIntentReceiver resultTo,
2125 int resultCode, String resultData, Bundle map,
2126 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002127 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002128 {
2129 Parcel data = Parcel.obtain();
2130 Parcel reply = Parcel.obtain();
2131 data.writeInterfaceToken(IActivityManager.descriptor);
2132 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2133 intent.writeToParcel(data, 0);
2134 data.writeString(resolvedType);
2135 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2136 data.writeInt(resultCode);
2137 data.writeString(resultData);
2138 data.writeBundle(map);
2139 data.writeString(requiredPermission);
2140 data.writeInt(serialized ? 1 : 0);
2141 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002142 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002143 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2144 reply.readException();
2145 int res = reply.readInt();
2146 reply.recycle();
2147 data.recycle();
2148 return res;
2149 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002150 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2151 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 {
2153 Parcel data = Parcel.obtain();
2154 Parcel reply = Parcel.obtain();
2155 data.writeInterfaceToken(IActivityManager.descriptor);
2156 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2157 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002158 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002159 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2160 reply.readException();
2161 data.recycle();
2162 reply.recycle();
2163 }
2164 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2165 {
2166 Parcel data = Parcel.obtain();
2167 Parcel reply = Parcel.obtain();
2168 data.writeInterfaceToken(IActivityManager.descriptor);
2169 data.writeStrongBinder(who);
2170 data.writeInt(resultCode);
2171 data.writeString(resultData);
2172 data.writeBundle(map);
2173 data.writeInt(abortBroadcast ? 1 : 0);
2174 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2175 reply.readException();
2176 data.recycle();
2177 reply.recycle();
2178 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002179 public void attachApplication(IApplicationThread app) throws RemoteException
2180 {
2181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeStrongBinder(app.asBinder());
2185 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2186 reply.readException();
2187 data.recycle();
2188 reply.recycle();
2189 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002190 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2191 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002192 {
2193 Parcel data = Parcel.obtain();
2194 Parcel reply = Parcel.obtain();
2195 data.writeInterfaceToken(IActivityManager.descriptor);
2196 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002197 if (config != null) {
2198 data.writeInt(1);
2199 config.writeToParcel(data, 0);
2200 } else {
2201 data.writeInt(0);
2202 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002203 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002204 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2205 reply.readException();
2206 data.recycle();
2207 reply.recycle();
2208 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002209 public void activityResumed(IBinder token) throws RemoteException
2210 {
2211 Parcel data = Parcel.obtain();
2212 Parcel reply = Parcel.obtain();
2213 data.writeInterfaceToken(IActivityManager.descriptor);
2214 data.writeStrongBinder(token);
2215 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2216 reply.readException();
2217 data.recycle();
2218 reply.recycle();
2219 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002220 public void activityPaused(IBinder token) throws RemoteException
2221 {
2222 Parcel data = Parcel.obtain();
2223 Parcel reply = Parcel.obtain();
2224 data.writeInterfaceToken(IActivityManager.descriptor);
2225 data.writeStrongBinder(token);
2226 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2227 reply.readException();
2228 data.recycle();
2229 reply.recycle();
2230 }
2231 public void activityStopped(IBinder token, Bundle state,
2232 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002233 {
2234 Parcel data = Parcel.obtain();
2235 Parcel reply = Parcel.obtain();
2236 data.writeInterfaceToken(IActivityManager.descriptor);
2237 data.writeStrongBinder(token);
2238 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002239 if (thumbnail != null) {
2240 data.writeInt(1);
2241 thumbnail.writeToParcel(data, 0);
2242 } else {
2243 data.writeInt(0);
2244 }
2245 TextUtils.writeToParcel(description, data, 0);
2246 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2247 reply.readException();
2248 data.recycle();
2249 reply.recycle();
2250 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002251 public void activitySlept(IBinder token) throws RemoteException
2252 {
2253 Parcel data = Parcel.obtain();
2254 Parcel reply = Parcel.obtain();
2255 data.writeInterfaceToken(IActivityManager.descriptor);
2256 data.writeStrongBinder(token);
2257 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2258 reply.readException();
2259 data.recycle();
2260 reply.recycle();
2261 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002262 public void activityDestroyed(IBinder token) throws RemoteException
2263 {
2264 Parcel data = Parcel.obtain();
2265 Parcel reply = Parcel.obtain();
2266 data.writeInterfaceToken(IActivityManager.descriptor);
2267 data.writeStrongBinder(token);
2268 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2269 reply.readException();
2270 data.recycle();
2271 reply.recycle();
2272 }
2273 public String getCallingPackage(IBinder token) throws RemoteException
2274 {
2275 Parcel data = Parcel.obtain();
2276 Parcel reply = Parcel.obtain();
2277 data.writeInterfaceToken(IActivityManager.descriptor);
2278 data.writeStrongBinder(token);
2279 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2280 reply.readException();
2281 String res = reply.readString();
2282 data.recycle();
2283 reply.recycle();
2284 return res;
2285 }
2286 public ComponentName getCallingActivity(IBinder token)
2287 throws RemoteException {
2288 Parcel data = Parcel.obtain();
2289 Parcel reply = Parcel.obtain();
2290 data.writeInterfaceToken(IActivityManager.descriptor);
2291 data.writeStrongBinder(token);
2292 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2293 reply.readException();
2294 ComponentName res = ComponentName.readFromParcel(reply);
2295 data.recycle();
2296 reply.recycle();
2297 return res;
2298 }
2299 public List getTasks(int maxNum, int flags,
2300 IThumbnailReceiver receiver) throws RemoteException {
2301 Parcel data = Parcel.obtain();
2302 Parcel reply = Parcel.obtain();
2303 data.writeInterfaceToken(IActivityManager.descriptor);
2304 data.writeInt(maxNum);
2305 data.writeInt(flags);
2306 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2307 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2308 reply.readException();
2309 ArrayList list = null;
2310 int N = reply.readInt();
2311 if (N >= 0) {
2312 list = new ArrayList();
2313 while (N > 0) {
2314 ActivityManager.RunningTaskInfo info =
2315 ActivityManager.RunningTaskInfo.CREATOR
2316 .createFromParcel(reply);
2317 list.add(info);
2318 N--;
2319 }
2320 }
2321 data.recycle();
2322 reply.recycle();
2323 return list;
2324 }
2325 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002326 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 data.writeInt(maxNum);
2331 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002332 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002333 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2334 reply.readException();
2335 ArrayList<ActivityManager.RecentTaskInfo> list
2336 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2337 data.recycle();
2338 reply.recycle();
2339 return list;
2340 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002341 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002342 Parcel data = Parcel.obtain();
2343 Parcel reply = Parcel.obtain();
2344 data.writeInterfaceToken(IActivityManager.descriptor);
2345 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002346 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002347 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002348 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002349 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002350 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002351 }
2352 data.recycle();
2353 reply.recycle();
2354 return bm;
2355 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002356 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2357 Parcel data = Parcel.obtain();
2358 Parcel reply = Parcel.obtain();
2359 data.writeInterfaceToken(IActivityManager.descriptor);
2360 data.writeInt(id);
2361 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2362 reply.readException();
2363 Bitmap bm = null;
2364 if (reply.readInt() != 0) {
2365 bm = Bitmap.CREATOR.createFromParcel(reply);
2366 }
2367 data.recycle();
2368 reply.recycle();
2369 return bm;
2370 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002371 public List getServices(int maxNum, int flags) throws RemoteException {
2372 Parcel data = Parcel.obtain();
2373 Parcel reply = Parcel.obtain();
2374 data.writeInterfaceToken(IActivityManager.descriptor);
2375 data.writeInt(maxNum);
2376 data.writeInt(flags);
2377 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2378 reply.readException();
2379 ArrayList list = null;
2380 int N = reply.readInt();
2381 if (N >= 0) {
2382 list = new ArrayList();
2383 while (N > 0) {
2384 ActivityManager.RunningServiceInfo info =
2385 ActivityManager.RunningServiceInfo.CREATOR
2386 .createFromParcel(reply);
2387 list.add(info);
2388 N--;
2389 }
2390 }
2391 data.recycle();
2392 reply.recycle();
2393 return list;
2394 }
2395 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2396 throws RemoteException {
2397 Parcel data = Parcel.obtain();
2398 Parcel reply = Parcel.obtain();
2399 data.writeInterfaceToken(IActivityManager.descriptor);
2400 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2401 reply.readException();
2402 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2403 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2404 data.recycle();
2405 reply.recycle();
2406 return list;
2407 }
2408 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2409 throws RemoteException {
2410 Parcel data = Parcel.obtain();
2411 Parcel reply = Parcel.obtain();
2412 data.writeInterfaceToken(IActivityManager.descriptor);
2413 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2414 reply.readException();
2415 ArrayList<ActivityManager.RunningAppProcessInfo> list
2416 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2417 data.recycle();
2418 reply.recycle();
2419 return list;
2420 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002421 public List<ApplicationInfo> getRunningExternalApplications()
2422 throws RemoteException {
2423 Parcel data = Parcel.obtain();
2424 Parcel reply = Parcel.obtain();
2425 data.writeInterfaceToken(IActivityManager.descriptor);
2426 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2427 reply.readException();
2428 ArrayList<ApplicationInfo> list
2429 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2430 data.recycle();
2431 reply.recycle();
2432 return list;
2433 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002434 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002435 {
2436 Parcel data = Parcel.obtain();
2437 Parcel reply = Parcel.obtain();
2438 data.writeInterfaceToken(IActivityManager.descriptor);
2439 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002440 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002441 if (options != null) {
2442 data.writeInt(1);
2443 options.writeToParcel(data, 0);
2444 } else {
2445 data.writeInt(0);
2446 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002447 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2448 reply.readException();
2449 data.recycle();
2450 reply.recycle();
2451 }
2452 public void moveTaskToBack(int task) throws RemoteException
2453 {
2454 Parcel data = Parcel.obtain();
2455 Parcel reply = Parcel.obtain();
2456 data.writeInterfaceToken(IActivityManager.descriptor);
2457 data.writeInt(task);
2458 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2459 reply.readException();
2460 data.recycle();
2461 reply.recycle();
2462 }
2463 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2464 throws RemoteException {
2465 Parcel data = Parcel.obtain();
2466 Parcel reply = Parcel.obtain();
2467 data.writeInterfaceToken(IActivityManager.descriptor);
2468 data.writeStrongBinder(token);
2469 data.writeInt(nonRoot ? 1 : 0);
2470 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2471 reply.readException();
2472 boolean res = reply.readInt() != 0;
2473 data.recycle();
2474 reply.recycle();
2475 return res;
2476 }
2477 public void moveTaskBackwards(int task) throws RemoteException
2478 {
2479 Parcel data = Parcel.obtain();
2480 Parcel reply = Parcel.obtain();
2481 data.writeInterfaceToken(IActivityManager.descriptor);
2482 data.writeInt(task);
2483 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 data.recycle();
2486 reply.recycle();
2487 }
2488 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2489 {
2490 Parcel data = Parcel.obtain();
2491 Parcel reply = Parcel.obtain();
2492 data.writeInterfaceToken(IActivityManager.descriptor);
2493 data.writeStrongBinder(token);
2494 data.writeInt(onlyRoot ? 1 : 0);
2495 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2496 reply.readException();
2497 int res = reply.readInt();
2498 data.recycle();
2499 reply.recycle();
2500 return res;
2501 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002502 public void reportThumbnail(IBinder token,
2503 Bitmap thumbnail, CharSequence description) throws RemoteException
2504 {
2505 Parcel data = Parcel.obtain();
2506 Parcel reply = Parcel.obtain();
2507 data.writeInterfaceToken(IActivityManager.descriptor);
2508 data.writeStrongBinder(token);
2509 if (thumbnail != null) {
2510 data.writeInt(1);
2511 thumbnail.writeToParcel(data, 0);
2512 } else {
2513 data.writeInt(0);
2514 }
2515 TextUtils.writeToParcel(description, data, 0);
2516 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2517 reply.readException();
2518 data.recycle();
2519 reply.recycle();
2520 }
2521 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002522 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002523 Parcel data = Parcel.obtain();
2524 Parcel reply = Parcel.obtain();
2525 data.writeInterfaceToken(IActivityManager.descriptor);
2526 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2527 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002528 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002529 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002530 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2531 reply.readException();
2532 int res = reply.readInt();
2533 ContentProviderHolder cph = null;
2534 if (res != 0) {
2535 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2536 }
2537 data.recycle();
2538 reply.recycle();
2539 return cph;
2540 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002541 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2542 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002543 Parcel data = Parcel.obtain();
2544 Parcel reply = Parcel.obtain();
2545 data.writeInterfaceToken(IActivityManager.descriptor);
2546 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002547 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002548 data.writeStrongBinder(token);
2549 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2550 reply.readException();
2551 int res = reply.readInt();
2552 ContentProviderHolder cph = null;
2553 if (res != 0) {
2554 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2555 }
2556 data.recycle();
2557 reply.recycle();
2558 return cph;
2559 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002560 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002561 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002562 {
2563 Parcel data = Parcel.obtain();
2564 Parcel reply = Parcel.obtain();
2565 data.writeInterfaceToken(IActivityManager.descriptor);
2566 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2567 data.writeTypedList(providers);
2568 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2569 reply.readException();
2570 data.recycle();
2571 reply.recycle();
2572 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002573 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2574 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 Parcel data = Parcel.obtain();
2576 Parcel reply = Parcel.obtain();
2577 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002578 data.writeStrongBinder(connection);
2579 data.writeInt(stable);
2580 data.writeInt(unstable);
2581 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2582 reply.readException();
2583 boolean res = reply.readInt() != 0;
2584 data.recycle();
2585 reply.recycle();
2586 return res;
2587 }
2588 public void unstableProviderDied(IBinder connection) throws RemoteException {
2589 Parcel data = Parcel.obtain();
2590 Parcel reply = Parcel.obtain();
2591 data.writeInterfaceToken(IActivityManager.descriptor);
2592 data.writeStrongBinder(connection);
2593 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2594 reply.readException();
2595 data.recycle();
2596 reply.recycle();
2597 }
2598
2599 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2600 Parcel data = Parcel.obtain();
2601 Parcel reply = Parcel.obtain();
2602 data.writeInterfaceToken(IActivityManager.descriptor);
2603 data.writeStrongBinder(connection);
2604 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2606 reply.readException();
2607 data.recycle();
2608 reply.recycle();
2609 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002610
2611 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 data.writeString(name);
2616 data.writeStrongBinder(token);
2617 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2618 reply.readException();
2619 data.recycle();
2620 reply.recycle();
2621 }
2622
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002623 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2624 throws RemoteException
2625 {
2626 Parcel data = Parcel.obtain();
2627 Parcel reply = Parcel.obtain();
2628 data.writeInterfaceToken(IActivityManager.descriptor);
2629 service.writeToParcel(data, 0);
2630 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2631 reply.readException();
2632 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2633 data.recycle();
2634 reply.recycle();
2635 return res;
2636 }
2637
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002638 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002639 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2645 service.writeToParcel(data, 0);
2646 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002647 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002648 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2649 reply.readException();
2650 ComponentName res = ComponentName.readFromParcel(reply);
2651 data.recycle();
2652 reply.recycle();
2653 return res;
2654 }
2655 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002656 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002657 {
2658 Parcel data = Parcel.obtain();
2659 Parcel reply = Parcel.obtain();
2660 data.writeInterfaceToken(IActivityManager.descriptor);
2661 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2662 service.writeToParcel(data, 0);
2663 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002664 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002665 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2666 reply.readException();
2667 int res = reply.readInt();
2668 reply.recycle();
2669 data.recycle();
2670 return res;
2671 }
2672 public boolean stopServiceToken(ComponentName className, IBinder token,
2673 int startId) throws RemoteException {
2674 Parcel data = Parcel.obtain();
2675 Parcel reply = Parcel.obtain();
2676 data.writeInterfaceToken(IActivityManager.descriptor);
2677 ComponentName.writeToParcel(className, data);
2678 data.writeStrongBinder(token);
2679 data.writeInt(startId);
2680 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 boolean res = reply.readInt() != 0;
2683 data.recycle();
2684 reply.recycle();
2685 return res;
2686 }
2687 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002688 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002689 Parcel data = Parcel.obtain();
2690 Parcel reply = Parcel.obtain();
2691 data.writeInterfaceToken(IActivityManager.descriptor);
2692 ComponentName.writeToParcel(className, data);
2693 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002694 data.writeInt(id);
2695 if (notification != null) {
2696 data.writeInt(1);
2697 notification.writeToParcel(data, 0);
2698 } else {
2699 data.writeInt(0);
2700 }
2701 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002702 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2703 reply.readException();
2704 data.recycle();
2705 reply.recycle();
2706 }
2707 public int bindService(IApplicationThread caller, IBinder token,
2708 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002709 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002710 Parcel data = Parcel.obtain();
2711 Parcel reply = Parcel.obtain();
2712 data.writeInterfaceToken(IActivityManager.descriptor);
2713 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2714 data.writeStrongBinder(token);
2715 service.writeToParcel(data, 0);
2716 data.writeString(resolvedType);
2717 data.writeStrongBinder(connection.asBinder());
2718 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002719 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002720 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2721 reply.readException();
2722 int res = reply.readInt();
2723 data.recycle();
2724 reply.recycle();
2725 return res;
2726 }
2727 public boolean unbindService(IServiceConnection connection) throws RemoteException
2728 {
2729 Parcel data = Parcel.obtain();
2730 Parcel reply = Parcel.obtain();
2731 data.writeInterfaceToken(IActivityManager.descriptor);
2732 data.writeStrongBinder(connection.asBinder());
2733 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2734 reply.readException();
2735 boolean res = reply.readInt() != 0;
2736 data.recycle();
2737 reply.recycle();
2738 return res;
2739 }
2740
2741 public void publishService(IBinder token,
2742 Intent intent, IBinder service) throws RemoteException {
2743 Parcel data = Parcel.obtain();
2744 Parcel reply = Parcel.obtain();
2745 data.writeInterfaceToken(IActivityManager.descriptor);
2746 data.writeStrongBinder(token);
2747 intent.writeToParcel(data, 0);
2748 data.writeStrongBinder(service);
2749 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2750 reply.readException();
2751 data.recycle();
2752 reply.recycle();
2753 }
2754
2755 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2756 throws RemoteException {
2757 Parcel data = Parcel.obtain();
2758 Parcel reply = Parcel.obtain();
2759 data.writeInterfaceToken(IActivityManager.descriptor);
2760 data.writeStrongBinder(token);
2761 intent.writeToParcel(data, 0);
2762 data.writeInt(doRebind ? 1 : 0);
2763 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2764 reply.readException();
2765 data.recycle();
2766 reply.recycle();
2767 }
2768
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002769 public void serviceDoneExecuting(IBinder token, int type, int startId,
2770 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
2773 data.writeInterfaceToken(IActivityManager.descriptor);
2774 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002775 data.writeInt(type);
2776 data.writeInt(startId);
2777 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002778 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2779 reply.readException();
2780 data.recycle();
2781 reply.recycle();
2782 }
2783
2784 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
2787 data.writeInterfaceToken(IActivityManager.descriptor);
2788 service.writeToParcel(data, 0);
2789 data.writeString(resolvedType);
2790 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2791 reply.readException();
2792 IBinder binder = reply.readStrongBinder();
2793 reply.recycle();
2794 data.recycle();
2795 return binder;
2796 }
2797
Christopher Tate181fafa2009-05-14 11:12:14 -07002798 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2799 throws RemoteException {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 app.writeToParcel(data, 0);
2804 data.writeInt(backupRestoreMode);
2805 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2806 reply.readException();
2807 boolean success = reply.readInt() != 0;
2808 reply.recycle();
2809 data.recycle();
2810 return success;
2811 }
2812
Christopher Tate346acb12012-10-15 19:20:25 -07002813 public void clearPendingBackup() throws RemoteException {
2814 Parcel data = Parcel.obtain();
2815 Parcel reply = Parcel.obtain();
2816 data.writeInterfaceToken(IActivityManager.descriptor);
2817 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
2818 reply.recycle();
2819 data.recycle();
2820 }
2821
Christopher Tate181fafa2009-05-14 11:12:14 -07002822 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2823 Parcel data = Parcel.obtain();
2824 Parcel reply = Parcel.obtain();
2825 data.writeInterfaceToken(IActivityManager.descriptor);
2826 data.writeString(packageName);
2827 data.writeStrongBinder(agent);
2828 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2829 reply.recycle();
2830 data.recycle();
2831 }
2832
2833 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2834 Parcel data = Parcel.obtain();
2835 Parcel reply = Parcel.obtain();
2836 data.writeInterfaceToken(IActivityManager.descriptor);
2837 app.writeToParcel(data, 0);
2838 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2839 reply.readException();
2840 reply.recycle();
2841 data.recycle();
2842 }
2843
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002844 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002845 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002846 throws RemoteException {
2847 Parcel data = Parcel.obtain();
2848 Parcel reply = Parcel.obtain();
2849 data.writeInterfaceToken(IActivityManager.descriptor);
2850 ComponentName.writeToParcel(className, data);
2851 data.writeString(profileFile);
2852 data.writeInt(flags);
2853 data.writeBundle(arguments);
2854 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002855 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002856 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2857 reply.readException();
2858 boolean res = reply.readInt() != 0;
2859 reply.recycle();
2860 data.recycle();
2861 return res;
2862 }
2863
2864 public void finishInstrumentation(IApplicationThread target,
2865 int resultCode, Bundle results) throws RemoteException {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
2868 data.writeInterfaceToken(IActivityManager.descriptor);
2869 data.writeStrongBinder(target != null ? target.asBinder() : null);
2870 data.writeInt(resultCode);
2871 data.writeBundle(results);
2872 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 data.recycle();
2875 reply.recycle();
2876 }
2877 public Configuration getConfiguration() throws RemoteException
2878 {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
2882 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2883 reply.readException();
2884 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2885 reply.recycle();
2886 data.recycle();
2887 return res;
2888 }
2889 public void updateConfiguration(Configuration values) throws RemoteException
2890 {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 values.writeToParcel(data, 0);
2895 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2896 reply.readException();
2897 data.recycle();
2898 reply.recycle();
2899 }
2900 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2901 throws RemoteException {
2902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeStrongBinder(token);
2906 data.writeInt(requestedOrientation);
2907 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2908 reply.readException();
2909 data.recycle();
2910 reply.recycle();
2911 }
2912 public int getRequestedOrientation(IBinder token) throws RemoteException {
2913 Parcel data = Parcel.obtain();
2914 Parcel reply = Parcel.obtain();
2915 data.writeInterfaceToken(IActivityManager.descriptor);
2916 data.writeStrongBinder(token);
2917 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2918 reply.readException();
2919 int res = reply.readInt();
2920 data.recycle();
2921 reply.recycle();
2922 return res;
2923 }
2924 public ComponentName getActivityClassForToken(IBinder token)
2925 throws RemoteException {
2926 Parcel data = Parcel.obtain();
2927 Parcel reply = Parcel.obtain();
2928 data.writeInterfaceToken(IActivityManager.descriptor);
2929 data.writeStrongBinder(token);
2930 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 ComponentName res = ComponentName.readFromParcel(reply);
2933 data.recycle();
2934 reply.recycle();
2935 return res;
2936 }
2937 public String getPackageForToken(IBinder token) throws RemoteException
2938 {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeStrongBinder(token);
2943 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 String res = reply.readString();
2946 data.recycle();
2947 reply.recycle();
2948 return res;
2949 }
2950 public IIntentSender getIntentSender(int type,
2951 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002952 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002953 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeInt(type);
2958 data.writeString(packageName);
2959 data.writeStrongBinder(token);
2960 data.writeString(resultWho);
2961 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002962 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002963 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002964 data.writeTypedArray(intents, 0);
2965 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 } else {
2967 data.writeInt(0);
2968 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002969 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002970 if (options != null) {
2971 data.writeInt(1);
2972 options.writeToParcel(data, 0);
2973 } else {
2974 data.writeInt(0);
2975 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002976 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2978 reply.readException();
2979 IIntentSender res = IIntentSender.Stub.asInterface(
2980 reply.readStrongBinder());
2981 data.recycle();
2982 reply.recycle();
2983 return res;
2984 }
2985 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2986 Parcel data = Parcel.obtain();
2987 Parcel reply = Parcel.obtain();
2988 data.writeInterfaceToken(IActivityManager.descriptor);
2989 data.writeStrongBinder(sender.asBinder());
2990 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2991 reply.readException();
2992 data.recycle();
2993 reply.recycle();
2994 }
2995 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
2999 data.writeStrongBinder(sender.asBinder());
3000 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3001 reply.readException();
3002 String res = reply.readString();
3003 data.recycle();
3004 reply.recycle();
3005 return res;
3006 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003007 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3008 Parcel data = Parcel.obtain();
3009 Parcel reply = Parcel.obtain();
3010 data.writeInterfaceToken(IActivityManager.descriptor);
3011 data.writeStrongBinder(sender.asBinder());
3012 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3013 reply.readException();
3014 int res = reply.readInt();
3015 data.recycle();
3016 reply.recycle();
3017 return res;
3018 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003019 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3020 boolean requireFull, String name, String callerPackage) throws RemoteException {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeInt(callingPid);
3025 data.writeInt(callingUid);
3026 data.writeInt(userId);
3027 data.writeInt(allowAll ? 1 : 0);
3028 data.writeInt(requireFull ? 1 : 0);
3029 data.writeString(name);
3030 data.writeString(callerPackage);
3031 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3032 reply.readException();
3033 int res = reply.readInt();
3034 data.recycle();
3035 reply.recycle();
3036 return res;
3037 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 public void setProcessLimit(int max) throws RemoteException
3039 {
3040 Parcel data = Parcel.obtain();
3041 Parcel reply = Parcel.obtain();
3042 data.writeInterfaceToken(IActivityManager.descriptor);
3043 data.writeInt(max);
3044 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3045 reply.readException();
3046 data.recycle();
3047 reply.recycle();
3048 }
3049 public int getProcessLimit() throws RemoteException
3050 {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3055 reply.readException();
3056 int res = reply.readInt();
3057 data.recycle();
3058 reply.recycle();
3059 return res;
3060 }
3061 public void setProcessForeground(IBinder token, int pid,
3062 boolean isForeground) throws RemoteException {
3063 Parcel data = Parcel.obtain();
3064 Parcel reply = Parcel.obtain();
3065 data.writeInterfaceToken(IActivityManager.descriptor);
3066 data.writeStrongBinder(token);
3067 data.writeInt(pid);
3068 data.writeInt(isForeground ? 1 : 0);
3069 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3070 reply.readException();
3071 data.recycle();
3072 reply.recycle();
3073 }
3074 public int checkPermission(String permission, int pid, int uid)
3075 throws RemoteException {
3076 Parcel data = Parcel.obtain();
3077 Parcel reply = Parcel.obtain();
3078 data.writeInterfaceToken(IActivityManager.descriptor);
3079 data.writeString(permission);
3080 data.writeInt(pid);
3081 data.writeInt(uid);
3082 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 int res = reply.readInt();
3085 data.recycle();
3086 reply.recycle();
3087 return res;
3088 }
3089 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003090 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 data.writeString(packageName);
3095 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07003096 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003097 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3098 reply.readException();
3099 boolean res = reply.readInt() != 0;
3100 data.recycle();
3101 reply.recycle();
3102 return res;
3103 }
3104 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3105 throws RemoteException {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 uri.writeToParcel(data, 0);
3110 data.writeInt(pid);
3111 data.writeInt(uid);
3112 data.writeInt(mode);
3113 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3114 reply.readException();
3115 int res = reply.readInt();
3116 data.recycle();
3117 reply.recycle();
3118 return res;
3119 }
3120 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3121 Uri uri, int mode) throws RemoteException {
3122 Parcel data = Parcel.obtain();
3123 Parcel reply = Parcel.obtain();
3124 data.writeInterfaceToken(IActivityManager.descriptor);
3125 data.writeStrongBinder(caller.asBinder());
3126 data.writeString(targetPkg);
3127 uri.writeToParcel(data, 0);
3128 data.writeInt(mode);
3129 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 data.recycle();
3132 reply.recycle();
3133 }
3134 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3135 int mode) throws RemoteException {
3136 Parcel data = Parcel.obtain();
3137 Parcel reply = Parcel.obtain();
3138 data.writeInterfaceToken(IActivityManager.descriptor);
3139 data.writeStrongBinder(caller.asBinder());
3140 uri.writeToParcel(data, 0);
3141 data.writeInt(mode);
3142 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3143 reply.readException();
3144 data.recycle();
3145 reply.recycle();
3146 }
3147 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3148 throws RemoteException {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeStrongBinder(who.asBinder());
3153 data.writeInt(waiting ? 1 : 0);
3154 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3155 reply.readException();
3156 data.recycle();
3157 reply.recycle();
3158 }
3159 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3160 Parcel data = Parcel.obtain();
3161 Parcel reply = Parcel.obtain();
3162 data.writeInterfaceToken(IActivityManager.descriptor);
3163 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3164 reply.readException();
3165 outInfo.readFromParcel(reply);
3166 data.recycle();
3167 reply.recycle();
3168 }
3169 public void unhandledBack() throws RemoteException
3170 {
3171 Parcel data = Parcel.obtain();
3172 Parcel reply = Parcel.obtain();
3173 data.writeInterfaceToken(IActivityManager.descriptor);
3174 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3175 reply.readException();
3176 data.recycle();
3177 reply.recycle();
3178 }
3179 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3180 {
3181 Parcel data = Parcel.obtain();
3182 Parcel reply = Parcel.obtain();
3183 data.writeInterfaceToken(IActivityManager.descriptor);
3184 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3185 reply.readException();
3186 ParcelFileDescriptor pfd = null;
3187 if (reply.readInt() != 0) {
3188 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3189 }
3190 data.recycle();
3191 reply.recycle();
3192 return pfd;
3193 }
3194 public void goingToSleep() throws RemoteException
3195 {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3200 reply.readException();
3201 data.recycle();
3202 reply.recycle();
3203 }
3204 public void wakingUp() throws RemoteException
3205 {
3206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
3209 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3210 reply.readException();
3211 data.recycle();
3212 reply.recycle();
3213 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003214 public void setLockScreenShown(boolean shown) throws RemoteException
3215 {
3216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 data.writeInt(shown ? 1 : 0);
3220 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3221 reply.readException();
3222 data.recycle();
3223 reply.recycle();
3224 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 public void setDebugApp(
3226 String packageName, boolean waitForDebugger, boolean persistent)
3227 throws RemoteException
3228 {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeString(packageName);
3233 data.writeInt(waitForDebugger ? 1 : 0);
3234 data.writeInt(persistent ? 1 : 0);
3235 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3236 reply.readException();
3237 data.recycle();
3238 reply.recycle();
3239 }
3240 public void setAlwaysFinish(boolean enabled) throws RemoteException
3241 {
3242 Parcel data = Parcel.obtain();
3243 Parcel reply = Parcel.obtain();
3244 data.writeInterfaceToken(IActivityManager.descriptor);
3245 data.writeInt(enabled ? 1 : 0);
3246 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 data.recycle();
3249 reply.recycle();
3250 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003251 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003252 {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003257 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003258 reply.readException();
3259 data.recycle();
3260 reply.recycle();
3261 }
3262 public void enterSafeMode() throws RemoteException {
3263 Parcel data = Parcel.obtain();
3264 data.writeInterfaceToken(IActivityManager.descriptor);
3265 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3266 data.recycle();
3267 }
3268 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3269 Parcel data = Parcel.obtain();
3270 data.writeStrongBinder(sender.asBinder());
3271 data.writeInterfaceToken(IActivityManager.descriptor);
3272 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3273 data.recycle();
3274 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003275 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003276 Parcel data = Parcel.obtain();
3277 Parcel reply = Parcel.obtain();
3278 data.writeInterfaceToken(IActivityManager.descriptor);
3279 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003280 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003281 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003282 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003283 boolean res = reply.readInt() != 0;
3284 data.recycle();
3285 reply.recycle();
3286 return res;
3287 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003288 @Override
3289 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3290 Parcel data = Parcel.obtain();
3291 Parcel reply = Parcel.obtain();
3292 data.writeInterfaceToken(IActivityManager.descriptor);
3293 data.writeString(reason);
3294 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3295 boolean res = reply.readInt() != 0;
3296 data.recycle();
3297 reply.recycle();
3298 return res;
3299 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003300 public void startRunning(String pkg, String cls, String action,
3301 String indata) throws RemoteException {
3302 Parcel data = Parcel.obtain();
3303 Parcel reply = Parcel.obtain();
3304 data.writeInterfaceToken(IActivityManager.descriptor);
3305 data.writeString(pkg);
3306 data.writeString(cls);
3307 data.writeString(action);
3308 data.writeString(indata);
3309 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3310 reply.readException();
3311 data.recycle();
3312 reply.recycle();
3313 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 public boolean testIsSystemReady()
3315 {
3316 /* this base class version is never called */
3317 return true;
3318 }
Dan Egnor60d87622009-12-16 16:32:58 -08003319 public void handleApplicationCrash(IBinder app,
3320 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3321 {
3322 Parcel data = Parcel.obtain();
3323 Parcel reply = Parcel.obtain();
3324 data.writeInterfaceToken(IActivityManager.descriptor);
3325 data.writeStrongBinder(app);
3326 crashInfo.writeToParcel(data, 0);
3327 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 reply.recycle();
3330 data.recycle();
3331 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003332
Dan Egnor60d87622009-12-16 16:32:58 -08003333 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003334 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003340 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003341 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003342 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003343 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003344 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003345 reply.recycle();
3346 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003347 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003349
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003350 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003351 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003352 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003353 {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003358 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003359 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003360 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3361 reply.readException();
3362 reply.recycle();
3363 data.recycle();
3364 }
3365
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003366 public void signalPersistentProcesses(int sig) throws RemoteException {
3367 Parcel data = Parcel.obtain();
3368 Parcel reply = Parcel.obtain();
3369 data.writeInterfaceToken(IActivityManager.descriptor);
3370 data.writeInt(sig);
3371 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3372 reply.readException();
3373 data.recycle();
3374 reply.recycle();
3375 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003376
Dianne Hackborn1676c852012-09-10 14:52:30 -07003377 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003378 Parcel data = Parcel.obtain();
3379 Parcel reply = Parcel.obtain();
3380 data.writeInterfaceToken(IActivityManager.descriptor);
3381 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003382 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003383 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3384 reply.readException();
3385 data.recycle();
3386 reply.recycle();
3387 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003388
3389 public void killAllBackgroundProcesses() throws RemoteException {
3390 Parcel data = Parcel.obtain();
3391 Parcel reply = Parcel.obtain();
3392 data.writeInterfaceToken(IActivityManager.descriptor);
3393 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3394 reply.readException();
3395 data.recycle();
3396 reply.recycle();
3397 }
3398
Dianne Hackborn1676c852012-09-10 14:52:30 -07003399 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003400 Parcel data = Parcel.obtain();
3401 Parcel reply = Parcel.obtain();
3402 data.writeInterfaceToken(IActivityManager.descriptor);
3403 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003404 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003405 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003406 reply.readException();
3407 data.recycle();
3408 reply.recycle();
3409 }
3410
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003411 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3412 throws RemoteException
3413 {
3414 Parcel data = Parcel.obtain();
3415 Parcel reply = Parcel.obtain();
3416 data.writeInterfaceToken(IActivityManager.descriptor);
3417 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 outInfo.readFromParcel(reply);
3420 reply.recycle();
3421 data.recycle();
3422 }
3423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003424 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3425 {
3426 Parcel data = Parcel.obtain();
3427 Parcel reply = Parcel.obtain();
3428 data.writeInterfaceToken(IActivityManager.descriptor);
3429 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3430 reply.readException();
3431 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3432 reply.recycle();
3433 data.recycle();
3434 return res;
3435 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003436
Dianne Hackborn1676c852012-09-10 14:52:30 -07003437 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003438 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003439 {
3440 Parcel data = Parcel.obtain();
3441 Parcel reply = Parcel.obtain();
3442 data.writeInterfaceToken(IActivityManager.descriptor);
3443 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003444 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003445 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003446 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003447 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003448 if (fd != null) {
3449 data.writeInt(1);
3450 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3451 } else {
3452 data.writeInt(0);
3453 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003454 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3455 reply.readException();
3456 boolean res = reply.readInt() != 0;
3457 reply.recycle();
3458 data.recycle();
3459 return res;
3460 }
3461
Dianne Hackborn55280a92009-05-07 15:53:46 -07003462 public boolean shutdown(int timeout) throws RemoteException
3463 {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeInt(timeout);
3468 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3469 reply.readException();
3470 boolean res = reply.readInt() != 0;
3471 reply.recycle();
3472 data.recycle();
3473 return res;
3474 }
3475
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003476 public void stopAppSwitches() throws RemoteException {
3477 Parcel data = Parcel.obtain();
3478 Parcel reply = Parcel.obtain();
3479 data.writeInterfaceToken(IActivityManager.descriptor);
3480 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 reply.recycle();
3483 data.recycle();
3484 }
3485
3486 public void resumeAppSwitches() throws RemoteException {
3487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3491 reply.readException();
3492 reply.recycle();
3493 data.recycle();
3494 }
3495
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003496 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003497 Parcel data = Parcel.obtain();
3498 Parcel reply = Parcel.obtain();
3499 data.writeInterfaceToken(IActivityManager.descriptor);
3500 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003501 data.writeInt(appid);
3502 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003503 reply.readException();
3504 data.recycle();
3505 reply.recycle();
3506 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003507
3508 public void closeSystemDialogs(String reason) throws RemoteException {
3509 Parcel data = Parcel.obtain();
3510 Parcel reply = Parcel.obtain();
3511 data.writeInterfaceToken(IActivityManager.descriptor);
3512 data.writeString(reason);
3513 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3514 reply.readException();
3515 data.recycle();
3516 reply.recycle();
3517 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003518
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003519 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003520 throws RemoteException {
3521 Parcel data = Parcel.obtain();
3522 Parcel reply = Parcel.obtain();
3523 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003524 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003525 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3526 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003527 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003528 data.recycle();
3529 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003530 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003531 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003532
3533 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 data.writeString(processName);
3538 data.writeInt(uid);
3539 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3540 reply.readException();
3541 data.recycle();
3542 reply.recycle();
3543 }
3544
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003545 public void overridePendingTransition(IBinder token, String packageName,
3546 int enterAnim, int exitAnim) throws RemoteException {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 data.writeStrongBinder(token);
3551 data.writeString(packageName);
3552 data.writeInt(enterAnim);
3553 data.writeInt(exitAnim);
3554 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3555 reply.readException();
3556 data.recycle();
3557 reply.recycle();
3558 }
3559
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003560 public boolean isUserAMonkey() throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3565 reply.readException();
3566 boolean res = reply.readInt() != 0;
3567 data.recycle();
3568 reply.recycle();
3569 return res;
3570 }
3571
Dianne Hackborn860755f2010-06-03 18:47:52 -07003572 public void finishHeavyWeightApp() throws RemoteException {
3573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
3576 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3577 reply.readException();
3578 data.recycle();
3579 reply.recycle();
3580 }
3581
Daniel Sandler69a48172010-06-23 16:29:36 -04003582 public void setImmersive(IBinder token, boolean immersive)
3583 throws RemoteException {
3584 Parcel data = Parcel.obtain();
3585 Parcel reply = Parcel.obtain();
3586 data.writeInterfaceToken(IActivityManager.descriptor);
3587 data.writeStrongBinder(token);
3588 data.writeInt(immersive ? 1 : 0);
3589 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3590 reply.readException();
3591 data.recycle();
3592 reply.recycle();
3593 }
3594
3595 public boolean isImmersive(IBinder token)
3596 throws RemoteException {
3597 Parcel data = Parcel.obtain();
3598 Parcel reply = Parcel.obtain();
3599 data.writeInterfaceToken(IActivityManager.descriptor);
3600 data.writeStrongBinder(token);
3601 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003602 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003603 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003604 data.recycle();
3605 reply.recycle();
3606 return res;
3607 }
3608
3609 public boolean isTopActivityImmersive()
3610 throws RemoteException {
3611 Parcel data = Parcel.obtain();
3612 Parcel reply = Parcel.obtain();
3613 data.writeInterfaceToken(IActivityManager.descriptor);
3614 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003615 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003616 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003617 data.recycle();
3618 reply.recycle();
3619 return res;
3620 }
3621
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003622 public void crashApplication(int uid, int initialPid, String packageName,
3623 String message) throws RemoteException {
3624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 data.writeInt(uid);
3628 data.writeInt(initialPid);
3629 data.writeString(packageName);
3630 data.writeString(message);
3631 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3632 reply.readException();
3633 data.recycle();
3634 reply.recycle();
3635 }
Andy McFadden824c5102010-07-09 16:26:57 -07003636
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003637 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003642 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003643 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3644 reply.readException();
3645 String res = reply.readString();
3646 data.recycle();
3647 reply.recycle();
3648 return res;
3649 }
3650
Dianne Hackborn7e269642010-08-25 19:50:20 -07003651 public IBinder newUriPermissionOwner(String name)
3652 throws RemoteException {
3653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeString(name);
3657 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3658 reply.readException();
3659 IBinder res = reply.readStrongBinder();
3660 data.recycle();
3661 reply.recycle();
3662 return res;
3663 }
3664
3665 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3666 Uri uri, int mode) throws RemoteException {
3667 Parcel data = Parcel.obtain();
3668 Parcel reply = Parcel.obtain();
3669 data.writeInterfaceToken(IActivityManager.descriptor);
3670 data.writeStrongBinder(owner);
3671 data.writeInt(fromUid);
3672 data.writeString(targetPkg);
3673 uri.writeToParcel(data, 0);
3674 data.writeInt(mode);
3675 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3676 reply.readException();
3677 data.recycle();
3678 reply.recycle();
3679 }
3680
3681 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3682 int mode) throws RemoteException {
3683 Parcel data = Parcel.obtain();
3684 Parcel reply = Parcel.obtain();
3685 data.writeInterfaceToken(IActivityManager.descriptor);
3686 data.writeStrongBinder(owner);
3687 if (uri != null) {
3688 data.writeInt(1);
3689 uri.writeToParcel(data, 0);
3690 } else {
3691 data.writeInt(0);
3692 }
3693 data.writeInt(mode);
3694 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3695 reply.readException();
3696 data.recycle();
3697 reply.recycle();
3698 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003699
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003700 public int checkGrantUriPermission(int callingUid, String targetPkg,
3701 Uri uri, int modeFlags) throws RemoteException {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 data.writeInt(callingUid);
3706 data.writeString(targetPkg);
3707 uri.writeToParcel(data, 0);
3708 data.writeInt(modeFlags);
3709 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 int res = reply.readInt();
3712 data.recycle();
3713 reply.recycle();
3714 return res;
3715 }
3716
Dianne Hackborn1676c852012-09-10 14:52:30 -07003717 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003718 String path, ParcelFileDescriptor fd) throws RemoteException {
3719 Parcel data = Parcel.obtain();
3720 Parcel reply = Parcel.obtain();
3721 data.writeInterfaceToken(IActivityManager.descriptor);
3722 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003723 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003724 data.writeInt(managed ? 1 : 0);
3725 data.writeString(path);
3726 if (fd != null) {
3727 data.writeInt(1);
3728 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3729 } else {
3730 data.writeInt(0);
3731 }
3732 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3733 reply.readException();
3734 boolean res = reply.readInt() != 0;
3735 reply.recycle();
3736 data.recycle();
3737 return res;
3738 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003739
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003740 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003741 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003742 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3747 data.writeTypedArray(intents, 0);
3748 data.writeStringArray(resolvedTypes);
3749 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003750 if (options != null) {
3751 data.writeInt(1);
3752 options.writeToParcel(data, 0);
3753 } else {
3754 data.writeInt(0);
3755 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07003756 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003757 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3758 reply.readException();
3759 int result = reply.readInt();
3760 reply.recycle();
3761 data.recycle();
3762 return result;
3763 }
3764
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003765 public int getFrontActivityScreenCompatMode() throws RemoteException {
3766 Parcel data = Parcel.obtain();
3767 Parcel reply = Parcel.obtain();
3768 data.writeInterfaceToken(IActivityManager.descriptor);
3769 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3770 reply.readException();
3771 int mode = reply.readInt();
3772 reply.recycle();
3773 data.recycle();
3774 return mode;
3775 }
3776
3777 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3778 Parcel data = Parcel.obtain();
3779 Parcel reply = Parcel.obtain();
3780 data.writeInterfaceToken(IActivityManager.descriptor);
3781 data.writeInt(mode);
3782 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3783 reply.readException();
3784 reply.recycle();
3785 data.recycle();
3786 }
3787
3788 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3789 Parcel data = Parcel.obtain();
3790 Parcel reply = Parcel.obtain();
3791 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003792 data.writeString(packageName);
3793 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003794 reply.readException();
3795 int mode = reply.readInt();
3796 reply.recycle();
3797 data.recycle();
3798 return mode;
3799 }
3800
3801 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003802 throws RemoteException {
3803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003807 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003808 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3809 reply.readException();
3810 reply.recycle();
3811 data.recycle();
3812 }
3813
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003814 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 data.writeString(packageName);
3819 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3820 reply.readException();
3821 boolean ask = reply.readInt() != 0;
3822 reply.recycle();
3823 data.recycle();
3824 return ask;
3825 }
3826
3827 public void setPackageAskScreenCompat(String packageName, boolean ask)
3828 throws RemoteException {
3829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeString(packageName);
3833 data.writeInt(ask ? 1 : 0);
3834 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3835 reply.readException();
3836 reply.recycle();
3837 data.recycle();
3838 }
3839
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003840 public boolean switchUser(int userid) throws RemoteException {
3841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeInt(userid);
3845 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3846 reply.readException();
3847 boolean result = reply.readInt() != 0;
3848 reply.recycle();
3849 data.recycle();
3850 return result;
3851 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003852
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003853 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3854 Parcel data = Parcel.obtain();
3855 Parcel reply = Parcel.obtain();
3856 data.writeInterfaceToken(IActivityManager.descriptor);
3857 data.writeInt(userid);
3858 data.writeStrongInterface(callback);
3859 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3860 reply.readException();
3861 int result = reply.readInt();
3862 reply.recycle();
3863 data.recycle();
3864 return result;
3865 }
3866
Amith Yamasani52f1d752012-03-28 18:19:29 -07003867 public UserInfo getCurrentUser() throws RemoteException {
3868 Parcel data = Parcel.obtain();
3869 Parcel reply = Parcel.obtain();
3870 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003871 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003872 reply.readException();
3873 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3874 reply.recycle();
3875 data.recycle();
3876 return userInfo;
3877 }
3878
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003879 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003880 Parcel data = Parcel.obtain();
3881 Parcel reply = Parcel.obtain();
3882 data.writeInterfaceToken(IActivityManager.descriptor);
3883 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07003884 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003885 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3886 reply.readException();
3887 boolean result = reply.readInt() != 0;
3888 reply.recycle();
3889 data.recycle();
3890 return result;
3891 }
3892
Dianne Hackbornc72fc672012-09-20 13:12:03 -07003893 public int[] getRunningUserIds() throws RemoteException {
3894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
3898 reply.readException();
3899 int[] result = reply.createIntArray();
3900 reply.recycle();
3901 data.recycle();
3902 return result;
3903 }
3904
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003905 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3906 Parcel data = Parcel.obtain();
3907 Parcel reply = Parcel.obtain();
3908 data.writeInterfaceToken(IActivityManager.descriptor);
3909 data.writeInt(taskId);
3910 data.writeInt(subTaskIndex);
3911 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 boolean result = reply.readInt() != 0;
3914 reply.recycle();
3915 data.recycle();
3916 return result;
3917 }
3918
3919 public boolean removeTask(int taskId, int flags) throws RemoteException {
3920 Parcel data = Parcel.obtain();
3921 Parcel reply = Parcel.obtain();
3922 data.writeInterfaceToken(IActivityManager.descriptor);
3923 data.writeInt(taskId);
3924 data.writeInt(flags);
3925 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 boolean result = reply.readInt() != 0;
3928 reply.recycle();
3929 data.recycle();
3930 return result;
3931 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003932
Jeff Sharkeya4620792011-05-20 15:29:23 -07003933 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3934 Parcel data = Parcel.obtain();
3935 Parcel reply = Parcel.obtain();
3936 data.writeInterfaceToken(IActivityManager.descriptor);
3937 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3938 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3939 reply.readException();
3940 data.recycle();
3941 reply.recycle();
3942 }
3943
3944 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3945 Parcel data = Parcel.obtain();
3946 Parcel reply = Parcel.obtain();
3947 data.writeInterfaceToken(IActivityManager.descriptor);
3948 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3949 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3950 reply.readException();
3951 data.recycle();
3952 reply.recycle();
3953 }
3954
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003955 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3956 Parcel data = Parcel.obtain();
3957 Parcel reply = Parcel.obtain();
3958 data.writeInterfaceToken(IActivityManager.descriptor);
3959 data.writeStrongBinder(sender.asBinder());
3960 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3961 reply.readException();
3962 boolean res = reply.readInt() != 0;
3963 data.recycle();
3964 reply.recycle();
3965 return res;
3966 }
3967
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003968 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3969 Parcel data = Parcel.obtain();
3970 Parcel reply = Parcel.obtain();
3971 data.writeInterfaceToken(IActivityManager.descriptor);
3972 data.writeStrongBinder(sender.asBinder());
3973 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3974 reply.readException();
3975 boolean res = reply.readInt() != 0;
3976 data.recycle();
3977 reply.recycle();
3978 return res;
3979 }
3980
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003981 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3982 {
3983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 values.writeToParcel(data, 0);
3987 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3988 reply.readException();
3989 data.recycle();
3990 reply.recycle();
3991 }
3992
Dianne Hackbornb437e092011-08-05 17:50:29 -07003993 public long[] getProcessPss(int[] pids) throws RemoteException {
3994 Parcel data = Parcel.obtain();
3995 Parcel reply = Parcel.obtain();
3996 data.writeInterfaceToken(IActivityManager.descriptor);
3997 data.writeIntArray(pids);
3998 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3999 reply.readException();
4000 long[] res = reply.createLongArray();
4001 data.recycle();
4002 reply.recycle();
4003 return res;
4004 }
4005
Dianne Hackborn661cd522011-08-22 00:26:20 -07004006 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4007 Parcel data = Parcel.obtain();
4008 Parcel reply = Parcel.obtain();
4009 data.writeInterfaceToken(IActivityManager.descriptor);
4010 TextUtils.writeToParcel(msg, data, 0);
4011 data.writeInt(always ? 1 : 0);
4012 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4013 reply.readException();
4014 data.recycle();
4015 reply.recycle();
4016 }
4017
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004018 public void dismissKeyguardOnNextActivity() throws RemoteException {
4019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
4022 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4023 reply.readException();
4024 data.recycle();
4025 reply.recycle();
4026 }
4027
Adam Powelldd8fab22012-03-22 17:47:27 -07004028 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4029 throws RemoteException {
4030 Parcel data = Parcel.obtain();
4031 Parcel reply = Parcel.obtain();
4032 data.writeInterfaceToken(IActivityManager.descriptor);
4033 data.writeStrongBinder(token);
4034 data.writeString(destAffinity);
4035 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4036 reply.readException();
4037 boolean result = reply.readInt() != 0;
4038 data.recycle();
4039 reply.recycle();
4040 return result;
4041 }
4042
4043 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4044 throws RemoteException {
4045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 data.writeStrongBinder(token);
4049 target.writeToParcel(data, 0);
4050 data.writeInt(resultCode);
4051 if (resultData != null) {
4052 data.writeInt(1);
4053 resultData.writeToParcel(data, 0);
4054 } else {
4055 data.writeInt(0);
4056 }
4057 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4058 reply.readException();
4059 boolean result = reply.readInt() != 0;
4060 data.recycle();
4061 reply.recycle();
4062 return result;
4063 }
4064
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004065 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4066 Parcel data = Parcel.obtain();
4067 Parcel reply = Parcel.obtain();
4068 data.writeInterfaceToken(IActivityManager.descriptor);
4069 data.writeStrongBinder(activityToken);
4070 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4071 reply.readException();
4072 int result = reply.readInt();
4073 data.recycle();
4074 reply.recycle();
4075 return result;
4076 }
4077
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004078 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4083 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4084 reply.readException();
4085 data.recycle();
4086 reply.recycle();
4087 }
4088
4089 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4094 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 data.recycle();
4097 reply.recycle();
4098 }
4099
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004100 public void requestBugReport() throws RemoteException {
4101 Parcel data = Parcel.obtain();
4102 Parcel reply = Parcel.obtain();
4103 data.writeInterfaceToken(IActivityManager.descriptor);
4104 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4105 reply.readException();
4106 data.recycle();
4107 reply.recycle();
4108 }
4109
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004110 public long inputDispatchingTimedOut(int pid, boolean aboveSystem) throws RemoteException {
4111 Parcel data = Parcel.obtain();
4112 Parcel reply = Parcel.obtain();
4113 data.writeInterfaceToken(IActivityManager.descriptor);
4114 data.writeInt(pid);
4115 data.writeInt(aboveSystem ? 1 : 0);
4116 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4117 reply.readException();
4118 long res = reply.readInt();
4119 data.recycle();
4120 reply.recycle();
4121 return res;
4122 }
4123
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004124 private IBinder mRemote;
4125}