blob: f4358e9b066d68f1702bc7b44251e6965f0a3be1 [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
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
33import android.graphics.Bitmap;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080034import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.net.Uri;
36import android.os.Binder;
37import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070038import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.os.IBinder;
40import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070041import android.os.ParcelFileDescriptor;
42import android.os.Parcelable;
43import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070045import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080048import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import java.util.ArrayList;
51import java.util.List;
52
53/** {@hide} */
54public abstract class ActivityManagerNative extends Binder implements IActivityManager
55{
56 /**
57 * Cast a Binder object into an activity manager interface, generating
58 * a proxy if needed.
59 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080060 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061 if (obj == null) {
62 return null;
63 }
64 IActivityManager in =
65 (IActivityManager)obj.queryLocalInterface(descriptor);
66 if (in != null) {
67 return in;
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 return new ActivityManagerProxy(obj);
71 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 /**
74 * Retrieve the system's default/global activity manager.
75 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076 static public IActivityManager getDefault() {
77 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 }
79
80 /**
81 * Convenience for checking whether the system is ready. For internal use only.
82 */
83 static public boolean isSystemReady() {
84 if (!sSystemReady) {
85 sSystemReady = getDefault().testIsSystemReady();
86 }
87 return sSystemReady;
88 }
89 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080090
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 /**
92 * Convenience for sending a sticky broadcast. For internal use only.
93 * If you don't care about permission, use null.
94 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070095 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 try {
97 getDefault().broadcastIntent(
98 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080099 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 } catch (RemoteException ex) {
101 }
102 }
103
Dianne Hackborn099bc622014-01-22 13:39:16 -0800104 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800106 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 } catch (RemoteException ex) {
108 }
109 }
110
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800111 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 attachInterface(this, descriptor);
113 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700114
115 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
117 throws RemoteException {
118 switch (code) {
119 case START_ACTIVITY_TRANSACTION:
120 {
121 data.enforceInterface(IActivityManager.descriptor);
122 IBinder b = data.readStrongBinder();
123 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800124 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125 Intent intent = Intent.CREATOR.createFromParcel(data);
126 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800128 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700130 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700131 String profileFile = data.readString();
132 ParcelFileDescriptor profileFd = data.readInt() != 0
133 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 Bundle options = data.readInt() != 0
135 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800136 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 resultTo, resultWho, requestCode, startFlags,
138 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 reply.writeNoException();
140 reply.writeInt(result);
141 return true;
142 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700143
Amith Yamasani82644082012-08-03 13:09:11 -0700144 case START_ACTIVITY_AS_USER_TRANSACTION:
145 {
146 data.enforceInterface(IActivityManager.descriptor);
147 IBinder b = data.readStrongBinder();
148 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800149 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700150 Intent intent = Intent.CREATOR.createFromParcel(data);
151 String resolvedType = data.readString();
152 IBinder resultTo = data.readStrongBinder();
153 String resultWho = data.readString();
154 int requestCode = data.readInt();
155 int startFlags = data.readInt();
156 String profileFile = data.readString();
157 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700158 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700159 Bundle options = data.readInt() != 0
160 ? Bundle.CREATOR.createFromParcel(data) : null;
161 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700163 resultTo, resultWho, requestCode, startFlags,
164 profileFile, profileFd, options, userId);
165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
169
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800170 case START_ACTIVITY_AND_WAIT_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800178 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800179 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700181 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700182 String profileFile = data.readString();
183 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700184 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700187 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800188 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700189 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800191 reply.writeNoException();
192 result.writeToParcel(reply, 0);
193 return true;
194 }
195
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700196 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
197 {
198 data.enforceInterface(IActivityManager.descriptor);
199 IBinder b = data.readStrongBinder();
200 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800201 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700202 Intent intent = Intent.CREATOR.createFromParcel(data);
203 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700205 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700207 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700208 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 Bundle options = data.readInt() != 0
210 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700211 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800212 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700213 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700214 reply.writeNoException();
215 reply.writeInt(result);
216 return true;
217 }
218
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700219 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700224 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700225 Intent fillInIntent = null;
226 if (data.readInt() != 0) {
227 fillInIntent = Intent.CREATOR.createFromParcel(data);
228 }
229 String resolvedType = data.readString();
230 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700231 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700232 int requestCode = data.readInt();
233 int flagsMask = data.readInt();
234 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700235 Bundle options = data.readInt() != 0
236 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700237 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700238 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700239 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700240 reply.writeNoException();
241 reply.writeInt(result);
242 return true;
243 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
246 {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder callingActivity = data.readStrongBinder();
249 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700250 Bundle options = data.readInt() != 0
251 ? Bundle.CREATOR.createFromParcel(data) : null;
252 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 reply.writeNoException();
254 reply.writeInt(result ? 1 : 0);
255 return true;
256 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 case FINISH_ACTIVITY_TRANSACTION: {
259 data.enforceInterface(IActivityManager.descriptor);
260 IBinder token = data.readStrongBinder();
261 Intent resultData = null;
262 int resultCode = data.readInt();
263 if (data.readInt() != 0) {
264 resultData = Intent.CREATOR.createFromParcel(data);
265 }
266 boolean res = finishActivity(token, resultCode, resultData);
267 reply.writeNoException();
268 reply.writeInt(res ? 1 : 0);
269 return true;
270 }
271
272 case FINISH_SUB_ACTIVITY_TRANSACTION: {
273 data.enforceInterface(IActivityManager.descriptor);
274 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700275 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800276 int requestCode = data.readInt();
277 finishSubActivity(token, resultWho, requestCode);
278 reply.writeNoException();
279 return true;
280 }
281
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700282 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
283 data.enforceInterface(IActivityManager.descriptor);
284 IBinder token = data.readStrongBinder();
285 boolean res = finishActivityAffinity(token);
286 reply.writeNoException();
287 reply.writeInt(res ? 1 : 0);
288 return true;
289 }
290
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800291 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
292 data.enforceInterface(IActivityManager.descriptor);
293 IBinder token = data.readStrongBinder();
294 boolean res = willActivityBeVisible(token);
295 reply.writeNoException();
296 reply.writeInt(res ? 1 : 0);
297 return true;
298 }
299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 case REGISTER_RECEIVER_TRANSACTION:
301 {
302 data.enforceInterface(IActivityManager.descriptor);
303 IBinder b = data.readStrongBinder();
304 IApplicationThread app =
305 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700306 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 b = data.readStrongBinder();
308 IIntentReceiver rec
309 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
310 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
311 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700312 int userId = data.readInt();
313 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800314 reply.writeNoException();
315 if (intent != null) {
316 reply.writeInt(1);
317 intent.writeToParcel(reply, 0);
318 } else {
319 reply.writeInt(0);
320 }
321 return true;
322 }
323
324 case UNREGISTER_RECEIVER_TRANSACTION:
325 {
326 data.enforceInterface(IActivityManager.descriptor);
327 IBinder b = data.readStrongBinder();
328 if (b == null) {
329 return true;
330 }
331 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
332 unregisterReceiver(rec);
333 reply.writeNoException();
334 return true;
335 }
336
337 case BROADCAST_INTENT_TRANSACTION:
338 {
339 data.enforceInterface(IActivityManager.descriptor);
340 IBinder b = data.readStrongBinder();
341 IApplicationThread app =
342 b != null ? ApplicationThreadNative.asInterface(b) : null;
343 Intent intent = Intent.CREATOR.createFromParcel(data);
344 String resolvedType = data.readString();
345 b = data.readStrongBinder();
346 IIntentReceiver resultTo =
347 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
348 int resultCode = data.readInt();
349 String resultData = data.readString();
350 Bundle resultExtras = data.readBundle();
351 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800352 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 boolean serialized = data.readInt() != 0;
354 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700355 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800357 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700358 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800359 reply.writeNoException();
360 reply.writeInt(res);
361 return true;
362 }
363
364 case UNBROADCAST_INTENT_TRANSACTION:
365 {
366 data.enforceInterface(IActivityManager.descriptor);
367 IBinder b = data.readStrongBinder();
368 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
369 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700370 int userId = data.readInt();
371 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 reply.writeNoException();
373 return true;
374 }
375
376 case FINISH_RECEIVER_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder who = data.readStrongBinder();
379 int resultCode = data.readInt();
380 String resultData = data.readString();
381 Bundle resultExtras = data.readBundle();
382 boolean resultAbort = data.readInt() != 0;
383 if (who != null) {
384 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
385 }
386 reply.writeNoException();
387 return true;
388 }
389
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 case ATTACH_APPLICATION_TRANSACTION: {
391 data.enforceInterface(IActivityManager.descriptor);
392 IApplicationThread app = ApplicationThreadNative.asInterface(
393 data.readStrongBinder());
394 if (app != null) {
395 attachApplication(app);
396 }
397 reply.writeNoException();
398 return true;
399 }
400
401 case ACTIVITY_IDLE_TRANSACTION: {
402 data.enforceInterface(IActivityManager.descriptor);
403 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700404 Configuration config = null;
405 if (data.readInt() != 0) {
406 config = Configuration.CREATOR.createFromParcel(data);
407 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700408 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700410 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 }
412 reply.writeNoException();
413 return true;
414 }
415
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700416 case ACTIVITY_RESUMED_TRANSACTION: {
417 data.enforceInterface(IActivityManager.descriptor);
418 IBinder token = data.readStrongBinder();
419 activityResumed(token);
420 reply.writeNoException();
421 return true;
422 }
423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 case ACTIVITY_PAUSED_TRANSACTION: {
425 data.enforceInterface(IActivityManager.descriptor);
426 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800427 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 reply.writeNoException();
429 return true;
430 }
431
432 case ACTIVITY_STOPPED_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800435 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 Bitmap thumbnail = data.readInt() != 0
437 ? Bitmap.CREATOR.createFromParcel(data) : null;
438 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800439 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 reply.writeNoException();
441 return true;
442 }
443
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800444 case ACTIVITY_SLEPT_TRANSACTION: {
445 data.enforceInterface(IActivityManager.descriptor);
446 IBinder token = data.readStrongBinder();
447 activitySlept(token);
448 reply.writeNoException();
449 return true;
450 }
451
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 case ACTIVITY_DESTROYED_TRANSACTION: {
453 data.enforceInterface(IActivityManager.descriptor);
454 IBinder token = data.readStrongBinder();
455 activityDestroyed(token);
456 reply.writeNoException();
457 return true;
458 }
459
460 case GET_CALLING_PACKAGE_TRANSACTION: {
461 data.enforceInterface(IActivityManager.descriptor);
462 IBinder token = data.readStrongBinder();
463 String res = token != null ? getCallingPackage(token) : null;
464 reply.writeNoException();
465 reply.writeString(res);
466 return true;
467 }
468
469 case GET_CALLING_ACTIVITY_TRANSACTION: {
470 data.enforceInterface(IActivityManager.descriptor);
471 IBinder token = data.readStrongBinder();
472 ComponentName cn = getCallingActivity(token);
473 reply.writeNoException();
474 ComponentName.writeToParcel(cn, reply);
475 return true;
476 }
477
478 case GET_TASKS_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 int maxNum = data.readInt();
481 int fl = data.readInt();
482 IBinder receiverBinder = data.readStrongBinder();
483 IThumbnailReceiver receiver = receiverBinder != null
484 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
485 : null;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700486 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 reply.writeNoException();
488 int N = list != null ? list.size() : -1;
489 reply.writeInt(N);
490 int i;
491 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700492 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 info.writeToParcel(reply, 0);
494 }
495 return true;
496 }
497
498 case GET_RECENT_TASKS_TRANSACTION: {
499 data.enforceInterface(IActivityManager.descriptor);
500 int maxNum = data.readInt();
501 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700502 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800503 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700504 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 reply.writeNoException();
506 reply.writeTypedList(list);
507 return true;
508 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700509
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700510 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800511 data.enforceInterface(IActivityManager.descriptor);
512 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700513 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800514 reply.writeNoException();
515 if (bm != null) {
516 reply.writeInt(1);
517 bm.writeToParcel(reply, 0);
518 } else {
519 reply.writeInt(0);
520 }
521 return true;
522 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700523
524 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
525 data.enforceInterface(IActivityManager.descriptor);
526 int id = data.readInt();
527 Bitmap bm = getTaskTopThumbnail(id);
528 reply.writeNoException();
529 if (bm != null) {
530 reply.writeInt(1);
531 bm.writeToParcel(reply, 0);
532 } else {
533 reply.writeInt(0);
534 }
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case GET_SERVICES_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 int maxNum = data.readInt();
541 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700542 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 int N = list != null ? list.size() : -1;
545 reply.writeInt(N);
546 int i;
547 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700548 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 info.writeToParcel(reply, 0);
550 }
551 return true;
552 }
553
554 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
557 reply.writeNoException();
558 reply.writeTypedList(list);
559 return true;
560 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700561
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800562 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
563 data.enforceInterface(IActivityManager.descriptor);
564 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
565 reply.writeNoException();
566 reply.writeTypedList(list);
567 return true;
568 }
569
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700570 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
571 data.enforceInterface(IActivityManager.descriptor);
572 List<ApplicationInfo> list = getRunningExternalApplications();
573 reply.writeNoException();
574 reply.writeTypedList(list);
575 return true;
576 }
577
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 case MOVE_TASK_TO_FRONT_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800581 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700582 Bundle options = data.readInt() != 0
583 ? Bundle.CREATOR.createFromParcel(data) : null;
584 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 reply.writeNoException();
586 return true;
587 }
588
589 case MOVE_TASK_TO_BACK_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 int task = data.readInt();
592 moveTaskToBack(task);
593 reply.writeNoException();
594 return true;
595 }
596
597 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 IBinder token = data.readStrongBinder();
600 boolean nonRoot = data.readInt() != 0;
601 boolean res = moveActivityTaskToBack(token, nonRoot);
602 reply.writeNoException();
603 reply.writeInt(res ? 1 : 0);
604 return true;
605 }
606
607 case MOVE_TASK_BACKWARDS_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 int task = data.readInt();
610 moveTaskBackwards(task);
611 reply.writeNoException();
612 return true;
613 }
614
Craig Mautnerc00204b2013-03-05 15:02:14 -0800615 case MOVE_TASK_TO_STACK_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int taskId = data.readInt();
618 int stackId = data.readInt();
619 boolean toTop = data.readInt() != 0;
620 moveTaskToStack(taskId, stackId, toTop);
621 reply.writeNoException();
622 return true;
623 }
624
625 case RESIZE_STACK_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800627 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800628 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800629 Rect r = Rect.CREATOR.createFromParcel(data);
630 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800631 reply.writeNoException();
632 return true;
633 }
634
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800635 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700636 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800637 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700638 reply.writeNoException();
639 reply.writeTypedList(list);
640 return true;
641 }
642
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800643 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700644 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800645 int stackId = data.readInt();
646 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700647 reply.writeNoException();
648 if (info != null) {
649 reply.writeInt(1);
650 info.writeToParcel(reply, 0);
651 } else {
652 reply.writeInt(0);
653 }
654 return true;
655 }
656
Craig Mautnercf910b02013-04-23 11:23:27 -0700657 case SET_FOCUSED_STACK_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 int stackId = data.readInt();
660 setFocusedStack(stackId);
661 reply.writeNoException();
662 return true;
663 }
664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 IBinder token = data.readStrongBinder();
668 boolean onlyRoot = data.readInt() != 0;
669 int res = token != null
670 ? getTaskForActivity(token, onlyRoot) : -1;
671 reply.writeNoException();
672 reply.writeInt(res);
673 return true;
674 }
675
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800676 case REPORT_THUMBNAIL_TRANSACTION: {
677 data.enforceInterface(IActivityManager.descriptor);
678 IBinder token = data.readStrongBinder();
679 Bitmap thumbnail = data.readInt() != 0
680 ? Bitmap.CREATOR.createFromParcel(data) : null;
681 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
682 reportThumbnail(token, thumbnail, description);
683 reply.writeNoException();
684 return true;
685 }
686
687 case GET_CONTENT_PROVIDER_TRANSACTION: {
688 data.enforceInterface(IActivityManager.descriptor);
689 IBinder b = data.readStrongBinder();
690 IApplicationThread app = ApplicationThreadNative.asInterface(b);
691 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700692 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700693 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700694 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800695 reply.writeNoException();
696 if (cph != null) {
697 reply.writeInt(1);
698 cph.writeToParcel(reply, 0);
699 } else {
700 reply.writeInt(0);
701 }
702 return true;
703 }
704
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800705 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700708 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800709 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700710 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800711 reply.writeNoException();
712 if (cph != null) {
713 reply.writeInt(1);
714 cph.writeToParcel(reply, 0);
715 } else {
716 reply.writeInt(0);
717 }
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder b = data.readStrongBinder();
724 IApplicationThread app = ApplicationThreadNative.asInterface(b);
725 ArrayList<ContentProviderHolder> providers =
726 data.createTypedArrayList(ContentProviderHolder.CREATOR);
727 publishContentProviders(app, providers);
728 reply.writeNoException();
729 return true;
730 }
731
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700732 case REF_CONTENT_PROVIDER_TRANSACTION: {
733 data.enforceInterface(IActivityManager.descriptor);
734 IBinder b = data.readStrongBinder();
735 int stable = data.readInt();
736 int unstable = data.readInt();
737 boolean res = refContentProvider(b, stable, unstable);
738 reply.writeNoException();
739 reply.writeInt(res ? 1 : 0);
740 return true;
741 }
742
743 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
744 data.enforceInterface(IActivityManager.descriptor);
745 IBinder b = data.readStrongBinder();
746 unstableProviderDied(b);
747 reply.writeNoException();
748 return true;
749 }
750
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700751 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 IBinder b = data.readStrongBinder();
754 appNotRespondingViaProvider(b);
755 reply.writeNoException();
756 return true;
757 }
758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700762 boolean stable = data.readInt() != 0;
763 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 reply.writeNoException();
765 return true;
766 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800767
768 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 String name = data.readString();
771 IBinder token = data.readStrongBinder();
772 removeContentProviderExternal(name, token);
773 reply.writeNoException();
774 return true;
775 }
776
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700777 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
780 PendingIntent pi = getRunningServiceControlPanel(comp);
781 reply.writeNoException();
782 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
783 return true;
784 }
785
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 case START_SERVICE_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder b = data.readStrongBinder();
789 IApplicationThread app = ApplicationThreadNative.asInterface(b);
790 Intent service = Intent.CREATOR.createFromParcel(data);
791 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700792 int userId = data.readInt();
793 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 reply.writeNoException();
795 ComponentName.writeToParcel(cn, reply);
796 return true;
797 }
798
799 case STOP_SERVICE_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder b = data.readStrongBinder();
802 IApplicationThread app = ApplicationThreadNative.asInterface(b);
803 Intent service = Intent.CREATOR.createFromParcel(data);
804 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700805 int userId = data.readInt();
806 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800807 reply.writeNoException();
808 reply.writeInt(res);
809 return true;
810 }
811
812 case STOP_SERVICE_TOKEN_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 ComponentName className = ComponentName.readFromParcel(data);
815 IBinder token = data.readStrongBinder();
816 int startId = data.readInt();
817 boolean res = stopServiceToken(className, token, startId);
818 reply.writeNoException();
819 reply.writeInt(res ? 1 : 0);
820 return true;
821 }
822
823 case SET_SERVICE_FOREGROUND_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 ComponentName className = ComponentName.readFromParcel(data);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700827 int id = data.readInt();
828 Notification notification = null;
829 if (data.readInt() != 0) {
830 notification = Notification.CREATOR.createFromParcel(data);
831 }
832 boolean removeNotification = data.readInt() != 0;
833 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 reply.writeNoException();
835 return true;
836 }
837
838 case BIND_SERVICE_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder b = data.readStrongBinder();
841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
842 IBinder token = data.readStrongBinder();
843 Intent service = Intent.CREATOR.createFromParcel(data);
844 String resolvedType = data.readString();
845 b = data.readStrongBinder();
846 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800847 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800848 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800849 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 reply.writeNoException();
851 reply.writeInt(res);
852 return true;
853 }
854
855 case UNBIND_SERVICE_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
859 boolean res = unbindService(conn);
860 reply.writeNoException();
861 reply.writeInt(res ? 1 : 0);
862 return true;
863 }
864
865 case PUBLISH_SERVICE_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder token = data.readStrongBinder();
868 Intent intent = Intent.CREATOR.createFromParcel(data);
869 IBinder service = data.readStrongBinder();
870 publishService(token, intent, service);
871 reply.writeNoException();
872 return true;
873 }
874
875 case UNBIND_FINISHED_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder token = data.readStrongBinder();
878 Intent intent = Intent.CREATOR.createFromParcel(data);
879 boolean doRebind = data.readInt() != 0;
880 unbindFinished(token, intent, doRebind);
881 reply.writeNoException();
882 return true;
883 }
884
885 case SERVICE_DONE_EXECUTING_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700888 int type = data.readInt();
889 int startId = data.readInt();
890 int res = data.readInt();
891 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 reply.writeNoException();
893 return true;
894 }
895
896 case START_INSTRUMENTATION_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 ComponentName className = ComponentName.readFromParcel(data);
899 String profileFile = data.readString();
900 int fl = data.readInt();
901 Bundle arguments = data.readBundle();
902 IBinder b = data.readStrongBinder();
903 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800904 b = data.readStrongBinder();
905 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700906 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800907 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res ? 1 : 0);
910 return true;
911 }
912
913
914 case FINISH_INSTRUMENTATION_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 IBinder b = data.readStrongBinder();
917 IApplicationThread app = ApplicationThreadNative.asInterface(b);
918 int resultCode = data.readInt();
919 Bundle results = data.readBundle();
920 finishInstrumentation(app, resultCode, results);
921 reply.writeNoException();
922 return true;
923 }
924
925 case GET_CONFIGURATION_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 Configuration config = getConfiguration();
928 reply.writeNoException();
929 config.writeToParcel(reply, 0);
930 return true;
931 }
932
933 case UPDATE_CONFIGURATION_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 Configuration config = Configuration.CREATOR.createFromParcel(data);
936 updateConfiguration(config);
937 reply.writeNoException();
938 return true;
939 }
940
941 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 IBinder token = data.readStrongBinder();
944 int requestedOrientation = data.readInt();
945 setRequestedOrientation(token, requestedOrientation);
946 reply.writeNoException();
947 return true;
948 }
949
950 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder token = data.readStrongBinder();
953 int req = getRequestedOrientation(token);
954 reply.writeNoException();
955 reply.writeInt(req);
956 return true;
957 }
958
959 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
960 data.enforceInterface(IActivityManager.descriptor);
961 IBinder token = data.readStrongBinder();
962 ComponentName cn = getActivityClassForToken(token);
963 reply.writeNoException();
964 ComponentName.writeToParcel(cn, reply);
965 return true;
966 }
967
968 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 reply.writeNoException();
972 reply.writeString(getPackageForToken(token));
973 return true;
974 }
975
976 case GET_INTENT_SENDER_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 int type = data.readInt();
979 String packageName = data.readString();
980 IBinder token = data.readStrongBinder();
981 String resultWho = data.readString();
982 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800983 Intent[] requestIntents;
984 String[] requestResolvedTypes;
985 if (data.readInt() != 0) {
986 requestIntents = data.createTypedArray(Intent.CREATOR);
987 requestResolvedTypes = data.createStringArray();
988 } else {
989 requestIntents = null;
990 requestResolvedTypes = null;
991 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700993 Bundle options = data.readInt() != 0
994 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700995 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800997 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700998 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 reply.writeNoException();
1000 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1001 return true;
1002 }
1003
1004 case CANCEL_INTENT_SENDER_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IIntentSender r = IIntentSender.Stub.asInterface(
1007 data.readStrongBinder());
1008 cancelIntentSender(r);
1009 reply.writeNoException();
1010 return true;
1011 }
1012
1013 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IIntentSender r = IIntentSender.Stub.asInterface(
1016 data.readStrongBinder());
1017 String res = getPackageForIntentSender(r);
1018 reply.writeNoException();
1019 reply.writeString(res);
1020 return true;
1021 }
1022
Christopher Tatec4a07d12012-04-06 14:19:13 -07001023 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1024 data.enforceInterface(IActivityManager.descriptor);
1025 IIntentSender r = IIntentSender.Stub.asInterface(
1026 data.readStrongBinder());
1027 int res = getUidForIntentSender(r);
1028 reply.writeNoException();
1029 reply.writeInt(res);
1030 return true;
1031 }
1032
Dianne Hackborn41203752012-08-31 14:05:51 -07001033 case HANDLE_INCOMING_USER_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 int callingPid = data.readInt();
1036 int callingUid = data.readInt();
1037 int userId = data.readInt();
1038 boolean allowAll = data.readInt() != 0 ;
1039 boolean requireFull = data.readInt() != 0;
1040 String name = data.readString();
1041 String callerPackage = data.readString();
1042 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1043 requireFull, name, callerPackage);
1044 reply.writeNoException();
1045 reply.writeInt(res);
1046 return true;
1047 }
1048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001049 case SET_PROCESS_LIMIT_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 int max = data.readInt();
1052 setProcessLimit(max);
1053 reply.writeNoException();
1054 return true;
1055 }
1056
1057 case GET_PROCESS_LIMIT_TRANSACTION: {
1058 data.enforceInterface(IActivityManager.descriptor);
1059 int limit = getProcessLimit();
1060 reply.writeNoException();
1061 reply.writeInt(limit);
1062 return true;
1063 }
1064
1065 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder token = data.readStrongBinder();
1068 int pid = data.readInt();
1069 boolean isForeground = data.readInt() != 0;
1070 setProcessForeground(token, pid, isForeground);
1071 reply.writeNoException();
1072 return true;
1073 }
1074
1075 case CHECK_PERMISSION_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 String perm = data.readString();
1078 int pid = data.readInt();
1079 int uid = data.readInt();
1080 int res = checkPermission(perm, pid, uid);
1081 reply.writeNoException();
1082 reply.writeInt(res);
1083 return true;
1084 }
1085
1086 case CHECK_URI_PERMISSION_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 Uri uri = Uri.CREATOR.createFromParcel(data);
1089 int pid = data.readInt();
1090 int uid = data.readInt();
1091 int mode = data.readInt();
1092 int res = checkUriPermission(uri, pid, uid, mode);
1093 reply.writeNoException();
1094 reply.writeInt(res);
1095 return true;
1096 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001099 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 String packageName = data.readString();
1101 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1102 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001103 int userId = data.readInt();
1104 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001105 reply.writeNoException();
1106 reply.writeInt(res ? 1 : 0);
1107 return true;
1108 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 case GRANT_URI_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 IBinder b = data.readStrongBinder();
1113 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1114 String targetPkg = data.readString();
1115 Uri uri = Uri.CREATOR.createFromParcel(data);
1116 int mode = data.readInt();
1117 grantUriPermission(app, targetPkg, uri, mode);
1118 reply.writeNoException();
1119 return true;
1120 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 case REVOKE_URI_PERMISSION_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 IBinder b = data.readStrongBinder();
1125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1126 Uri uri = Uri.CREATOR.createFromParcel(data);
1127 int mode = data.readInt();
1128 revokeUriPermission(app, uri, mode);
1129 reply.writeNoException();
1130 return true;
1131 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001132
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001133 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 Uri uri = Uri.CREATOR.createFromParcel(data);
1136 int mode = data.readInt();
1137 takePersistableUriPermission(uri, mode);
1138 reply.writeNoException();
1139 return true;
1140 }
1141
1142 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 Uri uri = Uri.CREATOR.createFromParcel(data);
1145 int mode = data.readInt();
1146 releasePersistableUriPermission(uri, mode);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
1151 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001153 final String packageName = data.readString();
1154 final boolean incoming = data.readInt() != 0;
1155 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1156 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001157 reply.writeNoException();
1158 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1159 return true;
1160 }
1161
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001162 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 IBinder b = data.readStrongBinder();
1165 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1166 boolean waiting = data.readInt() != 0;
1167 showWaitingForDebugger(app, waiting);
1168 reply.writeNoException();
1169 return true;
1170 }
1171
1172 case GET_MEMORY_INFO_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1175 getMemoryInfo(mi);
1176 reply.writeNoException();
1177 mi.writeToParcel(reply, 0);
1178 return true;
1179 }
1180
1181 case UNHANDLED_BACK_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 unhandledBack();
1184 reply.writeNoException();
1185 return true;
1186 }
1187
1188 case OPEN_CONTENT_URI_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 Uri uri = Uri.parse(data.readString());
1191 ParcelFileDescriptor pfd = openContentUri(uri);
1192 reply.writeNoException();
1193 if (pfd != null) {
1194 reply.writeInt(1);
1195 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1196 } else {
1197 reply.writeInt(0);
1198 }
1199 return true;
1200 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case GOING_TO_SLEEP_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 goingToSleep();
1205 reply.writeNoException();
1206 return true;
1207 }
1208
1209 case WAKING_UP_TRANSACTION: {
1210 data.enforceInterface(IActivityManager.descriptor);
1211 wakingUp();
1212 reply.writeNoException();
1213 return true;
1214 }
1215
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001216 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 setLockScreenShown(data.readInt() != 0);
1219 reply.writeNoException();
1220 return true;
1221 }
1222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 case SET_DEBUG_APP_TRANSACTION: {
1224 data.enforceInterface(IActivityManager.descriptor);
1225 String pn = data.readString();
1226 boolean wfd = data.readInt() != 0;
1227 boolean per = data.readInt() != 0;
1228 setDebugApp(pn, wfd, per);
1229 reply.writeNoException();
1230 return true;
1231 }
1232
1233 case SET_ALWAYS_FINISH_TRANSACTION: {
1234 data.enforceInterface(IActivityManager.descriptor);
1235 boolean enabled = data.readInt() != 0;
1236 setAlwaysFinish(enabled);
1237 reply.writeNoException();
1238 return true;
1239 }
1240
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001241 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001242 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001243 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001245 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001246 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 return true;
1248 }
1249
1250 case ENTER_SAFE_MODE_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 enterSafeMode();
1253 reply.writeNoException();
1254 return true;
1255 }
1256
1257 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 IIntentSender is = IIntentSender.Stub.asInterface(
1260 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001261 int sourceUid = data.readInt();
1262 String sourcePkg = data.readString();
1263 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 reply.writeNoException();
1265 return true;
1266 }
1267
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001268 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 data.enforceInterface(IActivityManager.descriptor);
1270 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001271 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001272 boolean secure = data.readInt() != 0;
1273 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 reply.writeNoException();
1275 reply.writeInt(res ? 1 : 0);
1276 return true;
1277 }
1278
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001279 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1280 data.enforceInterface(IActivityManager.descriptor);
1281 String reason = data.readString();
1282 boolean res = killProcessesBelowForeground(reason);
1283 reply.writeNoException();
1284 reply.writeInt(res ? 1 : 0);
1285 return true;
1286 }
1287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001288 case START_RUNNING_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 String pkg = data.readString();
1291 String cls = data.readString();
1292 String action = data.readString();
1293 String indata = data.readString();
1294 startRunning(pkg, cls, action, indata);
1295 reply.writeNoException();
1296 return true;
1297 }
1298
Dan Egnor60d87622009-12-16 16:32:58 -08001299 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1300 data.enforceInterface(IActivityManager.descriptor);
1301 IBinder app = data.readStrongBinder();
1302 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1303 handleApplicationCrash(app, ci);
1304 reply.writeNoException();
1305 return true;
1306 }
1307
1308 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 data.enforceInterface(IActivityManager.descriptor);
1310 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001311 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001312 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001313 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001315 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 return true;
1317 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001318
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001319 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1320 data.enforceInterface(IActivityManager.descriptor);
1321 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001322 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001323 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1324 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001325 reply.writeNoException();
1326 return true;
1327 }
1328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1330 data.enforceInterface(IActivityManager.descriptor);
1331 int sig = data.readInt();
1332 signalPersistentProcesses(sig);
1333 reply.writeNoException();
1334 return true;
1335 }
1336
Dianne Hackborn03abb812010-01-04 18:43:19 -08001337 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1338 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001339 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001340 int userId = data.readInt();
1341 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001342 reply.writeNoException();
1343 return true;
1344 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001345
1346 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1347 data.enforceInterface(IActivityManager.descriptor);
1348 killAllBackgroundProcesses();
1349 reply.writeNoException();
1350 return true;
1351 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001352
Dianne Hackborn03abb812010-01-04 18:43:19 -08001353 case FORCE_STOP_PACKAGE_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001356 int userId = data.readInt();
1357 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001361
1362 case GET_MY_MEMORY_STATE_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 ActivityManager.RunningAppProcessInfo info =
1365 new ActivityManager.RunningAppProcessInfo();
1366 getMyMemoryState(info);
1367 reply.writeNoException();
1368 info.writeToParcel(reply, 0);
1369 return true;
1370 }
1371
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001372 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1373 data.enforceInterface(IActivityManager.descriptor);
1374 ConfigurationInfo config = getDeviceConfigurationInfo();
1375 reply.writeNoException();
1376 config.writeToParcel(reply, 0);
1377 return true;
1378 }
1379
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001380 case PROFILE_CONTROL_TRANSACTION: {
1381 data.enforceInterface(IActivityManager.descriptor);
1382 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001383 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001384 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001385 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001386 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001387 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001388 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001389 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001390 reply.writeNoException();
1391 reply.writeInt(res ? 1 : 0);
1392 return true;
1393 }
1394
Dianne Hackborn55280a92009-05-07 15:53:46 -07001395 case SHUTDOWN_TRANSACTION: {
1396 data.enforceInterface(IActivityManager.descriptor);
1397 boolean res = shutdown(data.readInt());
1398 reply.writeNoException();
1399 reply.writeInt(res ? 1 : 0);
1400 return true;
1401 }
1402
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001403 case STOP_APP_SWITCHES_TRANSACTION: {
1404 data.enforceInterface(IActivityManager.descriptor);
1405 stopAppSwitches();
1406 reply.writeNoException();
1407 return true;
1408 }
1409
1410 case RESUME_APP_SWITCHES_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 resumeAppSwitches();
1413 reply.writeNoException();
1414 return true;
1415 }
1416
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001417 case PEEK_SERVICE_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 Intent service = Intent.CREATOR.createFromParcel(data);
1420 String resolvedType = data.readString();
1421 IBinder binder = peekService(service, resolvedType);
1422 reply.writeNoException();
1423 reply.writeStrongBinder(binder);
1424 return true;
1425 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001426
1427 case START_BACKUP_AGENT_TRANSACTION: {
1428 data.enforceInterface(IActivityManager.descriptor);
1429 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1430 int backupRestoreMode = data.readInt();
1431 boolean success = bindBackupAgent(info, backupRestoreMode);
1432 reply.writeNoException();
1433 reply.writeInt(success ? 1 : 0);
1434 return true;
1435 }
1436
1437 case BACKUP_AGENT_CREATED_TRANSACTION: {
1438 data.enforceInterface(IActivityManager.descriptor);
1439 String packageName = data.readString();
1440 IBinder agent = data.readStrongBinder();
1441 backupAgentCreated(packageName, agent);
1442 reply.writeNoException();
1443 return true;
1444 }
1445
1446 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1449 unbindBackupAgent(info);
1450 reply.writeNoException();
1451 return true;
1452 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001453
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001454 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001455 data.enforceInterface(IActivityManager.descriptor);
1456 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001457 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001458 String reason = data.readString();
1459 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001460 reply.writeNoException();
1461 return true;
1462 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001463
1464 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1465 data.enforceInterface(IActivityManager.descriptor);
1466 String reason = data.readString();
1467 closeSystemDialogs(reason);
1468 reply.writeNoException();
1469 return true;
1470 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001471
1472 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1473 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001474 int[] pids = data.createIntArray();
1475 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001476 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001477 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001478 return true;
1479 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001480
1481 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1482 data.enforceInterface(IActivityManager.descriptor);
1483 String processName = data.readString();
1484 int uid = data.readInt();
1485 killApplicationProcess(processName, uid);
1486 reply.writeNoException();
1487 return true;
1488 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001489
1490 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 IBinder token = data.readStrongBinder();
1493 String packageName = data.readString();
1494 int enterAnim = data.readInt();
1495 int exitAnim = data.readInt();
1496 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001497 reply.writeNoException();
1498 return true;
1499 }
1500
1501 case IS_USER_A_MONKEY_TRANSACTION: {
1502 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001503 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001504 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001505 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001506 return true;
1507 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001508
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001509 case SET_USER_IS_MONKEY_TRANSACTION: {
1510 data.enforceInterface(IActivityManager.descriptor);
1511 final boolean monkey = (data.readInt() == 1);
1512 setUserIsMonkey(monkey);
1513 reply.writeNoException();
1514 return true;
1515 }
1516
Dianne Hackborn860755f2010-06-03 18:47:52 -07001517 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1518 data.enforceInterface(IActivityManager.descriptor);
1519 finishHeavyWeightApp();
1520 reply.writeNoException();
1521 return true;
1522 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001523
1524 case IS_IMMERSIVE_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001527 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001528 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001529 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001530 return true;
1531 }
1532
Craig Mautner5eda9b32013-07-02 11:58:16 -07001533 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001534 data.enforceInterface(IActivityManager.descriptor);
1535 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001536 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001537 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001538 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001539 return true;
1540 }
1541
1542 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1543 data.enforceInterface(IActivityManager.descriptor);
1544 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001545 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001546 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001547 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001548 return true;
1549 }
1550
Daniel Sandler69a48172010-06-23 16:29:36 -04001551 case SET_IMMERSIVE_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 IBinder token = data.readStrongBinder();
1554 boolean imm = data.readInt() == 1;
1555 setImmersive(token, imm);
1556 reply.writeNoException();
1557 return true;
1558 }
1559
1560 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001562 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001563 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001564 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001565 return true;
1566 }
1567
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001568 case CRASH_APPLICATION_TRANSACTION: {
1569 data.enforceInterface(IActivityManager.descriptor);
1570 int uid = data.readInt();
1571 int initialPid = data.readInt();
1572 String packageName = data.readString();
1573 String message = data.readString();
1574 crashApplication(uid, initialPid, packageName, message);
1575 reply.writeNoException();
1576 return true;
1577 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001578
1579 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1580 data.enforceInterface(IActivityManager.descriptor);
1581 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001582 int userId = data.readInt();
1583 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001584 reply.writeNoException();
1585 reply.writeString(type);
1586 return true;
1587 }
1588
Dianne Hackborn7e269642010-08-25 19:50:20 -07001589 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1590 data.enforceInterface(IActivityManager.descriptor);
1591 String name = data.readString();
1592 IBinder perm = newUriPermissionOwner(name);
1593 reply.writeNoException();
1594 reply.writeStrongBinder(perm);
1595 return true;
1596 }
1597
1598 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1599 data.enforceInterface(IActivityManager.descriptor);
1600 IBinder owner = data.readStrongBinder();
1601 int fromUid = data.readInt();
1602 String targetPkg = data.readString();
1603 Uri uri = Uri.CREATOR.createFromParcel(data);
1604 int mode = data.readInt();
1605 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1606 reply.writeNoException();
1607 return true;
1608 }
1609
1610 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1611 data.enforceInterface(IActivityManager.descriptor);
1612 IBinder owner = data.readStrongBinder();
1613 Uri uri = null;
1614 if (data.readInt() != 0) {
1615 Uri.CREATOR.createFromParcel(data);
1616 }
1617 int mode = data.readInt();
1618 revokeUriPermissionFromOwner(owner, uri, mode);
1619 reply.writeNoException();
1620 return true;
1621 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001622
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001623 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1624 data.enforceInterface(IActivityManager.descriptor);
1625 int callingUid = data.readInt();
1626 String targetPkg = data.readString();
1627 Uri uri = Uri.CREATOR.createFromParcel(data);
1628 int modeFlags = data.readInt();
1629 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1630 reply.writeNoException();
1631 reply.writeInt(res);
1632 return true;
1633 }
1634
Andy McFadden824c5102010-07-09 16:26:57 -07001635 case DUMP_HEAP_TRANSACTION: {
1636 data.enforceInterface(IActivityManager.descriptor);
1637 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001638 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001639 boolean managed = data.readInt() != 0;
1640 String path = data.readString();
1641 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001642 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001643 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001644 reply.writeNoException();
1645 reply.writeInt(res ? 1 : 0);
1646 return true;
1647 }
1648
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001649 case START_ACTIVITIES_TRANSACTION:
1650 {
1651 data.enforceInterface(IActivityManager.descriptor);
1652 IBinder b = data.readStrongBinder();
1653 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001654 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001655 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1656 String[] resolvedTypes = data.createStringArray();
1657 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001658 Bundle options = data.readInt() != 0
1659 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001660 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001661 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001662 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001663 reply.writeNoException();
1664 reply.writeInt(result);
1665 return true;
1666 }
1667
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001668 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1669 {
1670 data.enforceInterface(IActivityManager.descriptor);
1671 int mode = getFrontActivityScreenCompatMode();
1672 reply.writeNoException();
1673 reply.writeInt(mode);
1674 return true;
1675 }
1676
1677 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1678 {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 int mode = data.readInt();
1681 setFrontActivityScreenCompatMode(mode);
1682 reply.writeNoException();
1683 reply.writeInt(mode);
1684 return true;
1685 }
1686
1687 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1688 {
1689 data.enforceInterface(IActivityManager.descriptor);
1690 String pkg = data.readString();
1691 int mode = getPackageScreenCompatMode(pkg);
1692 reply.writeNoException();
1693 reply.writeInt(mode);
1694 return true;
1695 }
1696
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001697 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1698 {
1699 data.enforceInterface(IActivityManager.descriptor);
1700 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001701 int mode = data.readInt();
1702 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001703 reply.writeNoException();
1704 return true;
1705 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001706
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001707 case SWITCH_USER_TRANSACTION: {
1708 data.enforceInterface(IActivityManager.descriptor);
1709 int userid = data.readInt();
1710 boolean result = switchUser(userid);
1711 reply.writeNoException();
1712 reply.writeInt(result ? 1 : 0);
1713 return true;
1714 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001715
Kenny Guy08488bf2014-02-21 17:40:37 +00001716 case START_USER_IN_BACKGROUND_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 int userid = data.readInt();
1719 boolean result = startUserInBackground(userid);
1720 reply.writeNoException();
1721 reply.writeInt(result ? 1 : 0);
1722 return true;
1723 }
1724
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001725 case STOP_USER_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 int userid = data.readInt();
1728 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1729 data.readStrongBinder());
1730 int result = stopUser(userid, callback);
1731 reply.writeNoException();
1732 reply.writeInt(result);
1733 return true;
1734 }
1735
Amith Yamasani52f1d752012-03-28 18:19:29 -07001736 case GET_CURRENT_USER_TRANSACTION: {
1737 data.enforceInterface(IActivityManager.descriptor);
1738 UserInfo userInfo = getCurrentUser();
1739 reply.writeNoException();
1740 userInfo.writeToParcel(reply, 0);
1741 return true;
1742 }
1743
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001744 case IS_USER_RUNNING_TRANSACTION: {
1745 data.enforceInterface(IActivityManager.descriptor);
1746 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001747 boolean orStopping = data.readInt() != 0;
1748 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001749 reply.writeNoException();
1750 reply.writeInt(result ? 1 : 0);
1751 return true;
1752 }
1753
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001754 case GET_RUNNING_USER_IDS_TRANSACTION: {
1755 data.enforceInterface(IActivityManager.descriptor);
1756 int[] result = getRunningUserIds();
1757 reply.writeNoException();
1758 reply.writeIntArray(result);
1759 return true;
1760 }
1761
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001762 case REMOVE_SUB_TASK_TRANSACTION:
1763 {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 int taskId = data.readInt();
1766 int subTaskIndex = data.readInt();
1767 boolean result = removeSubTask(taskId, subTaskIndex);
1768 reply.writeNoException();
1769 reply.writeInt(result ? 1 : 0);
1770 return true;
1771 }
1772
1773 case REMOVE_TASK_TRANSACTION:
1774 {
1775 data.enforceInterface(IActivityManager.descriptor);
1776 int taskId = data.readInt();
1777 int fl = data.readInt();
1778 boolean result = removeTask(taskId, fl);
1779 reply.writeNoException();
1780 reply.writeInt(result ? 1 : 0);
1781 return true;
1782 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001783
Jeff Sharkeya4620792011-05-20 15:29:23 -07001784 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1785 data.enforceInterface(IActivityManager.descriptor);
1786 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1787 data.readStrongBinder());
1788 registerProcessObserver(observer);
1789 return true;
1790 }
1791
1792 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1795 data.readStrongBinder());
1796 unregisterProcessObserver(observer);
1797 return true;
1798 }
1799
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001800 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1801 {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 String pkg = data.readString();
1804 boolean ask = getPackageAskScreenCompat(pkg);
1805 reply.writeNoException();
1806 reply.writeInt(ask ? 1 : 0);
1807 return true;
1808 }
1809
1810 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1811 {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 String pkg = data.readString();
1814 boolean ask = data.readInt() != 0;
1815 setPackageAskScreenCompat(pkg, ask);
1816 reply.writeNoException();
1817 return true;
1818 }
1819
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001820 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 IIntentSender r = IIntentSender.Stub.asInterface(
1823 data.readStrongBinder());
1824 boolean res = isIntentSenderTargetedToPackage(r);
1825 reply.writeNoException();
1826 reply.writeInt(res ? 1 : 0);
1827 return true;
1828 }
1829
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001830 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1831 data.enforceInterface(IActivityManager.descriptor);
1832 IIntentSender r = IIntentSender.Stub.asInterface(
1833 data.readStrongBinder());
1834 boolean res = isIntentSenderAnActivity(r);
1835 reply.writeNoException();
1836 reply.writeInt(res ? 1 : 0);
1837 return true;
1838 }
1839
Dianne Hackborn81038902012-11-26 17:04:09 -08001840 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1841 data.enforceInterface(IActivityManager.descriptor);
1842 IIntentSender r = IIntentSender.Stub.asInterface(
1843 data.readStrongBinder());
1844 Intent intent = getIntentForIntentSender(r);
1845 reply.writeNoException();
1846 if (intent != null) {
1847 reply.writeInt(1);
1848 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1849 } else {
1850 reply.writeInt(0);
1851 }
1852 return true;
1853 }
1854
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001855 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1856 data.enforceInterface(IActivityManager.descriptor);
1857 IIntentSender r = IIntentSender.Stub.asInterface(
1858 data.readStrongBinder());
1859 String prefix = data.readString();
1860 String tag = getTagForIntentSender(r, prefix);
1861 reply.writeNoException();
1862 reply.writeString(tag);
1863 return true;
1864 }
1865
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001866 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1867 data.enforceInterface(IActivityManager.descriptor);
1868 Configuration config = Configuration.CREATOR.createFromParcel(data);
1869 updatePersistentConfiguration(config);
1870 reply.writeNoException();
1871 return true;
1872 }
1873
Dianne Hackbornb437e092011-08-05 17:50:29 -07001874 case GET_PROCESS_PSS_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 int[] pids = data.createIntArray();
1877 long[] pss = getProcessPss(pids);
1878 reply.writeNoException();
1879 reply.writeLongArray(pss);
1880 return true;
1881 }
1882
Dianne Hackborn661cd522011-08-22 00:26:20 -07001883 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1886 boolean always = data.readInt() != 0;
1887 showBootMessage(msg, always);
1888 reply.writeNoException();
1889 return true;
1890 }
1891
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001892 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1893 data.enforceInterface(IActivityManager.descriptor);
1894 dismissKeyguardOnNextActivity();
1895 reply.writeNoException();
1896 return true;
1897 }
1898
Adam Powelldd8fab22012-03-22 17:47:27 -07001899 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 IBinder token = data.readStrongBinder();
1902 String destAffinity = data.readString();
1903 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1904 reply.writeNoException();
1905 reply.writeInt(res ? 1 : 0);
1906 return true;
1907 }
1908
1909 case NAVIGATE_UP_TO_TRANSACTION: {
1910 data.enforceInterface(IActivityManager.descriptor);
1911 IBinder token = data.readStrongBinder();
1912 Intent target = Intent.CREATOR.createFromParcel(data);
1913 int resultCode = data.readInt();
1914 Intent resultData = null;
1915 if (data.readInt() != 0) {
1916 resultData = Intent.CREATOR.createFromParcel(data);
1917 }
1918 boolean res = navigateUpTo(token, target, resultCode, resultData);
1919 reply.writeNoException();
1920 reply.writeInt(res ? 1 : 0);
1921 return true;
1922 }
1923
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001924 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 IBinder token = data.readStrongBinder();
1927 int res = getLaunchedFromUid(token);
1928 reply.writeNoException();
1929 reply.writeInt(res);
1930 return true;
1931 }
1932
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001933 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 String res = getLaunchedFromPackage(token);
1937 reply.writeNoException();
1938 reply.writeString(res);
1939 return true;
1940 }
1941
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001942 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1945 data.readStrongBinder());
1946 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001947 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001948 return true;
1949 }
1950
1951 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1954 data.readStrongBinder());
1955 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001956 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001957 return true;
1958 }
1959
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001960 case REQUEST_BUG_REPORT_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001963 reply.writeNoException();
1964 return true;
1965 }
1966
1967 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1968 data.enforceInterface(IActivityManager.descriptor);
1969 int pid = data.readInt();
1970 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001971 String reason = data.readString();
1972 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001973 reply.writeNoException();
1974 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001975 return true;
1976 }
1977
Adam Skorydfc7fd72013-08-05 19:23:41 -07001978 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001979 data.enforceInterface(IActivityManager.descriptor);
1980 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001981 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001982 reply.writeNoException();
1983 reply.writeBundle(res);
1984 return true;
1985 }
1986
Adam Skorydfc7fd72013-08-05 19:23:41 -07001987 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001988 data.enforceInterface(IActivityManager.descriptor);
1989 IBinder token = data.readStrongBinder();
1990 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01001991 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001992 reply.writeNoException();
1993 return true;
1994 }
1995
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001996 case KILL_UID_TRANSACTION: {
1997 data.enforceInterface(IActivityManager.descriptor);
1998 int uid = data.readInt();
1999 String reason = data.readString();
2000 killUid(uid, reason);
2001 reply.writeNoException();
2002 return true;
2003 }
2004
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002005 case HANG_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 IBinder who = data.readStrongBinder();
2008 boolean allowRestart = data.readInt() != 0;
2009 hang(who, allowRestart);
2010 reply.writeNoException();
2011 return true;
2012 }
2013
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002014 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 IBinder token = data.readStrongBinder();
2017 reportActivityFullyDrawn(token);
2018 reply.writeNoException();
2019 return true;
2020 }
2021
Craig Mautner5eda9b32013-07-02 11:58:16 -07002022 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2023 data.enforceInterface(IActivityManager.descriptor);
2024 IBinder token = data.readStrongBinder();
2025 notifyActivityDrawn(token);
2026 reply.writeNoException();
2027 return true;
2028 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002029
2030 case RESTART_TRANSACTION: {
2031 data.enforceInterface(IActivityManager.descriptor);
2032 restart();
2033 reply.writeNoException();
2034 return true;
2035 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002036
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002037 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 performIdleMaintenance();
2040 reply.writeNoException();
2041 return true;
2042 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002043
2044 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2045 data.enforceInterface(IActivityManager.descriptor);
2046 IBinder parentActivityToken = data.readStrongBinder();
2047 IActivityContainerCallback callback =
2048 (IActivityContainerCallback) data.readStrongBinder();
2049 IActivityContainer activityContainer =
2050 createActivityContainer(parentActivityToken, callback);
2051 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002052 if (activityContainer != null) {
2053 reply.writeInt(1);
2054 reply.writeStrongBinder(activityContainer.asBinder());
2055 } else {
2056 reply.writeInt(0);
2057 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002058 return true;
2059 }
2060
Craig Mautner95da1082014-02-24 17:54:35 -08002061 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 IActivityContainer activityContainer =
2064 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2065 deleteActivityContainer(activityContainer);
2066 reply.writeNoException();
2067 return true;
2068 }
2069
Craig Mautnere0a38842013-12-16 16:14:02 -08002070 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 IBinder activityToken = data.readStrongBinder();
2073 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2074 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002075 if (activityContainer != null) {
2076 reply.writeInt(1);
2077 reply.writeStrongBinder(activityContainer.asBinder());
2078 } else {
2079 reply.writeInt(0);
2080 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002081 return true;
2082 }
2083
Craig Mautner4a1cb222013-12-04 16:14:06 -08002084 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2085 data.enforceInterface(IActivityManager.descriptor);
2086 IBinder homeActivityToken = getHomeActivityToken();
2087 reply.writeNoException();
2088 reply.writeStrongBinder(homeActivityToken);
2089 return true;
2090 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002091 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002092
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002093 return super.onTransact(code, data, reply, flags);
2094 }
2095
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002096 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002097 return this;
2098 }
2099
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002100 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2101 protected IActivityManager create() {
2102 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002103 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002104 Log.v("ActivityManager", "default service binder = " + b);
2105 }
2106 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002107 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002108 Log.v("ActivityManager", "default service = " + am);
2109 }
2110 return am;
2111 }
2112 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002113}
2114
2115class ActivityManagerProxy implements IActivityManager
2116{
2117 public ActivityManagerProxy(IBinder remote)
2118 {
2119 mRemote = remote;
2120 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002122 public IBinder asBinder()
2123 {
2124 return mRemote;
2125 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002126
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002127 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002128 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2129 int startFlags, String profileFile,
2130 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002131 Parcel data = Parcel.obtain();
2132 Parcel reply = Parcel.obtain();
2133 data.writeInterfaceToken(IActivityManager.descriptor);
2134 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002135 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002136 intent.writeToParcel(data, 0);
2137 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002138 data.writeStrongBinder(resultTo);
2139 data.writeString(resultWho);
2140 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002141 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002142 data.writeString(profileFile);
2143 if (profileFd != null) {
2144 data.writeInt(1);
2145 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2146 } else {
2147 data.writeInt(0);
2148 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002149 if (options != null) {
2150 data.writeInt(1);
2151 options.writeToParcel(data, 0);
2152 } else {
2153 data.writeInt(0);
2154 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002155 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2156 reply.readException();
2157 int result = reply.readInt();
2158 reply.recycle();
2159 data.recycle();
2160 return result;
2161 }
Amith Yamasani82644082012-08-03 13:09:11 -07002162
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002163 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002164 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2165 int startFlags, String profileFile,
2166 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2167 Parcel data = Parcel.obtain();
2168 Parcel reply = Parcel.obtain();
2169 data.writeInterfaceToken(IActivityManager.descriptor);
2170 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002171 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002172 intent.writeToParcel(data, 0);
2173 data.writeString(resolvedType);
2174 data.writeStrongBinder(resultTo);
2175 data.writeString(resultWho);
2176 data.writeInt(requestCode);
2177 data.writeInt(startFlags);
2178 data.writeString(profileFile);
2179 if (profileFd != null) {
2180 data.writeInt(1);
2181 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2182 } else {
2183 data.writeInt(0);
2184 }
2185 if (options != null) {
2186 data.writeInt(1);
2187 options.writeToParcel(data, 0);
2188 } else {
2189 data.writeInt(0);
2190 }
2191 data.writeInt(userId);
2192 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2193 reply.readException();
2194 int result = reply.readInt();
2195 reply.recycle();
2196 data.recycle();
2197 return result;
2198 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002199 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2200 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002201 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002202 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002203 Parcel data = Parcel.obtain();
2204 Parcel reply = Parcel.obtain();
2205 data.writeInterfaceToken(IActivityManager.descriptor);
2206 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002207 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002208 intent.writeToParcel(data, 0);
2209 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002210 data.writeStrongBinder(resultTo);
2211 data.writeString(resultWho);
2212 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002213 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002214 data.writeString(profileFile);
2215 if (profileFd != null) {
2216 data.writeInt(1);
2217 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2218 } else {
2219 data.writeInt(0);
2220 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002221 if (options != null) {
2222 data.writeInt(1);
2223 options.writeToParcel(data, 0);
2224 } else {
2225 data.writeInt(0);
2226 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002227 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002228 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2229 reply.readException();
2230 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2231 reply.recycle();
2232 data.recycle();
2233 return result;
2234 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002235 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2236 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002237 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002238 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002239 Parcel data = Parcel.obtain();
2240 Parcel reply = Parcel.obtain();
2241 data.writeInterfaceToken(IActivityManager.descriptor);
2242 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002243 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002244 intent.writeToParcel(data, 0);
2245 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002246 data.writeStrongBinder(resultTo);
2247 data.writeString(resultWho);
2248 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002249 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002250 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002251 if (options != null) {
2252 data.writeInt(1);
2253 options.writeToParcel(data, 0);
2254 } else {
2255 data.writeInt(0);
2256 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002257 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002258 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2259 reply.readException();
2260 int result = reply.readInt();
2261 reply.recycle();
2262 data.recycle();
2263 return result;
2264 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002265 public int startActivityIntentSender(IApplicationThread caller,
2266 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002267 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002268 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002269 Parcel data = Parcel.obtain();
2270 Parcel reply = Parcel.obtain();
2271 data.writeInterfaceToken(IActivityManager.descriptor);
2272 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2273 intent.writeToParcel(data, 0);
2274 if (fillInIntent != null) {
2275 data.writeInt(1);
2276 fillInIntent.writeToParcel(data, 0);
2277 } else {
2278 data.writeInt(0);
2279 }
2280 data.writeString(resolvedType);
2281 data.writeStrongBinder(resultTo);
2282 data.writeString(resultWho);
2283 data.writeInt(requestCode);
2284 data.writeInt(flagsMask);
2285 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002286 if (options != null) {
2287 data.writeInt(1);
2288 options.writeToParcel(data, 0);
2289 } else {
2290 data.writeInt(0);
2291 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002292 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002293 reply.readException();
2294 int result = reply.readInt();
2295 reply.recycle();
2296 data.recycle();
2297 return result;
2298 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002299 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002300 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002301 Parcel data = Parcel.obtain();
2302 Parcel reply = Parcel.obtain();
2303 data.writeInterfaceToken(IActivityManager.descriptor);
2304 data.writeStrongBinder(callingActivity);
2305 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002306 if (options != null) {
2307 data.writeInt(1);
2308 options.writeToParcel(data, 0);
2309 } else {
2310 data.writeInt(0);
2311 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002312 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2313 reply.readException();
2314 int result = reply.readInt();
2315 reply.recycle();
2316 data.recycle();
2317 return result != 0;
2318 }
2319 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2320 throws RemoteException {
2321 Parcel data = Parcel.obtain();
2322 Parcel reply = Parcel.obtain();
2323 data.writeInterfaceToken(IActivityManager.descriptor);
2324 data.writeStrongBinder(token);
2325 data.writeInt(resultCode);
2326 if (resultData != null) {
2327 data.writeInt(1);
2328 resultData.writeToParcel(data, 0);
2329 } else {
2330 data.writeInt(0);
2331 }
2332 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2333 reply.readException();
2334 boolean res = reply.readInt() != 0;
2335 data.recycle();
2336 reply.recycle();
2337 return res;
2338 }
2339 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2340 {
2341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeStrongBinder(token);
2345 data.writeString(resultWho);
2346 data.writeInt(requestCode);
2347 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2348 reply.readException();
2349 data.recycle();
2350 reply.recycle();
2351 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002352 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2353 Parcel data = Parcel.obtain();
2354 Parcel reply = Parcel.obtain();
2355 data.writeInterfaceToken(IActivityManager.descriptor);
2356 data.writeStrongBinder(token);
2357 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2358 reply.readException();
2359 boolean res = reply.readInt() != 0;
2360 data.recycle();
2361 reply.recycle();
2362 return res;
2363 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002364 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2365 Parcel data = Parcel.obtain();
2366 Parcel reply = Parcel.obtain();
2367 data.writeInterfaceToken(IActivityManager.descriptor);
2368 data.writeStrongBinder(token);
2369 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2370 reply.readException();
2371 boolean res = reply.readInt() != 0;
2372 data.recycle();
2373 reply.recycle();
2374 return res;
2375 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002376 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002377 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002378 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002379 {
2380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002384 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2386 filter.writeToParcel(data, 0);
2387 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002388 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002389 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2390 reply.readException();
2391 Intent intent = null;
2392 int haveIntent = reply.readInt();
2393 if (haveIntent != 0) {
2394 intent = Intent.CREATOR.createFromParcel(reply);
2395 }
2396 reply.recycle();
2397 data.recycle();
2398 return intent;
2399 }
2400 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2401 {
2402 Parcel data = Parcel.obtain();
2403 Parcel reply = Parcel.obtain();
2404 data.writeInterfaceToken(IActivityManager.descriptor);
2405 data.writeStrongBinder(receiver.asBinder());
2406 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2407 reply.readException();
2408 data.recycle();
2409 reply.recycle();
2410 }
2411 public int broadcastIntent(IApplicationThread caller,
2412 Intent intent, String resolvedType, IIntentReceiver resultTo,
2413 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002414 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002415 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 {
2417 Parcel data = Parcel.obtain();
2418 Parcel reply = Parcel.obtain();
2419 data.writeInterfaceToken(IActivityManager.descriptor);
2420 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2421 intent.writeToParcel(data, 0);
2422 data.writeString(resolvedType);
2423 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2424 data.writeInt(resultCode);
2425 data.writeString(resultData);
2426 data.writeBundle(map);
2427 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002428 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002429 data.writeInt(serialized ? 1 : 0);
2430 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002431 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002432 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2433 reply.readException();
2434 int res = reply.readInt();
2435 reply.recycle();
2436 data.recycle();
2437 return res;
2438 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002439 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2440 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441 {
2442 Parcel data = Parcel.obtain();
2443 Parcel reply = Parcel.obtain();
2444 data.writeInterfaceToken(IActivityManager.descriptor);
2445 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2446 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002447 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002448 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 data.recycle();
2451 reply.recycle();
2452 }
2453 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2454 {
2455 Parcel data = Parcel.obtain();
2456 Parcel reply = Parcel.obtain();
2457 data.writeInterfaceToken(IActivityManager.descriptor);
2458 data.writeStrongBinder(who);
2459 data.writeInt(resultCode);
2460 data.writeString(resultData);
2461 data.writeBundle(map);
2462 data.writeInt(abortBroadcast ? 1 : 0);
2463 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2464 reply.readException();
2465 data.recycle();
2466 reply.recycle();
2467 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002468 public void attachApplication(IApplicationThread app) throws RemoteException
2469 {
2470 Parcel data = Parcel.obtain();
2471 Parcel reply = Parcel.obtain();
2472 data.writeInterfaceToken(IActivityManager.descriptor);
2473 data.writeStrongBinder(app.asBinder());
2474 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2475 reply.readException();
2476 data.recycle();
2477 reply.recycle();
2478 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002479 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2480 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002481 {
2482 Parcel data = Parcel.obtain();
2483 Parcel reply = Parcel.obtain();
2484 data.writeInterfaceToken(IActivityManager.descriptor);
2485 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002486 if (config != null) {
2487 data.writeInt(1);
2488 config.writeToParcel(data, 0);
2489 } else {
2490 data.writeInt(0);
2491 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002492 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002493 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2494 reply.readException();
2495 data.recycle();
2496 reply.recycle();
2497 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002498 public void activityResumed(IBinder token) throws RemoteException
2499 {
2500 Parcel data = Parcel.obtain();
2501 Parcel reply = Parcel.obtain();
2502 data.writeInterfaceToken(IActivityManager.descriptor);
2503 data.writeStrongBinder(token);
2504 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2505 reply.readException();
2506 data.recycle();
2507 reply.recycle();
2508 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002509 public void activityPaused(IBinder token) throws RemoteException
2510 {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(token);
2515 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2516 reply.readException();
2517 data.recycle();
2518 reply.recycle();
2519 }
2520 public void activityStopped(IBinder token, Bundle state,
2521 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002522 {
2523 Parcel data = Parcel.obtain();
2524 Parcel reply = Parcel.obtain();
2525 data.writeInterfaceToken(IActivityManager.descriptor);
2526 data.writeStrongBinder(token);
2527 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002528 if (thumbnail != null) {
2529 data.writeInt(1);
2530 thumbnail.writeToParcel(data, 0);
2531 } else {
2532 data.writeInt(0);
2533 }
2534 TextUtils.writeToParcel(description, data, 0);
2535 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2536 reply.readException();
2537 data.recycle();
2538 reply.recycle();
2539 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002540 public void activitySlept(IBinder token) throws RemoteException
2541 {
2542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeStrongBinder(token);
2546 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2547 reply.readException();
2548 data.recycle();
2549 reply.recycle();
2550 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 public void activityDestroyed(IBinder token) throws RemoteException
2552 {
2553 Parcel data = Parcel.obtain();
2554 Parcel reply = Parcel.obtain();
2555 data.writeInterfaceToken(IActivityManager.descriptor);
2556 data.writeStrongBinder(token);
2557 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2558 reply.readException();
2559 data.recycle();
2560 reply.recycle();
2561 }
2562 public String getCallingPackage(IBinder token) throws RemoteException
2563 {
2564 Parcel data = Parcel.obtain();
2565 Parcel reply = Parcel.obtain();
2566 data.writeInterfaceToken(IActivityManager.descriptor);
2567 data.writeStrongBinder(token);
2568 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2569 reply.readException();
2570 String res = reply.readString();
2571 data.recycle();
2572 reply.recycle();
2573 return res;
2574 }
2575 public ComponentName getCallingActivity(IBinder token)
2576 throws RemoteException {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 data.writeStrongBinder(token);
2581 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2582 reply.readException();
2583 ComponentName res = ComponentName.readFromParcel(reply);
2584 data.recycle();
2585 reply.recycle();
2586 return res;
2587 }
2588 public List getTasks(int maxNum, int flags,
2589 IThumbnailReceiver receiver) throws RemoteException {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeInt(maxNum);
2594 data.writeInt(flags);
2595 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2596 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2597 reply.readException();
2598 ArrayList list = null;
2599 int N = reply.readInt();
2600 if (N >= 0) {
2601 list = new ArrayList();
2602 while (N > 0) {
2603 ActivityManager.RunningTaskInfo info =
2604 ActivityManager.RunningTaskInfo.CREATOR
2605 .createFromParcel(reply);
2606 list.add(info);
2607 N--;
2608 }
2609 }
2610 data.recycle();
2611 reply.recycle();
2612 return list;
2613 }
2614 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002615 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 Parcel data = Parcel.obtain();
2617 Parcel reply = Parcel.obtain();
2618 data.writeInterfaceToken(IActivityManager.descriptor);
2619 data.writeInt(maxNum);
2620 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002621 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2623 reply.readException();
2624 ArrayList<ActivityManager.RecentTaskInfo> list
2625 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2626 data.recycle();
2627 reply.recycle();
2628 return list;
2629 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002630 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002635 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002636 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002637 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002638 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002639 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002640 }
2641 data.recycle();
2642 reply.recycle();
2643 return bm;
2644 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002645 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2646 Parcel data = Parcel.obtain();
2647 Parcel reply = Parcel.obtain();
2648 data.writeInterfaceToken(IActivityManager.descriptor);
2649 data.writeInt(id);
2650 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2651 reply.readException();
2652 Bitmap bm = null;
2653 if (reply.readInt() != 0) {
2654 bm = Bitmap.CREATOR.createFromParcel(reply);
2655 }
2656 data.recycle();
2657 reply.recycle();
2658 return bm;
2659 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002660 public List getServices(int maxNum, int flags) throws RemoteException {
2661 Parcel data = Parcel.obtain();
2662 Parcel reply = Parcel.obtain();
2663 data.writeInterfaceToken(IActivityManager.descriptor);
2664 data.writeInt(maxNum);
2665 data.writeInt(flags);
2666 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2667 reply.readException();
2668 ArrayList list = null;
2669 int N = reply.readInt();
2670 if (N >= 0) {
2671 list = new ArrayList();
2672 while (N > 0) {
2673 ActivityManager.RunningServiceInfo info =
2674 ActivityManager.RunningServiceInfo.CREATOR
2675 .createFromParcel(reply);
2676 list.add(info);
2677 N--;
2678 }
2679 }
2680 data.recycle();
2681 reply.recycle();
2682 return list;
2683 }
2684 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2685 throws RemoteException {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2690 reply.readException();
2691 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2692 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2693 data.recycle();
2694 reply.recycle();
2695 return list;
2696 }
2697 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2698 throws RemoteException {
2699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2703 reply.readException();
2704 ArrayList<ActivityManager.RunningAppProcessInfo> list
2705 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2706 data.recycle();
2707 reply.recycle();
2708 return list;
2709 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002710 public List<ApplicationInfo> getRunningExternalApplications()
2711 throws RemoteException {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2716 reply.readException();
2717 ArrayList<ApplicationInfo> list
2718 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2719 data.recycle();
2720 reply.recycle();
2721 return list;
2722 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002723 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002724 {
2725 Parcel data = Parcel.obtain();
2726 Parcel reply = Parcel.obtain();
2727 data.writeInterfaceToken(IActivityManager.descriptor);
2728 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002729 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002730 if (options != null) {
2731 data.writeInt(1);
2732 options.writeToParcel(data, 0);
2733 } else {
2734 data.writeInt(0);
2735 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2737 reply.readException();
2738 data.recycle();
2739 reply.recycle();
2740 }
2741 public void moveTaskToBack(int task) throws RemoteException
2742 {
2743 Parcel data = Parcel.obtain();
2744 Parcel reply = Parcel.obtain();
2745 data.writeInterfaceToken(IActivityManager.descriptor);
2746 data.writeInt(task);
2747 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2748 reply.readException();
2749 data.recycle();
2750 reply.recycle();
2751 }
2752 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2753 throws RemoteException {
2754 Parcel data = Parcel.obtain();
2755 Parcel reply = Parcel.obtain();
2756 data.writeInterfaceToken(IActivityManager.descriptor);
2757 data.writeStrongBinder(token);
2758 data.writeInt(nonRoot ? 1 : 0);
2759 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2760 reply.readException();
2761 boolean res = reply.readInt() != 0;
2762 data.recycle();
2763 reply.recycle();
2764 return res;
2765 }
2766 public void moveTaskBackwards(int task) throws RemoteException
2767 {
2768 Parcel data = Parcel.obtain();
2769 Parcel reply = Parcel.obtain();
2770 data.writeInterfaceToken(IActivityManager.descriptor);
2771 data.writeInt(task);
2772 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 data.recycle();
2775 reply.recycle();
2776 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002777 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002778 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2779 {
2780 Parcel data = Parcel.obtain();
2781 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002782 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002783 data.writeInt(taskId);
2784 data.writeInt(stackId);
2785 data.writeInt(toTop ? 1 : 0);
2786 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2787 reply.readException();
2788 data.recycle();
2789 reply.recycle();
2790 }
2791 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002792 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002793 {
2794 Parcel data = Parcel.obtain();
2795 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002796 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002797 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002798 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002799 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002800 reply.readException();
2801 data.recycle();
2802 reply.recycle();
2803 }
Craig Mautner967212c2013-04-13 21:10:58 -07002804 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002805 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002806 {
2807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002810 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002811 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002812 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002813 data.recycle();
2814 reply.recycle();
2815 return list;
2816 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002817 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002818 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002819 {
2820 Parcel data = Parcel.obtain();
2821 Parcel reply = Parcel.obtain();
2822 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002823 data.writeInt(stackId);
2824 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002825 reply.readException();
2826 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002827 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002828 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002829 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002830 }
2831 data.recycle();
2832 reply.recycle();
2833 return info;
2834 }
2835 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002836 public void setFocusedStack(int stackId) throws RemoteException
2837 {
2838 Parcel data = Parcel.obtain();
2839 Parcel reply = Parcel.obtain();
2840 data.writeInterfaceToken(IActivityManager.descriptor);
2841 data.writeInt(stackId);
2842 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2843 reply.readException();
2844 data.recycle();
2845 reply.recycle();
2846 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002847 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2848 {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeStrongBinder(token);
2853 data.writeInt(onlyRoot ? 1 : 0);
2854 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2855 reply.readException();
2856 int res = reply.readInt();
2857 data.recycle();
2858 reply.recycle();
2859 return res;
2860 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002861 public void reportThumbnail(IBinder token,
2862 Bitmap thumbnail, CharSequence description) throws RemoteException
2863 {
2864 Parcel data = Parcel.obtain();
2865 Parcel reply = Parcel.obtain();
2866 data.writeInterfaceToken(IActivityManager.descriptor);
2867 data.writeStrongBinder(token);
2868 if (thumbnail != null) {
2869 data.writeInt(1);
2870 thumbnail.writeToParcel(data, 0);
2871 } else {
2872 data.writeInt(0);
2873 }
2874 TextUtils.writeToParcel(description, data, 0);
2875 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2876 reply.readException();
2877 data.recycle();
2878 reply.recycle();
2879 }
2880 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002881 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002882 Parcel data = Parcel.obtain();
2883 Parcel reply = Parcel.obtain();
2884 data.writeInterfaceToken(IActivityManager.descriptor);
2885 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2886 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002887 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002888 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002889 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2890 reply.readException();
2891 int res = reply.readInt();
2892 ContentProviderHolder cph = null;
2893 if (res != 0) {
2894 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2895 }
2896 data.recycle();
2897 reply.recycle();
2898 return cph;
2899 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002900 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2901 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002906 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002907 data.writeStrongBinder(token);
2908 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2909 reply.readException();
2910 int res = reply.readInt();
2911 ContentProviderHolder cph = null;
2912 if (res != 0) {
2913 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2914 }
2915 data.recycle();
2916 reply.recycle();
2917 return cph;
2918 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002919 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002920 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002921 {
2922 Parcel data = Parcel.obtain();
2923 Parcel reply = Parcel.obtain();
2924 data.writeInterfaceToken(IActivityManager.descriptor);
2925 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2926 data.writeTypedList(providers);
2927 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2928 reply.readException();
2929 data.recycle();
2930 reply.recycle();
2931 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002932 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2933 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002934 Parcel data = Parcel.obtain();
2935 Parcel reply = Parcel.obtain();
2936 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002937 data.writeStrongBinder(connection);
2938 data.writeInt(stable);
2939 data.writeInt(unstable);
2940 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2941 reply.readException();
2942 boolean res = reply.readInt() != 0;
2943 data.recycle();
2944 reply.recycle();
2945 return res;
2946 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002947
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002948 public void unstableProviderDied(IBinder connection) throws RemoteException {
2949 Parcel data = Parcel.obtain();
2950 Parcel reply = Parcel.obtain();
2951 data.writeInterfaceToken(IActivityManager.descriptor);
2952 data.writeStrongBinder(connection);
2953 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2954 reply.readException();
2955 data.recycle();
2956 reply.recycle();
2957 }
2958
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002959 @Override
2960 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
2961 Parcel data = Parcel.obtain();
2962 Parcel reply = Parcel.obtain();
2963 data.writeInterfaceToken(IActivityManager.descriptor);
2964 data.writeStrongBinder(connection);
2965 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
2966 reply.readException();
2967 data.recycle();
2968 reply.recycle();
2969 }
2970
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002971 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2972 Parcel data = Parcel.obtain();
2973 Parcel reply = Parcel.obtain();
2974 data.writeInterfaceToken(IActivityManager.descriptor);
2975 data.writeStrongBinder(connection);
2976 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002977 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2978 reply.readException();
2979 data.recycle();
2980 reply.recycle();
2981 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002982
2983 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2984 Parcel data = Parcel.obtain();
2985 Parcel reply = Parcel.obtain();
2986 data.writeInterfaceToken(IActivityManager.descriptor);
2987 data.writeString(name);
2988 data.writeStrongBinder(token);
2989 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 data.recycle();
2992 reply.recycle();
2993 }
2994
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002995 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2996 throws RemoteException
2997 {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 service.writeToParcel(data, 0);
3002 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3005 data.recycle();
3006 reply.recycle();
3007 return res;
3008 }
3009
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003010 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003011 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003012 {
3013 Parcel data = Parcel.obtain();
3014 Parcel reply = Parcel.obtain();
3015 data.writeInterfaceToken(IActivityManager.descriptor);
3016 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3017 service.writeToParcel(data, 0);
3018 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003019 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3021 reply.readException();
3022 ComponentName res = ComponentName.readFromParcel(reply);
3023 data.recycle();
3024 reply.recycle();
3025 return res;
3026 }
3027 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003028 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003029 {
3030 Parcel data = Parcel.obtain();
3031 Parcel reply = Parcel.obtain();
3032 data.writeInterfaceToken(IActivityManager.descriptor);
3033 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3034 service.writeToParcel(data, 0);
3035 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003036 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003037 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3038 reply.readException();
3039 int res = reply.readInt();
3040 reply.recycle();
3041 data.recycle();
3042 return res;
3043 }
3044 public boolean stopServiceToken(ComponentName className, IBinder token,
3045 int startId) throws RemoteException {
3046 Parcel data = Parcel.obtain();
3047 Parcel reply = Parcel.obtain();
3048 data.writeInterfaceToken(IActivityManager.descriptor);
3049 ComponentName.writeToParcel(className, data);
3050 data.writeStrongBinder(token);
3051 data.writeInt(startId);
3052 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 boolean res = reply.readInt() != 0;
3055 data.recycle();
3056 reply.recycle();
3057 return res;
3058 }
3059 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003060 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 ComponentName.writeToParcel(className, data);
3065 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003066 data.writeInt(id);
3067 if (notification != null) {
3068 data.writeInt(1);
3069 notification.writeToParcel(data, 0);
3070 } else {
3071 data.writeInt(0);
3072 }
3073 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 data.recycle();
3077 reply.recycle();
3078 }
3079 public int bindService(IApplicationThread caller, IBinder token,
3080 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003081 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003082 Parcel data = Parcel.obtain();
3083 Parcel reply = Parcel.obtain();
3084 data.writeInterfaceToken(IActivityManager.descriptor);
3085 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3086 data.writeStrongBinder(token);
3087 service.writeToParcel(data, 0);
3088 data.writeString(resolvedType);
3089 data.writeStrongBinder(connection.asBinder());
3090 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003091 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3093 reply.readException();
3094 int res = reply.readInt();
3095 data.recycle();
3096 reply.recycle();
3097 return res;
3098 }
3099 public boolean unbindService(IServiceConnection connection) throws RemoteException
3100 {
3101 Parcel data = Parcel.obtain();
3102 Parcel reply = Parcel.obtain();
3103 data.writeInterfaceToken(IActivityManager.descriptor);
3104 data.writeStrongBinder(connection.asBinder());
3105 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3106 reply.readException();
3107 boolean res = reply.readInt() != 0;
3108 data.recycle();
3109 reply.recycle();
3110 return res;
3111 }
3112
3113 public void publishService(IBinder token,
3114 Intent intent, IBinder service) throws RemoteException {
3115 Parcel data = Parcel.obtain();
3116 Parcel reply = Parcel.obtain();
3117 data.writeInterfaceToken(IActivityManager.descriptor);
3118 data.writeStrongBinder(token);
3119 intent.writeToParcel(data, 0);
3120 data.writeStrongBinder(service);
3121 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3122 reply.readException();
3123 data.recycle();
3124 reply.recycle();
3125 }
3126
3127 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3128 throws RemoteException {
3129 Parcel data = Parcel.obtain();
3130 Parcel reply = Parcel.obtain();
3131 data.writeInterfaceToken(IActivityManager.descriptor);
3132 data.writeStrongBinder(token);
3133 intent.writeToParcel(data, 0);
3134 data.writeInt(doRebind ? 1 : 0);
3135 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3136 reply.readException();
3137 data.recycle();
3138 reply.recycle();
3139 }
3140
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003141 public void serviceDoneExecuting(IBinder token, int type, int startId,
3142 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003143 Parcel data = Parcel.obtain();
3144 Parcel reply = Parcel.obtain();
3145 data.writeInterfaceToken(IActivityManager.descriptor);
3146 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003147 data.writeInt(type);
3148 data.writeInt(startId);
3149 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003150 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3151 reply.readException();
3152 data.recycle();
3153 reply.recycle();
3154 }
3155
3156 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3157 Parcel data = Parcel.obtain();
3158 Parcel reply = Parcel.obtain();
3159 data.writeInterfaceToken(IActivityManager.descriptor);
3160 service.writeToParcel(data, 0);
3161 data.writeString(resolvedType);
3162 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3163 reply.readException();
3164 IBinder binder = reply.readStrongBinder();
3165 reply.recycle();
3166 data.recycle();
3167 return binder;
3168 }
3169
Christopher Tate181fafa2009-05-14 11:12:14 -07003170 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3171 throws RemoteException {
3172 Parcel data = Parcel.obtain();
3173 Parcel reply = Parcel.obtain();
3174 data.writeInterfaceToken(IActivityManager.descriptor);
3175 app.writeToParcel(data, 0);
3176 data.writeInt(backupRestoreMode);
3177 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 boolean success = reply.readInt() != 0;
3180 reply.recycle();
3181 data.recycle();
3182 return success;
3183 }
3184
Christopher Tate346acb12012-10-15 19:20:25 -07003185 public void clearPendingBackup() throws RemoteException {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3190 reply.recycle();
3191 data.recycle();
3192 }
3193
Christopher Tate181fafa2009-05-14 11:12:14 -07003194 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3195 Parcel data = Parcel.obtain();
3196 Parcel reply = Parcel.obtain();
3197 data.writeInterfaceToken(IActivityManager.descriptor);
3198 data.writeString(packageName);
3199 data.writeStrongBinder(agent);
3200 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3201 reply.recycle();
3202 data.recycle();
3203 }
3204
3205 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3206 Parcel data = Parcel.obtain();
3207 Parcel reply = Parcel.obtain();
3208 data.writeInterfaceToken(IActivityManager.descriptor);
3209 app.writeToParcel(data, 0);
3210 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3211 reply.readException();
3212 reply.recycle();
3213 data.recycle();
3214 }
3215
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003217 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3218 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003219 Parcel data = Parcel.obtain();
3220 Parcel reply = Parcel.obtain();
3221 data.writeInterfaceToken(IActivityManager.descriptor);
3222 ComponentName.writeToParcel(className, data);
3223 data.writeString(profileFile);
3224 data.writeInt(flags);
3225 data.writeBundle(arguments);
3226 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003227 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003228 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3230 reply.readException();
3231 boolean res = reply.readInt() != 0;
3232 reply.recycle();
3233 data.recycle();
3234 return res;
3235 }
3236
3237 public void finishInstrumentation(IApplicationThread target,
3238 int resultCode, Bundle results) throws RemoteException {
3239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 data.writeStrongBinder(target != null ? target.asBinder() : null);
3243 data.writeInt(resultCode);
3244 data.writeBundle(results);
3245 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3246 reply.readException();
3247 data.recycle();
3248 reply.recycle();
3249 }
3250 public Configuration getConfiguration() throws RemoteException
3251 {
3252 Parcel data = Parcel.obtain();
3253 Parcel reply = Parcel.obtain();
3254 data.writeInterfaceToken(IActivityManager.descriptor);
3255 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3256 reply.readException();
3257 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3258 reply.recycle();
3259 data.recycle();
3260 return res;
3261 }
3262 public void updateConfiguration(Configuration values) throws RemoteException
3263 {
3264 Parcel data = Parcel.obtain();
3265 Parcel reply = Parcel.obtain();
3266 data.writeInterfaceToken(IActivityManager.descriptor);
3267 values.writeToParcel(data, 0);
3268 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 data.recycle();
3271 reply.recycle();
3272 }
3273 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3274 throws RemoteException {
3275 Parcel data = Parcel.obtain();
3276 Parcel reply = Parcel.obtain();
3277 data.writeInterfaceToken(IActivityManager.descriptor);
3278 data.writeStrongBinder(token);
3279 data.writeInt(requestedOrientation);
3280 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3281 reply.readException();
3282 data.recycle();
3283 reply.recycle();
3284 }
3285 public int getRequestedOrientation(IBinder token) throws RemoteException {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
3289 data.writeStrongBinder(token);
3290 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 int res = reply.readInt();
3293 data.recycle();
3294 reply.recycle();
3295 return res;
3296 }
3297 public ComponentName getActivityClassForToken(IBinder token)
3298 throws RemoteException {
3299 Parcel data = Parcel.obtain();
3300 Parcel reply = Parcel.obtain();
3301 data.writeInterfaceToken(IActivityManager.descriptor);
3302 data.writeStrongBinder(token);
3303 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3304 reply.readException();
3305 ComponentName res = ComponentName.readFromParcel(reply);
3306 data.recycle();
3307 reply.recycle();
3308 return res;
3309 }
3310 public String getPackageForToken(IBinder token) throws RemoteException
3311 {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 data.writeStrongBinder(token);
3316 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3317 reply.readException();
3318 String res = reply.readString();
3319 data.recycle();
3320 reply.recycle();
3321 return res;
3322 }
3323 public IIntentSender getIntentSender(int type,
3324 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003325 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003326 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 data.writeInt(type);
3331 data.writeString(packageName);
3332 data.writeStrongBinder(token);
3333 data.writeString(resultWho);
3334 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003335 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003336 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003337 data.writeTypedArray(intents, 0);
3338 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 } else {
3340 data.writeInt(0);
3341 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003342 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003343 if (options != null) {
3344 data.writeInt(1);
3345 options.writeToParcel(data, 0);
3346 } else {
3347 data.writeInt(0);
3348 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003349 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 IIntentSender res = IIntentSender.Stub.asInterface(
3353 reply.readStrongBinder());
3354 data.recycle();
3355 reply.recycle();
3356 return res;
3357 }
3358 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 data.writeStrongBinder(sender.asBinder());
3363 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 data.recycle();
3366 reply.recycle();
3367 }
3368 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeStrongBinder(sender.asBinder());
3373 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3374 reply.readException();
3375 String res = reply.readString();
3376 data.recycle();
3377 reply.recycle();
3378 return res;
3379 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003380 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 data.writeStrongBinder(sender.asBinder());
3385 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3386 reply.readException();
3387 int res = reply.readInt();
3388 data.recycle();
3389 reply.recycle();
3390 return res;
3391 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003392 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3393 boolean requireFull, String name, String callerPackage) throws RemoteException {
3394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 data.writeInt(callingPid);
3398 data.writeInt(callingUid);
3399 data.writeInt(userId);
3400 data.writeInt(allowAll ? 1 : 0);
3401 data.writeInt(requireFull ? 1 : 0);
3402 data.writeString(name);
3403 data.writeString(callerPackage);
3404 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3405 reply.readException();
3406 int res = reply.readInt();
3407 data.recycle();
3408 reply.recycle();
3409 return res;
3410 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003411 public void setProcessLimit(int max) throws RemoteException
3412 {
3413 Parcel data = Parcel.obtain();
3414 Parcel reply = Parcel.obtain();
3415 data.writeInterfaceToken(IActivityManager.descriptor);
3416 data.writeInt(max);
3417 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3418 reply.readException();
3419 data.recycle();
3420 reply.recycle();
3421 }
3422 public int getProcessLimit() throws RemoteException
3423 {
3424 Parcel data = Parcel.obtain();
3425 Parcel reply = Parcel.obtain();
3426 data.writeInterfaceToken(IActivityManager.descriptor);
3427 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3428 reply.readException();
3429 int res = reply.readInt();
3430 data.recycle();
3431 reply.recycle();
3432 return res;
3433 }
3434 public void setProcessForeground(IBinder token, int pid,
3435 boolean isForeground) throws RemoteException {
3436 Parcel data = Parcel.obtain();
3437 Parcel reply = Parcel.obtain();
3438 data.writeInterfaceToken(IActivityManager.descriptor);
3439 data.writeStrongBinder(token);
3440 data.writeInt(pid);
3441 data.writeInt(isForeground ? 1 : 0);
3442 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3443 reply.readException();
3444 data.recycle();
3445 reply.recycle();
3446 }
3447 public int checkPermission(String permission, int pid, int uid)
3448 throws RemoteException {
3449 Parcel data = Parcel.obtain();
3450 Parcel reply = Parcel.obtain();
3451 data.writeInterfaceToken(IActivityManager.descriptor);
3452 data.writeString(permission);
3453 data.writeInt(pid);
3454 data.writeInt(uid);
3455 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3456 reply.readException();
3457 int res = reply.readInt();
3458 data.recycle();
3459 reply.recycle();
3460 return res;
3461 }
3462 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003463 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003468 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003469 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003470 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 boolean res = reply.readInt() != 0;
3473 data.recycle();
3474 reply.recycle();
3475 return res;
3476 }
3477 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3478 throws RemoteException {
3479 Parcel data = Parcel.obtain();
3480 Parcel reply = Parcel.obtain();
3481 data.writeInterfaceToken(IActivityManager.descriptor);
3482 uri.writeToParcel(data, 0);
3483 data.writeInt(pid);
3484 data.writeInt(uid);
3485 data.writeInt(mode);
3486 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3487 reply.readException();
3488 int res = reply.readInt();
3489 data.recycle();
3490 reply.recycle();
3491 return res;
3492 }
3493 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3494 Uri uri, int mode) throws RemoteException {
3495 Parcel data = Parcel.obtain();
3496 Parcel reply = Parcel.obtain();
3497 data.writeInterfaceToken(IActivityManager.descriptor);
3498 data.writeStrongBinder(caller.asBinder());
3499 data.writeString(targetPkg);
3500 uri.writeToParcel(data, 0);
3501 data.writeInt(mode);
3502 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3503 reply.readException();
3504 data.recycle();
3505 reply.recycle();
3506 }
3507 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3508 int mode) throws RemoteException {
3509 Parcel data = Parcel.obtain();
3510 Parcel reply = Parcel.obtain();
3511 data.writeInterfaceToken(IActivityManager.descriptor);
3512 data.writeStrongBinder(caller.asBinder());
3513 uri.writeToParcel(data, 0);
3514 data.writeInt(mode);
3515 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3516 reply.readException();
3517 data.recycle();
3518 reply.recycle();
3519 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003520
3521 @Override
3522 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3523 Parcel data = Parcel.obtain();
3524 Parcel reply = Parcel.obtain();
3525 data.writeInterfaceToken(IActivityManager.descriptor);
3526 uri.writeToParcel(data, 0);
3527 data.writeInt(mode);
3528 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3529 reply.readException();
3530 data.recycle();
3531 reply.recycle();
3532 }
3533
3534 @Override
3535 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3536 Parcel data = Parcel.obtain();
3537 Parcel reply = Parcel.obtain();
3538 data.writeInterfaceToken(IActivityManager.descriptor);
3539 uri.writeToParcel(data, 0);
3540 data.writeInt(mode);
3541 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3542 reply.readException();
3543 data.recycle();
3544 reply.recycle();
3545 }
3546
3547 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003548 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3549 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003550 Parcel data = Parcel.obtain();
3551 Parcel reply = Parcel.obtain();
3552 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003553 data.writeString(packageName);
3554 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003555 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3556 reply.readException();
3557 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3558 reply);
3559 data.recycle();
3560 reply.recycle();
3561 return perms;
3562 }
3563
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003564 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3565 throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeStrongBinder(who.asBinder());
3570 data.writeInt(waiting ? 1 : 0);
3571 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 data.recycle();
3574 reply.recycle();
3575 }
3576 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3577 Parcel data = Parcel.obtain();
3578 Parcel reply = Parcel.obtain();
3579 data.writeInterfaceToken(IActivityManager.descriptor);
3580 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3581 reply.readException();
3582 outInfo.readFromParcel(reply);
3583 data.recycle();
3584 reply.recycle();
3585 }
3586 public void unhandledBack() throws RemoteException
3587 {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 data.recycle();
3594 reply.recycle();
3595 }
3596 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3597 {
3598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3602 reply.readException();
3603 ParcelFileDescriptor pfd = null;
3604 if (reply.readInt() != 0) {
3605 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3606 }
3607 data.recycle();
3608 reply.recycle();
3609 return pfd;
3610 }
3611 public void goingToSleep() throws RemoteException
3612 {
3613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3617 reply.readException();
3618 data.recycle();
3619 reply.recycle();
3620 }
3621 public void wakingUp() throws RemoteException
3622 {
3623 Parcel data = Parcel.obtain();
3624 Parcel reply = Parcel.obtain();
3625 data.writeInterfaceToken(IActivityManager.descriptor);
3626 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3627 reply.readException();
3628 data.recycle();
3629 reply.recycle();
3630 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003631 public void setLockScreenShown(boolean shown) throws RemoteException
3632 {
3633 Parcel data = Parcel.obtain();
3634 Parcel reply = Parcel.obtain();
3635 data.writeInterfaceToken(IActivityManager.descriptor);
3636 data.writeInt(shown ? 1 : 0);
3637 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3638 reply.readException();
3639 data.recycle();
3640 reply.recycle();
3641 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003642 public void setDebugApp(
3643 String packageName, boolean waitForDebugger, boolean persistent)
3644 throws RemoteException
3645 {
3646 Parcel data = Parcel.obtain();
3647 Parcel reply = Parcel.obtain();
3648 data.writeInterfaceToken(IActivityManager.descriptor);
3649 data.writeString(packageName);
3650 data.writeInt(waitForDebugger ? 1 : 0);
3651 data.writeInt(persistent ? 1 : 0);
3652 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3653 reply.readException();
3654 data.recycle();
3655 reply.recycle();
3656 }
3657 public void setAlwaysFinish(boolean enabled) throws RemoteException
3658 {
3659 Parcel data = Parcel.obtain();
3660 Parcel reply = Parcel.obtain();
3661 data.writeInterfaceToken(IActivityManager.descriptor);
3662 data.writeInt(enabled ? 1 : 0);
3663 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3664 reply.readException();
3665 data.recycle();
3666 reply.recycle();
3667 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003668 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003669 {
3670 Parcel data = Parcel.obtain();
3671 Parcel reply = Parcel.obtain();
3672 data.writeInterfaceToken(IActivityManager.descriptor);
3673 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003674 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003675 reply.readException();
3676 data.recycle();
3677 reply.recycle();
3678 }
3679 public void enterSafeMode() throws RemoteException {
3680 Parcel data = Parcel.obtain();
3681 data.writeInterfaceToken(IActivityManager.descriptor);
3682 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3683 data.recycle();
3684 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003685 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3686 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003688 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003689 data.writeStrongBinder(sender.asBinder());
3690 data.writeInt(sourceUid);
3691 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3693 data.recycle();
3694 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003695 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003696 Parcel data = Parcel.obtain();
3697 Parcel reply = Parcel.obtain();
3698 data.writeInterfaceToken(IActivityManager.descriptor);
3699 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003700 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003701 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003702 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003703 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003704 boolean res = reply.readInt() != 0;
3705 data.recycle();
3706 reply.recycle();
3707 return res;
3708 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003709 @Override
3710 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3711 Parcel data = Parcel.obtain();
3712 Parcel reply = Parcel.obtain();
3713 data.writeInterfaceToken(IActivityManager.descriptor);
3714 data.writeString(reason);
3715 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3716 boolean res = reply.readInt() != 0;
3717 data.recycle();
3718 reply.recycle();
3719 return res;
3720 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003721 public void startRunning(String pkg, String cls, String action,
3722 String indata) throws RemoteException {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeString(pkg);
3727 data.writeString(cls);
3728 data.writeString(action);
3729 data.writeString(indata);
3730 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3731 reply.readException();
3732 data.recycle();
3733 reply.recycle();
3734 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 public boolean testIsSystemReady()
3736 {
3737 /* this base class version is never called */
3738 return true;
3739 }
Dan Egnor60d87622009-12-16 16:32:58 -08003740 public void handleApplicationCrash(IBinder app,
3741 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3742 {
3743 Parcel data = Parcel.obtain();
3744 Parcel reply = Parcel.obtain();
3745 data.writeInterfaceToken(IActivityManager.descriptor);
3746 data.writeStrongBinder(app);
3747 crashInfo.writeToParcel(data, 0);
3748 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3749 reply.readException();
3750 reply.recycle();
3751 data.recycle();
3752 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003753
Dan Egnor60d87622009-12-16 16:32:58 -08003754 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003755 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003756 {
3757 Parcel data = Parcel.obtain();
3758 Parcel reply = Parcel.obtain();
3759 data.writeInterfaceToken(IActivityManager.descriptor);
3760 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003761 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003762 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003763 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003764 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003765 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003766 reply.recycle();
3767 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003768 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003769 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003770
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003771 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003772 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003773 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003774 {
3775 Parcel data = Parcel.obtain();
3776 Parcel reply = Parcel.obtain();
3777 data.writeInterfaceToken(IActivityManager.descriptor);
3778 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003779 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003780 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003781 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 reply.recycle();
3784 data.recycle();
3785 }
3786
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003787 public void signalPersistentProcesses(int sig) throws RemoteException {
3788 Parcel data = Parcel.obtain();
3789 Parcel reply = Parcel.obtain();
3790 data.writeInterfaceToken(IActivityManager.descriptor);
3791 data.writeInt(sig);
3792 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3793 reply.readException();
3794 data.recycle();
3795 reply.recycle();
3796 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003797
Dianne Hackborn1676c852012-09-10 14:52:30 -07003798 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003799 Parcel data = Parcel.obtain();
3800 Parcel reply = Parcel.obtain();
3801 data.writeInterfaceToken(IActivityManager.descriptor);
3802 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003803 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003804 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 data.recycle();
3807 reply.recycle();
3808 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003809
3810 public void killAllBackgroundProcesses() throws RemoteException {
3811 Parcel data = Parcel.obtain();
3812 Parcel reply = Parcel.obtain();
3813 data.writeInterfaceToken(IActivityManager.descriptor);
3814 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3815 reply.readException();
3816 data.recycle();
3817 reply.recycle();
3818 }
3819
Dianne Hackborn1676c852012-09-10 14:52:30 -07003820 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003825 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003826 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003827 reply.readException();
3828 data.recycle();
3829 reply.recycle();
3830 }
3831
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003832 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3833 throws RemoteException
3834 {
3835 Parcel data = Parcel.obtain();
3836 Parcel reply = Parcel.obtain();
3837 data.writeInterfaceToken(IActivityManager.descriptor);
3838 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3839 reply.readException();
3840 outInfo.readFromParcel(reply);
3841 reply.recycle();
3842 data.recycle();
3843 }
3844
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003845 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3846 {
3847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3853 reply.recycle();
3854 data.recycle();
3855 return res;
3856 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003857
Dianne Hackborn1676c852012-09-10 14:52:30 -07003858 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003859 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003860 {
3861 Parcel data = Parcel.obtain();
3862 Parcel reply = Parcel.obtain();
3863 data.writeInterfaceToken(IActivityManager.descriptor);
3864 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003865 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003866 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003867 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003868 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003869 if (fd != null) {
3870 data.writeInt(1);
3871 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3872 } else {
3873 data.writeInt(0);
3874 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003875 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3876 reply.readException();
3877 boolean res = reply.readInt() != 0;
3878 reply.recycle();
3879 data.recycle();
3880 return res;
3881 }
3882
Dianne Hackborn55280a92009-05-07 15:53:46 -07003883 public boolean shutdown(int timeout) throws RemoteException
3884 {
3885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 data.writeInt(timeout);
3889 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3890 reply.readException();
3891 boolean res = reply.readInt() != 0;
3892 reply.recycle();
3893 data.recycle();
3894 return res;
3895 }
3896
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003897 public void stopAppSwitches() throws RemoteException {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3902 reply.readException();
3903 reply.recycle();
3904 data.recycle();
3905 }
3906
3907 public void resumeAppSwitches() throws RemoteException {
3908 Parcel data = Parcel.obtain();
3909 Parcel reply = Parcel.obtain();
3910 data.writeInterfaceToken(IActivityManager.descriptor);
3911 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 reply.recycle();
3914 data.recycle();
3915 }
3916
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003917 public void killApplicationWithAppId(String pkg, int appid, String reason)
3918 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003923 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003924 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003925 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003926 reply.readException();
3927 data.recycle();
3928 reply.recycle();
3929 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003930
3931 public void closeSystemDialogs(String reason) throws RemoteException {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeString(reason);
3936 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3937 reply.readException();
3938 data.recycle();
3939 reply.recycle();
3940 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003941
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003942 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003943 throws RemoteException {
3944 Parcel data = Parcel.obtain();
3945 Parcel reply = Parcel.obtain();
3946 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003947 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003948 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3949 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003950 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003951 data.recycle();
3952 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003953 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003954 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003955
3956 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3957 Parcel data = Parcel.obtain();
3958 Parcel reply = Parcel.obtain();
3959 data.writeInterfaceToken(IActivityManager.descriptor);
3960 data.writeString(processName);
3961 data.writeInt(uid);
3962 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3963 reply.readException();
3964 data.recycle();
3965 reply.recycle();
3966 }
3967
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003968 public void overridePendingTransition(IBinder token, String packageName,
3969 int enterAnim, int exitAnim) throws RemoteException {
3970 Parcel data = Parcel.obtain();
3971 Parcel reply = Parcel.obtain();
3972 data.writeInterfaceToken(IActivityManager.descriptor);
3973 data.writeStrongBinder(token);
3974 data.writeString(packageName);
3975 data.writeInt(enterAnim);
3976 data.writeInt(exitAnim);
3977 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3978 reply.readException();
3979 data.recycle();
3980 reply.recycle();
3981 }
3982
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003983 public boolean isUserAMonkey() throws RemoteException {
3984 Parcel data = Parcel.obtain();
3985 Parcel reply = Parcel.obtain();
3986 data.writeInterfaceToken(IActivityManager.descriptor);
3987 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3988 reply.readException();
3989 boolean res = reply.readInt() != 0;
3990 data.recycle();
3991 reply.recycle();
3992 return res;
3993 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003994
3995 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3996 Parcel data = Parcel.obtain();
3997 Parcel reply = Parcel.obtain();
3998 data.writeInterfaceToken(IActivityManager.descriptor);
3999 data.writeInt(monkey ? 1 : 0);
4000 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4001 reply.readException();
4002 data.recycle();
4003 reply.recycle();
4004 }
4005
Dianne Hackborn860755f2010-06-03 18:47:52 -07004006 public void finishHeavyWeightApp() throws RemoteException {
4007 Parcel data = Parcel.obtain();
4008 Parcel reply = Parcel.obtain();
4009 data.writeInterfaceToken(IActivityManager.descriptor);
4010 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4011 reply.readException();
4012 data.recycle();
4013 reply.recycle();
4014 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004015
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004016 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004017 throws RemoteException {
4018 Parcel data = Parcel.obtain();
4019 Parcel reply = Parcel.obtain();
4020 data.writeInterfaceToken(IActivityManager.descriptor);
4021 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004022 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4023 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004024 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004025 data.recycle();
4026 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004027 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004028 }
4029
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004030 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004031 throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeStrongBinder(token);
4036 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004037 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004038 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004039 data.recycle();
4040 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004041 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004042 }
4043
Daniel Sandler69a48172010-06-23 16:29:36 -04004044 public void setImmersive(IBinder token, boolean immersive)
4045 throws RemoteException {
4046 Parcel data = Parcel.obtain();
4047 Parcel reply = Parcel.obtain();
4048 data.writeInterfaceToken(IActivityManager.descriptor);
4049 data.writeStrongBinder(token);
4050 data.writeInt(immersive ? 1 : 0);
4051 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4052 reply.readException();
4053 data.recycle();
4054 reply.recycle();
4055 }
4056
4057 public boolean isImmersive(IBinder token)
4058 throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 data.writeStrongBinder(token);
4063 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004064 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004065 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004066 data.recycle();
4067 reply.recycle();
4068 return res;
4069 }
4070
4071 public boolean isTopActivityImmersive()
4072 throws RemoteException {
4073 Parcel data = Parcel.obtain();
4074 Parcel reply = Parcel.obtain();
4075 data.writeInterfaceToken(IActivityManager.descriptor);
4076 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004077 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004078 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004079 data.recycle();
4080 reply.recycle();
4081 return res;
4082 }
4083
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004084 public void crashApplication(int uid, int initialPid, String packageName,
4085 String message) throws RemoteException {
4086 Parcel data = Parcel.obtain();
4087 Parcel reply = Parcel.obtain();
4088 data.writeInterfaceToken(IActivityManager.descriptor);
4089 data.writeInt(uid);
4090 data.writeInt(initialPid);
4091 data.writeString(packageName);
4092 data.writeString(message);
4093 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4094 reply.readException();
4095 data.recycle();
4096 reply.recycle();
4097 }
Andy McFadden824c5102010-07-09 16:26:57 -07004098
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004099 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
4103 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004104 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004105 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4106 reply.readException();
4107 String res = reply.readString();
4108 data.recycle();
4109 reply.recycle();
4110 return res;
4111 }
4112
Dianne Hackborn7e269642010-08-25 19:50:20 -07004113 public IBinder newUriPermissionOwner(String name)
4114 throws RemoteException {
4115 Parcel data = Parcel.obtain();
4116 Parcel reply = Parcel.obtain();
4117 data.writeInterfaceToken(IActivityManager.descriptor);
4118 data.writeString(name);
4119 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4120 reply.readException();
4121 IBinder res = reply.readStrongBinder();
4122 data.recycle();
4123 reply.recycle();
4124 return res;
4125 }
4126
4127 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4128 Uri uri, int mode) throws RemoteException {
4129 Parcel data = Parcel.obtain();
4130 Parcel reply = Parcel.obtain();
4131 data.writeInterfaceToken(IActivityManager.descriptor);
4132 data.writeStrongBinder(owner);
4133 data.writeInt(fromUid);
4134 data.writeString(targetPkg);
4135 uri.writeToParcel(data, 0);
4136 data.writeInt(mode);
4137 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 data.recycle();
4140 reply.recycle();
4141 }
4142
4143 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4144 int mode) throws RemoteException {
4145 Parcel data = Parcel.obtain();
4146 Parcel reply = Parcel.obtain();
4147 data.writeInterfaceToken(IActivityManager.descriptor);
4148 data.writeStrongBinder(owner);
4149 if (uri != null) {
4150 data.writeInt(1);
4151 uri.writeToParcel(data, 0);
4152 } else {
4153 data.writeInt(0);
4154 }
4155 data.writeInt(mode);
4156 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4157 reply.readException();
4158 data.recycle();
4159 reply.recycle();
4160 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004161
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004162 public int checkGrantUriPermission(int callingUid, String targetPkg,
4163 Uri uri, int modeFlags) throws RemoteException {
4164 Parcel data = Parcel.obtain();
4165 Parcel reply = Parcel.obtain();
4166 data.writeInterfaceToken(IActivityManager.descriptor);
4167 data.writeInt(callingUid);
4168 data.writeString(targetPkg);
4169 uri.writeToParcel(data, 0);
4170 data.writeInt(modeFlags);
4171 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4172 reply.readException();
4173 int res = reply.readInt();
4174 data.recycle();
4175 reply.recycle();
4176 return res;
4177 }
4178
Dianne Hackborn1676c852012-09-10 14:52:30 -07004179 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004180 String path, ParcelFileDescriptor fd) throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004185 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004186 data.writeInt(managed ? 1 : 0);
4187 data.writeString(path);
4188 if (fd != null) {
4189 data.writeInt(1);
4190 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4191 } else {
4192 data.writeInt(0);
4193 }
4194 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4195 reply.readException();
4196 boolean res = reply.readInt() != 0;
4197 reply.recycle();
4198 data.recycle();
4199 return res;
4200 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004201
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004202 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004203 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004204 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004205 Parcel data = Parcel.obtain();
4206 Parcel reply = Parcel.obtain();
4207 data.writeInterfaceToken(IActivityManager.descriptor);
4208 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004209 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004210 data.writeTypedArray(intents, 0);
4211 data.writeStringArray(resolvedTypes);
4212 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004213 if (options != null) {
4214 data.writeInt(1);
4215 options.writeToParcel(data, 0);
4216 } else {
4217 data.writeInt(0);
4218 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004219 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004220 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4221 reply.readException();
4222 int result = reply.readInt();
4223 reply.recycle();
4224 data.recycle();
4225 return result;
4226 }
4227
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004228 public int getFrontActivityScreenCompatMode() throws RemoteException {
4229 Parcel data = Parcel.obtain();
4230 Parcel reply = Parcel.obtain();
4231 data.writeInterfaceToken(IActivityManager.descriptor);
4232 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4233 reply.readException();
4234 int mode = reply.readInt();
4235 reply.recycle();
4236 data.recycle();
4237 return mode;
4238 }
4239
4240 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4241 Parcel data = Parcel.obtain();
4242 Parcel reply = Parcel.obtain();
4243 data.writeInterfaceToken(IActivityManager.descriptor);
4244 data.writeInt(mode);
4245 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4246 reply.readException();
4247 reply.recycle();
4248 data.recycle();
4249 }
4250
4251 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4252 Parcel data = Parcel.obtain();
4253 Parcel reply = Parcel.obtain();
4254 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004255 data.writeString(packageName);
4256 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004257 reply.readException();
4258 int mode = reply.readInt();
4259 reply.recycle();
4260 data.recycle();
4261 return mode;
4262 }
4263
4264 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004265 throws RemoteException {
4266 Parcel data = Parcel.obtain();
4267 Parcel reply = Parcel.obtain();
4268 data.writeInterfaceToken(IActivityManager.descriptor);
4269 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004270 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004271 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4272 reply.readException();
4273 reply.recycle();
4274 data.recycle();
4275 }
4276
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004277 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4278 Parcel data = Parcel.obtain();
4279 Parcel reply = Parcel.obtain();
4280 data.writeInterfaceToken(IActivityManager.descriptor);
4281 data.writeString(packageName);
4282 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 boolean ask = reply.readInt() != 0;
4285 reply.recycle();
4286 data.recycle();
4287 return ask;
4288 }
4289
4290 public void setPackageAskScreenCompat(String packageName, boolean ask)
4291 throws RemoteException {
4292 Parcel data = Parcel.obtain();
4293 Parcel reply = Parcel.obtain();
4294 data.writeInterfaceToken(IActivityManager.descriptor);
4295 data.writeString(packageName);
4296 data.writeInt(ask ? 1 : 0);
4297 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4298 reply.readException();
4299 reply.recycle();
4300 data.recycle();
4301 }
4302
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004303 public boolean switchUser(int userid) throws RemoteException {
4304 Parcel data = Parcel.obtain();
4305 Parcel reply = Parcel.obtain();
4306 data.writeInterfaceToken(IActivityManager.descriptor);
4307 data.writeInt(userid);
4308 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4309 reply.readException();
4310 boolean result = reply.readInt() != 0;
4311 reply.recycle();
4312 data.recycle();
4313 return result;
4314 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004315
Kenny Guy08488bf2014-02-21 17:40:37 +00004316 public boolean startUserInBackground(int userid) throws RemoteException {
4317 Parcel data = Parcel.obtain();
4318 Parcel reply = Parcel.obtain();
4319 data.writeInterfaceToken(IActivityManager.descriptor);
4320 data.writeInt(userid);
4321 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4322 reply.readException();
4323 boolean result = reply.readInt() != 0;
4324 reply.recycle();
4325 data.recycle();
4326 return result;
4327 }
4328
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004329 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4330 Parcel data = Parcel.obtain();
4331 Parcel reply = Parcel.obtain();
4332 data.writeInterfaceToken(IActivityManager.descriptor);
4333 data.writeInt(userid);
4334 data.writeStrongInterface(callback);
4335 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4336 reply.readException();
4337 int result = reply.readInt();
4338 reply.recycle();
4339 data.recycle();
4340 return result;
4341 }
4342
Amith Yamasani52f1d752012-03-28 18:19:29 -07004343 public UserInfo getCurrentUser() throws RemoteException {
4344 Parcel data = Parcel.obtain();
4345 Parcel reply = Parcel.obtain();
4346 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004347 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004348 reply.readException();
4349 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4350 reply.recycle();
4351 data.recycle();
4352 return userInfo;
4353 }
4354
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004355 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004356 Parcel data = Parcel.obtain();
4357 Parcel reply = Parcel.obtain();
4358 data.writeInterfaceToken(IActivityManager.descriptor);
4359 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004360 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004361 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 boolean result = reply.readInt() != 0;
4364 reply.recycle();
4365 data.recycle();
4366 return result;
4367 }
4368
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004369 public int[] getRunningUserIds() throws RemoteException {
4370 Parcel data = Parcel.obtain();
4371 Parcel reply = Parcel.obtain();
4372 data.writeInterfaceToken(IActivityManager.descriptor);
4373 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4374 reply.readException();
4375 int[] result = reply.createIntArray();
4376 reply.recycle();
4377 data.recycle();
4378 return result;
4379 }
4380
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004381 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4382 Parcel data = Parcel.obtain();
4383 Parcel reply = Parcel.obtain();
4384 data.writeInterfaceToken(IActivityManager.descriptor);
4385 data.writeInt(taskId);
4386 data.writeInt(subTaskIndex);
4387 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4388 reply.readException();
4389 boolean result = reply.readInt() != 0;
4390 reply.recycle();
4391 data.recycle();
4392 return result;
4393 }
4394
4395 public boolean removeTask(int taskId, int flags) throws RemoteException {
4396 Parcel data = Parcel.obtain();
4397 Parcel reply = Parcel.obtain();
4398 data.writeInterfaceToken(IActivityManager.descriptor);
4399 data.writeInt(taskId);
4400 data.writeInt(flags);
4401 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4402 reply.readException();
4403 boolean result = reply.readInt() != 0;
4404 reply.recycle();
4405 data.recycle();
4406 return result;
4407 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004408
Jeff Sharkeya4620792011-05-20 15:29:23 -07004409 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4410 Parcel data = Parcel.obtain();
4411 Parcel reply = Parcel.obtain();
4412 data.writeInterfaceToken(IActivityManager.descriptor);
4413 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4414 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4415 reply.readException();
4416 data.recycle();
4417 reply.recycle();
4418 }
4419
4420 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4421 Parcel data = Parcel.obtain();
4422 Parcel reply = Parcel.obtain();
4423 data.writeInterfaceToken(IActivityManager.descriptor);
4424 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4425 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4426 reply.readException();
4427 data.recycle();
4428 reply.recycle();
4429 }
4430
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004431 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4432 Parcel data = Parcel.obtain();
4433 Parcel reply = Parcel.obtain();
4434 data.writeInterfaceToken(IActivityManager.descriptor);
4435 data.writeStrongBinder(sender.asBinder());
4436 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4437 reply.readException();
4438 boolean res = reply.readInt() != 0;
4439 data.recycle();
4440 reply.recycle();
4441 return res;
4442 }
4443
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004444 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4445 Parcel data = Parcel.obtain();
4446 Parcel reply = Parcel.obtain();
4447 data.writeInterfaceToken(IActivityManager.descriptor);
4448 data.writeStrongBinder(sender.asBinder());
4449 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4450 reply.readException();
4451 boolean res = reply.readInt() != 0;
4452 data.recycle();
4453 reply.recycle();
4454 return res;
4455 }
4456
Dianne Hackborn81038902012-11-26 17:04:09 -08004457 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4458 Parcel data = Parcel.obtain();
4459 Parcel reply = Parcel.obtain();
4460 data.writeInterfaceToken(IActivityManager.descriptor);
4461 data.writeStrongBinder(sender.asBinder());
4462 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4463 reply.readException();
4464 Intent res = reply.readInt() != 0
4465 ? Intent.CREATOR.createFromParcel(reply) : null;
4466 data.recycle();
4467 reply.recycle();
4468 return res;
4469 }
4470
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004471 public String getTagForIntentSender(IIntentSender sender, String prefix)
4472 throws RemoteException {
4473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
4476 data.writeStrongBinder(sender.asBinder());
4477 data.writeString(prefix);
4478 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4479 reply.readException();
4480 String res = reply.readString();
4481 data.recycle();
4482 reply.recycle();
4483 return res;
4484 }
4485
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004486 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4487 {
4488 Parcel data = Parcel.obtain();
4489 Parcel reply = Parcel.obtain();
4490 data.writeInterfaceToken(IActivityManager.descriptor);
4491 values.writeToParcel(data, 0);
4492 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4493 reply.readException();
4494 data.recycle();
4495 reply.recycle();
4496 }
4497
Dianne Hackbornb437e092011-08-05 17:50:29 -07004498 public long[] getProcessPss(int[] pids) throws RemoteException {
4499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 data.writeIntArray(pids);
4503 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4504 reply.readException();
4505 long[] res = reply.createLongArray();
4506 data.recycle();
4507 reply.recycle();
4508 return res;
4509 }
4510
Dianne Hackborn661cd522011-08-22 00:26:20 -07004511 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4512 Parcel data = Parcel.obtain();
4513 Parcel reply = Parcel.obtain();
4514 data.writeInterfaceToken(IActivityManager.descriptor);
4515 TextUtils.writeToParcel(msg, data, 0);
4516 data.writeInt(always ? 1 : 0);
4517 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4518 reply.readException();
4519 data.recycle();
4520 reply.recycle();
4521 }
4522
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004523 public void dismissKeyguardOnNextActivity() throws RemoteException {
4524 Parcel data = Parcel.obtain();
4525 Parcel reply = Parcel.obtain();
4526 data.writeInterfaceToken(IActivityManager.descriptor);
4527 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4528 reply.readException();
4529 data.recycle();
4530 reply.recycle();
4531 }
4532
Adam Powelldd8fab22012-03-22 17:47:27 -07004533 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4534 throws RemoteException {
4535 Parcel data = Parcel.obtain();
4536 Parcel reply = Parcel.obtain();
4537 data.writeInterfaceToken(IActivityManager.descriptor);
4538 data.writeStrongBinder(token);
4539 data.writeString(destAffinity);
4540 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4541 reply.readException();
4542 boolean result = reply.readInt() != 0;
4543 data.recycle();
4544 reply.recycle();
4545 return result;
4546 }
4547
4548 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4549 throws RemoteException {
4550 Parcel data = Parcel.obtain();
4551 Parcel reply = Parcel.obtain();
4552 data.writeInterfaceToken(IActivityManager.descriptor);
4553 data.writeStrongBinder(token);
4554 target.writeToParcel(data, 0);
4555 data.writeInt(resultCode);
4556 if (resultData != null) {
4557 data.writeInt(1);
4558 resultData.writeToParcel(data, 0);
4559 } else {
4560 data.writeInt(0);
4561 }
4562 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4563 reply.readException();
4564 boolean result = reply.readInt() != 0;
4565 data.recycle();
4566 reply.recycle();
4567 return result;
4568 }
4569
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004570 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4571 Parcel data = Parcel.obtain();
4572 Parcel reply = Parcel.obtain();
4573 data.writeInterfaceToken(IActivityManager.descriptor);
4574 data.writeStrongBinder(activityToken);
4575 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4576 reply.readException();
4577 int result = reply.readInt();
4578 data.recycle();
4579 reply.recycle();
4580 return result;
4581 }
4582
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004583 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 data.writeStrongBinder(activityToken);
4588 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4589 reply.readException();
4590 String result = reply.readString();
4591 data.recycle();
4592 reply.recycle();
4593 return result;
4594 }
4595
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004596 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4597 Parcel data = Parcel.obtain();
4598 Parcel reply = Parcel.obtain();
4599 data.writeInterfaceToken(IActivityManager.descriptor);
4600 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4601 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4602 reply.readException();
4603 data.recycle();
4604 reply.recycle();
4605 }
4606
4607 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4612 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4613 reply.readException();
4614 data.recycle();
4615 reply.recycle();
4616 }
4617
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004618 public void requestBugReport() throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4623 reply.readException();
4624 data.recycle();
4625 reply.recycle();
4626 }
4627
Jeff Brownbd181bb2013-09-10 16:44:24 -07004628 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4629 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004630 Parcel data = Parcel.obtain();
4631 Parcel reply = Parcel.obtain();
4632 data.writeInterfaceToken(IActivityManager.descriptor);
4633 data.writeInt(pid);
4634 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004635 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004636 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4637 reply.readException();
4638 long res = reply.readInt();
4639 data.recycle();
4640 reply.recycle();
4641 return res;
4642 }
4643
Adam Skorydfc7fd72013-08-05 19:23:41 -07004644 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004645 Parcel data = Parcel.obtain();
4646 Parcel reply = Parcel.obtain();
4647 data.writeInterfaceToken(IActivityManager.descriptor);
4648 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004649 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004650 reply.readException();
4651 Bundle res = reply.readBundle();
4652 data.recycle();
4653 reply.recycle();
4654 return res;
4655 }
4656
Adam Skory7140a252013-09-11 12:04:58 +01004657 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004658 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004659 Parcel data = Parcel.obtain();
4660 Parcel reply = Parcel.obtain();
4661 data.writeInterfaceToken(IActivityManager.descriptor);
4662 data.writeStrongBinder(token);
4663 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004664 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004665 reply.readException();
4666 data.recycle();
4667 reply.recycle();
4668 }
4669
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004670 public void killUid(int uid, String reason) throws RemoteException {
4671 Parcel data = Parcel.obtain();
4672 Parcel reply = Parcel.obtain();
4673 data.writeInterfaceToken(IActivityManager.descriptor);
4674 data.writeInt(uid);
4675 data.writeString(reason);
4676 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4677 reply.readException();
4678 data.recycle();
4679 reply.recycle();
4680 }
4681
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004682 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4683 Parcel data = Parcel.obtain();
4684 Parcel reply = Parcel.obtain();
4685 data.writeInterfaceToken(IActivityManager.descriptor);
4686 data.writeStrongBinder(who);
4687 data.writeInt(allowRestart ? 1 : 0);
4688 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4689 reply.readException();
4690 data.recycle();
4691 reply.recycle();
4692 }
4693
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004694 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4695 Parcel data = Parcel.obtain();
4696 Parcel reply = Parcel.obtain();
4697 data.writeInterfaceToken(IActivityManager.descriptor);
4698 data.writeStrongBinder(token);
4699 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4700 reply.readException();
4701 data.recycle();
4702 reply.recycle();
4703 }
4704
Craig Mautner5eda9b32013-07-02 11:58:16 -07004705 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 data.writeStrongBinder(token);
4710 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
4715
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004716 public void restart() throws RemoteException {
4717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4721 reply.readException();
4722 data.recycle();
4723 reply.recycle();
4724 }
4725
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004726 public void performIdleMaintenance() throws RemoteException {
4727 Parcel data = Parcel.obtain();
4728 Parcel reply = Parcel.obtain();
4729 data.writeInterfaceToken(IActivityManager.descriptor);
4730 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4731 reply.readException();
4732 data.recycle();
4733 reply.recycle();
4734 }
4735
Craig Mautner4a1cb222013-12-04 16:14:06 -08004736 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4737 IActivityContainerCallback callback) throws RemoteException {
4738 Parcel data = Parcel.obtain();
4739 Parcel reply = Parcel.obtain();
4740 data.writeInterfaceToken(IActivityManager.descriptor);
4741 data.writeStrongBinder(parentActivityToken);
4742 data.writeStrongBinder((IBinder)callback);
4743 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4744 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004745 final int result = reply.readInt();
4746 final IActivityContainer res;
4747 if (result == 1) {
4748 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4749 } else {
4750 res = null;
4751 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004752 data.recycle();
4753 reply.recycle();
4754 return res;
4755 }
4756
Craig Mautner95da1082014-02-24 17:54:35 -08004757 public void deleteActivityContainer(IActivityContainer activityContainer)
4758 throws RemoteException {
4759 Parcel data = Parcel.obtain();
4760 Parcel reply = Parcel.obtain();
4761 data.writeInterfaceToken(IActivityManager.descriptor);
4762 data.writeStrongBinder(activityContainer.asBinder());
4763 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4764 reply.readException();
4765 data.recycle();
4766 reply.recycle();
4767 }
4768
Craig Mautnere0a38842013-12-16 16:14:02 -08004769 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4770 throws RemoteException {
4771 Parcel data = Parcel.obtain();
4772 Parcel reply = Parcel.obtain();
4773 data.writeInterfaceToken(IActivityManager.descriptor);
4774 data.writeStrongBinder(activityToken);
4775 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4776 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004777 final int result = reply.readInt();
4778 final IActivityContainer res;
4779 if (result == 1) {
4780 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4781 } else {
4782 res = null;
4783 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004784 data.recycle();
4785 reply.recycle();
4786 return res;
4787 }
4788
Craig Mautner4a1cb222013-12-04 16:14:06 -08004789 public IBinder getHomeActivityToken() throws RemoteException {
4790 Parcel data = Parcel.obtain();
4791 Parcel reply = Parcel.obtain();
4792 data.writeInterfaceToken(IActivityManager.descriptor);
4793 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4794 reply.readException();
4795 IBinder res = reply.readStrongBinder();
4796 data.recycle();
4797 reply.recycle();
4798 return res;
4799 }
4800
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004801 private IBinder mRemote;
4802}