blob: 14ba537960b661af020bd370d8bde744a83af2a9 [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 Hackborn8f7f35e2010-02-25 18:48:12 -0800180 WaitResult result = startActivityAndWait(app, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700181 resultTo, resultWho, requestCode, startFlags,
182 profileFile, profileFd, options);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 reply.writeNoException();
184 result.writeToParcel(reply, 0);
185 return true;
186 }
187
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700188 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
189 {
190 data.enforceInterface(IActivityManager.descriptor);
191 IBinder b = data.readStrongBinder();
192 IApplicationThread app = ApplicationThreadNative.asInterface(b);
193 Intent intent = Intent.CREATOR.createFromParcel(data);
194 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700195 IBinder resultTo = data.readStrongBinder();
196 String resultWho = data.readString();
197 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700198 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700200 Bundle options = data.readInt() != 0
201 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700202 int userId = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700203 int result = startActivityWithConfig(app, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700204 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 reply.writeNoException();
206 reply.writeInt(result);
207 return true;
208 }
209
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700210 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700211 {
212 data.enforceInterface(IActivityManager.descriptor);
213 IBinder b = data.readStrongBinder();
214 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700215 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700216 Intent fillInIntent = null;
217 if (data.readInt() != 0) {
218 fillInIntent = Intent.CREATOR.createFromParcel(data);
219 }
220 String resolvedType = data.readString();
221 IBinder resultTo = data.readStrongBinder();
222 String resultWho = data.readString();
223 int requestCode = data.readInt();
224 int flagsMask = data.readInt();
225 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700226 Bundle options = data.readInt() != 0
227 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700228 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700229 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700230 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700231 reply.writeNoException();
232 reply.writeInt(result);
233 return true;
234 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800235
236 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
237 {
238 data.enforceInterface(IActivityManager.descriptor);
239 IBinder callingActivity = data.readStrongBinder();
240 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700241 Bundle options = data.readInt() != 0
242 ? Bundle.CREATOR.createFromParcel(data) : null;
243 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800244 reply.writeNoException();
245 reply.writeInt(result ? 1 : 0);
246 return true;
247 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800249 case FINISH_ACTIVITY_TRANSACTION: {
250 data.enforceInterface(IActivityManager.descriptor);
251 IBinder token = data.readStrongBinder();
252 Intent resultData = null;
253 int resultCode = data.readInt();
254 if (data.readInt() != 0) {
255 resultData = Intent.CREATOR.createFromParcel(data);
256 }
257 boolean res = finishActivity(token, resultCode, resultData);
258 reply.writeNoException();
259 reply.writeInt(res ? 1 : 0);
260 return true;
261 }
262
263 case FINISH_SUB_ACTIVITY_TRANSACTION: {
264 data.enforceInterface(IActivityManager.descriptor);
265 IBinder token = data.readStrongBinder();
266 String resultWho = data.readString();
267 int requestCode = data.readInt();
268 finishSubActivity(token, resultWho, requestCode);
269 reply.writeNoException();
270 return true;
271 }
272
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700273 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
274 data.enforceInterface(IActivityManager.descriptor);
275 IBinder token = data.readStrongBinder();
276 boolean res = finishActivityAffinity(token);
277 reply.writeNoException();
278 reply.writeInt(res ? 1 : 0);
279 return true;
280 }
281
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800282 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
283 data.enforceInterface(IActivityManager.descriptor);
284 IBinder token = data.readStrongBinder();
285 boolean res = willActivityBeVisible(token);
286 reply.writeNoException();
287 reply.writeInt(res ? 1 : 0);
288 return true;
289 }
290
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800291 case REGISTER_RECEIVER_TRANSACTION:
292 {
293 data.enforceInterface(IActivityManager.descriptor);
294 IBinder b = data.readStrongBinder();
295 IApplicationThread app =
296 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700297 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 b = data.readStrongBinder();
299 IIntentReceiver rec
300 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
301 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
302 String perm = data.readString();
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700303 Intent intent = registerReceiver(app, packageName, rec, filter, perm);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800304 reply.writeNoException();
305 if (intent != null) {
306 reply.writeInt(1);
307 intent.writeToParcel(reply, 0);
308 } else {
309 reply.writeInt(0);
310 }
311 return true;
312 }
313
314 case UNREGISTER_RECEIVER_TRANSACTION:
315 {
316 data.enforceInterface(IActivityManager.descriptor);
317 IBinder b = data.readStrongBinder();
318 if (b == null) {
319 return true;
320 }
321 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
322 unregisterReceiver(rec);
323 reply.writeNoException();
324 return true;
325 }
326
327 case BROADCAST_INTENT_TRANSACTION:
328 {
329 data.enforceInterface(IActivityManager.descriptor);
330 IBinder b = data.readStrongBinder();
331 IApplicationThread app =
332 b != null ? ApplicationThreadNative.asInterface(b) : null;
333 Intent intent = Intent.CREATOR.createFromParcel(data);
334 String resolvedType = data.readString();
335 b = data.readStrongBinder();
336 IIntentReceiver resultTo =
337 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
338 int resultCode = data.readInt();
339 String resultData = data.readString();
340 Bundle resultExtras = data.readBundle();
341 String perm = data.readString();
342 boolean serialized = data.readInt() != 0;
343 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700344 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 int res = broadcastIntent(app, intent, resolvedType, resultTo,
346 resultCode, resultData, resultExtras, perm,
Amith Yamasani742a6712011-05-04 14:49:28 -0700347 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 reply.writeNoException();
349 reply.writeInt(res);
350 return true;
351 }
352
353 case UNBROADCAST_INTENT_TRANSACTION:
354 {
355 data.enforceInterface(IActivityManager.descriptor);
356 IBinder b = data.readStrongBinder();
357 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
358 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700359 int userId = data.readInt();
360 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 reply.writeNoException();
362 return true;
363 }
364
365 case FINISH_RECEIVER_TRANSACTION: {
366 data.enforceInterface(IActivityManager.descriptor);
367 IBinder who = data.readStrongBinder();
368 int resultCode = data.readInt();
369 String resultData = data.readString();
370 Bundle resultExtras = data.readBundle();
371 boolean resultAbort = data.readInt() != 0;
372 if (who != null) {
373 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
374 }
375 reply.writeNoException();
376 return true;
377 }
378
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800379 case ATTACH_APPLICATION_TRANSACTION: {
380 data.enforceInterface(IActivityManager.descriptor);
381 IApplicationThread app = ApplicationThreadNative.asInterface(
382 data.readStrongBinder());
383 if (app != null) {
384 attachApplication(app);
385 }
386 reply.writeNoException();
387 return true;
388 }
389
390 case ACTIVITY_IDLE_TRANSACTION: {
391 data.enforceInterface(IActivityManager.descriptor);
392 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700393 Configuration config = null;
394 if (data.readInt() != 0) {
395 config = Configuration.CREATOR.createFromParcel(data);
396 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700397 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800398 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700399 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800400 }
401 reply.writeNoException();
402 return true;
403 }
404
405 case ACTIVITY_PAUSED_TRANSACTION: {
406 data.enforceInterface(IActivityManager.descriptor);
407 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800408 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 reply.writeNoException();
410 return true;
411 }
412
413 case ACTIVITY_STOPPED_TRANSACTION: {
414 data.enforceInterface(IActivityManager.descriptor);
415 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800416 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800417 Bitmap thumbnail = data.readInt() != 0
418 ? Bitmap.CREATOR.createFromParcel(data) : null;
419 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800420 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 reply.writeNoException();
422 return true;
423 }
424
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800425 case ACTIVITY_SLEPT_TRANSACTION: {
426 data.enforceInterface(IActivityManager.descriptor);
427 IBinder token = data.readStrongBinder();
428 activitySlept(token);
429 reply.writeNoException();
430 return true;
431 }
432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800433 case ACTIVITY_DESTROYED_TRANSACTION: {
434 data.enforceInterface(IActivityManager.descriptor);
435 IBinder token = data.readStrongBinder();
436 activityDestroyed(token);
437 reply.writeNoException();
438 return true;
439 }
440
441 case GET_CALLING_PACKAGE_TRANSACTION: {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder token = data.readStrongBinder();
444 String res = token != null ? getCallingPackage(token) : null;
445 reply.writeNoException();
446 reply.writeString(res);
447 return true;
448 }
449
450 case GET_CALLING_ACTIVITY_TRANSACTION: {
451 data.enforceInterface(IActivityManager.descriptor);
452 IBinder token = data.readStrongBinder();
453 ComponentName cn = getCallingActivity(token);
454 reply.writeNoException();
455 ComponentName.writeToParcel(cn, reply);
456 return true;
457 }
458
459 case GET_TASKS_TRANSACTION: {
460 data.enforceInterface(IActivityManager.descriptor);
461 int maxNum = data.readInt();
462 int fl = data.readInt();
463 IBinder receiverBinder = data.readStrongBinder();
464 IThumbnailReceiver receiver = receiverBinder != null
465 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
466 : null;
467 List list = getTasks(maxNum, fl, receiver);
468 reply.writeNoException();
469 int N = list != null ? list.size() : -1;
470 reply.writeInt(N);
471 int i;
472 for (i=0; i<N; i++) {
473 ActivityManager.RunningTaskInfo info =
474 (ActivityManager.RunningTaskInfo)list.get(i);
475 info.writeToParcel(reply, 0);
476 }
477 return true;
478 }
479
480 case GET_RECENT_TASKS_TRANSACTION: {
481 data.enforceInterface(IActivityManager.descriptor);
482 int maxNum = data.readInt();
483 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700484 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800485 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700486 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 reply.writeNoException();
488 reply.writeTypedList(list);
489 return true;
490 }
491
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700492 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800493 data.enforceInterface(IActivityManager.descriptor);
494 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700495 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800496 reply.writeNoException();
497 if (bm != null) {
498 reply.writeInt(1);
499 bm.writeToParcel(reply, 0);
500 } else {
501 reply.writeInt(0);
502 }
503 return true;
504 }
505
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800506 case GET_SERVICES_TRANSACTION: {
507 data.enforceInterface(IActivityManager.descriptor);
508 int maxNum = data.readInt();
509 int fl = data.readInt();
510 List list = getServices(maxNum, fl);
511 reply.writeNoException();
512 int N = list != null ? list.size() : -1;
513 reply.writeInt(N);
514 int i;
515 for (i=0; i<N; i++) {
516 ActivityManager.RunningServiceInfo info =
517 (ActivityManager.RunningServiceInfo)list.get(i);
518 info.writeToParcel(reply, 0);
519 }
520 return true;
521 }
522
523 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
524 data.enforceInterface(IActivityManager.descriptor);
525 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
526 reply.writeNoException();
527 reply.writeTypedList(list);
528 return true;
529 }
530
531 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
532 data.enforceInterface(IActivityManager.descriptor);
533 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
534 reply.writeNoException();
535 reply.writeTypedList(list);
536 return true;
537 }
538
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700539 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 List<ApplicationInfo> list = getRunningExternalApplications();
542 reply.writeNoException();
543 reply.writeTypedList(list);
544 return true;
545 }
546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 case MOVE_TASK_TO_FRONT_TRANSACTION: {
548 data.enforceInterface(IActivityManager.descriptor);
549 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800550 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700551 Bundle options = data.readInt() != 0
552 ? Bundle.CREATOR.createFromParcel(data) : null;
553 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 reply.writeNoException();
555 return true;
556 }
557
558 case MOVE_TASK_TO_BACK_TRANSACTION: {
559 data.enforceInterface(IActivityManager.descriptor);
560 int task = data.readInt();
561 moveTaskToBack(task);
562 reply.writeNoException();
563 return true;
564 }
565
566 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
567 data.enforceInterface(IActivityManager.descriptor);
568 IBinder token = data.readStrongBinder();
569 boolean nonRoot = data.readInt() != 0;
570 boolean res = moveActivityTaskToBack(token, nonRoot);
571 reply.writeNoException();
572 reply.writeInt(res ? 1 : 0);
573 return true;
574 }
575
576 case MOVE_TASK_BACKWARDS_TRANSACTION: {
577 data.enforceInterface(IActivityManager.descriptor);
578 int task = data.readInt();
579 moveTaskBackwards(task);
580 reply.writeNoException();
581 return true;
582 }
583
584 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
585 data.enforceInterface(IActivityManager.descriptor);
586 IBinder token = data.readStrongBinder();
587 boolean onlyRoot = data.readInt() != 0;
588 int res = token != null
589 ? getTaskForActivity(token, onlyRoot) : -1;
590 reply.writeNoException();
591 reply.writeInt(res);
592 return true;
593 }
594
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800595 case REPORT_THUMBNAIL_TRANSACTION: {
596 data.enforceInterface(IActivityManager.descriptor);
597 IBinder token = data.readStrongBinder();
598 Bitmap thumbnail = data.readInt() != 0
599 ? Bitmap.CREATOR.createFromParcel(data) : null;
600 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
601 reportThumbnail(token, thumbnail, description);
602 reply.writeNoException();
603 return true;
604 }
605
606 case GET_CONTENT_PROVIDER_TRANSACTION: {
607 data.enforceInterface(IActivityManager.descriptor);
608 IBinder b = data.readStrongBinder();
609 IApplicationThread app = ApplicationThreadNative.asInterface(b);
610 String name = data.readString();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700611 boolean stable = data.readInt() != 0;
612 ContentProviderHolder cph = getContentProvider(app, name, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 reply.writeNoException();
614 if (cph != null) {
615 reply.writeInt(1);
616 cph.writeToParcel(reply, 0);
617 } else {
618 reply.writeInt(0);
619 }
620 return true;
621 }
622
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800623 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
624 data.enforceInterface(IActivityManager.descriptor);
625 String name = data.readString();
626 IBinder token = data.readStrongBinder();
627 ContentProviderHolder cph = getContentProviderExternal(name, token);
628 reply.writeNoException();
629 if (cph != null) {
630 reply.writeInt(1);
631 cph.writeToParcel(reply, 0);
632 } else {
633 reply.writeInt(0);
634 }
635 return true;
636 }
637
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
639 data.enforceInterface(IActivityManager.descriptor);
640 IBinder b = data.readStrongBinder();
641 IApplicationThread app = ApplicationThreadNative.asInterface(b);
642 ArrayList<ContentProviderHolder> providers =
643 data.createTypedArrayList(ContentProviderHolder.CREATOR);
644 publishContentProviders(app, providers);
645 reply.writeNoException();
646 return true;
647 }
648
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700649 case REF_CONTENT_PROVIDER_TRANSACTION: {
650 data.enforceInterface(IActivityManager.descriptor);
651 IBinder b = data.readStrongBinder();
652 int stable = data.readInt();
653 int unstable = data.readInt();
654 boolean res = refContentProvider(b, stable, unstable);
655 reply.writeNoException();
656 reply.writeInt(res ? 1 : 0);
657 return true;
658 }
659
660 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
661 data.enforceInterface(IActivityManager.descriptor);
662 IBinder b = data.readStrongBinder();
663 unstableProviderDied(b);
664 reply.writeNoException();
665 return true;
666 }
667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800668 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
669 data.enforceInterface(IActivityManager.descriptor);
670 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700671 boolean stable = data.readInt() != 0;
672 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800673 reply.writeNoException();
674 return true;
675 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800676
677 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
678 data.enforceInterface(IActivityManager.descriptor);
679 String name = data.readString();
680 IBinder token = data.readStrongBinder();
681 removeContentProviderExternal(name, token);
682 reply.writeNoException();
683 return true;
684 }
685
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700686 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
687 data.enforceInterface(IActivityManager.descriptor);
688 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
689 PendingIntent pi = getRunningServiceControlPanel(comp);
690 reply.writeNoException();
691 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
692 return true;
693 }
694
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800695 case START_SERVICE_TRANSACTION: {
696 data.enforceInterface(IActivityManager.descriptor);
697 IBinder b = data.readStrongBinder();
698 IApplicationThread app = ApplicationThreadNative.asInterface(b);
699 Intent service = Intent.CREATOR.createFromParcel(data);
700 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700701 int userId = data.readInt();
702 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800703 reply.writeNoException();
704 ComponentName.writeToParcel(cn, reply);
705 return true;
706 }
707
708 case STOP_SERVICE_TRANSACTION: {
709 data.enforceInterface(IActivityManager.descriptor);
710 IBinder b = data.readStrongBinder();
711 IApplicationThread app = ApplicationThreadNative.asInterface(b);
712 Intent service = Intent.CREATOR.createFromParcel(data);
713 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700714 int userId = data.readInt();
715 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800716 reply.writeNoException();
717 reply.writeInt(res);
718 return true;
719 }
720
721 case STOP_SERVICE_TOKEN_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 ComponentName className = ComponentName.readFromParcel(data);
724 IBinder token = data.readStrongBinder();
725 int startId = data.readInt();
726 boolean res = stopServiceToken(className, token, startId);
727 reply.writeNoException();
728 reply.writeInt(res ? 1 : 0);
729 return true;
730 }
731
732 case SET_SERVICE_FOREGROUND_TRANSACTION: {
733 data.enforceInterface(IActivityManager.descriptor);
734 ComponentName className = ComponentName.readFromParcel(data);
735 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700736 int id = data.readInt();
737 Notification notification = null;
738 if (data.readInt() != 0) {
739 notification = Notification.CREATOR.createFromParcel(data);
740 }
741 boolean removeNotification = data.readInt() != 0;
742 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800743 reply.writeNoException();
744 return true;
745 }
746
747 case BIND_SERVICE_TRANSACTION: {
748 data.enforceInterface(IActivityManager.descriptor);
749 IBinder b = data.readStrongBinder();
750 IApplicationThread app = ApplicationThreadNative.asInterface(b);
751 IBinder token = data.readStrongBinder();
752 Intent service = Intent.CREATOR.createFromParcel(data);
753 String resolvedType = data.readString();
754 b = data.readStrongBinder();
755 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800756 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800757 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800758 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 reply.writeNoException();
760 reply.writeInt(res);
761 return true;
762 }
763
764 case UNBIND_SERVICE_TRANSACTION: {
765 data.enforceInterface(IActivityManager.descriptor);
766 IBinder b = data.readStrongBinder();
767 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
768 boolean res = unbindService(conn);
769 reply.writeNoException();
770 reply.writeInt(res ? 1 : 0);
771 return true;
772 }
773
774 case PUBLISH_SERVICE_TRANSACTION: {
775 data.enforceInterface(IActivityManager.descriptor);
776 IBinder token = data.readStrongBinder();
777 Intent intent = Intent.CREATOR.createFromParcel(data);
778 IBinder service = data.readStrongBinder();
779 publishService(token, intent, service);
780 reply.writeNoException();
781 return true;
782 }
783
784 case UNBIND_FINISHED_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 IBinder token = data.readStrongBinder();
787 Intent intent = Intent.CREATOR.createFromParcel(data);
788 boolean doRebind = data.readInt() != 0;
789 unbindFinished(token, intent, doRebind);
790 reply.writeNoException();
791 return true;
792 }
793
794 case SERVICE_DONE_EXECUTING_TRANSACTION: {
795 data.enforceInterface(IActivityManager.descriptor);
796 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700797 int type = data.readInt();
798 int startId = data.readInt();
799 int res = data.readInt();
800 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800801 reply.writeNoException();
802 return true;
803 }
804
805 case START_INSTRUMENTATION_TRANSACTION: {
806 data.enforceInterface(IActivityManager.descriptor);
807 ComponentName className = ComponentName.readFromParcel(data);
808 String profileFile = data.readString();
809 int fl = data.readInt();
810 Bundle arguments = data.readBundle();
811 IBinder b = data.readStrongBinder();
812 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
813 boolean res = startInstrumentation(className, profileFile, fl, arguments, w);
814 reply.writeNoException();
815 reply.writeInt(res ? 1 : 0);
816 return true;
817 }
818
819
820 case FINISH_INSTRUMENTATION_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder b = data.readStrongBinder();
823 IApplicationThread app = ApplicationThreadNative.asInterface(b);
824 int resultCode = data.readInt();
825 Bundle results = data.readBundle();
826 finishInstrumentation(app, resultCode, results);
827 reply.writeNoException();
828 return true;
829 }
830
831 case GET_CONFIGURATION_TRANSACTION: {
832 data.enforceInterface(IActivityManager.descriptor);
833 Configuration config = getConfiguration();
834 reply.writeNoException();
835 config.writeToParcel(reply, 0);
836 return true;
837 }
838
839 case UPDATE_CONFIGURATION_TRANSACTION: {
840 data.enforceInterface(IActivityManager.descriptor);
841 Configuration config = Configuration.CREATOR.createFromParcel(data);
842 updateConfiguration(config);
843 reply.writeNoException();
844 return true;
845 }
846
847 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 IBinder token = data.readStrongBinder();
850 int requestedOrientation = data.readInt();
851 setRequestedOrientation(token, requestedOrientation);
852 reply.writeNoException();
853 return true;
854 }
855
856 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
857 data.enforceInterface(IActivityManager.descriptor);
858 IBinder token = data.readStrongBinder();
859 int req = getRequestedOrientation(token);
860 reply.writeNoException();
861 reply.writeInt(req);
862 return true;
863 }
864
865 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder token = data.readStrongBinder();
868 ComponentName cn = getActivityClassForToken(token);
869 reply.writeNoException();
870 ComponentName.writeToParcel(cn, reply);
871 return true;
872 }
873
874 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
875 data.enforceInterface(IActivityManager.descriptor);
876 IBinder token = data.readStrongBinder();
877 reply.writeNoException();
878 reply.writeString(getPackageForToken(token));
879 return true;
880 }
881
882 case GET_INTENT_SENDER_TRANSACTION: {
883 data.enforceInterface(IActivityManager.descriptor);
884 int type = data.readInt();
885 String packageName = data.readString();
886 IBinder token = data.readStrongBinder();
887 String resultWho = data.readString();
888 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800889 Intent[] requestIntents;
890 String[] requestResolvedTypes;
891 if (data.readInt() != 0) {
892 requestIntents = data.createTypedArray(Intent.CREATOR);
893 requestResolvedTypes = data.createStringArray();
894 } else {
895 requestIntents = null;
896 requestResolvedTypes = null;
897 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800898 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700899 Bundle options = data.readInt() != 0
900 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700901 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800902 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800903 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700904 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800905 reply.writeNoException();
906 reply.writeStrongBinder(res != null ? res.asBinder() : null);
907 return true;
908 }
909
910 case CANCEL_INTENT_SENDER_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 IIntentSender r = IIntentSender.Stub.asInterface(
913 data.readStrongBinder());
914 cancelIntentSender(r);
915 reply.writeNoException();
916 return true;
917 }
918
919 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
920 data.enforceInterface(IActivityManager.descriptor);
921 IIntentSender r = IIntentSender.Stub.asInterface(
922 data.readStrongBinder());
923 String res = getPackageForIntentSender(r);
924 reply.writeNoException();
925 reply.writeString(res);
926 return true;
927 }
928
Christopher Tatec4a07d12012-04-06 14:19:13 -0700929 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
930 data.enforceInterface(IActivityManager.descriptor);
931 IIntentSender r = IIntentSender.Stub.asInterface(
932 data.readStrongBinder());
933 int res = getUidForIntentSender(r);
934 reply.writeNoException();
935 reply.writeInt(res);
936 return true;
937 }
938
Dianne Hackborn41203752012-08-31 14:05:51 -0700939 case HANDLE_INCOMING_USER_TRANSACTION: {
940 data.enforceInterface(IActivityManager.descriptor);
941 int callingPid = data.readInt();
942 int callingUid = data.readInt();
943 int userId = data.readInt();
944 boolean allowAll = data.readInt() != 0 ;
945 boolean requireFull = data.readInt() != 0;
946 String name = data.readString();
947 String callerPackage = data.readString();
948 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
949 requireFull, name, callerPackage);
950 reply.writeNoException();
951 reply.writeInt(res);
952 return true;
953 }
954
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800955 case SET_PROCESS_LIMIT_TRANSACTION: {
956 data.enforceInterface(IActivityManager.descriptor);
957 int max = data.readInt();
958 setProcessLimit(max);
959 reply.writeNoException();
960 return true;
961 }
962
963 case GET_PROCESS_LIMIT_TRANSACTION: {
964 data.enforceInterface(IActivityManager.descriptor);
965 int limit = getProcessLimit();
966 reply.writeNoException();
967 reply.writeInt(limit);
968 return true;
969 }
970
971 case SET_PROCESS_FOREGROUND_TRANSACTION: {
972 data.enforceInterface(IActivityManager.descriptor);
973 IBinder token = data.readStrongBinder();
974 int pid = data.readInt();
975 boolean isForeground = data.readInt() != 0;
976 setProcessForeground(token, pid, isForeground);
977 reply.writeNoException();
978 return true;
979 }
980
981 case CHECK_PERMISSION_TRANSACTION: {
982 data.enforceInterface(IActivityManager.descriptor);
983 String perm = data.readString();
984 int pid = data.readInt();
985 int uid = data.readInt();
986 int res = checkPermission(perm, pid, uid);
987 reply.writeNoException();
988 reply.writeInt(res);
989 return true;
990 }
991
992 case CHECK_URI_PERMISSION_TRANSACTION: {
993 data.enforceInterface(IActivityManager.descriptor);
994 Uri uri = Uri.CREATOR.createFromParcel(data);
995 int pid = data.readInt();
996 int uid = data.readInt();
997 int mode = data.readInt();
998 int res = checkUriPermission(uri, pid, uid, mode);
999 reply.writeNoException();
1000 reply.writeInt(res);
1001 return true;
1002 }
1003
1004 case CLEAR_APP_DATA_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 String packageName = data.readString();
1007 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1008 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001009 int userId = data.readInt();
1010 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001011 reply.writeNoException();
1012 reply.writeInt(res ? 1 : 0);
1013 return true;
1014 }
1015
1016 case GRANT_URI_PERMISSION_TRANSACTION: {
1017 data.enforceInterface(IActivityManager.descriptor);
1018 IBinder b = data.readStrongBinder();
1019 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1020 String targetPkg = data.readString();
1021 Uri uri = Uri.CREATOR.createFromParcel(data);
1022 int mode = data.readInt();
1023 grantUriPermission(app, targetPkg, uri, mode);
1024 reply.writeNoException();
1025 return true;
1026 }
1027
1028 case REVOKE_URI_PERMISSION_TRANSACTION: {
1029 data.enforceInterface(IActivityManager.descriptor);
1030 IBinder b = data.readStrongBinder();
1031 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1032 Uri uri = Uri.CREATOR.createFromParcel(data);
1033 int mode = data.readInt();
1034 revokeUriPermission(app, uri, mode);
1035 reply.writeNoException();
1036 return true;
1037 }
1038
1039 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1040 data.enforceInterface(IActivityManager.descriptor);
1041 IBinder b = data.readStrongBinder();
1042 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1043 boolean waiting = data.readInt() != 0;
1044 showWaitingForDebugger(app, waiting);
1045 reply.writeNoException();
1046 return true;
1047 }
1048
1049 case GET_MEMORY_INFO_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1052 getMemoryInfo(mi);
1053 reply.writeNoException();
1054 mi.writeToParcel(reply, 0);
1055 return true;
1056 }
1057
1058 case UNHANDLED_BACK_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 unhandledBack();
1061 reply.writeNoException();
1062 return true;
1063 }
1064
1065 case OPEN_CONTENT_URI_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 Uri uri = Uri.parse(data.readString());
1068 ParcelFileDescriptor pfd = openContentUri(uri);
1069 reply.writeNoException();
1070 if (pfd != null) {
1071 reply.writeInt(1);
1072 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1073 } else {
1074 reply.writeInt(0);
1075 }
1076 return true;
1077 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001078
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001079 case GOING_TO_SLEEP_TRANSACTION: {
1080 data.enforceInterface(IActivityManager.descriptor);
1081 goingToSleep();
1082 reply.writeNoException();
1083 return true;
1084 }
1085
1086 case WAKING_UP_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 wakingUp();
1089 reply.writeNoException();
1090 return true;
1091 }
1092
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001093 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1094 data.enforceInterface(IActivityManager.descriptor);
1095 setLockScreenShown(data.readInt() != 0);
1096 reply.writeNoException();
1097 return true;
1098 }
1099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 case SET_DEBUG_APP_TRANSACTION: {
1101 data.enforceInterface(IActivityManager.descriptor);
1102 String pn = data.readString();
1103 boolean wfd = data.readInt() != 0;
1104 boolean per = data.readInt() != 0;
1105 setDebugApp(pn, wfd, per);
1106 reply.writeNoException();
1107 return true;
1108 }
1109
1110 case SET_ALWAYS_FINISH_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 boolean enabled = data.readInt() != 0;
1113 setAlwaysFinish(enabled);
1114 reply.writeNoException();
1115 return true;
1116 }
1117
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001118 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001119 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001120 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001122 setActivityController(watcher);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001123 return true;
1124 }
1125
1126 case ENTER_SAFE_MODE_TRANSACTION: {
1127 data.enforceInterface(IActivityManager.descriptor);
1128 enterSafeMode();
1129 reply.writeNoException();
1130 return true;
1131 }
1132
1133 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 IIntentSender is = IIntentSender.Stub.asInterface(
1136 data.readStrongBinder());
1137 noteWakeupAlarm(is);
1138 reply.writeNoException();
1139 return true;
1140 }
1141
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001142 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001143 data.enforceInterface(IActivityManager.descriptor);
1144 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001145 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001146 boolean secure = data.readInt() != 0;
1147 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 reply.writeNoException();
1149 reply.writeInt(res ? 1 : 0);
1150 return true;
1151 }
1152
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001153 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1154 data.enforceInterface(IActivityManager.descriptor);
1155 String reason = data.readString();
1156 boolean res = killProcessesBelowForeground(reason);
1157 reply.writeNoException();
1158 reply.writeInt(res ? 1 : 0);
1159 return true;
1160 }
1161
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001162 case START_RUNNING_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 String pkg = data.readString();
1165 String cls = data.readString();
1166 String action = data.readString();
1167 String indata = data.readString();
1168 startRunning(pkg, cls, action, indata);
1169 reply.writeNoException();
1170 return true;
1171 }
1172
Dan Egnor60d87622009-12-16 16:32:58 -08001173 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1174 data.enforceInterface(IActivityManager.descriptor);
1175 IBinder app = data.readStrongBinder();
1176 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1177 handleApplicationCrash(app, ci);
1178 reply.writeNoException();
1179 return true;
1180 }
1181
1182 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001183 data.enforceInterface(IActivityManager.descriptor);
1184 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001185 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001186 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001187 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001188 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001189 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 return true;
1191 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001192
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001193 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1194 data.enforceInterface(IActivityManager.descriptor);
1195 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001196 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001197 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1198 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001199 reply.writeNoException();
1200 return true;
1201 }
1202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1204 data.enforceInterface(IActivityManager.descriptor);
1205 int sig = data.readInt();
1206 signalPersistentProcesses(sig);
1207 reply.writeNoException();
1208 return true;
1209 }
1210
Dianne Hackborn03abb812010-01-04 18:43:19 -08001211 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 String packageName = data.readString();
Dianne Hackborn03abb812010-01-04 18:43:19 -08001214 killBackgroundProcesses(packageName);
1215 reply.writeNoException();
1216 return true;
1217 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001218
1219 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1220 data.enforceInterface(IActivityManager.descriptor);
1221 killAllBackgroundProcesses();
1222 reply.writeNoException();
1223 return true;
1224 }
Dianne Hackborn03abb812010-01-04 18:43:19 -08001225
1226 case FORCE_STOP_PACKAGE_TRANSACTION: {
1227 data.enforceInterface(IActivityManager.descriptor);
1228 String packageName = data.readString();
1229 forceStopPackage(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 reply.writeNoException();
1231 return true;
1232 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001233
1234 case GET_MY_MEMORY_STATE_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 ActivityManager.RunningAppProcessInfo info =
1237 new ActivityManager.RunningAppProcessInfo();
1238 getMyMemoryState(info);
1239 reply.writeNoException();
1240 info.writeToParcel(reply, 0);
1241 return true;
1242 }
1243
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1245 data.enforceInterface(IActivityManager.descriptor);
1246 ConfigurationInfo config = getDeviceConfigurationInfo();
1247 reply.writeNoException();
1248 config.writeToParcel(reply, 0);
1249 return true;
1250 }
1251
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001252 case PROFILE_CONTROL_TRANSACTION: {
1253 data.enforceInterface(IActivityManager.descriptor);
1254 String process = data.readString();
1255 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001256 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001257 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001258 ParcelFileDescriptor fd = data.readInt() != 0
1259 ? data.readFileDescriptor() : null;
Romain Guy7eabe552011-07-21 14:56:34 -07001260 boolean res = profileControl(process, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001261 reply.writeNoException();
1262 reply.writeInt(res ? 1 : 0);
1263 return true;
1264 }
1265
Dianne Hackborn55280a92009-05-07 15:53:46 -07001266 case SHUTDOWN_TRANSACTION: {
1267 data.enforceInterface(IActivityManager.descriptor);
1268 boolean res = shutdown(data.readInt());
1269 reply.writeNoException();
1270 reply.writeInt(res ? 1 : 0);
1271 return true;
1272 }
1273
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001274 case STOP_APP_SWITCHES_TRANSACTION: {
1275 data.enforceInterface(IActivityManager.descriptor);
1276 stopAppSwitches();
1277 reply.writeNoException();
1278 return true;
1279 }
1280
1281 case RESUME_APP_SWITCHES_TRANSACTION: {
1282 data.enforceInterface(IActivityManager.descriptor);
1283 resumeAppSwitches();
1284 reply.writeNoException();
1285 return true;
1286 }
1287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001288 case PEEK_SERVICE_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 Intent service = Intent.CREATOR.createFromParcel(data);
1291 String resolvedType = data.readString();
1292 IBinder binder = peekService(service, resolvedType);
1293 reply.writeNoException();
1294 reply.writeStrongBinder(binder);
1295 return true;
1296 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001297
1298 case START_BACKUP_AGENT_TRANSACTION: {
1299 data.enforceInterface(IActivityManager.descriptor);
1300 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1301 int backupRestoreMode = data.readInt();
1302 boolean success = bindBackupAgent(info, backupRestoreMode);
1303 reply.writeNoException();
1304 reply.writeInt(success ? 1 : 0);
1305 return true;
1306 }
1307
1308 case BACKUP_AGENT_CREATED_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
1310 String packageName = data.readString();
1311 IBinder agent = data.readStrongBinder();
1312 backupAgentCreated(packageName, agent);
1313 reply.writeNoException();
1314 return true;
1315 }
1316
1317 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1320 unbindBackupAgent(info);
1321 reply.writeNoException();
1322 return true;
1323 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001324
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001325 case KILL_APPLICATION_WITH_UID_TRANSACTION: {
1326 data.enforceInterface(IActivityManager.descriptor);
1327 String pkg = data.readString();
1328 int uid = data.readInt();
1329 killApplicationWithUid(pkg, uid);
1330 reply.writeNoException();
1331 return true;
1332 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001333
1334 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1335 data.enforceInterface(IActivityManager.descriptor);
1336 String reason = data.readString();
1337 closeSystemDialogs(reason);
1338 reply.writeNoException();
1339 return true;
1340 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001341
1342 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1343 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001344 int[] pids = data.createIntArray();
1345 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001346 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001347 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001348 return true;
1349 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001350
1351 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 String processName = data.readString();
1354 int uid = data.readInt();
1355 killApplicationProcess(processName, uid);
1356 reply.writeNoException();
1357 return true;
1358 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001359
1360 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 IBinder token = data.readStrongBinder();
1363 String packageName = data.readString();
1364 int enterAnim = data.readInt();
1365 int exitAnim = data.readInt();
1366 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001367 reply.writeNoException();
1368 return true;
1369 }
1370
1371 case IS_USER_A_MONKEY_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001373 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001374 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001375 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001376 return true;
1377 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001378
1379 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
1381 finishHeavyWeightApp();
1382 reply.writeNoException();
1383 return true;
1384 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001385
1386 case IS_IMMERSIVE_TRANSACTION: {
1387 data.enforceInterface(IActivityManager.descriptor);
1388 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001389 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001390 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001391 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001392 return true;
1393 }
1394
1395 case SET_IMMERSIVE_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 IBinder token = data.readStrongBinder();
1398 boolean imm = data.readInt() == 1;
1399 setImmersive(token, imm);
1400 reply.writeNoException();
1401 return true;
1402 }
1403
1404 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001406 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001407 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001408 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001409 return true;
1410 }
1411
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001412 case CRASH_APPLICATION_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 int uid = data.readInt();
1415 int initialPid = data.readInt();
1416 String packageName = data.readString();
1417 String message = data.readString();
1418 crashApplication(uid, initialPid, packageName, message);
1419 reply.writeNoException();
1420 return true;
1421 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001422
1423 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1424 data.enforceInterface(IActivityManager.descriptor);
1425 Uri uri = Uri.CREATOR.createFromParcel(data);
1426 String type = getProviderMimeType(uri);
1427 reply.writeNoException();
1428 reply.writeString(type);
1429 return true;
1430 }
1431
Dianne Hackborn7e269642010-08-25 19:50:20 -07001432 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1433 data.enforceInterface(IActivityManager.descriptor);
1434 String name = data.readString();
1435 IBinder perm = newUriPermissionOwner(name);
1436 reply.writeNoException();
1437 reply.writeStrongBinder(perm);
1438 return true;
1439 }
1440
1441 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1442 data.enforceInterface(IActivityManager.descriptor);
1443 IBinder owner = data.readStrongBinder();
1444 int fromUid = data.readInt();
1445 String targetPkg = data.readString();
1446 Uri uri = Uri.CREATOR.createFromParcel(data);
1447 int mode = data.readInt();
1448 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1449 reply.writeNoException();
1450 return true;
1451 }
1452
1453 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 IBinder owner = data.readStrongBinder();
1456 Uri uri = null;
1457 if (data.readInt() != 0) {
1458 Uri.CREATOR.createFromParcel(data);
1459 }
1460 int mode = data.readInt();
1461 revokeUriPermissionFromOwner(owner, uri, mode);
1462 reply.writeNoException();
1463 return true;
1464 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001465
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001466 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1467 data.enforceInterface(IActivityManager.descriptor);
1468 int callingUid = data.readInt();
1469 String targetPkg = data.readString();
1470 Uri uri = Uri.CREATOR.createFromParcel(data);
1471 int modeFlags = data.readInt();
1472 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1473 reply.writeNoException();
1474 reply.writeInt(res);
1475 return true;
1476 }
1477
Andy McFadden824c5102010-07-09 16:26:57 -07001478 case DUMP_HEAP_TRANSACTION: {
1479 data.enforceInterface(IActivityManager.descriptor);
1480 String process = data.readString();
1481 boolean managed = data.readInt() != 0;
1482 String path = data.readString();
1483 ParcelFileDescriptor fd = data.readInt() != 0
1484 ? data.readFileDescriptor() : null;
1485 boolean res = dumpHeap(process, managed, path, fd);
1486 reply.writeNoException();
1487 reply.writeInt(res ? 1 : 0);
1488 return true;
1489 }
1490
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001491 case START_ACTIVITIES_TRANSACTION:
1492 {
1493 data.enforceInterface(IActivityManager.descriptor);
1494 IBinder b = data.readStrongBinder();
1495 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1496 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1497 String[] resolvedTypes = data.createStringArray();
1498 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001499 Bundle options = data.readInt() != 0
1500 ? Bundle.CREATOR.createFromParcel(data) : null;
1501 int result = startActivities(app, intents, resolvedTypes, resultTo,
1502 options);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001503 reply.writeNoException();
1504 reply.writeInt(result);
1505 return true;
1506 }
1507
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001508 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1509 {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 int mode = getFrontActivityScreenCompatMode();
1512 reply.writeNoException();
1513 reply.writeInt(mode);
1514 return true;
1515 }
1516
1517 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1518 {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 int mode = data.readInt();
1521 setFrontActivityScreenCompatMode(mode);
1522 reply.writeNoException();
1523 reply.writeInt(mode);
1524 return true;
1525 }
1526
1527 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1528 {
1529 data.enforceInterface(IActivityManager.descriptor);
1530 String pkg = data.readString();
1531 int mode = getPackageScreenCompatMode(pkg);
1532 reply.writeNoException();
1533 reply.writeInt(mode);
1534 return true;
1535 }
1536
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001537 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1538 {
1539 data.enforceInterface(IActivityManager.descriptor);
1540 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001541 int mode = data.readInt();
1542 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001543 reply.writeNoException();
1544 return true;
1545 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001546
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001547 case SWITCH_USER_TRANSACTION: {
1548 data.enforceInterface(IActivityManager.descriptor);
1549 int userid = data.readInt();
1550 boolean result = switchUser(userid);
1551 reply.writeNoException();
1552 reply.writeInt(result ? 1 : 0);
1553 return true;
1554 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001555
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001556 case STOP_USER_TRANSACTION: {
1557 data.enforceInterface(IActivityManager.descriptor);
1558 int userid = data.readInt();
1559 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1560 data.readStrongBinder());
1561 int result = stopUser(userid, callback);
1562 reply.writeNoException();
1563 reply.writeInt(result);
1564 return true;
1565 }
1566
Amith Yamasani52f1d752012-03-28 18:19:29 -07001567 case GET_CURRENT_USER_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 UserInfo userInfo = getCurrentUser();
1570 reply.writeNoException();
1571 userInfo.writeToParcel(reply, 0);
1572 return true;
1573 }
1574
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001575 case REMOVE_SUB_TASK_TRANSACTION:
1576 {
1577 data.enforceInterface(IActivityManager.descriptor);
1578 int taskId = data.readInt();
1579 int subTaskIndex = data.readInt();
1580 boolean result = removeSubTask(taskId, subTaskIndex);
1581 reply.writeNoException();
1582 reply.writeInt(result ? 1 : 0);
1583 return true;
1584 }
1585
1586 case REMOVE_TASK_TRANSACTION:
1587 {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 int taskId = data.readInt();
1590 int fl = data.readInt();
1591 boolean result = removeTask(taskId, fl);
1592 reply.writeNoException();
1593 reply.writeInt(result ? 1 : 0);
1594 return true;
1595 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001596
Jeff Sharkeya4620792011-05-20 15:29:23 -07001597 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1598 data.enforceInterface(IActivityManager.descriptor);
1599 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1600 data.readStrongBinder());
1601 registerProcessObserver(observer);
1602 return true;
1603 }
1604
1605 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1606 data.enforceInterface(IActivityManager.descriptor);
1607 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1608 data.readStrongBinder());
1609 unregisterProcessObserver(observer);
1610 return true;
1611 }
1612
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001613 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1614 {
1615 data.enforceInterface(IActivityManager.descriptor);
1616 String pkg = data.readString();
1617 boolean ask = getPackageAskScreenCompat(pkg);
1618 reply.writeNoException();
1619 reply.writeInt(ask ? 1 : 0);
1620 return true;
1621 }
1622
1623 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1624 {
1625 data.enforceInterface(IActivityManager.descriptor);
1626 String pkg = data.readString();
1627 boolean ask = data.readInt() != 0;
1628 setPackageAskScreenCompat(pkg, ask);
1629 reply.writeNoException();
1630 return true;
1631 }
1632
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001633 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1634 data.enforceInterface(IActivityManager.descriptor);
1635 IIntentSender r = IIntentSender.Stub.asInterface(
1636 data.readStrongBinder());
1637 boolean res = isIntentSenderTargetedToPackage(r);
1638 reply.writeNoException();
1639 reply.writeInt(res ? 1 : 0);
1640 return true;
1641 }
1642
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001643 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1644 data.enforceInterface(IActivityManager.descriptor);
1645 IIntentSender r = IIntentSender.Stub.asInterface(
1646 data.readStrongBinder());
1647 boolean res = isIntentSenderAnActivity(r);
1648 reply.writeNoException();
1649 reply.writeInt(res ? 1 : 0);
1650 return true;
1651 }
1652
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001653 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1654 data.enforceInterface(IActivityManager.descriptor);
1655 Configuration config = Configuration.CREATOR.createFromParcel(data);
1656 updatePersistentConfiguration(config);
1657 reply.writeNoException();
1658 return true;
1659 }
1660
Dianne Hackbornb437e092011-08-05 17:50:29 -07001661 case GET_PROCESS_PSS_TRANSACTION: {
1662 data.enforceInterface(IActivityManager.descriptor);
1663 int[] pids = data.createIntArray();
1664 long[] pss = getProcessPss(pids);
1665 reply.writeNoException();
1666 reply.writeLongArray(pss);
1667 return true;
1668 }
1669
Dianne Hackborn661cd522011-08-22 00:26:20 -07001670 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1671 data.enforceInterface(IActivityManager.descriptor);
1672 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1673 boolean always = data.readInt() != 0;
1674 showBootMessage(msg, always);
1675 reply.writeNoException();
1676 return true;
1677 }
1678
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001679 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 dismissKeyguardOnNextActivity();
1682 reply.writeNoException();
1683 return true;
1684 }
1685
Adam Powelldd8fab22012-03-22 17:47:27 -07001686 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 IBinder token = data.readStrongBinder();
1689 String destAffinity = data.readString();
1690 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1691 reply.writeNoException();
1692 reply.writeInt(res ? 1 : 0);
1693 return true;
1694 }
1695
1696 case NAVIGATE_UP_TO_TRANSACTION: {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 IBinder token = data.readStrongBinder();
1699 Intent target = Intent.CREATOR.createFromParcel(data);
1700 int resultCode = data.readInt();
1701 Intent resultData = null;
1702 if (data.readInt() != 0) {
1703 resultData = Intent.CREATOR.createFromParcel(data);
1704 }
1705 boolean res = navigateUpTo(token, target, resultCode, resultData);
1706 reply.writeNoException();
1707 reply.writeInt(res ? 1 : 0);
1708 return true;
1709 }
1710
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001711 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1712 data.enforceInterface(IActivityManager.descriptor);
1713 IBinder token = data.readStrongBinder();
1714 int res = getLaunchedFromUid(token);
1715 reply.writeNoException();
1716 reply.writeInt(res);
1717 return true;
1718 }
1719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001720 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001721
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001722 return super.onTransact(code, data, reply, flags);
1723 }
1724
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001725 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 return this;
1727 }
1728
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001729 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
1730 protected IActivityManager create() {
1731 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07001732 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001733 Log.v("ActivityManager", "default service binder = " + b);
1734 }
1735 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07001736 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08001737 Log.v("ActivityManager", "default service = " + am);
1738 }
1739 return am;
1740 }
1741 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001742}
1743
1744class ActivityManagerProxy implements IActivityManager
1745{
1746 public ActivityManagerProxy(IBinder remote)
1747 {
1748 mRemote = remote;
1749 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001750
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001751 public IBinder asBinder()
1752 {
1753 return mRemote;
1754 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08001755
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001756 public int startActivity(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001757 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1758 int startFlags, String profileFile,
1759 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001760 Parcel data = Parcel.obtain();
1761 Parcel reply = Parcel.obtain();
1762 data.writeInterfaceToken(IActivityManager.descriptor);
1763 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1764 intent.writeToParcel(data, 0);
1765 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001766 data.writeStrongBinder(resultTo);
1767 data.writeString(resultWho);
1768 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001769 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001770 data.writeString(profileFile);
1771 if (profileFd != null) {
1772 data.writeInt(1);
1773 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1774 } else {
1775 data.writeInt(0);
1776 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001777 if (options != null) {
1778 data.writeInt(1);
1779 options.writeToParcel(data, 0);
1780 } else {
1781 data.writeInt(0);
1782 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001783 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1784 reply.readException();
1785 int result = reply.readInt();
1786 reply.recycle();
1787 data.recycle();
1788 return result;
1789 }
Amith Yamasani82644082012-08-03 13:09:11 -07001790
1791 public int startActivityAsUser(IApplicationThread caller, Intent intent,
1792 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
1793 int startFlags, String profileFile,
1794 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
1795 Parcel data = Parcel.obtain();
1796 Parcel reply = Parcel.obtain();
1797 data.writeInterfaceToken(IActivityManager.descriptor);
1798 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1799 intent.writeToParcel(data, 0);
1800 data.writeString(resolvedType);
1801 data.writeStrongBinder(resultTo);
1802 data.writeString(resultWho);
1803 data.writeInt(requestCode);
1804 data.writeInt(startFlags);
1805 data.writeString(profileFile);
1806 if (profileFd != null) {
1807 data.writeInt(1);
1808 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1809 } else {
1810 data.writeInt(0);
1811 }
1812 if (options != null) {
1813 data.writeInt(1);
1814 options.writeToParcel(data, 0);
1815 } else {
1816 data.writeInt(0);
1817 }
1818 data.writeInt(userId);
1819 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
1820 reply.readException();
1821 int result = reply.readInt();
1822 reply.recycle();
1823 data.recycle();
1824 return result;
1825 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001826 public WaitResult startActivityAndWait(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001827 String resolvedType, IBinder resultTo, String resultWho,
1828 int requestCode, int startFlags, String profileFile,
1829 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001830 Parcel data = Parcel.obtain();
1831 Parcel reply = Parcel.obtain();
1832 data.writeInterfaceToken(IActivityManager.descriptor);
1833 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1834 intent.writeToParcel(data, 0);
1835 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001836 data.writeStrongBinder(resultTo);
1837 data.writeString(resultWho);
1838 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001839 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07001840 data.writeString(profileFile);
1841 if (profileFd != null) {
1842 data.writeInt(1);
1843 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1844 } else {
1845 data.writeInt(0);
1846 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07001847 if (options != null) {
1848 data.writeInt(1);
1849 options.writeToParcel(data, 0);
1850 } else {
1851 data.writeInt(0);
1852 }
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08001853 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
1854 reply.readException();
1855 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
1856 reply.recycle();
1857 data.recycle();
1858 return result;
1859 }
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001860 public int startActivityWithConfig(IApplicationThread caller, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001861 String resolvedType, IBinder resultTo, String resultWho,
1862 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07001863 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001864 Parcel data = Parcel.obtain();
1865 Parcel reply = Parcel.obtain();
1866 data.writeInterfaceToken(IActivityManager.descriptor);
1867 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1868 intent.writeToParcel(data, 0);
1869 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001870 data.writeStrongBinder(resultTo);
1871 data.writeString(resultWho);
1872 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001873 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001874 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001875 if (options != null) {
1876 data.writeInt(1);
1877 options.writeToParcel(data, 0);
1878 } else {
1879 data.writeInt(0);
1880 }
Dianne Hackborn41203752012-08-31 14:05:51 -07001881 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07001882 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
1883 reply.readException();
1884 int result = reply.readInt();
1885 reply.recycle();
1886 data.recycle();
1887 return result;
1888 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001889 public int startActivityIntentSender(IApplicationThread caller,
1890 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001891 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001892 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001893 Parcel data = Parcel.obtain();
1894 Parcel reply = Parcel.obtain();
1895 data.writeInterfaceToken(IActivityManager.descriptor);
1896 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
1897 intent.writeToParcel(data, 0);
1898 if (fillInIntent != null) {
1899 data.writeInt(1);
1900 fillInIntent.writeToParcel(data, 0);
1901 } else {
1902 data.writeInt(0);
1903 }
1904 data.writeString(resolvedType);
1905 data.writeStrongBinder(resultTo);
1906 data.writeString(resultWho);
1907 data.writeInt(requestCode);
1908 data.writeInt(flagsMask);
1909 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001910 if (options != null) {
1911 data.writeInt(1);
1912 options.writeToParcel(data, 0);
1913 } else {
1914 data.writeInt(0);
1915 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07001916 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07001917 reply.readException();
1918 int result = reply.readInt();
1919 reply.recycle();
1920 data.recycle();
1921 return result;
1922 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001923 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07001924 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001925 Parcel data = Parcel.obtain();
1926 Parcel reply = Parcel.obtain();
1927 data.writeInterfaceToken(IActivityManager.descriptor);
1928 data.writeStrongBinder(callingActivity);
1929 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07001930 if (options != null) {
1931 data.writeInt(1);
1932 options.writeToParcel(data, 0);
1933 } else {
1934 data.writeInt(0);
1935 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001936 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
1937 reply.readException();
1938 int result = reply.readInt();
1939 reply.recycle();
1940 data.recycle();
1941 return result != 0;
1942 }
1943 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
1944 throws RemoteException {
1945 Parcel data = Parcel.obtain();
1946 Parcel reply = Parcel.obtain();
1947 data.writeInterfaceToken(IActivityManager.descriptor);
1948 data.writeStrongBinder(token);
1949 data.writeInt(resultCode);
1950 if (resultData != null) {
1951 data.writeInt(1);
1952 resultData.writeToParcel(data, 0);
1953 } else {
1954 data.writeInt(0);
1955 }
1956 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
1957 reply.readException();
1958 boolean res = reply.readInt() != 0;
1959 data.recycle();
1960 reply.recycle();
1961 return res;
1962 }
1963 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
1964 {
1965 Parcel data = Parcel.obtain();
1966 Parcel reply = Parcel.obtain();
1967 data.writeInterfaceToken(IActivityManager.descriptor);
1968 data.writeStrongBinder(token);
1969 data.writeString(resultWho);
1970 data.writeInt(requestCode);
1971 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
1972 reply.readException();
1973 data.recycle();
1974 reply.recycle();
1975 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07001976 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
1977 Parcel data = Parcel.obtain();
1978 Parcel reply = Parcel.obtain();
1979 data.writeInterfaceToken(IActivityManager.descriptor);
1980 data.writeStrongBinder(token);
1981 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
1982 reply.readException();
1983 boolean res = reply.readInt() != 0;
1984 data.recycle();
1985 reply.recycle();
1986 return res;
1987 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08001988 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
1989 Parcel data = Parcel.obtain();
1990 Parcel reply = Parcel.obtain();
1991 data.writeInterfaceToken(IActivityManager.descriptor);
1992 data.writeStrongBinder(token);
1993 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
1994 reply.readException();
1995 boolean res = reply.readInt() != 0;
1996 data.recycle();
1997 reply.recycle();
1998 return res;
1999 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002000 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002001 IIntentReceiver receiver,
2002 IntentFilter filter, String perm) throws RemoteException
2003 {
2004 Parcel data = Parcel.obtain();
2005 Parcel reply = Parcel.obtain();
2006 data.writeInterfaceToken(IActivityManager.descriptor);
2007 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002008 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002009 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2010 filter.writeToParcel(data, 0);
2011 data.writeString(perm);
2012 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2013 reply.readException();
2014 Intent intent = null;
2015 int haveIntent = reply.readInt();
2016 if (haveIntent != 0) {
2017 intent = Intent.CREATOR.createFromParcel(reply);
2018 }
2019 reply.recycle();
2020 data.recycle();
2021 return intent;
2022 }
2023 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2024 {
2025 Parcel data = Parcel.obtain();
2026 Parcel reply = Parcel.obtain();
2027 data.writeInterfaceToken(IActivityManager.descriptor);
2028 data.writeStrongBinder(receiver.asBinder());
2029 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2030 reply.readException();
2031 data.recycle();
2032 reply.recycle();
2033 }
2034 public int broadcastIntent(IApplicationThread caller,
2035 Intent intent, String resolvedType, IIntentReceiver resultTo,
2036 int resultCode, String resultData, Bundle map,
2037 String requiredPermission, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002038 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002039 {
2040 Parcel data = Parcel.obtain();
2041 Parcel reply = Parcel.obtain();
2042 data.writeInterfaceToken(IActivityManager.descriptor);
2043 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2044 intent.writeToParcel(data, 0);
2045 data.writeString(resolvedType);
2046 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2047 data.writeInt(resultCode);
2048 data.writeString(resultData);
2049 data.writeBundle(map);
2050 data.writeString(requiredPermission);
2051 data.writeInt(serialized ? 1 : 0);
2052 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002053 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002054 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2055 reply.readException();
2056 int res = reply.readInt();
2057 reply.recycle();
2058 data.recycle();
2059 return res;
2060 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002061 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2062 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002063 {
2064 Parcel data = Parcel.obtain();
2065 Parcel reply = Parcel.obtain();
2066 data.writeInterfaceToken(IActivityManager.descriptor);
2067 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2068 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002069 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002070 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2071 reply.readException();
2072 data.recycle();
2073 reply.recycle();
2074 }
2075 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2076 {
2077 Parcel data = Parcel.obtain();
2078 Parcel reply = Parcel.obtain();
2079 data.writeInterfaceToken(IActivityManager.descriptor);
2080 data.writeStrongBinder(who);
2081 data.writeInt(resultCode);
2082 data.writeString(resultData);
2083 data.writeBundle(map);
2084 data.writeInt(abortBroadcast ? 1 : 0);
2085 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2086 reply.readException();
2087 data.recycle();
2088 reply.recycle();
2089 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002090 public void attachApplication(IApplicationThread app) throws RemoteException
2091 {
2092 Parcel data = Parcel.obtain();
2093 Parcel reply = Parcel.obtain();
2094 data.writeInterfaceToken(IActivityManager.descriptor);
2095 data.writeStrongBinder(app.asBinder());
2096 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2097 reply.readException();
2098 data.recycle();
2099 reply.recycle();
2100 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002101 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2102 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002103 {
2104 Parcel data = Parcel.obtain();
2105 Parcel reply = Parcel.obtain();
2106 data.writeInterfaceToken(IActivityManager.descriptor);
2107 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002108 if (config != null) {
2109 data.writeInt(1);
2110 config.writeToParcel(data, 0);
2111 } else {
2112 data.writeInt(0);
2113 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002114 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002115 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2116 reply.readException();
2117 data.recycle();
2118 reply.recycle();
2119 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002120 public void activityPaused(IBinder token) throws RemoteException
2121 {
2122 Parcel data = Parcel.obtain();
2123 Parcel reply = Parcel.obtain();
2124 data.writeInterfaceToken(IActivityManager.descriptor);
2125 data.writeStrongBinder(token);
2126 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2127 reply.readException();
2128 data.recycle();
2129 reply.recycle();
2130 }
2131 public void activityStopped(IBinder token, Bundle state,
2132 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002133 {
2134 Parcel data = Parcel.obtain();
2135 Parcel reply = Parcel.obtain();
2136 data.writeInterfaceToken(IActivityManager.descriptor);
2137 data.writeStrongBinder(token);
2138 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002139 if (thumbnail != null) {
2140 data.writeInt(1);
2141 thumbnail.writeToParcel(data, 0);
2142 } else {
2143 data.writeInt(0);
2144 }
2145 TextUtils.writeToParcel(description, data, 0);
2146 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2147 reply.readException();
2148 data.recycle();
2149 reply.recycle();
2150 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002151 public void activitySlept(IBinder token) throws RemoteException
2152 {
2153 Parcel data = Parcel.obtain();
2154 Parcel reply = Parcel.obtain();
2155 data.writeInterfaceToken(IActivityManager.descriptor);
2156 data.writeStrongBinder(token);
2157 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2158 reply.readException();
2159 data.recycle();
2160 reply.recycle();
2161 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002162 public void activityDestroyed(IBinder token) throws RemoteException
2163 {
2164 Parcel data = Parcel.obtain();
2165 Parcel reply = Parcel.obtain();
2166 data.writeInterfaceToken(IActivityManager.descriptor);
2167 data.writeStrongBinder(token);
2168 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2169 reply.readException();
2170 data.recycle();
2171 reply.recycle();
2172 }
2173 public String getCallingPackage(IBinder token) throws RemoteException
2174 {
2175 Parcel data = Parcel.obtain();
2176 Parcel reply = Parcel.obtain();
2177 data.writeInterfaceToken(IActivityManager.descriptor);
2178 data.writeStrongBinder(token);
2179 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2180 reply.readException();
2181 String res = reply.readString();
2182 data.recycle();
2183 reply.recycle();
2184 return res;
2185 }
2186 public ComponentName getCallingActivity(IBinder token)
2187 throws RemoteException {
2188 Parcel data = Parcel.obtain();
2189 Parcel reply = Parcel.obtain();
2190 data.writeInterfaceToken(IActivityManager.descriptor);
2191 data.writeStrongBinder(token);
2192 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2193 reply.readException();
2194 ComponentName res = ComponentName.readFromParcel(reply);
2195 data.recycle();
2196 reply.recycle();
2197 return res;
2198 }
2199 public List getTasks(int maxNum, int flags,
2200 IThumbnailReceiver receiver) throws RemoteException {
2201 Parcel data = Parcel.obtain();
2202 Parcel reply = Parcel.obtain();
2203 data.writeInterfaceToken(IActivityManager.descriptor);
2204 data.writeInt(maxNum);
2205 data.writeInt(flags);
2206 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2207 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2208 reply.readException();
2209 ArrayList list = null;
2210 int N = reply.readInt();
2211 if (N >= 0) {
2212 list = new ArrayList();
2213 while (N > 0) {
2214 ActivityManager.RunningTaskInfo info =
2215 ActivityManager.RunningTaskInfo.CREATOR
2216 .createFromParcel(reply);
2217 list.add(info);
2218 N--;
2219 }
2220 }
2221 data.recycle();
2222 reply.recycle();
2223 return list;
2224 }
2225 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002226 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002227 Parcel data = Parcel.obtain();
2228 Parcel reply = Parcel.obtain();
2229 data.writeInterfaceToken(IActivityManager.descriptor);
2230 data.writeInt(maxNum);
2231 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002232 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002233 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2234 reply.readException();
2235 ArrayList<ActivityManager.RecentTaskInfo> list
2236 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2237 data.recycle();
2238 reply.recycle();
2239 return list;
2240 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002241 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002242 Parcel data = Parcel.obtain();
2243 Parcel reply = Parcel.obtain();
2244 data.writeInterfaceToken(IActivityManager.descriptor);
2245 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002246 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002247 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002248 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002249 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002250 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002251 }
2252 data.recycle();
2253 reply.recycle();
2254 return bm;
2255 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002256 public List getServices(int maxNum, int flags) throws RemoteException {
2257 Parcel data = Parcel.obtain();
2258 Parcel reply = Parcel.obtain();
2259 data.writeInterfaceToken(IActivityManager.descriptor);
2260 data.writeInt(maxNum);
2261 data.writeInt(flags);
2262 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2263 reply.readException();
2264 ArrayList list = null;
2265 int N = reply.readInt();
2266 if (N >= 0) {
2267 list = new ArrayList();
2268 while (N > 0) {
2269 ActivityManager.RunningServiceInfo info =
2270 ActivityManager.RunningServiceInfo.CREATOR
2271 .createFromParcel(reply);
2272 list.add(info);
2273 N--;
2274 }
2275 }
2276 data.recycle();
2277 reply.recycle();
2278 return list;
2279 }
2280 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2281 throws RemoteException {
2282 Parcel data = Parcel.obtain();
2283 Parcel reply = Parcel.obtain();
2284 data.writeInterfaceToken(IActivityManager.descriptor);
2285 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2286 reply.readException();
2287 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2288 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2289 data.recycle();
2290 reply.recycle();
2291 return list;
2292 }
2293 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2294 throws RemoteException {
2295 Parcel data = Parcel.obtain();
2296 Parcel reply = Parcel.obtain();
2297 data.writeInterfaceToken(IActivityManager.descriptor);
2298 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2299 reply.readException();
2300 ArrayList<ActivityManager.RunningAppProcessInfo> list
2301 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2302 data.recycle();
2303 reply.recycle();
2304 return list;
2305 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002306 public List<ApplicationInfo> getRunningExternalApplications()
2307 throws RemoteException {
2308 Parcel data = Parcel.obtain();
2309 Parcel reply = Parcel.obtain();
2310 data.writeInterfaceToken(IActivityManager.descriptor);
2311 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2312 reply.readException();
2313 ArrayList<ApplicationInfo> list
2314 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2315 data.recycle();
2316 reply.recycle();
2317 return list;
2318 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002319 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002320 {
2321 Parcel data = Parcel.obtain();
2322 Parcel reply = Parcel.obtain();
2323 data.writeInterfaceToken(IActivityManager.descriptor);
2324 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002325 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002326 if (options != null) {
2327 data.writeInt(1);
2328 options.writeToParcel(data, 0);
2329 } else {
2330 data.writeInt(0);
2331 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 data.recycle();
2335 reply.recycle();
2336 }
2337 public void moveTaskToBack(int task) throws RemoteException
2338 {
2339 Parcel data = Parcel.obtain();
2340 Parcel reply = Parcel.obtain();
2341 data.writeInterfaceToken(IActivityManager.descriptor);
2342 data.writeInt(task);
2343 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 data.recycle();
2346 reply.recycle();
2347 }
2348 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2349 throws RemoteException {
2350 Parcel data = Parcel.obtain();
2351 Parcel reply = Parcel.obtain();
2352 data.writeInterfaceToken(IActivityManager.descriptor);
2353 data.writeStrongBinder(token);
2354 data.writeInt(nonRoot ? 1 : 0);
2355 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2356 reply.readException();
2357 boolean res = reply.readInt() != 0;
2358 data.recycle();
2359 reply.recycle();
2360 return res;
2361 }
2362 public void moveTaskBackwards(int task) throws RemoteException
2363 {
2364 Parcel data = Parcel.obtain();
2365 Parcel reply = Parcel.obtain();
2366 data.writeInterfaceToken(IActivityManager.descriptor);
2367 data.writeInt(task);
2368 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2369 reply.readException();
2370 data.recycle();
2371 reply.recycle();
2372 }
2373 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2374 {
2375 Parcel data = Parcel.obtain();
2376 Parcel reply = Parcel.obtain();
2377 data.writeInterfaceToken(IActivityManager.descriptor);
2378 data.writeStrongBinder(token);
2379 data.writeInt(onlyRoot ? 1 : 0);
2380 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2381 reply.readException();
2382 int res = reply.readInt();
2383 data.recycle();
2384 reply.recycle();
2385 return res;
2386 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002387 public void reportThumbnail(IBinder token,
2388 Bitmap thumbnail, CharSequence description) throws RemoteException
2389 {
2390 Parcel data = Parcel.obtain();
2391 Parcel reply = Parcel.obtain();
2392 data.writeInterfaceToken(IActivityManager.descriptor);
2393 data.writeStrongBinder(token);
2394 if (thumbnail != null) {
2395 data.writeInt(1);
2396 thumbnail.writeToParcel(data, 0);
2397 } else {
2398 data.writeInt(0);
2399 }
2400 TextUtils.writeToParcel(description, data, 0);
2401 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2402 reply.readException();
2403 data.recycle();
2404 reply.recycle();
2405 }
2406 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002407 String name, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002408 Parcel data = Parcel.obtain();
2409 Parcel reply = Parcel.obtain();
2410 data.writeInterfaceToken(IActivityManager.descriptor);
2411 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2412 data.writeString(name);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002413 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002414 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2415 reply.readException();
2416 int res = reply.readInt();
2417 ContentProviderHolder cph = null;
2418 if (res != 0) {
2419 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2420 }
2421 data.recycle();
2422 reply.recycle();
2423 return cph;
2424 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002425 public ContentProviderHolder getContentProviderExternal(String name, IBinder token)
2426 throws RemoteException
2427 {
2428 Parcel data = Parcel.obtain();
2429 Parcel reply = Parcel.obtain();
2430 data.writeInterfaceToken(IActivityManager.descriptor);
2431 data.writeString(name);
2432 data.writeStrongBinder(token);
2433 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_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 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002444 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002445 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002446 {
2447 Parcel data = Parcel.obtain();
2448 Parcel reply = Parcel.obtain();
2449 data.writeInterfaceToken(IActivityManager.descriptor);
2450 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2451 data.writeTypedList(providers);
2452 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2453 reply.readException();
2454 data.recycle();
2455 reply.recycle();
2456 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002457 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2458 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002459 Parcel data = Parcel.obtain();
2460 Parcel reply = Parcel.obtain();
2461 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002462 data.writeStrongBinder(connection);
2463 data.writeInt(stable);
2464 data.writeInt(unstable);
2465 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2466 reply.readException();
2467 boolean res = reply.readInt() != 0;
2468 data.recycle();
2469 reply.recycle();
2470 return res;
2471 }
2472 public void unstableProviderDied(IBinder connection) throws RemoteException {
2473 Parcel data = Parcel.obtain();
2474 Parcel reply = Parcel.obtain();
2475 data.writeInterfaceToken(IActivityManager.descriptor);
2476 data.writeStrongBinder(connection);
2477 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2478 reply.readException();
2479 data.recycle();
2480 reply.recycle();
2481 }
2482
2483 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2484 Parcel data = Parcel.obtain();
2485 Parcel reply = Parcel.obtain();
2486 data.writeInterfaceToken(IActivityManager.descriptor);
2487 data.writeStrongBinder(connection);
2488 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002489 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2490 reply.readException();
2491 data.recycle();
2492 reply.recycle();
2493 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002494
2495 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2496 Parcel data = Parcel.obtain();
2497 Parcel reply = Parcel.obtain();
2498 data.writeInterfaceToken(IActivityManager.descriptor);
2499 data.writeString(name);
2500 data.writeStrongBinder(token);
2501 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2502 reply.readException();
2503 data.recycle();
2504 reply.recycle();
2505 }
2506
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002507 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2508 throws RemoteException
2509 {
2510 Parcel data = Parcel.obtain();
2511 Parcel reply = Parcel.obtain();
2512 data.writeInterfaceToken(IActivityManager.descriptor);
2513 service.writeToParcel(data, 0);
2514 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2515 reply.readException();
2516 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2517 data.recycle();
2518 reply.recycle();
2519 return res;
2520 }
2521
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002522 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002523 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002524 {
2525 Parcel data = Parcel.obtain();
2526 Parcel reply = Parcel.obtain();
2527 data.writeInterfaceToken(IActivityManager.descriptor);
2528 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2529 service.writeToParcel(data, 0);
2530 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002531 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002532 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2533 reply.readException();
2534 ComponentName res = ComponentName.readFromParcel(reply);
2535 data.recycle();
2536 reply.recycle();
2537 return res;
2538 }
2539 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002540 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002541 {
2542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2546 service.writeToParcel(data, 0);
2547 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002548 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002549 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
2550 reply.readException();
2551 int res = reply.readInt();
2552 reply.recycle();
2553 data.recycle();
2554 return res;
2555 }
2556 public boolean stopServiceToken(ComponentName className, IBinder token,
2557 int startId) throws RemoteException {
2558 Parcel data = Parcel.obtain();
2559 Parcel reply = Parcel.obtain();
2560 data.writeInterfaceToken(IActivityManager.descriptor);
2561 ComponentName.writeToParcel(className, data);
2562 data.writeStrongBinder(token);
2563 data.writeInt(startId);
2564 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
2565 reply.readException();
2566 boolean res = reply.readInt() != 0;
2567 data.recycle();
2568 reply.recycle();
2569 return res;
2570 }
2571 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002572 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002573 Parcel data = Parcel.obtain();
2574 Parcel reply = Parcel.obtain();
2575 data.writeInterfaceToken(IActivityManager.descriptor);
2576 ComponentName.writeToParcel(className, data);
2577 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07002578 data.writeInt(id);
2579 if (notification != null) {
2580 data.writeInt(1);
2581 notification.writeToParcel(data, 0);
2582 } else {
2583 data.writeInt(0);
2584 }
2585 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002586 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
2587 reply.readException();
2588 data.recycle();
2589 reply.recycle();
2590 }
2591 public int bindService(IApplicationThread caller, IBinder token,
2592 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002593 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2598 data.writeStrongBinder(token);
2599 service.writeToParcel(data, 0);
2600 data.writeString(resolvedType);
2601 data.writeStrongBinder(connection.asBinder());
2602 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08002603 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002604 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
2605 reply.readException();
2606 int res = reply.readInt();
2607 data.recycle();
2608 reply.recycle();
2609 return res;
2610 }
2611 public boolean unbindService(IServiceConnection connection) throws RemoteException
2612 {
2613 Parcel data = Parcel.obtain();
2614 Parcel reply = Parcel.obtain();
2615 data.writeInterfaceToken(IActivityManager.descriptor);
2616 data.writeStrongBinder(connection.asBinder());
2617 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
2618 reply.readException();
2619 boolean res = reply.readInt() != 0;
2620 data.recycle();
2621 reply.recycle();
2622 return res;
2623 }
2624
2625 public void publishService(IBinder token,
2626 Intent intent, IBinder service) throws RemoteException {
2627 Parcel data = Parcel.obtain();
2628 Parcel reply = Parcel.obtain();
2629 data.writeInterfaceToken(IActivityManager.descriptor);
2630 data.writeStrongBinder(token);
2631 intent.writeToParcel(data, 0);
2632 data.writeStrongBinder(service);
2633 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
2634 reply.readException();
2635 data.recycle();
2636 reply.recycle();
2637 }
2638
2639 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
2640 throws RemoteException {
2641 Parcel data = Parcel.obtain();
2642 Parcel reply = Parcel.obtain();
2643 data.writeInterfaceToken(IActivityManager.descriptor);
2644 data.writeStrongBinder(token);
2645 intent.writeToParcel(data, 0);
2646 data.writeInt(doRebind ? 1 : 0);
2647 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
2648 reply.readException();
2649 data.recycle();
2650 reply.recycle();
2651 }
2652
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002653 public void serviceDoneExecuting(IBinder token, int type, int startId,
2654 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07002659 data.writeInt(type);
2660 data.writeInt(startId);
2661 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002662 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2663 reply.readException();
2664 data.recycle();
2665 reply.recycle();
2666 }
2667
2668 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
2669 Parcel data = Parcel.obtain();
2670 Parcel reply = Parcel.obtain();
2671 data.writeInterfaceToken(IActivityManager.descriptor);
2672 service.writeToParcel(data, 0);
2673 data.writeString(resolvedType);
2674 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
2675 reply.readException();
2676 IBinder binder = reply.readStrongBinder();
2677 reply.recycle();
2678 data.recycle();
2679 return binder;
2680 }
2681
Christopher Tate181fafa2009-05-14 11:12:14 -07002682 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
2683 throws RemoteException {
2684 Parcel data = Parcel.obtain();
2685 Parcel reply = Parcel.obtain();
2686 data.writeInterfaceToken(IActivityManager.descriptor);
2687 app.writeToParcel(data, 0);
2688 data.writeInt(backupRestoreMode);
2689 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2690 reply.readException();
2691 boolean success = reply.readInt() != 0;
2692 reply.recycle();
2693 data.recycle();
2694 return success;
2695 }
2696
2697 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
2698 Parcel data = Parcel.obtain();
2699 Parcel reply = Parcel.obtain();
2700 data.writeInterfaceToken(IActivityManager.descriptor);
2701 data.writeString(packageName);
2702 data.writeStrongBinder(agent);
2703 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
2704 reply.recycle();
2705 data.recycle();
2706 }
2707
2708 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
2709 Parcel data = Parcel.obtain();
2710 Parcel reply = Parcel.obtain();
2711 data.writeInterfaceToken(IActivityManager.descriptor);
2712 app.writeToParcel(data, 0);
2713 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
2714 reply.readException();
2715 reply.recycle();
2716 data.recycle();
2717 }
2718
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002719 public boolean startInstrumentation(ComponentName className, String profileFile,
2720 int flags, Bundle arguments, IInstrumentationWatcher watcher)
2721 throws RemoteException {
2722 Parcel data = Parcel.obtain();
2723 Parcel reply = Parcel.obtain();
2724 data.writeInterfaceToken(IActivityManager.descriptor);
2725 ComponentName.writeToParcel(className, data);
2726 data.writeString(profileFile);
2727 data.writeInt(flags);
2728 data.writeBundle(arguments);
2729 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
2730 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2731 reply.readException();
2732 boolean res = reply.readInt() != 0;
2733 reply.recycle();
2734 data.recycle();
2735 return res;
2736 }
2737
2738 public void finishInstrumentation(IApplicationThread target,
2739 int resultCode, Bundle results) throws RemoteException {
2740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeStrongBinder(target != null ? target.asBinder() : null);
2744 data.writeInt(resultCode);
2745 data.writeBundle(results);
2746 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
2747 reply.readException();
2748 data.recycle();
2749 reply.recycle();
2750 }
2751 public Configuration getConfiguration() throws RemoteException
2752 {
2753 Parcel data = Parcel.obtain();
2754 Parcel reply = Parcel.obtain();
2755 data.writeInterfaceToken(IActivityManager.descriptor);
2756 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
2757 reply.readException();
2758 Configuration res = Configuration.CREATOR.createFromParcel(reply);
2759 reply.recycle();
2760 data.recycle();
2761 return res;
2762 }
2763 public void updateConfiguration(Configuration values) throws RemoteException
2764 {
2765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 values.writeToParcel(data, 0);
2769 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
2770 reply.readException();
2771 data.recycle();
2772 reply.recycle();
2773 }
2774 public void setRequestedOrientation(IBinder token, int requestedOrientation)
2775 throws RemoteException {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
2779 data.writeStrongBinder(token);
2780 data.writeInt(requestedOrientation);
2781 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2782 reply.readException();
2783 data.recycle();
2784 reply.recycle();
2785 }
2786 public int getRequestedOrientation(IBinder token) throws RemoteException {
2787 Parcel data = Parcel.obtain();
2788 Parcel reply = Parcel.obtain();
2789 data.writeInterfaceToken(IActivityManager.descriptor);
2790 data.writeStrongBinder(token);
2791 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
2792 reply.readException();
2793 int res = reply.readInt();
2794 data.recycle();
2795 reply.recycle();
2796 return res;
2797 }
2798 public ComponentName getActivityClassForToken(IBinder token)
2799 throws RemoteException {
2800 Parcel data = Parcel.obtain();
2801 Parcel reply = Parcel.obtain();
2802 data.writeInterfaceToken(IActivityManager.descriptor);
2803 data.writeStrongBinder(token);
2804 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
2805 reply.readException();
2806 ComponentName res = ComponentName.readFromParcel(reply);
2807 data.recycle();
2808 reply.recycle();
2809 return res;
2810 }
2811 public String getPackageForToken(IBinder token) throws RemoteException
2812 {
2813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 data.writeStrongBinder(token);
2817 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
2818 reply.readException();
2819 String res = reply.readString();
2820 data.recycle();
2821 reply.recycle();
2822 return res;
2823 }
2824 public IIntentSender getIntentSender(int type,
2825 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002826 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07002827 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002828 Parcel data = Parcel.obtain();
2829 Parcel reply = Parcel.obtain();
2830 data.writeInterfaceToken(IActivityManager.descriptor);
2831 data.writeInt(type);
2832 data.writeString(packageName);
2833 data.writeStrongBinder(token);
2834 data.writeString(resultWho);
2835 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002836 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002837 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002838 data.writeTypedArray(intents, 0);
2839 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002840 } else {
2841 data.writeInt(0);
2842 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07002844 if (options != null) {
2845 data.writeInt(1);
2846 options.writeToParcel(data, 0);
2847 } else {
2848 data.writeInt(0);
2849 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002850 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002851 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
2852 reply.readException();
2853 IIntentSender res = IIntentSender.Stub.asInterface(
2854 reply.readStrongBinder());
2855 data.recycle();
2856 reply.recycle();
2857 return res;
2858 }
2859 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(sender.asBinder());
2864 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
2865 reply.readException();
2866 data.recycle();
2867 reply.recycle();
2868 }
2869 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
2870 Parcel data = Parcel.obtain();
2871 Parcel reply = Parcel.obtain();
2872 data.writeInterfaceToken(IActivityManager.descriptor);
2873 data.writeStrongBinder(sender.asBinder());
2874 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2875 reply.readException();
2876 String res = reply.readString();
2877 data.recycle();
2878 reply.recycle();
2879 return res;
2880 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07002881 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
2882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeStrongBinder(sender.asBinder());
2886 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 int res = reply.readInt();
2889 data.recycle();
2890 reply.recycle();
2891 return res;
2892 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002893 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
2894 boolean requireFull, String name, String callerPackage) throws RemoteException {
2895 Parcel data = Parcel.obtain();
2896 Parcel reply = Parcel.obtain();
2897 data.writeInterfaceToken(IActivityManager.descriptor);
2898 data.writeInt(callingPid);
2899 data.writeInt(callingUid);
2900 data.writeInt(userId);
2901 data.writeInt(allowAll ? 1 : 0);
2902 data.writeInt(requireFull ? 1 : 0);
2903 data.writeString(name);
2904 data.writeString(callerPackage);
2905 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
2906 reply.readException();
2907 int res = reply.readInt();
2908 data.recycle();
2909 reply.recycle();
2910 return res;
2911 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 public void setProcessLimit(int max) throws RemoteException
2913 {
2914 Parcel data = Parcel.obtain();
2915 Parcel reply = Parcel.obtain();
2916 data.writeInterfaceToken(IActivityManager.descriptor);
2917 data.writeInt(max);
2918 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 data.recycle();
2921 reply.recycle();
2922 }
2923 public int getProcessLimit() throws RemoteException
2924 {
2925 Parcel data = Parcel.obtain();
2926 Parcel reply = Parcel.obtain();
2927 data.writeInterfaceToken(IActivityManager.descriptor);
2928 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
2929 reply.readException();
2930 int res = reply.readInt();
2931 data.recycle();
2932 reply.recycle();
2933 return res;
2934 }
2935 public void setProcessForeground(IBinder token, int pid,
2936 boolean isForeground) throws RemoteException {
2937 Parcel data = Parcel.obtain();
2938 Parcel reply = Parcel.obtain();
2939 data.writeInterfaceToken(IActivityManager.descriptor);
2940 data.writeStrongBinder(token);
2941 data.writeInt(pid);
2942 data.writeInt(isForeground ? 1 : 0);
2943 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 data.recycle();
2946 reply.recycle();
2947 }
2948 public int checkPermission(String permission, int pid, int uid)
2949 throws RemoteException {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeString(permission);
2954 data.writeInt(pid);
2955 data.writeInt(uid);
2956 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
2957 reply.readException();
2958 int res = reply.readInt();
2959 data.recycle();
2960 reply.recycle();
2961 return res;
2962 }
2963 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07002964 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002965 Parcel data = Parcel.obtain();
2966 Parcel reply = Parcel.obtain();
2967 data.writeInterfaceToken(IActivityManager.descriptor);
2968 data.writeString(packageName);
2969 data.writeStrongBinder(observer.asBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07002970 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002971 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 boolean res = reply.readInt() != 0;
2974 data.recycle();
2975 reply.recycle();
2976 return res;
2977 }
2978 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
2979 throws RemoteException {
2980 Parcel data = Parcel.obtain();
2981 Parcel reply = Parcel.obtain();
2982 data.writeInterfaceToken(IActivityManager.descriptor);
2983 uri.writeToParcel(data, 0);
2984 data.writeInt(pid);
2985 data.writeInt(uid);
2986 data.writeInt(mode);
2987 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
2988 reply.readException();
2989 int res = reply.readInt();
2990 data.recycle();
2991 reply.recycle();
2992 return res;
2993 }
2994 public void grantUriPermission(IApplicationThread caller, String targetPkg,
2995 Uri uri, int mode) throws RemoteException {
2996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
2999 data.writeStrongBinder(caller.asBinder());
3000 data.writeString(targetPkg);
3001 uri.writeToParcel(data, 0);
3002 data.writeInt(mode);
3003 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3004 reply.readException();
3005 data.recycle();
3006 reply.recycle();
3007 }
3008 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3009 int mode) throws RemoteException {
3010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeStrongBinder(caller.asBinder());
3014 uri.writeToParcel(data, 0);
3015 data.writeInt(mode);
3016 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3017 reply.readException();
3018 data.recycle();
3019 reply.recycle();
3020 }
3021 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3022 throws RemoteException {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 data.writeStrongBinder(who.asBinder());
3027 data.writeInt(waiting ? 1 : 0);
3028 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 data.recycle();
3031 reply.recycle();
3032 }
3033 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3034 Parcel data = Parcel.obtain();
3035 Parcel reply = Parcel.obtain();
3036 data.writeInterfaceToken(IActivityManager.descriptor);
3037 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3038 reply.readException();
3039 outInfo.readFromParcel(reply);
3040 data.recycle();
3041 reply.recycle();
3042 }
3043 public void unhandledBack() throws RemoteException
3044 {
3045 Parcel data = Parcel.obtain();
3046 Parcel reply = Parcel.obtain();
3047 data.writeInterfaceToken(IActivityManager.descriptor);
3048 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3049 reply.readException();
3050 data.recycle();
3051 reply.recycle();
3052 }
3053 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3054 {
3055 Parcel data = Parcel.obtain();
3056 Parcel reply = Parcel.obtain();
3057 data.writeInterfaceToken(IActivityManager.descriptor);
3058 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3059 reply.readException();
3060 ParcelFileDescriptor pfd = null;
3061 if (reply.readInt() != 0) {
3062 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3063 }
3064 data.recycle();
3065 reply.recycle();
3066 return pfd;
3067 }
3068 public void goingToSleep() throws RemoteException
3069 {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3074 reply.readException();
3075 data.recycle();
3076 reply.recycle();
3077 }
3078 public void wakingUp() throws RemoteException
3079 {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 data.recycle();
3086 reply.recycle();
3087 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003088 public void setLockScreenShown(boolean shown) throws RemoteException
3089 {
3090 Parcel data = Parcel.obtain();
3091 Parcel reply = Parcel.obtain();
3092 data.writeInterfaceToken(IActivityManager.descriptor);
3093 data.writeInt(shown ? 1 : 0);
3094 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3095 reply.readException();
3096 data.recycle();
3097 reply.recycle();
3098 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003099 public void setDebugApp(
3100 String packageName, boolean waitForDebugger, boolean persistent)
3101 throws RemoteException
3102 {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 data.writeString(packageName);
3107 data.writeInt(waitForDebugger ? 1 : 0);
3108 data.writeInt(persistent ? 1 : 0);
3109 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3110 reply.readException();
3111 data.recycle();
3112 reply.recycle();
3113 }
3114 public void setAlwaysFinish(boolean enabled) throws RemoteException
3115 {
3116 Parcel data = Parcel.obtain();
3117 Parcel reply = Parcel.obtain();
3118 data.writeInterfaceToken(IActivityManager.descriptor);
3119 data.writeInt(enabled ? 1 : 0);
3120 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3121 reply.readException();
3122 data.recycle();
3123 reply.recycle();
3124 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003125 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003126 {
3127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003131 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 reply.readException();
3133 data.recycle();
3134 reply.recycle();
3135 }
3136 public void enterSafeMode() throws RemoteException {
3137 Parcel data = Parcel.obtain();
3138 data.writeInterfaceToken(IActivityManager.descriptor);
3139 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3140 data.recycle();
3141 }
3142 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3143 Parcel data = Parcel.obtain();
3144 data.writeStrongBinder(sender.asBinder());
3145 data.writeInterfaceToken(IActivityManager.descriptor);
3146 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3147 data.recycle();
3148 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003149 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003150 Parcel data = Parcel.obtain();
3151 Parcel reply = Parcel.obtain();
3152 data.writeInterfaceToken(IActivityManager.descriptor);
3153 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003154 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003155 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003156 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003157 boolean res = reply.readInt() != 0;
3158 data.recycle();
3159 reply.recycle();
3160 return res;
3161 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003162 @Override
3163 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeString(reason);
3168 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3169 boolean res = reply.readInt() != 0;
3170 data.recycle();
3171 reply.recycle();
3172 return res;
3173 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003174 public void startRunning(String pkg, String cls, String action,
3175 String indata) throws RemoteException {
3176 Parcel data = Parcel.obtain();
3177 Parcel reply = Parcel.obtain();
3178 data.writeInterfaceToken(IActivityManager.descriptor);
3179 data.writeString(pkg);
3180 data.writeString(cls);
3181 data.writeString(action);
3182 data.writeString(indata);
3183 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3184 reply.readException();
3185 data.recycle();
3186 reply.recycle();
3187 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003188 public boolean testIsSystemReady()
3189 {
3190 /* this base class version is never called */
3191 return true;
3192 }
Dan Egnor60d87622009-12-16 16:32:58 -08003193 public void handleApplicationCrash(IBinder app,
3194 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3195 {
3196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 data.writeStrongBinder(app);
3200 crashInfo.writeToParcel(data, 0);
3201 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 reply.recycle();
3204 data.recycle();
3205 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003206
Dan Egnor60d87622009-12-16 16:32:58 -08003207 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003208 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003209 {
3210 Parcel data = Parcel.obtain();
3211 Parcel reply = Parcel.obtain();
3212 data.writeInterfaceToken(IActivityManager.descriptor);
3213 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003215 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003216 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003217 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003218 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 reply.recycle();
3220 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003221 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003223
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003224 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003225 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003226 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003227 {
3228 Parcel data = Parcel.obtain();
3229 Parcel reply = Parcel.obtain();
3230 data.writeInterfaceToken(IActivityManager.descriptor);
3231 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003232 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003233 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003234 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3235 reply.readException();
3236 reply.recycle();
3237 data.recycle();
3238 }
3239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003240 public void signalPersistentProcesses(int sig) throws RemoteException {
3241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 data.writeInt(sig);
3245 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003250
Dianne Hackborn03abb812010-01-04 18:43:19 -08003251 public void killBackgroundProcesses(String packageName) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 data.writeString(packageName);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003256 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3257 reply.readException();
3258 data.recycle();
3259 reply.recycle();
3260 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003261
3262 public void killAllBackgroundProcesses() throws RemoteException {
3263 Parcel data = Parcel.obtain();
3264 Parcel reply = Parcel.obtain();
3265 data.writeInterfaceToken(IActivityManager.descriptor);
3266 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3267 reply.readException();
3268 data.recycle();
3269 reply.recycle();
3270 }
3271
Dianne Hackborn03abb812010-01-04 18:43:19 -08003272 public void forceStopPackage(String packageName) throws RemoteException {
3273 Parcel data = Parcel.obtain();
3274 Parcel reply = Parcel.obtain();
3275 data.writeInterfaceToken(IActivityManager.descriptor);
3276 data.writeString(packageName);
3277 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003278 reply.readException();
3279 data.recycle();
3280 reply.recycle();
3281 }
3282
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003283 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3284 throws RemoteException
3285 {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
3289 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3290 reply.readException();
3291 outInfo.readFromParcel(reply);
3292 reply.recycle();
3293 data.recycle();
3294 }
3295
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3297 {
3298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3304 reply.recycle();
3305 data.recycle();
3306 return res;
3307 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003308
3309 public boolean profileControl(String process, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003310 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003311 {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeString(process);
3316 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003317 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003318 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003319 if (fd != null) {
3320 data.writeInt(1);
3321 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3322 } else {
3323 data.writeInt(0);
3324 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003325 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3326 reply.readException();
3327 boolean res = reply.readInt() != 0;
3328 reply.recycle();
3329 data.recycle();
3330 return res;
3331 }
3332
Dianne Hackborn55280a92009-05-07 15:53:46 -07003333 public boolean shutdown(int timeout) throws RemoteException
3334 {
3335 Parcel data = Parcel.obtain();
3336 Parcel reply = Parcel.obtain();
3337 data.writeInterfaceToken(IActivityManager.descriptor);
3338 data.writeInt(timeout);
3339 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3340 reply.readException();
3341 boolean res = reply.readInt() != 0;
3342 reply.recycle();
3343 data.recycle();
3344 return res;
3345 }
3346
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003347 public void stopAppSwitches() throws RemoteException {
3348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3352 reply.readException();
3353 reply.recycle();
3354 data.recycle();
3355 }
3356
3357 public void resumeAppSwitches() throws RemoteException {
3358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3362 reply.readException();
3363 reply.recycle();
3364 data.recycle();
3365 }
3366
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003367 public void killApplicationWithUid(String pkg, int uid) throws RemoteException {
3368 Parcel data = Parcel.obtain();
3369 Parcel reply = Parcel.obtain();
3370 data.writeInterfaceToken(IActivityManager.descriptor);
3371 data.writeString(pkg);
3372 data.writeInt(uid);
3373 mRemote.transact(KILL_APPLICATION_WITH_UID_TRANSACTION, data, reply, 0);
3374 reply.readException();
3375 data.recycle();
3376 reply.recycle();
3377 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003378
3379 public void closeSystemDialogs(String reason) throws RemoteException {
3380 Parcel data = Parcel.obtain();
3381 Parcel reply = Parcel.obtain();
3382 data.writeInterfaceToken(IActivityManager.descriptor);
3383 data.writeString(reason);
3384 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3385 reply.readException();
3386 data.recycle();
3387 reply.recycle();
3388 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003389
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003390 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003391 throws RemoteException {
3392 Parcel data = Parcel.obtain();
3393 Parcel reply = Parcel.obtain();
3394 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003395 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003396 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3397 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003398 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003399 data.recycle();
3400 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003401 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003402 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003403
3404 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 data.writeString(processName);
3409 data.writeInt(uid);
3410 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3411 reply.readException();
3412 data.recycle();
3413 reply.recycle();
3414 }
3415
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003416 public void overridePendingTransition(IBinder token, String packageName,
3417 int enterAnim, int exitAnim) throws RemoteException {
3418 Parcel data = Parcel.obtain();
3419 Parcel reply = Parcel.obtain();
3420 data.writeInterfaceToken(IActivityManager.descriptor);
3421 data.writeStrongBinder(token);
3422 data.writeString(packageName);
3423 data.writeInt(enterAnim);
3424 data.writeInt(exitAnim);
3425 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3426 reply.readException();
3427 data.recycle();
3428 reply.recycle();
3429 }
3430
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003431 public boolean isUserAMonkey() throws RemoteException {
3432 Parcel data = Parcel.obtain();
3433 Parcel reply = Parcel.obtain();
3434 data.writeInterfaceToken(IActivityManager.descriptor);
3435 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3436 reply.readException();
3437 boolean res = reply.readInt() != 0;
3438 data.recycle();
3439 reply.recycle();
3440 return res;
3441 }
3442
Dianne Hackborn860755f2010-06-03 18:47:52 -07003443 public void finishHeavyWeightApp() throws RemoteException {
3444 Parcel data = Parcel.obtain();
3445 Parcel reply = Parcel.obtain();
3446 data.writeInterfaceToken(IActivityManager.descriptor);
3447 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3448 reply.readException();
3449 data.recycle();
3450 reply.recycle();
3451 }
3452
Daniel Sandler69a48172010-06-23 16:29:36 -04003453 public void setImmersive(IBinder token, boolean immersive)
3454 throws RemoteException {
3455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 data.writeStrongBinder(token);
3459 data.writeInt(immersive ? 1 : 0);
3460 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
3461 reply.readException();
3462 data.recycle();
3463 reply.recycle();
3464 }
3465
3466 public boolean isImmersive(IBinder token)
3467 throws RemoteException {
3468 Parcel data = Parcel.obtain();
3469 Parcel reply = Parcel.obtain();
3470 data.writeInterfaceToken(IActivityManager.descriptor);
3471 data.writeStrongBinder(token);
3472 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003473 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003474 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003475 data.recycle();
3476 reply.recycle();
3477 return res;
3478 }
3479
3480 public boolean isTopActivityImmersive()
3481 throws RemoteException {
3482 Parcel data = Parcel.obtain();
3483 Parcel reply = Parcel.obtain();
3484 data.writeInterfaceToken(IActivityManager.descriptor);
3485 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04003486 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07003487 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04003488 data.recycle();
3489 reply.recycle();
3490 return res;
3491 }
3492
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003493 public void crashApplication(int uid, int initialPid, String packageName,
3494 String message) throws RemoteException {
3495 Parcel data = Parcel.obtain();
3496 Parcel reply = Parcel.obtain();
3497 data.writeInterfaceToken(IActivityManager.descriptor);
3498 data.writeInt(uid);
3499 data.writeInt(initialPid);
3500 data.writeString(packageName);
3501 data.writeString(message);
3502 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
3503 reply.readException();
3504 data.recycle();
3505 reply.recycle();
3506 }
Andy McFadden824c5102010-07-09 16:26:57 -07003507
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07003508 public String getProviderMimeType(Uri uri)
3509 throws RemoteException {
3510 Parcel data = Parcel.obtain();
3511 Parcel reply = Parcel.obtain();
3512 data.writeInterfaceToken(IActivityManager.descriptor);
3513 uri.writeToParcel(data, 0);
3514 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
3515 reply.readException();
3516 String res = reply.readString();
3517 data.recycle();
3518 reply.recycle();
3519 return res;
3520 }
3521
Dianne Hackborn7e269642010-08-25 19:50:20 -07003522 public IBinder newUriPermissionOwner(String name)
3523 throws RemoteException {
3524 Parcel data = Parcel.obtain();
3525 Parcel reply = Parcel.obtain();
3526 data.writeInterfaceToken(IActivityManager.descriptor);
3527 data.writeString(name);
3528 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
3529 reply.readException();
3530 IBinder res = reply.readStrongBinder();
3531 data.recycle();
3532 reply.recycle();
3533 return res;
3534 }
3535
3536 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
3537 Uri uri, int mode) throws RemoteException {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeStrongBinder(owner);
3542 data.writeInt(fromUid);
3543 data.writeString(targetPkg);
3544 uri.writeToParcel(data, 0);
3545 data.writeInt(mode);
3546 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3547 reply.readException();
3548 data.recycle();
3549 reply.recycle();
3550 }
3551
3552 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
3553 int mode) throws RemoteException {
3554 Parcel data = Parcel.obtain();
3555 Parcel reply = Parcel.obtain();
3556 data.writeInterfaceToken(IActivityManager.descriptor);
3557 data.writeStrongBinder(owner);
3558 if (uri != null) {
3559 data.writeInt(1);
3560 uri.writeToParcel(data, 0);
3561 } else {
3562 data.writeInt(0);
3563 }
3564 data.writeInt(mode);
3565 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3566 reply.readException();
3567 data.recycle();
3568 reply.recycle();
3569 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07003570
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07003571 public int checkGrantUriPermission(int callingUid, String targetPkg,
3572 Uri uri, int modeFlags) throws RemoteException {
3573 Parcel data = Parcel.obtain();
3574 Parcel reply = Parcel.obtain();
3575 data.writeInterfaceToken(IActivityManager.descriptor);
3576 data.writeInt(callingUid);
3577 data.writeString(targetPkg);
3578 uri.writeToParcel(data, 0);
3579 data.writeInt(modeFlags);
3580 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3581 reply.readException();
3582 int res = reply.readInt();
3583 data.recycle();
3584 reply.recycle();
3585 return res;
3586 }
3587
Andy McFadden824c5102010-07-09 16:26:57 -07003588 public boolean dumpHeap(String process, boolean managed,
3589 String path, ParcelFileDescriptor fd) throws RemoteException {
3590 Parcel data = Parcel.obtain();
3591 Parcel reply = Parcel.obtain();
3592 data.writeInterfaceToken(IActivityManager.descriptor);
3593 data.writeString(process);
3594 data.writeInt(managed ? 1 : 0);
3595 data.writeString(path);
3596 if (fd != null) {
3597 data.writeInt(1);
3598 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3599 } else {
3600 data.writeInt(0);
3601 }
3602 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
3603 reply.readException();
3604 boolean res = reply.readInt() != 0;
3605 reply.recycle();
3606 data.recycle();
3607 return res;
3608 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07003609
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003610 public int startActivities(IApplicationThread caller,
Dianne Hackborna4972e92012-03-14 10:38:05 -07003611 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
3612 Bundle options) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3617 data.writeTypedArray(intents, 0);
3618 data.writeStringArray(resolvedTypes);
3619 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07003620 if (options != null) {
3621 data.writeInt(1);
3622 options.writeToParcel(data, 0);
3623 } else {
3624 data.writeInt(0);
3625 }
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003626 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 int result = reply.readInt();
3629 reply.recycle();
3630 data.recycle();
3631 return result;
3632 }
3633
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003634 public int getFrontActivityScreenCompatMode() throws RemoteException {
3635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 int mode = reply.readInt();
3641 reply.recycle();
3642 data.recycle();
3643 return mode;
3644 }
3645
3646 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
3647 Parcel data = Parcel.obtain();
3648 Parcel reply = Parcel.obtain();
3649 data.writeInterfaceToken(IActivityManager.descriptor);
3650 data.writeInt(mode);
3651 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3652 reply.readException();
3653 reply.recycle();
3654 data.recycle();
3655 }
3656
3657 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
3658 Parcel data = Parcel.obtain();
3659 Parcel reply = Parcel.obtain();
3660 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003661 data.writeString(packageName);
3662 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003663 reply.readException();
3664 int mode = reply.readInt();
3665 reply.recycle();
3666 data.recycle();
3667 return mode;
3668 }
3669
3670 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003671 throws RemoteException {
3672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07003676 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04003677 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
3678 reply.readException();
3679 reply.recycle();
3680 data.recycle();
3681 }
3682
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07003683 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
3684 Parcel data = Parcel.obtain();
3685 Parcel reply = Parcel.obtain();
3686 data.writeInterfaceToken(IActivityManager.descriptor);
3687 data.writeString(packageName);
3688 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3689 reply.readException();
3690 boolean ask = reply.readInt() != 0;
3691 reply.recycle();
3692 data.recycle();
3693 return ask;
3694 }
3695
3696 public void setPackageAskScreenCompat(String packageName, boolean ask)
3697 throws RemoteException {
3698 Parcel data = Parcel.obtain();
3699 Parcel reply = Parcel.obtain();
3700 data.writeInterfaceToken(IActivityManager.descriptor);
3701 data.writeString(packageName);
3702 data.writeInt(ask ? 1 : 0);
3703 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
3704 reply.readException();
3705 reply.recycle();
3706 data.recycle();
3707 }
3708
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003709 public boolean switchUser(int userid) throws RemoteException {
3710 Parcel data = Parcel.obtain();
3711 Parcel reply = Parcel.obtain();
3712 data.writeInterfaceToken(IActivityManager.descriptor);
3713 data.writeInt(userid);
3714 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
3715 reply.readException();
3716 boolean result = reply.readInt() != 0;
3717 reply.recycle();
3718 data.recycle();
3719 return result;
3720 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07003721
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003722 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeInt(userid);
3727 data.writeStrongInterface(callback);
3728 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
3729 reply.readException();
3730 int result = reply.readInt();
3731 reply.recycle();
3732 data.recycle();
3733 return result;
3734 }
3735
Amith Yamasani52f1d752012-03-28 18:19:29 -07003736 public UserInfo getCurrentUser() throws RemoteException {
3737 Parcel data = Parcel.obtain();
3738 Parcel reply = Parcel.obtain();
3739 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07003740 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07003741 reply.readException();
3742 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
3743 reply.recycle();
3744 data.recycle();
3745 return userInfo;
3746 }
3747
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07003748 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
3749 Parcel data = Parcel.obtain();
3750 Parcel reply = Parcel.obtain();
3751 data.writeInterfaceToken(IActivityManager.descriptor);
3752 data.writeInt(taskId);
3753 data.writeInt(subTaskIndex);
3754 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 boolean result = reply.readInt() != 0;
3757 reply.recycle();
3758 data.recycle();
3759 return result;
3760 }
3761
3762 public boolean removeTask(int taskId, int flags) throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeInt(taskId);
3767 data.writeInt(flags);
3768 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
3769 reply.readException();
3770 boolean result = reply.readInt() != 0;
3771 reply.recycle();
3772 data.recycle();
3773 return result;
3774 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07003775
Jeff Sharkeya4620792011-05-20 15:29:23 -07003776 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3781 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 data.recycle();
3784 reply.recycle();
3785 }
3786
3787 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
3788 Parcel data = Parcel.obtain();
3789 Parcel reply = Parcel.obtain();
3790 data.writeInterfaceToken(IActivityManager.descriptor);
3791 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
3792 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
3793 reply.readException();
3794 data.recycle();
3795 reply.recycle();
3796 }
3797
Dianne Hackborn6c418d52011-06-29 14:05:33 -07003798 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
3799 Parcel data = Parcel.obtain();
3800 Parcel reply = Parcel.obtain();
3801 data.writeInterfaceToken(IActivityManager.descriptor);
3802 data.writeStrongBinder(sender.asBinder());
3803 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
3804 reply.readException();
3805 boolean res = reply.readInt() != 0;
3806 data.recycle();
3807 reply.recycle();
3808 return res;
3809 }
3810
Dianne Hackborn1927ae82012-06-22 15:21:36 -07003811 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
3812 Parcel data = Parcel.obtain();
3813 Parcel reply = Parcel.obtain();
3814 data.writeInterfaceToken(IActivityManager.descriptor);
3815 data.writeStrongBinder(sender.asBinder());
3816 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
3817 reply.readException();
3818 boolean res = reply.readInt() != 0;
3819 data.recycle();
3820 reply.recycle();
3821 return res;
3822 }
3823
Dianne Hackborn31ca8542011-07-19 14:58:28 -07003824 public void updatePersistentConfiguration(Configuration values) throws RemoteException
3825 {
3826 Parcel data = Parcel.obtain();
3827 Parcel reply = Parcel.obtain();
3828 data.writeInterfaceToken(IActivityManager.descriptor);
3829 values.writeToParcel(data, 0);
3830 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
3831 reply.readException();
3832 data.recycle();
3833 reply.recycle();
3834 }
3835
Dianne Hackbornb437e092011-08-05 17:50:29 -07003836 public long[] getProcessPss(int[] pids) throws RemoteException {
3837 Parcel data = Parcel.obtain();
3838 Parcel reply = Parcel.obtain();
3839 data.writeInterfaceToken(IActivityManager.descriptor);
3840 data.writeIntArray(pids);
3841 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 long[] res = reply.createLongArray();
3844 data.recycle();
3845 reply.recycle();
3846 return res;
3847 }
3848
Dianne Hackborn661cd522011-08-22 00:26:20 -07003849 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 TextUtils.writeToParcel(msg, data, 0);
3854 data.writeInt(always ? 1 : 0);
3855 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
3856 reply.readException();
3857 data.recycle();
3858 reply.recycle();
3859 }
3860
Dianne Hackborn90c52de2011-09-23 12:57:44 -07003861 public void dismissKeyguardOnNextActivity() throws RemoteException {
3862 Parcel data = Parcel.obtain();
3863 Parcel reply = Parcel.obtain();
3864 data.writeInterfaceToken(IActivityManager.descriptor);
3865 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
3866 reply.readException();
3867 data.recycle();
3868 reply.recycle();
3869 }
3870
Adam Powelldd8fab22012-03-22 17:47:27 -07003871 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
3872 throws RemoteException {
3873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 data.writeStrongBinder(token);
3877 data.writeString(destAffinity);
3878 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 boolean result = reply.readInt() != 0;
3881 data.recycle();
3882 reply.recycle();
3883 return result;
3884 }
3885
3886 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
3887 throws RemoteException {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 data.writeStrongBinder(token);
3892 target.writeToParcel(data, 0);
3893 data.writeInt(resultCode);
3894 if (resultData != null) {
3895 data.writeInt(1);
3896 resultData.writeToParcel(data, 0);
3897 } else {
3898 data.writeInt(0);
3899 }
3900 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
3901 reply.readException();
3902 boolean result = reply.readInt() != 0;
3903 data.recycle();
3904 reply.recycle();
3905 return result;
3906 }
3907
Dianne Hackborn5320eb82012-05-18 12:05:04 -07003908 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
3909 Parcel data = Parcel.obtain();
3910 Parcel reply = Parcel.obtain();
3911 data.writeInterfaceToken(IActivityManager.descriptor);
3912 data.writeStrongBinder(activityToken);
3913 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 int result = reply.readInt();
3916 data.recycle();
3917 reply.recycle();
3918 return result;
3919 }
3920
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003921 private IBinder mRemote;
3922}