blob: ea0ddc1403cb88f1630b27be8d8aa980730d40a7 [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
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001716 case STOP_USER_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 int userid = data.readInt();
1719 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1720 data.readStrongBinder());
1721 int result = stopUser(userid, callback);
1722 reply.writeNoException();
1723 reply.writeInt(result);
1724 return true;
1725 }
1726
Amith Yamasani52f1d752012-03-28 18:19:29 -07001727 case GET_CURRENT_USER_TRANSACTION: {
1728 data.enforceInterface(IActivityManager.descriptor);
1729 UserInfo userInfo = getCurrentUser();
1730 reply.writeNoException();
1731 userInfo.writeToParcel(reply, 0);
1732 return true;
1733 }
1734
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001735 case IS_USER_RUNNING_TRANSACTION: {
1736 data.enforceInterface(IActivityManager.descriptor);
1737 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001738 boolean orStopping = data.readInt() != 0;
1739 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001740 reply.writeNoException();
1741 reply.writeInt(result ? 1 : 0);
1742 return true;
1743 }
1744
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001745 case GET_RUNNING_USER_IDS_TRANSACTION: {
1746 data.enforceInterface(IActivityManager.descriptor);
1747 int[] result = getRunningUserIds();
1748 reply.writeNoException();
1749 reply.writeIntArray(result);
1750 return true;
1751 }
1752
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001753 case REMOVE_SUB_TASK_TRANSACTION:
1754 {
1755 data.enforceInterface(IActivityManager.descriptor);
1756 int taskId = data.readInt();
1757 int subTaskIndex = data.readInt();
1758 boolean result = removeSubTask(taskId, subTaskIndex);
1759 reply.writeNoException();
1760 reply.writeInt(result ? 1 : 0);
1761 return true;
1762 }
1763
1764 case REMOVE_TASK_TRANSACTION:
1765 {
1766 data.enforceInterface(IActivityManager.descriptor);
1767 int taskId = data.readInt();
1768 int fl = data.readInt();
1769 boolean result = removeTask(taskId, fl);
1770 reply.writeNoException();
1771 reply.writeInt(result ? 1 : 0);
1772 return true;
1773 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001774
Jeff Sharkeya4620792011-05-20 15:29:23 -07001775 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1776 data.enforceInterface(IActivityManager.descriptor);
1777 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1778 data.readStrongBinder());
1779 registerProcessObserver(observer);
1780 return true;
1781 }
1782
1783 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1784 data.enforceInterface(IActivityManager.descriptor);
1785 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1786 data.readStrongBinder());
1787 unregisterProcessObserver(observer);
1788 return true;
1789 }
1790
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001791 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1792 {
1793 data.enforceInterface(IActivityManager.descriptor);
1794 String pkg = data.readString();
1795 boolean ask = getPackageAskScreenCompat(pkg);
1796 reply.writeNoException();
1797 reply.writeInt(ask ? 1 : 0);
1798 return true;
1799 }
1800
1801 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1802 {
1803 data.enforceInterface(IActivityManager.descriptor);
1804 String pkg = data.readString();
1805 boolean ask = data.readInt() != 0;
1806 setPackageAskScreenCompat(pkg, ask);
1807 reply.writeNoException();
1808 return true;
1809 }
1810
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001811 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1812 data.enforceInterface(IActivityManager.descriptor);
1813 IIntentSender r = IIntentSender.Stub.asInterface(
1814 data.readStrongBinder());
1815 boolean res = isIntentSenderTargetedToPackage(r);
1816 reply.writeNoException();
1817 reply.writeInt(res ? 1 : 0);
1818 return true;
1819 }
1820
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001821 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1822 data.enforceInterface(IActivityManager.descriptor);
1823 IIntentSender r = IIntentSender.Stub.asInterface(
1824 data.readStrongBinder());
1825 boolean res = isIntentSenderAnActivity(r);
1826 reply.writeNoException();
1827 reply.writeInt(res ? 1 : 0);
1828 return true;
1829 }
1830
Dianne Hackborn81038902012-11-26 17:04:09 -08001831 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1832 data.enforceInterface(IActivityManager.descriptor);
1833 IIntentSender r = IIntentSender.Stub.asInterface(
1834 data.readStrongBinder());
1835 Intent intent = getIntentForIntentSender(r);
1836 reply.writeNoException();
1837 if (intent != null) {
1838 reply.writeInt(1);
1839 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1840 } else {
1841 reply.writeInt(0);
1842 }
1843 return true;
1844 }
1845
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001846 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1847 data.enforceInterface(IActivityManager.descriptor);
1848 IIntentSender r = IIntentSender.Stub.asInterface(
1849 data.readStrongBinder());
1850 String prefix = data.readString();
1851 String tag = getTagForIntentSender(r, prefix);
1852 reply.writeNoException();
1853 reply.writeString(tag);
1854 return true;
1855 }
1856
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001857 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1858 data.enforceInterface(IActivityManager.descriptor);
1859 Configuration config = Configuration.CREATOR.createFromParcel(data);
1860 updatePersistentConfiguration(config);
1861 reply.writeNoException();
1862 return true;
1863 }
1864
Dianne Hackbornb437e092011-08-05 17:50:29 -07001865 case GET_PROCESS_PSS_TRANSACTION: {
1866 data.enforceInterface(IActivityManager.descriptor);
1867 int[] pids = data.createIntArray();
1868 long[] pss = getProcessPss(pids);
1869 reply.writeNoException();
1870 reply.writeLongArray(pss);
1871 return true;
1872 }
1873
Dianne Hackborn661cd522011-08-22 00:26:20 -07001874 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1875 data.enforceInterface(IActivityManager.descriptor);
1876 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1877 boolean always = data.readInt() != 0;
1878 showBootMessage(msg, always);
1879 reply.writeNoException();
1880 return true;
1881 }
1882
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001883 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 dismissKeyguardOnNextActivity();
1886 reply.writeNoException();
1887 return true;
1888 }
1889
Adam Powelldd8fab22012-03-22 17:47:27 -07001890 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 IBinder token = data.readStrongBinder();
1893 String destAffinity = data.readString();
1894 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1895 reply.writeNoException();
1896 reply.writeInt(res ? 1 : 0);
1897 return true;
1898 }
1899
1900 case NAVIGATE_UP_TO_TRANSACTION: {
1901 data.enforceInterface(IActivityManager.descriptor);
1902 IBinder token = data.readStrongBinder();
1903 Intent target = Intent.CREATOR.createFromParcel(data);
1904 int resultCode = data.readInt();
1905 Intent resultData = null;
1906 if (data.readInt() != 0) {
1907 resultData = Intent.CREATOR.createFromParcel(data);
1908 }
1909 boolean res = navigateUpTo(token, target, resultCode, resultData);
1910 reply.writeNoException();
1911 reply.writeInt(res ? 1 : 0);
1912 return true;
1913 }
1914
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001915 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1916 data.enforceInterface(IActivityManager.descriptor);
1917 IBinder token = data.readStrongBinder();
1918 int res = getLaunchedFromUid(token);
1919 reply.writeNoException();
1920 reply.writeInt(res);
1921 return true;
1922 }
1923
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001924 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 IBinder token = data.readStrongBinder();
1927 String res = getLaunchedFromPackage(token);
1928 reply.writeNoException();
1929 reply.writeString(res);
1930 return true;
1931 }
1932
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001933 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1936 data.readStrongBinder());
1937 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001938 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001939 return true;
1940 }
1941
1942 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1945 data.readStrongBinder());
1946 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001947 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001948 return true;
1949 }
1950
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001951 case REQUEST_BUG_REPORT_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001954 reply.writeNoException();
1955 return true;
1956 }
1957
1958 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1959 data.enforceInterface(IActivityManager.descriptor);
1960 int pid = data.readInt();
1961 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001962 String reason = data.readString();
1963 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001964 reply.writeNoException();
1965 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001966 return true;
1967 }
1968
Adam Skorydfc7fd72013-08-05 19:23:41 -07001969 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001970 data.enforceInterface(IActivityManager.descriptor);
1971 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001972 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001973 reply.writeNoException();
1974 reply.writeBundle(res);
1975 return true;
1976 }
1977
Adam Skorydfc7fd72013-08-05 19:23:41 -07001978 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001979 data.enforceInterface(IActivityManager.descriptor);
1980 IBinder token = data.readStrongBinder();
1981 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01001982 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001983 reply.writeNoException();
1984 return true;
1985 }
1986
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001987 case KILL_UID_TRANSACTION: {
1988 data.enforceInterface(IActivityManager.descriptor);
1989 int uid = data.readInt();
1990 String reason = data.readString();
1991 killUid(uid, reason);
1992 reply.writeNoException();
1993 return true;
1994 }
1995
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001996 case HANG_TRANSACTION: {
1997 data.enforceInterface(IActivityManager.descriptor);
1998 IBinder who = data.readStrongBinder();
1999 boolean allowRestart = data.readInt() != 0;
2000 hang(who, allowRestart);
2001 reply.writeNoException();
2002 return true;
2003 }
2004
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002005 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 IBinder token = data.readStrongBinder();
2008 reportActivityFullyDrawn(token);
2009 reply.writeNoException();
2010 return true;
2011 }
2012
Craig Mautner5eda9b32013-07-02 11:58:16 -07002013 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2014 data.enforceInterface(IActivityManager.descriptor);
2015 IBinder token = data.readStrongBinder();
2016 notifyActivityDrawn(token);
2017 reply.writeNoException();
2018 return true;
2019 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002020
2021 case RESTART_TRANSACTION: {
2022 data.enforceInterface(IActivityManager.descriptor);
2023 restart();
2024 reply.writeNoException();
2025 return true;
2026 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002027
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002028 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2029 data.enforceInterface(IActivityManager.descriptor);
2030 performIdleMaintenance();
2031 reply.writeNoException();
2032 return true;
2033 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002034
2035 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2036 data.enforceInterface(IActivityManager.descriptor);
2037 IBinder parentActivityToken = data.readStrongBinder();
2038 IActivityContainerCallback callback =
2039 (IActivityContainerCallback) data.readStrongBinder();
2040 IActivityContainer activityContainer =
2041 createActivityContainer(parentActivityToken, callback);
2042 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002043 if (activityContainer != null) {
2044 reply.writeInt(1);
2045 reply.writeStrongBinder(activityContainer.asBinder());
2046 } else {
2047 reply.writeInt(0);
2048 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002049 return true;
2050 }
2051
Craig Mautner95da1082014-02-24 17:54:35 -08002052 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2053 data.enforceInterface(IActivityManager.descriptor);
2054 IActivityContainer activityContainer =
2055 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2056 deleteActivityContainer(activityContainer);
2057 reply.writeNoException();
2058 return true;
2059 }
2060
Craig Mautnere0a38842013-12-16 16:14:02 -08002061 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 IBinder activityToken = data.readStrongBinder();
2064 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2065 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002066 if (activityContainer != null) {
2067 reply.writeInt(1);
2068 reply.writeStrongBinder(activityContainer.asBinder());
2069 } else {
2070 reply.writeInt(0);
2071 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002072 return true;
2073 }
2074
Craig Mautner4a1cb222013-12-04 16:14:06 -08002075 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2076 data.enforceInterface(IActivityManager.descriptor);
2077 IBinder homeActivityToken = getHomeActivityToken();
2078 reply.writeNoException();
2079 reply.writeStrongBinder(homeActivityToken);
2080 return true;
2081 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002082 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002083
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002084 return super.onTransact(code, data, reply, flags);
2085 }
2086
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002087 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002088 return this;
2089 }
2090
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002091 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2092 protected IActivityManager create() {
2093 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002094 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002095 Log.v("ActivityManager", "default service binder = " + b);
2096 }
2097 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002098 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002099 Log.v("ActivityManager", "default service = " + am);
2100 }
2101 return am;
2102 }
2103 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002104}
2105
2106class ActivityManagerProxy implements IActivityManager
2107{
2108 public ActivityManagerProxy(IBinder remote)
2109 {
2110 mRemote = remote;
2111 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002112
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002113 public IBinder asBinder()
2114 {
2115 return mRemote;
2116 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002117
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002118 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002119 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2120 int startFlags, String profileFile,
2121 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002122 Parcel data = Parcel.obtain();
2123 Parcel reply = Parcel.obtain();
2124 data.writeInterfaceToken(IActivityManager.descriptor);
2125 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002126 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002127 intent.writeToParcel(data, 0);
2128 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002129 data.writeStrongBinder(resultTo);
2130 data.writeString(resultWho);
2131 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002132 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002133 data.writeString(profileFile);
2134 if (profileFd != null) {
2135 data.writeInt(1);
2136 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2137 } else {
2138 data.writeInt(0);
2139 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002140 if (options != null) {
2141 data.writeInt(1);
2142 options.writeToParcel(data, 0);
2143 } else {
2144 data.writeInt(0);
2145 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002146 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2147 reply.readException();
2148 int result = reply.readInt();
2149 reply.recycle();
2150 data.recycle();
2151 return result;
2152 }
Amith Yamasani82644082012-08-03 13:09:11 -07002153
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002154 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002155 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2156 int startFlags, String profileFile,
2157 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2158 Parcel data = Parcel.obtain();
2159 Parcel reply = Parcel.obtain();
2160 data.writeInterfaceToken(IActivityManager.descriptor);
2161 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002162 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002163 intent.writeToParcel(data, 0);
2164 data.writeString(resolvedType);
2165 data.writeStrongBinder(resultTo);
2166 data.writeString(resultWho);
2167 data.writeInt(requestCode);
2168 data.writeInt(startFlags);
2169 data.writeString(profileFile);
2170 if (profileFd != null) {
2171 data.writeInt(1);
2172 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2173 } else {
2174 data.writeInt(0);
2175 }
2176 if (options != null) {
2177 data.writeInt(1);
2178 options.writeToParcel(data, 0);
2179 } else {
2180 data.writeInt(0);
2181 }
2182 data.writeInt(userId);
2183 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2184 reply.readException();
2185 int result = reply.readInt();
2186 reply.recycle();
2187 data.recycle();
2188 return result;
2189 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002190 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2191 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002192 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002193 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002194 Parcel data = Parcel.obtain();
2195 Parcel reply = Parcel.obtain();
2196 data.writeInterfaceToken(IActivityManager.descriptor);
2197 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002198 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002199 intent.writeToParcel(data, 0);
2200 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002201 data.writeStrongBinder(resultTo);
2202 data.writeString(resultWho);
2203 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002204 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002205 data.writeString(profileFile);
2206 if (profileFd != null) {
2207 data.writeInt(1);
2208 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2209 } else {
2210 data.writeInt(0);
2211 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002212 if (options != null) {
2213 data.writeInt(1);
2214 options.writeToParcel(data, 0);
2215 } else {
2216 data.writeInt(0);
2217 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002218 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002219 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2220 reply.readException();
2221 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2222 reply.recycle();
2223 data.recycle();
2224 return result;
2225 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002226 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2227 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002228 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002229 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002230 Parcel data = Parcel.obtain();
2231 Parcel reply = Parcel.obtain();
2232 data.writeInterfaceToken(IActivityManager.descriptor);
2233 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002234 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002235 intent.writeToParcel(data, 0);
2236 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002237 data.writeStrongBinder(resultTo);
2238 data.writeString(resultWho);
2239 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002240 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002241 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002242 if (options != null) {
2243 data.writeInt(1);
2244 options.writeToParcel(data, 0);
2245 } else {
2246 data.writeInt(0);
2247 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002248 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002249 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2250 reply.readException();
2251 int result = reply.readInt();
2252 reply.recycle();
2253 data.recycle();
2254 return result;
2255 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002256 public int startActivityIntentSender(IApplicationThread caller,
2257 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002258 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002259 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002260 Parcel data = Parcel.obtain();
2261 Parcel reply = Parcel.obtain();
2262 data.writeInterfaceToken(IActivityManager.descriptor);
2263 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2264 intent.writeToParcel(data, 0);
2265 if (fillInIntent != null) {
2266 data.writeInt(1);
2267 fillInIntent.writeToParcel(data, 0);
2268 } else {
2269 data.writeInt(0);
2270 }
2271 data.writeString(resolvedType);
2272 data.writeStrongBinder(resultTo);
2273 data.writeString(resultWho);
2274 data.writeInt(requestCode);
2275 data.writeInt(flagsMask);
2276 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002277 if (options != null) {
2278 data.writeInt(1);
2279 options.writeToParcel(data, 0);
2280 } else {
2281 data.writeInt(0);
2282 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002283 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002284 reply.readException();
2285 int result = reply.readInt();
2286 reply.recycle();
2287 data.recycle();
2288 return result;
2289 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002291 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002292 Parcel data = Parcel.obtain();
2293 Parcel reply = Parcel.obtain();
2294 data.writeInterfaceToken(IActivityManager.descriptor);
2295 data.writeStrongBinder(callingActivity);
2296 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002297 if (options != null) {
2298 data.writeInt(1);
2299 options.writeToParcel(data, 0);
2300 } else {
2301 data.writeInt(0);
2302 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002303 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2304 reply.readException();
2305 int result = reply.readInt();
2306 reply.recycle();
2307 data.recycle();
2308 return result != 0;
2309 }
2310 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2311 throws RemoteException {
2312 Parcel data = Parcel.obtain();
2313 Parcel reply = Parcel.obtain();
2314 data.writeInterfaceToken(IActivityManager.descriptor);
2315 data.writeStrongBinder(token);
2316 data.writeInt(resultCode);
2317 if (resultData != null) {
2318 data.writeInt(1);
2319 resultData.writeToParcel(data, 0);
2320 } else {
2321 data.writeInt(0);
2322 }
2323 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2324 reply.readException();
2325 boolean res = reply.readInt() != 0;
2326 data.recycle();
2327 reply.recycle();
2328 return res;
2329 }
2330 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2331 {
2332 Parcel data = Parcel.obtain();
2333 Parcel reply = Parcel.obtain();
2334 data.writeInterfaceToken(IActivityManager.descriptor);
2335 data.writeStrongBinder(token);
2336 data.writeString(resultWho);
2337 data.writeInt(requestCode);
2338 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2339 reply.readException();
2340 data.recycle();
2341 reply.recycle();
2342 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002343 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2344 Parcel data = Parcel.obtain();
2345 Parcel reply = Parcel.obtain();
2346 data.writeInterfaceToken(IActivityManager.descriptor);
2347 data.writeStrongBinder(token);
2348 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2349 reply.readException();
2350 boolean res = reply.readInt() != 0;
2351 data.recycle();
2352 reply.recycle();
2353 return res;
2354 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002355 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2356 Parcel data = Parcel.obtain();
2357 Parcel reply = Parcel.obtain();
2358 data.writeInterfaceToken(IActivityManager.descriptor);
2359 data.writeStrongBinder(token);
2360 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2361 reply.readException();
2362 boolean res = reply.readInt() != 0;
2363 data.recycle();
2364 reply.recycle();
2365 return res;
2366 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002367 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002368 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002369 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002370 {
2371 Parcel data = Parcel.obtain();
2372 Parcel reply = Parcel.obtain();
2373 data.writeInterfaceToken(IActivityManager.descriptor);
2374 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002375 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002376 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2377 filter.writeToParcel(data, 0);
2378 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002379 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002380 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2381 reply.readException();
2382 Intent intent = null;
2383 int haveIntent = reply.readInt();
2384 if (haveIntent != 0) {
2385 intent = Intent.CREATOR.createFromParcel(reply);
2386 }
2387 reply.recycle();
2388 data.recycle();
2389 return intent;
2390 }
2391 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2392 {
2393 Parcel data = Parcel.obtain();
2394 Parcel reply = Parcel.obtain();
2395 data.writeInterfaceToken(IActivityManager.descriptor);
2396 data.writeStrongBinder(receiver.asBinder());
2397 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2398 reply.readException();
2399 data.recycle();
2400 reply.recycle();
2401 }
2402 public int broadcastIntent(IApplicationThread caller,
2403 Intent intent, String resolvedType, IIntentReceiver resultTo,
2404 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002405 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002406 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002407 {
2408 Parcel data = Parcel.obtain();
2409 Parcel reply = Parcel.obtain();
2410 data.writeInterfaceToken(IActivityManager.descriptor);
2411 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2412 intent.writeToParcel(data, 0);
2413 data.writeString(resolvedType);
2414 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2415 data.writeInt(resultCode);
2416 data.writeString(resultData);
2417 data.writeBundle(map);
2418 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002419 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002420 data.writeInt(serialized ? 1 : 0);
2421 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002422 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002423 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2424 reply.readException();
2425 int res = reply.readInt();
2426 reply.recycle();
2427 data.recycle();
2428 return res;
2429 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002430 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2431 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002432 {
2433 Parcel data = Parcel.obtain();
2434 Parcel reply = Parcel.obtain();
2435 data.writeInterfaceToken(IActivityManager.descriptor);
2436 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2437 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002438 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002439 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2440 reply.readException();
2441 data.recycle();
2442 reply.recycle();
2443 }
2444 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2445 {
2446 Parcel data = Parcel.obtain();
2447 Parcel reply = Parcel.obtain();
2448 data.writeInterfaceToken(IActivityManager.descriptor);
2449 data.writeStrongBinder(who);
2450 data.writeInt(resultCode);
2451 data.writeString(resultData);
2452 data.writeBundle(map);
2453 data.writeInt(abortBroadcast ? 1 : 0);
2454 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2455 reply.readException();
2456 data.recycle();
2457 reply.recycle();
2458 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002459 public void attachApplication(IApplicationThread app) throws RemoteException
2460 {
2461 Parcel data = Parcel.obtain();
2462 Parcel reply = Parcel.obtain();
2463 data.writeInterfaceToken(IActivityManager.descriptor);
2464 data.writeStrongBinder(app.asBinder());
2465 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2466 reply.readException();
2467 data.recycle();
2468 reply.recycle();
2469 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002470 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2471 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002472 {
2473 Parcel data = Parcel.obtain();
2474 Parcel reply = Parcel.obtain();
2475 data.writeInterfaceToken(IActivityManager.descriptor);
2476 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002477 if (config != null) {
2478 data.writeInt(1);
2479 config.writeToParcel(data, 0);
2480 } else {
2481 data.writeInt(0);
2482 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002483 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002484 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2485 reply.readException();
2486 data.recycle();
2487 reply.recycle();
2488 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002489 public void activityResumed(IBinder token) throws RemoteException
2490 {
2491 Parcel data = Parcel.obtain();
2492 Parcel reply = Parcel.obtain();
2493 data.writeInterfaceToken(IActivityManager.descriptor);
2494 data.writeStrongBinder(token);
2495 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2496 reply.readException();
2497 data.recycle();
2498 reply.recycle();
2499 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002500 public void activityPaused(IBinder token) throws RemoteException
2501 {
2502 Parcel data = Parcel.obtain();
2503 Parcel reply = Parcel.obtain();
2504 data.writeInterfaceToken(IActivityManager.descriptor);
2505 data.writeStrongBinder(token);
2506 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2507 reply.readException();
2508 data.recycle();
2509 reply.recycle();
2510 }
2511 public void activityStopped(IBinder token, Bundle state,
2512 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002513 {
2514 Parcel data = Parcel.obtain();
2515 Parcel reply = Parcel.obtain();
2516 data.writeInterfaceToken(IActivityManager.descriptor);
2517 data.writeStrongBinder(token);
2518 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002519 if (thumbnail != null) {
2520 data.writeInt(1);
2521 thumbnail.writeToParcel(data, 0);
2522 } else {
2523 data.writeInt(0);
2524 }
2525 TextUtils.writeToParcel(description, data, 0);
2526 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2527 reply.readException();
2528 data.recycle();
2529 reply.recycle();
2530 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002531 public void activitySlept(IBinder token) throws RemoteException
2532 {
2533 Parcel data = Parcel.obtain();
2534 Parcel reply = Parcel.obtain();
2535 data.writeInterfaceToken(IActivityManager.descriptor);
2536 data.writeStrongBinder(token);
2537 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2538 reply.readException();
2539 data.recycle();
2540 reply.recycle();
2541 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002542 public void activityDestroyed(IBinder token) throws RemoteException
2543 {
2544 Parcel data = Parcel.obtain();
2545 Parcel reply = Parcel.obtain();
2546 data.writeInterfaceToken(IActivityManager.descriptor);
2547 data.writeStrongBinder(token);
2548 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2549 reply.readException();
2550 data.recycle();
2551 reply.recycle();
2552 }
2553 public String getCallingPackage(IBinder token) throws RemoteException
2554 {
2555 Parcel data = Parcel.obtain();
2556 Parcel reply = Parcel.obtain();
2557 data.writeInterfaceToken(IActivityManager.descriptor);
2558 data.writeStrongBinder(token);
2559 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2560 reply.readException();
2561 String res = reply.readString();
2562 data.recycle();
2563 reply.recycle();
2564 return res;
2565 }
2566 public ComponentName getCallingActivity(IBinder token)
2567 throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 data.writeStrongBinder(token);
2572 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2573 reply.readException();
2574 ComponentName res = ComponentName.readFromParcel(reply);
2575 data.recycle();
2576 reply.recycle();
2577 return res;
2578 }
2579 public List getTasks(int maxNum, int flags,
2580 IThumbnailReceiver receiver) throws RemoteException {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 data.writeInt(maxNum);
2585 data.writeInt(flags);
2586 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2587 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2588 reply.readException();
2589 ArrayList list = null;
2590 int N = reply.readInt();
2591 if (N >= 0) {
2592 list = new ArrayList();
2593 while (N > 0) {
2594 ActivityManager.RunningTaskInfo info =
2595 ActivityManager.RunningTaskInfo.CREATOR
2596 .createFromParcel(reply);
2597 list.add(info);
2598 N--;
2599 }
2600 }
2601 data.recycle();
2602 reply.recycle();
2603 return list;
2604 }
2605 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002606 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002607 Parcel data = Parcel.obtain();
2608 Parcel reply = Parcel.obtain();
2609 data.writeInterfaceToken(IActivityManager.descriptor);
2610 data.writeInt(maxNum);
2611 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002612 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002613 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2614 reply.readException();
2615 ArrayList<ActivityManager.RecentTaskInfo> list
2616 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2617 data.recycle();
2618 reply.recycle();
2619 return list;
2620 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002621 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002622 Parcel data = Parcel.obtain();
2623 Parcel reply = Parcel.obtain();
2624 data.writeInterfaceToken(IActivityManager.descriptor);
2625 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002626 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002627 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002628 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002629 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002630 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002631 }
2632 data.recycle();
2633 reply.recycle();
2634 return bm;
2635 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002636 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2637 Parcel data = Parcel.obtain();
2638 Parcel reply = Parcel.obtain();
2639 data.writeInterfaceToken(IActivityManager.descriptor);
2640 data.writeInt(id);
2641 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2642 reply.readException();
2643 Bitmap bm = null;
2644 if (reply.readInt() != 0) {
2645 bm = Bitmap.CREATOR.createFromParcel(reply);
2646 }
2647 data.recycle();
2648 reply.recycle();
2649 return bm;
2650 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002651 public List getServices(int maxNum, int flags) throws RemoteException {
2652 Parcel data = Parcel.obtain();
2653 Parcel reply = Parcel.obtain();
2654 data.writeInterfaceToken(IActivityManager.descriptor);
2655 data.writeInt(maxNum);
2656 data.writeInt(flags);
2657 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2658 reply.readException();
2659 ArrayList list = null;
2660 int N = reply.readInt();
2661 if (N >= 0) {
2662 list = new ArrayList();
2663 while (N > 0) {
2664 ActivityManager.RunningServiceInfo info =
2665 ActivityManager.RunningServiceInfo.CREATOR
2666 .createFromParcel(reply);
2667 list.add(info);
2668 N--;
2669 }
2670 }
2671 data.recycle();
2672 reply.recycle();
2673 return list;
2674 }
2675 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2676 throws RemoteException {
2677 Parcel data = Parcel.obtain();
2678 Parcel reply = Parcel.obtain();
2679 data.writeInterfaceToken(IActivityManager.descriptor);
2680 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2683 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2684 data.recycle();
2685 reply.recycle();
2686 return list;
2687 }
2688 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2689 throws RemoteException {
2690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 ArrayList<ActivityManager.RunningAppProcessInfo> list
2696 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2697 data.recycle();
2698 reply.recycle();
2699 return list;
2700 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002701 public List<ApplicationInfo> getRunningExternalApplications()
2702 throws RemoteException {
2703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2707 reply.readException();
2708 ArrayList<ApplicationInfo> list
2709 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2710 data.recycle();
2711 reply.recycle();
2712 return list;
2713 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002714 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002715 {
2716 Parcel data = Parcel.obtain();
2717 Parcel reply = Parcel.obtain();
2718 data.writeInterfaceToken(IActivityManager.descriptor);
2719 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002720 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002721 if (options != null) {
2722 data.writeInt(1);
2723 options.writeToParcel(data, 0);
2724 } else {
2725 data.writeInt(0);
2726 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002727 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2728 reply.readException();
2729 data.recycle();
2730 reply.recycle();
2731 }
2732 public void moveTaskToBack(int task) throws RemoteException
2733 {
2734 Parcel data = Parcel.obtain();
2735 Parcel reply = Parcel.obtain();
2736 data.writeInterfaceToken(IActivityManager.descriptor);
2737 data.writeInt(task);
2738 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2739 reply.readException();
2740 data.recycle();
2741 reply.recycle();
2742 }
2743 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2744 throws RemoteException {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 data.writeStrongBinder(token);
2749 data.writeInt(nonRoot ? 1 : 0);
2750 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2751 reply.readException();
2752 boolean res = reply.readInt() != 0;
2753 data.recycle();
2754 reply.recycle();
2755 return res;
2756 }
2757 public void moveTaskBackwards(int task) throws RemoteException
2758 {
2759 Parcel data = Parcel.obtain();
2760 Parcel reply = Parcel.obtain();
2761 data.writeInterfaceToken(IActivityManager.descriptor);
2762 data.writeInt(task);
2763 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2764 reply.readException();
2765 data.recycle();
2766 reply.recycle();
2767 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002768 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002769 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2770 {
2771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002773 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002774 data.writeInt(taskId);
2775 data.writeInt(stackId);
2776 data.writeInt(toTop ? 1 : 0);
2777 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2778 reply.readException();
2779 data.recycle();
2780 reply.recycle();
2781 }
2782 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002783 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002784 {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002787 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002788 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002789 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002790 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002791 reply.readException();
2792 data.recycle();
2793 reply.recycle();
2794 }
Craig Mautner967212c2013-04-13 21:10:58 -07002795 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002796 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002797 {
2798 Parcel data = Parcel.obtain();
2799 Parcel reply = Parcel.obtain();
2800 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002801 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002802 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002803 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002804 data.recycle();
2805 reply.recycle();
2806 return list;
2807 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002808 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002809 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002810 {
2811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002814 data.writeInt(stackId);
2815 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002816 reply.readException();
2817 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002818 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002819 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002820 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002821 }
2822 data.recycle();
2823 reply.recycle();
2824 return info;
2825 }
2826 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002827 public void setFocusedStack(int stackId) throws RemoteException
2828 {
2829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
2832 data.writeInt(stackId);
2833 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2834 reply.readException();
2835 data.recycle();
2836 reply.recycle();
2837 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002838 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2839 {
2840 Parcel data = Parcel.obtain();
2841 Parcel reply = Parcel.obtain();
2842 data.writeInterfaceToken(IActivityManager.descriptor);
2843 data.writeStrongBinder(token);
2844 data.writeInt(onlyRoot ? 1 : 0);
2845 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2846 reply.readException();
2847 int res = reply.readInt();
2848 data.recycle();
2849 reply.recycle();
2850 return res;
2851 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002852 public void reportThumbnail(IBinder token,
2853 Bitmap thumbnail, CharSequence description) throws RemoteException
2854 {
2855 Parcel data = Parcel.obtain();
2856 Parcel reply = Parcel.obtain();
2857 data.writeInterfaceToken(IActivityManager.descriptor);
2858 data.writeStrongBinder(token);
2859 if (thumbnail != null) {
2860 data.writeInt(1);
2861 thumbnail.writeToParcel(data, 0);
2862 } else {
2863 data.writeInt(0);
2864 }
2865 TextUtils.writeToParcel(description, data, 0);
2866 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2867 reply.readException();
2868 data.recycle();
2869 reply.recycle();
2870 }
2871 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002872 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002873 Parcel data = Parcel.obtain();
2874 Parcel reply = Parcel.obtain();
2875 data.writeInterfaceToken(IActivityManager.descriptor);
2876 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2877 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002878 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002879 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002880 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2881 reply.readException();
2882 int res = reply.readInt();
2883 ContentProviderHolder cph = null;
2884 if (res != 0) {
2885 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2886 }
2887 data.recycle();
2888 reply.recycle();
2889 return cph;
2890 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002891 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2892 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002897 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002898 data.writeStrongBinder(token);
2899 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2900 reply.readException();
2901 int res = reply.readInt();
2902 ContentProviderHolder cph = null;
2903 if (res != 0) {
2904 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2905 }
2906 data.recycle();
2907 reply.recycle();
2908 return cph;
2909 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002910 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002911 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 {
2913 Parcel data = Parcel.obtain();
2914 Parcel reply = Parcel.obtain();
2915 data.writeInterfaceToken(IActivityManager.descriptor);
2916 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2917 data.writeTypedList(providers);
2918 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 data.recycle();
2921 reply.recycle();
2922 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002923 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2924 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002925 Parcel data = Parcel.obtain();
2926 Parcel reply = Parcel.obtain();
2927 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002928 data.writeStrongBinder(connection);
2929 data.writeInt(stable);
2930 data.writeInt(unstable);
2931 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2932 reply.readException();
2933 boolean res = reply.readInt() != 0;
2934 data.recycle();
2935 reply.recycle();
2936 return res;
2937 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002938
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002939 public void unstableProviderDied(IBinder connection) throws RemoteException {
2940 Parcel data = Parcel.obtain();
2941 Parcel reply = Parcel.obtain();
2942 data.writeInterfaceToken(IActivityManager.descriptor);
2943 data.writeStrongBinder(connection);
2944 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2945 reply.readException();
2946 data.recycle();
2947 reply.recycle();
2948 }
2949
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002950 @Override
2951 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
2952 Parcel data = Parcel.obtain();
2953 Parcel reply = Parcel.obtain();
2954 data.writeInterfaceToken(IActivityManager.descriptor);
2955 data.writeStrongBinder(connection);
2956 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
2957 reply.readException();
2958 data.recycle();
2959 reply.recycle();
2960 }
2961
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002962 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2963 Parcel data = Parcel.obtain();
2964 Parcel reply = Parcel.obtain();
2965 data.writeInterfaceToken(IActivityManager.descriptor);
2966 data.writeStrongBinder(connection);
2967 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002968 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2969 reply.readException();
2970 data.recycle();
2971 reply.recycle();
2972 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002973
2974 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeString(name);
2979 data.writeStrongBinder(token);
2980 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 data.recycle();
2983 reply.recycle();
2984 }
2985
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002986 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2987 throws RemoteException
2988 {
2989 Parcel data = Parcel.obtain();
2990 Parcel reply = Parcel.obtain();
2991 data.writeInterfaceToken(IActivityManager.descriptor);
2992 service.writeToParcel(data, 0);
2993 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2996 data.recycle();
2997 reply.recycle();
2998 return res;
2999 }
3000
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003002 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003003 {
3004 Parcel data = Parcel.obtain();
3005 Parcel reply = Parcel.obtain();
3006 data.writeInterfaceToken(IActivityManager.descriptor);
3007 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3008 service.writeToParcel(data, 0);
3009 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003010 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003011 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 ComponentName res = ComponentName.readFromParcel(reply);
3014 data.recycle();
3015 reply.recycle();
3016 return res;
3017 }
3018 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003019 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003020 {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3025 service.writeToParcel(data, 0);
3026 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003027 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003028 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 int res = reply.readInt();
3031 reply.recycle();
3032 data.recycle();
3033 return res;
3034 }
3035 public boolean stopServiceToken(ComponentName className, IBinder token,
3036 int startId) throws RemoteException {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 ComponentName.writeToParcel(className, data);
3041 data.writeStrongBinder(token);
3042 data.writeInt(startId);
3043 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 boolean res = reply.readInt() != 0;
3046 data.recycle();
3047 reply.recycle();
3048 return res;
3049 }
3050 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003051 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 ComponentName.writeToParcel(className, data);
3056 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003057 data.writeInt(id);
3058 if (notification != null) {
3059 data.writeInt(1);
3060 notification.writeToParcel(data, 0);
3061 } else {
3062 data.writeInt(0);
3063 }
3064 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003065 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3066 reply.readException();
3067 data.recycle();
3068 reply.recycle();
3069 }
3070 public int bindService(IApplicationThread caller, IBinder token,
3071 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003072 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 Parcel data = Parcel.obtain();
3074 Parcel reply = Parcel.obtain();
3075 data.writeInterfaceToken(IActivityManager.descriptor);
3076 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3077 data.writeStrongBinder(token);
3078 service.writeToParcel(data, 0);
3079 data.writeString(resolvedType);
3080 data.writeStrongBinder(connection.asBinder());
3081 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003082 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 int res = reply.readInt();
3086 data.recycle();
3087 reply.recycle();
3088 return res;
3089 }
3090 public boolean unbindService(IServiceConnection connection) throws RemoteException
3091 {
3092 Parcel data = Parcel.obtain();
3093 Parcel reply = Parcel.obtain();
3094 data.writeInterfaceToken(IActivityManager.descriptor);
3095 data.writeStrongBinder(connection.asBinder());
3096 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 boolean res = reply.readInt() != 0;
3099 data.recycle();
3100 reply.recycle();
3101 return res;
3102 }
3103
3104 public void publishService(IBinder token,
3105 Intent intent, IBinder service) throws RemoteException {
3106 Parcel data = Parcel.obtain();
3107 Parcel reply = Parcel.obtain();
3108 data.writeInterfaceToken(IActivityManager.descriptor);
3109 data.writeStrongBinder(token);
3110 intent.writeToParcel(data, 0);
3111 data.writeStrongBinder(service);
3112 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3113 reply.readException();
3114 data.recycle();
3115 reply.recycle();
3116 }
3117
3118 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3119 throws RemoteException {
3120 Parcel data = Parcel.obtain();
3121 Parcel reply = Parcel.obtain();
3122 data.writeInterfaceToken(IActivityManager.descriptor);
3123 data.writeStrongBinder(token);
3124 intent.writeToParcel(data, 0);
3125 data.writeInt(doRebind ? 1 : 0);
3126 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3127 reply.readException();
3128 data.recycle();
3129 reply.recycle();
3130 }
3131
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003132 public void serviceDoneExecuting(IBinder token, int type, int startId,
3133 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003134 Parcel data = Parcel.obtain();
3135 Parcel reply = Parcel.obtain();
3136 data.writeInterfaceToken(IActivityManager.descriptor);
3137 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003138 data.writeInt(type);
3139 data.writeInt(startId);
3140 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003141 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3142 reply.readException();
3143 data.recycle();
3144 reply.recycle();
3145 }
3146
3147 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3148 Parcel data = Parcel.obtain();
3149 Parcel reply = Parcel.obtain();
3150 data.writeInterfaceToken(IActivityManager.descriptor);
3151 service.writeToParcel(data, 0);
3152 data.writeString(resolvedType);
3153 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3154 reply.readException();
3155 IBinder binder = reply.readStrongBinder();
3156 reply.recycle();
3157 data.recycle();
3158 return binder;
3159 }
3160
Christopher Tate181fafa2009-05-14 11:12:14 -07003161 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3162 throws RemoteException {
3163 Parcel data = Parcel.obtain();
3164 Parcel reply = Parcel.obtain();
3165 data.writeInterfaceToken(IActivityManager.descriptor);
3166 app.writeToParcel(data, 0);
3167 data.writeInt(backupRestoreMode);
3168 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3169 reply.readException();
3170 boolean success = reply.readInt() != 0;
3171 reply.recycle();
3172 data.recycle();
3173 return success;
3174 }
3175
Christopher Tate346acb12012-10-15 19:20:25 -07003176 public void clearPendingBackup() throws RemoteException {
3177 Parcel data = Parcel.obtain();
3178 Parcel reply = Parcel.obtain();
3179 data.writeInterfaceToken(IActivityManager.descriptor);
3180 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3181 reply.recycle();
3182 data.recycle();
3183 }
3184
Christopher Tate181fafa2009-05-14 11:12:14 -07003185 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3186 Parcel data = Parcel.obtain();
3187 Parcel reply = Parcel.obtain();
3188 data.writeInterfaceToken(IActivityManager.descriptor);
3189 data.writeString(packageName);
3190 data.writeStrongBinder(agent);
3191 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3192 reply.recycle();
3193 data.recycle();
3194 }
3195
3196 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 app.writeToParcel(data, 0);
3201 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3202 reply.readException();
3203 reply.recycle();
3204 data.recycle();
3205 }
3206
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003208 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3209 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 Parcel data = Parcel.obtain();
3211 Parcel reply = Parcel.obtain();
3212 data.writeInterfaceToken(IActivityManager.descriptor);
3213 ComponentName.writeToParcel(className, data);
3214 data.writeString(profileFile);
3215 data.writeInt(flags);
3216 data.writeBundle(arguments);
3217 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003218 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003219 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003220 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3221 reply.readException();
3222 boolean res = reply.readInt() != 0;
3223 reply.recycle();
3224 data.recycle();
3225 return res;
3226 }
3227
3228 public void finishInstrumentation(IApplicationThread target,
3229 int resultCode, Bundle results) throws RemoteException {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 data.writeStrongBinder(target != null ? target.asBinder() : null);
3234 data.writeInt(resultCode);
3235 data.writeBundle(results);
3236 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3237 reply.readException();
3238 data.recycle();
3239 reply.recycle();
3240 }
3241 public Configuration getConfiguration() throws RemoteException
3242 {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3249 reply.recycle();
3250 data.recycle();
3251 return res;
3252 }
3253 public void updateConfiguration(Configuration values) throws RemoteException
3254 {
3255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
3258 values.writeToParcel(data, 0);
3259 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 data.recycle();
3262 reply.recycle();
3263 }
3264 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3265 throws RemoteException {
3266 Parcel data = Parcel.obtain();
3267 Parcel reply = Parcel.obtain();
3268 data.writeInterfaceToken(IActivityManager.descriptor);
3269 data.writeStrongBinder(token);
3270 data.writeInt(requestedOrientation);
3271 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3272 reply.readException();
3273 data.recycle();
3274 reply.recycle();
3275 }
3276 public int getRequestedOrientation(IBinder token) throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeStrongBinder(token);
3281 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3282 reply.readException();
3283 int res = reply.readInt();
3284 data.recycle();
3285 reply.recycle();
3286 return res;
3287 }
3288 public ComponentName getActivityClassForToken(IBinder token)
3289 throws RemoteException {
3290 Parcel data = Parcel.obtain();
3291 Parcel reply = Parcel.obtain();
3292 data.writeInterfaceToken(IActivityManager.descriptor);
3293 data.writeStrongBinder(token);
3294 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3295 reply.readException();
3296 ComponentName res = ComponentName.readFromParcel(reply);
3297 data.recycle();
3298 reply.recycle();
3299 return res;
3300 }
3301 public String getPackageForToken(IBinder token) throws RemoteException
3302 {
3303 Parcel data = Parcel.obtain();
3304 Parcel reply = Parcel.obtain();
3305 data.writeInterfaceToken(IActivityManager.descriptor);
3306 data.writeStrongBinder(token);
3307 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3308 reply.readException();
3309 String res = reply.readString();
3310 data.recycle();
3311 reply.recycle();
3312 return res;
3313 }
3314 public IIntentSender getIntentSender(int type,
3315 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003316 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003317 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 Parcel data = Parcel.obtain();
3319 Parcel reply = Parcel.obtain();
3320 data.writeInterfaceToken(IActivityManager.descriptor);
3321 data.writeInt(type);
3322 data.writeString(packageName);
3323 data.writeStrongBinder(token);
3324 data.writeString(resultWho);
3325 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003326 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003327 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003328 data.writeTypedArray(intents, 0);
3329 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003330 } else {
3331 data.writeInt(0);
3332 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003333 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003334 if (options != null) {
3335 data.writeInt(1);
3336 options.writeToParcel(data, 0);
3337 } else {
3338 data.writeInt(0);
3339 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003340 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003341 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 IIntentSender res = IIntentSender.Stub.asInterface(
3344 reply.readStrongBinder());
3345 data.recycle();
3346 reply.recycle();
3347 return res;
3348 }
3349 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 data.writeStrongBinder(sender.asBinder());
3354 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3355 reply.readException();
3356 data.recycle();
3357 reply.recycle();
3358 }
3359 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 data.writeStrongBinder(sender.asBinder());
3364 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3365 reply.readException();
3366 String res = reply.readString();
3367 data.recycle();
3368 reply.recycle();
3369 return res;
3370 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003371 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 data.writeStrongBinder(sender.asBinder());
3376 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 int res = reply.readInt();
3379 data.recycle();
3380 reply.recycle();
3381 return res;
3382 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003383 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3384 boolean requireFull, String name, String callerPackage) throws RemoteException {
3385 Parcel data = Parcel.obtain();
3386 Parcel reply = Parcel.obtain();
3387 data.writeInterfaceToken(IActivityManager.descriptor);
3388 data.writeInt(callingPid);
3389 data.writeInt(callingUid);
3390 data.writeInt(userId);
3391 data.writeInt(allowAll ? 1 : 0);
3392 data.writeInt(requireFull ? 1 : 0);
3393 data.writeString(name);
3394 data.writeString(callerPackage);
3395 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 int res = reply.readInt();
3398 data.recycle();
3399 reply.recycle();
3400 return res;
3401 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003402 public void setProcessLimit(int max) throws RemoteException
3403 {
3404 Parcel data = Parcel.obtain();
3405 Parcel reply = Parcel.obtain();
3406 data.writeInterfaceToken(IActivityManager.descriptor);
3407 data.writeInt(max);
3408 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3409 reply.readException();
3410 data.recycle();
3411 reply.recycle();
3412 }
3413 public int getProcessLimit() throws RemoteException
3414 {
3415 Parcel data = Parcel.obtain();
3416 Parcel reply = Parcel.obtain();
3417 data.writeInterfaceToken(IActivityManager.descriptor);
3418 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3419 reply.readException();
3420 int res = reply.readInt();
3421 data.recycle();
3422 reply.recycle();
3423 return res;
3424 }
3425 public void setProcessForeground(IBinder token, int pid,
3426 boolean isForeground) throws RemoteException {
3427 Parcel data = Parcel.obtain();
3428 Parcel reply = Parcel.obtain();
3429 data.writeInterfaceToken(IActivityManager.descriptor);
3430 data.writeStrongBinder(token);
3431 data.writeInt(pid);
3432 data.writeInt(isForeground ? 1 : 0);
3433 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 data.recycle();
3436 reply.recycle();
3437 }
3438 public int checkPermission(String permission, int pid, int uid)
3439 throws RemoteException {
3440 Parcel data = Parcel.obtain();
3441 Parcel reply = Parcel.obtain();
3442 data.writeInterfaceToken(IActivityManager.descriptor);
3443 data.writeString(permission);
3444 data.writeInt(pid);
3445 data.writeInt(uid);
3446 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 int res = reply.readInt();
3449 data.recycle();
3450 reply.recycle();
3451 return res;
3452 }
3453 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003454 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003455 Parcel data = Parcel.obtain();
3456 Parcel reply = Parcel.obtain();
3457 data.writeInterfaceToken(IActivityManager.descriptor);
3458 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003459 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003460 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003461 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3462 reply.readException();
3463 boolean res = reply.readInt() != 0;
3464 data.recycle();
3465 reply.recycle();
3466 return res;
3467 }
3468 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3469 throws RemoteException {
3470 Parcel data = Parcel.obtain();
3471 Parcel reply = Parcel.obtain();
3472 data.writeInterfaceToken(IActivityManager.descriptor);
3473 uri.writeToParcel(data, 0);
3474 data.writeInt(pid);
3475 data.writeInt(uid);
3476 data.writeInt(mode);
3477 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3478 reply.readException();
3479 int res = reply.readInt();
3480 data.recycle();
3481 reply.recycle();
3482 return res;
3483 }
3484 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3485 Uri uri, int mode) throws RemoteException {
3486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeStrongBinder(caller.asBinder());
3490 data.writeString(targetPkg);
3491 uri.writeToParcel(data, 0);
3492 data.writeInt(mode);
3493 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 data.recycle();
3496 reply.recycle();
3497 }
3498 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3499 int mode) throws RemoteException {
3500 Parcel data = Parcel.obtain();
3501 Parcel reply = Parcel.obtain();
3502 data.writeInterfaceToken(IActivityManager.descriptor);
3503 data.writeStrongBinder(caller.asBinder());
3504 uri.writeToParcel(data, 0);
3505 data.writeInt(mode);
3506 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 data.recycle();
3509 reply.recycle();
3510 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003511
3512 @Override
3513 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3514 Parcel data = Parcel.obtain();
3515 Parcel reply = Parcel.obtain();
3516 data.writeInterfaceToken(IActivityManager.descriptor);
3517 uri.writeToParcel(data, 0);
3518 data.writeInt(mode);
3519 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 data.recycle();
3522 reply.recycle();
3523 }
3524
3525 @Override
3526 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3527 Parcel data = Parcel.obtain();
3528 Parcel reply = Parcel.obtain();
3529 data.writeInterfaceToken(IActivityManager.descriptor);
3530 uri.writeToParcel(data, 0);
3531 data.writeInt(mode);
3532 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3533 reply.readException();
3534 data.recycle();
3535 reply.recycle();
3536 }
3537
3538 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003539 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3540 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003541 Parcel data = Parcel.obtain();
3542 Parcel reply = Parcel.obtain();
3543 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003544 data.writeString(packageName);
3545 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003546 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3547 reply.readException();
3548 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3549 reply);
3550 data.recycle();
3551 reply.recycle();
3552 return perms;
3553 }
3554
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003555 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3556 throws RemoteException {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
3560 data.writeStrongBinder(who.asBinder());
3561 data.writeInt(waiting ? 1 : 0);
3562 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3563 reply.readException();
3564 data.recycle();
3565 reply.recycle();
3566 }
3567 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3568 Parcel data = Parcel.obtain();
3569 Parcel reply = Parcel.obtain();
3570 data.writeInterfaceToken(IActivityManager.descriptor);
3571 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3572 reply.readException();
3573 outInfo.readFromParcel(reply);
3574 data.recycle();
3575 reply.recycle();
3576 }
3577 public void unhandledBack() throws RemoteException
3578 {
3579 Parcel data = Parcel.obtain();
3580 Parcel reply = Parcel.obtain();
3581 data.writeInterfaceToken(IActivityManager.descriptor);
3582 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3583 reply.readException();
3584 data.recycle();
3585 reply.recycle();
3586 }
3587 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3588 {
3589 Parcel data = Parcel.obtain();
3590 Parcel reply = Parcel.obtain();
3591 data.writeInterfaceToken(IActivityManager.descriptor);
3592 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3593 reply.readException();
3594 ParcelFileDescriptor pfd = null;
3595 if (reply.readInt() != 0) {
3596 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3597 }
3598 data.recycle();
3599 reply.recycle();
3600 return pfd;
3601 }
3602 public void goingToSleep() throws RemoteException
3603 {
3604 Parcel data = Parcel.obtain();
3605 Parcel reply = Parcel.obtain();
3606 data.writeInterfaceToken(IActivityManager.descriptor);
3607 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3608 reply.readException();
3609 data.recycle();
3610 reply.recycle();
3611 }
3612 public void wakingUp() throws RemoteException
3613 {
3614 Parcel data = Parcel.obtain();
3615 Parcel reply = Parcel.obtain();
3616 data.writeInterfaceToken(IActivityManager.descriptor);
3617 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3618 reply.readException();
3619 data.recycle();
3620 reply.recycle();
3621 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003622 public void setLockScreenShown(boolean shown) throws RemoteException
3623 {
3624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 data.writeInt(shown ? 1 : 0);
3628 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3629 reply.readException();
3630 data.recycle();
3631 reply.recycle();
3632 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003633 public void setDebugApp(
3634 String packageName, boolean waitForDebugger, boolean persistent)
3635 throws RemoteException
3636 {
3637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 data.writeString(packageName);
3641 data.writeInt(waitForDebugger ? 1 : 0);
3642 data.writeInt(persistent ? 1 : 0);
3643 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3644 reply.readException();
3645 data.recycle();
3646 reply.recycle();
3647 }
3648 public void setAlwaysFinish(boolean enabled) throws RemoteException
3649 {
3650 Parcel data = Parcel.obtain();
3651 Parcel reply = Parcel.obtain();
3652 data.writeInterfaceToken(IActivityManager.descriptor);
3653 data.writeInt(enabled ? 1 : 0);
3654 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 data.recycle();
3657 reply.recycle();
3658 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003659 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003660 {
3661 Parcel data = Parcel.obtain();
3662 Parcel reply = Parcel.obtain();
3663 data.writeInterfaceToken(IActivityManager.descriptor);
3664 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003665 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003666 reply.readException();
3667 data.recycle();
3668 reply.recycle();
3669 }
3670 public void enterSafeMode() throws RemoteException {
3671 Parcel data = Parcel.obtain();
3672 data.writeInterfaceToken(IActivityManager.descriptor);
3673 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3674 data.recycle();
3675 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003676 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3677 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003678 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003679 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003680 data.writeStrongBinder(sender.asBinder());
3681 data.writeInt(sourceUid);
3682 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003683 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3684 data.recycle();
3685 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003686 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 Parcel data = Parcel.obtain();
3688 Parcel reply = Parcel.obtain();
3689 data.writeInterfaceToken(IActivityManager.descriptor);
3690 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003691 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003692 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003693 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003694 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 boolean res = reply.readInt() != 0;
3696 data.recycle();
3697 reply.recycle();
3698 return res;
3699 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003700 @Override
3701 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3702 Parcel data = Parcel.obtain();
3703 Parcel reply = Parcel.obtain();
3704 data.writeInterfaceToken(IActivityManager.descriptor);
3705 data.writeString(reason);
3706 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3707 boolean res = reply.readInt() != 0;
3708 data.recycle();
3709 reply.recycle();
3710 return res;
3711 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003712 public void startRunning(String pkg, String cls, String action,
3713 String indata) throws RemoteException {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 data.writeString(pkg);
3718 data.writeString(cls);
3719 data.writeString(action);
3720 data.writeString(indata);
3721 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3722 reply.readException();
3723 data.recycle();
3724 reply.recycle();
3725 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003726 public boolean testIsSystemReady()
3727 {
3728 /* this base class version is never called */
3729 return true;
3730 }
Dan Egnor60d87622009-12-16 16:32:58 -08003731 public void handleApplicationCrash(IBinder app,
3732 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3733 {
3734 Parcel data = Parcel.obtain();
3735 Parcel reply = Parcel.obtain();
3736 data.writeInterfaceToken(IActivityManager.descriptor);
3737 data.writeStrongBinder(app);
3738 crashInfo.writeToParcel(data, 0);
3739 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3740 reply.readException();
3741 reply.recycle();
3742 data.recycle();
3743 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003744
Dan Egnor60d87622009-12-16 16:32:58 -08003745 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003746 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003747 {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
3750 data.writeInterfaceToken(IActivityManager.descriptor);
3751 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003752 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003753 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003754 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003755 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003756 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003757 reply.recycle();
3758 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003759 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003760 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003761
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003762 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003763 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003764 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003765 {
3766 Parcel data = Parcel.obtain();
3767 Parcel reply = Parcel.obtain();
3768 data.writeInterfaceToken(IActivityManager.descriptor);
3769 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003770 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003771 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003772 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3773 reply.readException();
3774 reply.recycle();
3775 data.recycle();
3776 }
3777
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003778 public void signalPersistentProcesses(int sig) throws RemoteException {
3779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 data.writeInt(sig);
3783 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 data.recycle();
3786 reply.recycle();
3787 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003788
Dianne Hackborn1676c852012-09-10 14:52:30 -07003789 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003790 Parcel data = Parcel.obtain();
3791 Parcel reply = Parcel.obtain();
3792 data.writeInterfaceToken(IActivityManager.descriptor);
3793 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003794 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003795 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3796 reply.readException();
3797 data.recycle();
3798 reply.recycle();
3799 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003800
3801 public void killAllBackgroundProcesses() throws RemoteException {
3802 Parcel data = Parcel.obtain();
3803 Parcel reply = Parcel.obtain();
3804 data.writeInterfaceToken(IActivityManager.descriptor);
3805 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3806 reply.readException();
3807 data.recycle();
3808 reply.recycle();
3809 }
3810
Dianne Hackborn1676c852012-09-10 14:52:30 -07003811 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003812 Parcel data = Parcel.obtain();
3813 Parcel reply = Parcel.obtain();
3814 data.writeInterfaceToken(IActivityManager.descriptor);
3815 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003816 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003817 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003818 reply.readException();
3819 data.recycle();
3820 reply.recycle();
3821 }
3822
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003823 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3824 throws RemoteException
3825 {
3826 Parcel data = Parcel.obtain();
3827 Parcel reply = Parcel.obtain();
3828 data.writeInterfaceToken(IActivityManager.descriptor);
3829 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3830 reply.readException();
3831 outInfo.readFromParcel(reply);
3832 reply.recycle();
3833 data.recycle();
3834 }
3835
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3837 {
3838 Parcel data = Parcel.obtain();
3839 Parcel reply = Parcel.obtain();
3840 data.writeInterfaceToken(IActivityManager.descriptor);
3841 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3844 reply.recycle();
3845 data.recycle();
3846 return res;
3847 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003848
Dianne Hackborn1676c852012-09-10 14:52:30 -07003849 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003850 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003851 {
3852 Parcel data = Parcel.obtain();
3853 Parcel reply = Parcel.obtain();
3854 data.writeInterfaceToken(IActivityManager.descriptor);
3855 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003856 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003857 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003858 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003859 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003860 if (fd != null) {
3861 data.writeInt(1);
3862 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3863 } else {
3864 data.writeInt(0);
3865 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003866 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3867 reply.readException();
3868 boolean res = reply.readInt() != 0;
3869 reply.recycle();
3870 data.recycle();
3871 return res;
3872 }
3873
Dianne Hackborn55280a92009-05-07 15:53:46 -07003874 public boolean shutdown(int timeout) throws RemoteException
3875 {
3876 Parcel data = Parcel.obtain();
3877 Parcel reply = Parcel.obtain();
3878 data.writeInterfaceToken(IActivityManager.descriptor);
3879 data.writeInt(timeout);
3880 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3881 reply.readException();
3882 boolean res = reply.readInt() != 0;
3883 reply.recycle();
3884 data.recycle();
3885 return res;
3886 }
3887
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003888 public void stopAppSwitches() throws RemoteException {
3889 Parcel data = Parcel.obtain();
3890 Parcel reply = Parcel.obtain();
3891 data.writeInterfaceToken(IActivityManager.descriptor);
3892 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3893 reply.readException();
3894 reply.recycle();
3895 data.recycle();
3896 }
3897
3898 public void resumeAppSwitches() throws RemoteException {
3899 Parcel data = Parcel.obtain();
3900 Parcel reply = Parcel.obtain();
3901 data.writeInterfaceToken(IActivityManager.descriptor);
3902 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 reply.recycle();
3905 data.recycle();
3906 }
3907
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003908 public void killApplicationWithAppId(String pkg, int appid, String reason)
3909 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003910 Parcel data = Parcel.obtain();
3911 Parcel reply = Parcel.obtain();
3912 data.writeInterfaceToken(IActivityManager.descriptor);
3913 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003914 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003915 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003916 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003917 reply.readException();
3918 data.recycle();
3919 reply.recycle();
3920 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003921
3922 public void closeSystemDialogs(String reason) throws RemoteException {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeString(reason);
3927 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3928 reply.readException();
3929 data.recycle();
3930 reply.recycle();
3931 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003932
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003933 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003934 throws RemoteException {
3935 Parcel data = Parcel.obtain();
3936 Parcel reply = Parcel.obtain();
3937 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003938 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003939 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3940 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003941 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003942 data.recycle();
3943 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003944 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003945 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003946
3947 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3948 Parcel data = Parcel.obtain();
3949 Parcel reply = Parcel.obtain();
3950 data.writeInterfaceToken(IActivityManager.descriptor);
3951 data.writeString(processName);
3952 data.writeInt(uid);
3953 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 data.recycle();
3956 reply.recycle();
3957 }
3958
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003959 public void overridePendingTransition(IBinder token, String packageName,
3960 int enterAnim, int exitAnim) throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 data.writeStrongBinder(token);
3965 data.writeString(packageName);
3966 data.writeInt(enterAnim);
3967 data.writeInt(exitAnim);
3968 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 data.recycle();
3971 reply.recycle();
3972 }
3973
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003974 public boolean isUserAMonkey() throws RemoteException {
3975 Parcel data = Parcel.obtain();
3976 Parcel reply = Parcel.obtain();
3977 data.writeInterfaceToken(IActivityManager.descriptor);
3978 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3979 reply.readException();
3980 boolean res = reply.readInt() != 0;
3981 data.recycle();
3982 reply.recycle();
3983 return res;
3984 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003985
3986 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3987 Parcel data = Parcel.obtain();
3988 Parcel reply = Parcel.obtain();
3989 data.writeInterfaceToken(IActivityManager.descriptor);
3990 data.writeInt(monkey ? 1 : 0);
3991 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3992 reply.readException();
3993 data.recycle();
3994 reply.recycle();
3995 }
3996
Dianne Hackborn860755f2010-06-03 18:47:52 -07003997 public void finishHeavyWeightApp() throws RemoteException {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4002 reply.readException();
4003 data.recycle();
4004 reply.recycle();
4005 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004006
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004007 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004008 throws RemoteException {
4009 Parcel data = Parcel.obtain();
4010 Parcel reply = Parcel.obtain();
4011 data.writeInterfaceToken(IActivityManager.descriptor);
4012 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004013 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4014 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004015 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004016 data.recycle();
4017 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004018 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004019 }
4020
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004021 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004022 throws RemoteException {
4023 Parcel data = Parcel.obtain();
4024 Parcel reply = Parcel.obtain();
4025 data.writeInterfaceToken(IActivityManager.descriptor);
4026 data.writeStrongBinder(token);
4027 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004028 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004029 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004030 data.recycle();
4031 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004032 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004033 }
4034
Daniel Sandler69a48172010-06-23 16:29:36 -04004035 public void setImmersive(IBinder token, boolean immersive)
4036 throws RemoteException {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 data.writeStrongBinder(token);
4041 data.writeInt(immersive ? 1 : 0);
4042 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4043 reply.readException();
4044 data.recycle();
4045 reply.recycle();
4046 }
4047
4048 public boolean isImmersive(IBinder token)
4049 throws RemoteException {
4050 Parcel data = Parcel.obtain();
4051 Parcel reply = Parcel.obtain();
4052 data.writeInterfaceToken(IActivityManager.descriptor);
4053 data.writeStrongBinder(token);
4054 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004055 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004056 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004057 data.recycle();
4058 reply.recycle();
4059 return res;
4060 }
4061
4062 public boolean isTopActivityImmersive()
4063 throws RemoteException {
4064 Parcel data = Parcel.obtain();
4065 Parcel reply = Parcel.obtain();
4066 data.writeInterfaceToken(IActivityManager.descriptor);
4067 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004068 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004069 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004070 data.recycle();
4071 reply.recycle();
4072 return res;
4073 }
4074
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004075 public void crashApplication(int uid, int initialPid, String packageName,
4076 String message) throws RemoteException {
4077 Parcel data = Parcel.obtain();
4078 Parcel reply = Parcel.obtain();
4079 data.writeInterfaceToken(IActivityManager.descriptor);
4080 data.writeInt(uid);
4081 data.writeInt(initialPid);
4082 data.writeString(packageName);
4083 data.writeString(message);
4084 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4085 reply.readException();
4086 data.recycle();
4087 reply.recycle();
4088 }
Andy McFadden824c5102010-07-09 16:26:57 -07004089
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004090 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004091 Parcel data = Parcel.obtain();
4092 Parcel reply = Parcel.obtain();
4093 data.writeInterfaceToken(IActivityManager.descriptor);
4094 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004095 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004096 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4097 reply.readException();
4098 String res = reply.readString();
4099 data.recycle();
4100 reply.recycle();
4101 return res;
4102 }
4103
Dianne Hackborn7e269642010-08-25 19:50:20 -07004104 public IBinder newUriPermissionOwner(String name)
4105 throws RemoteException {
4106 Parcel data = Parcel.obtain();
4107 Parcel reply = Parcel.obtain();
4108 data.writeInterfaceToken(IActivityManager.descriptor);
4109 data.writeString(name);
4110 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4111 reply.readException();
4112 IBinder res = reply.readStrongBinder();
4113 data.recycle();
4114 reply.recycle();
4115 return res;
4116 }
4117
4118 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4119 Uri uri, int mode) throws RemoteException {
4120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 data.writeStrongBinder(owner);
4124 data.writeInt(fromUid);
4125 data.writeString(targetPkg);
4126 uri.writeToParcel(data, 0);
4127 data.writeInt(mode);
4128 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4129 reply.readException();
4130 data.recycle();
4131 reply.recycle();
4132 }
4133
4134 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4135 int mode) throws RemoteException {
4136 Parcel data = Parcel.obtain();
4137 Parcel reply = Parcel.obtain();
4138 data.writeInterfaceToken(IActivityManager.descriptor);
4139 data.writeStrongBinder(owner);
4140 if (uri != null) {
4141 data.writeInt(1);
4142 uri.writeToParcel(data, 0);
4143 } else {
4144 data.writeInt(0);
4145 }
4146 data.writeInt(mode);
4147 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4148 reply.readException();
4149 data.recycle();
4150 reply.recycle();
4151 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004152
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004153 public int checkGrantUriPermission(int callingUid, String targetPkg,
4154 Uri uri, int modeFlags) throws RemoteException {
4155 Parcel data = Parcel.obtain();
4156 Parcel reply = Parcel.obtain();
4157 data.writeInterfaceToken(IActivityManager.descriptor);
4158 data.writeInt(callingUid);
4159 data.writeString(targetPkg);
4160 uri.writeToParcel(data, 0);
4161 data.writeInt(modeFlags);
4162 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4163 reply.readException();
4164 int res = reply.readInt();
4165 data.recycle();
4166 reply.recycle();
4167 return res;
4168 }
4169
Dianne Hackborn1676c852012-09-10 14:52:30 -07004170 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004171 String path, ParcelFileDescriptor fd) throws RemoteException {
4172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004176 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004177 data.writeInt(managed ? 1 : 0);
4178 data.writeString(path);
4179 if (fd != null) {
4180 data.writeInt(1);
4181 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4182 } else {
4183 data.writeInt(0);
4184 }
4185 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4186 reply.readException();
4187 boolean res = reply.readInt() != 0;
4188 reply.recycle();
4189 data.recycle();
4190 return res;
4191 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004192
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004193 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004194 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004195 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004196 Parcel data = Parcel.obtain();
4197 Parcel reply = Parcel.obtain();
4198 data.writeInterfaceToken(IActivityManager.descriptor);
4199 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004200 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004201 data.writeTypedArray(intents, 0);
4202 data.writeStringArray(resolvedTypes);
4203 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004204 if (options != null) {
4205 data.writeInt(1);
4206 options.writeToParcel(data, 0);
4207 } else {
4208 data.writeInt(0);
4209 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004210 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004211 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4212 reply.readException();
4213 int result = reply.readInt();
4214 reply.recycle();
4215 data.recycle();
4216 return result;
4217 }
4218
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004219 public int getFrontActivityScreenCompatMode() throws RemoteException {
4220 Parcel data = Parcel.obtain();
4221 Parcel reply = Parcel.obtain();
4222 data.writeInterfaceToken(IActivityManager.descriptor);
4223 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4224 reply.readException();
4225 int mode = reply.readInt();
4226 reply.recycle();
4227 data.recycle();
4228 return mode;
4229 }
4230
4231 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeInt(mode);
4236 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4237 reply.readException();
4238 reply.recycle();
4239 data.recycle();
4240 }
4241
4242 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004246 data.writeString(packageName);
4247 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004248 reply.readException();
4249 int mode = reply.readInt();
4250 reply.recycle();
4251 data.recycle();
4252 return mode;
4253 }
4254
4255 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004256 throws RemoteException {
4257 Parcel data = Parcel.obtain();
4258 Parcel reply = Parcel.obtain();
4259 data.writeInterfaceToken(IActivityManager.descriptor);
4260 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004261 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004262 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4263 reply.readException();
4264 reply.recycle();
4265 data.recycle();
4266 }
4267
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004268 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4269 Parcel data = Parcel.obtain();
4270 Parcel reply = Parcel.obtain();
4271 data.writeInterfaceToken(IActivityManager.descriptor);
4272 data.writeString(packageName);
4273 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4274 reply.readException();
4275 boolean ask = reply.readInt() != 0;
4276 reply.recycle();
4277 data.recycle();
4278 return ask;
4279 }
4280
4281 public void setPackageAskScreenCompat(String packageName, boolean ask)
4282 throws RemoteException {
4283 Parcel data = Parcel.obtain();
4284 Parcel reply = Parcel.obtain();
4285 data.writeInterfaceToken(IActivityManager.descriptor);
4286 data.writeString(packageName);
4287 data.writeInt(ask ? 1 : 0);
4288 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 reply.recycle();
4291 data.recycle();
4292 }
4293
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004294 public boolean switchUser(int userid) throws RemoteException {
4295 Parcel data = Parcel.obtain();
4296 Parcel reply = Parcel.obtain();
4297 data.writeInterfaceToken(IActivityManager.descriptor);
4298 data.writeInt(userid);
4299 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4300 reply.readException();
4301 boolean result = reply.readInt() != 0;
4302 reply.recycle();
4303 data.recycle();
4304 return result;
4305 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004306
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004307 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4308 Parcel data = Parcel.obtain();
4309 Parcel reply = Parcel.obtain();
4310 data.writeInterfaceToken(IActivityManager.descriptor);
4311 data.writeInt(userid);
4312 data.writeStrongInterface(callback);
4313 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4314 reply.readException();
4315 int result = reply.readInt();
4316 reply.recycle();
4317 data.recycle();
4318 return result;
4319 }
4320
Amith Yamasani52f1d752012-03-28 18:19:29 -07004321 public UserInfo getCurrentUser() throws RemoteException {
4322 Parcel data = Parcel.obtain();
4323 Parcel reply = Parcel.obtain();
4324 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004325 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004326 reply.readException();
4327 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4328 reply.recycle();
4329 data.recycle();
4330 return userInfo;
4331 }
4332
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004333 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004334 Parcel data = Parcel.obtain();
4335 Parcel reply = Parcel.obtain();
4336 data.writeInterfaceToken(IActivityManager.descriptor);
4337 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004338 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004339 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4340 reply.readException();
4341 boolean result = reply.readInt() != 0;
4342 reply.recycle();
4343 data.recycle();
4344 return result;
4345 }
4346
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004347 public int[] getRunningUserIds() throws RemoteException {
4348 Parcel data = Parcel.obtain();
4349 Parcel reply = Parcel.obtain();
4350 data.writeInterfaceToken(IActivityManager.descriptor);
4351 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4352 reply.readException();
4353 int[] result = reply.createIntArray();
4354 reply.recycle();
4355 data.recycle();
4356 return result;
4357 }
4358
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004359 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4360 Parcel data = Parcel.obtain();
4361 Parcel reply = Parcel.obtain();
4362 data.writeInterfaceToken(IActivityManager.descriptor);
4363 data.writeInt(taskId);
4364 data.writeInt(subTaskIndex);
4365 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4366 reply.readException();
4367 boolean result = reply.readInt() != 0;
4368 reply.recycle();
4369 data.recycle();
4370 return result;
4371 }
4372
4373 public boolean removeTask(int taskId, int flags) throws RemoteException {
4374 Parcel data = Parcel.obtain();
4375 Parcel reply = Parcel.obtain();
4376 data.writeInterfaceToken(IActivityManager.descriptor);
4377 data.writeInt(taskId);
4378 data.writeInt(flags);
4379 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4380 reply.readException();
4381 boolean result = reply.readInt() != 0;
4382 reply.recycle();
4383 data.recycle();
4384 return result;
4385 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004386
Jeff Sharkeya4620792011-05-20 15:29:23 -07004387 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4388 Parcel data = Parcel.obtain();
4389 Parcel reply = Parcel.obtain();
4390 data.writeInterfaceToken(IActivityManager.descriptor);
4391 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4392 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4393 reply.readException();
4394 data.recycle();
4395 reply.recycle();
4396 }
4397
4398 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4399 Parcel data = Parcel.obtain();
4400 Parcel reply = Parcel.obtain();
4401 data.writeInterfaceToken(IActivityManager.descriptor);
4402 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4403 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4404 reply.readException();
4405 data.recycle();
4406 reply.recycle();
4407 }
4408
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004409 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4410 Parcel data = Parcel.obtain();
4411 Parcel reply = Parcel.obtain();
4412 data.writeInterfaceToken(IActivityManager.descriptor);
4413 data.writeStrongBinder(sender.asBinder());
4414 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4415 reply.readException();
4416 boolean res = reply.readInt() != 0;
4417 data.recycle();
4418 reply.recycle();
4419 return res;
4420 }
4421
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004422 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4423 Parcel data = Parcel.obtain();
4424 Parcel reply = Parcel.obtain();
4425 data.writeInterfaceToken(IActivityManager.descriptor);
4426 data.writeStrongBinder(sender.asBinder());
4427 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4428 reply.readException();
4429 boolean res = reply.readInt() != 0;
4430 data.recycle();
4431 reply.recycle();
4432 return res;
4433 }
4434
Dianne Hackborn81038902012-11-26 17:04:09 -08004435 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4436 Parcel data = Parcel.obtain();
4437 Parcel reply = Parcel.obtain();
4438 data.writeInterfaceToken(IActivityManager.descriptor);
4439 data.writeStrongBinder(sender.asBinder());
4440 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 Intent res = reply.readInt() != 0
4443 ? Intent.CREATOR.createFromParcel(reply) : null;
4444 data.recycle();
4445 reply.recycle();
4446 return res;
4447 }
4448
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004449 public String getTagForIntentSender(IIntentSender sender, String prefix)
4450 throws RemoteException {
4451 Parcel data = Parcel.obtain();
4452 Parcel reply = Parcel.obtain();
4453 data.writeInterfaceToken(IActivityManager.descriptor);
4454 data.writeStrongBinder(sender.asBinder());
4455 data.writeString(prefix);
4456 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4457 reply.readException();
4458 String res = reply.readString();
4459 data.recycle();
4460 reply.recycle();
4461 return res;
4462 }
4463
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004464 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4465 {
4466 Parcel data = Parcel.obtain();
4467 Parcel reply = Parcel.obtain();
4468 data.writeInterfaceToken(IActivityManager.descriptor);
4469 values.writeToParcel(data, 0);
4470 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4471 reply.readException();
4472 data.recycle();
4473 reply.recycle();
4474 }
4475
Dianne Hackbornb437e092011-08-05 17:50:29 -07004476 public long[] getProcessPss(int[] pids) throws RemoteException {
4477 Parcel data = Parcel.obtain();
4478 Parcel reply = Parcel.obtain();
4479 data.writeInterfaceToken(IActivityManager.descriptor);
4480 data.writeIntArray(pids);
4481 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4482 reply.readException();
4483 long[] res = reply.createLongArray();
4484 data.recycle();
4485 reply.recycle();
4486 return res;
4487 }
4488
Dianne Hackborn661cd522011-08-22 00:26:20 -07004489 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4490 Parcel data = Parcel.obtain();
4491 Parcel reply = Parcel.obtain();
4492 data.writeInterfaceToken(IActivityManager.descriptor);
4493 TextUtils.writeToParcel(msg, data, 0);
4494 data.writeInt(always ? 1 : 0);
4495 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4496 reply.readException();
4497 data.recycle();
4498 reply.recycle();
4499 }
4500
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004501 public void dismissKeyguardOnNextActivity() throws RemoteException {
4502 Parcel data = Parcel.obtain();
4503 Parcel reply = Parcel.obtain();
4504 data.writeInterfaceToken(IActivityManager.descriptor);
4505 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4506 reply.readException();
4507 data.recycle();
4508 reply.recycle();
4509 }
4510
Adam Powelldd8fab22012-03-22 17:47:27 -07004511 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4512 throws RemoteException {
4513 Parcel data = Parcel.obtain();
4514 Parcel reply = Parcel.obtain();
4515 data.writeInterfaceToken(IActivityManager.descriptor);
4516 data.writeStrongBinder(token);
4517 data.writeString(destAffinity);
4518 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4519 reply.readException();
4520 boolean result = reply.readInt() != 0;
4521 data.recycle();
4522 reply.recycle();
4523 return result;
4524 }
4525
4526 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4527 throws RemoteException {
4528 Parcel data = Parcel.obtain();
4529 Parcel reply = Parcel.obtain();
4530 data.writeInterfaceToken(IActivityManager.descriptor);
4531 data.writeStrongBinder(token);
4532 target.writeToParcel(data, 0);
4533 data.writeInt(resultCode);
4534 if (resultData != null) {
4535 data.writeInt(1);
4536 resultData.writeToParcel(data, 0);
4537 } else {
4538 data.writeInt(0);
4539 }
4540 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4541 reply.readException();
4542 boolean result = reply.readInt() != 0;
4543 data.recycle();
4544 reply.recycle();
4545 return result;
4546 }
4547
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004548 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4549 Parcel data = Parcel.obtain();
4550 Parcel reply = Parcel.obtain();
4551 data.writeInterfaceToken(IActivityManager.descriptor);
4552 data.writeStrongBinder(activityToken);
4553 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4554 reply.readException();
4555 int result = reply.readInt();
4556 data.recycle();
4557 reply.recycle();
4558 return result;
4559 }
4560
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004561 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
4565 data.writeStrongBinder(activityToken);
4566 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4567 reply.readException();
4568 String result = reply.readString();
4569 data.recycle();
4570 reply.recycle();
4571 return result;
4572 }
4573
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004574 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4575 Parcel data = Parcel.obtain();
4576 Parcel reply = Parcel.obtain();
4577 data.writeInterfaceToken(IActivityManager.descriptor);
4578 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4579 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4580 reply.readException();
4581 data.recycle();
4582 reply.recycle();
4583 }
4584
4585 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4586 Parcel data = Parcel.obtain();
4587 Parcel reply = Parcel.obtain();
4588 data.writeInterfaceToken(IActivityManager.descriptor);
4589 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4590 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4591 reply.readException();
4592 data.recycle();
4593 reply.recycle();
4594 }
4595
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004596 public void requestBugReport() throws RemoteException {
4597 Parcel data = Parcel.obtain();
4598 Parcel reply = Parcel.obtain();
4599 data.writeInterfaceToken(IActivityManager.descriptor);
4600 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4601 reply.readException();
4602 data.recycle();
4603 reply.recycle();
4604 }
4605
Jeff Brownbd181bb2013-09-10 16:44:24 -07004606 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4607 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 data.writeInt(pid);
4612 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004613 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004614 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 long res = reply.readInt();
4617 data.recycle();
4618 reply.recycle();
4619 return res;
4620 }
4621
Adam Skorydfc7fd72013-08-05 19:23:41 -07004622 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004623 Parcel data = Parcel.obtain();
4624 Parcel reply = Parcel.obtain();
4625 data.writeInterfaceToken(IActivityManager.descriptor);
4626 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004627 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004628 reply.readException();
4629 Bundle res = reply.readBundle();
4630 data.recycle();
4631 reply.recycle();
4632 return res;
4633 }
4634
Adam Skory7140a252013-09-11 12:04:58 +01004635 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004636 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 data.writeStrongBinder(token);
4641 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004642 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004643 reply.readException();
4644 data.recycle();
4645 reply.recycle();
4646 }
4647
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004648 public void killUid(int uid, String reason) throws RemoteException {
4649 Parcel data = Parcel.obtain();
4650 Parcel reply = Parcel.obtain();
4651 data.writeInterfaceToken(IActivityManager.descriptor);
4652 data.writeInt(uid);
4653 data.writeString(reason);
4654 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4655 reply.readException();
4656 data.recycle();
4657 reply.recycle();
4658 }
4659
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004660 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4661 Parcel data = Parcel.obtain();
4662 Parcel reply = Parcel.obtain();
4663 data.writeInterfaceToken(IActivityManager.descriptor);
4664 data.writeStrongBinder(who);
4665 data.writeInt(allowRestart ? 1 : 0);
4666 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4667 reply.readException();
4668 data.recycle();
4669 reply.recycle();
4670 }
4671
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004672 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4673 Parcel data = Parcel.obtain();
4674 Parcel reply = Parcel.obtain();
4675 data.writeInterfaceToken(IActivityManager.descriptor);
4676 data.writeStrongBinder(token);
4677 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4678 reply.readException();
4679 data.recycle();
4680 reply.recycle();
4681 }
4682
Craig Mautner5eda9b32013-07-02 11:58:16 -07004683 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4684 Parcel data = Parcel.obtain();
4685 Parcel reply = Parcel.obtain();
4686 data.writeInterfaceToken(IActivityManager.descriptor);
4687 data.writeStrongBinder(token);
4688 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4689 reply.readException();
4690 data.recycle();
4691 reply.recycle();
4692 }
4693
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004694 public void restart() throws RemoteException {
4695 Parcel data = Parcel.obtain();
4696 Parcel reply = Parcel.obtain();
4697 data.writeInterfaceToken(IActivityManager.descriptor);
4698 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4699 reply.readException();
4700 data.recycle();
4701 reply.recycle();
4702 }
4703
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004704 public void performIdleMaintenance() throws RemoteException {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4709 reply.readException();
4710 data.recycle();
4711 reply.recycle();
4712 }
4713
Craig Mautner4a1cb222013-12-04 16:14:06 -08004714 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4715 IActivityContainerCallback callback) throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
4719 data.writeStrongBinder(parentActivityToken);
4720 data.writeStrongBinder((IBinder)callback);
4721 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4722 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004723 final int result = reply.readInt();
4724 final IActivityContainer res;
4725 if (result == 1) {
4726 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4727 } else {
4728 res = null;
4729 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004730 data.recycle();
4731 reply.recycle();
4732 return res;
4733 }
4734
Craig Mautner95da1082014-02-24 17:54:35 -08004735 public void deleteActivityContainer(IActivityContainer activityContainer)
4736 throws RemoteException {
4737 Parcel data = Parcel.obtain();
4738 Parcel reply = Parcel.obtain();
4739 data.writeInterfaceToken(IActivityManager.descriptor);
4740 data.writeStrongBinder(activityContainer.asBinder());
4741 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4742 reply.readException();
4743 data.recycle();
4744 reply.recycle();
4745 }
4746
Craig Mautnere0a38842013-12-16 16:14:02 -08004747 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4748 throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 data.writeStrongBinder(activityToken);
4753 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4754 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004755 final int result = reply.readInt();
4756 final IActivityContainer res;
4757 if (result == 1) {
4758 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4759 } else {
4760 res = null;
4761 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004762 data.recycle();
4763 reply.recycle();
4764 return res;
4765 }
4766
Craig Mautner4a1cb222013-12-04 16:14:06 -08004767 public IBinder getHomeActivityToken() throws RemoteException {
4768 Parcel data = Parcel.obtain();
4769 Parcel reply = Parcel.obtain();
4770 data.writeInterfaceToken(IActivityManager.descriptor);
4771 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4772 reply.readException();
4773 IBinder res = reply.readStrongBinder();
4774 data.recycle();
4775 reply.recycle();
4776 return res;
4777 }
4778
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004779 private IBinder mRemote;
4780}