blob: 373a8a3f86c36526184d389b4c16ac3ed1a0a887 [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
Winson Chung303e1ff2014-03-07 15:06:19 -0800657 case IS_IN_HOME_STACK_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 int taskId = data.readInt();
660 boolean isInHomeStack = isInHomeStack(taskId);
661 reply.writeNoException();
662 reply.writeInt(isInHomeStack ? 1 : 0);
663 return true;
664 }
665
Craig Mautnercf910b02013-04-23 11:23:27 -0700666 case SET_FOCUSED_STACK_TRANSACTION: {
667 data.enforceInterface(IActivityManager.descriptor);
668 int stackId = data.readInt();
669 setFocusedStack(stackId);
670 reply.writeNoException();
671 return true;
672 }
673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 IBinder token = data.readStrongBinder();
677 boolean onlyRoot = data.readInt() != 0;
678 int res = token != null
679 ? getTaskForActivity(token, onlyRoot) : -1;
680 reply.writeNoException();
681 reply.writeInt(res);
682 return true;
683 }
684
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800685 case REPORT_THUMBNAIL_TRANSACTION: {
686 data.enforceInterface(IActivityManager.descriptor);
687 IBinder token = data.readStrongBinder();
688 Bitmap thumbnail = data.readInt() != 0
689 ? Bitmap.CREATOR.createFromParcel(data) : null;
690 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
691 reportThumbnail(token, thumbnail, description);
692 reply.writeNoException();
693 return true;
694 }
695
696 case GET_CONTENT_PROVIDER_TRANSACTION: {
697 data.enforceInterface(IActivityManager.descriptor);
698 IBinder b = data.readStrongBinder();
699 IApplicationThread app = ApplicationThreadNative.asInterface(b);
700 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700701 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700702 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700703 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 reply.writeNoException();
705 if (cph != null) {
706 reply.writeInt(1);
707 cph.writeToParcel(reply, 0);
708 } else {
709 reply.writeInt(0);
710 }
711 return true;
712 }
713
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800714 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
715 data.enforceInterface(IActivityManager.descriptor);
716 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700717 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800718 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700719 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800720 reply.writeNoException();
721 if (cph != null) {
722 reply.writeInt(1);
723 cph.writeToParcel(reply, 0);
724 } else {
725 reply.writeInt(0);
726 }
727 return true;
728 }
729
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800730 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
731 data.enforceInterface(IActivityManager.descriptor);
732 IBinder b = data.readStrongBinder();
733 IApplicationThread app = ApplicationThreadNative.asInterface(b);
734 ArrayList<ContentProviderHolder> providers =
735 data.createTypedArrayList(ContentProviderHolder.CREATOR);
736 publishContentProviders(app, providers);
737 reply.writeNoException();
738 return true;
739 }
740
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700741 case REF_CONTENT_PROVIDER_TRANSACTION: {
742 data.enforceInterface(IActivityManager.descriptor);
743 IBinder b = data.readStrongBinder();
744 int stable = data.readInt();
745 int unstable = data.readInt();
746 boolean res = refContentProvider(b, stable, unstable);
747 reply.writeNoException();
748 reply.writeInt(res ? 1 : 0);
749 return true;
750 }
751
752 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
753 data.enforceInterface(IActivityManager.descriptor);
754 IBinder b = data.readStrongBinder();
755 unstableProviderDied(b);
756 reply.writeNoException();
757 return true;
758 }
759
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700760 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 IBinder b = data.readStrongBinder();
763 appNotRespondingViaProvider(b);
764 reply.writeNoException();
765 return true;
766 }
767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700771 boolean stable = data.readInt() != 0;
772 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 reply.writeNoException();
774 return true;
775 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800776
777 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 String name = data.readString();
780 IBinder token = data.readStrongBinder();
781 removeContentProviderExternal(name, token);
782 reply.writeNoException();
783 return true;
784 }
785
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700786 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
789 PendingIntent pi = getRunningServiceControlPanel(comp);
790 reply.writeNoException();
791 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
792 return true;
793 }
794
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800795 case START_SERVICE_TRANSACTION: {
796 data.enforceInterface(IActivityManager.descriptor);
797 IBinder b = data.readStrongBinder();
798 IApplicationThread app = ApplicationThreadNative.asInterface(b);
799 Intent service = Intent.CREATOR.createFromParcel(data);
800 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700801 int userId = data.readInt();
802 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 reply.writeNoException();
804 ComponentName.writeToParcel(cn, reply);
805 return true;
806 }
807
808 case STOP_SERVICE_TRANSACTION: {
809 data.enforceInterface(IActivityManager.descriptor);
810 IBinder b = data.readStrongBinder();
811 IApplicationThread app = ApplicationThreadNative.asInterface(b);
812 Intent service = Intent.CREATOR.createFromParcel(data);
813 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700814 int userId = data.readInt();
815 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 reply.writeNoException();
817 reply.writeInt(res);
818 return true;
819 }
820
821 case STOP_SERVICE_TOKEN_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 ComponentName className = ComponentName.readFromParcel(data);
824 IBinder token = data.readStrongBinder();
825 int startId = data.readInt();
826 boolean res = stopServiceToken(className, token, startId);
827 reply.writeNoException();
828 reply.writeInt(res ? 1 : 0);
829 return true;
830 }
831
832 case SET_SERVICE_FOREGROUND_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 ComponentName className = ComponentName.readFromParcel(data);
835 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700836 int id = data.readInt();
837 Notification notification = null;
838 if (data.readInt() != 0) {
839 notification = Notification.CREATOR.createFromParcel(data);
840 }
841 boolean removeNotification = data.readInt() != 0;
842 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 reply.writeNoException();
844 return true;
845 }
846
847 case BIND_SERVICE_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 IBinder b = data.readStrongBinder();
850 IApplicationThread app = ApplicationThreadNative.asInterface(b);
851 IBinder token = data.readStrongBinder();
852 Intent service = Intent.CREATOR.createFromParcel(data);
853 String resolvedType = data.readString();
854 b = data.readStrongBinder();
855 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800856 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800858 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 reply.writeNoException();
860 reply.writeInt(res);
861 return true;
862 }
863
864 case UNBIND_SERVICE_TRANSACTION: {
865 data.enforceInterface(IActivityManager.descriptor);
866 IBinder b = data.readStrongBinder();
867 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
868 boolean res = unbindService(conn);
869 reply.writeNoException();
870 reply.writeInt(res ? 1 : 0);
871 return true;
872 }
873
874 case PUBLISH_SERVICE_TRANSACTION: {
875 data.enforceInterface(IActivityManager.descriptor);
876 IBinder token = data.readStrongBinder();
877 Intent intent = Intent.CREATOR.createFromParcel(data);
878 IBinder service = data.readStrongBinder();
879 publishService(token, intent, service);
880 reply.writeNoException();
881 return true;
882 }
883
884 case UNBIND_FINISHED_TRANSACTION: {
885 data.enforceInterface(IActivityManager.descriptor);
886 IBinder token = data.readStrongBinder();
887 Intent intent = Intent.CREATOR.createFromParcel(data);
888 boolean doRebind = data.readInt() != 0;
889 unbindFinished(token, intent, doRebind);
890 reply.writeNoException();
891 return true;
892 }
893
894 case SERVICE_DONE_EXECUTING_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700897 int type = data.readInt();
898 int startId = data.readInt();
899 int res = data.readInt();
900 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 reply.writeNoException();
902 return true;
903 }
904
905 case START_INSTRUMENTATION_TRANSACTION: {
906 data.enforceInterface(IActivityManager.descriptor);
907 ComponentName className = ComponentName.readFromParcel(data);
908 String profileFile = data.readString();
909 int fl = data.readInt();
910 Bundle arguments = data.readBundle();
911 IBinder b = data.readStrongBinder();
912 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800913 b = data.readStrongBinder();
914 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700915 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800916 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 reply.writeNoException();
918 reply.writeInt(res ? 1 : 0);
919 return true;
920 }
921
922
923 case FINISH_INSTRUMENTATION_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 IApplicationThread app = ApplicationThreadNative.asInterface(b);
927 int resultCode = data.readInt();
928 Bundle results = data.readBundle();
929 finishInstrumentation(app, resultCode, results);
930 reply.writeNoException();
931 return true;
932 }
933
934 case GET_CONFIGURATION_TRANSACTION: {
935 data.enforceInterface(IActivityManager.descriptor);
936 Configuration config = getConfiguration();
937 reply.writeNoException();
938 config.writeToParcel(reply, 0);
939 return true;
940 }
941
942 case UPDATE_CONFIGURATION_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 Configuration config = Configuration.CREATOR.createFromParcel(data);
945 updateConfiguration(config);
946 reply.writeNoException();
947 return true;
948 }
949
950 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder token = data.readStrongBinder();
953 int requestedOrientation = data.readInt();
954 setRequestedOrientation(token, requestedOrientation);
955 reply.writeNoException();
956 return true;
957 }
958
959 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
960 data.enforceInterface(IActivityManager.descriptor);
961 IBinder token = data.readStrongBinder();
962 int req = getRequestedOrientation(token);
963 reply.writeNoException();
964 reply.writeInt(req);
965 return true;
966 }
967
968 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 ComponentName cn = getActivityClassForToken(token);
972 reply.writeNoException();
973 ComponentName.writeToParcel(cn, reply);
974 return true;
975 }
976
977 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
980 reply.writeNoException();
981 reply.writeString(getPackageForToken(token));
982 return true;
983 }
984
985 case GET_INTENT_SENDER_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 int type = data.readInt();
988 String packageName = data.readString();
989 IBinder token = data.readStrongBinder();
990 String resultWho = data.readString();
991 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800992 Intent[] requestIntents;
993 String[] requestResolvedTypes;
994 if (data.readInt() != 0) {
995 requestIntents = data.createTypedArray(Intent.CREATOR);
996 requestResolvedTypes = data.createStringArray();
997 } else {
998 requestIntents = null;
999 requestResolvedTypes = null;
1000 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001002 Bundle options = data.readInt() != 0
1003 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001004 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001006 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001007 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001008 reply.writeNoException();
1009 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1010 return true;
1011 }
1012
1013 case CANCEL_INTENT_SENDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IIntentSender r = IIntentSender.Stub.asInterface(
1016 data.readStrongBinder());
1017 cancelIntentSender(r);
1018 reply.writeNoException();
1019 return true;
1020 }
1021
1022 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1023 data.enforceInterface(IActivityManager.descriptor);
1024 IIntentSender r = IIntentSender.Stub.asInterface(
1025 data.readStrongBinder());
1026 String res = getPackageForIntentSender(r);
1027 reply.writeNoException();
1028 reply.writeString(res);
1029 return true;
1030 }
1031
Christopher Tatec4a07d12012-04-06 14:19:13 -07001032 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1033 data.enforceInterface(IActivityManager.descriptor);
1034 IIntentSender r = IIntentSender.Stub.asInterface(
1035 data.readStrongBinder());
1036 int res = getUidForIntentSender(r);
1037 reply.writeNoException();
1038 reply.writeInt(res);
1039 return true;
1040 }
1041
Dianne Hackborn41203752012-08-31 14:05:51 -07001042 case HANDLE_INCOMING_USER_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 int callingPid = data.readInt();
1045 int callingUid = data.readInt();
1046 int userId = data.readInt();
1047 boolean allowAll = data.readInt() != 0 ;
1048 boolean requireFull = data.readInt() != 0;
1049 String name = data.readString();
1050 String callerPackage = data.readString();
1051 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1052 requireFull, name, callerPackage);
1053 reply.writeNoException();
1054 reply.writeInt(res);
1055 return true;
1056 }
1057
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001058 case SET_PROCESS_LIMIT_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 int max = data.readInt();
1061 setProcessLimit(max);
1062 reply.writeNoException();
1063 return true;
1064 }
1065
1066 case GET_PROCESS_LIMIT_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 int limit = getProcessLimit();
1069 reply.writeNoException();
1070 reply.writeInt(limit);
1071 return true;
1072 }
1073
1074 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 IBinder token = data.readStrongBinder();
1077 int pid = data.readInt();
1078 boolean isForeground = data.readInt() != 0;
1079 setProcessForeground(token, pid, isForeground);
1080 reply.writeNoException();
1081 return true;
1082 }
1083
1084 case CHECK_PERMISSION_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 String perm = data.readString();
1087 int pid = data.readInt();
1088 int uid = data.readInt();
1089 int res = checkPermission(perm, pid, uid);
1090 reply.writeNoException();
1091 reply.writeInt(res);
1092 return true;
1093 }
1094
1095 case CHECK_URI_PERMISSION_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 Uri uri = Uri.CREATOR.createFromParcel(data);
1098 int pid = data.readInt();
1099 int uid = data.readInt();
1100 int mode = data.readInt();
1101 int res = checkUriPermission(uri, pid, uid, mode);
1102 reply.writeNoException();
1103 reply.writeInt(res);
1104 return true;
1105 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001108 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 String packageName = data.readString();
1110 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1111 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001112 int userId = data.readInt();
1113 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001114 reply.writeNoException();
1115 reply.writeInt(res ? 1 : 0);
1116 return true;
1117 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001118
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001119 case GRANT_URI_PERMISSION_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 IBinder b = data.readStrongBinder();
1122 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1123 String targetPkg = data.readString();
1124 Uri uri = Uri.CREATOR.createFromParcel(data);
1125 int mode = data.readInt();
1126 grantUriPermission(app, targetPkg, uri, mode);
1127 reply.writeNoException();
1128 return true;
1129 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001130
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 case REVOKE_URI_PERMISSION_TRANSACTION: {
1132 data.enforceInterface(IActivityManager.descriptor);
1133 IBinder b = data.readStrongBinder();
1134 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1135 Uri uri = Uri.CREATOR.createFromParcel(data);
1136 int mode = data.readInt();
1137 revokeUriPermission(app, uri, mode);
1138 reply.writeNoException();
1139 return true;
1140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001141
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001142 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 Uri uri = Uri.CREATOR.createFromParcel(data);
1145 int mode = data.readInt();
1146 takePersistableUriPermission(uri, mode);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
1151 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 Uri uri = Uri.CREATOR.createFromParcel(data);
1154 int mode = data.readInt();
1155 releasePersistableUriPermission(uri, mode);
1156 reply.writeNoException();
1157 return true;
1158 }
1159
1160 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001162 final String packageName = data.readString();
1163 final boolean incoming = data.readInt() != 0;
1164 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1165 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001166 reply.writeNoException();
1167 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1168 return true;
1169 }
1170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 IBinder b = data.readStrongBinder();
1174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1175 boolean waiting = data.readInt() != 0;
1176 showWaitingForDebugger(app, waiting);
1177 reply.writeNoException();
1178 return true;
1179 }
1180
1181 case GET_MEMORY_INFO_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1184 getMemoryInfo(mi);
1185 reply.writeNoException();
1186 mi.writeToParcel(reply, 0);
1187 return true;
1188 }
1189
1190 case UNHANDLED_BACK_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 unhandledBack();
1193 reply.writeNoException();
1194 return true;
1195 }
1196
1197 case OPEN_CONTENT_URI_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 Uri uri = Uri.parse(data.readString());
1200 ParcelFileDescriptor pfd = openContentUri(uri);
1201 reply.writeNoException();
1202 if (pfd != null) {
1203 reply.writeInt(1);
1204 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1205 } else {
1206 reply.writeInt(0);
1207 }
1208 return true;
1209 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001210
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 case GOING_TO_SLEEP_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 goingToSleep();
1214 reply.writeNoException();
1215 return true;
1216 }
1217
1218 case WAKING_UP_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 wakingUp();
1221 reply.writeNoException();
1222 return true;
1223 }
1224
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001225 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 setLockScreenShown(data.readInt() != 0);
1228 reply.writeNoException();
1229 return true;
1230 }
1231
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001232 case SET_DEBUG_APP_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 String pn = data.readString();
1235 boolean wfd = data.readInt() != 0;
1236 boolean per = data.readInt() != 0;
1237 setDebugApp(pn, wfd, per);
1238 reply.writeNoException();
1239 return true;
1240 }
1241
1242 case SET_ALWAYS_FINISH_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 boolean enabled = data.readInt() != 0;
1245 setAlwaysFinish(enabled);
1246 reply.writeNoException();
1247 return true;
1248 }
1249
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001250 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001252 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001254 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001255 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001256 return true;
1257 }
1258
1259 case ENTER_SAFE_MODE_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
1261 enterSafeMode();
1262 reply.writeNoException();
1263 return true;
1264 }
1265
1266 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1267 data.enforceInterface(IActivityManager.descriptor);
1268 IIntentSender is = IIntentSender.Stub.asInterface(
1269 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001270 int sourceUid = data.readInt();
1271 String sourcePkg = data.readString();
1272 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 reply.writeNoException();
1274 return true;
1275 }
1276
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001277 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 data.enforceInterface(IActivityManager.descriptor);
1279 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001280 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001281 boolean secure = data.readInt() != 0;
1282 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 reply.writeNoException();
1284 reply.writeInt(res ? 1 : 0);
1285 return true;
1286 }
1287
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001288 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 String reason = data.readString();
1291 boolean res = killProcessesBelowForeground(reason);
1292 reply.writeNoException();
1293 reply.writeInt(res ? 1 : 0);
1294 return true;
1295 }
1296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001297 case START_RUNNING_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 String pkg = data.readString();
1300 String cls = data.readString();
1301 String action = data.readString();
1302 String indata = data.readString();
1303 startRunning(pkg, cls, action, indata);
1304 reply.writeNoException();
1305 return true;
1306 }
1307
Dan Egnor60d87622009-12-16 16:32:58 -08001308 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
1310 IBinder app = data.readStrongBinder();
1311 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1312 handleApplicationCrash(app, ci);
1313 reply.writeNoException();
1314 return true;
1315 }
1316
1317 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 data.enforceInterface(IActivityManager.descriptor);
1319 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001320 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001321 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001322 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001323 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001324 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325 return true;
1326 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001327
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001328 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1329 data.enforceInterface(IActivityManager.descriptor);
1330 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001331 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001332 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1333 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001334 reply.writeNoException();
1335 return true;
1336 }
1337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 int sig = data.readInt();
1341 signalPersistentProcesses(sig);
1342 reply.writeNoException();
1343 return true;
1344 }
1345
Dianne Hackborn03abb812010-01-04 18:43:19 -08001346 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1347 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001349 int userId = data.readInt();
1350 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001351 reply.writeNoException();
1352 return true;
1353 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001354
1355 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1356 data.enforceInterface(IActivityManager.descriptor);
1357 killAllBackgroundProcesses();
1358 reply.writeNoException();
1359 return true;
1360 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001361
Dianne Hackborn03abb812010-01-04 18:43:19 -08001362 case FORCE_STOP_PACKAGE_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001365 int userId = data.readInt();
1366 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 reply.writeNoException();
1368 return true;
1369 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001370
1371 case GET_MY_MEMORY_STATE_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 ActivityManager.RunningAppProcessInfo info =
1374 new ActivityManager.RunningAppProcessInfo();
1375 getMyMemoryState(info);
1376 reply.writeNoException();
1377 info.writeToParcel(reply, 0);
1378 return true;
1379 }
1380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001381 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 ConfigurationInfo config = getDeviceConfigurationInfo();
1384 reply.writeNoException();
1385 config.writeToParcel(reply, 0);
1386 return true;
1387 }
1388
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001389 case PROFILE_CONTROL_TRANSACTION: {
1390 data.enforceInterface(IActivityManager.descriptor);
1391 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001392 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001393 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001394 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001395 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001396 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001397 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001398 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001399 reply.writeNoException();
1400 reply.writeInt(res ? 1 : 0);
1401 return true;
1402 }
1403
Dianne Hackborn55280a92009-05-07 15:53:46 -07001404 case SHUTDOWN_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 boolean res = shutdown(data.readInt());
1407 reply.writeNoException();
1408 reply.writeInt(res ? 1 : 0);
1409 return true;
1410 }
1411
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001412 case STOP_APP_SWITCHES_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 stopAppSwitches();
1415 reply.writeNoException();
1416 return true;
1417 }
1418
1419 case RESUME_APP_SWITCHES_TRANSACTION: {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 resumeAppSwitches();
1422 reply.writeNoException();
1423 return true;
1424 }
1425
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001426 case PEEK_SERVICE_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 Intent service = Intent.CREATOR.createFromParcel(data);
1429 String resolvedType = data.readString();
1430 IBinder binder = peekService(service, resolvedType);
1431 reply.writeNoException();
1432 reply.writeStrongBinder(binder);
1433 return true;
1434 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001435
1436 case START_BACKUP_AGENT_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1439 int backupRestoreMode = data.readInt();
1440 boolean success = bindBackupAgent(info, backupRestoreMode);
1441 reply.writeNoException();
1442 reply.writeInt(success ? 1 : 0);
1443 return true;
1444 }
1445
1446 case BACKUP_AGENT_CREATED_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 String packageName = data.readString();
1449 IBinder agent = data.readStrongBinder();
1450 backupAgentCreated(packageName, agent);
1451 reply.writeNoException();
1452 return true;
1453 }
1454
1455 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1456 data.enforceInterface(IActivityManager.descriptor);
1457 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1458 unbindBackupAgent(info);
1459 reply.writeNoException();
1460 return true;
1461 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001462
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001463 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001464 data.enforceInterface(IActivityManager.descriptor);
1465 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001466 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001467 String reason = data.readString();
1468 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001469 reply.writeNoException();
1470 return true;
1471 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001472
1473 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 String reason = data.readString();
1476 closeSystemDialogs(reason);
1477 reply.writeNoException();
1478 return true;
1479 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001480
1481 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1482 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001483 int[] pids = data.createIntArray();
1484 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001485 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001486 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001487 return true;
1488 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001489
1490 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 String processName = data.readString();
1493 int uid = data.readInt();
1494 killApplicationProcess(processName, uid);
1495 reply.writeNoException();
1496 return true;
1497 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001498
1499 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 IBinder token = data.readStrongBinder();
1502 String packageName = data.readString();
1503 int enterAnim = data.readInt();
1504 int exitAnim = data.readInt();
1505 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001506 reply.writeNoException();
1507 return true;
1508 }
1509
1510 case IS_USER_A_MONKEY_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001512 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001513 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001514 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001515 return true;
1516 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001517
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001518 case SET_USER_IS_MONKEY_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 final boolean monkey = (data.readInt() == 1);
1521 setUserIsMonkey(monkey);
1522 reply.writeNoException();
1523 return true;
1524 }
1525
Dianne Hackborn860755f2010-06-03 18:47:52 -07001526 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 finishHeavyWeightApp();
1529 reply.writeNoException();
1530 return true;
1531 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001532
1533 case IS_IMMERSIVE_TRANSACTION: {
1534 data.enforceInterface(IActivityManager.descriptor);
1535 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001536 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001537 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001538 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001539 return true;
1540 }
1541
Craig Mautner5eda9b32013-07-02 11:58:16 -07001542 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001543 data.enforceInterface(IActivityManager.descriptor);
1544 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001545 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001546 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001547 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001548 return true;
1549 }
1550
1551 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001554 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001555 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001556 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001557 return true;
1558 }
1559
Daniel Sandler69a48172010-06-23 16:29:36 -04001560 case SET_IMMERSIVE_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
1562 IBinder token = data.readStrongBinder();
1563 boolean imm = data.readInt() == 1;
1564 setImmersive(token, imm);
1565 reply.writeNoException();
1566 return true;
1567 }
1568
1569 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1570 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001571 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001572 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001573 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001574 return true;
1575 }
1576
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001577 case CRASH_APPLICATION_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 int uid = data.readInt();
1580 int initialPid = data.readInt();
1581 String packageName = data.readString();
1582 String message = data.readString();
1583 crashApplication(uid, initialPid, packageName, message);
1584 reply.writeNoException();
1585 return true;
1586 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001587
1588 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1589 data.enforceInterface(IActivityManager.descriptor);
1590 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001591 int userId = data.readInt();
1592 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001593 reply.writeNoException();
1594 reply.writeString(type);
1595 return true;
1596 }
1597
Dianne Hackborn7e269642010-08-25 19:50:20 -07001598 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1599 data.enforceInterface(IActivityManager.descriptor);
1600 String name = data.readString();
1601 IBinder perm = newUriPermissionOwner(name);
1602 reply.writeNoException();
1603 reply.writeStrongBinder(perm);
1604 return true;
1605 }
1606
1607 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 IBinder owner = data.readStrongBinder();
1610 int fromUid = data.readInt();
1611 String targetPkg = data.readString();
1612 Uri uri = Uri.CREATOR.createFromParcel(data);
1613 int mode = data.readInt();
1614 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1615 reply.writeNoException();
1616 return true;
1617 }
1618
1619 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 IBinder owner = data.readStrongBinder();
1622 Uri uri = null;
1623 if (data.readInt() != 0) {
1624 Uri.CREATOR.createFromParcel(data);
1625 }
1626 int mode = data.readInt();
1627 revokeUriPermissionFromOwner(owner, uri, mode);
1628 reply.writeNoException();
1629 return true;
1630 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001631
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001632 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1633 data.enforceInterface(IActivityManager.descriptor);
1634 int callingUid = data.readInt();
1635 String targetPkg = data.readString();
1636 Uri uri = Uri.CREATOR.createFromParcel(data);
1637 int modeFlags = data.readInt();
1638 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1639 reply.writeNoException();
1640 reply.writeInt(res);
1641 return true;
1642 }
1643
Andy McFadden824c5102010-07-09 16:26:57 -07001644 case DUMP_HEAP_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001647 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001648 boolean managed = data.readInt() != 0;
1649 String path = data.readString();
1650 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001651 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001652 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001653 reply.writeNoException();
1654 reply.writeInt(res ? 1 : 0);
1655 return true;
1656 }
1657
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001658 case START_ACTIVITIES_TRANSACTION:
1659 {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 IBinder b = data.readStrongBinder();
1662 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001663 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001664 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1665 String[] resolvedTypes = data.createStringArray();
1666 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001667 Bundle options = data.readInt() != 0
1668 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001669 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001670 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001671 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001672 reply.writeNoException();
1673 reply.writeInt(result);
1674 return true;
1675 }
1676
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001677 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1678 {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 int mode = getFrontActivityScreenCompatMode();
1681 reply.writeNoException();
1682 reply.writeInt(mode);
1683 return true;
1684 }
1685
1686 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1687 {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 int mode = data.readInt();
1690 setFrontActivityScreenCompatMode(mode);
1691 reply.writeNoException();
1692 reply.writeInt(mode);
1693 return true;
1694 }
1695
1696 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1697 {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 String pkg = data.readString();
1700 int mode = getPackageScreenCompatMode(pkg);
1701 reply.writeNoException();
1702 reply.writeInt(mode);
1703 return true;
1704 }
1705
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001706 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1707 {
1708 data.enforceInterface(IActivityManager.descriptor);
1709 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001710 int mode = data.readInt();
1711 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001712 reply.writeNoException();
1713 return true;
1714 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001715
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001716 case SWITCH_USER_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 int userid = data.readInt();
1719 boolean result = switchUser(userid);
1720 reply.writeNoException();
1721 reply.writeInt(result ? 1 : 0);
1722 return true;
1723 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001724
Kenny Guy08488bf2014-02-21 17:40:37 +00001725 case START_USER_IN_BACKGROUND_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 int userid = data.readInt();
1728 boolean result = startUserInBackground(userid);
1729 reply.writeNoException();
1730 reply.writeInt(result ? 1 : 0);
1731 return true;
1732 }
1733
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001734 case STOP_USER_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 int userid = data.readInt();
1737 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1738 data.readStrongBinder());
1739 int result = stopUser(userid, callback);
1740 reply.writeNoException();
1741 reply.writeInt(result);
1742 return true;
1743 }
1744
Amith Yamasani52f1d752012-03-28 18:19:29 -07001745 case GET_CURRENT_USER_TRANSACTION: {
1746 data.enforceInterface(IActivityManager.descriptor);
1747 UserInfo userInfo = getCurrentUser();
1748 reply.writeNoException();
1749 userInfo.writeToParcel(reply, 0);
1750 return true;
1751 }
1752
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001753 case IS_USER_RUNNING_TRANSACTION: {
1754 data.enforceInterface(IActivityManager.descriptor);
1755 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001756 boolean orStopping = data.readInt() != 0;
1757 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001758 reply.writeNoException();
1759 reply.writeInt(result ? 1 : 0);
1760 return true;
1761 }
1762
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001763 case GET_RUNNING_USER_IDS_TRANSACTION: {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 int[] result = getRunningUserIds();
1766 reply.writeNoException();
1767 reply.writeIntArray(result);
1768 return true;
1769 }
1770
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001771 case REMOVE_SUB_TASK_TRANSACTION:
1772 {
1773 data.enforceInterface(IActivityManager.descriptor);
1774 int taskId = data.readInt();
1775 int subTaskIndex = data.readInt();
1776 boolean result = removeSubTask(taskId, subTaskIndex);
1777 reply.writeNoException();
1778 reply.writeInt(result ? 1 : 0);
1779 return true;
1780 }
1781
1782 case REMOVE_TASK_TRANSACTION:
1783 {
1784 data.enforceInterface(IActivityManager.descriptor);
1785 int taskId = data.readInt();
1786 int fl = data.readInt();
1787 boolean result = removeTask(taskId, fl);
1788 reply.writeNoException();
1789 reply.writeInt(result ? 1 : 0);
1790 return true;
1791 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001792
Jeff Sharkeya4620792011-05-20 15:29:23 -07001793 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1794 data.enforceInterface(IActivityManager.descriptor);
1795 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1796 data.readStrongBinder());
1797 registerProcessObserver(observer);
1798 return true;
1799 }
1800
1801 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1804 data.readStrongBinder());
1805 unregisterProcessObserver(observer);
1806 return true;
1807 }
1808
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001809 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1810 {
1811 data.enforceInterface(IActivityManager.descriptor);
1812 String pkg = data.readString();
1813 boolean ask = getPackageAskScreenCompat(pkg);
1814 reply.writeNoException();
1815 reply.writeInt(ask ? 1 : 0);
1816 return true;
1817 }
1818
1819 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1820 {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 String pkg = data.readString();
1823 boolean ask = data.readInt() != 0;
1824 setPackageAskScreenCompat(pkg, ask);
1825 reply.writeNoException();
1826 return true;
1827 }
1828
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001829 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 IIntentSender r = IIntentSender.Stub.asInterface(
1832 data.readStrongBinder());
1833 boolean res = isIntentSenderTargetedToPackage(r);
1834 reply.writeNoException();
1835 reply.writeInt(res ? 1 : 0);
1836 return true;
1837 }
1838
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001839 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 IIntentSender r = IIntentSender.Stub.asInterface(
1842 data.readStrongBinder());
1843 boolean res = isIntentSenderAnActivity(r);
1844 reply.writeNoException();
1845 reply.writeInt(res ? 1 : 0);
1846 return true;
1847 }
1848
Dianne Hackborn81038902012-11-26 17:04:09 -08001849 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 IIntentSender r = IIntentSender.Stub.asInterface(
1852 data.readStrongBinder());
1853 Intent intent = getIntentForIntentSender(r);
1854 reply.writeNoException();
1855 if (intent != null) {
1856 reply.writeInt(1);
1857 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1858 } else {
1859 reply.writeInt(0);
1860 }
1861 return true;
1862 }
1863
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001864 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 IIntentSender r = IIntentSender.Stub.asInterface(
1867 data.readStrongBinder());
1868 String prefix = data.readString();
1869 String tag = getTagForIntentSender(r, prefix);
1870 reply.writeNoException();
1871 reply.writeString(tag);
1872 return true;
1873 }
1874
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001875 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 Configuration config = Configuration.CREATOR.createFromParcel(data);
1878 updatePersistentConfiguration(config);
1879 reply.writeNoException();
1880 return true;
1881 }
1882
Dianne Hackbornb437e092011-08-05 17:50:29 -07001883 case GET_PROCESS_PSS_TRANSACTION: {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 int[] pids = data.createIntArray();
1886 long[] pss = getProcessPss(pids);
1887 reply.writeNoException();
1888 reply.writeLongArray(pss);
1889 return true;
1890 }
1891
Dianne Hackborn661cd522011-08-22 00:26:20 -07001892 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1893 data.enforceInterface(IActivityManager.descriptor);
1894 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1895 boolean always = data.readInt() != 0;
1896 showBootMessage(msg, always);
1897 reply.writeNoException();
1898 return true;
1899 }
1900
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001901 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 dismissKeyguardOnNextActivity();
1904 reply.writeNoException();
1905 return true;
1906 }
1907
Adam Powelldd8fab22012-03-22 17:47:27 -07001908 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 IBinder token = data.readStrongBinder();
1911 String destAffinity = data.readString();
1912 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1913 reply.writeNoException();
1914 reply.writeInt(res ? 1 : 0);
1915 return true;
1916 }
1917
1918 case NAVIGATE_UP_TO_TRANSACTION: {
1919 data.enforceInterface(IActivityManager.descriptor);
1920 IBinder token = data.readStrongBinder();
1921 Intent target = Intent.CREATOR.createFromParcel(data);
1922 int resultCode = data.readInt();
1923 Intent resultData = null;
1924 if (data.readInt() != 0) {
1925 resultData = Intent.CREATOR.createFromParcel(data);
1926 }
1927 boolean res = navigateUpTo(token, target, resultCode, resultData);
1928 reply.writeNoException();
1929 reply.writeInt(res ? 1 : 0);
1930 return true;
1931 }
1932
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001933 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 int res = getLaunchedFromUid(token);
1937 reply.writeNoException();
1938 reply.writeInt(res);
1939 return true;
1940 }
1941
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001942 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IBinder token = data.readStrongBinder();
1945 String res = getLaunchedFromPackage(token);
1946 reply.writeNoException();
1947 reply.writeString(res);
1948 return true;
1949 }
1950
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001951 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1954 data.readStrongBinder());
1955 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001956 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001957 return true;
1958 }
1959
1960 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1963 data.readStrongBinder());
1964 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001965 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001966 return true;
1967 }
1968
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001969 case REQUEST_BUG_REPORT_TRANSACTION: {
1970 data.enforceInterface(IActivityManager.descriptor);
1971 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001972 reply.writeNoException();
1973 return true;
1974 }
1975
1976 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 int pid = data.readInt();
1979 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001980 String reason = data.readString();
1981 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001982 reply.writeNoException();
1983 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001984 return true;
1985 }
1986
Adam Skorydfc7fd72013-08-05 19:23:41 -07001987 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001988 data.enforceInterface(IActivityManager.descriptor);
1989 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001990 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001991 reply.writeNoException();
1992 reply.writeBundle(res);
1993 return true;
1994 }
1995
Adam Skorydfc7fd72013-08-05 19:23:41 -07001996 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001997 data.enforceInterface(IActivityManager.descriptor);
1998 IBinder token = data.readStrongBinder();
1999 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002000 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002001 reply.writeNoException();
2002 return true;
2003 }
2004
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002005 case KILL_UID_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 int uid = data.readInt();
2008 String reason = data.readString();
2009 killUid(uid, reason);
2010 reply.writeNoException();
2011 return true;
2012 }
2013
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002014 case HANG_TRANSACTION: {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 IBinder who = data.readStrongBinder();
2017 boolean allowRestart = data.readInt() != 0;
2018 hang(who, allowRestart);
2019 reply.writeNoException();
2020 return true;
2021 }
2022
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002023 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2024 data.enforceInterface(IActivityManager.descriptor);
2025 IBinder token = data.readStrongBinder();
2026 reportActivityFullyDrawn(token);
2027 reply.writeNoException();
2028 return true;
2029 }
2030
Craig Mautner5eda9b32013-07-02 11:58:16 -07002031 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 IBinder token = data.readStrongBinder();
2034 notifyActivityDrawn(token);
2035 reply.writeNoException();
2036 return true;
2037 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002038
2039 case RESTART_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 restart();
2042 reply.writeNoException();
2043 return true;
2044 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002045
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002046 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 performIdleMaintenance();
2049 reply.writeNoException();
2050 return true;
2051 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002052
2053 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 IBinder parentActivityToken = data.readStrongBinder();
2056 IActivityContainerCallback callback =
2057 (IActivityContainerCallback) data.readStrongBinder();
2058 IActivityContainer activityContainer =
2059 createActivityContainer(parentActivityToken, callback);
2060 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002061 if (activityContainer != null) {
2062 reply.writeInt(1);
2063 reply.writeStrongBinder(activityContainer.asBinder());
2064 } else {
2065 reply.writeInt(0);
2066 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002067 return true;
2068 }
2069
Craig Mautner95da1082014-02-24 17:54:35 -08002070 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 IActivityContainer activityContainer =
2073 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2074 deleteActivityContainer(activityContainer);
2075 reply.writeNoException();
2076 return true;
2077 }
2078
Craig Mautnere0a38842013-12-16 16:14:02 -08002079 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2080 data.enforceInterface(IActivityManager.descriptor);
2081 IBinder activityToken = data.readStrongBinder();
2082 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2083 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002084 if (activityContainer != null) {
2085 reply.writeInt(1);
2086 reply.writeStrongBinder(activityContainer.asBinder());
2087 } else {
2088 reply.writeInt(0);
2089 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002090 return true;
2091 }
2092
Craig Mautner4a1cb222013-12-04 16:14:06 -08002093 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2094 data.enforceInterface(IActivityManager.descriptor);
2095 IBinder homeActivityToken = getHomeActivityToken();
2096 reply.writeNoException();
2097 reply.writeStrongBinder(homeActivityToken);
2098 return true;
2099 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002100
2101 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2102 data.enforceInterface(IActivityManager.descriptor);
2103 final int taskId = data.readInt();
2104 startLockTaskMode(taskId);
2105 reply.writeNoException();
2106 return true;
2107 }
2108
2109 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2110 data.enforceInterface(IActivityManager.descriptor);
2111 IBinder token = data.readStrongBinder();
2112 startLockTaskMode(token);
2113 reply.writeNoException();
2114 return true;
2115 }
2116
2117 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 stopLockTaskMode();
2120 reply.writeNoException();
2121 return true;
2122 }
2123
2124 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 final boolean isInLockTaskMode = isInLockTaskMode();
2127 reply.writeNoException();
2128 reply.writeInt(isInLockTaskMode ? 1 : 0);
2129 return true;
2130 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002131 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002132
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002133 return super.onTransact(code, data, reply, flags);
2134 }
2135
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002136 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002137 return this;
2138 }
2139
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002140 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2141 protected IActivityManager create() {
2142 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002143 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002144 Log.v("ActivityManager", "default service binder = " + b);
2145 }
2146 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002147 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002148 Log.v("ActivityManager", "default service = " + am);
2149 }
2150 return am;
2151 }
2152 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002153}
2154
2155class ActivityManagerProxy implements IActivityManager
2156{
2157 public ActivityManagerProxy(IBinder remote)
2158 {
2159 mRemote = remote;
2160 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002161
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002162 public IBinder asBinder()
2163 {
2164 return mRemote;
2165 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002166
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002167 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002168 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2169 int startFlags, String profileFile,
2170 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002171 Parcel data = Parcel.obtain();
2172 Parcel reply = Parcel.obtain();
2173 data.writeInterfaceToken(IActivityManager.descriptor);
2174 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002175 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002176 intent.writeToParcel(data, 0);
2177 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002178 data.writeStrongBinder(resultTo);
2179 data.writeString(resultWho);
2180 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002181 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002182 data.writeString(profileFile);
2183 if (profileFd != null) {
2184 data.writeInt(1);
2185 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2186 } else {
2187 data.writeInt(0);
2188 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002189 if (options != null) {
2190 data.writeInt(1);
2191 options.writeToParcel(data, 0);
2192 } else {
2193 data.writeInt(0);
2194 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2196 reply.readException();
2197 int result = reply.readInt();
2198 reply.recycle();
2199 data.recycle();
2200 return result;
2201 }
Amith Yamasani82644082012-08-03 13:09:11 -07002202
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002203 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002204 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2205 int startFlags, String profileFile,
2206 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2207 Parcel data = Parcel.obtain();
2208 Parcel reply = Parcel.obtain();
2209 data.writeInterfaceToken(IActivityManager.descriptor);
2210 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002211 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002212 intent.writeToParcel(data, 0);
2213 data.writeString(resolvedType);
2214 data.writeStrongBinder(resultTo);
2215 data.writeString(resultWho);
2216 data.writeInt(requestCode);
2217 data.writeInt(startFlags);
2218 data.writeString(profileFile);
2219 if (profileFd != null) {
2220 data.writeInt(1);
2221 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2222 } else {
2223 data.writeInt(0);
2224 }
2225 if (options != null) {
2226 data.writeInt(1);
2227 options.writeToParcel(data, 0);
2228 } else {
2229 data.writeInt(0);
2230 }
2231 data.writeInt(userId);
2232 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2233 reply.readException();
2234 int result = reply.readInt();
2235 reply.recycle();
2236 data.recycle();
2237 return result;
2238 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002239 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2240 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002241 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002242 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002243 Parcel data = Parcel.obtain();
2244 Parcel reply = Parcel.obtain();
2245 data.writeInterfaceToken(IActivityManager.descriptor);
2246 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002247 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002248 intent.writeToParcel(data, 0);
2249 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002250 data.writeStrongBinder(resultTo);
2251 data.writeString(resultWho);
2252 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002253 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002254 data.writeString(profileFile);
2255 if (profileFd != null) {
2256 data.writeInt(1);
2257 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2258 } else {
2259 data.writeInt(0);
2260 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002261 if (options != null) {
2262 data.writeInt(1);
2263 options.writeToParcel(data, 0);
2264 } else {
2265 data.writeInt(0);
2266 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002267 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002268 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2269 reply.readException();
2270 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2271 reply.recycle();
2272 data.recycle();
2273 return result;
2274 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002275 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2276 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002277 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002278 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002279 Parcel data = Parcel.obtain();
2280 Parcel reply = Parcel.obtain();
2281 data.writeInterfaceToken(IActivityManager.descriptor);
2282 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002283 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002284 intent.writeToParcel(data, 0);
2285 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002286 data.writeStrongBinder(resultTo);
2287 data.writeString(resultWho);
2288 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002289 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002290 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002291 if (options != null) {
2292 data.writeInt(1);
2293 options.writeToParcel(data, 0);
2294 } else {
2295 data.writeInt(0);
2296 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002297 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002298 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2299 reply.readException();
2300 int result = reply.readInt();
2301 reply.recycle();
2302 data.recycle();
2303 return result;
2304 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002305 public int startActivityIntentSender(IApplicationThread caller,
2306 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002307 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002308 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002309 Parcel data = Parcel.obtain();
2310 Parcel reply = Parcel.obtain();
2311 data.writeInterfaceToken(IActivityManager.descriptor);
2312 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2313 intent.writeToParcel(data, 0);
2314 if (fillInIntent != null) {
2315 data.writeInt(1);
2316 fillInIntent.writeToParcel(data, 0);
2317 } else {
2318 data.writeInt(0);
2319 }
2320 data.writeString(resolvedType);
2321 data.writeStrongBinder(resultTo);
2322 data.writeString(resultWho);
2323 data.writeInt(requestCode);
2324 data.writeInt(flagsMask);
2325 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002326 if (options != null) {
2327 data.writeInt(1);
2328 options.writeToParcel(data, 0);
2329 } else {
2330 data.writeInt(0);
2331 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002332 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002333 reply.readException();
2334 int result = reply.readInt();
2335 reply.recycle();
2336 data.recycle();
2337 return result;
2338 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002340 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002341 Parcel data = Parcel.obtain();
2342 Parcel reply = Parcel.obtain();
2343 data.writeInterfaceToken(IActivityManager.descriptor);
2344 data.writeStrongBinder(callingActivity);
2345 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002346 if (options != null) {
2347 data.writeInt(1);
2348 options.writeToParcel(data, 0);
2349 } else {
2350 data.writeInt(0);
2351 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002352 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2353 reply.readException();
2354 int result = reply.readInt();
2355 reply.recycle();
2356 data.recycle();
2357 return result != 0;
2358 }
2359 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2360 throws RemoteException {
2361 Parcel data = Parcel.obtain();
2362 Parcel reply = Parcel.obtain();
2363 data.writeInterfaceToken(IActivityManager.descriptor);
2364 data.writeStrongBinder(token);
2365 data.writeInt(resultCode);
2366 if (resultData != null) {
2367 data.writeInt(1);
2368 resultData.writeToParcel(data, 0);
2369 } else {
2370 data.writeInt(0);
2371 }
2372 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2373 reply.readException();
2374 boolean res = reply.readInt() != 0;
2375 data.recycle();
2376 reply.recycle();
2377 return res;
2378 }
2379 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2380 {
2381 Parcel data = Parcel.obtain();
2382 Parcel reply = Parcel.obtain();
2383 data.writeInterfaceToken(IActivityManager.descriptor);
2384 data.writeStrongBinder(token);
2385 data.writeString(resultWho);
2386 data.writeInt(requestCode);
2387 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2388 reply.readException();
2389 data.recycle();
2390 reply.recycle();
2391 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002392 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2393 Parcel data = Parcel.obtain();
2394 Parcel reply = Parcel.obtain();
2395 data.writeInterfaceToken(IActivityManager.descriptor);
2396 data.writeStrongBinder(token);
2397 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2398 reply.readException();
2399 boolean res = reply.readInt() != 0;
2400 data.recycle();
2401 reply.recycle();
2402 return res;
2403 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002404 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2405 Parcel data = Parcel.obtain();
2406 Parcel reply = Parcel.obtain();
2407 data.writeInterfaceToken(IActivityManager.descriptor);
2408 data.writeStrongBinder(token);
2409 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2410 reply.readException();
2411 boolean res = reply.readInt() != 0;
2412 data.recycle();
2413 reply.recycle();
2414 return res;
2415 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002416 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002417 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002418 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002419 {
2420 Parcel data = Parcel.obtain();
2421 Parcel reply = Parcel.obtain();
2422 data.writeInterfaceToken(IActivityManager.descriptor);
2423 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002424 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002425 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2426 filter.writeToParcel(data, 0);
2427 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002428 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002429 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2430 reply.readException();
2431 Intent intent = null;
2432 int haveIntent = reply.readInt();
2433 if (haveIntent != 0) {
2434 intent = Intent.CREATOR.createFromParcel(reply);
2435 }
2436 reply.recycle();
2437 data.recycle();
2438 return intent;
2439 }
2440 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2441 {
2442 Parcel data = Parcel.obtain();
2443 Parcel reply = Parcel.obtain();
2444 data.writeInterfaceToken(IActivityManager.descriptor);
2445 data.writeStrongBinder(receiver.asBinder());
2446 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2447 reply.readException();
2448 data.recycle();
2449 reply.recycle();
2450 }
2451 public int broadcastIntent(IApplicationThread caller,
2452 Intent intent, String resolvedType, IIntentReceiver resultTo,
2453 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002454 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002455 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002456 {
2457 Parcel data = Parcel.obtain();
2458 Parcel reply = Parcel.obtain();
2459 data.writeInterfaceToken(IActivityManager.descriptor);
2460 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2461 intent.writeToParcel(data, 0);
2462 data.writeString(resolvedType);
2463 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2464 data.writeInt(resultCode);
2465 data.writeString(resultData);
2466 data.writeBundle(map);
2467 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002468 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002469 data.writeInt(serialized ? 1 : 0);
2470 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002471 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002472 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2473 reply.readException();
2474 int res = reply.readInt();
2475 reply.recycle();
2476 data.recycle();
2477 return res;
2478 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002479 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2480 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002481 {
2482 Parcel data = Parcel.obtain();
2483 Parcel reply = Parcel.obtain();
2484 data.writeInterfaceToken(IActivityManager.descriptor);
2485 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2486 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002487 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2489 reply.readException();
2490 data.recycle();
2491 reply.recycle();
2492 }
2493 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2494 {
2495 Parcel data = Parcel.obtain();
2496 Parcel reply = Parcel.obtain();
2497 data.writeInterfaceToken(IActivityManager.descriptor);
2498 data.writeStrongBinder(who);
2499 data.writeInt(resultCode);
2500 data.writeString(resultData);
2501 data.writeBundle(map);
2502 data.writeInt(abortBroadcast ? 1 : 0);
2503 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2504 reply.readException();
2505 data.recycle();
2506 reply.recycle();
2507 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002508 public void attachApplication(IApplicationThread app) throws RemoteException
2509 {
2510 Parcel data = Parcel.obtain();
2511 Parcel reply = Parcel.obtain();
2512 data.writeInterfaceToken(IActivityManager.descriptor);
2513 data.writeStrongBinder(app.asBinder());
2514 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2515 reply.readException();
2516 data.recycle();
2517 reply.recycle();
2518 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002519 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2520 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002521 {
2522 Parcel data = Parcel.obtain();
2523 Parcel reply = Parcel.obtain();
2524 data.writeInterfaceToken(IActivityManager.descriptor);
2525 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002526 if (config != null) {
2527 data.writeInt(1);
2528 config.writeToParcel(data, 0);
2529 } else {
2530 data.writeInt(0);
2531 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002532 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002533 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2534 reply.readException();
2535 data.recycle();
2536 reply.recycle();
2537 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002538 public void activityResumed(IBinder token) throws RemoteException
2539 {
2540 Parcel data = Parcel.obtain();
2541 Parcel reply = Parcel.obtain();
2542 data.writeInterfaceToken(IActivityManager.descriptor);
2543 data.writeStrongBinder(token);
2544 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2545 reply.readException();
2546 data.recycle();
2547 reply.recycle();
2548 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002549 public void activityPaused(IBinder token) throws RemoteException
2550 {
2551 Parcel data = Parcel.obtain();
2552 Parcel reply = Parcel.obtain();
2553 data.writeInterfaceToken(IActivityManager.descriptor);
2554 data.writeStrongBinder(token);
2555 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2556 reply.readException();
2557 data.recycle();
2558 reply.recycle();
2559 }
2560 public void activityStopped(IBinder token, Bundle state,
2561 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002562 {
2563 Parcel data = Parcel.obtain();
2564 Parcel reply = Parcel.obtain();
2565 data.writeInterfaceToken(IActivityManager.descriptor);
2566 data.writeStrongBinder(token);
2567 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002568 if (thumbnail != null) {
2569 data.writeInt(1);
2570 thumbnail.writeToParcel(data, 0);
2571 } else {
2572 data.writeInt(0);
2573 }
2574 TextUtils.writeToParcel(description, data, 0);
2575 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2576 reply.readException();
2577 data.recycle();
2578 reply.recycle();
2579 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002580 public void activitySlept(IBinder token) throws RemoteException
2581 {
2582 Parcel data = Parcel.obtain();
2583 Parcel reply = Parcel.obtain();
2584 data.writeInterfaceToken(IActivityManager.descriptor);
2585 data.writeStrongBinder(token);
2586 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2587 reply.readException();
2588 data.recycle();
2589 reply.recycle();
2590 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002591 public void activityDestroyed(IBinder token) throws RemoteException
2592 {
2593 Parcel data = Parcel.obtain();
2594 Parcel reply = Parcel.obtain();
2595 data.writeInterfaceToken(IActivityManager.descriptor);
2596 data.writeStrongBinder(token);
2597 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2598 reply.readException();
2599 data.recycle();
2600 reply.recycle();
2601 }
2602 public String getCallingPackage(IBinder token) throws RemoteException
2603 {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 data.writeStrongBinder(token);
2608 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2609 reply.readException();
2610 String res = reply.readString();
2611 data.recycle();
2612 reply.recycle();
2613 return res;
2614 }
2615 public ComponentName getCallingActivity(IBinder token)
2616 throws RemoteException {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(token);
2621 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2622 reply.readException();
2623 ComponentName res = ComponentName.readFromParcel(reply);
2624 data.recycle();
2625 reply.recycle();
2626 return res;
2627 }
2628 public List getTasks(int maxNum, int flags,
2629 IThumbnailReceiver receiver) throws RemoteException {
2630 Parcel data = Parcel.obtain();
2631 Parcel reply = Parcel.obtain();
2632 data.writeInterfaceToken(IActivityManager.descriptor);
2633 data.writeInt(maxNum);
2634 data.writeInt(flags);
2635 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2636 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2637 reply.readException();
2638 ArrayList list = null;
2639 int N = reply.readInt();
2640 if (N >= 0) {
2641 list = new ArrayList();
2642 while (N > 0) {
2643 ActivityManager.RunningTaskInfo info =
2644 ActivityManager.RunningTaskInfo.CREATOR
2645 .createFromParcel(reply);
2646 list.add(info);
2647 N--;
2648 }
2649 }
2650 data.recycle();
2651 reply.recycle();
2652 return list;
2653 }
2654 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002655 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 data.writeInt(maxNum);
2660 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002661 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002662 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2663 reply.readException();
2664 ArrayList<ActivityManager.RecentTaskInfo> list
2665 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2666 data.recycle();
2667 reply.recycle();
2668 return list;
2669 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002670 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002671 Parcel data = Parcel.obtain();
2672 Parcel reply = Parcel.obtain();
2673 data.writeInterfaceToken(IActivityManager.descriptor);
2674 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002675 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002676 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002677 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002678 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002679 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002680 }
2681 data.recycle();
2682 reply.recycle();
2683 return bm;
2684 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002685 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 data.writeInt(id);
2690 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2691 reply.readException();
2692 Bitmap bm = null;
2693 if (reply.readInt() != 0) {
2694 bm = Bitmap.CREATOR.createFromParcel(reply);
2695 }
2696 data.recycle();
2697 reply.recycle();
2698 return bm;
2699 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002700 public List getServices(int maxNum, int flags) throws RemoteException {
2701 Parcel data = Parcel.obtain();
2702 Parcel reply = Parcel.obtain();
2703 data.writeInterfaceToken(IActivityManager.descriptor);
2704 data.writeInt(maxNum);
2705 data.writeInt(flags);
2706 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2707 reply.readException();
2708 ArrayList list = null;
2709 int N = reply.readInt();
2710 if (N >= 0) {
2711 list = new ArrayList();
2712 while (N > 0) {
2713 ActivityManager.RunningServiceInfo info =
2714 ActivityManager.RunningServiceInfo.CREATOR
2715 .createFromParcel(reply);
2716 list.add(info);
2717 N--;
2718 }
2719 }
2720 data.recycle();
2721 reply.recycle();
2722 return list;
2723 }
2724 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2725 throws RemoteException {
2726 Parcel data = Parcel.obtain();
2727 Parcel reply = Parcel.obtain();
2728 data.writeInterfaceToken(IActivityManager.descriptor);
2729 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2730 reply.readException();
2731 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2732 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2733 data.recycle();
2734 reply.recycle();
2735 return list;
2736 }
2737 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2738 throws RemoteException {
2739 Parcel data = Parcel.obtain();
2740 Parcel reply = Parcel.obtain();
2741 data.writeInterfaceToken(IActivityManager.descriptor);
2742 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2743 reply.readException();
2744 ArrayList<ActivityManager.RunningAppProcessInfo> list
2745 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2746 data.recycle();
2747 reply.recycle();
2748 return list;
2749 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002750 public List<ApplicationInfo> getRunningExternalApplications()
2751 throws RemoteException {
2752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 ArrayList<ApplicationInfo> list
2758 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2759 data.recycle();
2760 reply.recycle();
2761 return list;
2762 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002763 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002764 {
2765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002769 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002770 if (options != null) {
2771 data.writeInt(1);
2772 options.writeToParcel(data, 0);
2773 } else {
2774 data.writeInt(0);
2775 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002776 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2777 reply.readException();
2778 data.recycle();
2779 reply.recycle();
2780 }
2781 public void moveTaskToBack(int task) throws RemoteException
2782 {
2783 Parcel data = Parcel.obtain();
2784 Parcel reply = Parcel.obtain();
2785 data.writeInterfaceToken(IActivityManager.descriptor);
2786 data.writeInt(task);
2787 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2788 reply.readException();
2789 data.recycle();
2790 reply.recycle();
2791 }
2792 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2793 throws RemoteException {
2794 Parcel data = Parcel.obtain();
2795 Parcel reply = Parcel.obtain();
2796 data.writeInterfaceToken(IActivityManager.descriptor);
2797 data.writeStrongBinder(token);
2798 data.writeInt(nonRoot ? 1 : 0);
2799 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2800 reply.readException();
2801 boolean res = reply.readInt() != 0;
2802 data.recycle();
2803 reply.recycle();
2804 return res;
2805 }
2806 public void moveTaskBackwards(int task) throws RemoteException
2807 {
2808 Parcel data = Parcel.obtain();
2809 Parcel reply = Parcel.obtain();
2810 data.writeInterfaceToken(IActivityManager.descriptor);
2811 data.writeInt(task);
2812 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2813 reply.readException();
2814 data.recycle();
2815 reply.recycle();
2816 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002817 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002818 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2819 {
2820 Parcel data = Parcel.obtain();
2821 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002822 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002823 data.writeInt(taskId);
2824 data.writeInt(stackId);
2825 data.writeInt(toTop ? 1 : 0);
2826 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2827 reply.readException();
2828 data.recycle();
2829 reply.recycle();
2830 }
2831 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002832 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002833 {
2834 Parcel data = Parcel.obtain();
2835 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002836 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002837 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002838 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002839 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002840 reply.readException();
2841 data.recycle();
2842 reply.recycle();
2843 }
Craig Mautner967212c2013-04-13 21:10:58 -07002844 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002845 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002846 {
2847 Parcel data = Parcel.obtain();
2848 Parcel reply = Parcel.obtain();
2849 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002850 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002851 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002852 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002853 data.recycle();
2854 reply.recycle();
2855 return list;
2856 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002857 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002858 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002863 data.writeInt(stackId);
2864 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002865 reply.readException();
2866 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002867 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002868 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002869 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002870 }
2871 data.recycle();
2872 reply.recycle();
2873 return info;
2874 }
2875 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002876 public boolean isInHomeStack(int taskId) throws RemoteException {
2877 Parcel data = Parcel.obtain();
2878 Parcel reply = Parcel.obtain();
2879 data.writeInterfaceToken(IActivityManager.descriptor);
2880 data.writeInt(taskId);
2881 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2882 reply.readException();
2883 boolean isInHomeStack = reply.readInt() > 0;
2884 data.recycle();
2885 reply.recycle();
2886 return isInHomeStack;
2887 }
2888 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002889 public void setFocusedStack(int stackId) throws RemoteException
2890 {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 data.writeInt(stackId);
2895 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2896 reply.readException();
2897 data.recycle();
2898 reply.recycle();
2899 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002900 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2901 {
2902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeStrongBinder(token);
2906 data.writeInt(onlyRoot ? 1 : 0);
2907 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2908 reply.readException();
2909 int res = reply.readInt();
2910 data.recycle();
2911 reply.recycle();
2912 return res;
2913 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002914 public void reportThumbnail(IBinder token,
2915 Bitmap thumbnail, CharSequence description) throws RemoteException
2916 {
2917 Parcel data = Parcel.obtain();
2918 Parcel reply = Parcel.obtain();
2919 data.writeInterfaceToken(IActivityManager.descriptor);
2920 data.writeStrongBinder(token);
2921 if (thumbnail != null) {
2922 data.writeInt(1);
2923 thumbnail.writeToParcel(data, 0);
2924 } else {
2925 data.writeInt(0);
2926 }
2927 TextUtils.writeToParcel(description, data, 0);
2928 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2929 reply.readException();
2930 data.recycle();
2931 reply.recycle();
2932 }
2933 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002934 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 Parcel data = Parcel.obtain();
2936 Parcel reply = Parcel.obtain();
2937 data.writeInterfaceToken(IActivityManager.descriptor);
2938 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2939 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002940 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002941 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002942 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2943 reply.readException();
2944 int res = reply.readInt();
2945 ContentProviderHolder cph = null;
2946 if (res != 0) {
2947 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2948 }
2949 data.recycle();
2950 reply.recycle();
2951 return cph;
2952 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002953 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2954 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
2957 data.writeInterfaceToken(IActivityManager.descriptor);
2958 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002959 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002960 data.writeStrongBinder(token);
2961 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2962 reply.readException();
2963 int res = reply.readInt();
2964 ContentProviderHolder cph = null;
2965 if (res != 0) {
2966 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2967 }
2968 data.recycle();
2969 reply.recycle();
2970 return cph;
2971 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002972 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002973 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002974 {
2975 Parcel data = Parcel.obtain();
2976 Parcel reply = Parcel.obtain();
2977 data.writeInterfaceToken(IActivityManager.descriptor);
2978 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2979 data.writeTypedList(providers);
2980 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 data.recycle();
2983 reply.recycle();
2984 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002985 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2986 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002990 data.writeStrongBinder(connection);
2991 data.writeInt(stable);
2992 data.writeInt(unstable);
2993 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2994 reply.readException();
2995 boolean res = reply.readInt() != 0;
2996 data.recycle();
2997 reply.recycle();
2998 return res;
2999 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003000
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003001 public void unstableProviderDied(IBinder connection) throws RemoteException {
3002 Parcel data = Parcel.obtain();
3003 Parcel reply = Parcel.obtain();
3004 data.writeInterfaceToken(IActivityManager.descriptor);
3005 data.writeStrongBinder(connection);
3006 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 data.recycle();
3009 reply.recycle();
3010 }
3011
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003012 @Override
3013 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3014 Parcel data = Parcel.obtain();
3015 Parcel reply = Parcel.obtain();
3016 data.writeInterfaceToken(IActivityManager.descriptor);
3017 data.writeStrongBinder(connection);
3018 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3019 reply.readException();
3020 data.recycle();
3021 reply.recycle();
3022 }
3023
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003024 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3025 Parcel data = Parcel.obtain();
3026 Parcel reply = Parcel.obtain();
3027 data.writeInterfaceToken(IActivityManager.descriptor);
3028 data.writeStrongBinder(connection);
3029 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003030 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 data.recycle();
3033 reply.recycle();
3034 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003035
3036 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 data.writeString(name);
3041 data.writeStrongBinder(token);
3042 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 data.recycle();
3045 reply.recycle();
3046 }
3047
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003048 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3049 throws RemoteException
3050 {
3051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 service.writeToParcel(data, 0);
3055 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3058 data.recycle();
3059 reply.recycle();
3060 return res;
3061 }
3062
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003063 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003064 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003065 {
3066 Parcel data = Parcel.obtain();
3067 Parcel reply = Parcel.obtain();
3068 data.writeInterfaceToken(IActivityManager.descriptor);
3069 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3070 service.writeToParcel(data, 0);
3071 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003072 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003073 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3074 reply.readException();
3075 ComponentName res = ComponentName.readFromParcel(reply);
3076 data.recycle();
3077 reply.recycle();
3078 return res;
3079 }
3080 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003081 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003082 {
3083 Parcel data = Parcel.obtain();
3084 Parcel reply = Parcel.obtain();
3085 data.writeInterfaceToken(IActivityManager.descriptor);
3086 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3087 service.writeToParcel(data, 0);
3088 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003089 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003090 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3091 reply.readException();
3092 int res = reply.readInt();
3093 reply.recycle();
3094 data.recycle();
3095 return res;
3096 }
3097 public boolean stopServiceToken(ComponentName className, IBinder token,
3098 int startId) throws RemoteException {
3099 Parcel data = Parcel.obtain();
3100 Parcel reply = Parcel.obtain();
3101 data.writeInterfaceToken(IActivityManager.descriptor);
3102 ComponentName.writeToParcel(className, data);
3103 data.writeStrongBinder(token);
3104 data.writeInt(startId);
3105 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3106 reply.readException();
3107 boolean res = reply.readInt() != 0;
3108 data.recycle();
3109 reply.recycle();
3110 return res;
3111 }
3112 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003113 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003114 Parcel data = Parcel.obtain();
3115 Parcel reply = Parcel.obtain();
3116 data.writeInterfaceToken(IActivityManager.descriptor);
3117 ComponentName.writeToParcel(className, data);
3118 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003119 data.writeInt(id);
3120 if (notification != null) {
3121 data.writeInt(1);
3122 notification.writeToParcel(data, 0);
3123 } else {
3124 data.writeInt(0);
3125 }
3126 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003127 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3128 reply.readException();
3129 data.recycle();
3130 reply.recycle();
3131 }
3132 public int bindService(IApplicationThread caller, IBinder token,
3133 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003134 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3139 data.writeStrongBinder(token);
3140 service.writeToParcel(data, 0);
3141 data.writeString(resolvedType);
3142 data.writeStrongBinder(connection.asBinder());
3143 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003144 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3146 reply.readException();
3147 int res = reply.readInt();
3148 data.recycle();
3149 reply.recycle();
3150 return res;
3151 }
3152 public boolean unbindService(IServiceConnection connection) throws RemoteException
3153 {
3154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 data.writeStrongBinder(connection.asBinder());
3158 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3159 reply.readException();
3160 boolean res = reply.readInt() != 0;
3161 data.recycle();
3162 reply.recycle();
3163 return res;
3164 }
3165
3166 public void publishService(IBinder token,
3167 Intent intent, IBinder service) throws RemoteException {
3168 Parcel data = Parcel.obtain();
3169 Parcel reply = Parcel.obtain();
3170 data.writeInterfaceToken(IActivityManager.descriptor);
3171 data.writeStrongBinder(token);
3172 intent.writeToParcel(data, 0);
3173 data.writeStrongBinder(service);
3174 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3175 reply.readException();
3176 data.recycle();
3177 reply.recycle();
3178 }
3179
3180 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3181 throws RemoteException {
3182 Parcel data = Parcel.obtain();
3183 Parcel reply = Parcel.obtain();
3184 data.writeInterfaceToken(IActivityManager.descriptor);
3185 data.writeStrongBinder(token);
3186 intent.writeToParcel(data, 0);
3187 data.writeInt(doRebind ? 1 : 0);
3188 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3189 reply.readException();
3190 data.recycle();
3191 reply.recycle();
3192 }
3193
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003194 public void serviceDoneExecuting(IBinder token, int type, int startId,
3195 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003196 Parcel data = Parcel.obtain();
3197 Parcel reply = Parcel.obtain();
3198 data.writeInterfaceToken(IActivityManager.descriptor);
3199 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003200 data.writeInt(type);
3201 data.writeInt(startId);
3202 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003203 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3204 reply.readException();
3205 data.recycle();
3206 reply.recycle();
3207 }
3208
3209 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3210 Parcel data = Parcel.obtain();
3211 Parcel reply = Parcel.obtain();
3212 data.writeInterfaceToken(IActivityManager.descriptor);
3213 service.writeToParcel(data, 0);
3214 data.writeString(resolvedType);
3215 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3216 reply.readException();
3217 IBinder binder = reply.readStrongBinder();
3218 reply.recycle();
3219 data.recycle();
3220 return binder;
3221 }
3222
Christopher Tate181fafa2009-05-14 11:12:14 -07003223 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3224 throws RemoteException {
3225 Parcel data = Parcel.obtain();
3226 Parcel reply = Parcel.obtain();
3227 data.writeInterfaceToken(IActivityManager.descriptor);
3228 app.writeToParcel(data, 0);
3229 data.writeInt(backupRestoreMode);
3230 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3231 reply.readException();
3232 boolean success = reply.readInt() != 0;
3233 reply.recycle();
3234 data.recycle();
3235 return success;
3236 }
3237
Christopher Tate346acb12012-10-15 19:20:25 -07003238 public void clearPendingBackup() throws RemoteException {
3239 Parcel data = Parcel.obtain();
3240 Parcel reply = Parcel.obtain();
3241 data.writeInterfaceToken(IActivityManager.descriptor);
3242 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3243 reply.recycle();
3244 data.recycle();
3245 }
3246
Christopher Tate181fafa2009-05-14 11:12:14 -07003247 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeString(packageName);
3252 data.writeStrongBinder(agent);
3253 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3254 reply.recycle();
3255 data.recycle();
3256 }
3257
3258 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3259 Parcel data = Parcel.obtain();
3260 Parcel reply = Parcel.obtain();
3261 data.writeInterfaceToken(IActivityManager.descriptor);
3262 app.writeToParcel(data, 0);
3263 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3264 reply.readException();
3265 reply.recycle();
3266 data.recycle();
3267 }
3268
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003270 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3271 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 ComponentName.writeToParcel(className, data);
3276 data.writeString(profileFile);
3277 data.writeInt(flags);
3278 data.writeBundle(arguments);
3279 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003280 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003281 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003282 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3283 reply.readException();
3284 boolean res = reply.readInt() != 0;
3285 reply.recycle();
3286 data.recycle();
3287 return res;
3288 }
3289
3290 public void finishInstrumentation(IApplicationThread target,
3291 int resultCode, Bundle results) throws RemoteException {
3292 Parcel data = Parcel.obtain();
3293 Parcel reply = Parcel.obtain();
3294 data.writeInterfaceToken(IActivityManager.descriptor);
3295 data.writeStrongBinder(target != null ? target.asBinder() : null);
3296 data.writeInt(resultCode);
3297 data.writeBundle(results);
3298 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3299 reply.readException();
3300 data.recycle();
3301 reply.recycle();
3302 }
3303 public Configuration getConfiguration() throws RemoteException
3304 {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3309 reply.readException();
3310 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3311 reply.recycle();
3312 data.recycle();
3313 return res;
3314 }
3315 public void updateConfiguration(Configuration values) throws RemoteException
3316 {
3317 Parcel data = Parcel.obtain();
3318 Parcel reply = Parcel.obtain();
3319 data.writeInterfaceToken(IActivityManager.descriptor);
3320 values.writeToParcel(data, 0);
3321 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3322 reply.readException();
3323 data.recycle();
3324 reply.recycle();
3325 }
3326 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3327 throws RemoteException {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeStrongBinder(token);
3332 data.writeInt(requestedOrientation);
3333 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3334 reply.readException();
3335 data.recycle();
3336 reply.recycle();
3337 }
3338 public int getRequestedOrientation(IBinder token) throws RemoteException {
3339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 data.writeStrongBinder(token);
3343 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3344 reply.readException();
3345 int res = reply.readInt();
3346 data.recycle();
3347 reply.recycle();
3348 return res;
3349 }
3350 public ComponentName getActivityClassForToken(IBinder token)
3351 throws RemoteException {
3352 Parcel data = Parcel.obtain();
3353 Parcel reply = Parcel.obtain();
3354 data.writeInterfaceToken(IActivityManager.descriptor);
3355 data.writeStrongBinder(token);
3356 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3357 reply.readException();
3358 ComponentName res = ComponentName.readFromParcel(reply);
3359 data.recycle();
3360 reply.recycle();
3361 return res;
3362 }
3363 public String getPackageForToken(IBinder token) throws RemoteException
3364 {
3365 Parcel data = Parcel.obtain();
3366 Parcel reply = Parcel.obtain();
3367 data.writeInterfaceToken(IActivityManager.descriptor);
3368 data.writeStrongBinder(token);
3369 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3370 reply.readException();
3371 String res = reply.readString();
3372 data.recycle();
3373 reply.recycle();
3374 return res;
3375 }
3376 public IIntentSender getIntentSender(int type,
3377 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003378 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003379 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003380 Parcel data = Parcel.obtain();
3381 Parcel reply = Parcel.obtain();
3382 data.writeInterfaceToken(IActivityManager.descriptor);
3383 data.writeInt(type);
3384 data.writeString(packageName);
3385 data.writeStrongBinder(token);
3386 data.writeString(resultWho);
3387 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003388 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003389 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003390 data.writeTypedArray(intents, 0);
3391 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003392 } else {
3393 data.writeInt(0);
3394 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003395 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003396 if (options != null) {
3397 data.writeInt(1);
3398 options.writeToParcel(data, 0);
3399 } else {
3400 data.writeInt(0);
3401 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003402 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003403 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3404 reply.readException();
3405 IIntentSender res = IIntentSender.Stub.asInterface(
3406 reply.readStrongBinder());
3407 data.recycle();
3408 reply.recycle();
3409 return res;
3410 }
3411 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3412 Parcel data = Parcel.obtain();
3413 Parcel reply = Parcel.obtain();
3414 data.writeInterfaceToken(IActivityManager.descriptor);
3415 data.writeStrongBinder(sender.asBinder());
3416 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3417 reply.readException();
3418 data.recycle();
3419 reply.recycle();
3420 }
3421 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3422 Parcel data = Parcel.obtain();
3423 Parcel reply = Parcel.obtain();
3424 data.writeInterfaceToken(IActivityManager.descriptor);
3425 data.writeStrongBinder(sender.asBinder());
3426 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 String res = reply.readString();
3429 data.recycle();
3430 reply.recycle();
3431 return res;
3432 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003433 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3434 Parcel data = Parcel.obtain();
3435 Parcel reply = Parcel.obtain();
3436 data.writeInterfaceToken(IActivityManager.descriptor);
3437 data.writeStrongBinder(sender.asBinder());
3438 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3439 reply.readException();
3440 int res = reply.readInt();
3441 data.recycle();
3442 reply.recycle();
3443 return res;
3444 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003445 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3446 boolean requireFull, String name, String callerPackage) throws RemoteException {
3447 Parcel data = Parcel.obtain();
3448 Parcel reply = Parcel.obtain();
3449 data.writeInterfaceToken(IActivityManager.descriptor);
3450 data.writeInt(callingPid);
3451 data.writeInt(callingUid);
3452 data.writeInt(userId);
3453 data.writeInt(allowAll ? 1 : 0);
3454 data.writeInt(requireFull ? 1 : 0);
3455 data.writeString(name);
3456 data.writeString(callerPackage);
3457 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 int res = reply.readInt();
3460 data.recycle();
3461 reply.recycle();
3462 return res;
3463 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003464 public void setProcessLimit(int max) throws RemoteException
3465 {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 data.writeInt(max);
3470 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3471 reply.readException();
3472 data.recycle();
3473 reply.recycle();
3474 }
3475 public int getProcessLimit() throws RemoteException
3476 {
3477 Parcel data = Parcel.obtain();
3478 Parcel reply = Parcel.obtain();
3479 data.writeInterfaceToken(IActivityManager.descriptor);
3480 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 int res = reply.readInt();
3483 data.recycle();
3484 reply.recycle();
3485 return res;
3486 }
3487 public void setProcessForeground(IBinder token, int pid,
3488 boolean isForeground) throws RemoteException {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeStrongBinder(token);
3493 data.writeInt(pid);
3494 data.writeInt(isForeground ? 1 : 0);
3495 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3496 reply.readException();
3497 data.recycle();
3498 reply.recycle();
3499 }
3500 public int checkPermission(String permission, int pid, int uid)
3501 throws RemoteException {
3502 Parcel data = Parcel.obtain();
3503 Parcel reply = Parcel.obtain();
3504 data.writeInterfaceToken(IActivityManager.descriptor);
3505 data.writeString(permission);
3506 data.writeInt(pid);
3507 data.writeInt(uid);
3508 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3509 reply.readException();
3510 int res = reply.readInt();
3511 data.recycle();
3512 reply.recycle();
3513 return res;
3514 }
3515 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003516 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003517 Parcel data = Parcel.obtain();
3518 Parcel reply = Parcel.obtain();
3519 data.writeInterfaceToken(IActivityManager.descriptor);
3520 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003521 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003522 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3524 reply.readException();
3525 boolean res = reply.readInt() != 0;
3526 data.recycle();
3527 reply.recycle();
3528 return res;
3529 }
3530 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3531 throws RemoteException {
3532 Parcel data = Parcel.obtain();
3533 Parcel reply = Parcel.obtain();
3534 data.writeInterfaceToken(IActivityManager.descriptor);
3535 uri.writeToParcel(data, 0);
3536 data.writeInt(pid);
3537 data.writeInt(uid);
3538 data.writeInt(mode);
3539 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3540 reply.readException();
3541 int res = reply.readInt();
3542 data.recycle();
3543 reply.recycle();
3544 return res;
3545 }
3546 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3547 Uri uri, int mode) throws RemoteException {
3548 Parcel data = Parcel.obtain();
3549 Parcel reply = Parcel.obtain();
3550 data.writeInterfaceToken(IActivityManager.descriptor);
3551 data.writeStrongBinder(caller.asBinder());
3552 data.writeString(targetPkg);
3553 uri.writeToParcel(data, 0);
3554 data.writeInt(mode);
3555 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3556 reply.readException();
3557 data.recycle();
3558 reply.recycle();
3559 }
3560 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3561 int mode) throws RemoteException {
3562 Parcel data = Parcel.obtain();
3563 Parcel reply = Parcel.obtain();
3564 data.writeInterfaceToken(IActivityManager.descriptor);
3565 data.writeStrongBinder(caller.asBinder());
3566 uri.writeToParcel(data, 0);
3567 data.writeInt(mode);
3568 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3569 reply.readException();
3570 data.recycle();
3571 reply.recycle();
3572 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003573
3574 @Override
3575 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3576 Parcel data = Parcel.obtain();
3577 Parcel reply = Parcel.obtain();
3578 data.writeInterfaceToken(IActivityManager.descriptor);
3579 uri.writeToParcel(data, 0);
3580 data.writeInt(mode);
3581 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3582 reply.readException();
3583 data.recycle();
3584 reply.recycle();
3585 }
3586
3587 @Override
3588 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3589 Parcel data = Parcel.obtain();
3590 Parcel reply = Parcel.obtain();
3591 data.writeInterfaceToken(IActivityManager.descriptor);
3592 uri.writeToParcel(data, 0);
3593 data.writeInt(mode);
3594 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3595 reply.readException();
3596 data.recycle();
3597 reply.recycle();
3598 }
3599
3600 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003601 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3602 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003603 Parcel data = Parcel.obtain();
3604 Parcel reply = Parcel.obtain();
3605 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003606 data.writeString(packageName);
3607 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003608 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3609 reply.readException();
3610 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3611 reply);
3612 data.recycle();
3613 reply.recycle();
3614 return perms;
3615 }
3616
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003617 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3618 throws RemoteException {
3619 Parcel data = Parcel.obtain();
3620 Parcel reply = Parcel.obtain();
3621 data.writeInterfaceToken(IActivityManager.descriptor);
3622 data.writeStrongBinder(who.asBinder());
3623 data.writeInt(waiting ? 1 : 0);
3624 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3625 reply.readException();
3626 data.recycle();
3627 reply.recycle();
3628 }
3629 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3630 Parcel data = Parcel.obtain();
3631 Parcel reply = Parcel.obtain();
3632 data.writeInterfaceToken(IActivityManager.descriptor);
3633 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3634 reply.readException();
3635 outInfo.readFromParcel(reply);
3636 data.recycle();
3637 reply.recycle();
3638 }
3639 public void unhandledBack() throws RemoteException
3640 {
3641 Parcel data = Parcel.obtain();
3642 Parcel reply = Parcel.obtain();
3643 data.writeInterfaceToken(IActivityManager.descriptor);
3644 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3645 reply.readException();
3646 data.recycle();
3647 reply.recycle();
3648 }
3649 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3650 {
3651 Parcel data = Parcel.obtain();
3652 Parcel reply = Parcel.obtain();
3653 data.writeInterfaceToken(IActivityManager.descriptor);
3654 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 ParcelFileDescriptor pfd = null;
3657 if (reply.readInt() != 0) {
3658 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3659 }
3660 data.recycle();
3661 reply.recycle();
3662 return pfd;
3663 }
3664 public void goingToSleep() throws RemoteException
3665 {
3666 Parcel data = Parcel.obtain();
3667 Parcel reply = Parcel.obtain();
3668 data.writeInterfaceToken(IActivityManager.descriptor);
3669 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 data.recycle();
3672 reply.recycle();
3673 }
3674 public void wakingUp() throws RemoteException
3675 {
3676 Parcel data = Parcel.obtain();
3677 Parcel reply = Parcel.obtain();
3678 data.writeInterfaceToken(IActivityManager.descriptor);
3679 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3680 reply.readException();
3681 data.recycle();
3682 reply.recycle();
3683 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003684 public void setLockScreenShown(boolean shown) throws RemoteException
3685 {
3686 Parcel data = Parcel.obtain();
3687 Parcel reply = Parcel.obtain();
3688 data.writeInterfaceToken(IActivityManager.descriptor);
3689 data.writeInt(shown ? 1 : 0);
3690 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 data.recycle();
3693 reply.recycle();
3694 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003695 public void setDebugApp(
3696 String packageName, boolean waitForDebugger, boolean persistent)
3697 throws RemoteException
3698 {
3699 Parcel data = Parcel.obtain();
3700 Parcel reply = Parcel.obtain();
3701 data.writeInterfaceToken(IActivityManager.descriptor);
3702 data.writeString(packageName);
3703 data.writeInt(waitForDebugger ? 1 : 0);
3704 data.writeInt(persistent ? 1 : 0);
3705 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3706 reply.readException();
3707 data.recycle();
3708 reply.recycle();
3709 }
3710 public void setAlwaysFinish(boolean enabled) throws RemoteException
3711 {
3712 Parcel data = Parcel.obtain();
3713 Parcel reply = Parcel.obtain();
3714 data.writeInterfaceToken(IActivityManager.descriptor);
3715 data.writeInt(enabled ? 1 : 0);
3716 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3717 reply.readException();
3718 data.recycle();
3719 reply.recycle();
3720 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003721 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003722 {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003727 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003728 reply.readException();
3729 data.recycle();
3730 reply.recycle();
3731 }
3732 public void enterSafeMode() throws RemoteException {
3733 Parcel data = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
3735 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3736 data.recycle();
3737 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003738 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3739 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003740 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003741 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003742 data.writeStrongBinder(sender.asBinder());
3743 data.writeInt(sourceUid);
3744 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003745 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3746 data.recycle();
3747 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003748 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003749 Parcel data = Parcel.obtain();
3750 Parcel reply = Parcel.obtain();
3751 data.writeInterfaceToken(IActivityManager.descriptor);
3752 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003753 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003754 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003755 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003756 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003757 boolean res = reply.readInt() != 0;
3758 data.recycle();
3759 reply.recycle();
3760 return res;
3761 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003762 @Override
3763 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3764 Parcel data = Parcel.obtain();
3765 Parcel reply = Parcel.obtain();
3766 data.writeInterfaceToken(IActivityManager.descriptor);
3767 data.writeString(reason);
3768 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3769 boolean res = reply.readInt() != 0;
3770 data.recycle();
3771 reply.recycle();
3772 return res;
3773 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003774 public void startRunning(String pkg, String cls, String action,
3775 String indata) throws RemoteException {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeString(pkg);
3780 data.writeString(cls);
3781 data.writeString(action);
3782 data.writeString(indata);
3783 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3784 reply.readException();
3785 data.recycle();
3786 reply.recycle();
3787 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 public boolean testIsSystemReady()
3789 {
3790 /* this base class version is never called */
3791 return true;
3792 }
Dan Egnor60d87622009-12-16 16:32:58 -08003793 public void handleApplicationCrash(IBinder app,
3794 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3795 {
3796 Parcel data = Parcel.obtain();
3797 Parcel reply = Parcel.obtain();
3798 data.writeInterfaceToken(IActivityManager.descriptor);
3799 data.writeStrongBinder(app);
3800 crashInfo.writeToParcel(data, 0);
3801 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3802 reply.readException();
3803 reply.recycle();
3804 data.recycle();
3805 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003806
Dan Egnor60d87622009-12-16 16:32:58 -08003807 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003808 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003809 {
3810 Parcel data = Parcel.obtain();
3811 Parcel reply = Parcel.obtain();
3812 data.writeInterfaceToken(IActivityManager.descriptor);
3813 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003814 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003815 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003816 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003817 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003818 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 reply.recycle();
3820 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003821 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003822 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003823
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003824 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003825 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003826 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003827 {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003832 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003833 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003834 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3835 reply.readException();
3836 reply.recycle();
3837 data.recycle();
3838 }
3839
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003840 public void signalPersistentProcesses(int sig) throws RemoteException {
3841 Parcel data = Parcel.obtain();
3842 Parcel reply = Parcel.obtain();
3843 data.writeInterfaceToken(IActivityManager.descriptor);
3844 data.writeInt(sig);
3845 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3846 reply.readException();
3847 data.recycle();
3848 reply.recycle();
3849 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003850
Dianne Hackborn1676c852012-09-10 14:52:30 -07003851 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003852 Parcel data = Parcel.obtain();
3853 Parcel reply = Parcel.obtain();
3854 data.writeInterfaceToken(IActivityManager.descriptor);
3855 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003856 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003857 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3858 reply.readException();
3859 data.recycle();
3860 reply.recycle();
3861 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003862
3863 public void killAllBackgroundProcesses() throws RemoteException {
3864 Parcel data = Parcel.obtain();
3865 Parcel reply = Parcel.obtain();
3866 data.writeInterfaceToken(IActivityManager.descriptor);
3867 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 data.recycle();
3870 reply.recycle();
3871 }
3872
Dianne Hackborn1676c852012-09-10 14:52:30 -07003873 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
3877 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003878 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003879 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003880 reply.readException();
3881 data.recycle();
3882 reply.recycle();
3883 }
3884
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003885 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3886 throws RemoteException
3887 {
3888 Parcel data = Parcel.obtain();
3889 Parcel reply = Parcel.obtain();
3890 data.writeInterfaceToken(IActivityManager.descriptor);
3891 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3892 reply.readException();
3893 outInfo.readFromParcel(reply);
3894 reply.recycle();
3895 data.recycle();
3896 }
3897
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003898 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3899 {
3900 Parcel data = Parcel.obtain();
3901 Parcel reply = Parcel.obtain();
3902 data.writeInterfaceToken(IActivityManager.descriptor);
3903 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3904 reply.readException();
3905 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3906 reply.recycle();
3907 data.recycle();
3908 return res;
3909 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003910
Dianne Hackborn1676c852012-09-10 14:52:30 -07003911 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003912 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003913 {
3914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
3917 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003918 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003919 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003920 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003921 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003922 if (fd != null) {
3923 data.writeInt(1);
3924 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3925 } else {
3926 data.writeInt(0);
3927 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003928 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3929 reply.readException();
3930 boolean res = reply.readInt() != 0;
3931 reply.recycle();
3932 data.recycle();
3933 return res;
3934 }
3935
Dianne Hackborn55280a92009-05-07 15:53:46 -07003936 public boolean shutdown(int timeout) throws RemoteException
3937 {
3938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 data.writeInt(timeout);
3942 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3943 reply.readException();
3944 boolean res = reply.readInt() != 0;
3945 reply.recycle();
3946 data.recycle();
3947 return res;
3948 }
3949
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003950 public void stopAppSwitches() throws RemoteException {
3951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3955 reply.readException();
3956 reply.recycle();
3957 data.recycle();
3958 }
3959
3960 public void resumeAppSwitches() throws RemoteException {
3961 Parcel data = Parcel.obtain();
3962 Parcel reply = Parcel.obtain();
3963 data.writeInterfaceToken(IActivityManager.descriptor);
3964 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3965 reply.readException();
3966 reply.recycle();
3967 data.recycle();
3968 }
3969
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003970 public void killApplicationWithAppId(String pkg, int appid, String reason)
3971 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003972 Parcel data = Parcel.obtain();
3973 Parcel reply = Parcel.obtain();
3974 data.writeInterfaceToken(IActivityManager.descriptor);
3975 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003976 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003977 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003978 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003979 reply.readException();
3980 data.recycle();
3981 reply.recycle();
3982 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003983
3984 public void closeSystemDialogs(String reason) throws RemoteException {
3985 Parcel data = Parcel.obtain();
3986 Parcel reply = Parcel.obtain();
3987 data.writeInterfaceToken(IActivityManager.descriptor);
3988 data.writeString(reason);
3989 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3990 reply.readException();
3991 data.recycle();
3992 reply.recycle();
3993 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003994
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003995 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003996 throws RemoteException {
3997 Parcel data = Parcel.obtain();
3998 Parcel reply = Parcel.obtain();
3999 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004000 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004001 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4002 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004003 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004004 data.recycle();
4005 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004006 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004007 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004008
4009 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4010 Parcel data = Parcel.obtain();
4011 Parcel reply = Parcel.obtain();
4012 data.writeInterfaceToken(IActivityManager.descriptor);
4013 data.writeString(processName);
4014 data.writeInt(uid);
4015 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4016 reply.readException();
4017 data.recycle();
4018 reply.recycle();
4019 }
4020
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004021 public void overridePendingTransition(IBinder token, String packageName,
4022 int enterAnim, int exitAnim) throws RemoteException {
4023 Parcel data = Parcel.obtain();
4024 Parcel reply = Parcel.obtain();
4025 data.writeInterfaceToken(IActivityManager.descriptor);
4026 data.writeStrongBinder(token);
4027 data.writeString(packageName);
4028 data.writeInt(enterAnim);
4029 data.writeInt(exitAnim);
4030 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4031 reply.readException();
4032 data.recycle();
4033 reply.recycle();
4034 }
4035
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004036 public boolean isUserAMonkey() throws RemoteException {
4037 Parcel data = Parcel.obtain();
4038 Parcel reply = Parcel.obtain();
4039 data.writeInterfaceToken(IActivityManager.descriptor);
4040 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4041 reply.readException();
4042 boolean res = reply.readInt() != 0;
4043 data.recycle();
4044 reply.recycle();
4045 return res;
4046 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004047
4048 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4049 Parcel data = Parcel.obtain();
4050 Parcel reply = Parcel.obtain();
4051 data.writeInterfaceToken(IActivityManager.descriptor);
4052 data.writeInt(monkey ? 1 : 0);
4053 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4054 reply.readException();
4055 data.recycle();
4056 reply.recycle();
4057 }
4058
Dianne Hackborn860755f2010-06-03 18:47:52 -07004059 public void finishHeavyWeightApp() throws RemoteException {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4064 reply.readException();
4065 data.recycle();
4066 reply.recycle();
4067 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004068
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004069 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004070 throws RemoteException {
4071 Parcel data = Parcel.obtain();
4072 Parcel reply = Parcel.obtain();
4073 data.writeInterfaceToken(IActivityManager.descriptor);
4074 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004075 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4076 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004077 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004078 data.recycle();
4079 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004080 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004081 }
4082
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004083 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004084 throws RemoteException {
4085 Parcel data = Parcel.obtain();
4086 Parcel reply = Parcel.obtain();
4087 data.writeInterfaceToken(IActivityManager.descriptor);
4088 data.writeStrongBinder(token);
4089 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004090 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004091 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004092 data.recycle();
4093 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004094 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004095 }
4096
Daniel Sandler69a48172010-06-23 16:29:36 -04004097 public void setImmersive(IBinder token, boolean immersive)
4098 throws RemoteException {
4099 Parcel data = Parcel.obtain();
4100 Parcel reply = Parcel.obtain();
4101 data.writeInterfaceToken(IActivityManager.descriptor);
4102 data.writeStrongBinder(token);
4103 data.writeInt(immersive ? 1 : 0);
4104 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4105 reply.readException();
4106 data.recycle();
4107 reply.recycle();
4108 }
4109
4110 public boolean isImmersive(IBinder token)
4111 throws RemoteException {
4112 Parcel data = Parcel.obtain();
4113 Parcel reply = Parcel.obtain();
4114 data.writeInterfaceToken(IActivityManager.descriptor);
4115 data.writeStrongBinder(token);
4116 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004117 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004118 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004119 data.recycle();
4120 reply.recycle();
4121 return res;
4122 }
4123
4124 public boolean isTopActivityImmersive()
4125 throws RemoteException {
4126 Parcel data = Parcel.obtain();
4127 Parcel reply = Parcel.obtain();
4128 data.writeInterfaceToken(IActivityManager.descriptor);
4129 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004130 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004131 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004132 data.recycle();
4133 reply.recycle();
4134 return res;
4135 }
4136
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004137 public void crashApplication(int uid, int initialPid, String packageName,
4138 String message) throws RemoteException {
4139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 data.writeInt(uid);
4143 data.writeInt(initialPid);
4144 data.writeString(packageName);
4145 data.writeString(message);
4146 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 data.recycle();
4149 reply.recycle();
4150 }
Andy McFadden824c5102010-07-09 16:26:57 -07004151
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004152 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004153 Parcel data = Parcel.obtain();
4154 Parcel reply = Parcel.obtain();
4155 data.writeInterfaceToken(IActivityManager.descriptor);
4156 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004157 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004158 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 String res = reply.readString();
4161 data.recycle();
4162 reply.recycle();
4163 return res;
4164 }
4165
Dianne Hackborn7e269642010-08-25 19:50:20 -07004166 public IBinder newUriPermissionOwner(String name)
4167 throws RemoteException {
4168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 data.writeString(name);
4172 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4173 reply.readException();
4174 IBinder res = reply.readStrongBinder();
4175 data.recycle();
4176 reply.recycle();
4177 return res;
4178 }
4179
4180 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4181 Uri uri, int mode) throws RemoteException {
4182 Parcel data = Parcel.obtain();
4183 Parcel reply = Parcel.obtain();
4184 data.writeInterfaceToken(IActivityManager.descriptor);
4185 data.writeStrongBinder(owner);
4186 data.writeInt(fromUid);
4187 data.writeString(targetPkg);
4188 uri.writeToParcel(data, 0);
4189 data.writeInt(mode);
4190 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4191 reply.readException();
4192 data.recycle();
4193 reply.recycle();
4194 }
4195
4196 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4197 int mode) throws RemoteException {
4198 Parcel data = Parcel.obtain();
4199 Parcel reply = Parcel.obtain();
4200 data.writeInterfaceToken(IActivityManager.descriptor);
4201 data.writeStrongBinder(owner);
4202 if (uri != null) {
4203 data.writeInt(1);
4204 uri.writeToParcel(data, 0);
4205 } else {
4206 data.writeInt(0);
4207 }
4208 data.writeInt(mode);
4209 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4210 reply.readException();
4211 data.recycle();
4212 reply.recycle();
4213 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004214
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004215 public int checkGrantUriPermission(int callingUid, String targetPkg,
4216 Uri uri, int modeFlags) throws RemoteException {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeInt(callingUid);
4221 data.writeString(targetPkg);
4222 uri.writeToParcel(data, 0);
4223 data.writeInt(modeFlags);
4224 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4225 reply.readException();
4226 int res = reply.readInt();
4227 data.recycle();
4228 reply.recycle();
4229 return res;
4230 }
4231
Dianne Hackborn1676c852012-09-10 14:52:30 -07004232 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004233 String path, ParcelFileDescriptor fd) throws RemoteException {
4234 Parcel data = Parcel.obtain();
4235 Parcel reply = Parcel.obtain();
4236 data.writeInterfaceToken(IActivityManager.descriptor);
4237 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004238 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004239 data.writeInt(managed ? 1 : 0);
4240 data.writeString(path);
4241 if (fd != null) {
4242 data.writeInt(1);
4243 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4244 } else {
4245 data.writeInt(0);
4246 }
4247 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4248 reply.readException();
4249 boolean res = reply.readInt() != 0;
4250 reply.recycle();
4251 data.recycle();
4252 return res;
4253 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004254
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004255 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004256 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004257 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004258 Parcel data = Parcel.obtain();
4259 Parcel reply = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004262 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004263 data.writeTypedArray(intents, 0);
4264 data.writeStringArray(resolvedTypes);
4265 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004266 if (options != null) {
4267 data.writeInt(1);
4268 options.writeToParcel(data, 0);
4269 } else {
4270 data.writeInt(0);
4271 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004272 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004273 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4274 reply.readException();
4275 int result = reply.readInt();
4276 reply.recycle();
4277 data.recycle();
4278 return result;
4279 }
4280
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004281 public int getFrontActivityScreenCompatMode() throws RemoteException {
4282 Parcel data = Parcel.obtain();
4283 Parcel reply = Parcel.obtain();
4284 data.writeInterfaceToken(IActivityManager.descriptor);
4285 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4286 reply.readException();
4287 int mode = reply.readInt();
4288 reply.recycle();
4289 data.recycle();
4290 return mode;
4291 }
4292
4293 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4294 Parcel data = Parcel.obtain();
4295 Parcel reply = Parcel.obtain();
4296 data.writeInterfaceToken(IActivityManager.descriptor);
4297 data.writeInt(mode);
4298 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4299 reply.readException();
4300 reply.recycle();
4301 data.recycle();
4302 }
4303
4304 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4305 Parcel data = Parcel.obtain();
4306 Parcel reply = Parcel.obtain();
4307 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004308 data.writeString(packageName);
4309 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004310 reply.readException();
4311 int mode = reply.readInt();
4312 reply.recycle();
4313 data.recycle();
4314 return mode;
4315 }
4316
4317 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004318 throws RemoteException {
4319 Parcel data = Parcel.obtain();
4320 Parcel reply = Parcel.obtain();
4321 data.writeInterfaceToken(IActivityManager.descriptor);
4322 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004323 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004324 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4325 reply.readException();
4326 reply.recycle();
4327 data.recycle();
4328 }
4329
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004330 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4331 Parcel data = Parcel.obtain();
4332 Parcel reply = Parcel.obtain();
4333 data.writeInterfaceToken(IActivityManager.descriptor);
4334 data.writeString(packageName);
4335 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4336 reply.readException();
4337 boolean ask = reply.readInt() != 0;
4338 reply.recycle();
4339 data.recycle();
4340 return ask;
4341 }
4342
4343 public void setPackageAskScreenCompat(String packageName, boolean ask)
4344 throws RemoteException {
4345 Parcel data = Parcel.obtain();
4346 Parcel reply = Parcel.obtain();
4347 data.writeInterfaceToken(IActivityManager.descriptor);
4348 data.writeString(packageName);
4349 data.writeInt(ask ? 1 : 0);
4350 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4351 reply.readException();
4352 reply.recycle();
4353 data.recycle();
4354 }
4355
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004356 public boolean switchUser(int userid) throws RemoteException {
4357 Parcel data = Parcel.obtain();
4358 Parcel reply = Parcel.obtain();
4359 data.writeInterfaceToken(IActivityManager.descriptor);
4360 data.writeInt(userid);
4361 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4362 reply.readException();
4363 boolean result = reply.readInt() != 0;
4364 reply.recycle();
4365 data.recycle();
4366 return result;
4367 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004368
Kenny Guy08488bf2014-02-21 17:40:37 +00004369 public boolean startUserInBackground(int userid) throws RemoteException {
4370 Parcel data = Parcel.obtain();
4371 Parcel reply = Parcel.obtain();
4372 data.writeInterfaceToken(IActivityManager.descriptor);
4373 data.writeInt(userid);
4374 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4375 reply.readException();
4376 boolean result = reply.readInt() != 0;
4377 reply.recycle();
4378 data.recycle();
4379 return result;
4380 }
4381
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004382 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeInt(userid);
4387 data.writeStrongInterface(callback);
4388 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4389 reply.readException();
4390 int result = reply.readInt();
4391 reply.recycle();
4392 data.recycle();
4393 return result;
4394 }
4395
Amith Yamasani52f1d752012-03-28 18:19:29 -07004396 public UserInfo getCurrentUser() throws RemoteException {
4397 Parcel data = Parcel.obtain();
4398 Parcel reply = Parcel.obtain();
4399 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004400 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004401 reply.readException();
4402 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4403 reply.recycle();
4404 data.recycle();
4405 return userInfo;
4406 }
4407
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004408 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004409 Parcel data = Parcel.obtain();
4410 Parcel reply = Parcel.obtain();
4411 data.writeInterfaceToken(IActivityManager.descriptor);
4412 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004413 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004414 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4415 reply.readException();
4416 boolean result = reply.readInt() != 0;
4417 reply.recycle();
4418 data.recycle();
4419 return result;
4420 }
4421
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004422 public int[] getRunningUserIds() throws RemoteException {
4423 Parcel data = Parcel.obtain();
4424 Parcel reply = Parcel.obtain();
4425 data.writeInterfaceToken(IActivityManager.descriptor);
4426 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4427 reply.readException();
4428 int[] result = reply.createIntArray();
4429 reply.recycle();
4430 data.recycle();
4431 return result;
4432 }
4433
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004434 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 data.writeInt(taskId);
4439 data.writeInt(subTaskIndex);
4440 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4441 reply.readException();
4442 boolean result = reply.readInt() != 0;
4443 reply.recycle();
4444 data.recycle();
4445 return result;
4446 }
4447
4448 public boolean removeTask(int taskId, int flags) throws RemoteException {
4449 Parcel data = Parcel.obtain();
4450 Parcel reply = Parcel.obtain();
4451 data.writeInterfaceToken(IActivityManager.descriptor);
4452 data.writeInt(taskId);
4453 data.writeInt(flags);
4454 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4455 reply.readException();
4456 boolean result = reply.readInt() != 0;
4457 reply.recycle();
4458 data.recycle();
4459 return result;
4460 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004461
Jeff Sharkeya4620792011-05-20 15:29:23 -07004462 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4463 Parcel data = Parcel.obtain();
4464 Parcel reply = Parcel.obtain();
4465 data.writeInterfaceToken(IActivityManager.descriptor);
4466 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4467 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4468 reply.readException();
4469 data.recycle();
4470 reply.recycle();
4471 }
4472
4473 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4474 Parcel data = Parcel.obtain();
4475 Parcel reply = Parcel.obtain();
4476 data.writeInterfaceToken(IActivityManager.descriptor);
4477 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4478 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4479 reply.readException();
4480 data.recycle();
4481 reply.recycle();
4482 }
4483
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004484 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4485 Parcel data = Parcel.obtain();
4486 Parcel reply = Parcel.obtain();
4487 data.writeInterfaceToken(IActivityManager.descriptor);
4488 data.writeStrongBinder(sender.asBinder());
4489 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4490 reply.readException();
4491 boolean res = reply.readInt() != 0;
4492 data.recycle();
4493 reply.recycle();
4494 return res;
4495 }
4496
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004497 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4498 Parcel data = Parcel.obtain();
4499 Parcel reply = Parcel.obtain();
4500 data.writeInterfaceToken(IActivityManager.descriptor);
4501 data.writeStrongBinder(sender.asBinder());
4502 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4503 reply.readException();
4504 boolean res = reply.readInt() != 0;
4505 data.recycle();
4506 reply.recycle();
4507 return res;
4508 }
4509
Dianne Hackborn81038902012-11-26 17:04:09 -08004510 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4511 Parcel data = Parcel.obtain();
4512 Parcel reply = Parcel.obtain();
4513 data.writeInterfaceToken(IActivityManager.descriptor);
4514 data.writeStrongBinder(sender.asBinder());
4515 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4516 reply.readException();
4517 Intent res = reply.readInt() != 0
4518 ? Intent.CREATOR.createFromParcel(reply) : null;
4519 data.recycle();
4520 reply.recycle();
4521 return res;
4522 }
4523
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004524 public String getTagForIntentSender(IIntentSender sender, String prefix)
4525 throws RemoteException {
4526 Parcel data = Parcel.obtain();
4527 Parcel reply = Parcel.obtain();
4528 data.writeInterfaceToken(IActivityManager.descriptor);
4529 data.writeStrongBinder(sender.asBinder());
4530 data.writeString(prefix);
4531 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4532 reply.readException();
4533 String res = reply.readString();
4534 data.recycle();
4535 reply.recycle();
4536 return res;
4537 }
4538
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004539 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4540 {
4541 Parcel data = Parcel.obtain();
4542 Parcel reply = Parcel.obtain();
4543 data.writeInterfaceToken(IActivityManager.descriptor);
4544 values.writeToParcel(data, 0);
4545 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4546 reply.readException();
4547 data.recycle();
4548 reply.recycle();
4549 }
4550
Dianne Hackbornb437e092011-08-05 17:50:29 -07004551 public long[] getProcessPss(int[] pids) throws RemoteException {
4552 Parcel data = Parcel.obtain();
4553 Parcel reply = Parcel.obtain();
4554 data.writeInterfaceToken(IActivityManager.descriptor);
4555 data.writeIntArray(pids);
4556 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4557 reply.readException();
4558 long[] res = reply.createLongArray();
4559 data.recycle();
4560 reply.recycle();
4561 return res;
4562 }
4563
Dianne Hackborn661cd522011-08-22 00:26:20 -07004564 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4565 Parcel data = Parcel.obtain();
4566 Parcel reply = Parcel.obtain();
4567 data.writeInterfaceToken(IActivityManager.descriptor);
4568 TextUtils.writeToParcel(msg, data, 0);
4569 data.writeInt(always ? 1 : 0);
4570 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4571 reply.readException();
4572 data.recycle();
4573 reply.recycle();
4574 }
4575
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004576 public void dismissKeyguardOnNextActivity() throws RemoteException {
4577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4581 reply.readException();
4582 data.recycle();
4583 reply.recycle();
4584 }
4585
Adam Powelldd8fab22012-03-22 17:47:27 -07004586 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4587 throws RemoteException {
4588 Parcel data = Parcel.obtain();
4589 Parcel reply = Parcel.obtain();
4590 data.writeInterfaceToken(IActivityManager.descriptor);
4591 data.writeStrongBinder(token);
4592 data.writeString(destAffinity);
4593 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4594 reply.readException();
4595 boolean result = reply.readInt() != 0;
4596 data.recycle();
4597 reply.recycle();
4598 return result;
4599 }
4600
4601 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4602 throws RemoteException {
4603 Parcel data = Parcel.obtain();
4604 Parcel reply = Parcel.obtain();
4605 data.writeInterfaceToken(IActivityManager.descriptor);
4606 data.writeStrongBinder(token);
4607 target.writeToParcel(data, 0);
4608 data.writeInt(resultCode);
4609 if (resultData != null) {
4610 data.writeInt(1);
4611 resultData.writeToParcel(data, 0);
4612 } else {
4613 data.writeInt(0);
4614 }
4615 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4616 reply.readException();
4617 boolean result = reply.readInt() != 0;
4618 data.recycle();
4619 reply.recycle();
4620 return result;
4621 }
4622
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004623 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
4627 data.writeStrongBinder(activityToken);
4628 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4629 reply.readException();
4630 int result = reply.readInt();
4631 data.recycle();
4632 reply.recycle();
4633 return result;
4634 }
4635
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004636 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 data.writeStrongBinder(activityToken);
4641 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4642 reply.readException();
4643 String result = reply.readString();
4644 data.recycle();
4645 reply.recycle();
4646 return result;
4647 }
4648
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004649 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4650 Parcel data = Parcel.obtain();
4651 Parcel reply = Parcel.obtain();
4652 data.writeInterfaceToken(IActivityManager.descriptor);
4653 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4654 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4655 reply.readException();
4656 data.recycle();
4657 reply.recycle();
4658 }
4659
4660 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4661 Parcel data = Parcel.obtain();
4662 Parcel reply = Parcel.obtain();
4663 data.writeInterfaceToken(IActivityManager.descriptor);
4664 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4665 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 data.recycle();
4668 reply.recycle();
4669 }
4670
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004671 public void requestBugReport() throws RemoteException {
4672 Parcel data = Parcel.obtain();
4673 Parcel reply = Parcel.obtain();
4674 data.writeInterfaceToken(IActivityManager.descriptor);
4675 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4676 reply.readException();
4677 data.recycle();
4678 reply.recycle();
4679 }
4680
Jeff Brownbd181bb2013-09-10 16:44:24 -07004681 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4682 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004683 Parcel data = Parcel.obtain();
4684 Parcel reply = Parcel.obtain();
4685 data.writeInterfaceToken(IActivityManager.descriptor);
4686 data.writeInt(pid);
4687 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004688 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004689 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4690 reply.readException();
4691 long res = reply.readInt();
4692 data.recycle();
4693 reply.recycle();
4694 return res;
4695 }
4696
Adam Skorydfc7fd72013-08-05 19:23:41 -07004697 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004698 Parcel data = Parcel.obtain();
4699 Parcel reply = Parcel.obtain();
4700 data.writeInterfaceToken(IActivityManager.descriptor);
4701 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004702 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004703 reply.readException();
4704 Bundle res = reply.readBundle();
4705 data.recycle();
4706 reply.recycle();
4707 return res;
4708 }
4709
Adam Skory7140a252013-09-11 12:04:58 +01004710 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004711 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004712 Parcel data = Parcel.obtain();
4713 Parcel reply = Parcel.obtain();
4714 data.writeInterfaceToken(IActivityManager.descriptor);
4715 data.writeStrongBinder(token);
4716 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004717 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004718 reply.readException();
4719 data.recycle();
4720 reply.recycle();
4721 }
4722
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004723 public void killUid(int uid, String reason) throws RemoteException {
4724 Parcel data = Parcel.obtain();
4725 Parcel reply = Parcel.obtain();
4726 data.writeInterfaceToken(IActivityManager.descriptor);
4727 data.writeInt(uid);
4728 data.writeString(reason);
4729 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4730 reply.readException();
4731 data.recycle();
4732 reply.recycle();
4733 }
4734
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004735 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4736 Parcel data = Parcel.obtain();
4737 Parcel reply = Parcel.obtain();
4738 data.writeInterfaceToken(IActivityManager.descriptor);
4739 data.writeStrongBinder(who);
4740 data.writeInt(allowRestart ? 1 : 0);
4741 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4742 reply.readException();
4743 data.recycle();
4744 reply.recycle();
4745 }
4746
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004747 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4748 Parcel data = Parcel.obtain();
4749 Parcel reply = Parcel.obtain();
4750 data.writeInterfaceToken(IActivityManager.descriptor);
4751 data.writeStrongBinder(token);
4752 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4753 reply.readException();
4754 data.recycle();
4755 reply.recycle();
4756 }
4757
Craig Mautner5eda9b32013-07-02 11:58:16 -07004758 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4759 Parcel data = Parcel.obtain();
4760 Parcel reply = Parcel.obtain();
4761 data.writeInterfaceToken(IActivityManager.descriptor);
4762 data.writeStrongBinder(token);
4763 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4764 reply.readException();
4765 data.recycle();
4766 reply.recycle();
4767 }
4768
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004769 public void restart() throws RemoteException {
4770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
4773 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4774 reply.readException();
4775 data.recycle();
4776 reply.recycle();
4777 }
4778
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004779 public void performIdleMaintenance() throws RemoteException {
4780 Parcel data = Parcel.obtain();
4781 Parcel reply = Parcel.obtain();
4782 data.writeInterfaceToken(IActivityManager.descriptor);
4783 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4784 reply.readException();
4785 data.recycle();
4786 reply.recycle();
4787 }
4788
Craig Mautner4a1cb222013-12-04 16:14:06 -08004789 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4790 IActivityContainerCallback callback) throws RemoteException {
4791 Parcel data = Parcel.obtain();
4792 Parcel reply = Parcel.obtain();
4793 data.writeInterfaceToken(IActivityManager.descriptor);
4794 data.writeStrongBinder(parentActivityToken);
4795 data.writeStrongBinder((IBinder)callback);
4796 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4797 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004798 final int result = reply.readInt();
4799 final IActivityContainer res;
4800 if (result == 1) {
4801 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4802 } else {
4803 res = null;
4804 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004805 data.recycle();
4806 reply.recycle();
4807 return res;
4808 }
4809
Craig Mautner95da1082014-02-24 17:54:35 -08004810 public void deleteActivityContainer(IActivityContainer activityContainer)
4811 throws RemoteException {
4812 Parcel data = Parcel.obtain();
4813 Parcel reply = Parcel.obtain();
4814 data.writeInterfaceToken(IActivityManager.descriptor);
4815 data.writeStrongBinder(activityContainer.asBinder());
4816 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4817 reply.readException();
4818 data.recycle();
4819 reply.recycle();
4820 }
4821
Craig Mautnere0a38842013-12-16 16:14:02 -08004822 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4823 throws RemoteException {
4824 Parcel data = Parcel.obtain();
4825 Parcel reply = Parcel.obtain();
4826 data.writeInterfaceToken(IActivityManager.descriptor);
4827 data.writeStrongBinder(activityToken);
4828 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4829 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004830 final int result = reply.readInt();
4831 final IActivityContainer res;
4832 if (result == 1) {
4833 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4834 } else {
4835 res = null;
4836 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004837 data.recycle();
4838 reply.recycle();
4839 return res;
4840 }
4841
Craig Mautner4a1cb222013-12-04 16:14:06 -08004842 public IBinder getHomeActivityToken() throws RemoteException {
4843 Parcel data = Parcel.obtain();
4844 Parcel reply = Parcel.obtain();
4845 data.writeInterfaceToken(IActivityManager.descriptor);
4846 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4847 reply.readException();
4848 IBinder res = reply.readStrongBinder();
4849 data.recycle();
4850 reply.recycle();
4851 return res;
4852 }
4853
Craig Mautneraea74a52014-03-08 14:23:10 -08004854 @Override
4855 public void startLockTaskMode(int taskId) throws RemoteException {
4856 Parcel data = Parcel.obtain();
4857 Parcel reply = Parcel.obtain();
4858 data.writeInterfaceToken(IActivityManager.descriptor);
4859 data.writeInt(taskId);
4860 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4861 reply.readException();
4862 data.recycle();
4863 reply.recycle();
4864 }
4865
4866 @Override
4867 public void startLockTaskMode(IBinder token) throws RemoteException {
4868 Parcel data = Parcel.obtain();
4869 Parcel reply = Parcel.obtain();
4870 data.writeInterfaceToken(IActivityManager.descriptor);
4871 data.writeStrongBinder(token);
4872 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4873 reply.readException();
4874 data.recycle();
4875 reply.recycle();
4876 }
4877
4878 @Override
4879 public void stopLockTaskMode() throws RemoteException {
4880 Parcel data = Parcel.obtain();
4881 Parcel reply = Parcel.obtain();
4882 data.writeInterfaceToken(IActivityManager.descriptor);
4883 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4884 reply.readException();
4885 data.recycle();
4886 reply.recycle();
4887 }
4888
4889 @Override
4890 public boolean isInLockTaskMode() throws RemoteException {
4891 Parcel data = Parcel.obtain();
4892 Parcel reply = Parcel.obtain();
4893 data.writeInterfaceToken(IActivityManager.descriptor);
4894 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4895 reply.readException();
4896 boolean isInLockTaskMode = reply.readInt() == 1;
4897 data.recycle();
4898 reply.recycle();
4899 return isInLockTaskMode;
4900 }
4901
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004902 private IBinder mRemote;
4903}