blob: c7c81dd97410d5e3ab23e7a1fe3a1c0ebcd720f0 [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 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002100 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002102 return super.onTransact(code, data, reply, flags);
2103 }
2104
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002105 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002106 return this;
2107 }
2108
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002109 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2110 protected IActivityManager create() {
2111 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002112 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002113 Log.v("ActivityManager", "default service binder = " + b);
2114 }
2115 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002116 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002117 Log.v("ActivityManager", "default service = " + am);
2118 }
2119 return am;
2120 }
2121 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002122}
2123
2124class ActivityManagerProxy implements IActivityManager
2125{
2126 public ActivityManagerProxy(IBinder remote)
2127 {
2128 mRemote = remote;
2129 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002130
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002131 public IBinder asBinder()
2132 {
2133 return mRemote;
2134 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002135
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002136 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002137 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2138 int startFlags, String profileFile,
2139 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002140 Parcel data = Parcel.obtain();
2141 Parcel reply = Parcel.obtain();
2142 data.writeInterfaceToken(IActivityManager.descriptor);
2143 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002144 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002145 intent.writeToParcel(data, 0);
2146 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002147 data.writeStrongBinder(resultTo);
2148 data.writeString(resultWho);
2149 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002150 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002151 data.writeString(profileFile);
2152 if (profileFd != null) {
2153 data.writeInt(1);
2154 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2155 } else {
2156 data.writeInt(0);
2157 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002158 if (options != null) {
2159 data.writeInt(1);
2160 options.writeToParcel(data, 0);
2161 } else {
2162 data.writeInt(0);
2163 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002164 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2165 reply.readException();
2166 int result = reply.readInt();
2167 reply.recycle();
2168 data.recycle();
2169 return result;
2170 }
Amith Yamasani82644082012-08-03 13:09:11 -07002171
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002172 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002173 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2174 int startFlags, String profileFile,
2175 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2176 Parcel data = Parcel.obtain();
2177 Parcel reply = Parcel.obtain();
2178 data.writeInterfaceToken(IActivityManager.descriptor);
2179 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002180 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002181 intent.writeToParcel(data, 0);
2182 data.writeString(resolvedType);
2183 data.writeStrongBinder(resultTo);
2184 data.writeString(resultWho);
2185 data.writeInt(requestCode);
2186 data.writeInt(startFlags);
2187 data.writeString(profileFile);
2188 if (profileFd != null) {
2189 data.writeInt(1);
2190 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2191 } else {
2192 data.writeInt(0);
2193 }
2194 if (options != null) {
2195 data.writeInt(1);
2196 options.writeToParcel(data, 0);
2197 } else {
2198 data.writeInt(0);
2199 }
2200 data.writeInt(userId);
2201 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2202 reply.readException();
2203 int result = reply.readInt();
2204 reply.recycle();
2205 data.recycle();
2206 return result;
2207 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002208 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2209 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002210 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002211 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002212 Parcel data = Parcel.obtain();
2213 Parcel reply = Parcel.obtain();
2214 data.writeInterfaceToken(IActivityManager.descriptor);
2215 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002216 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002217 intent.writeToParcel(data, 0);
2218 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002219 data.writeStrongBinder(resultTo);
2220 data.writeString(resultWho);
2221 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002222 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002223 data.writeString(profileFile);
2224 if (profileFd != null) {
2225 data.writeInt(1);
2226 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2227 } else {
2228 data.writeInt(0);
2229 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002230 if (options != null) {
2231 data.writeInt(1);
2232 options.writeToParcel(data, 0);
2233 } else {
2234 data.writeInt(0);
2235 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002236 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002237 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2238 reply.readException();
2239 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2240 reply.recycle();
2241 data.recycle();
2242 return result;
2243 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002244 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2245 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002246 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002247 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002248 Parcel data = Parcel.obtain();
2249 Parcel reply = Parcel.obtain();
2250 data.writeInterfaceToken(IActivityManager.descriptor);
2251 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002252 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002253 intent.writeToParcel(data, 0);
2254 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002255 data.writeStrongBinder(resultTo);
2256 data.writeString(resultWho);
2257 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002258 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002259 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002260 if (options != null) {
2261 data.writeInt(1);
2262 options.writeToParcel(data, 0);
2263 } else {
2264 data.writeInt(0);
2265 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002266 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002267 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2268 reply.readException();
2269 int result = reply.readInt();
2270 reply.recycle();
2271 data.recycle();
2272 return result;
2273 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002274 public int startActivityIntentSender(IApplicationThread caller,
2275 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002276 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002277 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002278 Parcel data = Parcel.obtain();
2279 Parcel reply = Parcel.obtain();
2280 data.writeInterfaceToken(IActivityManager.descriptor);
2281 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2282 intent.writeToParcel(data, 0);
2283 if (fillInIntent != null) {
2284 data.writeInt(1);
2285 fillInIntent.writeToParcel(data, 0);
2286 } else {
2287 data.writeInt(0);
2288 }
2289 data.writeString(resolvedType);
2290 data.writeStrongBinder(resultTo);
2291 data.writeString(resultWho);
2292 data.writeInt(requestCode);
2293 data.writeInt(flagsMask);
2294 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002295 if (options != null) {
2296 data.writeInt(1);
2297 options.writeToParcel(data, 0);
2298 } else {
2299 data.writeInt(0);
2300 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002301 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002302 reply.readException();
2303 int result = reply.readInt();
2304 reply.recycle();
2305 data.recycle();
2306 return result;
2307 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002308 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002309 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 data.writeStrongBinder(callingActivity);
2314 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002315 if (options != null) {
2316 data.writeInt(1);
2317 options.writeToParcel(data, 0);
2318 } else {
2319 data.writeInt(0);
2320 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002321 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2322 reply.readException();
2323 int result = reply.readInt();
2324 reply.recycle();
2325 data.recycle();
2326 return result != 0;
2327 }
2328 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2329 throws RemoteException {
2330 Parcel data = Parcel.obtain();
2331 Parcel reply = Parcel.obtain();
2332 data.writeInterfaceToken(IActivityManager.descriptor);
2333 data.writeStrongBinder(token);
2334 data.writeInt(resultCode);
2335 if (resultData != null) {
2336 data.writeInt(1);
2337 resultData.writeToParcel(data, 0);
2338 } else {
2339 data.writeInt(0);
2340 }
2341 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2342 reply.readException();
2343 boolean res = reply.readInt() != 0;
2344 data.recycle();
2345 reply.recycle();
2346 return res;
2347 }
2348 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2349 {
2350 Parcel data = Parcel.obtain();
2351 Parcel reply = Parcel.obtain();
2352 data.writeInterfaceToken(IActivityManager.descriptor);
2353 data.writeStrongBinder(token);
2354 data.writeString(resultWho);
2355 data.writeInt(requestCode);
2356 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2357 reply.readException();
2358 data.recycle();
2359 reply.recycle();
2360 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002361 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2362 Parcel data = Parcel.obtain();
2363 Parcel reply = Parcel.obtain();
2364 data.writeInterfaceToken(IActivityManager.descriptor);
2365 data.writeStrongBinder(token);
2366 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2367 reply.readException();
2368 boolean res = reply.readInt() != 0;
2369 data.recycle();
2370 reply.recycle();
2371 return res;
2372 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002373 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2374 Parcel data = Parcel.obtain();
2375 Parcel reply = Parcel.obtain();
2376 data.writeInterfaceToken(IActivityManager.descriptor);
2377 data.writeStrongBinder(token);
2378 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2379 reply.readException();
2380 boolean res = reply.readInt() != 0;
2381 data.recycle();
2382 reply.recycle();
2383 return res;
2384 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002385 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002386 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002387 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002388 {
2389 Parcel data = Parcel.obtain();
2390 Parcel reply = Parcel.obtain();
2391 data.writeInterfaceToken(IActivityManager.descriptor);
2392 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002393 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002394 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2395 filter.writeToParcel(data, 0);
2396 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002397 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002398 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2399 reply.readException();
2400 Intent intent = null;
2401 int haveIntent = reply.readInt();
2402 if (haveIntent != 0) {
2403 intent = Intent.CREATOR.createFromParcel(reply);
2404 }
2405 reply.recycle();
2406 data.recycle();
2407 return intent;
2408 }
2409 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2410 {
2411 Parcel data = Parcel.obtain();
2412 Parcel reply = Parcel.obtain();
2413 data.writeInterfaceToken(IActivityManager.descriptor);
2414 data.writeStrongBinder(receiver.asBinder());
2415 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2416 reply.readException();
2417 data.recycle();
2418 reply.recycle();
2419 }
2420 public int broadcastIntent(IApplicationThread caller,
2421 Intent intent, String resolvedType, IIntentReceiver resultTo,
2422 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002423 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002424 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002425 {
2426 Parcel data = Parcel.obtain();
2427 Parcel reply = Parcel.obtain();
2428 data.writeInterfaceToken(IActivityManager.descriptor);
2429 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2430 intent.writeToParcel(data, 0);
2431 data.writeString(resolvedType);
2432 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2433 data.writeInt(resultCode);
2434 data.writeString(resultData);
2435 data.writeBundle(map);
2436 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002437 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002438 data.writeInt(serialized ? 1 : 0);
2439 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002440 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002441 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2442 reply.readException();
2443 int res = reply.readInt();
2444 reply.recycle();
2445 data.recycle();
2446 return res;
2447 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002448 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2449 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002450 {
2451 Parcel data = Parcel.obtain();
2452 Parcel reply = Parcel.obtain();
2453 data.writeInterfaceToken(IActivityManager.descriptor);
2454 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2455 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002456 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2458 reply.readException();
2459 data.recycle();
2460 reply.recycle();
2461 }
2462 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2463 {
2464 Parcel data = Parcel.obtain();
2465 Parcel reply = Parcel.obtain();
2466 data.writeInterfaceToken(IActivityManager.descriptor);
2467 data.writeStrongBinder(who);
2468 data.writeInt(resultCode);
2469 data.writeString(resultData);
2470 data.writeBundle(map);
2471 data.writeInt(abortBroadcast ? 1 : 0);
2472 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2473 reply.readException();
2474 data.recycle();
2475 reply.recycle();
2476 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002477 public void attachApplication(IApplicationThread app) throws RemoteException
2478 {
2479 Parcel data = Parcel.obtain();
2480 Parcel reply = Parcel.obtain();
2481 data.writeInterfaceToken(IActivityManager.descriptor);
2482 data.writeStrongBinder(app.asBinder());
2483 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2484 reply.readException();
2485 data.recycle();
2486 reply.recycle();
2487 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002488 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2489 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002490 {
2491 Parcel data = Parcel.obtain();
2492 Parcel reply = Parcel.obtain();
2493 data.writeInterfaceToken(IActivityManager.descriptor);
2494 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002495 if (config != null) {
2496 data.writeInt(1);
2497 config.writeToParcel(data, 0);
2498 } else {
2499 data.writeInt(0);
2500 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002501 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002502 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2503 reply.readException();
2504 data.recycle();
2505 reply.recycle();
2506 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002507 public void activityResumed(IBinder token) throws RemoteException
2508 {
2509 Parcel data = Parcel.obtain();
2510 Parcel reply = Parcel.obtain();
2511 data.writeInterfaceToken(IActivityManager.descriptor);
2512 data.writeStrongBinder(token);
2513 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2514 reply.readException();
2515 data.recycle();
2516 reply.recycle();
2517 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002518 public void activityPaused(IBinder token) throws RemoteException
2519 {
2520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeStrongBinder(token);
2524 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2525 reply.readException();
2526 data.recycle();
2527 reply.recycle();
2528 }
2529 public void activityStopped(IBinder token, Bundle state,
2530 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002531 {
2532 Parcel data = Parcel.obtain();
2533 Parcel reply = Parcel.obtain();
2534 data.writeInterfaceToken(IActivityManager.descriptor);
2535 data.writeStrongBinder(token);
2536 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002537 if (thumbnail != null) {
2538 data.writeInt(1);
2539 thumbnail.writeToParcel(data, 0);
2540 } else {
2541 data.writeInt(0);
2542 }
2543 TextUtils.writeToParcel(description, data, 0);
2544 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2545 reply.readException();
2546 data.recycle();
2547 reply.recycle();
2548 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002549 public void activitySlept(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_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2556 reply.readException();
2557 data.recycle();
2558 reply.recycle();
2559 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002560 public void activityDestroyed(IBinder token) throws RemoteException
2561 {
2562 Parcel data = Parcel.obtain();
2563 Parcel reply = Parcel.obtain();
2564 data.writeInterfaceToken(IActivityManager.descriptor);
2565 data.writeStrongBinder(token);
2566 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2567 reply.readException();
2568 data.recycle();
2569 reply.recycle();
2570 }
2571 public String getCallingPackage(IBinder token) throws RemoteException
2572 {
2573 Parcel data = Parcel.obtain();
2574 Parcel reply = Parcel.obtain();
2575 data.writeInterfaceToken(IActivityManager.descriptor);
2576 data.writeStrongBinder(token);
2577 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2578 reply.readException();
2579 String res = reply.readString();
2580 data.recycle();
2581 reply.recycle();
2582 return res;
2583 }
2584 public ComponentName getCallingActivity(IBinder token)
2585 throws RemoteException {
2586 Parcel data = Parcel.obtain();
2587 Parcel reply = Parcel.obtain();
2588 data.writeInterfaceToken(IActivityManager.descriptor);
2589 data.writeStrongBinder(token);
2590 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2591 reply.readException();
2592 ComponentName res = ComponentName.readFromParcel(reply);
2593 data.recycle();
2594 reply.recycle();
2595 return res;
2596 }
2597 public List getTasks(int maxNum, int flags,
2598 IThumbnailReceiver receiver) throws RemoteException {
2599 Parcel data = Parcel.obtain();
2600 Parcel reply = Parcel.obtain();
2601 data.writeInterfaceToken(IActivityManager.descriptor);
2602 data.writeInt(maxNum);
2603 data.writeInt(flags);
2604 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2605 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2606 reply.readException();
2607 ArrayList list = null;
2608 int N = reply.readInt();
2609 if (N >= 0) {
2610 list = new ArrayList();
2611 while (N > 0) {
2612 ActivityManager.RunningTaskInfo info =
2613 ActivityManager.RunningTaskInfo.CREATOR
2614 .createFromParcel(reply);
2615 list.add(info);
2616 N--;
2617 }
2618 }
2619 data.recycle();
2620 reply.recycle();
2621 return list;
2622 }
2623 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002624 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002625 Parcel data = Parcel.obtain();
2626 Parcel reply = Parcel.obtain();
2627 data.writeInterfaceToken(IActivityManager.descriptor);
2628 data.writeInt(maxNum);
2629 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002630 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002631 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2632 reply.readException();
2633 ArrayList<ActivityManager.RecentTaskInfo> list
2634 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2635 data.recycle();
2636 reply.recycle();
2637 return list;
2638 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002639 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002640 Parcel data = Parcel.obtain();
2641 Parcel reply = Parcel.obtain();
2642 data.writeInterfaceToken(IActivityManager.descriptor);
2643 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002644 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002645 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002646 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002647 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002648 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002649 }
2650 data.recycle();
2651 reply.recycle();
2652 return bm;
2653 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002654 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 data.writeInt(id);
2659 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2660 reply.readException();
2661 Bitmap bm = null;
2662 if (reply.readInt() != 0) {
2663 bm = Bitmap.CREATOR.createFromParcel(reply);
2664 }
2665 data.recycle();
2666 reply.recycle();
2667 return bm;
2668 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002669 public List getServices(int maxNum, int flags) throws RemoteException {
2670 Parcel data = Parcel.obtain();
2671 Parcel reply = Parcel.obtain();
2672 data.writeInterfaceToken(IActivityManager.descriptor);
2673 data.writeInt(maxNum);
2674 data.writeInt(flags);
2675 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2676 reply.readException();
2677 ArrayList list = null;
2678 int N = reply.readInt();
2679 if (N >= 0) {
2680 list = new ArrayList();
2681 while (N > 0) {
2682 ActivityManager.RunningServiceInfo info =
2683 ActivityManager.RunningServiceInfo.CREATOR
2684 .createFromParcel(reply);
2685 list.add(info);
2686 N--;
2687 }
2688 }
2689 data.recycle();
2690 reply.recycle();
2691 return list;
2692 }
2693 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2694 throws RemoteException {
2695 Parcel data = Parcel.obtain();
2696 Parcel reply = Parcel.obtain();
2697 data.writeInterfaceToken(IActivityManager.descriptor);
2698 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2699 reply.readException();
2700 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2701 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2702 data.recycle();
2703 reply.recycle();
2704 return list;
2705 }
2706 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2707 throws RemoteException {
2708 Parcel data = Parcel.obtain();
2709 Parcel reply = Parcel.obtain();
2710 data.writeInterfaceToken(IActivityManager.descriptor);
2711 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2712 reply.readException();
2713 ArrayList<ActivityManager.RunningAppProcessInfo> list
2714 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2715 data.recycle();
2716 reply.recycle();
2717 return list;
2718 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002719 public List<ApplicationInfo> getRunningExternalApplications()
2720 throws RemoteException {
2721 Parcel data = Parcel.obtain();
2722 Parcel reply = Parcel.obtain();
2723 data.writeInterfaceToken(IActivityManager.descriptor);
2724 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2725 reply.readException();
2726 ArrayList<ApplicationInfo> list
2727 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2728 data.recycle();
2729 reply.recycle();
2730 return list;
2731 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002732 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002733 {
2734 Parcel data = Parcel.obtain();
2735 Parcel reply = Parcel.obtain();
2736 data.writeInterfaceToken(IActivityManager.descriptor);
2737 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002738 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002739 if (options != null) {
2740 data.writeInt(1);
2741 options.writeToParcel(data, 0);
2742 } else {
2743 data.writeInt(0);
2744 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002745 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2746 reply.readException();
2747 data.recycle();
2748 reply.recycle();
2749 }
2750 public void moveTaskToBack(int task) throws RemoteException
2751 {
2752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 data.writeInt(task);
2756 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2757 reply.readException();
2758 data.recycle();
2759 reply.recycle();
2760 }
2761 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2762 throws RemoteException {
2763 Parcel data = Parcel.obtain();
2764 Parcel reply = Parcel.obtain();
2765 data.writeInterfaceToken(IActivityManager.descriptor);
2766 data.writeStrongBinder(token);
2767 data.writeInt(nonRoot ? 1 : 0);
2768 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2769 reply.readException();
2770 boolean res = reply.readInt() != 0;
2771 data.recycle();
2772 reply.recycle();
2773 return res;
2774 }
2775 public void moveTaskBackwards(int task) throws RemoteException
2776 {
2777 Parcel data = Parcel.obtain();
2778 Parcel reply = Parcel.obtain();
2779 data.writeInterfaceToken(IActivityManager.descriptor);
2780 data.writeInt(task);
2781 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2782 reply.readException();
2783 data.recycle();
2784 reply.recycle();
2785 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002786 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002787 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2788 {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002791 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002792 data.writeInt(taskId);
2793 data.writeInt(stackId);
2794 data.writeInt(toTop ? 1 : 0);
2795 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2796 reply.readException();
2797 data.recycle();
2798 reply.recycle();
2799 }
2800 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002801 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002802 {
2803 Parcel data = Parcel.obtain();
2804 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002805 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002806 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002807 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002808 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002809 reply.readException();
2810 data.recycle();
2811 reply.recycle();
2812 }
Craig Mautner967212c2013-04-13 21:10:58 -07002813 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002814 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002815 {
2816 Parcel data = Parcel.obtain();
2817 Parcel reply = Parcel.obtain();
2818 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002819 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002820 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002821 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002822 data.recycle();
2823 reply.recycle();
2824 return list;
2825 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002826 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002827 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002828 {
2829 Parcel data = Parcel.obtain();
2830 Parcel reply = Parcel.obtain();
2831 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002832 data.writeInt(stackId);
2833 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002834 reply.readException();
2835 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002836 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002837 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002838 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002839 }
2840 data.recycle();
2841 reply.recycle();
2842 return info;
2843 }
2844 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002845 public boolean isInHomeStack(int taskId) throws RemoteException {
2846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 data.writeInt(taskId);
2850 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2851 reply.readException();
2852 boolean isInHomeStack = reply.readInt() > 0;
2853 data.recycle();
2854 reply.recycle();
2855 return isInHomeStack;
2856 }
2857 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002858 public void setFocusedStack(int stackId) throws RemoteException
2859 {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeInt(stackId);
2864 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2865 reply.readException();
2866 data.recycle();
2867 reply.recycle();
2868 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002869 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2870 {
2871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeStrongBinder(token);
2875 data.writeInt(onlyRoot ? 1 : 0);
2876 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 int res = reply.readInt();
2879 data.recycle();
2880 reply.recycle();
2881 return res;
2882 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002883 public void reportThumbnail(IBinder token,
2884 Bitmap thumbnail, CharSequence description) throws RemoteException
2885 {
2886 Parcel data = Parcel.obtain();
2887 Parcel reply = Parcel.obtain();
2888 data.writeInterfaceToken(IActivityManager.descriptor);
2889 data.writeStrongBinder(token);
2890 if (thumbnail != null) {
2891 data.writeInt(1);
2892 thumbnail.writeToParcel(data, 0);
2893 } else {
2894 data.writeInt(0);
2895 }
2896 TextUtils.writeToParcel(description, data, 0);
2897 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2898 reply.readException();
2899 data.recycle();
2900 reply.recycle();
2901 }
2902 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002903 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2908 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002909 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002910 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002911 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 int res = reply.readInt();
2914 ContentProviderHolder cph = null;
2915 if (res != 0) {
2916 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2917 }
2918 data.recycle();
2919 reply.recycle();
2920 return cph;
2921 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002922 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2923 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002924 Parcel data = Parcel.obtain();
2925 Parcel reply = Parcel.obtain();
2926 data.writeInterfaceToken(IActivityManager.descriptor);
2927 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002928 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002929 data.writeStrongBinder(token);
2930 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2931 reply.readException();
2932 int res = reply.readInt();
2933 ContentProviderHolder cph = null;
2934 if (res != 0) {
2935 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2936 }
2937 data.recycle();
2938 reply.recycle();
2939 return cph;
2940 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002941 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002942 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 {
2944 Parcel data = Parcel.obtain();
2945 Parcel reply = Parcel.obtain();
2946 data.writeInterfaceToken(IActivityManager.descriptor);
2947 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2948 data.writeTypedList(providers);
2949 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2950 reply.readException();
2951 data.recycle();
2952 reply.recycle();
2953 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002954 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2955 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002956 Parcel data = Parcel.obtain();
2957 Parcel reply = Parcel.obtain();
2958 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002959 data.writeStrongBinder(connection);
2960 data.writeInt(stable);
2961 data.writeInt(unstable);
2962 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2963 reply.readException();
2964 boolean res = reply.readInt() != 0;
2965 data.recycle();
2966 reply.recycle();
2967 return res;
2968 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002969
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002970 public void unstableProviderDied(IBinder connection) throws RemoteException {
2971 Parcel data = Parcel.obtain();
2972 Parcel reply = Parcel.obtain();
2973 data.writeInterfaceToken(IActivityManager.descriptor);
2974 data.writeStrongBinder(connection);
2975 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2976 reply.readException();
2977 data.recycle();
2978 reply.recycle();
2979 }
2980
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002981 @Override
2982 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
2983 Parcel data = Parcel.obtain();
2984 Parcel reply = Parcel.obtain();
2985 data.writeInterfaceToken(IActivityManager.descriptor);
2986 data.writeStrongBinder(connection);
2987 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
2988 reply.readException();
2989 data.recycle();
2990 reply.recycle();
2991 }
2992
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002993 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 data.writeStrongBinder(connection);
2998 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3000 reply.readException();
3001 data.recycle();
3002 reply.recycle();
3003 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003004
3005 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3006 Parcel data = Parcel.obtain();
3007 Parcel reply = Parcel.obtain();
3008 data.writeInterfaceToken(IActivityManager.descriptor);
3009 data.writeString(name);
3010 data.writeStrongBinder(token);
3011 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3012 reply.readException();
3013 data.recycle();
3014 reply.recycle();
3015 }
3016
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003017 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3018 throws RemoteException
3019 {
3020 Parcel data = Parcel.obtain();
3021 Parcel reply = Parcel.obtain();
3022 data.writeInterfaceToken(IActivityManager.descriptor);
3023 service.writeToParcel(data, 0);
3024 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3025 reply.readException();
3026 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3027 data.recycle();
3028 reply.recycle();
3029 return res;
3030 }
3031
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003032 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003033 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003034 {
3035 Parcel data = Parcel.obtain();
3036 Parcel reply = Parcel.obtain();
3037 data.writeInterfaceToken(IActivityManager.descriptor);
3038 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3039 service.writeToParcel(data, 0);
3040 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003041 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003042 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3043 reply.readException();
3044 ComponentName res = ComponentName.readFromParcel(reply);
3045 data.recycle();
3046 reply.recycle();
3047 return res;
3048 }
3049 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003050 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 {
3052 Parcel data = Parcel.obtain();
3053 Parcel reply = Parcel.obtain();
3054 data.writeInterfaceToken(IActivityManager.descriptor);
3055 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3056 service.writeToParcel(data, 0);
3057 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003058 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003059 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3060 reply.readException();
3061 int res = reply.readInt();
3062 reply.recycle();
3063 data.recycle();
3064 return res;
3065 }
3066 public boolean stopServiceToken(ComponentName className, IBinder token,
3067 int startId) throws RemoteException {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 ComponentName.writeToParcel(className, data);
3072 data.writeStrongBinder(token);
3073 data.writeInt(startId);
3074 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 boolean res = reply.readInt() != 0;
3077 data.recycle();
3078 reply.recycle();
3079 return res;
3080 }
3081 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003082 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003083 Parcel data = Parcel.obtain();
3084 Parcel reply = Parcel.obtain();
3085 data.writeInterfaceToken(IActivityManager.descriptor);
3086 ComponentName.writeToParcel(className, data);
3087 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003088 data.writeInt(id);
3089 if (notification != null) {
3090 data.writeInt(1);
3091 notification.writeToParcel(data, 0);
3092 } else {
3093 data.writeInt(0);
3094 }
3095 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003096 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 data.recycle();
3099 reply.recycle();
3100 }
3101 public int bindService(IApplicationThread caller, IBinder token,
3102 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003103 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3108 data.writeStrongBinder(token);
3109 service.writeToParcel(data, 0);
3110 data.writeString(resolvedType);
3111 data.writeStrongBinder(connection.asBinder());
3112 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003113 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003114 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3115 reply.readException();
3116 int res = reply.readInt();
3117 data.recycle();
3118 reply.recycle();
3119 return res;
3120 }
3121 public boolean unbindService(IServiceConnection connection) throws RemoteException
3122 {
3123 Parcel data = Parcel.obtain();
3124 Parcel reply = Parcel.obtain();
3125 data.writeInterfaceToken(IActivityManager.descriptor);
3126 data.writeStrongBinder(connection.asBinder());
3127 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3128 reply.readException();
3129 boolean res = reply.readInt() != 0;
3130 data.recycle();
3131 reply.recycle();
3132 return res;
3133 }
3134
3135 public void publishService(IBinder token,
3136 Intent intent, IBinder service) throws RemoteException {
3137 Parcel data = Parcel.obtain();
3138 Parcel reply = Parcel.obtain();
3139 data.writeInterfaceToken(IActivityManager.descriptor);
3140 data.writeStrongBinder(token);
3141 intent.writeToParcel(data, 0);
3142 data.writeStrongBinder(service);
3143 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3144 reply.readException();
3145 data.recycle();
3146 reply.recycle();
3147 }
3148
3149 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3150 throws RemoteException {
3151 Parcel data = Parcel.obtain();
3152 Parcel reply = Parcel.obtain();
3153 data.writeInterfaceToken(IActivityManager.descriptor);
3154 data.writeStrongBinder(token);
3155 intent.writeToParcel(data, 0);
3156 data.writeInt(doRebind ? 1 : 0);
3157 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 data.recycle();
3160 reply.recycle();
3161 }
3162
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003163 public void serviceDoneExecuting(IBinder token, int type, int startId,
3164 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003169 data.writeInt(type);
3170 data.writeInt(startId);
3171 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003172 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3173 reply.readException();
3174 data.recycle();
3175 reply.recycle();
3176 }
3177
3178 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3179 Parcel data = Parcel.obtain();
3180 Parcel reply = Parcel.obtain();
3181 data.writeInterfaceToken(IActivityManager.descriptor);
3182 service.writeToParcel(data, 0);
3183 data.writeString(resolvedType);
3184 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3185 reply.readException();
3186 IBinder binder = reply.readStrongBinder();
3187 reply.recycle();
3188 data.recycle();
3189 return binder;
3190 }
3191
Christopher Tate181fafa2009-05-14 11:12:14 -07003192 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3193 throws RemoteException {
3194 Parcel data = Parcel.obtain();
3195 Parcel reply = Parcel.obtain();
3196 data.writeInterfaceToken(IActivityManager.descriptor);
3197 app.writeToParcel(data, 0);
3198 data.writeInt(backupRestoreMode);
3199 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3200 reply.readException();
3201 boolean success = reply.readInt() != 0;
3202 reply.recycle();
3203 data.recycle();
3204 return success;
3205 }
3206
Christopher Tate346acb12012-10-15 19:20:25 -07003207 public void clearPendingBackup() throws RemoteException {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3212 reply.recycle();
3213 data.recycle();
3214 }
3215
Christopher Tate181fafa2009-05-14 11:12:14 -07003216 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3217 Parcel data = Parcel.obtain();
3218 Parcel reply = Parcel.obtain();
3219 data.writeInterfaceToken(IActivityManager.descriptor);
3220 data.writeString(packageName);
3221 data.writeStrongBinder(agent);
3222 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3223 reply.recycle();
3224 data.recycle();
3225 }
3226
3227 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3228 Parcel data = Parcel.obtain();
3229 Parcel reply = Parcel.obtain();
3230 data.writeInterfaceToken(IActivityManager.descriptor);
3231 app.writeToParcel(data, 0);
3232 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3233 reply.readException();
3234 reply.recycle();
3235 data.recycle();
3236 }
3237
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003238 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003239 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3240 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003241 Parcel data = Parcel.obtain();
3242 Parcel reply = Parcel.obtain();
3243 data.writeInterfaceToken(IActivityManager.descriptor);
3244 ComponentName.writeToParcel(className, data);
3245 data.writeString(profileFile);
3246 data.writeInt(flags);
3247 data.writeBundle(arguments);
3248 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003249 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003250 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003251 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3252 reply.readException();
3253 boolean res = reply.readInt() != 0;
3254 reply.recycle();
3255 data.recycle();
3256 return res;
3257 }
3258
3259 public void finishInstrumentation(IApplicationThread target,
3260 int resultCode, Bundle results) throws RemoteException {
3261 Parcel data = Parcel.obtain();
3262 Parcel reply = Parcel.obtain();
3263 data.writeInterfaceToken(IActivityManager.descriptor);
3264 data.writeStrongBinder(target != null ? target.asBinder() : null);
3265 data.writeInt(resultCode);
3266 data.writeBundle(results);
3267 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3268 reply.readException();
3269 data.recycle();
3270 reply.recycle();
3271 }
3272 public Configuration getConfiguration() throws RemoteException
3273 {
3274 Parcel data = Parcel.obtain();
3275 Parcel reply = Parcel.obtain();
3276 data.writeInterfaceToken(IActivityManager.descriptor);
3277 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3278 reply.readException();
3279 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3280 reply.recycle();
3281 data.recycle();
3282 return res;
3283 }
3284 public void updateConfiguration(Configuration values) throws RemoteException
3285 {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
3289 values.writeToParcel(data, 0);
3290 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 data.recycle();
3293 reply.recycle();
3294 }
3295 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3296 throws RemoteException {
3297 Parcel data = Parcel.obtain();
3298 Parcel reply = Parcel.obtain();
3299 data.writeInterfaceToken(IActivityManager.descriptor);
3300 data.writeStrongBinder(token);
3301 data.writeInt(requestedOrientation);
3302 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3303 reply.readException();
3304 data.recycle();
3305 reply.recycle();
3306 }
3307 public int getRequestedOrientation(IBinder token) throws RemoteException {
3308 Parcel data = Parcel.obtain();
3309 Parcel reply = Parcel.obtain();
3310 data.writeInterfaceToken(IActivityManager.descriptor);
3311 data.writeStrongBinder(token);
3312 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3313 reply.readException();
3314 int res = reply.readInt();
3315 data.recycle();
3316 reply.recycle();
3317 return res;
3318 }
3319 public ComponentName getActivityClassForToken(IBinder token)
3320 throws RemoteException {
3321 Parcel data = Parcel.obtain();
3322 Parcel reply = Parcel.obtain();
3323 data.writeInterfaceToken(IActivityManager.descriptor);
3324 data.writeStrongBinder(token);
3325 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3326 reply.readException();
3327 ComponentName res = ComponentName.readFromParcel(reply);
3328 data.recycle();
3329 reply.recycle();
3330 return res;
3331 }
3332 public String getPackageForToken(IBinder token) throws RemoteException
3333 {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 data.writeStrongBinder(token);
3338 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3339 reply.readException();
3340 String res = reply.readString();
3341 data.recycle();
3342 reply.recycle();
3343 return res;
3344 }
3345 public IIntentSender getIntentSender(int type,
3346 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003347 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003348 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003349 Parcel data = Parcel.obtain();
3350 Parcel reply = Parcel.obtain();
3351 data.writeInterfaceToken(IActivityManager.descriptor);
3352 data.writeInt(type);
3353 data.writeString(packageName);
3354 data.writeStrongBinder(token);
3355 data.writeString(resultWho);
3356 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003357 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003358 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003359 data.writeTypedArray(intents, 0);
3360 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003361 } else {
3362 data.writeInt(0);
3363 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003364 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003365 if (options != null) {
3366 data.writeInt(1);
3367 options.writeToParcel(data, 0);
3368 } else {
3369 data.writeInt(0);
3370 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003371 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003372 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3373 reply.readException();
3374 IIntentSender res = IIntentSender.Stub.asInterface(
3375 reply.readStrongBinder());
3376 data.recycle();
3377 reply.recycle();
3378 return res;
3379 }
3380 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3381 Parcel data = Parcel.obtain();
3382 Parcel reply = Parcel.obtain();
3383 data.writeInterfaceToken(IActivityManager.descriptor);
3384 data.writeStrongBinder(sender.asBinder());
3385 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3386 reply.readException();
3387 data.recycle();
3388 reply.recycle();
3389 }
3390 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3391 Parcel data = Parcel.obtain();
3392 Parcel reply = Parcel.obtain();
3393 data.writeInterfaceToken(IActivityManager.descriptor);
3394 data.writeStrongBinder(sender.asBinder());
3395 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 String res = reply.readString();
3398 data.recycle();
3399 reply.recycle();
3400 return res;
3401 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003402 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3403 Parcel data = Parcel.obtain();
3404 Parcel reply = Parcel.obtain();
3405 data.writeInterfaceToken(IActivityManager.descriptor);
3406 data.writeStrongBinder(sender.asBinder());
3407 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3408 reply.readException();
3409 int res = reply.readInt();
3410 data.recycle();
3411 reply.recycle();
3412 return res;
3413 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003414 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3415 boolean requireFull, String name, String callerPackage) throws RemoteException {
3416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 data.writeInt(callingPid);
3420 data.writeInt(callingUid);
3421 data.writeInt(userId);
3422 data.writeInt(allowAll ? 1 : 0);
3423 data.writeInt(requireFull ? 1 : 0);
3424 data.writeString(name);
3425 data.writeString(callerPackage);
3426 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3427 reply.readException();
3428 int res = reply.readInt();
3429 data.recycle();
3430 reply.recycle();
3431 return res;
3432 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003433 public void setProcessLimit(int max) throws RemoteException
3434 {
3435 Parcel data = Parcel.obtain();
3436 Parcel reply = Parcel.obtain();
3437 data.writeInterfaceToken(IActivityManager.descriptor);
3438 data.writeInt(max);
3439 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 data.recycle();
3442 reply.recycle();
3443 }
3444 public int getProcessLimit() throws RemoteException
3445 {
3446 Parcel data = Parcel.obtain();
3447 Parcel reply = Parcel.obtain();
3448 data.writeInterfaceToken(IActivityManager.descriptor);
3449 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3450 reply.readException();
3451 int res = reply.readInt();
3452 data.recycle();
3453 reply.recycle();
3454 return res;
3455 }
3456 public void setProcessForeground(IBinder token, int pid,
3457 boolean isForeground) throws RemoteException {
3458 Parcel data = Parcel.obtain();
3459 Parcel reply = Parcel.obtain();
3460 data.writeInterfaceToken(IActivityManager.descriptor);
3461 data.writeStrongBinder(token);
3462 data.writeInt(pid);
3463 data.writeInt(isForeground ? 1 : 0);
3464 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3465 reply.readException();
3466 data.recycle();
3467 reply.recycle();
3468 }
3469 public int checkPermission(String permission, int pid, int uid)
3470 throws RemoteException {
3471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 data.writeString(permission);
3475 data.writeInt(pid);
3476 data.writeInt(uid);
3477 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3478 reply.readException();
3479 int res = reply.readInt();
3480 data.recycle();
3481 reply.recycle();
3482 return res;
3483 }
3484 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003485 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003486 Parcel data = Parcel.obtain();
3487 Parcel reply = Parcel.obtain();
3488 data.writeInterfaceToken(IActivityManager.descriptor);
3489 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003490 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003491 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003492 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3493 reply.readException();
3494 boolean res = reply.readInt() != 0;
3495 data.recycle();
3496 reply.recycle();
3497 return res;
3498 }
3499 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3500 throws RemoteException {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 uri.writeToParcel(data, 0);
3505 data.writeInt(pid);
3506 data.writeInt(uid);
3507 data.writeInt(mode);
3508 mRemote.transact(CHECK_URI_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 void grantUriPermission(IApplicationThread caller, String targetPkg,
3516 Uri uri, int mode) throws RemoteException {
3517 Parcel data = Parcel.obtain();
3518 Parcel reply = Parcel.obtain();
3519 data.writeInterfaceToken(IActivityManager.descriptor);
3520 data.writeStrongBinder(caller.asBinder());
3521 data.writeString(targetPkg);
3522 uri.writeToParcel(data, 0);
3523 data.writeInt(mode);
3524 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 data.recycle();
3527 reply.recycle();
3528 }
3529 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3530 int mode) throws RemoteException {
3531 Parcel data = Parcel.obtain();
3532 Parcel reply = Parcel.obtain();
3533 data.writeInterfaceToken(IActivityManager.descriptor);
3534 data.writeStrongBinder(caller.asBinder());
3535 uri.writeToParcel(data, 0);
3536 data.writeInt(mode);
3537 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3538 reply.readException();
3539 data.recycle();
3540 reply.recycle();
3541 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003542
3543 @Override
3544 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 uri.writeToParcel(data, 0);
3549 data.writeInt(mode);
3550 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3551 reply.readException();
3552 data.recycle();
3553 reply.recycle();
3554 }
3555
3556 @Override
3557 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3558 Parcel data = Parcel.obtain();
3559 Parcel reply = Parcel.obtain();
3560 data.writeInterfaceToken(IActivityManager.descriptor);
3561 uri.writeToParcel(data, 0);
3562 data.writeInt(mode);
3563 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3564 reply.readException();
3565 data.recycle();
3566 reply.recycle();
3567 }
3568
3569 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003570 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3571 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003572 Parcel data = Parcel.obtain();
3573 Parcel reply = Parcel.obtain();
3574 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003575 data.writeString(packageName);
3576 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003577 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3578 reply.readException();
3579 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3580 reply);
3581 data.recycle();
3582 reply.recycle();
3583 return perms;
3584 }
3585
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003586 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3587 throws RemoteException {
3588 Parcel data = Parcel.obtain();
3589 Parcel reply = Parcel.obtain();
3590 data.writeInterfaceToken(IActivityManager.descriptor);
3591 data.writeStrongBinder(who.asBinder());
3592 data.writeInt(waiting ? 1 : 0);
3593 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3594 reply.readException();
3595 data.recycle();
3596 reply.recycle();
3597 }
3598 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3599 Parcel data = Parcel.obtain();
3600 Parcel reply = Parcel.obtain();
3601 data.writeInterfaceToken(IActivityManager.descriptor);
3602 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3603 reply.readException();
3604 outInfo.readFromParcel(reply);
3605 data.recycle();
3606 reply.recycle();
3607 }
3608 public void unhandledBack() throws RemoteException
3609 {
3610 Parcel data = Parcel.obtain();
3611 Parcel reply = Parcel.obtain();
3612 data.writeInterfaceToken(IActivityManager.descriptor);
3613 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 data.recycle();
3616 reply.recycle();
3617 }
3618 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3619 {
3620 Parcel data = Parcel.obtain();
3621 Parcel reply = Parcel.obtain();
3622 data.writeInterfaceToken(IActivityManager.descriptor);
3623 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3624 reply.readException();
3625 ParcelFileDescriptor pfd = null;
3626 if (reply.readInt() != 0) {
3627 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3628 }
3629 data.recycle();
3630 reply.recycle();
3631 return pfd;
3632 }
3633 public void goingToSleep() throws RemoteException
3634 {
3635 Parcel data = Parcel.obtain();
3636 Parcel reply = Parcel.obtain();
3637 data.writeInterfaceToken(IActivityManager.descriptor);
3638 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3639 reply.readException();
3640 data.recycle();
3641 reply.recycle();
3642 }
3643 public void wakingUp() throws RemoteException
3644 {
3645 Parcel data = Parcel.obtain();
3646 Parcel reply = Parcel.obtain();
3647 data.writeInterfaceToken(IActivityManager.descriptor);
3648 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3649 reply.readException();
3650 data.recycle();
3651 reply.recycle();
3652 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003653 public void setLockScreenShown(boolean shown) throws RemoteException
3654 {
3655 Parcel data = Parcel.obtain();
3656 Parcel reply = Parcel.obtain();
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 data.writeInt(shown ? 1 : 0);
3659 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3660 reply.readException();
3661 data.recycle();
3662 reply.recycle();
3663 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003664 public void setDebugApp(
3665 String packageName, boolean waitForDebugger, boolean persistent)
3666 throws RemoteException
3667 {
3668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 data.writeString(packageName);
3672 data.writeInt(waitForDebugger ? 1 : 0);
3673 data.writeInt(persistent ? 1 : 0);
3674 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3675 reply.readException();
3676 data.recycle();
3677 reply.recycle();
3678 }
3679 public void setAlwaysFinish(boolean enabled) throws RemoteException
3680 {
3681 Parcel data = Parcel.obtain();
3682 Parcel reply = Parcel.obtain();
3683 data.writeInterfaceToken(IActivityManager.descriptor);
3684 data.writeInt(enabled ? 1 : 0);
3685 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3686 reply.readException();
3687 data.recycle();
3688 reply.recycle();
3689 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003690 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003691 {
3692 Parcel data = Parcel.obtain();
3693 Parcel reply = Parcel.obtain();
3694 data.writeInterfaceToken(IActivityManager.descriptor);
3695 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003696 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003697 reply.readException();
3698 data.recycle();
3699 reply.recycle();
3700 }
3701 public void enterSafeMode() throws RemoteException {
3702 Parcel data = Parcel.obtain();
3703 data.writeInterfaceToken(IActivityManager.descriptor);
3704 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3705 data.recycle();
3706 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003707 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3708 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003709 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003710 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003711 data.writeStrongBinder(sender.asBinder());
3712 data.writeInt(sourceUid);
3713 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003714 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3715 data.recycle();
3716 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003717 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003722 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003723 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003724 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003725 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003726 boolean res = reply.readInt() != 0;
3727 data.recycle();
3728 reply.recycle();
3729 return res;
3730 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003731 @Override
3732 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3733 Parcel data = Parcel.obtain();
3734 Parcel reply = Parcel.obtain();
3735 data.writeInterfaceToken(IActivityManager.descriptor);
3736 data.writeString(reason);
3737 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3738 boolean res = reply.readInt() != 0;
3739 data.recycle();
3740 reply.recycle();
3741 return res;
3742 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003743 public void startRunning(String pkg, String cls, String action,
3744 String indata) throws RemoteException {
3745 Parcel data = Parcel.obtain();
3746 Parcel reply = Parcel.obtain();
3747 data.writeInterfaceToken(IActivityManager.descriptor);
3748 data.writeString(pkg);
3749 data.writeString(cls);
3750 data.writeString(action);
3751 data.writeString(indata);
3752 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3753 reply.readException();
3754 data.recycle();
3755 reply.recycle();
3756 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003757 public boolean testIsSystemReady()
3758 {
3759 /* this base class version is never called */
3760 return true;
3761 }
Dan Egnor60d87622009-12-16 16:32:58 -08003762 public void handleApplicationCrash(IBinder app,
3763 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3764 {
3765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeStrongBinder(app);
3769 crashInfo.writeToParcel(data, 0);
3770 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3771 reply.readException();
3772 reply.recycle();
3773 data.recycle();
3774 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003775
Dan Egnor60d87622009-12-16 16:32:58 -08003776 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003777 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003778 {
3779 Parcel data = Parcel.obtain();
3780 Parcel reply = Parcel.obtain();
3781 data.writeInterfaceToken(IActivityManager.descriptor);
3782 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003783 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003784 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003785 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003786 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003787 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 reply.recycle();
3789 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003790 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003791 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003792
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003793 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003794 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003795 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003796 {
3797 Parcel data = Parcel.obtain();
3798 Parcel reply = Parcel.obtain();
3799 data.writeInterfaceToken(IActivityManager.descriptor);
3800 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003801 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003802 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003803 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3804 reply.readException();
3805 reply.recycle();
3806 data.recycle();
3807 }
3808
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003809 public void signalPersistentProcesses(int sig) throws RemoteException {
3810 Parcel data = Parcel.obtain();
3811 Parcel reply = Parcel.obtain();
3812 data.writeInterfaceToken(IActivityManager.descriptor);
3813 data.writeInt(sig);
3814 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3815 reply.readException();
3816 data.recycle();
3817 reply.recycle();
3818 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003819
Dianne Hackborn1676c852012-09-10 14:52:30 -07003820 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 Parcel data = Parcel.obtain();
3822 Parcel reply = Parcel.obtain();
3823 data.writeInterfaceToken(IActivityManager.descriptor);
3824 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003825 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003826 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3827 reply.readException();
3828 data.recycle();
3829 reply.recycle();
3830 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003831
3832 public void killAllBackgroundProcesses() throws RemoteException {
3833 Parcel data = Parcel.obtain();
3834 Parcel reply = Parcel.obtain();
3835 data.writeInterfaceToken(IActivityManager.descriptor);
3836 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3837 reply.readException();
3838 data.recycle();
3839 reply.recycle();
3840 }
3841
Dianne Hackborn1676c852012-09-10 14:52:30 -07003842 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003843 Parcel data = Parcel.obtain();
3844 Parcel reply = Parcel.obtain();
3845 data.writeInterfaceToken(IActivityManager.descriptor);
3846 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003847 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003848 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003849 reply.readException();
3850 data.recycle();
3851 reply.recycle();
3852 }
3853
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003854 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3855 throws RemoteException
3856 {
3857 Parcel data = Parcel.obtain();
3858 Parcel reply = Parcel.obtain();
3859 data.writeInterfaceToken(IActivityManager.descriptor);
3860 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3861 reply.readException();
3862 outInfo.readFromParcel(reply);
3863 reply.recycle();
3864 data.recycle();
3865 }
3866
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003867 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3868 {
3869 Parcel data = Parcel.obtain();
3870 Parcel reply = Parcel.obtain();
3871 data.writeInterfaceToken(IActivityManager.descriptor);
3872 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3873 reply.readException();
3874 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3875 reply.recycle();
3876 data.recycle();
3877 return res;
3878 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003879
Dianne Hackborn1676c852012-09-10 14:52:30 -07003880 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003881 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003882 {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003887 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003888 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003889 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003890 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003891 if (fd != null) {
3892 data.writeInt(1);
3893 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3894 } else {
3895 data.writeInt(0);
3896 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003897 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3898 reply.readException();
3899 boolean res = reply.readInt() != 0;
3900 reply.recycle();
3901 data.recycle();
3902 return res;
3903 }
3904
Dianne Hackborn55280a92009-05-07 15:53:46 -07003905 public boolean shutdown(int timeout) throws RemoteException
3906 {
3907 Parcel data = Parcel.obtain();
3908 Parcel reply = Parcel.obtain();
3909 data.writeInterfaceToken(IActivityManager.descriptor);
3910 data.writeInt(timeout);
3911 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 boolean res = reply.readInt() != 0;
3914 reply.recycle();
3915 data.recycle();
3916 return res;
3917 }
3918
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003919 public void stopAppSwitches() throws RemoteException {
3920 Parcel data = Parcel.obtain();
3921 Parcel reply = Parcel.obtain();
3922 data.writeInterfaceToken(IActivityManager.descriptor);
3923 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3924 reply.readException();
3925 reply.recycle();
3926 data.recycle();
3927 }
3928
3929 public void resumeAppSwitches() throws RemoteException {
3930 Parcel data = Parcel.obtain();
3931 Parcel reply = Parcel.obtain();
3932 data.writeInterfaceToken(IActivityManager.descriptor);
3933 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3934 reply.readException();
3935 reply.recycle();
3936 data.recycle();
3937 }
3938
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003939 public void killApplicationWithAppId(String pkg, int appid, String reason)
3940 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003945 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003946 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003947 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003948 reply.readException();
3949 data.recycle();
3950 reply.recycle();
3951 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003952
3953 public void closeSystemDialogs(String reason) throws RemoteException {
3954 Parcel data = Parcel.obtain();
3955 Parcel reply = Parcel.obtain();
3956 data.writeInterfaceToken(IActivityManager.descriptor);
3957 data.writeString(reason);
3958 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3959 reply.readException();
3960 data.recycle();
3961 reply.recycle();
3962 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003963
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003964 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003965 throws RemoteException {
3966 Parcel data = Parcel.obtain();
3967 Parcel reply = Parcel.obtain();
3968 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003969 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003970 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3971 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003972 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003973 data.recycle();
3974 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003975 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003976 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003977
3978 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3979 Parcel data = Parcel.obtain();
3980 Parcel reply = Parcel.obtain();
3981 data.writeInterfaceToken(IActivityManager.descriptor);
3982 data.writeString(processName);
3983 data.writeInt(uid);
3984 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3985 reply.readException();
3986 data.recycle();
3987 reply.recycle();
3988 }
3989
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003990 public void overridePendingTransition(IBinder token, String packageName,
3991 int enterAnim, int exitAnim) throws RemoteException {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 data.writeStrongBinder(token);
3996 data.writeString(packageName);
3997 data.writeInt(enterAnim);
3998 data.writeInt(exitAnim);
3999 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4000 reply.readException();
4001 data.recycle();
4002 reply.recycle();
4003 }
4004
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004005 public boolean isUserAMonkey() throws RemoteException {
4006 Parcel data = Parcel.obtain();
4007 Parcel reply = Parcel.obtain();
4008 data.writeInterfaceToken(IActivityManager.descriptor);
4009 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4010 reply.readException();
4011 boolean res = reply.readInt() != 0;
4012 data.recycle();
4013 reply.recycle();
4014 return res;
4015 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004016
4017 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4018 Parcel data = Parcel.obtain();
4019 Parcel reply = Parcel.obtain();
4020 data.writeInterfaceToken(IActivityManager.descriptor);
4021 data.writeInt(monkey ? 1 : 0);
4022 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4023 reply.readException();
4024 data.recycle();
4025 reply.recycle();
4026 }
4027
Dianne Hackborn860755f2010-06-03 18:47:52 -07004028 public void finishHeavyWeightApp() throws RemoteException {
4029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4033 reply.readException();
4034 data.recycle();
4035 reply.recycle();
4036 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004037
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004038 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004039 throws RemoteException {
4040 Parcel data = Parcel.obtain();
4041 Parcel reply = Parcel.obtain();
4042 data.writeInterfaceToken(IActivityManager.descriptor);
4043 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004044 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4045 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004046 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004047 data.recycle();
4048 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004049 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004050 }
4051
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004052 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004053 throws RemoteException {
4054 Parcel data = Parcel.obtain();
4055 Parcel reply = Parcel.obtain();
4056 data.writeInterfaceToken(IActivityManager.descriptor);
4057 data.writeStrongBinder(token);
4058 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004059 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004060 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004061 data.recycle();
4062 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004063 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004064 }
4065
Daniel Sandler69a48172010-06-23 16:29:36 -04004066 public void setImmersive(IBinder token, boolean immersive)
4067 throws RemoteException {
4068 Parcel data = Parcel.obtain();
4069 Parcel reply = Parcel.obtain();
4070 data.writeInterfaceToken(IActivityManager.descriptor);
4071 data.writeStrongBinder(token);
4072 data.writeInt(immersive ? 1 : 0);
4073 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4074 reply.readException();
4075 data.recycle();
4076 reply.recycle();
4077 }
4078
4079 public boolean isImmersive(IBinder token)
4080 throws RemoteException {
4081 Parcel data = Parcel.obtain();
4082 Parcel reply = Parcel.obtain();
4083 data.writeInterfaceToken(IActivityManager.descriptor);
4084 data.writeStrongBinder(token);
4085 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004086 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004087 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004088 data.recycle();
4089 reply.recycle();
4090 return res;
4091 }
4092
4093 public boolean isTopActivityImmersive()
4094 throws RemoteException {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004099 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004100 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004101 data.recycle();
4102 reply.recycle();
4103 return res;
4104 }
4105
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004106 public void crashApplication(int uid, int initialPid, String packageName,
4107 String message) throws RemoteException {
4108 Parcel data = Parcel.obtain();
4109 Parcel reply = Parcel.obtain();
4110 data.writeInterfaceToken(IActivityManager.descriptor);
4111 data.writeInt(uid);
4112 data.writeInt(initialPid);
4113 data.writeString(packageName);
4114 data.writeString(message);
4115 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4116 reply.readException();
4117 data.recycle();
4118 reply.recycle();
4119 }
Andy McFadden824c5102010-07-09 16:26:57 -07004120
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004121 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004122 Parcel data = Parcel.obtain();
4123 Parcel reply = Parcel.obtain();
4124 data.writeInterfaceToken(IActivityManager.descriptor);
4125 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004126 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004127 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4128 reply.readException();
4129 String res = reply.readString();
4130 data.recycle();
4131 reply.recycle();
4132 return res;
4133 }
4134
Dianne Hackborn7e269642010-08-25 19:50:20 -07004135 public IBinder newUriPermissionOwner(String name)
4136 throws RemoteException {
4137 Parcel data = Parcel.obtain();
4138 Parcel reply = Parcel.obtain();
4139 data.writeInterfaceToken(IActivityManager.descriptor);
4140 data.writeString(name);
4141 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4142 reply.readException();
4143 IBinder res = reply.readStrongBinder();
4144 data.recycle();
4145 reply.recycle();
4146 return res;
4147 }
4148
4149 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4150 Uri uri, int mode) throws RemoteException {
4151 Parcel data = Parcel.obtain();
4152 Parcel reply = Parcel.obtain();
4153 data.writeInterfaceToken(IActivityManager.descriptor);
4154 data.writeStrongBinder(owner);
4155 data.writeInt(fromUid);
4156 data.writeString(targetPkg);
4157 uri.writeToParcel(data, 0);
4158 data.writeInt(mode);
4159 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4160 reply.readException();
4161 data.recycle();
4162 reply.recycle();
4163 }
4164
4165 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4166 int mode) throws RemoteException {
4167 Parcel data = Parcel.obtain();
4168 Parcel reply = Parcel.obtain();
4169 data.writeInterfaceToken(IActivityManager.descriptor);
4170 data.writeStrongBinder(owner);
4171 if (uri != null) {
4172 data.writeInt(1);
4173 uri.writeToParcel(data, 0);
4174 } else {
4175 data.writeInt(0);
4176 }
4177 data.writeInt(mode);
4178 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4179 reply.readException();
4180 data.recycle();
4181 reply.recycle();
4182 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004183
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004184 public int checkGrantUriPermission(int callingUid, String targetPkg,
4185 Uri uri, int modeFlags) throws RemoteException {
4186 Parcel data = Parcel.obtain();
4187 Parcel reply = Parcel.obtain();
4188 data.writeInterfaceToken(IActivityManager.descriptor);
4189 data.writeInt(callingUid);
4190 data.writeString(targetPkg);
4191 uri.writeToParcel(data, 0);
4192 data.writeInt(modeFlags);
4193 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4194 reply.readException();
4195 int res = reply.readInt();
4196 data.recycle();
4197 reply.recycle();
4198 return res;
4199 }
4200
Dianne Hackborn1676c852012-09-10 14:52:30 -07004201 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004202 String path, ParcelFileDescriptor fd) throws RemoteException {
4203 Parcel data = Parcel.obtain();
4204 Parcel reply = Parcel.obtain();
4205 data.writeInterfaceToken(IActivityManager.descriptor);
4206 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004207 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004208 data.writeInt(managed ? 1 : 0);
4209 data.writeString(path);
4210 if (fd != null) {
4211 data.writeInt(1);
4212 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4213 } else {
4214 data.writeInt(0);
4215 }
4216 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4217 reply.readException();
4218 boolean res = reply.readInt() != 0;
4219 reply.recycle();
4220 data.recycle();
4221 return res;
4222 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004223
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004224 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004225 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004226 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004227 Parcel data = Parcel.obtain();
4228 Parcel reply = Parcel.obtain();
4229 data.writeInterfaceToken(IActivityManager.descriptor);
4230 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004231 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004232 data.writeTypedArray(intents, 0);
4233 data.writeStringArray(resolvedTypes);
4234 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004235 if (options != null) {
4236 data.writeInt(1);
4237 options.writeToParcel(data, 0);
4238 } else {
4239 data.writeInt(0);
4240 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004241 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004242 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4243 reply.readException();
4244 int result = reply.readInt();
4245 reply.recycle();
4246 data.recycle();
4247 return result;
4248 }
4249
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004250 public int getFrontActivityScreenCompatMode() throws RemoteException {
4251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
4254 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4255 reply.readException();
4256 int mode = reply.readInt();
4257 reply.recycle();
4258 data.recycle();
4259 return mode;
4260 }
4261
4262 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4263 Parcel data = Parcel.obtain();
4264 Parcel reply = Parcel.obtain();
4265 data.writeInterfaceToken(IActivityManager.descriptor);
4266 data.writeInt(mode);
4267 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4268 reply.readException();
4269 reply.recycle();
4270 data.recycle();
4271 }
4272
4273 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4274 Parcel data = Parcel.obtain();
4275 Parcel reply = Parcel.obtain();
4276 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004277 data.writeString(packageName);
4278 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004279 reply.readException();
4280 int mode = reply.readInt();
4281 reply.recycle();
4282 data.recycle();
4283 return mode;
4284 }
4285
4286 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004287 throws RemoteException {
4288 Parcel data = Parcel.obtain();
4289 Parcel reply = Parcel.obtain();
4290 data.writeInterfaceToken(IActivityManager.descriptor);
4291 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004292 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004293 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4294 reply.readException();
4295 reply.recycle();
4296 data.recycle();
4297 }
4298
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004299 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4300 Parcel data = Parcel.obtain();
4301 Parcel reply = Parcel.obtain();
4302 data.writeInterfaceToken(IActivityManager.descriptor);
4303 data.writeString(packageName);
4304 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4305 reply.readException();
4306 boolean ask = reply.readInt() != 0;
4307 reply.recycle();
4308 data.recycle();
4309 return ask;
4310 }
4311
4312 public void setPackageAskScreenCompat(String packageName, boolean ask)
4313 throws RemoteException {
4314 Parcel data = Parcel.obtain();
4315 Parcel reply = Parcel.obtain();
4316 data.writeInterfaceToken(IActivityManager.descriptor);
4317 data.writeString(packageName);
4318 data.writeInt(ask ? 1 : 0);
4319 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4320 reply.readException();
4321 reply.recycle();
4322 data.recycle();
4323 }
4324
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004325 public boolean switchUser(int userid) throws RemoteException {
4326 Parcel data = Parcel.obtain();
4327 Parcel reply = Parcel.obtain();
4328 data.writeInterfaceToken(IActivityManager.descriptor);
4329 data.writeInt(userid);
4330 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4331 reply.readException();
4332 boolean result = reply.readInt() != 0;
4333 reply.recycle();
4334 data.recycle();
4335 return result;
4336 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004337
Kenny Guy08488bf2014-02-21 17:40:37 +00004338 public boolean startUserInBackground(int userid) throws RemoteException {
4339 Parcel data = Parcel.obtain();
4340 Parcel reply = Parcel.obtain();
4341 data.writeInterfaceToken(IActivityManager.descriptor);
4342 data.writeInt(userid);
4343 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4344 reply.readException();
4345 boolean result = reply.readInt() != 0;
4346 reply.recycle();
4347 data.recycle();
4348 return result;
4349 }
4350
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004351 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4352 Parcel data = Parcel.obtain();
4353 Parcel reply = Parcel.obtain();
4354 data.writeInterfaceToken(IActivityManager.descriptor);
4355 data.writeInt(userid);
4356 data.writeStrongInterface(callback);
4357 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4358 reply.readException();
4359 int result = reply.readInt();
4360 reply.recycle();
4361 data.recycle();
4362 return result;
4363 }
4364
Amith Yamasani52f1d752012-03-28 18:19:29 -07004365 public UserInfo getCurrentUser() throws RemoteException {
4366 Parcel data = Parcel.obtain();
4367 Parcel reply = Parcel.obtain();
4368 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004369 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004370 reply.readException();
4371 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4372 reply.recycle();
4373 data.recycle();
4374 return userInfo;
4375 }
4376
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004377 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004378 Parcel data = Parcel.obtain();
4379 Parcel reply = Parcel.obtain();
4380 data.writeInterfaceToken(IActivityManager.descriptor);
4381 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004382 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004383 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4384 reply.readException();
4385 boolean result = reply.readInt() != 0;
4386 reply.recycle();
4387 data.recycle();
4388 return result;
4389 }
4390
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004391 public int[] getRunningUserIds() throws RemoteException {
4392 Parcel data = Parcel.obtain();
4393 Parcel reply = Parcel.obtain();
4394 data.writeInterfaceToken(IActivityManager.descriptor);
4395 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4396 reply.readException();
4397 int[] result = reply.createIntArray();
4398 reply.recycle();
4399 data.recycle();
4400 return result;
4401 }
4402
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004403 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4404 Parcel data = Parcel.obtain();
4405 Parcel reply = Parcel.obtain();
4406 data.writeInterfaceToken(IActivityManager.descriptor);
4407 data.writeInt(taskId);
4408 data.writeInt(subTaskIndex);
4409 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4410 reply.readException();
4411 boolean result = reply.readInt() != 0;
4412 reply.recycle();
4413 data.recycle();
4414 return result;
4415 }
4416
4417 public boolean removeTask(int taskId, int flags) throws RemoteException {
4418 Parcel data = Parcel.obtain();
4419 Parcel reply = Parcel.obtain();
4420 data.writeInterfaceToken(IActivityManager.descriptor);
4421 data.writeInt(taskId);
4422 data.writeInt(flags);
4423 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4424 reply.readException();
4425 boolean result = reply.readInt() != 0;
4426 reply.recycle();
4427 data.recycle();
4428 return result;
4429 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004430
Jeff Sharkeya4620792011-05-20 15:29:23 -07004431 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4432 Parcel data = Parcel.obtain();
4433 Parcel reply = Parcel.obtain();
4434 data.writeInterfaceToken(IActivityManager.descriptor);
4435 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4436 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4437 reply.readException();
4438 data.recycle();
4439 reply.recycle();
4440 }
4441
4442 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4443 Parcel data = Parcel.obtain();
4444 Parcel reply = Parcel.obtain();
4445 data.writeInterfaceToken(IActivityManager.descriptor);
4446 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4447 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4448 reply.readException();
4449 data.recycle();
4450 reply.recycle();
4451 }
4452
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004453 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4454 Parcel data = Parcel.obtain();
4455 Parcel reply = Parcel.obtain();
4456 data.writeInterfaceToken(IActivityManager.descriptor);
4457 data.writeStrongBinder(sender.asBinder());
4458 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4459 reply.readException();
4460 boolean res = reply.readInt() != 0;
4461 data.recycle();
4462 reply.recycle();
4463 return res;
4464 }
4465
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004466 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4467 Parcel data = Parcel.obtain();
4468 Parcel reply = Parcel.obtain();
4469 data.writeInterfaceToken(IActivityManager.descriptor);
4470 data.writeStrongBinder(sender.asBinder());
4471 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 boolean res = reply.readInt() != 0;
4474 data.recycle();
4475 reply.recycle();
4476 return res;
4477 }
4478
Dianne Hackborn81038902012-11-26 17:04:09 -08004479 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4480 Parcel data = Parcel.obtain();
4481 Parcel reply = Parcel.obtain();
4482 data.writeInterfaceToken(IActivityManager.descriptor);
4483 data.writeStrongBinder(sender.asBinder());
4484 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4485 reply.readException();
4486 Intent res = reply.readInt() != 0
4487 ? Intent.CREATOR.createFromParcel(reply) : null;
4488 data.recycle();
4489 reply.recycle();
4490 return res;
4491 }
4492
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004493 public String getTagForIntentSender(IIntentSender sender, String prefix)
4494 throws RemoteException {
4495 Parcel data = Parcel.obtain();
4496 Parcel reply = Parcel.obtain();
4497 data.writeInterfaceToken(IActivityManager.descriptor);
4498 data.writeStrongBinder(sender.asBinder());
4499 data.writeString(prefix);
4500 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4501 reply.readException();
4502 String res = reply.readString();
4503 data.recycle();
4504 reply.recycle();
4505 return res;
4506 }
4507
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004508 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4509 {
4510 Parcel data = Parcel.obtain();
4511 Parcel reply = Parcel.obtain();
4512 data.writeInterfaceToken(IActivityManager.descriptor);
4513 values.writeToParcel(data, 0);
4514 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4515 reply.readException();
4516 data.recycle();
4517 reply.recycle();
4518 }
4519
Dianne Hackbornb437e092011-08-05 17:50:29 -07004520 public long[] getProcessPss(int[] pids) throws RemoteException {
4521 Parcel data = Parcel.obtain();
4522 Parcel reply = Parcel.obtain();
4523 data.writeInterfaceToken(IActivityManager.descriptor);
4524 data.writeIntArray(pids);
4525 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4526 reply.readException();
4527 long[] res = reply.createLongArray();
4528 data.recycle();
4529 reply.recycle();
4530 return res;
4531 }
4532
Dianne Hackborn661cd522011-08-22 00:26:20 -07004533 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4534 Parcel data = Parcel.obtain();
4535 Parcel reply = Parcel.obtain();
4536 data.writeInterfaceToken(IActivityManager.descriptor);
4537 TextUtils.writeToParcel(msg, data, 0);
4538 data.writeInt(always ? 1 : 0);
4539 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4540 reply.readException();
4541 data.recycle();
4542 reply.recycle();
4543 }
4544
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004545 public void dismissKeyguardOnNextActivity() throws RemoteException {
4546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
4549 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4550 reply.readException();
4551 data.recycle();
4552 reply.recycle();
4553 }
4554
Adam Powelldd8fab22012-03-22 17:47:27 -07004555 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4556 throws RemoteException {
4557 Parcel data = Parcel.obtain();
4558 Parcel reply = Parcel.obtain();
4559 data.writeInterfaceToken(IActivityManager.descriptor);
4560 data.writeStrongBinder(token);
4561 data.writeString(destAffinity);
4562 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4563 reply.readException();
4564 boolean result = reply.readInt() != 0;
4565 data.recycle();
4566 reply.recycle();
4567 return result;
4568 }
4569
4570 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4571 throws RemoteException {
4572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 data.writeStrongBinder(token);
4576 target.writeToParcel(data, 0);
4577 data.writeInt(resultCode);
4578 if (resultData != null) {
4579 data.writeInt(1);
4580 resultData.writeToParcel(data, 0);
4581 } else {
4582 data.writeInt(0);
4583 }
4584 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4585 reply.readException();
4586 boolean result = reply.readInt() != 0;
4587 data.recycle();
4588 reply.recycle();
4589 return result;
4590 }
4591
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004592 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4593 Parcel data = Parcel.obtain();
4594 Parcel reply = Parcel.obtain();
4595 data.writeInterfaceToken(IActivityManager.descriptor);
4596 data.writeStrongBinder(activityToken);
4597 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4598 reply.readException();
4599 int result = reply.readInt();
4600 data.recycle();
4601 reply.recycle();
4602 return result;
4603 }
4604
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004605 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4606 Parcel data = Parcel.obtain();
4607 Parcel reply = Parcel.obtain();
4608 data.writeInterfaceToken(IActivityManager.descriptor);
4609 data.writeStrongBinder(activityToken);
4610 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4611 reply.readException();
4612 String result = reply.readString();
4613 data.recycle();
4614 reply.recycle();
4615 return result;
4616 }
4617
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004618 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4623 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 data.recycle();
4626 reply.recycle();
4627 }
4628
4629 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4630 Parcel data = Parcel.obtain();
4631 Parcel reply = Parcel.obtain();
4632 data.writeInterfaceToken(IActivityManager.descriptor);
4633 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4634 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4635 reply.readException();
4636 data.recycle();
4637 reply.recycle();
4638 }
4639
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004640 public void requestBugReport() throws RemoteException {
4641 Parcel data = Parcel.obtain();
4642 Parcel reply = Parcel.obtain();
4643 data.writeInterfaceToken(IActivityManager.descriptor);
4644 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4645 reply.readException();
4646 data.recycle();
4647 reply.recycle();
4648 }
4649
Jeff Brownbd181bb2013-09-10 16:44:24 -07004650 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4651 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004652 Parcel data = Parcel.obtain();
4653 Parcel reply = Parcel.obtain();
4654 data.writeInterfaceToken(IActivityManager.descriptor);
4655 data.writeInt(pid);
4656 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004657 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004658 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 long res = reply.readInt();
4661 data.recycle();
4662 reply.recycle();
4663 return res;
4664 }
4665
Adam Skorydfc7fd72013-08-05 19:23:41 -07004666 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004667 Parcel data = Parcel.obtain();
4668 Parcel reply = Parcel.obtain();
4669 data.writeInterfaceToken(IActivityManager.descriptor);
4670 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004671 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004672 reply.readException();
4673 Bundle res = reply.readBundle();
4674 data.recycle();
4675 reply.recycle();
4676 return res;
4677 }
4678
Adam Skory7140a252013-09-11 12:04:58 +01004679 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004680 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004681 Parcel data = Parcel.obtain();
4682 Parcel reply = Parcel.obtain();
4683 data.writeInterfaceToken(IActivityManager.descriptor);
4684 data.writeStrongBinder(token);
4685 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004686 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004687 reply.readException();
4688 data.recycle();
4689 reply.recycle();
4690 }
4691
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004692 public void killUid(int uid, String reason) throws RemoteException {
4693 Parcel data = Parcel.obtain();
4694 Parcel reply = Parcel.obtain();
4695 data.writeInterfaceToken(IActivityManager.descriptor);
4696 data.writeInt(uid);
4697 data.writeString(reason);
4698 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4699 reply.readException();
4700 data.recycle();
4701 reply.recycle();
4702 }
4703
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004704 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4705 Parcel data = Parcel.obtain();
4706 Parcel reply = Parcel.obtain();
4707 data.writeInterfaceToken(IActivityManager.descriptor);
4708 data.writeStrongBinder(who);
4709 data.writeInt(allowRestart ? 1 : 0);
4710 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
4715
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004716 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 data.writeStrongBinder(token);
4721 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4722 reply.readException();
4723 data.recycle();
4724 reply.recycle();
4725 }
4726
Craig Mautner5eda9b32013-07-02 11:58:16 -07004727 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4728 Parcel data = Parcel.obtain();
4729 Parcel reply = Parcel.obtain();
4730 data.writeInterfaceToken(IActivityManager.descriptor);
4731 data.writeStrongBinder(token);
4732 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4733 reply.readException();
4734 data.recycle();
4735 reply.recycle();
4736 }
4737
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004738 public void restart() throws RemoteException {
4739 Parcel data = Parcel.obtain();
4740 Parcel reply = Parcel.obtain();
4741 data.writeInterfaceToken(IActivityManager.descriptor);
4742 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4743 reply.readException();
4744 data.recycle();
4745 reply.recycle();
4746 }
4747
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004748 public void performIdleMaintenance() throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4753 reply.readException();
4754 data.recycle();
4755 reply.recycle();
4756 }
4757
Craig Mautner4a1cb222013-12-04 16:14:06 -08004758 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4759 IActivityContainerCallback callback) throws RemoteException {
4760 Parcel data = Parcel.obtain();
4761 Parcel reply = Parcel.obtain();
4762 data.writeInterfaceToken(IActivityManager.descriptor);
4763 data.writeStrongBinder(parentActivityToken);
4764 data.writeStrongBinder((IBinder)callback);
4765 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4766 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004767 final int result = reply.readInt();
4768 final IActivityContainer res;
4769 if (result == 1) {
4770 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4771 } else {
4772 res = null;
4773 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004774 data.recycle();
4775 reply.recycle();
4776 return res;
4777 }
4778
Craig Mautner95da1082014-02-24 17:54:35 -08004779 public void deleteActivityContainer(IActivityContainer activityContainer)
4780 throws RemoteException {
4781 Parcel data = Parcel.obtain();
4782 Parcel reply = Parcel.obtain();
4783 data.writeInterfaceToken(IActivityManager.descriptor);
4784 data.writeStrongBinder(activityContainer.asBinder());
4785 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4786 reply.readException();
4787 data.recycle();
4788 reply.recycle();
4789 }
4790
Craig Mautnere0a38842013-12-16 16:14:02 -08004791 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4792 throws RemoteException {
4793 Parcel data = Parcel.obtain();
4794 Parcel reply = Parcel.obtain();
4795 data.writeInterfaceToken(IActivityManager.descriptor);
4796 data.writeStrongBinder(activityToken);
4797 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4798 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004799 final int result = reply.readInt();
4800 final IActivityContainer res;
4801 if (result == 1) {
4802 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4803 } else {
4804 res = null;
4805 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004806 data.recycle();
4807 reply.recycle();
4808 return res;
4809 }
4810
Craig Mautner4a1cb222013-12-04 16:14:06 -08004811 public IBinder getHomeActivityToken() throws RemoteException {
4812 Parcel data = Parcel.obtain();
4813 Parcel reply = Parcel.obtain();
4814 data.writeInterfaceToken(IActivityManager.descriptor);
4815 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4816 reply.readException();
4817 IBinder res = reply.readStrongBinder();
4818 data.recycle();
4819 reply.recycle();
4820 return res;
4821 }
4822
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004823 private IBinder mRemote;
4824}