blob: bf77f6e995c01fa0ab5e10c564f6e73b889334f0 [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
407 case ACTIVITY_PAUSED_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800410 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 reply.writeNoException();
412 return true;
413 }
414
415 case ACTIVITY_STOPPED_TRANSACTION: {
416 data.enforceInterface(IActivityManager.descriptor);
417 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800418 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800419 Bitmap thumbnail = data.readInt() != 0
420 ? Bitmap.CREATOR.createFromParcel(data) : null;
421 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800422 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 reply.writeNoException();
424 return true;
425 }
426
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800427 case ACTIVITY_SLEPT_TRANSACTION: {
428 data.enforceInterface(IActivityManager.descriptor);
429 IBinder token = data.readStrongBinder();
430 activitySlept(token);
431 reply.writeNoException();
432 return true;
433 }
434
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800435 case ACTIVITY_DESTROYED_TRANSACTION: {
436 data.enforceInterface(IActivityManager.descriptor);
437 IBinder token = data.readStrongBinder();
438 activityDestroyed(token);
439 reply.writeNoException();
440 return true;
441 }
442
443 case GET_CALLING_PACKAGE_TRANSACTION: {
444 data.enforceInterface(IActivityManager.descriptor);
445 IBinder token = data.readStrongBinder();
446 String res = token != null ? getCallingPackage(token) : null;
447 reply.writeNoException();
448 reply.writeString(res);
449 return true;
450 }
451
452 case GET_CALLING_ACTIVITY_TRANSACTION: {
453 data.enforceInterface(IActivityManager.descriptor);
454 IBinder token = data.readStrongBinder();
455 ComponentName cn = getCallingActivity(token);
456 reply.writeNoException();
457 ComponentName.writeToParcel(cn, reply);
458 return true;
459 }
460
461 case GET_TASKS_TRANSACTION: {
462 data.enforceInterface(IActivityManager.descriptor);
463 int maxNum = data.readInt();
464 int fl = data.readInt();
465 IBinder receiverBinder = data.readStrongBinder();
466 IThumbnailReceiver receiver = receiverBinder != null
467 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
468 : null;
469 List list = getTasks(maxNum, fl, receiver);
470 reply.writeNoException();
471 int N = list != null ? list.size() : -1;
472 reply.writeInt(N);
473 int i;
474 for (i=0; i<N; i++) {
475 ActivityManager.RunningTaskInfo info =
476 (ActivityManager.RunningTaskInfo)list.get(i);
477 info.writeToParcel(reply, 0);
478 }
479 return true;
480 }
481
482 case GET_RECENT_TASKS_TRANSACTION: {
483 data.enforceInterface(IActivityManager.descriptor);
484 int maxNum = data.readInt();
485 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700486 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700488 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800489 reply.writeNoException();
490 reply.writeTypedList(list);
491 return true;
492 }
493
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700494 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800495 data.enforceInterface(IActivityManager.descriptor);
496 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700497 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800498 reply.writeNoException();
499 if (bm != null) {
500 reply.writeInt(1);
501 bm.writeToParcel(reply, 0);
502 } else {
503 reply.writeInt(0);
504 }
505 return true;
506 }
507
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800508 case GET_SERVICES_TRANSACTION: {
509 data.enforceInterface(IActivityManager.descriptor);
510 int maxNum = data.readInt();
511 int fl = data.readInt();
512 List list = getServices(maxNum, fl);
513 reply.writeNoException();
514 int N = list != null ? list.size() : -1;
515 reply.writeInt(N);
516 int i;
517 for (i=0; i<N; i++) {
518 ActivityManager.RunningServiceInfo info =
519 (ActivityManager.RunningServiceInfo)list.get(i);
520 info.writeToParcel(reply, 0);
521 }
522 return true;
523 }
524
525 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
526 data.enforceInterface(IActivityManager.descriptor);
527 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
528 reply.writeNoException();
529 reply.writeTypedList(list);
530 return true;
531 }
532
533 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
534 data.enforceInterface(IActivityManager.descriptor);
535 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
536 reply.writeNoException();
537 reply.writeTypedList(list);
538 return true;
539 }
540
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700541 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
542 data.enforceInterface(IActivityManager.descriptor);
543 List<ApplicationInfo> list = getRunningExternalApplications();
544 reply.writeNoException();
545 reply.writeTypedList(list);
546 return true;
547 }
548
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 case MOVE_TASK_TO_FRONT_TRANSACTION: {
550 data.enforceInterface(IActivityManager.descriptor);
551 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800552 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700553 Bundle options = data.readInt() != 0
554 ? Bundle.CREATOR.createFromParcel(data) : null;
555 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800556 reply.writeNoException();
557 return true;
558 }
559
560 case MOVE_TASK_TO_BACK_TRANSACTION: {
561 data.enforceInterface(IActivityManager.descriptor);
562 int task = data.readInt();
563 moveTaskToBack(task);
564 reply.writeNoException();
565 return true;
566 }
567
568 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
569 data.enforceInterface(IActivityManager.descriptor);
570 IBinder token = data.readStrongBinder();
571 boolean nonRoot = data.readInt() != 0;
572 boolean res = moveActivityTaskToBack(token, nonRoot);
573 reply.writeNoException();
574 reply.writeInt(res ? 1 : 0);
575 return true;
576 }
577
578 case MOVE_TASK_BACKWARDS_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 int task = data.readInt();
581 moveTaskBackwards(task);
582 reply.writeNoException();
583 return true;
584 }
585
586 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
587 data.enforceInterface(IActivityManager.descriptor);
588 IBinder token = data.readStrongBinder();
589 boolean onlyRoot = data.readInt() != 0;
590 int res = token != null
591 ? getTaskForActivity(token, onlyRoot) : -1;
592 reply.writeNoException();
593 reply.writeInt(res);
594 return true;
595 }
596
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800597 case REPORT_THUMBNAIL_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 IBinder token = data.readStrongBinder();
600 Bitmap thumbnail = data.readInt() != 0
601 ? Bitmap.CREATOR.createFromParcel(data) : null;
602 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
603 reportThumbnail(token, thumbnail, description);
604 reply.writeNoException();
605 return true;
606 }
607
608 case GET_CONTENT_PROVIDER_TRANSACTION: {
609 data.enforceInterface(IActivityManager.descriptor);
610 IBinder b = data.readStrongBinder();
611 IApplicationThread app = ApplicationThreadNative.asInterface(b);
612 String name = data.readString();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700613 boolean stable = data.readInt() != 0;
614 ContentProviderHolder cph = getContentProvider(app, name, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800615 reply.writeNoException();
616 if (cph != null) {
617 reply.writeInt(1);
618 cph.writeToParcel(reply, 0);
619 } else {
620 reply.writeInt(0);
621 }
622 return true;
623 }
624
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800625 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 String name = data.readString();
628 IBinder token = data.readStrongBinder();
629 ContentProviderHolder cph = getContentProviderExternal(name, token);
630 reply.writeNoException();
631 if (cph != null) {
632 reply.writeInt(1);
633 cph.writeToParcel(reply, 0);
634 } else {
635 reply.writeInt(0);
636 }
637 return true;
638 }
639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
641 data.enforceInterface(IActivityManager.descriptor);
642 IBinder b = data.readStrongBinder();
643 IApplicationThread app = ApplicationThreadNative.asInterface(b);
644 ArrayList<ContentProviderHolder> providers =
645 data.createTypedArrayList(ContentProviderHolder.CREATOR);
646 publishContentProviders(app, providers);
647 reply.writeNoException();
648 return true;
649 }
650
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700651 case REF_CONTENT_PROVIDER_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 IBinder b = data.readStrongBinder();
654 int stable = data.readInt();
655 int unstable = data.readInt();
656 boolean res = refContentProvider(b, stable, unstable);
657 reply.writeNoException();
658 reply.writeInt(res ? 1 : 0);
659 return true;
660 }
661
662 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
663 data.enforceInterface(IActivityManager.descriptor);
664 IBinder b = data.readStrongBinder();
665 unstableProviderDied(b);
666 reply.writeNoException();
667 return true;
668 }
669
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800670 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
671 data.enforceInterface(IActivityManager.descriptor);
672 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700673 boolean stable = data.readInt() != 0;
674 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800675 reply.writeNoException();
676 return true;
677 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800678
679 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
680 data.enforceInterface(IActivityManager.descriptor);
681 String name = data.readString();
682 IBinder token = data.readStrongBinder();
683 removeContentProviderExternal(name, token);
684 reply.writeNoException();
685 return true;
686 }
687
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700688 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
689 data.enforceInterface(IActivityManager.descriptor);
690 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
691 PendingIntent pi = getRunningServiceControlPanel(comp);
692 reply.writeNoException();
693 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
694 return true;
695 }
696
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 case START_SERVICE_TRANSACTION: {
698 data.enforceInterface(IActivityManager.descriptor);
699 IBinder b = data.readStrongBinder();
700 IApplicationThread app = ApplicationThreadNative.asInterface(b);
701 Intent service = Intent.CREATOR.createFromParcel(data);
702 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700703 int userId = data.readInt();
704 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 reply.writeNoException();
706 ComponentName.writeToParcel(cn, reply);
707 return true;
708 }
709
710 case STOP_SERVICE_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 IBinder b = data.readStrongBinder();
713 IApplicationThread app = ApplicationThreadNative.asInterface(b);
714 Intent service = Intent.CREATOR.createFromParcel(data);
715 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700716 int userId = data.readInt();
717 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800718 reply.writeNoException();
719 reply.writeInt(res);
720 return true;
721 }
722
723 case STOP_SERVICE_TOKEN_TRANSACTION: {
724 data.enforceInterface(IActivityManager.descriptor);
725 ComponentName className = ComponentName.readFromParcel(data);
726 IBinder token = data.readStrongBinder();
727 int startId = data.readInt();
728 boolean res = stopServiceToken(className, token, startId);
729 reply.writeNoException();
730 reply.writeInt(res ? 1 : 0);
731 return true;
732 }
733
734 case SET_SERVICE_FOREGROUND_TRANSACTION: {
735 data.enforceInterface(IActivityManager.descriptor);
736 ComponentName className = ComponentName.readFromParcel(data);
737 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700738 int id = data.readInt();
739 Notification notification = null;
740 if (data.readInt() != 0) {
741 notification = Notification.CREATOR.createFromParcel(data);
742 }
743 boolean removeNotification = data.readInt() != 0;
744 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800745 reply.writeNoException();
746 return true;
747 }
748
749 case BIND_SERVICE_TRANSACTION: {
750 data.enforceInterface(IActivityManager.descriptor);
751 IBinder b = data.readStrongBinder();
752 IApplicationThread app = ApplicationThreadNative.asInterface(b);
753 IBinder token = data.readStrongBinder();
754 Intent service = Intent.CREATOR.createFromParcel(data);
755 String resolvedType = data.readString();
756 b = data.readStrongBinder();
757 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800758 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800760 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800761 reply.writeNoException();
762 reply.writeInt(res);
763 return true;
764 }
765
766 case UNBIND_SERVICE_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 IBinder b = data.readStrongBinder();
769 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
770 boolean res = unbindService(conn);
771 reply.writeNoException();
772 reply.writeInt(res ? 1 : 0);
773 return true;
774 }
775
776 case PUBLISH_SERVICE_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder token = data.readStrongBinder();
779 Intent intent = Intent.CREATOR.createFromParcel(data);
780 IBinder service = data.readStrongBinder();
781 publishService(token, intent, service);
782 reply.writeNoException();
783 return true;
784 }
785
786 case UNBIND_FINISHED_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder token = data.readStrongBinder();
789 Intent intent = Intent.CREATOR.createFromParcel(data);
790 boolean doRebind = data.readInt() != 0;
791 unbindFinished(token, intent, doRebind);
792 reply.writeNoException();
793 return true;
794 }
795
796 case SERVICE_DONE_EXECUTING_TRANSACTION: {
797 data.enforceInterface(IActivityManager.descriptor);
798 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700799 int type = data.readInt();
800 int startId = data.readInt();
801 int res = data.readInt();
802 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 reply.writeNoException();
804 return true;
805 }
806
807 case START_INSTRUMENTATION_TRANSACTION: {
808 data.enforceInterface(IActivityManager.descriptor);
809 ComponentName className = ComponentName.readFromParcel(data);
810 String profileFile = data.readString();
811 int fl = data.readInt();
812 Bundle arguments = data.readBundle();
813 IBinder b = data.readStrongBinder();
814 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700815 int userId = data.readInt();
816 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800817 reply.writeNoException();
818 reply.writeInt(res ? 1 : 0);
819 return true;
820 }
821
822
823 case FINISH_INSTRUMENTATION_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 IBinder b = data.readStrongBinder();
826 IApplicationThread app = ApplicationThreadNative.asInterface(b);
827 int resultCode = data.readInt();
828 Bundle results = data.readBundle();
829 finishInstrumentation(app, resultCode, results);
830 reply.writeNoException();
831 return true;
832 }
833
834 case GET_CONFIGURATION_TRANSACTION: {
835 data.enforceInterface(IActivityManager.descriptor);
836 Configuration config = getConfiguration();
837 reply.writeNoException();
838 config.writeToParcel(reply, 0);
839 return true;
840 }
841
842 case UPDATE_CONFIGURATION_TRANSACTION: {
843 data.enforceInterface(IActivityManager.descriptor);
844 Configuration config = Configuration.CREATOR.createFromParcel(data);
845 updateConfiguration(config);
846 reply.writeNoException();
847 return true;
848 }
849
850 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
851 data.enforceInterface(IActivityManager.descriptor);
852 IBinder token = data.readStrongBinder();
853 int requestedOrientation = data.readInt();
854 setRequestedOrientation(token, requestedOrientation);
855 reply.writeNoException();
856 return true;
857 }
858
859 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
860 data.enforceInterface(IActivityManager.descriptor);
861 IBinder token = data.readStrongBinder();
862 int req = getRequestedOrientation(token);
863 reply.writeNoException();
864 reply.writeInt(req);
865 return true;
866 }
867
868 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
869 data.enforceInterface(IActivityManager.descriptor);
870 IBinder token = data.readStrongBinder();
871 ComponentName cn = getActivityClassForToken(token);
872 reply.writeNoException();
873 ComponentName.writeToParcel(cn, reply);
874 return true;
875 }
876
877 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
878 data.enforceInterface(IActivityManager.descriptor);
879 IBinder token = data.readStrongBinder();
880 reply.writeNoException();
881 reply.writeString(getPackageForToken(token));
882 return true;
883 }
884
885 case GET_INTENT_SENDER_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 int type = data.readInt();
888 String packageName = data.readString();
889 IBinder token = data.readStrongBinder();
890 String resultWho = data.readString();
891 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800892 Intent[] requestIntents;
893 String[] requestResolvedTypes;
894 if (data.readInt() != 0) {
895 requestIntents = data.createTypedArray(Intent.CREATOR);
896 requestResolvedTypes = data.createStringArray();
897 } else {
898 requestIntents = null;
899 requestResolvedTypes = null;
900 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700902 Bundle options = data.readInt() != 0
903 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700904 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800906 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700907 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeStrongBinder(res != null ? res.asBinder() : null);
910 return true;
911 }
912
913 case CANCEL_INTENT_SENDER_TRANSACTION: {
914 data.enforceInterface(IActivityManager.descriptor);
915 IIntentSender r = IIntentSender.Stub.asInterface(
916 data.readStrongBinder());
917 cancelIntentSender(r);
918 reply.writeNoException();
919 return true;
920 }
921
922 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
923 data.enforceInterface(IActivityManager.descriptor);
924 IIntentSender r = IIntentSender.Stub.asInterface(
925 data.readStrongBinder());
926 String res = getPackageForIntentSender(r);
927 reply.writeNoException();
928 reply.writeString(res);
929 return true;
930 }
931
Christopher Tatec4a07d12012-04-06 14:19:13 -0700932 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
933 data.enforceInterface(IActivityManager.descriptor);
934 IIntentSender r = IIntentSender.Stub.asInterface(
935 data.readStrongBinder());
936 int res = getUidForIntentSender(r);
937 reply.writeNoException();
938 reply.writeInt(res);
939 return true;
940 }
941
Dianne Hackborn41203752012-08-31 14:05:51 -0700942 case HANDLE_INCOMING_USER_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 int callingPid = data.readInt();
945 int callingUid = data.readInt();
946 int userId = data.readInt();
947 boolean allowAll = data.readInt() != 0 ;
948 boolean requireFull = data.readInt() != 0;
949 String name = data.readString();
950 String callerPackage = data.readString();
951 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
952 requireFull, name, callerPackage);
953 reply.writeNoException();
954 reply.writeInt(res);
955 return true;
956 }
957
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800958 case SET_PROCESS_LIMIT_TRANSACTION: {
959 data.enforceInterface(IActivityManager.descriptor);
960 int max = data.readInt();
961 setProcessLimit(max);
962 reply.writeNoException();
963 return true;
964 }
965
966 case GET_PROCESS_LIMIT_TRANSACTION: {
967 data.enforceInterface(IActivityManager.descriptor);
968 int limit = getProcessLimit();
969 reply.writeNoException();
970 reply.writeInt(limit);
971 return true;
972 }
973
974 case SET_PROCESS_FOREGROUND_TRANSACTION: {
975 data.enforceInterface(IActivityManager.descriptor);
976 IBinder token = data.readStrongBinder();
977 int pid = data.readInt();
978 boolean isForeground = data.readInt() != 0;
979 setProcessForeground(token, pid, isForeground);
980 reply.writeNoException();
981 return true;
982 }
983
984 case CHECK_PERMISSION_TRANSACTION: {
985 data.enforceInterface(IActivityManager.descriptor);
986 String perm = data.readString();
987 int pid = data.readInt();
988 int uid = data.readInt();
989 int res = checkPermission(perm, pid, uid);
990 reply.writeNoException();
991 reply.writeInt(res);
992 return true;
993 }
994
995 case CHECK_URI_PERMISSION_TRANSACTION: {
996 data.enforceInterface(IActivityManager.descriptor);
997 Uri uri = Uri.CREATOR.createFromParcel(data);
998 int pid = data.readInt();
999 int uid = data.readInt();
1000 int mode = data.readInt();
1001 int res = checkUriPermission(uri, pid, uid, mode);
1002 reply.writeNoException();
1003 reply.writeInt(res);
1004 return true;
1005 }
1006
1007 case CLEAR_APP_DATA_TRANSACTION: {
1008 data.enforceInterface(IActivityManager.descriptor);
1009 String packageName = data.readString();
1010 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1011 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001012 int userId = data.readInt();
1013 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001014 reply.writeNoException();
1015 reply.writeInt(res ? 1 : 0);
1016 return true;
1017 }
1018
1019 case GRANT_URI_PERMISSION_TRANSACTION: {
1020 data.enforceInterface(IActivityManager.descriptor);
1021 IBinder b = data.readStrongBinder();
1022 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1023 String targetPkg = data.readString();
1024 Uri uri = Uri.CREATOR.createFromParcel(data);
1025 int mode = data.readInt();
1026 grantUriPermission(app, targetPkg, uri, mode);
1027 reply.writeNoException();
1028 return true;
1029 }
1030
1031 case REVOKE_URI_PERMISSION_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 IBinder b = data.readStrongBinder();
1034 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1035 Uri uri = Uri.CREATOR.createFromParcel(data);
1036 int mode = data.readInt();
1037 revokeUriPermission(app, uri, mode);
1038 reply.writeNoException();
1039 return true;
1040 }
1041
1042 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 IBinder b = data.readStrongBinder();
1045 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1046 boolean waiting = data.readInt() != 0;
1047 showWaitingForDebugger(app, waiting);
1048 reply.writeNoException();
1049 return true;
1050 }
1051
1052 case GET_MEMORY_INFO_TRANSACTION: {
1053 data.enforceInterface(IActivityManager.descriptor);
1054 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1055 getMemoryInfo(mi);
1056 reply.writeNoException();
1057 mi.writeToParcel(reply, 0);
1058 return true;
1059 }
1060
1061 case UNHANDLED_BACK_TRANSACTION: {
1062 data.enforceInterface(IActivityManager.descriptor);
1063 unhandledBack();
1064 reply.writeNoException();
1065 return true;
1066 }
1067
1068 case OPEN_CONTENT_URI_TRANSACTION: {
1069 data.enforceInterface(IActivityManager.descriptor);
1070 Uri uri = Uri.parse(data.readString());
1071 ParcelFileDescriptor pfd = openContentUri(uri);
1072 reply.writeNoException();
1073 if (pfd != null) {
1074 reply.writeInt(1);
1075 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1076 } else {
1077 reply.writeInt(0);
1078 }
1079 return true;
1080 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001081
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001082 case GOING_TO_SLEEP_TRANSACTION: {
1083 data.enforceInterface(IActivityManager.descriptor);
1084 goingToSleep();
1085 reply.writeNoException();
1086 return true;
1087 }
1088
1089 case WAKING_UP_TRANSACTION: {
1090 data.enforceInterface(IActivityManager.descriptor);
1091 wakingUp();
1092 reply.writeNoException();
1093 return true;
1094 }
1095
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001096 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1097 data.enforceInterface(IActivityManager.descriptor);
1098 setLockScreenShown(data.readInt() != 0);
1099 reply.writeNoException();
1100 return true;
1101 }
1102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001103 case SET_DEBUG_APP_TRANSACTION: {
1104 data.enforceInterface(IActivityManager.descriptor);
1105 String pn = data.readString();
1106 boolean wfd = data.readInt() != 0;
1107 boolean per = data.readInt() != 0;
1108 setDebugApp(pn, wfd, per);
1109 reply.writeNoException();
1110 return true;
1111 }
1112
1113 case SET_ALWAYS_FINISH_TRANSACTION: {
1114 data.enforceInterface(IActivityManager.descriptor);
1115 boolean enabled = data.readInt() != 0;
1116 setAlwaysFinish(enabled);
1117 reply.writeNoException();
1118 return true;
1119 }
1120
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001121 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001123 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001124 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001125 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001126 return true;
1127 }
1128
1129 case ENTER_SAFE_MODE_TRANSACTION: {
1130 data.enforceInterface(IActivityManager.descriptor);
1131 enterSafeMode();
1132 reply.writeNoException();
1133 return true;
1134 }
1135
1136 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1137 data.enforceInterface(IActivityManager.descriptor);
1138 IIntentSender is = IIntentSender.Stub.asInterface(
1139 data.readStrongBinder());
1140 noteWakeupAlarm(is);
1141 reply.writeNoException();
1142 return true;
1143 }
1144
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001145 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001146 data.enforceInterface(IActivityManager.descriptor);
1147 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001148 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001149 boolean secure = data.readInt() != 0;
1150 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 reply.writeNoException();
1152 reply.writeInt(res ? 1 : 0);
1153 return true;
1154 }
1155
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001156 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1157 data.enforceInterface(IActivityManager.descriptor);
1158 String reason = data.readString();
1159 boolean res = killProcessesBelowForeground(reason);
1160 reply.writeNoException();
1161 reply.writeInt(res ? 1 : 0);
1162 return true;
1163 }
1164
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001165 case START_RUNNING_TRANSACTION: {
1166 data.enforceInterface(IActivityManager.descriptor);
1167 String pkg = data.readString();
1168 String cls = data.readString();
1169 String action = data.readString();
1170 String indata = data.readString();
1171 startRunning(pkg, cls, action, indata);
1172 reply.writeNoException();
1173 return true;
1174 }
1175
Dan Egnor60d87622009-12-16 16:32:58 -08001176 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1177 data.enforceInterface(IActivityManager.descriptor);
1178 IBinder app = data.readStrongBinder();
1179 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1180 handleApplicationCrash(app, ci);
1181 reply.writeNoException();
1182 return true;
1183 }
1184
1185 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001186 data.enforceInterface(IActivityManager.descriptor);
1187 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001189 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001190 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001191 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001192 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001193 return true;
1194 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001195
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001196 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1197 data.enforceInterface(IActivityManager.descriptor);
1198 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001199 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001200 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1201 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001202 reply.writeNoException();
1203 return true;
1204 }
1205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1207 data.enforceInterface(IActivityManager.descriptor);
1208 int sig = data.readInt();
1209 signalPersistentProcesses(sig);
1210 reply.writeNoException();
1211 return true;
1212 }
1213
Dianne Hackborn03abb812010-01-04 18:43:19 -08001214 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1215 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001217 int userId = data.readInt();
1218 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001219 reply.writeNoException();
1220 return true;
1221 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001222
1223 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1224 data.enforceInterface(IActivityManager.descriptor);
1225 killAllBackgroundProcesses();
1226 reply.writeNoException();
1227 return true;
1228 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001229
1230 case FORCE_STOP_PACKAGE_TRANSACTION: {
1231 data.enforceInterface(IActivityManager.descriptor);
1232 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001233 int userId = data.readInt();
1234 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 reply.writeNoException();
1236 return true;
1237 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001238
1239 case GET_MY_MEMORY_STATE_TRANSACTION: {
1240 data.enforceInterface(IActivityManager.descriptor);
1241 ActivityManager.RunningAppProcessInfo info =
1242 new ActivityManager.RunningAppProcessInfo();
1243 getMyMemoryState(info);
1244 reply.writeNoException();
1245 info.writeToParcel(reply, 0);
1246 return true;
1247 }
1248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001249 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1250 data.enforceInterface(IActivityManager.descriptor);
1251 ConfigurationInfo config = getDeviceConfigurationInfo();
1252 reply.writeNoException();
1253 config.writeToParcel(reply, 0);
1254 return true;
1255 }
1256
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001257 case PROFILE_CONTROL_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001260 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001261 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001262 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001263 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001264 ParcelFileDescriptor fd = data.readInt() != 0
1265 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001266 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001267 reply.writeNoException();
1268 reply.writeInt(res ? 1 : 0);
1269 return true;
1270 }
1271
Dianne Hackborn55280a92009-05-07 15:53:46 -07001272 case SHUTDOWN_TRANSACTION: {
1273 data.enforceInterface(IActivityManager.descriptor);
1274 boolean res = shutdown(data.readInt());
1275 reply.writeNoException();
1276 reply.writeInt(res ? 1 : 0);
1277 return true;
1278 }
1279
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001280 case STOP_APP_SWITCHES_TRANSACTION: {
1281 data.enforceInterface(IActivityManager.descriptor);
1282 stopAppSwitches();
1283 reply.writeNoException();
1284 return true;
1285 }
1286
1287 case RESUME_APP_SWITCHES_TRANSACTION: {
1288 data.enforceInterface(IActivityManager.descriptor);
1289 resumeAppSwitches();
1290 reply.writeNoException();
1291 return true;
1292 }
1293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 case PEEK_SERVICE_TRANSACTION: {
1295 data.enforceInterface(IActivityManager.descriptor);
1296 Intent service = Intent.CREATOR.createFromParcel(data);
1297 String resolvedType = data.readString();
1298 IBinder binder = peekService(service, resolvedType);
1299 reply.writeNoException();
1300 reply.writeStrongBinder(binder);
1301 return true;
1302 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001303
1304 case START_BACKUP_AGENT_TRANSACTION: {
1305 data.enforceInterface(IActivityManager.descriptor);
1306 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1307 int backupRestoreMode = data.readInt();
1308 boolean success = bindBackupAgent(info, backupRestoreMode);
1309 reply.writeNoException();
1310 reply.writeInt(success ? 1 : 0);
1311 return true;
1312 }
1313
1314 case BACKUP_AGENT_CREATED_TRANSACTION: {
1315 data.enforceInterface(IActivityManager.descriptor);
1316 String packageName = data.readString();
1317 IBinder agent = data.readStrongBinder();
1318 backupAgentCreated(packageName, agent);
1319 reply.writeNoException();
1320 return true;
1321 }
1322
1323 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1324 data.enforceInterface(IActivityManager.descriptor);
1325 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1326 unbindBackupAgent(info);
1327 reply.writeNoException();
1328 return true;
1329 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001330
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001331 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001332 data.enforceInterface(IActivityManager.descriptor);
1333 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001334 int appid = data.readInt();
1335 killApplicationWithAppId(pkg, appid);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001336 reply.writeNoException();
1337 return true;
1338 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001339
1340 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1341 data.enforceInterface(IActivityManager.descriptor);
1342 String reason = data.readString();
1343 closeSystemDialogs(reason);
1344 reply.writeNoException();
1345 return true;
1346 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001347
1348 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1349 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001350 int[] pids = data.createIntArray();
1351 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001352 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001353 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001354 return true;
1355 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001356
1357 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1358 data.enforceInterface(IActivityManager.descriptor);
1359 String processName = data.readString();
1360 int uid = data.readInt();
1361 killApplicationProcess(processName, uid);
1362 reply.writeNoException();
1363 return true;
1364 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001365
1366 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1367 data.enforceInterface(IActivityManager.descriptor);
1368 IBinder token = data.readStrongBinder();
1369 String packageName = data.readString();
1370 int enterAnim = data.readInt();
1371 int exitAnim = data.readInt();
1372 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001373 reply.writeNoException();
1374 return true;
1375 }
1376
1377 case IS_USER_A_MONKEY_TRANSACTION: {
1378 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001379 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001380 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001381 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001382 return true;
1383 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001384
1385 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1386 data.enforceInterface(IActivityManager.descriptor);
1387 finishHeavyWeightApp();
1388 reply.writeNoException();
1389 return true;
1390 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001391
1392 case IS_IMMERSIVE_TRANSACTION: {
1393 data.enforceInterface(IActivityManager.descriptor);
1394 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001395 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001396 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001397 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001398 return true;
1399 }
1400
1401 case SET_IMMERSIVE_TRANSACTION: {
1402 data.enforceInterface(IActivityManager.descriptor);
1403 IBinder token = data.readStrongBinder();
1404 boolean imm = data.readInt() == 1;
1405 setImmersive(token, imm);
1406 reply.writeNoException();
1407 return true;
1408 }
1409
1410 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001412 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001413 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001414 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001415 return true;
1416 }
1417
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001418 case CRASH_APPLICATION_TRANSACTION: {
1419 data.enforceInterface(IActivityManager.descriptor);
1420 int uid = data.readInt();
1421 int initialPid = data.readInt();
1422 String packageName = data.readString();
1423 String message = data.readString();
1424 crashApplication(uid, initialPid, packageName, message);
1425 reply.writeNoException();
1426 return true;
1427 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001428
1429 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1430 data.enforceInterface(IActivityManager.descriptor);
1431 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001432 int userId = data.readInt();
1433 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001434 reply.writeNoException();
1435 reply.writeString(type);
1436 return true;
1437 }
1438
Dianne Hackborn7e269642010-08-25 19:50:20 -07001439 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1440 data.enforceInterface(IActivityManager.descriptor);
1441 String name = data.readString();
1442 IBinder perm = newUriPermissionOwner(name);
1443 reply.writeNoException();
1444 reply.writeStrongBinder(perm);
1445 return true;
1446 }
1447
1448 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1449 data.enforceInterface(IActivityManager.descriptor);
1450 IBinder owner = data.readStrongBinder();
1451 int fromUid = data.readInt();
1452 String targetPkg = data.readString();
1453 Uri uri = Uri.CREATOR.createFromParcel(data);
1454 int mode = data.readInt();
1455 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1456 reply.writeNoException();
1457 return true;
1458 }
1459
1460 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1461 data.enforceInterface(IActivityManager.descriptor);
1462 IBinder owner = data.readStrongBinder();
1463 Uri uri = null;
1464 if (data.readInt() != 0) {
1465 Uri.CREATOR.createFromParcel(data);
1466 }
1467 int mode = data.readInt();
1468 revokeUriPermissionFromOwner(owner, uri, mode);
1469 reply.writeNoException();
1470 return true;
1471 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001472
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001473 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 int callingUid = data.readInt();
1476 String targetPkg = data.readString();
1477 Uri uri = Uri.CREATOR.createFromParcel(data);
1478 int modeFlags = data.readInt();
1479 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1480 reply.writeNoException();
1481 reply.writeInt(res);
1482 return true;
1483 }
1484
Andy McFadden824c5102010-07-09 16:26:57 -07001485 case DUMP_HEAP_TRANSACTION: {
1486 data.enforceInterface(IActivityManager.descriptor);
1487 String process = data.readString();
1488 boolean managed = data.readInt() != 0;
1489 String path = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001490 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001491 ParcelFileDescriptor fd = data.readInt() != 0
1492 ? data.readFileDescriptor() : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001493 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001494 reply.writeNoException();
1495 reply.writeInt(res ? 1 : 0);
1496 return true;
1497 }
1498
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001499 case START_ACTIVITIES_TRANSACTION:
1500 {
1501 data.enforceInterface(IActivityManager.descriptor);
1502 IBinder b = data.readStrongBinder();
1503 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1504 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1505 String[] resolvedTypes = data.createStringArray();
1506 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001507 Bundle options = data.readInt() != 0
1508 ? Bundle.CREATOR.createFromParcel(data) : null;
1509 int result = startActivities(app, intents, resolvedTypes, resultTo,
1510 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001511 reply.writeNoException();
1512 reply.writeInt(result);
1513 return true;
1514 }
1515
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001516 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1517 {
1518 data.enforceInterface(IActivityManager.descriptor);
1519 int mode = getFrontActivityScreenCompatMode();
1520 reply.writeNoException();
1521 reply.writeInt(mode);
1522 return true;
1523 }
1524
1525 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1526 {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 int mode = data.readInt();
1529 setFrontActivityScreenCompatMode(mode);
1530 reply.writeNoException();
1531 reply.writeInt(mode);
1532 return true;
1533 }
1534
1535 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1536 {
1537 data.enforceInterface(IActivityManager.descriptor);
1538 String pkg = data.readString();
1539 int mode = getPackageScreenCompatMode(pkg);
1540 reply.writeNoException();
1541 reply.writeInt(mode);
1542 return true;
1543 }
1544
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001545 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1546 {
1547 data.enforceInterface(IActivityManager.descriptor);
1548 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001549 int mode = data.readInt();
1550 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001551 reply.writeNoException();
1552 return true;
1553 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001554
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001555 case SWITCH_USER_TRANSACTION: {
1556 data.enforceInterface(IActivityManager.descriptor);
1557 int userid = data.readInt();
1558 boolean result = switchUser(userid);
1559 reply.writeNoException();
1560 reply.writeInt(result ? 1 : 0);
1561 return true;
1562 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001563
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001564 case STOP_USER_TRANSACTION: {
1565 data.enforceInterface(IActivityManager.descriptor);
1566 int userid = data.readInt();
1567 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1568 data.readStrongBinder());
1569 int result = stopUser(userid, callback);
1570 reply.writeNoException();
1571 reply.writeInt(result);
1572 return true;
1573 }
1574
Amith Yamasani52f1d752012-03-28 18:19:29 -07001575 case GET_CURRENT_USER_TRANSACTION: {
1576 data.enforceInterface(IActivityManager.descriptor);
1577 UserInfo userInfo = getCurrentUser();
1578 reply.writeNoException();
1579 userInfo.writeToParcel(reply, 0);
1580 return true;
1581 }
1582
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001583 case IS_USER_RUNNING_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 int userid = data.readInt();
1586 boolean result = isUserRunning(userid);
1587 reply.writeNoException();
1588 reply.writeInt(result ? 1 : 0);
1589 return true;
1590 }
1591
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001592 case REMOVE_SUB_TASK_TRANSACTION:
1593 {
1594 data.enforceInterface(IActivityManager.descriptor);
1595 int taskId = data.readInt();
1596 int subTaskIndex = data.readInt();
1597 boolean result = removeSubTask(taskId, subTaskIndex);
1598 reply.writeNoException();
1599 reply.writeInt(result ? 1 : 0);
1600 return true;
1601 }
1602
1603 case REMOVE_TASK_TRANSACTION:
1604 {
1605 data.enforceInterface(IActivityManager.descriptor);
1606 int taskId = data.readInt();
1607 int fl = data.readInt();
1608 boolean result = removeTask(taskId, fl);
1609 reply.writeNoException();
1610 reply.writeInt(result ? 1 : 0);
1611 return true;
1612 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001613
Jeff Sharkeya4620792011-05-20 15:29:23 -07001614 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1617 data.readStrongBinder());
1618 registerProcessObserver(observer);
1619 return true;
1620 }
1621
1622 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1623 data.enforceInterface(IActivityManager.descriptor);
1624 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1625 data.readStrongBinder());
1626 unregisterProcessObserver(observer);
1627 return true;
1628 }
1629
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001630 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1631 {
1632 data.enforceInterface(IActivityManager.descriptor);
1633 String pkg = data.readString();
1634 boolean ask = getPackageAskScreenCompat(pkg);
1635 reply.writeNoException();
1636 reply.writeInt(ask ? 1 : 0);
1637 return true;
1638 }
1639
1640 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1641 {
1642 data.enforceInterface(IActivityManager.descriptor);
1643 String pkg = data.readString();
1644 boolean ask = data.readInt() != 0;
1645 setPackageAskScreenCompat(pkg, ask);
1646 reply.writeNoException();
1647 return true;
1648 }
1649
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001650 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1651 data.enforceInterface(IActivityManager.descriptor);
1652 IIntentSender r = IIntentSender.Stub.asInterface(
1653 data.readStrongBinder());
1654 boolean res = isIntentSenderTargetedToPackage(r);
1655 reply.writeNoException();
1656 reply.writeInt(res ? 1 : 0);
1657 return true;
1658 }
1659
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001660 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1661 data.enforceInterface(IActivityManager.descriptor);
1662 IIntentSender r = IIntentSender.Stub.asInterface(
1663 data.readStrongBinder());
1664 boolean res = isIntentSenderAnActivity(r);
1665 reply.writeNoException();
1666 reply.writeInt(res ? 1 : 0);
1667 return true;
1668 }
1669
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001670 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1671 data.enforceInterface(IActivityManager.descriptor);
1672 Configuration config = Configuration.CREATOR.createFromParcel(data);
1673 updatePersistentConfiguration(config);
1674 reply.writeNoException();
1675 return true;
1676 }
1677
Dianne Hackbornb437e092011-08-05 17:50:29 -07001678 case GET_PROCESS_PSS_TRANSACTION: {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 int[] pids = data.createIntArray();
1681 long[] pss = getProcessPss(pids);
1682 reply.writeNoException();
1683 reply.writeLongArray(pss);
1684 return true;
1685 }
1686
Dianne Hackborn661cd522011-08-22 00:26:20 -07001687 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1690 boolean always = data.readInt() != 0;
1691 showBootMessage(msg, always);
1692 reply.writeNoException();
1693 return true;
1694 }
1695
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001696 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 dismissKeyguardOnNextActivity();
1699 reply.writeNoException();
1700 return true;
1701 }
1702
Adam Powelldd8fab22012-03-22 17:47:27 -07001703 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1704 data.enforceInterface(IActivityManager.descriptor);
1705 IBinder token = data.readStrongBinder();
1706 String destAffinity = data.readString();
1707 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1708 reply.writeNoException();
1709 reply.writeInt(res ? 1 : 0);
1710 return true;
1711 }
1712
1713 case NAVIGATE_UP_TO_TRANSACTION: {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 IBinder token = data.readStrongBinder();
1716 Intent target = Intent.CREATOR.createFromParcel(data);
1717 int resultCode = data.readInt();
1718 Intent resultData = null;
1719 if (data.readInt() != 0) {
1720 resultData = Intent.CREATOR.createFromParcel(data);
1721 }
1722 boolean res = navigateUpTo(token, target, resultCode, resultData);
1723 reply.writeNoException();
1724 reply.writeInt(res ? 1 : 0);
1725 return true;
1726 }
1727
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001728 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1729 data.enforceInterface(IActivityManager.descriptor);
1730 IBinder token = data.readStrongBinder();
1731 int res = getLaunchedFromUid(token);
1732 reply.writeNoException();
1733 reply.writeInt(res);
1734 return true;
1735 }
1736
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001737 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001738
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001739 return super.onTransact(code, data, reply, flags);
1740 }
1741
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001742 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001743 return this;
1744 }
1745
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001746 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1747 protected IActivityManager create() {
1748 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001749 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001750 Log.v("ActivityManager", "default service binder = " + b);
1751 }
1752 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001753 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001754 Log.v("ActivityManager", "default service = " + am);
1755 }
1756 return am;
1757 }
1758 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001759}
1760
1761class ActivityManagerProxy implements IActivityManager
1762{
1763 public ActivityManagerProxy(IBinder remote)
1764 {
1765 mRemote = remote;
1766 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001768 public IBinder asBinder()
1769 {
1770 return mRemote;
1771 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001772
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001773 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001774 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1775 int startFlags, String profileFile,
1776 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001777 Parcel data = Parcel.obtain();
1778 Parcel reply = Parcel.obtain();
1779 data.writeInterfaceToken(IActivityManager.descriptor);
1780 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1781 intent.writeToParcel(data, 0);
1782 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001783 data.writeStrongBinder(resultTo);
1784 data.writeString(resultWho);
1785 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001786 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001787 data.writeString(profileFile);
1788 if (profileFd != null) {
1789 data.writeInt(1);
1790 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1791 } else {
1792 data.writeInt(0);
1793 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001794 if (options != null) {
1795 data.writeInt(1);
1796 options.writeToParcel(data, 0);
1797 } else {
1798 data.writeInt(0);
1799 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001800 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1801 reply.readException();
1802 int result = reply.readInt();
1803 reply.recycle();
1804 data.recycle();
1805 return result;
1806 }
Amith Yamasani82644082012-08-03 13:09:11 -07001807
1808 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1809 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1810 int startFlags, String profileFile,
1811 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1812 Parcel data = Parcel.obtain();
1813 Parcel reply = Parcel.obtain();
1814 data.writeInterfaceToken(IActivityManager.descriptor);
1815 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1816 intent.writeToParcel(data, 0);
1817 data.writeString(resolvedType);
1818 data.writeStrongBinder(resultTo);
1819 data.writeString(resultWho);
1820 data.writeInt(requestCode);
1821 data.writeInt(startFlags);
1822 data.writeString(profileFile);
1823 if (profileFd != null) {
1824 data.writeInt(1);
1825 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1826 } else {
1827 data.writeInt(0);
1828 }
1829 if (options != null) {
1830 data.writeInt(1);
1831 options.writeToParcel(data, 0);
1832 } else {
1833 data.writeInt(0);
1834 }
1835 data.writeInt(userId);
1836 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1837 reply.readException();
1838 int result = reply.readInt();
1839 reply.recycle();
1840 data.recycle();
1841 return result;
1842 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001843 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001844 String resolvedType, IBinder resultTo, String resultWho,
1845 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001846 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -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);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -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 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001870 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001871 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1872 reply.readException();
1873 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1874 reply.recycle();
1875 data.recycle();
1876 return result;
1877 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001878 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001879 String resolvedType, IBinder resultTo, String resultWho,
1880 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001881 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001882 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);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001888 data.writeStrongBinder(resultTo);
1889 data.writeString(resultWho);
1890 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001891 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001892 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001893 if (options != null) {
1894 data.writeInt(1);
1895 options.writeToParcel(data, 0);
1896 } else {
1897 data.writeInt(0);
1898 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001899 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001900 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1901 reply.readException();
1902 int result = reply.readInt();
1903 reply.recycle();
1904 data.recycle();
1905 return result;
1906 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001907 public int startActivityIntentSender(IApplicationThread caller,
1908 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001909 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001910 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001911 Parcel data = Parcel.obtain();
1912 Parcel reply = Parcel.obtain();
1913 data.writeInterfaceToken(IActivityManager.descriptor);
1914 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1915 intent.writeToParcel(data, 0);
1916 if (fillInIntent != null) {
1917 data.writeInt(1);
1918 fillInIntent.writeToParcel(data, 0);
1919 } else {
1920 data.writeInt(0);
1921 }
1922 data.writeString(resolvedType);
1923 data.writeStrongBinder(resultTo);
1924 data.writeString(resultWho);
1925 data.writeInt(requestCode);
1926 data.writeInt(flagsMask);
1927 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001928 if (options != null) {
1929 data.writeInt(1);
1930 options.writeToParcel(data, 0);
1931 } else {
1932 data.writeInt(0);
1933 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001934 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001935 reply.readException();
1936 int result = reply.readInt();
1937 reply.recycle();
1938 data.recycle();
1939 return result;
1940 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001941 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001942 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001943 Parcel data = Parcel.obtain();
1944 Parcel reply = Parcel.obtain();
1945 data.writeInterfaceToken(IActivityManager.descriptor);
1946 data.writeStrongBinder(callingActivity);
1947 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001948 if (options != null) {
1949 data.writeInt(1);
1950 options.writeToParcel(data, 0);
1951 } else {
1952 data.writeInt(0);
1953 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1955 reply.readException();
1956 int result = reply.readInt();
1957 reply.recycle();
1958 data.recycle();
1959 return result != 0;
1960 }
1961 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1962 throws RemoteException {
1963 Parcel data = Parcel.obtain();
1964 Parcel reply = Parcel.obtain();
1965 data.writeInterfaceToken(IActivityManager.descriptor);
1966 data.writeStrongBinder(token);
1967 data.writeInt(resultCode);
1968 if (resultData != null) {
1969 data.writeInt(1);
1970 resultData.writeToParcel(data, 0);
1971 } else {
1972 data.writeInt(0);
1973 }
1974 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1975 reply.readException();
1976 boolean res = reply.readInt() != 0;
1977 data.recycle();
1978 reply.recycle();
1979 return res;
1980 }
1981 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1982 {
1983 Parcel data = Parcel.obtain();
1984 Parcel reply = Parcel.obtain();
1985 data.writeInterfaceToken(IActivityManager.descriptor);
1986 data.writeStrongBinder(token);
1987 data.writeString(resultWho);
1988 data.writeInt(requestCode);
1989 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1990 reply.readException();
1991 data.recycle();
1992 reply.recycle();
1993 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07001994 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
1995 Parcel data = Parcel.obtain();
1996 Parcel reply = Parcel.obtain();
1997 data.writeInterfaceToken(IActivityManager.descriptor);
1998 data.writeStrongBinder(token);
1999 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2000 reply.readException();
2001 boolean res = reply.readInt() != 0;
2002 data.recycle();
2003 reply.recycle();
2004 return res;
2005 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002006 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2007 Parcel data = Parcel.obtain();
2008 Parcel reply = Parcel.obtain();
2009 data.writeInterfaceToken(IActivityManager.descriptor);
2010 data.writeStrongBinder(token);
2011 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2012 reply.readException();
2013 boolean res = reply.readInt() != 0;
2014 data.recycle();
2015 reply.recycle();
2016 return res;
2017 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002018 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002019 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002020 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002021 {
2022 Parcel data = Parcel.obtain();
2023 Parcel reply = Parcel.obtain();
2024 data.writeInterfaceToken(IActivityManager.descriptor);
2025 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002026 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002027 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2028 filter.writeToParcel(data, 0);
2029 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002030 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002031 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2032 reply.readException();
2033 Intent intent = null;
2034 int haveIntent = reply.readInt();
2035 if (haveIntent != 0) {
2036 intent = Intent.CREATOR.createFromParcel(reply);
2037 }
2038 reply.recycle();
2039 data.recycle();
2040 return intent;
2041 }
2042 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2043 {
2044 Parcel data = Parcel.obtain();
2045 Parcel reply = Parcel.obtain();
2046 data.writeInterfaceToken(IActivityManager.descriptor);
2047 data.writeStrongBinder(receiver.asBinder());
2048 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2049 reply.readException();
2050 data.recycle();
2051 reply.recycle();
2052 }
2053 public int broadcastIntent(IApplicationThread caller,
2054 Intent intent, String resolvedType, IIntentReceiver resultTo,
2055 int resultCode, String resultData, Bundle map,
2056 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002057 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002058 {
2059 Parcel data = Parcel.obtain();
2060 Parcel reply = Parcel.obtain();
2061 data.writeInterfaceToken(IActivityManager.descriptor);
2062 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2063 intent.writeToParcel(data, 0);
2064 data.writeString(resolvedType);
2065 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2066 data.writeInt(resultCode);
2067 data.writeString(resultData);
2068 data.writeBundle(map);
2069 data.writeString(requiredPermission);
2070 data.writeInt(serialized ? 1 : 0);
2071 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002072 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002073 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2074 reply.readException();
2075 int res = reply.readInt();
2076 reply.recycle();
2077 data.recycle();
2078 return res;
2079 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002080 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2081 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002082 {
2083 Parcel data = Parcel.obtain();
2084 Parcel reply = Parcel.obtain();
2085 data.writeInterfaceToken(IActivityManager.descriptor);
2086 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2087 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002088 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002089 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2090 reply.readException();
2091 data.recycle();
2092 reply.recycle();
2093 }
2094 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2095 {
2096 Parcel data = Parcel.obtain();
2097 Parcel reply = Parcel.obtain();
2098 data.writeInterfaceToken(IActivityManager.descriptor);
2099 data.writeStrongBinder(who);
2100 data.writeInt(resultCode);
2101 data.writeString(resultData);
2102 data.writeBundle(map);
2103 data.writeInt(abortBroadcast ? 1 : 0);
2104 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2105 reply.readException();
2106 data.recycle();
2107 reply.recycle();
2108 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002109 public void attachApplication(IApplicationThread app) throws RemoteException
2110 {
2111 Parcel data = Parcel.obtain();
2112 Parcel reply = Parcel.obtain();
2113 data.writeInterfaceToken(IActivityManager.descriptor);
2114 data.writeStrongBinder(app.asBinder());
2115 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2116 reply.readException();
2117 data.recycle();
2118 reply.recycle();
2119 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002120 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2121 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002122 {
2123 Parcel data = Parcel.obtain();
2124 Parcel reply = Parcel.obtain();
2125 data.writeInterfaceToken(IActivityManager.descriptor);
2126 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002127 if (config != null) {
2128 data.writeInt(1);
2129 config.writeToParcel(data, 0);
2130 } else {
2131 data.writeInt(0);
2132 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002133 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002134 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2135 reply.readException();
2136 data.recycle();
2137 reply.recycle();
2138 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002139 public void activityPaused(IBinder token) throws RemoteException
2140 {
2141 Parcel data = Parcel.obtain();
2142 Parcel reply = Parcel.obtain();
2143 data.writeInterfaceToken(IActivityManager.descriptor);
2144 data.writeStrongBinder(token);
2145 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2146 reply.readException();
2147 data.recycle();
2148 reply.recycle();
2149 }
2150 public void activityStopped(IBinder token, Bundle state,
2151 Bitmap thumbnail, CharSequence description) 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(token);
2157 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002158 if (thumbnail != null) {
2159 data.writeInt(1);
2160 thumbnail.writeToParcel(data, 0);
2161 } else {
2162 data.writeInt(0);
2163 }
2164 TextUtils.writeToParcel(description, data, 0);
2165 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2166 reply.readException();
2167 data.recycle();
2168 reply.recycle();
2169 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002170 public void activitySlept(IBinder token) throws RemoteException
2171 {
2172 Parcel data = Parcel.obtain();
2173 Parcel reply = Parcel.obtain();
2174 data.writeInterfaceToken(IActivityManager.descriptor);
2175 data.writeStrongBinder(token);
2176 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2177 reply.readException();
2178 data.recycle();
2179 reply.recycle();
2180 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002181 public void activityDestroyed(IBinder token) throws RemoteException
2182 {
2183 Parcel data = Parcel.obtain();
2184 Parcel reply = Parcel.obtain();
2185 data.writeInterfaceToken(IActivityManager.descriptor);
2186 data.writeStrongBinder(token);
2187 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2188 reply.readException();
2189 data.recycle();
2190 reply.recycle();
2191 }
2192 public String getCallingPackage(IBinder token) throws RemoteException
2193 {
2194 Parcel data = Parcel.obtain();
2195 Parcel reply = Parcel.obtain();
2196 data.writeInterfaceToken(IActivityManager.descriptor);
2197 data.writeStrongBinder(token);
2198 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2199 reply.readException();
2200 String res = reply.readString();
2201 data.recycle();
2202 reply.recycle();
2203 return res;
2204 }
2205 public ComponentName getCallingActivity(IBinder token)
2206 throws RemoteException {
2207 Parcel data = Parcel.obtain();
2208 Parcel reply = Parcel.obtain();
2209 data.writeInterfaceToken(IActivityManager.descriptor);
2210 data.writeStrongBinder(token);
2211 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2212 reply.readException();
2213 ComponentName res = ComponentName.readFromParcel(reply);
2214 data.recycle();
2215 reply.recycle();
2216 return res;
2217 }
2218 public List getTasks(int maxNum, int flags,
2219 IThumbnailReceiver receiver) throws RemoteException {
2220 Parcel data = Parcel.obtain();
2221 Parcel reply = Parcel.obtain();
2222 data.writeInterfaceToken(IActivityManager.descriptor);
2223 data.writeInt(maxNum);
2224 data.writeInt(flags);
2225 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2226 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2227 reply.readException();
2228 ArrayList list = null;
2229 int N = reply.readInt();
2230 if (N >= 0) {
2231 list = new ArrayList();
2232 while (N > 0) {
2233 ActivityManager.RunningTaskInfo info =
2234 ActivityManager.RunningTaskInfo.CREATOR
2235 .createFromParcel(reply);
2236 list.add(info);
2237 N--;
2238 }
2239 }
2240 data.recycle();
2241 reply.recycle();
2242 return list;
2243 }
2244 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002245 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002246 Parcel data = Parcel.obtain();
2247 Parcel reply = Parcel.obtain();
2248 data.writeInterfaceToken(IActivityManager.descriptor);
2249 data.writeInt(maxNum);
2250 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002251 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002252 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2253 reply.readException();
2254 ArrayList<ActivityManager.RecentTaskInfo> list
2255 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2256 data.recycle();
2257 reply.recycle();
2258 return list;
2259 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002260 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002261 Parcel data = Parcel.obtain();
2262 Parcel reply = Parcel.obtain();
2263 data.writeInterfaceToken(IActivityManager.descriptor);
2264 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002265 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002266 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002267 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002268 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002269 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002270 }
2271 data.recycle();
2272 reply.recycle();
2273 return bm;
2274 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002275 public List getServices(int maxNum, int flags) throws RemoteException {
2276 Parcel data = Parcel.obtain();
2277 Parcel reply = Parcel.obtain();
2278 data.writeInterfaceToken(IActivityManager.descriptor);
2279 data.writeInt(maxNum);
2280 data.writeInt(flags);
2281 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2282 reply.readException();
2283 ArrayList list = null;
2284 int N = reply.readInt();
2285 if (N >= 0) {
2286 list = new ArrayList();
2287 while (N > 0) {
2288 ActivityManager.RunningServiceInfo info =
2289 ActivityManager.RunningServiceInfo.CREATOR
2290 .createFromParcel(reply);
2291 list.add(info);
2292 N--;
2293 }
2294 }
2295 data.recycle();
2296 reply.recycle();
2297 return list;
2298 }
2299 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2300 throws RemoteException {
2301 Parcel data = Parcel.obtain();
2302 Parcel reply = Parcel.obtain();
2303 data.writeInterfaceToken(IActivityManager.descriptor);
2304 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2305 reply.readException();
2306 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2307 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2308 data.recycle();
2309 reply.recycle();
2310 return list;
2311 }
2312 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2313 throws RemoteException {
2314 Parcel data = Parcel.obtain();
2315 Parcel reply = Parcel.obtain();
2316 data.writeInterfaceToken(IActivityManager.descriptor);
2317 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2318 reply.readException();
2319 ArrayList<ActivityManager.RunningAppProcessInfo> list
2320 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2321 data.recycle();
2322 reply.recycle();
2323 return list;
2324 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002325 public List<ApplicationInfo> getRunningExternalApplications()
2326 throws RemoteException {
2327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2331 reply.readException();
2332 ArrayList<ApplicationInfo> list
2333 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2334 data.recycle();
2335 reply.recycle();
2336 return list;
2337 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002338 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 {
2340 Parcel data = Parcel.obtain();
2341 Parcel reply = Parcel.obtain();
2342 data.writeInterfaceToken(IActivityManager.descriptor);
2343 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002344 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002345 if (options != null) {
2346 data.writeInt(1);
2347 options.writeToParcel(data, 0);
2348 } else {
2349 data.writeInt(0);
2350 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002351 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2352 reply.readException();
2353 data.recycle();
2354 reply.recycle();
2355 }
2356 public void moveTaskToBack(int task) throws RemoteException
2357 {
2358 Parcel data = Parcel.obtain();
2359 Parcel reply = Parcel.obtain();
2360 data.writeInterfaceToken(IActivityManager.descriptor);
2361 data.writeInt(task);
2362 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2363 reply.readException();
2364 data.recycle();
2365 reply.recycle();
2366 }
2367 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2368 throws RemoteException {
2369 Parcel data = Parcel.obtain();
2370 Parcel reply = Parcel.obtain();
2371 data.writeInterfaceToken(IActivityManager.descriptor);
2372 data.writeStrongBinder(token);
2373 data.writeInt(nonRoot ? 1 : 0);
2374 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2375 reply.readException();
2376 boolean res = reply.readInt() != 0;
2377 data.recycle();
2378 reply.recycle();
2379 return res;
2380 }
2381 public void moveTaskBackwards(int task) throws RemoteException
2382 {
2383 Parcel data = Parcel.obtain();
2384 Parcel reply = Parcel.obtain();
2385 data.writeInterfaceToken(IActivityManager.descriptor);
2386 data.writeInt(task);
2387 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2388 reply.readException();
2389 data.recycle();
2390 reply.recycle();
2391 }
2392 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2393 {
2394 Parcel data = Parcel.obtain();
2395 Parcel reply = Parcel.obtain();
2396 data.writeInterfaceToken(IActivityManager.descriptor);
2397 data.writeStrongBinder(token);
2398 data.writeInt(onlyRoot ? 1 : 0);
2399 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2400 reply.readException();
2401 int res = reply.readInt();
2402 data.recycle();
2403 reply.recycle();
2404 return res;
2405 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002406 public void reportThumbnail(IBinder token,
2407 Bitmap thumbnail, CharSequence description) throws RemoteException
2408 {
2409 Parcel data = Parcel.obtain();
2410 Parcel reply = Parcel.obtain();
2411 data.writeInterfaceToken(IActivityManager.descriptor);
2412 data.writeStrongBinder(token);
2413 if (thumbnail != null) {
2414 data.writeInt(1);
2415 thumbnail.writeToParcel(data, 0);
2416 } else {
2417 data.writeInt(0);
2418 }
2419 TextUtils.writeToParcel(description, data, 0);
2420 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2421 reply.readException();
2422 data.recycle();
2423 reply.recycle();
2424 }
2425 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002426 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2431 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002432 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002433 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2434 reply.readException();
2435 int res = reply.readInt();
2436 ContentProviderHolder cph = null;
2437 if (res != 0) {
2438 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2439 }
2440 data.recycle();
2441 reply.recycle();
2442 return cph;
2443 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002444 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2445 throws RemoteException
2446 {
2447 Parcel data = Parcel.obtain();
2448 Parcel reply = Parcel.obtain();
2449 data.writeInterfaceToken(IActivityManager.descriptor);
2450 data.writeString(name);
2451 data.writeStrongBinder(token);
2452 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2453 reply.readException();
2454 int res = reply.readInt();
2455 ContentProviderHolder cph = null;
2456 if (res != 0) {
2457 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2458 }
2459 data.recycle();
2460 reply.recycle();
2461 return cph;
2462 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002463 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002464 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002465 {
2466 Parcel data = Parcel.obtain();
2467 Parcel reply = Parcel.obtain();
2468 data.writeInterfaceToken(IActivityManager.descriptor);
2469 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2470 data.writeTypedList(providers);
2471 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2472 reply.readException();
2473 data.recycle();
2474 reply.recycle();
2475 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002476 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2477 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002481 data.writeStrongBinder(connection);
2482 data.writeInt(stable);
2483 data.writeInt(unstable);
2484 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 boolean res = reply.readInt() != 0;
2487 data.recycle();
2488 reply.recycle();
2489 return res;
2490 }
2491 public void unstableProviderDied(IBinder connection) throws RemoteException {
2492 Parcel data = Parcel.obtain();
2493 Parcel reply = Parcel.obtain();
2494 data.writeInterfaceToken(IActivityManager.descriptor);
2495 data.writeStrongBinder(connection);
2496 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2497 reply.readException();
2498 data.recycle();
2499 reply.recycle();
2500 }
2501
2502 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2503 Parcel data = Parcel.obtain();
2504 Parcel reply = Parcel.obtain();
2505 data.writeInterfaceToken(IActivityManager.descriptor);
2506 data.writeStrongBinder(connection);
2507 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002508 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2509 reply.readException();
2510 data.recycle();
2511 reply.recycle();
2512 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002513
2514 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2515 Parcel data = Parcel.obtain();
2516 Parcel reply = Parcel.obtain();
2517 data.writeInterfaceToken(IActivityManager.descriptor);
2518 data.writeString(name);
2519 data.writeStrongBinder(token);
2520 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2521 reply.readException();
2522 data.recycle();
2523 reply.recycle();
2524 }
2525
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002526 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2527 throws RemoteException
2528 {
2529 Parcel data = Parcel.obtain();
2530 Parcel reply = Parcel.obtain();
2531 data.writeInterfaceToken(IActivityManager.descriptor);
2532 service.writeToParcel(data, 0);
2533 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2534 reply.readException();
2535 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2536 data.recycle();
2537 reply.recycle();
2538 return res;
2539 }
2540
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002541 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002542 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002543 {
2544 Parcel data = Parcel.obtain();
2545 Parcel reply = Parcel.obtain();
2546 data.writeInterfaceToken(IActivityManager.descriptor);
2547 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2548 service.writeToParcel(data, 0);
2549 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002550 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2552 reply.readException();
2553 ComponentName res = ComponentName.readFromParcel(reply);
2554 data.recycle();
2555 reply.recycle();
2556 return res;
2557 }
2558 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002559 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002560 {
2561 Parcel data = Parcel.obtain();
2562 Parcel reply = Parcel.obtain();
2563 data.writeInterfaceToken(IActivityManager.descriptor);
2564 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2565 service.writeToParcel(data, 0);
2566 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002567 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002568 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2569 reply.readException();
2570 int res = reply.readInt();
2571 reply.recycle();
2572 data.recycle();
2573 return res;
2574 }
2575 public boolean stopServiceToken(ComponentName className, IBinder token,
2576 int startId) throws RemoteException {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 ComponentName.writeToParcel(className, data);
2581 data.writeStrongBinder(token);
2582 data.writeInt(startId);
2583 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 boolean res = reply.readInt() != 0;
2586 data.recycle();
2587 reply.recycle();
2588 return res;
2589 }
2590 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002591 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002592 Parcel data = Parcel.obtain();
2593 Parcel reply = Parcel.obtain();
2594 data.writeInterfaceToken(IActivityManager.descriptor);
2595 ComponentName.writeToParcel(className, data);
2596 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002597 data.writeInt(id);
2598 if (notification != null) {
2599 data.writeInt(1);
2600 notification.writeToParcel(data, 0);
2601 } else {
2602 data.writeInt(0);
2603 }
2604 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002605 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2606 reply.readException();
2607 data.recycle();
2608 reply.recycle();
2609 }
2610 public int bindService(IApplicationThread caller, IBinder token,
2611 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002612 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 Parcel data = Parcel.obtain();
2614 Parcel reply = Parcel.obtain();
2615 data.writeInterfaceToken(IActivityManager.descriptor);
2616 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2617 data.writeStrongBinder(token);
2618 service.writeToParcel(data, 0);
2619 data.writeString(resolvedType);
2620 data.writeStrongBinder(connection.asBinder());
2621 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002622 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002623 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2624 reply.readException();
2625 int res = reply.readInt();
2626 data.recycle();
2627 reply.recycle();
2628 return res;
2629 }
2630 public boolean unbindService(IServiceConnection connection) throws RemoteException
2631 {
2632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeStrongBinder(connection.asBinder());
2636 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2637 reply.readException();
2638 boolean res = reply.readInt() != 0;
2639 data.recycle();
2640 reply.recycle();
2641 return res;
2642 }
2643
2644 public void publishService(IBinder token,
2645 Intent intent, IBinder service) throws RemoteException {
2646 Parcel data = Parcel.obtain();
2647 Parcel reply = Parcel.obtain();
2648 data.writeInterfaceToken(IActivityManager.descriptor);
2649 data.writeStrongBinder(token);
2650 intent.writeToParcel(data, 0);
2651 data.writeStrongBinder(service);
2652 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2653 reply.readException();
2654 data.recycle();
2655 reply.recycle();
2656 }
2657
2658 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2659 throws RemoteException {
2660 Parcel data = Parcel.obtain();
2661 Parcel reply = Parcel.obtain();
2662 data.writeInterfaceToken(IActivityManager.descriptor);
2663 data.writeStrongBinder(token);
2664 intent.writeToParcel(data, 0);
2665 data.writeInt(doRebind ? 1 : 0);
2666 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2667 reply.readException();
2668 data.recycle();
2669 reply.recycle();
2670 }
2671
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002672 public void serviceDoneExecuting(IBinder token, int type, int startId,
2673 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002674 Parcel data = Parcel.obtain();
2675 Parcel reply = Parcel.obtain();
2676 data.writeInterfaceToken(IActivityManager.descriptor);
2677 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002678 data.writeInt(type);
2679 data.writeInt(startId);
2680 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002681 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2682 reply.readException();
2683 data.recycle();
2684 reply.recycle();
2685 }
2686
2687 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2688 Parcel data = Parcel.obtain();
2689 Parcel reply = Parcel.obtain();
2690 data.writeInterfaceToken(IActivityManager.descriptor);
2691 service.writeToParcel(data, 0);
2692 data.writeString(resolvedType);
2693 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 IBinder binder = reply.readStrongBinder();
2696 reply.recycle();
2697 data.recycle();
2698 return binder;
2699 }
2700
Christopher Tate181fafa2009-05-14 11:12:14 -07002701 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2702 throws RemoteException {
2703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 app.writeToParcel(data, 0);
2707 data.writeInt(backupRestoreMode);
2708 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2709 reply.readException();
2710 boolean success = reply.readInt() != 0;
2711 reply.recycle();
2712 data.recycle();
2713 return success;
2714 }
2715
2716 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2717 Parcel data = Parcel.obtain();
2718 Parcel reply = Parcel.obtain();
2719 data.writeInterfaceToken(IActivityManager.descriptor);
2720 data.writeString(packageName);
2721 data.writeStrongBinder(agent);
2722 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2723 reply.recycle();
2724 data.recycle();
2725 }
2726
2727 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2728 Parcel data = Parcel.obtain();
2729 Parcel reply = Parcel.obtain();
2730 data.writeInterfaceToken(IActivityManager.descriptor);
2731 app.writeToParcel(data, 0);
2732 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2733 reply.readException();
2734 reply.recycle();
2735 data.recycle();
2736 }
2737
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002738 public boolean startInstrumentation(ComponentName className, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002739 int flags, Bundle arguments, IInstrumentationWatcher watcher, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 throws RemoteException {
2741 Parcel data = Parcel.obtain();
2742 Parcel reply = Parcel.obtain();
2743 data.writeInterfaceToken(IActivityManager.descriptor);
2744 ComponentName.writeToParcel(className, data);
2745 data.writeString(profileFile);
2746 data.writeInt(flags);
2747 data.writeBundle(arguments);
2748 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002749 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002750 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2751 reply.readException();
2752 boolean res = reply.readInt() != 0;
2753 reply.recycle();
2754 data.recycle();
2755 return res;
2756 }
2757
2758 public void finishInstrumentation(IApplicationThread target,
2759 int resultCode, Bundle results) throws RemoteException {
2760 Parcel data = Parcel.obtain();
2761 Parcel reply = Parcel.obtain();
2762 data.writeInterfaceToken(IActivityManager.descriptor);
2763 data.writeStrongBinder(target != null ? target.asBinder() : null);
2764 data.writeInt(resultCode);
2765 data.writeBundle(results);
2766 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2767 reply.readException();
2768 data.recycle();
2769 reply.recycle();
2770 }
2771 public Configuration getConfiguration() throws RemoteException
2772 {
2773 Parcel data = Parcel.obtain();
2774 Parcel reply = Parcel.obtain();
2775 data.writeInterfaceToken(IActivityManager.descriptor);
2776 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2777 reply.readException();
2778 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2779 reply.recycle();
2780 data.recycle();
2781 return res;
2782 }
2783 public void updateConfiguration(Configuration values) throws RemoteException
2784 {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
2787 data.writeInterfaceToken(IActivityManager.descriptor);
2788 values.writeToParcel(data, 0);
2789 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2790 reply.readException();
2791 data.recycle();
2792 reply.recycle();
2793 }
2794 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2795 throws RemoteException {
2796 Parcel data = Parcel.obtain();
2797 Parcel reply = Parcel.obtain();
2798 data.writeInterfaceToken(IActivityManager.descriptor);
2799 data.writeStrongBinder(token);
2800 data.writeInt(requestedOrientation);
2801 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2802 reply.readException();
2803 data.recycle();
2804 reply.recycle();
2805 }
2806 public int getRequestedOrientation(IBinder token) throws RemoteException {
2807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeStrongBinder(token);
2811 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2812 reply.readException();
2813 int res = reply.readInt();
2814 data.recycle();
2815 reply.recycle();
2816 return res;
2817 }
2818 public ComponentName getActivityClassForToken(IBinder token)
2819 throws RemoteException {
2820 Parcel data = Parcel.obtain();
2821 Parcel reply = Parcel.obtain();
2822 data.writeInterfaceToken(IActivityManager.descriptor);
2823 data.writeStrongBinder(token);
2824 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2825 reply.readException();
2826 ComponentName res = ComponentName.readFromParcel(reply);
2827 data.recycle();
2828 reply.recycle();
2829 return res;
2830 }
2831 public String getPackageForToken(IBinder token) throws RemoteException
2832 {
2833 Parcel data = Parcel.obtain();
2834 Parcel reply = Parcel.obtain();
2835 data.writeInterfaceToken(IActivityManager.descriptor);
2836 data.writeStrongBinder(token);
2837 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2838 reply.readException();
2839 String res = reply.readString();
2840 data.recycle();
2841 reply.recycle();
2842 return res;
2843 }
2844 public IIntentSender getIntentSender(int type,
2845 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002846 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002847 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002848 Parcel data = Parcel.obtain();
2849 Parcel reply = Parcel.obtain();
2850 data.writeInterfaceToken(IActivityManager.descriptor);
2851 data.writeInt(type);
2852 data.writeString(packageName);
2853 data.writeStrongBinder(token);
2854 data.writeString(resultWho);
2855 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002856 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002857 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002858 data.writeTypedArray(intents, 0);
2859 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002860 } else {
2861 data.writeInt(0);
2862 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002863 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002864 if (options != null) {
2865 data.writeInt(1);
2866 options.writeToParcel(data, 0);
2867 } else {
2868 data.writeInt(0);
2869 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002870 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002871 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2872 reply.readException();
2873 IIntentSender res = IIntentSender.Stub.asInterface(
2874 reply.readStrongBinder());
2875 data.recycle();
2876 reply.recycle();
2877 return res;
2878 }
2879 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeStrongBinder(sender.asBinder());
2884 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 data.recycle();
2887 reply.recycle();
2888 }
2889 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2890 Parcel data = Parcel.obtain();
2891 Parcel reply = Parcel.obtain();
2892 data.writeInterfaceToken(IActivityManager.descriptor);
2893 data.writeStrongBinder(sender.asBinder());
2894 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2895 reply.readException();
2896 String res = reply.readString();
2897 data.recycle();
2898 reply.recycle();
2899 return res;
2900 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002901 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeStrongBinder(sender.asBinder());
2906 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2907 reply.readException();
2908 int res = reply.readInt();
2909 data.recycle();
2910 reply.recycle();
2911 return res;
2912 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002913 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2914 boolean requireFull, String name, String callerPackage) throws RemoteException {
2915 Parcel data = Parcel.obtain();
2916 Parcel reply = Parcel.obtain();
2917 data.writeInterfaceToken(IActivityManager.descriptor);
2918 data.writeInt(callingPid);
2919 data.writeInt(callingUid);
2920 data.writeInt(userId);
2921 data.writeInt(allowAll ? 1 : 0);
2922 data.writeInt(requireFull ? 1 : 0);
2923 data.writeString(name);
2924 data.writeString(callerPackage);
2925 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
2926 reply.readException();
2927 int res = reply.readInt();
2928 data.recycle();
2929 reply.recycle();
2930 return res;
2931 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002932 public void setProcessLimit(int max) throws RemoteException
2933 {
2934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
2937 data.writeInt(max);
2938 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2939 reply.readException();
2940 data.recycle();
2941 reply.recycle();
2942 }
2943 public int getProcessLimit() throws RemoteException
2944 {
2945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
2948 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2949 reply.readException();
2950 int res = reply.readInt();
2951 data.recycle();
2952 reply.recycle();
2953 return res;
2954 }
2955 public void setProcessForeground(IBinder token, int pid,
2956 boolean isForeground) throws RemoteException {
2957 Parcel data = Parcel.obtain();
2958 Parcel reply = Parcel.obtain();
2959 data.writeInterfaceToken(IActivityManager.descriptor);
2960 data.writeStrongBinder(token);
2961 data.writeInt(pid);
2962 data.writeInt(isForeground ? 1 : 0);
2963 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2964 reply.readException();
2965 data.recycle();
2966 reply.recycle();
2967 }
2968 public int checkPermission(String permission, int pid, int uid)
2969 throws RemoteException {
2970 Parcel data = Parcel.obtain();
2971 Parcel reply = Parcel.obtain();
2972 data.writeInterfaceToken(IActivityManager.descriptor);
2973 data.writeString(permission);
2974 data.writeInt(pid);
2975 data.writeInt(uid);
2976 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2977 reply.readException();
2978 int res = reply.readInt();
2979 data.recycle();
2980 reply.recycle();
2981 return res;
2982 }
2983 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002984 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 Parcel data = Parcel.obtain();
2986 Parcel reply = Parcel.obtain();
2987 data.writeInterfaceToken(IActivityManager.descriptor);
2988 data.writeString(packageName);
2989 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002990 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002991 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2992 reply.readException();
2993 boolean res = reply.readInt() != 0;
2994 data.recycle();
2995 reply.recycle();
2996 return res;
2997 }
2998 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2999 throws RemoteException {
3000 Parcel data = Parcel.obtain();
3001 Parcel reply = Parcel.obtain();
3002 data.writeInterfaceToken(IActivityManager.descriptor);
3003 uri.writeToParcel(data, 0);
3004 data.writeInt(pid);
3005 data.writeInt(uid);
3006 data.writeInt(mode);
3007 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3008 reply.readException();
3009 int res = reply.readInt();
3010 data.recycle();
3011 reply.recycle();
3012 return res;
3013 }
3014 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3015 Uri uri, int mode) throws RemoteException {
3016 Parcel data = Parcel.obtain();
3017 Parcel reply = Parcel.obtain();
3018 data.writeInterfaceToken(IActivityManager.descriptor);
3019 data.writeStrongBinder(caller.asBinder());
3020 data.writeString(targetPkg);
3021 uri.writeToParcel(data, 0);
3022 data.writeInt(mode);
3023 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3024 reply.readException();
3025 data.recycle();
3026 reply.recycle();
3027 }
3028 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3029 int mode) throws RemoteException {
3030 Parcel data = Parcel.obtain();
3031 Parcel reply = Parcel.obtain();
3032 data.writeInterfaceToken(IActivityManager.descriptor);
3033 data.writeStrongBinder(caller.asBinder());
3034 uri.writeToParcel(data, 0);
3035 data.writeInt(mode);
3036 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3037 reply.readException();
3038 data.recycle();
3039 reply.recycle();
3040 }
3041 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3042 throws RemoteException {
3043 Parcel data = Parcel.obtain();
3044 Parcel reply = Parcel.obtain();
3045 data.writeInterfaceToken(IActivityManager.descriptor);
3046 data.writeStrongBinder(who.asBinder());
3047 data.writeInt(waiting ? 1 : 0);
3048 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3049 reply.readException();
3050 data.recycle();
3051 reply.recycle();
3052 }
3053 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3054 Parcel data = Parcel.obtain();
3055 Parcel reply = Parcel.obtain();
3056 data.writeInterfaceToken(IActivityManager.descriptor);
3057 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3058 reply.readException();
3059 outInfo.readFromParcel(reply);
3060 data.recycle();
3061 reply.recycle();
3062 }
3063 public void unhandledBack() throws RemoteException
3064 {
3065 Parcel data = Parcel.obtain();
3066 Parcel reply = Parcel.obtain();
3067 data.writeInterfaceToken(IActivityManager.descriptor);
3068 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3069 reply.readException();
3070 data.recycle();
3071 reply.recycle();
3072 }
3073 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3074 {
3075 Parcel data = Parcel.obtain();
3076 Parcel reply = Parcel.obtain();
3077 data.writeInterfaceToken(IActivityManager.descriptor);
3078 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3079 reply.readException();
3080 ParcelFileDescriptor pfd = null;
3081 if (reply.readInt() != 0) {
3082 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3083 }
3084 data.recycle();
3085 reply.recycle();
3086 return pfd;
3087 }
3088 public void goingToSleep() throws RemoteException
3089 {
3090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3094 reply.readException();
3095 data.recycle();
3096 reply.recycle();
3097 }
3098 public void wakingUp() throws RemoteException
3099 {
3100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3104 reply.readException();
3105 data.recycle();
3106 reply.recycle();
3107 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003108 public void setLockScreenShown(boolean shown) throws RemoteException
3109 {
3110 Parcel data = Parcel.obtain();
3111 Parcel reply = Parcel.obtain();
3112 data.writeInterfaceToken(IActivityManager.descriptor);
3113 data.writeInt(shown ? 1 : 0);
3114 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 data.recycle();
3117 reply.recycle();
3118 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003119 public void setDebugApp(
3120 String packageName, boolean waitForDebugger, boolean persistent)
3121 throws RemoteException
3122 {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeString(packageName);
3127 data.writeInt(waitForDebugger ? 1 : 0);
3128 data.writeInt(persistent ? 1 : 0);
3129 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3130 reply.readException();
3131 data.recycle();
3132 reply.recycle();
3133 }
3134 public void setAlwaysFinish(boolean enabled) throws RemoteException
3135 {
3136 Parcel data = Parcel.obtain();
3137 Parcel reply = Parcel.obtain();
3138 data.writeInterfaceToken(IActivityManager.descriptor);
3139 data.writeInt(enabled ? 1 : 0);
3140 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3141 reply.readException();
3142 data.recycle();
3143 reply.recycle();
3144 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003145 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 {
3147 Parcel data = Parcel.obtain();
3148 Parcel reply = Parcel.obtain();
3149 data.writeInterfaceToken(IActivityManager.descriptor);
3150 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003151 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003152 reply.readException();
3153 data.recycle();
3154 reply.recycle();
3155 }
3156 public void enterSafeMode() throws RemoteException {
3157 Parcel data = Parcel.obtain();
3158 data.writeInterfaceToken(IActivityManager.descriptor);
3159 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3160 data.recycle();
3161 }
3162 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3163 Parcel data = Parcel.obtain();
3164 data.writeStrongBinder(sender.asBinder());
3165 data.writeInterfaceToken(IActivityManager.descriptor);
3166 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3167 data.recycle();
3168 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003169 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003170 Parcel data = Parcel.obtain();
3171 Parcel reply = Parcel.obtain();
3172 data.writeInterfaceToken(IActivityManager.descriptor);
3173 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003174 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003175 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003176 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003177 boolean res = reply.readInt() != 0;
3178 data.recycle();
3179 reply.recycle();
3180 return res;
3181 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003182 @Override
3183 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 data.writeString(reason);
3188 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3189 boolean res = reply.readInt() != 0;
3190 data.recycle();
3191 reply.recycle();
3192 return res;
3193 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003194 public void startRunning(String pkg, String cls, String action,
3195 String indata) throws RemoteException {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 data.writeString(pkg);
3200 data.writeString(cls);
3201 data.writeString(action);
3202 data.writeString(indata);
3203 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3204 reply.readException();
3205 data.recycle();
3206 reply.recycle();
3207 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003208 public boolean testIsSystemReady()
3209 {
3210 /* this base class version is never called */
3211 return true;
3212 }
Dan Egnor60d87622009-12-16 16:32:58 -08003213 public void handleApplicationCrash(IBinder app,
3214 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3215 {
3216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 data.writeStrongBinder(app);
3220 crashInfo.writeToParcel(data, 0);
3221 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3222 reply.readException();
3223 reply.recycle();
3224 data.recycle();
3225 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003226
Dan Egnor60d87622009-12-16 16:32:58 -08003227 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003228 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003234 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003235 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003236 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003237 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003238 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 reply.recycle();
3240 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003241 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003242 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003243
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003244 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003245 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003246 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003247 {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003252 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003253 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003254 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 reply.recycle();
3257 data.recycle();
3258 }
3259
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003260 public void signalPersistentProcesses(int sig) throws RemoteException {
3261 Parcel data = Parcel.obtain();
3262 Parcel reply = Parcel.obtain();
3263 data.writeInterfaceToken(IActivityManager.descriptor);
3264 data.writeInt(sig);
3265 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3266 reply.readException();
3267 data.recycle();
3268 reply.recycle();
3269 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003270
Dianne Hackborn1676c852012-09-10 14:52:30 -07003271 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003276 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003277 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3278 reply.readException();
3279 data.recycle();
3280 reply.recycle();
3281 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003282
3283 public void killAllBackgroundProcesses() throws RemoteException {
3284 Parcel data = Parcel.obtain();
3285 Parcel reply = Parcel.obtain();
3286 data.writeInterfaceToken(IActivityManager.descriptor);
3287 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3288 reply.readException();
3289 data.recycle();
3290 reply.recycle();
3291 }
3292
Dianne Hackborn1676c852012-09-10 14:52:30 -07003293 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003294 Parcel data = Parcel.obtain();
3295 Parcel reply = Parcel.obtain();
3296 data.writeInterfaceToken(IActivityManager.descriptor);
3297 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003298 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003299 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003300 reply.readException();
3301 data.recycle();
3302 reply.recycle();
3303 }
3304
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003305 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3306 throws RemoteException
3307 {
3308 Parcel data = Parcel.obtain();
3309 Parcel reply = Parcel.obtain();
3310 data.writeInterfaceToken(IActivityManager.descriptor);
3311 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3312 reply.readException();
3313 outInfo.readFromParcel(reply);
3314 reply.recycle();
3315 data.recycle();
3316 }
3317
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3319 {
3320 Parcel data = Parcel.obtain();
3321 Parcel reply = Parcel.obtain();
3322 data.writeInterfaceToken(IActivityManager.descriptor);
3323 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3324 reply.readException();
3325 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3326 reply.recycle();
3327 data.recycle();
3328 return res;
3329 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003330
Dianne Hackborn1676c852012-09-10 14:52:30 -07003331 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003332 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003338 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003339 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003340 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003341 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003342 if (fd != null) {
3343 data.writeInt(1);
3344 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3345 } else {
3346 data.writeInt(0);
3347 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003348 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3349 reply.readException();
3350 boolean res = reply.readInt() != 0;
3351 reply.recycle();
3352 data.recycle();
3353 return res;
3354 }
3355
Dianne Hackborn55280a92009-05-07 15:53:46 -07003356 public boolean shutdown(int timeout) throws RemoteException
3357 {
3358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 data.writeInt(timeout);
3362 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 boolean res = reply.readInt() != 0;
3365 reply.recycle();
3366 data.recycle();
3367 return res;
3368 }
3369
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003370 public void stopAppSwitches() throws RemoteException {
3371 Parcel data = Parcel.obtain();
3372 Parcel reply = Parcel.obtain();
3373 data.writeInterfaceToken(IActivityManager.descriptor);
3374 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3375 reply.readException();
3376 reply.recycle();
3377 data.recycle();
3378 }
3379
3380 public void resumeAppSwitches() throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3385 reply.readException();
3386 reply.recycle();
3387 data.recycle();
3388 }
3389
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003390 public void killApplicationWithAppId(String pkg, int appid) throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003391 Parcel data = Parcel.obtain();
3392 Parcel reply = Parcel.obtain();
3393 data.writeInterfaceToken(IActivityManager.descriptor);
3394 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003395 data.writeInt(appid);
3396 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003397 reply.readException();
3398 data.recycle();
3399 reply.recycle();
3400 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003401
3402 public void closeSystemDialogs(String reason) throws RemoteException {
3403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeString(reason);
3407 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3408 reply.readException();
3409 data.recycle();
3410 reply.recycle();
3411 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003412
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003413 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003414 throws RemoteException {
3415 Parcel data = Parcel.obtain();
3416 Parcel reply = Parcel.obtain();
3417 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003418 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003419 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3420 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003421 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003422 data.recycle();
3423 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003424 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003425 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003426
3427 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3428 Parcel data = Parcel.obtain();
3429 Parcel reply = Parcel.obtain();
3430 data.writeInterfaceToken(IActivityManager.descriptor);
3431 data.writeString(processName);
3432 data.writeInt(uid);
3433 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 data.recycle();
3436 reply.recycle();
3437 }
3438
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003439 public void overridePendingTransition(IBinder token, String packageName,
3440 int enterAnim, int exitAnim) throws RemoteException {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 data.writeStrongBinder(token);
3445 data.writeString(packageName);
3446 data.writeInt(enterAnim);
3447 data.writeInt(exitAnim);
3448 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 data.recycle();
3451 reply.recycle();
3452 }
3453
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003454 public boolean isUserAMonkey() throws RemoteException {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3459 reply.readException();
3460 boolean res = reply.readInt() != 0;
3461 data.recycle();
3462 reply.recycle();
3463 return res;
3464 }
3465
Dianne Hackborn860755f2010-06-03 18:47:52 -07003466 public void finishHeavyWeightApp() throws RemoteException {
3467 Parcel data = Parcel.obtain();
3468 Parcel reply = Parcel.obtain();
3469 data.writeInterfaceToken(IActivityManager.descriptor);
3470 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 data.recycle();
3473 reply.recycle();
3474 }
3475
Daniel Sandler69a48172010-06-23 16:29:36 -04003476 public void setImmersive(IBinder token, boolean immersive)
3477 throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeStrongBinder(token);
3482 data.writeInt(immersive ? 1 : 0);
3483 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3484 reply.readException();
3485 data.recycle();
3486 reply.recycle();
3487 }
3488
3489 public boolean isImmersive(IBinder token)
3490 throws RemoteException {
3491 Parcel data = Parcel.obtain();
3492 Parcel reply = Parcel.obtain();
3493 data.writeInterfaceToken(IActivityManager.descriptor);
3494 data.writeStrongBinder(token);
3495 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003496 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003497 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003498 data.recycle();
3499 reply.recycle();
3500 return res;
3501 }
3502
3503 public boolean isTopActivityImmersive()
3504 throws RemoteException {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003509 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003510 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003511 data.recycle();
3512 reply.recycle();
3513 return res;
3514 }
3515
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003516 public void crashApplication(int uid, int initialPid, String packageName,
3517 String message) throws RemoteException {
3518 Parcel data = Parcel.obtain();
3519 Parcel reply = Parcel.obtain();
3520 data.writeInterfaceToken(IActivityManager.descriptor);
3521 data.writeInt(uid);
3522 data.writeInt(initialPid);
3523 data.writeString(packageName);
3524 data.writeString(message);
3525 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 data.recycle();
3528 reply.recycle();
3529 }
Andy McFadden824c5102010-07-09 16:26:57 -07003530
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003531 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003532 Parcel data = Parcel.obtain();
3533 Parcel reply = Parcel.obtain();
3534 data.writeInterfaceToken(IActivityManager.descriptor);
3535 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003536 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003537 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 String res = reply.readString();
3540 data.recycle();
3541 reply.recycle();
3542 return res;
3543 }
3544
Dianne Hackborn7e269642010-08-25 19:50:20 -07003545 public IBinder newUriPermissionOwner(String name)
3546 throws RemoteException {
3547 Parcel data = Parcel.obtain();
3548 Parcel reply = Parcel.obtain();
3549 data.writeInterfaceToken(IActivityManager.descriptor);
3550 data.writeString(name);
3551 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3552 reply.readException();
3553 IBinder res = reply.readStrongBinder();
3554 data.recycle();
3555 reply.recycle();
3556 return res;
3557 }
3558
3559 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3560 Uri uri, int mode) throws RemoteException {
3561 Parcel data = Parcel.obtain();
3562 Parcel reply = Parcel.obtain();
3563 data.writeInterfaceToken(IActivityManager.descriptor);
3564 data.writeStrongBinder(owner);
3565 data.writeInt(fromUid);
3566 data.writeString(targetPkg);
3567 uri.writeToParcel(data, 0);
3568 data.writeInt(mode);
3569 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3570 reply.readException();
3571 data.recycle();
3572 reply.recycle();
3573 }
3574
3575 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3576 int mode) throws RemoteException {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 data.writeStrongBinder(owner);
3581 if (uri != null) {
3582 data.writeInt(1);
3583 uri.writeToParcel(data, 0);
3584 } else {
3585 data.writeInt(0);
3586 }
3587 data.writeInt(mode);
3588 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3589 reply.readException();
3590 data.recycle();
3591 reply.recycle();
3592 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003593
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003594 public int checkGrantUriPermission(int callingUid, String targetPkg,
3595 Uri uri, int modeFlags) throws RemoteException {
3596 Parcel data = Parcel.obtain();
3597 Parcel reply = Parcel.obtain();
3598 data.writeInterfaceToken(IActivityManager.descriptor);
3599 data.writeInt(callingUid);
3600 data.writeString(targetPkg);
3601 uri.writeToParcel(data, 0);
3602 data.writeInt(modeFlags);
3603 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3604 reply.readException();
3605 int res = reply.readInt();
3606 data.recycle();
3607 reply.recycle();
3608 return res;
3609 }
3610
Dianne Hackborn1676c852012-09-10 14:52:30 -07003611 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07003612 String path, ParcelFileDescriptor fd) throws RemoteException {
3613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003617 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07003618 data.writeInt(managed ? 1 : 0);
3619 data.writeString(path);
3620 if (fd != null) {
3621 data.writeInt(1);
3622 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3623 } else {
3624 data.writeInt(0);
3625 }
3626 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 boolean res = reply.readInt() != 0;
3629 reply.recycle();
3630 data.recycle();
3631 return res;
3632 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003633
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003634 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003635 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3636 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3641 data.writeTypedArray(intents, 0);
3642 data.writeStringArray(resolvedTypes);
3643 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003644 if (options != null) {
3645 data.writeInt(1);
3646 options.writeToParcel(data, 0);
3647 } else {
3648 data.writeInt(0);
3649 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003650 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3651 reply.readException();
3652 int result = reply.readInt();
3653 reply.recycle();
3654 data.recycle();
3655 return result;
3656 }
3657
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003658 public int getFrontActivityScreenCompatMode() throws RemoteException {
3659 Parcel data = Parcel.obtain();
3660 Parcel reply = Parcel.obtain();
3661 data.writeInterfaceToken(IActivityManager.descriptor);
3662 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3663 reply.readException();
3664 int mode = reply.readInt();
3665 reply.recycle();
3666 data.recycle();
3667 return mode;
3668 }
3669
3670 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3671 Parcel data = Parcel.obtain();
3672 Parcel reply = Parcel.obtain();
3673 data.writeInterfaceToken(IActivityManager.descriptor);
3674 data.writeInt(mode);
3675 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3676 reply.readException();
3677 reply.recycle();
3678 data.recycle();
3679 }
3680
3681 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3682 Parcel data = Parcel.obtain();
3683 Parcel reply = Parcel.obtain();
3684 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003685 data.writeString(packageName);
3686 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003687 reply.readException();
3688 int mode = reply.readInt();
3689 reply.recycle();
3690 data.recycle();
3691 return mode;
3692 }
3693
3694 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003695 throws RemoteException {
3696 Parcel data = Parcel.obtain();
3697 Parcel reply = Parcel.obtain();
3698 data.writeInterfaceToken(IActivityManager.descriptor);
3699 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003700 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003701 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3702 reply.readException();
3703 reply.recycle();
3704 data.recycle();
3705 }
3706
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003707 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3708 Parcel data = Parcel.obtain();
3709 Parcel reply = Parcel.obtain();
3710 data.writeInterfaceToken(IActivityManager.descriptor);
3711 data.writeString(packageName);
3712 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3713 reply.readException();
3714 boolean ask = reply.readInt() != 0;
3715 reply.recycle();
3716 data.recycle();
3717 return ask;
3718 }
3719
3720 public void setPackageAskScreenCompat(String packageName, boolean ask)
3721 throws RemoteException {
3722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 data.writeString(packageName);
3726 data.writeInt(ask ? 1 : 0);
3727 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3728 reply.readException();
3729 reply.recycle();
3730 data.recycle();
3731 }
3732
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003733 public boolean switchUser(int userid) throws RemoteException {
3734 Parcel data = Parcel.obtain();
3735 Parcel reply = Parcel.obtain();
3736 data.writeInterfaceToken(IActivityManager.descriptor);
3737 data.writeInt(userid);
3738 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 boolean result = reply.readInt() != 0;
3741 reply.recycle();
3742 data.recycle();
3743 return result;
3744 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003745
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003746 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3747 Parcel data = Parcel.obtain();
3748 Parcel reply = Parcel.obtain();
3749 data.writeInterfaceToken(IActivityManager.descriptor);
3750 data.writeInt(userid);
3751 data.writeStrongInterface(callback);
3752 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3753 reply.readException();
3754 int result = reply.readInt();
3755 reply.recycle();
3756 data.recycle();
3757 return result;
3758 }
3759
Amith Yamasani52f1d752012-03-28 18:19:29 -07003760 public UserInfo getCurrentUser() throws RemoteException {
3761 Parcel data = Parcel.obtain();
3762 Parcel reply = Parcel.obtain();
3763 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003764 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003765 reply.readException();
3766 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3767 reply.recycle();
3768 data.recycle();
3769 return userInfo;
3770 }
3771
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003772 public boolean isUserRunning(int userid) throws RemoteException {
3773 Parcel data = Parcel.obtain();
3774 Parcel reply = Parcel.obtain();
3775 data.writeInterfaceToken(IActivityManager.descriptor);
3776 data.writeInt(userid);
3777 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
3778 reply.readException();
3779 boolean result = reply.readInt() != 0;
3780 reply.recycle();
3781 data.recycle();
3782 return result;
3783 }
3784
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003785 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3786 Parcel data = Parcel.obtain();
3787 Parcel reply = Parcel.obtain();
3788 data.writeInterfaceToken(IActivityManager.descriptor);
3789 data.writeInt(taskId);
3790 data.writeInt(subTaskIndex);
3791 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3792 reply.readException();
3793 boolean result = reply.readInt() != 0;
3794 reply.recycle();
3795 data.recycle();
3796 return result;
3797 }
3798
3799 public boolean removeTask(int taskId, int flags) throws RemoteException {
3800 Parcel data = Parcel.obtain();
3801 Parcel reply = Parcel.obtain();
3802 data.writeInterfaceToken(IActivityManager.descriptor);
3803 data.writeInt(taskId);
3804 data.writeInt(flags);
3805 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3806 reply.readException();
3807 boolean result = reply.readInt() != 0;
3808 reply.recycle();
3809 data.recycle();
3810 return result;
3811 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003812
Jeff Sharkeya4620792011-05-20 15:29:23 -07003813 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3814 Parcel data = Parcel.obtain();
3815 Parcel reply = Parcel.obtain();
3816 data.writeInterfaceToken(IActivityManager.descriptor);
3817 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3818 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3819 reply.readException();
3820 data.recycle();
3821 reply.recycle();
3822 }
3823
3824 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3825 Parcel data = Parcel.obtain();
3826 Parcel reply = Parcel.obtain();
3827 data.writeInterfaceToken(IActivityManager.descriptor);
3828 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3829 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 data.recycle();
3832 reply.recycle();
3833 }
3834
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003835 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 data.writeStrongBinder(sender.asBinder());
3840 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3841 reply.readException();
3842 boolean res = reply.readInt() != 0;
3843 data.recycle();
3844 reply.recycle();
3845 return res;
3846 }
3847
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003848 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3849 Parcel data = Parcel.obtain();
3850 Parcel reply = Parcel.obtain();
3851 data.writeInterfaceToken(IActivityManager.descriptor);
3852 data.writeStrongBinder(sender.asBinder());
3853 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 boolean res = reply.readInt() != 0;
3856 data.recycle();
3857 reply.recycle();
3858 return res;
3859 }
3860
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003861 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3862 {
3863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 values.writeToParcel(data, 0);
3867 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 data.recycle();
3870 reply.recycle();
3871 }
3872
Dianne Hackbornb437e092011-08-05 17:50:29 -07003873 public long[] getProcessPss(int[] pids) throws RemoteException {
3874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
3877 data.writeIntArray(pids);
3878 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 long[] res = reply.createLongArray();
3881 data.recycle();
3882 reply.recycle();
3883 return res;
3884 }
3885
Dianne Hackborn661cd522011-08-22 00:26:20 -07003886 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 TextUtils.writeToParcel(msg, data, 0);
3891 data.writeInt(always ? 1 : 0);
3892 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3893 reply.readException();
3894 data.recycle();
3895 reply.recycle();
3896 }
3897
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003898 public void dismissKeyguardOnNextActivity() throws RemoteException {
3899 Parcel data = Parcel.obtain();
3900 Parcel reply = Parcel.obtain();
3901 data.writeInterfaceToken(IActivityManager.descriptor);
3902 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 data.recycle();
3905 reply.recycle();
3906 }
3907
Adam Powelldd8fab22012-03-22 17:47:27 -07003908 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3909 throws RemoteException {
3910 Parcel data = Parcel.obtain();
3911 Parcel reply = Parcel.obtain();
3912 data.writeInterfaceToken(IActivityManager.descriptor);
3913 data.writeStrongBinder(token);
3914 data.writeString(destAffinity);
3915 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3916 reply.readException();
3917 boolean result = reply.readInt() != 0;
3918 data.recycle();
3919 reply.recycle();
3920 return result;
3921 }
3922
3923 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3924 throws RemoteException {
3925 Parcel data = Parcel.obtain();
3926 Parcel reply = Parcel.obtain();
3927 data.writeInterfaceToken(IActivityManager.descriptor);
3928 data.writeStrongBinder(token);
3929 target.writeToParcel(data, 0);
3930 data.writeInt(resultCode);
3931 if (resultData != null) {
3932 data.writeInt(1);
3933 resultData.writeToParcel(data, 0);
3934 } else {
3935 data.writeInt(0);
3936 }
3937 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 boolean result = reply.readInt() != 0;
3940 data.recycle();
3941 reply.recycle();
3942 return result;
3943 }
3944
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003945 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3946 Parcel data = Parcel.obtain();
3947 Parcel reply = Parcel.obtain();
3948 data.writeInterfaceToken(IActivityManager.descriptor);
3949 data.writeStrongBinder(activityToken);
3950 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3951 reply.readException();
3952 int result = reply.readInt();
3953 data.recycle();
3954 reply.recycle();
3955 return result;
3956 }
3957
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003958 private IBinder mRemote;
3959}