blob: 7b81713c0fccc8f00b057f6dedd0511e37e2d0f9 [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
104 static public void noteWakeupAlarm(PendingIntent ps) {
105 try {
106 getDefault().noteWakeupAlarm(ps.getTarget());
107 } catch (RemoteException ex) {
108 }
109 }
110
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800111 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 attachInterface(this, descriptor);
113 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700114
115 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
117 throws RemoteException {
118 switch (code) {
119 case START_ACTIVITY_TRANSACTION:
120 {
121 data.enforceInterface(IActivityManager.descriptor);
122 IBinder b = data.readStrongBinder();
123 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800124 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125 Intent intent = Intent.CREATOR.createFromParcel(data);
126 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800128 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700130 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700131 String profileFile = data.readString();
132 ParcelFileDescriptor profileFd = data.readInt() != 0
133 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 Bundle options = data.readInt() != 0
135 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800136 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 resultTo, resultWho, requestCode, startFlags,
138 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 reply.writeNoException();
140 reply.writeInt(result);
141 return true;
142 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700143
Amith Yamasani82644082012-08-03 13:09:11 -0700144 case START_ACTIVITY_AS_USER_TRANSACTION:
145 {
146 data.enforceInterface(IActivityManager.descriptor);
147 IBinder b = data.readStrongBinder();
148 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800149 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700150 Intent intent = Intent.CREATOR.createFromParcel(data);
151 String resolvedType = data.readString();
152 IBinder resultTo = data.readStrongBinder();
153 String resultWho = data.readString();
154 int requestCode = data.readInt();
155 int startFlags = data.readInt();
156 String profileFile = data.readString();
157 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700158 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700159 Bundle options = data.readInt() != 0
160 ? Bundle.CREATOR.createFromParcel(data) : null;
161 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700163 resultTo, resultWho, requestCode, startFlags,
164 profileFile, profileFd, options, userId);
165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
169
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800170 case START_ACTIVITY_AND_WAIT_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800178 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800179 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700181 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700182 String profileFile = data.readString();
183 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700184 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700187 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800188 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700189 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800191 reply.writeNoException();
192 result.writeToParcel(reply, 0);
193 return true;
194 }
195
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700196 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
197 {
198 data.enforceInterface(IActivityManager.descriptor);
199 IBinder b = data.readStrongBinder();
200 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800201 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700202 Intent intent = Intent.CREATOR.createFromParcel(data);
203 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700205 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700207 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700208 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 Bundle options = data.readInt() != 0
210 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700211 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800212 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700213 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700214 reply.writeNoException();
215 reply.writeInt(result);
216 return true;
217 }
218
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700219 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700224 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700225 Intent fillInIntent = null;
226 if (data.readInt() != 0) {
227 fillInIntent = Intent.CREATOR.createFromParcel(data);
228 }
229 String resolvedType = data.readString();
230 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700231 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700232 int requestCode = data.readInt();
233 int flagsMask = data.readInt();
234 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700235 Bundle options = data.readInt() != 0
236 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700237 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700238 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700239 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700240 reply.writeNoException();
241 reply.writeInt(result);
242 return true;
243 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
246 {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder callingActivity = data.readStrongBinder();
249 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700250 Bundle options = data.readInt() != 0
251 ? Bundle.CREATOR.createFromParcel(data) : null;
252 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 reply.writeNoException();
254 reply.writeInt(result ? 1 : 0);
255 return true;
256 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 case FINISH_ACTIVITY_TRANSACTION: {
259 data.enforceInterface(IActivityManager.descriptor);
260 IBinder token = data.readStrongBinder();
261 Intent resultData = null;
262 int resultCode = data.readInt();
263 if (data.readInt() != 0) {
264 resultData = Intent.CREATOR.createFromParcel(data);
265 }
266 boolean res = finishActivity(token, resultCode, resultData);
267 reply.writeNoException();
268 reply.writeInt(res ? 1 : 0);
269 return true;
270 }
271
272 case FINISH_SUB_ACTIVITY_TRANSACTION: {
273 data.enforceInterface(IActivityManager.descriptor);
274 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700275 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800276 int requestCode = data.readInt();
277 finishSubActivity(token, resultWho, requestCode);
278 reply.writeNoException();
279 return true;
280 }
281
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700282 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
283 data.enforceInterface(IActivityManager.descriptor);
284 IBinder token = data.readStrongBinder();
285 boolean res = finishActivityAffinity(token);
286 reply.writeNoException();
287 reply.writeInt(res ? 1 : 0);
288 return true;
289 }
290
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800291 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
292 data.enforceInterface(IActivityManager.descriptor);
293 IBinder token = data.readStrongBinder();
294 boolean res = willActivityBeVisible(token);
295 reply.writeNoException();
296 reply.writeInt(res ? 1 : 0);
297 return true;
298 }
299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 case REGISTER_RECEIVER_TRANSACTION:
301 {
302 data.enforceInterface(IActivityManager.descriptor);
303 IBinder b = data.readStrongBinder();
304 IApplicationThread app =
305 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700306 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 b = data.readStrongBinder();
308 IIntentReceiver rec
309 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
310 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
311 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700312 int userId = data.readInt();
313 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800314 reply.writeNoException();
315 if (intent != null) {
316 reply.writeInt(1);
317 intent.writeToParcel(reply, 0);
318 } else {
319 reply.writeInt(0);
320 }
321 return true;
322 }
323
324 case UNREGISTER_RECEIVER_TRANSACTION:
325 {
326 data.enforceInterface(IActivityManager.descriptor);
327 IBinder b = data.readStrongBinder();
328 if (b == null) {
329 return true;
330 }
331 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
332 unregisterReceiver(rec);
333 reply.writeNoException();
334 return true;
335 }
336
337 case BROADCAST_INTENT_TRANSACTION:
338 {
339 data.enforceInterface(IActivityManager.descriptor);
340 IBinder b = data.readStrongBinder();
341 IApplicationThread app =
342 b != null ? ApplicationThreadNative.asInterface(b) : null;
343 Intent intent = Intent.CREATOR.createFromParcel(data);
344 String resolvedType = data.readString();
345 b = data.readStrongBinder();
346 IIntentReceiver resultTo =
347 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
348 int resultCode = data.readInt();
349 String resultData = data.readString();
350 Bundle resultExtras = data.readBundle();
351 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800352 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 boolean serialized = data.readInt() != 0;
354 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700355 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800357 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700358 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800359 reply.writeNoException();
360 reply.writeInt(res);
361 return true;
362 }
363
364 case UNBROADCAST_INTENT_TRANSACTION:
365 {
366 data.enforceInterface(IActivityManager.descriptor);
367 IBinder b = data.readStrongBinder();
368 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
369 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700370 int userId = data.readInt();
371 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 reply.writeNoException();
373 return true;
374 }
375
376 case FINISH_RECEIVER_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder who = data.readStrongBinder();
379 int resultCode = data.readInt();
380 String resultData = data.readString();
381 Bundle resultExtras = data.readBundle();
382 boolean resultAbort = data.readInt() != 0;
383 if (who != null) {
384 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
385 }
386 reply.writeNoException();
387 return true;
388 }
389
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 case ATTACH_APPLICATION_TRANSACTION: {
391 data.enforceInterface(IActivityManager.descriptor);
392 IApplicationThread app = ApplicationThreadNative.asInterface(
393 data.readStrongBinder());
394 if (app != null) {
395 attachApplication(app);
396 }
397 reply.writeNoException();
398 return true;
399 }
400
401 case ACTIVITY_IDLE_TRANSACTION: {
402 data.enforceInterface(IActivityManager.descriptor);
403 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700404 Configuration config = null;
405 if (data.readInt() != 0) {
406 config = Configuration.CREATOR.createFromParcel(data);
407 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700408 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700410 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 }
412 reply.writeNoException();
413 return true;
414 }
415
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700416 case ACTIVITY_RESUMED_TRANSACTION: {
417 data.enforceInterface(IActivityManager.descriptor);
418 IBinder token = data.readStrongBinder();
419 activityResumed(token);
420 reply.writeNoException();
421 return true;
422 }
423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 case ACTIVITY_PAUSED_TRANSACTION: {
425 data.enforceInterface(IActivityManager.descriptor);
426 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800427 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 reply.writeNoException();
429 return true;
430 }
431
432 case ACTIVITY_STOPPED_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800435 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 Bitmap thumbnail = data.readInt() != 0
437 ? Bitmap.CREATOR.createFromParcel(data) : null;
438 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800439 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 reply.writeNoException();
441 return true;
442 }
443
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800444 case ACTIVITY_SLEPT_TRANSACTION: {
445 data.enforceInterface(IActivityManager.descriptor);
446 IBinder token = data.readStrongBinder();
447 activitySlept(token);
448 reply.writeNoException();
449 return true;
450 }
451
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 case ACTIVITY_DESTROYED_TRANSACTION: {
453 data.enforceInterface(IActivityManager.descriptor);
454 IBinder token = data.readStrongBinder();
455 activityDestroyed(token);
456 reply.writeNoException();
457 return true;
458 }
459
460 case GET_CALLING_PACKAGE_TRANSACTION: {
461 data.enforceInterface(IActivityManager.descriptor);
462 IBinder token = data.readStrongBinder();
463 String res = token != null ? getCallingPackage(token) : null;
464 reply.writeNoException();
465 reply.writeString(res);
466 return true;
467 }
468
469 case GET_CALLING_ACTIVITY_TRANSACTION: {
470 data.enforceInterface(IActivityManager.descriptor);
471 IBinder token = data.readStrongBinder();
472 ComponentName cn = getCallingActivity(token);
473 reply.writeNoException();
474 ComponentName.writeToParcel(cn, reply);
475 return true;
476 }
477
478 case GET_TASKS_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 int maxNum = data.readInt();
481 int fl = data.readInt();
482 IBinder receiverBinder = data.readStrongBinder();
483 IThumbnailReceiver receiver = receiverBinder != null
484 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
485 : null;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700486 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 reply.writeNoException();
488 int N = list != null ? list.size() : -1;
489 reply.writeInt(N);
490 int i;
491 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700492 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 info.writeToParcel(reply, 0);
494 }
495 return true;
496 }
497
498 case GET_RECENT_TASKS_TRANSACTION: {
499 data.enforceInterface(IActivityManager.descriptor);
500 int maxNum = data.readInt();
501 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700502 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800503 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700504 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 reply.writeNoException();
506 reply.writeTypedList(list);
507 return true;
508 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700509
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700510 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800511 data.enforceInterface(IActivityManager.descriptor);
512 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700513 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800514 reply.writeNoException();
515 if (bm != null) {
516 reply.writeInt(1);
517 bm.writeToParcel(reply, 0);
518 } else {
519 reply.writeInt(0);
520 }
521 return true;
522 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700523
524 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
525 data.enforceInterface(IActivityManager.descriptor);
526 int id = data.readInt();
527 Bitmap bm = getTaskTopThumbnail(id);
528 reply.writeNoException();
529 if (bm != null) {
530 reply.writeInt(1);
531 bm.writeToParcel(reply, 0);
532 } else {
533 reply.writeInt(0);
534 }
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case GET_SERVICES_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 int maxNum = data.readInt();
541 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700542 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 int N = list != null ? list.size() : -1;
545 reply.writeInt(N);
546 int i;
547 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700548 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 info.writeToParcel(reply, 0);
550 }
551 return true;
552 }
553
554 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
557 reply.writeNoException();
558 reply.writeTypedList(list);
559 return true;
560 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700561
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800562 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
563 data.enforceInterface(IActivityManager.descriptor);
564 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
565 reply.writeNoException();
566 reply.writeTypedList(list);
567 return true;
568 }
569
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700570 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
571 data.enforceInterface(IActivityManager.descriptor);
572 List<ApplicationInfo> list = getRunningExternalApplications();
573 reply.writeNoException();
574 reply.writeTypedList(list);
575 return true;
576 }
577
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 case MOVE_TASK_TO_FRONT_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800581 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700582 Bundle options = data.readInt() != 0
583 ? Bundle.CREATOR.createFromParcel(data) : null;
584 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 reply.writeNoException();
586 return true;
587 }
588
589 case MOVE_TASK_TO_BACK_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 int task = data.readInt();
592 moveTaskToBack(task);
593 reply.writeNoException();
594 return true;
595 }
596
597 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 IBinder token = data.readStrongBinder();
600 boolean nonRoot = data.readInt() != 0;
601 boolean res = moveActivityTaskToBack(token, nonRoot);
602 reply.writeNoException();
603 reply.writeInt(res ? 1 : 0);
604 return true;
605 }
606
607 case MOVE_TASK_BACKWARDS_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 int task = data.readInt();
610 moveTaskBackwards(task);
611 reply.writeNoException();
612 return true;
613 }
614
Craig Mautnerc00204b2013-03-05 15:02:14 -0800615 case MOVE_TASK_TO_STACK_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int taskId = data.readInt();
618 int stackId = data.readInt();
619 boolean toTop = data.readInt() != 0;
620 moveTaskToStack(taskId, stackId, toTop);
621 reply.writeNoException();
622 return true;
623 }
624
625 case RESIZE_STACK_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800627 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800628 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800629 Rect r = Rect.CREATOR.createFromParcel(data);
630 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800631 reply.writeNoException();
632 return true;
633 }
634
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800635 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700636 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800637 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700638 reply.writeNoException();
639 reply.writeTypedList(list);
640 return true;
641 }
642
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800643 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700644 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800645 int stackId = data.readInt();
646 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700647 reply.writeNoException();
648 if (info != null) {
649 reply.writeInt(1);
650 info.writeToParcel(reply, 0);
651 } else {
652 reply.writeInt(0);
653 }
654 return true;
655 }
656
Craig Mautnercf910b02013-04-23 11:23:27 -0700657 case SET_FOCUSED_STACK_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 int stackId = data.readInt();
660 setFocusedStack(stackId);
661 reply.writeNoException();
662 return true;
663 }
664
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
666 data.enforceInterface(IActivityManager.descriptor);
667 IBinder token = data.readStrongBinder();
668 boolean onlyRoot = data.readInt() != 0;
669 int res = token != null
670 ? getTaskForActivity(token, onlyRoot) : -1;
671 reply.writeNoException();
672 reply.writeInt(res);
673 return true;
674 }
675
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800676 case REPORT_THUMBNAIL_TRANSACTION: {
677 data.enforceInterface(IActivityManager.descriptor);
678 IBinder token = data.readStrongBinder();
679 Bitmap thumbnail = data.readInt() != 0
680 ? Bitmap.CREATOR.createFromParcel(data) : null;
681 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
682 reportThumbnail(token, thumbnail, description);
683 reply.writeNoException();
684 return true;
685 }
686
687 case GET_CONTENT_PROVIDER_TRANSACTION: {
688 data.enforceInterface(IActivityManager.descriptor);
689 IBinder b = data.readStrongBinder();
690 IApplicationThread app = ApplicationThreadNative.asInterface(b);
691 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700692 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700693 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700694 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800695 reply.writeNoException();
696 if (cph != null) {
697 reply.writeInt(1);
698 cph.writeToParcel(reply, 0);
699 } else {
700 reply.writeInt(0);
701 }
702 return true;
703 }
704
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800705 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
706 data.enforceInterface(IActivityManager.descriptor);
707 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700708 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800709 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700710 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800711 reply.writeNoException();
712 if (cph != null) {
713 reply.writeInt(1);
714 cph.writeToParcel(reply, 0);
715 } else {
716 reply.writeInt(0);
717 }
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder b = data.readStrongBinder();
724 IApplicationThread app = ApplicationThreadNative.asInterface(b);
725 ArrayList<ContentProviderHolder> providers =
726 data.createTypedArrayList(ContentProviderHolder.CREATOR);
727 publishContentProviders(app, providers);
728 reply.writeNoException();
729 return true;
730 }
731
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700732 case REF_CONTENT_PROVIDER_TRANSACTION: {
733 data.enforceInterface(IActivityManager.descriptor);
734 IBinder b = data.readStrongBinder();
735 int stable = data.readInt();
736 int unstable = data.readInt();
737 boolean res = refContentProvider(b, stable, unstable);
738 reply.writeNoException();
739 reply.writeInt(res ? 1 : 0);
740 return true;
741 }
742
743 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
744 data.enforceInterface(IActivityManager.descriptor);
745 IBinder b = data.readStrongBinder();
746 unstableProviderDied(b);
747 reply.writeNoException();
748 return true;
749 }
750
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700751 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
752 data.enforceInterface(IActivityManager.descriptor);
753 IBinder b = data.readStrongBinder();
754 appNotRespondingViaProvider(b);
755 reply.writeNoException();
756 return true;
757 }
758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800759 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
760 data.enforceInterface(IActivityManager.descriptor);
761 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700762 boolean stable = data.readInt() != 0;
763 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 reply.writeNoException();
765 return true;
766 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800767
768 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 String name = data.readString();
771 IBinder token = data.readStrongBinder();
772 removeContentProviderExternal(name, token);
773 reply.writeNoException();
774 return true;
775 }
776
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700777 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
780 PendingIntent pi = getRunningServiceControlPanel(comp);
781 reply.writeNoException();
782 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
783 return true;
784 }
785
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800786 case START_SERVICE_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 IBinder b = data.readStrongBinder();
789 IApplicationThread app = ApplicationThreadNative.asInterface(b);
790 Intent service = Intent.CREATOR.createFromParcel(data);
791 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700792 int userId = data.readInt();
793 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800794 reply.writeNoException();
795 ComponentName.writeToParcel(cn, reply);
796 return true;
797 }
798
799 case STOP_SERVICE_TRANSACTION: {
800 data.enforceInterface(IActivityManager.descriptor);
801 IBinder b = data.readStrongBinder();
802 IApplicationThread app = ApplicationThreadNative.asInterface(b);
803 Intent service = Intent.CREATOR.createFromParcel(data);
804 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700805 int userId = data.readInt();
806 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800807 reply.writeNoException();
808 reply.writeInt(res);
809 return true;
810 }
811
812 case STOP_SERVICE_TOKEN_TRANSACTION: {
813 data.enforceInterface(IActivityManager.descriptor);
814 ComponentName className = ComponentName.readFromParcel(data);
815 IBinder token = data.readStrongBinder();
816 int startId = data.readInt();
817 boolean res = stopServiceToken(className, token, startId);
818 reply.writeNoException();
819 reply.writeInt(res ? 1 : 0);
820 return true;
821 }
822
823 case SET_SERVICE_FOREGROUND_TRANSACTION: {
824 data.enforceInterface(IActivityManager.descriptor);
825 ComponentName className = ComponentName.readFromParcel(data);
826 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700827 int id = data.readInt();
828 Notification notification = null;
829 if (data.readInt() != 0) {
830 notification = Notification.CREATOR.createFromParcel(data);
831 }
832 boolean removeNotification = data.readInt() != 0;
833 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800834 reply.writeNoException();
835 return true;
836 }
837
838 case BIND_SERVICE_TRANSACTION: {
839 data.enforceInterface(IActivityManager.descriptor);
840 IBinder b = data.readStrongBinder();
841 IApplicationThread app = ApplicationThreadNative.asInterface(b);
842 IBinder token = data.readStrongBinder();
843 Intent service = Intent.CREATOR.createFromParcel(data);
844 String resolvedType = data.readString();
845 b = data.readStrongBinder();
846 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800847 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800848 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800849 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800850 reply.writeNoException();
851 reply.writeInt(res);
852 return true;
853 }
854
855 case UNBIND_SERVICE_TRANSACTION: {
856 data.enforceInterface(IActivityManager.descriptor);
857 IBinder b = data.readStrongBinder();
858 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
859 boolean res = unbindService(conn);
860 reply.writeNoException();
861 reply.writeInt(res ? 1 : 0);
862 return true;
863 }
864
865 case PUBLISH_SERVICE_TRANSACTION: {
866 data.enforceInterface(IActivityManager.descriptor);
867 IBinder token = data.readStrongBinder();
868 Intent intent = Intent.CREATOR.createFromParcel(data);
869 IBinder service = data.readStrongBinder();
870 publishService(token, intent, service);
871 reply.writeNoException();
872 return true;
873 }
874
875 case UNBIND_FINISHED_TRANSACTION: {
876 data.enforceInterface(IActivityManager.descriptor);
877 IBinder token = data.readStrongBinder();
878 Intent intent = Intent.CREATOR.createFromParcel(data);
879 boolean doRebind = data.readInt() != 0;
880 unbindFinished(token, intent, doRebind);
881 reply.writeNoException();
882 return true;
883 }
884
885 case SERVICE_DONE_EXECUTING_TRANSACTION: {
886 data.enforceInterface(IActivityManager.descriptor);
887 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700888 int type = data.readInt();
889 int startId = data.readInt();
890 int res = data.readInt();
891 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800892 reply.writeNoException();
893 return true;
894 }
895
896 case START_INSTRUMENTATION_TRANSACTION: {
897 data.enforceInterface(IActivityManager.descriptor);
898 ComponentName className = ComponentName.readFromParcel(data);
899 String profileFile = data.readString();
900 int fl = data.readInt();
901 Bundle arguments = data.readBundle();
902 IBinder b = data.readStrongBinder();
903 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800904 b = data.readStrongBinder();
905 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700906 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800907 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800908 reply.writeNoException();
909 reply.writeInt(res ? 1 : 0);
910 return true;
911 }
912
913
914 case FINISH_INSTRUMENTATION_TRANSACTION: {
915 data.enforceInterface(IActivityManager.descriptor);
916 IBinder b = data.readStrongBinder();
917 IApplicationThread app = ApplicationThreadNative.asInterface(b);
918 int resultCode = data.readInt();
919 Bundle results = data.readBundle();
920 finishInstrumentation(app, resultCode, results);
921 reply.writeNoException();
922 return true;
923 }
924
925 case GET_CONFIGURATION_TRANSACTION: {
926 data.enforceInterface(IActivityManager.descriptor);
927 Configuration config = getConfiguration();
928 reply.writeNoException();
929 config.writeToParcel(reply, 0);
930 return true;
931 }
932
933 case UPDATE_CONFIGURATION_TRANSACTION: {
934 data.enforceInterface(IActivityManager.descriptor);
935 Configuration config = Configuration.CREATOR.createFromParcel(data);
936 updateConfiguration(config);
937 reply.writeNoException();
938 return true;
939 }
940
941 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 IBinder token = data.readStrongBinder();
944 int requestedOrientation = data.readInt();
945 setRequestedOrientation(token, requestedOrientation);
946 reply.writeNoException();
947 return true;
948 }
949
950 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder token = data.readStrongBinder();
953 int req = getRequestedOrientation(token);
954 reply.writeNoException();
955 reply.writeInt(req);
956 return true;
957 }
958
959 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
960 data.enforceInterface(IActivityManager.descriptor);
961 IBinder token = data.readStrongBinder();
962 ComponentName cn = getActivityClassForToken(token);
963 reply.writeNoException();
964 ComponentName.writeToParcel(cn, reply);
965 return true;
966 }
967
968 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 reply.writeNoException();
972 reply.writeString(getPackageForToken(token));
973 return true;
974 }
975
976 case GET_INTENT_SENDER_TRANSACTION: {
977 data.enforceInterface(IActivityManager.descriptor);
978 int type = data.readInt();
979 String packageName = data.readString();
980 IBinder token = data.readStrongBinder();
981 String resultWho = data.readString();
982 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800983 Intent[] requestIntents;
984 String[] requestResolvedTypes;
985 if (data.readInt() != 0) {
986 requestIntents = data.createTypedArray(Intent.CREATOR);
987 requestResolvedTypes = data.createStringArray();
988 } else {
989 requestIntents = null;
990 requestResolvedTypes = null;
991 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800992 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -0700993 Bundle options = data.readInt() != 0
994 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700995 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800997 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -0700998 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 reply.writeNoException();
1000 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1001 return true;
1002 }
1003
1004 case CANCEL_INTENT_SENDER_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IIntentSender r = IIntentSender.Stub.asInterface(
1007 data.readStrongBinder());
1008 cancelIntentSender(r);
1009 reply.writeNoException();
1010 return true;
1011 }
1012
1013 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IIntentSender r = IIntentSender.Stub.asInterface(
1016 data.readStrongBinder());
1017 String res = getPackageForIntentSender(r);
1018 reply.writeNoException();
1019 reply.writeString(res);
1020 return true;
1021 }
1022
Christopher Tatec4a07d12012-04-06 14:19:13 -07001023 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1024 data.enforceInterface(IActivityManager.descriptor);
1025 IIntentSender r = IIntentSender.Stub.asInterface(
1026 data.readStrongBinder());
1027 int res = getUidForIntentSender(r);
1028 reply.writeNoException();
1029 reply.writeInt(res);
1030 return true;
1031 }
1032
Dianne Hackborn41203752012-08-31 14:05:51 -07001033 case HANDLE_INCOMING_USER_TRANSACTION: {
1034 data.enforceInterface(IActivityManager.descriptor);
1035 int callingPid = data.readInt();
1036 int callingUid = data.readInt();
1037 int userId = data.readInt();
1038 boolean allowAll = data.readInt() != 0 ;
1039 boolean requireFull = data.readInt() != 0;
1040 String name = data.readString();
1041 String callerPackage = data.readString();
1042 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1043 requireFull, name, callerPackage);
1044 reply.writeNoException();
1045 reply.writeInt(res);
1046 return true;
1047 }
1048
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001049 case SET_PROCESS_LIMIT_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 int max = data.readInt();
1052 setProcessLimit(max);
1053 reply.writeNoException();
1054 return true;
1055 }
1056
1057 case GET_PROCESS_LIMIT_TRANSACTION: {
1058 data.enforceInterface(IActivityManager.descriptor);
1059 int limit = getProcessLimit();
1060 reply.writeNoException();
1061 reply.writeInt(limit);
1062 return true;
1063 }
1064
1065 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1066 data.enforceInterface(IActivityManager.descriptor);
1067 IBinder token = data.readStrongBinder();
1068 int pid = data.readInt();
1069 boolean isForeground = data.readInt() != 0;
1070 setProcessForeground(token, pid, isForeground);
1071 reply.writeNoException();
1072 return true;
1073 }
1074
1075 case CHECK_PERMISSION_TRANSACTION: {
1076 data.enforceInterface(IActivityManager.descriptor);
1077 String perm = data.readString();
1078 int pid = data.readInt();
1079 int uid = data.readInt();
1080 int res = checkPermission(perm, pid, uid);
1081 reply.writeNoException();
1082 reply.writeInt(res);
1083 return true;
1084 }
1085
1086 case CHECK_URI_PERMISSION_TRANSACTION: {
1087 data.enforceInterface(IActivityManager.descriptor);
1088 Uri uri = Uri.CREATOR.createFromParcel(data);
1089 int pid = data.readInt();
1090 int uid = data.readInt();
1091 int mode = data.readInt();
1092 int res = checkUriPermission(uri, pid, uid, mode);
1093 reply.writeNoException();
1094 reply.writeInt(res);
1095 return true;
1096 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001097
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001099 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 String packageName = data.readString();
1101 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1102 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001103 int userId = data.readInt();
1104 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001105 reply.writeNoException();
1106 reply.writeInt(res ? 1 : 0);
1107 return true;
1108 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001110 case GRANT_URI_PERMISSION_TRANSACTION: {
1111 data.enforceInterface(IActivityManager.descriptor);
1112 IBinder b = data.readStrongBinder();
1113 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1114 String targetPkg = data.readString();
1115 Uri uri = Uri.CREATOR.createFromParcel(data);
1116 int mode = data.readInt();
1117 grantUriPermission(app, targetPkg, uri, mode);
1118 reply.writeNoException();
1119 return true;
1120 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001121
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001122 case REVOKE_URI_PERMISSION_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 IBinder b = data.readStrongBinder();
1125 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1126 Uri uri = Uri.CREATOR.createFromParcel(data);
1127 int mode = data.readInt();
1128 revokeUriPermission(app, uri, mode);
1129 reply.writeNoException();
1130 return true;
1131 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001132
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001133 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1134 data.enforceInterface(IActivityManager.descriptor);
1135 Uri uri = Uri.CREATOR.createFromParcel(data);
1136 int mode = data.readInt();
1137 takePersistableUriPermission(uri, mode);
1138 reply.writeNoException();
1139 return true;
1140 }
1141
1142 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 Uri uri = Uri.CREATOR.createFromParcel(data);
1145 int mode = data.readInt();
1146 releasePersistableUriPermission(uri, mode);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
1151 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001153 final String packageName = data.readString();
1154 final boolean incoming = data.readInt() != 0;
1155 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1156 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001157 reply.writeNoException();
1158 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1159 return true;
1160 }
1161
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001162 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1163 data.enforceInterface(IActivityManager.descriptor);
1164 IBinder b = data.readStrongBinder();
1165 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1166 boolean waiting = data.readInt() != 0;
1167 showWaitingForDebugger(app, waiting);
1168 reply.writeNoException();
1169 return true;
1170 }
1171
1172 case GET_MEMORY_INFO_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1175 getMemoryInfo(mi);
1176 reply.writeNoException();
1177 mi.writeToParcel(reply, 0);
1178 return true;
1179 }
1180
1181 case UNHANDLED_BACK_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 unhandledBack();
1184 reply.writeNoException();
1185 return true;
1186 }
1187
1188 case OPEN_CONTENT_URI_TRANSACTION: {
1189 data.enforceInterface(IActivityManager.descriptor);
1190 Uri uri = Uri.parse(data.readString());
1191 ParcelFileDescriptor pfd = openContentUri(uri);
1192 reply.writeNoException();
1193 if (pfd != null) {
1194 reply.writeInt(1);
1195 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1196 } else {
1197 reply.writeInt(0);
1198 }
1199 return true;
1200 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001201
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202 case GOING_TO_SLEEP_TRANSACTION: {
1203 data.enforceInterface(IActivityManager.descriptor);
1204 goingToSleep();
1205 reply.writeNoException();
1206 return true;
1207 }
1208
1209 case WAKING_UP_TRANSACTION: {
1210 data.enforceInterface(IActivityManager.descriptor);
1211 wakingUp();
1212 reply.writeNoException();
1213 return true;
1214 }
1215
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001216 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1217 data.enforceInterface(IActivityManager.descriptor);
1218 setLockScreenShown(data.readInt() != 0);
1219 reply.writeNoException();
1220 return true;
1221 }
1222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001223 case SET_DEBUG_APP_TRANSACTION: {
1224 data.enforceInterface(IActivityManager.descriptor);
1225 String pn = data.readString();
1226 boolean wfd = data.readInt() != 0;
1227 boolean per = data.readInt() != 0;
1228 setDebugApp(pn, wfd, per);
1229 reply.writeNoException();
1230 return true;
1231 }
1232
1233 case SET_ALWAYS_FINISH_TRANSACTION: {
1234 data.enforceInterface(IActivityManager.descriptor);
1235 boolean enabled = data.readInt() != 0;
1236 setAlwaysFinish(enabled);
1237 reply.writeNoException();
1238 return true;
1239 }
1240
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001241 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001242 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001243 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001245 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001246 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 return true;
1248 }
1249
1250 case ENTER_SAFE_MODE_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 enterSafeMode();
1253 reply.writeNoException();
1254 return true;
1255 }
1256
1257 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1258 data.enforceInterface(IActivityManager.descriptor);
1259 IIntentSender is = IIntentSender.Stub.asInterface(
1260 data.readStrongBinder());
1261 noteWakeupAlarm(is);
1262 reply.writeNoException();
1263 return true;
1264 }
1265
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001266 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001267 data.enforceInterface(IActivityManager.descriptor);
1268 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001269 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001270 boolean secure = data.readInt() != 0;
1271 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001272 reply.writeNoException();
1273 reply.writeInt(res ? 1 : 0);
1274 return true;
1275 }
1276
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001277 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 String reason = data.readString();
1280 boolean res = killProcessesBelowForeground(reason);
1281 reply.writeNoException();
1282 reply.writeInt(res ? 1 : 0);
1283 return true;
1284 }
1285
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001286 case START_RUNNING_TRANSACTION: {
1287 data.enforceInterface(IActivityManager.descriptor);
1288 String pkg = data.readString();
1289 String cls = data.readString();
1290 String action = data.readString();
1291 String indata = data.readString();
1292 startRunning(pkg, cls, action, indata);
1293 reply.writeNoException();
1294 return true;
1295 }
1296
Dan Egnor60d87622009-12-16 16:32:58 -08001297 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 IBinder app = data.readStrongBinder();
1300 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1301 handleApplicationCrash(app, ci);
1302 reply.writeNoException();
1303 return true;
1304 }
1305
1306 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001307 data.enforceInterface(IActivityManager.descriptor);
1308 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001309 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001310 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001311 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001312 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001313 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 return true;
1315 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001316
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001317 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1318 data.enforceInterface(IActivityManager.descriptor);
1319 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001320 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001321 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1322 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001323 reply.writeNoException();
1324 return true;
1325 }
1326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1328 data.enforceInterface(IActivityManager.descriptor);
1329 int sig = data.readInt();
1330 signalPersistentProcesses(sig);
1331 reply.writeNoException();
1332 return true;
1333 }
1334
Dianne Hackborn03abb812010-01-04 18:43:19 -08001335 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001338 int userId = data.readInt();
1339 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001340 reply.writeNoException();
1341 return true;
1342 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001343
1344 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
1346 killAllBackgroundProcesses();
1347 reply.writeNoException();
1348 return true;
1349 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001350
Dianne Hackborn03abb812010-01-04 18:43:19 -08001351 case FORCE_STOP_PACKAGE_TRANSACTION: {
1352 data.enforceInterface(IActivityManager.descriptor);
1353 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001354 int userId = data.readInt();
1355 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001356 reply.writeNoException();
1357 return true;
1358 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001359
1360 case GET_MY_MEMORY_STATE_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 ActivityManager.RunningAppProcessInfo info =
1363 new ActivityManager.RunningAppProcessInfo();
1364 getMyMemoryState(info);
1365 reply.writeNoException();
1366 info.writeToParcel(reply, 0);
1367 return true;
1368 }
1369
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001370 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1371 data.enforceInterface(IActivityManager.descriptor);
1372 ConfigurationInfo config = getDeviceConfigurationInfo();
1373 reply.writeNoException();
1374 config.writeToParcel(reply, 0);
1375 return true;
1376 }
1377
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001378 case PROFILE_CONTROL_TRANSACTION: {
1379 data.enforceInterface(IActivityManager.descriptor);
1380 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001381 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001382 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001383 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001384 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001385 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001386 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001387 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001388 reply.writeNoException();
1389 reply.writeInt(res ? 1 : 0);
1390 return true;
1391 }
1392
Dianne Hackborn55280a92009-05-07 15:53:46 -07001393 case SHUTDOWN_TRANSACTION: {
1394 data.enforceInterface(IActivityManager.descriptor);
1395 boolean res = shutdown(data.readInt());
1396 reply.writeNoException();
1397 reply.writeInt(res ? 1 : 0);
1398 return true;
1399 }
1400
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001401 case STOP_APP_SWITCHES_TRANSACTION: {
1402 data.enforceInterface(IActivityManager.descriptor);
1403 stopAppSwitches();
1404 reply.writeNoException();
1405 return true;
1406 }
1407
1408 case RESUME_APP_SWITCHES_TRANSACTION: {
1409 data.enforceInterface(IActivityManager.descriptor);
1410 resumeAppSwitches();
1411 reply.writeNoException();
1412 return true;
1413 }
1414
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001415 case PEEK_SERVICE_TRANSACTION: {
1416 data.enforceInterface(IActivityManager.descriptor);
1417 Intent service = Intent.CREATOR.createFromParcel(data);
1418 String resolvedType = data.readString();
1419 IBinder binder = peekService(service, resolvedType);
1420 reply.writeNoException();
1421 reply.writeStrongBinder(binder);
1422 return true;
1423 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001424
1425 case START_BACKUP_AGENT_TRANSACTION: {
1426 data.enforceInterface(IActivityManager.descriptor);
1427 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1428 int backupRestoreMode = data.readInt();
1429 boolean success = bindBackupAgent(info, backupRestoreMode);
1430 reply.writeNoException();
1431 reply.writeInt(success ? 1 : 0);
1432 return true;
1433 }
1434
1435 case BACKUP_AGENT_CREATED_TRANSACTION: {
1436 data.enforceInterface(IActivityManager.descriptor);
1437 String packageName = data.readString();
1438 IBinder agent = data.readStrongBinder();
1439 backupAgentCreated(packageName, agent);
1440 reply.writeNoException();
1441 return true;
1442 }
1443
1444 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1445 data.enforceInterface(IActivityManager.descriptor);
1446 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1447 unbindBackupAgent(info);
1448 reply.writeNoException();
1449 return true;
1450 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001451
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001452 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001453 data.enforceInterface(IActivityManager.descriptor);
1454 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001455 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001456 String reason = data.readString();
1457 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001458 reply.writeNoException();
1459 return true;
1460 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001461
1462 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 String reason = data.readString();
1465 closeSystemDialogs(reason);
1466 reply.writeNoException();
1467 return true;
1468 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001469
1470 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1471 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001472 int[] pids = data.createIntArray();
1473 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001474 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001475 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001476 return true;
1477 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001478
1479 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
1481 String processName = data.readString();
1482 int uid = data.readInt();
1483 killApplicationProcess(processName, uid);
1484 reply.writeNoException();
1485 return true;
1486 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001487
1488 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
1490 IBinder token = data.readStrongBinder();
1491 String packageName = data.readString();
1492 int enterAnim = data.readInt();
1493 int exitAnim = data.readInt();
1494 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001495 reply.writeNoException();
1496 return true;
1497 }
1498
1499 case IS_USER_A_MONKEY_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001501 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001502 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001503 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001504 return true;
1505 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001506
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001507 case SET_USER_IS_MONKEY_TRANSACTION: {
1508 data.enforceInterface(IActivityManager.descriptor);
1509 final boolean monkey = (data.readInt() == 1);
1510 setUserIsMonkey(monkey);
1511 reply.writeNoException();
1512 return true;
1513 }
1514
Dianne Hackborn860755f2010-06-03 18:47:52 -07001515 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1516 data.enforceInterface(IActivityManager.descriptor);
1517 finishHeavyWeightApp();
1518 reply.writeNoException();
1519 return true;
1520 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001521
1522 case IS_IMMERSIVE_TRANSACTION: {
1523 data.enforceInterface(IActivityManager.descriptor);
1524 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001525 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001526 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001527 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001528 return true;
1529 }
1530
Craig Mautner5eda9b32013-07-02 11:58:16 -07001531 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001532 data.enforceInterface(IActivityManager.descriptor);
1533 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001534 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001535 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001536 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001537 return true;
1538 }
1539
1540 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1541 data.enforceInterface(IActivityManager.descriptor);
1542 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001543 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001544 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001545 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001546 return true;
1547 }
1548
Daniel Sandler69a48172010-06-23 16:29:36 -04001549 case SET_IMMERSIVE_TRANSACTION: {
1550 data.enforceInterface(IActivityManager.descriptor);
1551 IBinder token = data.readStrongBinder();
1552 boolean imm = data.readInt() == 1;
1553 setImmersive(token, imm);
1554 reply.writeNoException();
1555 return true;
1556 }
1557
1558 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001560 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001561 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001562 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001563 return true;
1564 }
1565
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001566 case CRASH_APPLICATION_TRANSACTION: {
1567 data.enforceInterface(IActivityManager.descriptor);
1568 int uid = data.readInt();
1569 int initialPid = data.readInt();
1570 String packageName = data.readString();
1571 String message = data.readString();
1572 crashApplication(uid, initialPid, packageName, message);
1573 reply.writeNoException();
1574 return true;
1575 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001576
1577 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001580 int userId = data.readInt();
1581 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001582 reply.writeNoException();
1583 reply.writeString(type);
1584 return true;
1585 }
1586
Dianne Hackborn7e269642010-08-25 19:50:20 -07001587 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1588 data.enforceInterface(IActivityManager.descriptor);
1589 String name = data.readString();
1590 IBinder perm = newUriPermissionOwner(name);
1591 reply.writeNoException();
1592 reply.writeStrongBinder(perm);
1593 return true;
1594 }
1595
1596 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1597 data.enforceInterface(IActivityManager.descriptor);
1598 IBinder owner = data.readStrongBinder();
1599 int fromUid = data.readInt();
1600 String targetPkg = data.readString();
1601 Uri uri = Uri.CREATOR.createFromParcel(data);
1602 int mode = data.readInt();
1603 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1604 reply.writeNoException();
1605 return true;
1606 }
1607
1608 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1609 data.enforceInterface(IActivityManager.descriptor);
1610 IBinder owner = data.readStrongBinder();
1611 Uri uri = null;
1612 if (data.readInt() != 0) {
1613 Uri.CREATOR.createFromParcel(data);
1614 }
1615 int mode = data.readInt();
1616 revokeUriPermissionFromOwner(owner, uri, mode);
1617 reply.writeNoException();
1618 return true;
1619 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001620
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001621 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 int callingUid = data.readInt();
1624 String targetPkg = data.readString();
1625 Uri uri = Uri.CREATOR.createFromParcel(data);
1626 int modeFlags = data.readInt();
1627 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1628 reply.writeNoException();
1629 reply.writeInt(res);
1630 return true;
1631 }
1632
Andy McFadden824c5102010-07-09 16:26:57 -07001633 case DUMP_HEAP_TRANSACTION: {
1634 data.enforceInterface(IActivityManager.descriptor);
1635 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001636 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001637 boolean managed = data.readInt() != 0;
1638 String path = data.readString();
1639 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001640 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001641 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001642 reply.writeNoException();
1643 reply.writeInt(res ? 1 : 0);
1644 return true;
1645 }
1646
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001647 case START_ACTIVITIES_TRANSACTION:
1648 {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 IBinder b = data.readStrongBinder();
1651 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001652 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001653 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1654 String[] resolvedTypes = data.createStringArray();
1655 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001656 Bundle options = data.readInt() != 0
1657 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001658 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001659 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001660 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001661 reply.writeNoException();
1662 reply.writeInt(result);
1663 return true;
1664 }
1665
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001666 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1667 {
1668 data.enforceInterface(IActivityManager.descriptor);
1669 int mode = getFrontActivityScreenCompatMode();
1670 reply.writeNoException();
1671 reply.writeInt(mode);
1672 return true;
1673 }
1674
1675 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1676 {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 int mode = data.readInt();
1679 setFrontActivityScreenCompatMode(mode);
1680 reply.writeNoException();
1681 reply.writeInt(mode);
1682 return true;
1683 }
1684
1685 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1686 {
1687 data.enforceInterface(IActivityManager.descriptor);
1688 String pkg = data.readString();
1689 int mode = getPackageScreenCompatMode(pkg);
1690 reply.writeNoException();
1691 reply.writeInt(mode);
1692 return true;
1693 }
1694
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001695 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1696 {
1697 data.enforceInterface(IActivityManager.descriptor);
1698 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001699 int mode = data.readInt();
1700 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001701 reply.writeNoException();
1702 return true;
1703 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001704
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001705 case SWITCH_USER_TRANSACTION: {
1706 data.enforceInterface(IActivityManager.descriptor);
1707 int userid = data.readInt();
1708 boolean result = switchUser(userid);
1709 reply.writeNoException();
1710 reply.writeInt(result ? 1 : 0);
1711 return true;
1712 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001713
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001714 case STOP_USER_TRANSACTION: {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 int userid = data.readInt();
1717 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1718 data.readStrongBinder());
1719 int result = stopUser(userid, callback);
1720 reply.writeNoException();
1721 reply.writeInt(result);
1722 return true;
1723 }
1724
Amith Yamasani52f1d752012-03-28 18:19:29 -07001725 case GET_CURRENT_USER_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 UserInfo userInfo = getCurrentUser();
1728 reply.writeNoException();
1729 userInfo.writeToParcel(reply, 0);
1730 return true;
1731 }
1732
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001733 case IS_USER_RUNNING_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001736 boolean orStopping = data.readInt() != 0;
1737 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001738 reply.writeNoException();
1739 reply.writeInt(result ? 1 : 0);
1740 return true;
1741 }
1742
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001743 case GET_RUNNING_USER_IDS_TRANSACTION: {
1744 data.enforceInterface(IActivityManager.descriptor);
1745 int[] result = getRunningUserIds();
1746 reply.writeNoException();
1747 reply.writeIntArray(result);
1748 return true;
1749 }
1750
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001751 case REMOVE_SUB_TASK_TRANSACTION:
1752 {
1753 data.enforceInterface(IActivityManager.descriptor);
1754 int taskId = data.readInt();
1755 int subTaskIndex = data.readInt();
1756 boolean result = removeSubTask(taskId, subTaskIndex);
1757 reply.writeNoException();
1758 reply.writeInt(result ? 1 : 0);
1759 return true;
1760 }
1761
1762 case REMOVE_TASK_TRANSACTION:
1763 {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 int taskId = data.readInt();
1766 int fl = data.readInt();
1767 boolean result = removeTask(taskId, fl);
1768 reply.writeNoException();
1769 reply.writeInt(result ? 1 : 0);
1770 return true;
1771 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001772
Jeff Sharkeya4620792011-05-20 15:29:23 -07001773 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1774 data.enforceInterface(IActivityManager.descriptor);
1775 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1776 data.readStrongBinder());
1777 registerProcessObserver(observer);
1778 return true;
1779 }
1780
1781 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1782 data.enforceInterface(IActivityManager.descriptor);
1783 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1784 data.readStrongBinder());
1785 unregisterProcessObserver(observer);
1786 return true;
1787 }
1788
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001789 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1790 {
1791 data.enforceInterface(IActivityManager.descriptor);
1792 String pkg = data.readString();
1793 boolean ask = getPackageAskScreenCompat(pkg);
1794 reply.writeNoException();
1795 reply.writeInt(ask ? 1 : 0);
1796 return true;
1797 }
1798
1799 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1800 {
1801 data.enforceInterface(IActivityManager.descriptor);
1802 String pkg = data.readString();
1803 boolean ask = data.readInt() != 0;
1804 setPackageAskScreenCompat(pkg, ask);
1805 reply.writeNoException();
1806 return true;
1807 }
1808
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001809 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1810 data.enforceInterface(IActivityManager.descriptor);
1811 IIntentSender r = IIntentSender.Stub.asInterface(
1812 data.readStrongBinder());
1813 boolean res = isIntentSenderTargetedToPackage(r);
1814 reply.writeNoException();
1815 reply.writeInt(res ? 1 : 0);
1816 return true;
1817 }
1818
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001819 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1820 data.enforceInterface(IActivityManager.descriptor);
1821 IIntentSender r = IIntentSender.Stub.asInterface(
1822 data.readStrongBinder());
1823 boolean res = isIntentSenderAnActivity(r);
1824 reply.writeNoException();
1825 reply.writeInt(res ? 1 : 0);
1826 return true;
1827 }
1828
Dianne Hackborn81038902012-11-26 17:04:09 -08001829 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 IIntentSender r = IIntentSender.Stub.asInterface(
1832 data.readStrongBinder());
1833 Intent intent = getIntentForIntentSender(r);
1834 reply.writeNoException();
1835 if (intent != null) {
1836 reply.writeInt(1);
1837 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1838 } else {
1839 reply.writeInt(0);
1840 }
1841 return true;
1842 }
1843
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001844 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1845 data.enforceInterface(IActivityManager.descriptor);
1846 Configuration config = Configuration.CREATOR.createFromParcel(data);
1847 updatePersistentConfiguration(config);
1848 reply.writeNoException();
1849 return true;
1850 }
1851
Dianne Hackbornb437e092011-08-05 17:50:29 -07001852 case GET_PROCESS_PSS_TRANSACTION: {
1853 data.enforceInterface(IActivityManager.descriptor);
1854 int[] pids = data.createIntArray();
1855 long[] pss = getProcessPss(pids);
1856 reply.writeNoException();
1857 reply.writeLongArray(pss);
1858 return true;
1859 }
1860
Dianne Hackborn661cd522011-08-22 00:26:20 -07001861 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1862 data.enforceInterface(IActivityManager.descriptor);
1863 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1864 boolean always = data.readInt() != 0;
1865 showBootMessage(msg, always);
1866 reply.writeNoException();
1867 return true;
1868 }
1869
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001870 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1871 data.enforceInterface(IActivityManager.descriptor);
1872 dismissKeyguardOnNextActivity();
1873 reply.writeNoException();
1874 return true;
1875 }
1876
Adam Powelldd8fab22012-03-22 17:47:27 -07001877 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1878 data.enforceInterface(IActivityManager.descriptor);
1879 IBinder token = data.readStrongBinder();
1880 String destAffinity = data.readString();
1881 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1882 reply.writeNoException();
1883 reply.writeInt(res ? 1 : 0);
1884 return true;
1885 }
1886
1887 case NAVIGATE_UP_TO_TRANSACTION: {
1888 data.enforceInterface(IActivityManager.descriptor);
1889 IBinder token = data.readStrongBinder();
1890 Intent target = Intent.CREATOR.createFromParcel(data);
1891 int resultCode = data.readInt();
1892 Intent resultData = null;
1893 if (data.readInt() != 0) {
1894 resultData = Intent.CREATOR.createFromParcel(data);
1895 }
1896 boolean res = navigateUpTo(token, target, resultCode, resultData);
1897 reply.writeNoException();
1898 reply.writeInt(res ? 1 : 0);
1899 return true;
1900 }
1901
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001902 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1903 data.enforceInterface(IActivityManager.descriptor);
1904 IBinder token = data.readStrongBinder();
1905 int res = getLaunchedFromUid(token);
1906 reply.writeNoException();
1907 reply.writeInt(res);
1908 return true;
1909 }
1910
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001911 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1912 data.enforceInterface(IActivityManager.descriptor);
1913 IBinder token = data.readStrongBinder();
1914 String res = getLaunchedFromPackage(token);
1915 reply.writeNoException();
1916 reply.writeString(res);
1917 return true;
1918 }
1919
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001920 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1921 data.enforceInterface(IActivityManager.descriptor);
1922 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1923 data.readStrongBinder());
1924 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001925 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001926 return true;
1927 }
1928
1929 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1930 data.enforceInterface(IActivityManager.descriptor);
1931 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1932 data.readStrongBinder());
1933 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001934 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001935 return true;
1936 }
1937
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001938 case REQUEST_BUG_REPORT_TRANSACTION: {
1939 data.enforceInterface(IActivityManager.descriptor);
1940 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001941 reply.writeNoException();
1942 return true;
1943 }
1944
1945 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1946 data.enforceInterface(IActivityManager.descriptor);
1947 int pid = data.readInt();
1948 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001949 String reason = data.readString();
1950 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001951 reply.writeNoException();
1952 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001953 return true;
1954 }
1955
Adam Skorydfc7fd72013-08-05 19:23:41 -07001956 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001957 data.enforceInterface(IActivityManager.descriptor);
1958 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001959 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001960 reply.writeNoException();
1961 reply.writeBundle(res);
1962 return true;
1963 }
1964
Adam Skorydfc7fd72013-08-05 19:23:41 -07001965 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001966 data.enforceInterface(IActivityManager.descriptor);
1967 IBinder token = data.readStrongBinder();
1968 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01001969 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001970 reply.writeNoException();
1971 return true;
1972 }
1973
Dianne Hackbornf1b78242013-04-08 22:28:59 -07001974 case KILL_UID_TRANSACTION: {
1975 data.enforceInterface(IActivityManager.descriptor);
1976 int uid = data.readInt();
1977 String reason = data.readString();
1978 killUid(uid, reason);
1979 reply.writeNoException();
1980 return true;
1981 }
1982
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07001983 case HANG_TRANSACTION: {
1984 data.enforceInterface(IActivityManager.descriptor);
1985 IBinder who = data.readStrongBinder();
1986 boolean allowRestart = data.readInt() != 0;
1987 hang(who, allowRestart);
1988 reply.writeNoException();
1989 return true;
1990 }
1991
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07001992 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
1993 data.enforceInterface(IActivityManager.descriptor);
1994 IBinder token = data.readStrongBinder();
1995 reportActivityFullyDrawn(token);
1996 reply.writeNoException();
1997 return true;
1998 }
1999
Craig Mautner5eda9b32013-07-02 11:58:16 -07002000 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 IBinder token = data.readStrongBinder();
2003 notifyActivityDrawn(token);
2004 reply.writeNoException();
2005 return true;
2006 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002007
2008 case RESTART_TRANSACTION: {
2009 data.enforceInterface(IActivityManager.descriptor);
2010 restart();
2011 reply.writeNoException();
2012 return true;
2013 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002014
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002015 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2016 data.enforceInterface(IActivityManager.descriptor);
2017 performIdleMaintenance();
2018 reply.writeNoException();
2019 return true;
2020 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002021
2022 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2023 data.enforceInterface(IActivityManager.descriptor);
2024 IBinder parentActivityToken = data.readStrongBinder();
2025 IActivityContainerCallback callback =
2026 (IActivityContainerCallback) data.readStrongBinder();
2027 IActivityContainer activityContainer =
2028 createActivityContainer(parentActivityToken, callback);
2029 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002030 if (activityContainer != null) {
2031 reply.writeInt(1);
2032 reply.writeStrongBinder(activityContainer.asBinder());
2033 } else {
2034 reply.writeInt(0);
2035 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002036 return true;
2037 }
2038
Craig Mautnere0a38842013-12-16 16:14:02 -08002039 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 IBinder activityToken = data.readStrongBinder();
2042 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2043 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002044 if (activityContainer != null) {
2045 reply.writeInt(1);
2046 reply.writeStrongBinder(activityContainer.asBinder());
2047 } else {
2048 reply.writeInt(0);
2049 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002050 return true;
2051 }
2052
Craig Mautner4a1cb222013-12-04 16:14:06 -08002053 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 IBinder homeActivityToken = getHomeActivityToken();
2056 reply.writeNoException();
2057 reply.writeStrongBinder(homeActivityToken);
2058 return true;
2059 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002060 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002061
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002062 return super.onTransact(code, data, reply, flags);
2063 }
2064
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002065 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002066 return this;
2067 }
2068
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002069 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2070 protected IActivityManager create() {
2071 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002072 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002073 Log.v("ActivityManager", "default service binder = " + b);
2074 }
2075 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002076 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002077 Log.v("ActivityManager", "default service = " + am);
2078 }
2079 return am;
2080 }
2081 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002082}
2083
2084class ActivityManagerProxy implements IActivityManager
2085{
2086 public ActivityManagerProxy(IBinder remote)
2087 {
2088 mRemote = remote;
2089 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002090
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002091 public IBinder asBinder()
2092 {
2093 return mRemote;
2094 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002095
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002096 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002097 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2098 int startFlags, String profileFile,
2099 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002100 Parcel data = Parcel.obtain();
2101 Parcel reply = Parcel.obtain();
2102 data.writeInterfaceToken(IActivityManager.descriptor);
2103 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002104 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002105 intent.writeToParcel(data, 0);
2106 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002107 data.writeStrongBinder(resultTo);
2108 data.writeString(resultWho);
2109 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002110 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002111 data.writeString(profileFile);
2112 if (profileFd != null) {
2113 data.writeInt(1);
2114 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2115 } else {
2116 data.writeInt(0);
2117 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002118 if (options != null) {
2119 data.writeInt(1);
2120 options.writeToParcel(data, 0);
2121 } else {
2122 data.writeInt(0);
2123 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002124 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2125 reply.readException();
2126 int result = reply.readInt();
2127 reply.recycle();
2128 data.recycle();
2129 return result;
2130 }
Amith Yamasani82644082012-08-03 13:09:11 -07002131
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002132 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002133 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2134 int startFlags, String profileFile,
2135 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2136 Parcel data = Parcel.obtain();
2137 Parcel reply = Parcel.obtain();
2138 data.writeInterfaceToken(IActivityManager.descriptor);
2139 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002140 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002141 intent.writeToParcel(data, 0);
2142 data.writeString(resolvedType);
2143 data.writeStrongBinder(resultTo);
2144 data.writeString(resultWho);
2145 data.writeInt(requestCode);
2146 data.writeInt(startFlags);
2147 data.writeString(profileFile);
2148 if (profileFd != null) {
2149 data.writeInt(1);
2150 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2151 } else {
2152 data.writeInt(0);
2153 }
2154 if (options != null) {
2155 data.writeInt(1);
2156 options.writeToParcel(data, 0);
2157 } else {
2158 data.writeInt(0);
2159 }
2160 data.writeInt(userId);
2161 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2162 reply.readException();
2163 int result = reply.readInt();
2164 reply.recycle();
2165 data.recycle();
2166 return result;
2167 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002168 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2169 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002170 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002171 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002172 Parcel data = Parcel.obtain();
2173 Parcel reply = Parcel.obtain();
2174 data.writeInterfaceToken(IActivityManager.descriptor);
2175 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002176 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002177 intent.writeToParcel(data, 0);
2178 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002179 data.writeStrongBinder(resultTo);
2180 data.writeString(resultWho);
2181 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002182 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002183 data.writeString(profileFile);
2184 if (profileFd != null) {
2185 data.writeInt(1);
2186 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2187 } else {
2188 data.writeInt(0);
2189 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002190 if (options != null) {
2191 data.writeInt(1);
2192 options.writeToParcel(data, 0);
2193 } else {
2194 data.writeInt(0);
2195 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002196 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002197 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2198 reply.readException();
2199 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2200 reply.recycle();
2201 data.recycle();
2202 return result;
2203 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002204 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2205 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002206 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002207 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002208 Parcel data = Parcel.obtain();
2209 Parcel reply = Parcel.obtain();
2210 data.writeInterfaceToken(IActivityManager.descriptor);
2211 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002212 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002213 intent.writeToParcel(data, 0);
2214 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002215 data.writeStrongBinder(resultTo);
2216 data.writeString(resultWho);
2217 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002218 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002219 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002220 if (options != null) {
2221 data.writeInt(1);
2222 options.writeToParcel(data, 0);
2223 } else {
2224 data.writeInt(0);
2225 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002226 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002227 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2228 reply.readException();
2229 int result = reply.readInt();
2230 reply.recycle();
2231 data.recycle();
2232 return result;
2233 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002234 public int startActivityIntentSender(IApplicationThread caller,
2235 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002236 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002237 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002238 Parcel data = Parcel.obtain();
2239 Parcel reply = Parcel.obtain();
2240 data.writeInterfaceToken(IActivityManager.descriptor);
2241 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2242 intent.writeToParcel(data, 0);
2243 if (fillInIntent != null) {
2244 data.writeInt(1);
2245 fillInIntent.writeToParcel(data, 0);
2246 } else {
2247 data.writeInt(0);
2248 }
2249 data.writeString(resolvedType);
2250 data.writeStrongBinder(resultTo);
2251 data.writeString(resultWho);
2252 data.writeInt(requestCode);
2253 data.writeInt(flagsMask);
2254 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002255 if (options != null) {
2256 data.writeInt(1);
2257 options.writeToParcel(data, 0);
2258 } else {
2259 data.writeInt(0);
2260 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002261 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002262 reply.readException();
2263 int result = reply.readInt();
2264 reply.recycle();
2265 data.recycle();
2266 return result;
2267 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002268 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002269 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002270 Parcel data = Parcel.obtain();
2271 Parcel reply = Parcel.obtain();
2272 data.writeInterfaceToken(IActivityManager.descriptor);
2273 data.writeStrongBinder(callingActivity);
2274 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002275 if (options != null) {
2276 data.writeInt(1);
2277 options.writeToParcel(data, 0);
2278 } else {
2279 data.writeInt(0);
2280 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002281 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2282 reply.readException();
2283 int result = reply.readInt();
2284 reply.recycle();
2285 data.recycle();
2286 return result != 0;
2287 }
2288 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2289 throws RemoteException {
2290 Parcel data = Parcel.obtain();
2291 Parcel reply = Parcel.obtain();
2292 data.writeInterfaceToken(IActivityManager.descriptor);
2293 data.writeStrongBinder(token);
2294 data.writeInt(resultCode);
2295 if (resultData != null) {
2296 data.writeInt(1);
2297 resultData.writeToParcel(data, 0);
2298 } else {
2299 data.writeInt(0);
2300 }
2301 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2302 reply.readException();
2303 boolean res = reply.readInt() != 0;
2304 data.recycle();
2305 reply.recycle();
2306 return res;
2307 }
2308 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2309 {
2310 Parcel data = Parcel.obtain();
2311 Parcel reply = Parcel.obtain();
2312 data.writeInterfaceToken(IActivityManager.descriptor);
2313 data.writeStrongBinder(token);
2314 data.writeString(resultWho);
2315 data.writeInt(requestCode);
2316 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2317 reply.readException();
2318 data.recycle();
2319 reply.recycle();
2320 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002321 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2322 Parcel data = Parcel.obtain();
2323 Parcel reply = Parcel.obtain();
2324 data.writeInterfaceToken(IActivityManager.descriptor);
2325 data.writeStrongBinder(token);
2326 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2327 reply.readException();
2328 boolean res = reply.readInt() != 0;
2329 data.recycle();
2330 reply.recycle();
2331 return res;
2332 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002333 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2334 Parcel data = Parcel.obtain();
2335 Parcel reply = Parcel.obtain();
2336 data.writeInterfaceToken(IActivityManager.descriptor);
2337 data.writeStrongBinder(token);
2338 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2339 reply.readException();
2340 boolean res = reply.readInt() != 0;
2341 data.recycle();
2342 reply.recycle();
2343 return res;
2344 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002345 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002346 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002347 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002348 {
2349 Parcel data = Parcel.obtain();
2350 Parcel reply = Parcel.obtain();
2351 data.writeInterfaceToken(IActivityManager.descriptor);
2352 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002353 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002354 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2355 filter.writeToParcel(data, 0);
2356 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002357 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002358 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2359 reply.readException();
2360 Intent intent = null;
2361 int haveIntent = reply.readInt();
2362 if (haveIntent != 0) {
2363 intent = Intent.CREATOR.createFromParcel(reply);
2364 }
2365 reply.recycle();
2366 data.recycle();
2367 return intent;
2368 }
2369 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2370 {
2371 Parcel data = Parcel.obtain();
2372 Parcel reply = Parcel.obtain();
2373 data.writeInterfaceToken(IActivityManager.descriptor);
2374 data.writeStrongBinder(receiver.asBinder());
2375 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2376 reply.readException();
2377 data.recycle();
2378 reply.recycle();
2379 }
2380 public int broadcastIntent(IApplicationThread caller,
2381 Intent intent, String resolvedType, IIntentReceiver resultTo,
2382 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002383 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002384 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002385 {
2386 Parcel data = Parcel.obtain();
2387 Parcel reply = Parcel.obtain();
2388 data.writeInterfaceToken(IActivityManager.descriptor);
2389 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2390 intent.writeToParcel(data, 0);
2391 data.writeString(resolvedType);
2392 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2393 data.writeInt(resultCode);
2394 data.writeString(resultData);
2395 data.writeBundle(map);
2396 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002397 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002398 data.writeInt(serialized ? 1 : 0);
2399 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002400 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002401 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2402 reply.readException();
2403 int res = reply.readInt();
2404 reply.recycle();
2405 data.recycle();
2406 return res;
2407 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002408 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2409 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002410 {
2411 Parcel data = Parcel.obtain();
2412 Parcel reply = Parcel.obtain();
2413 data.writeInterfaceToken(IActivityManager.descriptor);
2414 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2415 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002416 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002417 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2418 reply.readException();
2419 data.recycle();
2420 reply.recycle();
2421 }
2422 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2423 {
2424 Parcel data = Parcel.obtain();
2425 Parcel reply = Parcel.obtain();
2426 data.writeInterfaceToken(IActivityManager.descriptor);
2427 data.writeStrongBinder(who);
2428 data.writeInt(resultCode);
2429 data.writeString(resultData);
2430 data.writeBundle(map);
2431 data.writeInt(abortBroadcast ? 1 : 0);
2432 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2433 reply.readException();
2434 data.recycle();
2435 reply.recycle();
2436 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002437 public void attachApplication(IApplicationThread app) throws RemoteException
2438 {
2439 Parcel data = Parcel.obtain();
2440 Parcel reply = Parcel.obtain();
2441 data.writeInterfaceToken(IActivityManager.descriptor);
2442 data.writeStrongBinder(app.asBinder());
2443 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 data.recycle();
2446 reply.recycle();
2447 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002448 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
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(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002455 if (config != null) {
2456 data.writeInt(1);
2457 config.writeToParcel(data, 0);
2458 } else {
2459 data.writeInt(0);
2460 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002461 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002462 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2463 reply.readException();
2464 data.recycle();
2465 reply.recycle();
2466 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002467 public void activityResumed(IBinder token) throws RemoteException
2468 {
2469 Parcel data = Parcel.obtain();
2470 Parcel reply = Parcel.obtain();
2471 data.writeInterfaceToken(IActivityManager.descriptor);
2472 data.writeStrongBinder(token);
2473 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2474 reply.readException();
2475 data.recycle();
2476 reply.recycle();
2477 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002478 public void activityPaused(IBinder token) throws RemoteException
2479 {
2480 Parcel data = Parcel.obtain();
2481 Parcel reply = Parcel.obtain();
2482 data.writeInterfaceToken(IActivityManager.descriptor);
2483 data.writeStrongBinder(token);
2484 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 data.recycle();
2487 reply.recycle();
2488 }
2489 public void activityStopped(IBinder token, Bundle state,
2490 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002491 {
2492 Parcel data = Parcel.obtain();
2493 Parcel reply = Parcel.obtain();
2494 data.writeInterfaceToken(IActivityManager.descriptor);
2495 data.writeStrongBinder(token);
2496 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002497 if (thumbnail != null) {
2498 data.writeInt(1);
2499 thumbnail.writeToParcel(data, 0);
2500 } else {
2501 data.writeInt(0);
2502 }
2503 TextUtils.writeToParcel(description, data, 0);
2504 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2505 reply.readException();
2506 data.recycle();
2507 reply.recycle();
2508 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002509 public void activitySlept(IBinder token) throws RemoteException
2510 {
2511 Parcel data = Parcel.obtain();
2512 Parcel reply = Parcel.obtain();
2513 data.writeInterfaceToken(IActivityManager.descriptor);
2514 data.writeStrongBinder(token);
2515 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2516 reply.readException();
2517 data.recycle();
2518 reply.recycle();
2519 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002520 public void activityDestroyed(IBinder token) throws RemoteException
2521 {
2522 Parcel data = Parcel.obtain();
2523 Parcel reply = Parcel.obtain();
2524 data.writeInterfaceToken(IActivityManager.descriptor);
2525 data.writeStrongBinder(token);
2526 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2527 reply.readException();
2528 data.recycle();
2529 reply.recycle();
2530 }
2531 public String getCallingPackage(IBinder token) throws RemoteException
2532 {
2533 Parcel data = Parcel.obtain();
2534 Parcel reply = Parcel.obtain();
2535 data.writeInterfaceToken(IActivityManager.descriptor);
2536 data.writeStrongBinder(token);
2537 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2538 reply.readException();
2539 String res = reply.readString();
2540 data.recycle();
2541 reply.recycle();
2542 return res;
2543 }
2544 public ComponentName getCallingActivity(IBinder token)
2545 throws RemoteException {
2546 Parcel data = Parcel.obtain();
2547 Parcel reply = Parcel.obtain();
2548 data.writeInterfaceToken(IActivityManager.descriptor);
2549 data.writeStrongBinder(token);
2550 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2551 reply.readException();
2552 ComponentName res = ComponentName.readFromParcel(reply);
2553 data.recycle();
2554 reply.recycle();
2555 return res;
2556 }
2557 public List getTasks(int maxNum, int flags,
2558 IThumbnailReceiver receiver) throws RemoteException {
2559 Parcel data = Parcel.obtain();
2560 Parcel reply = Parcel.obtain();
2561 data.writeInterfaceToken(IActivityManager.descriptor);
2562 data.writeInt(maxNum);
2563 data.writeInt(flags);
2564 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2565 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2566 reply.readException();
2567 ArrayList list = null;
2568 int N = reply.readInt();
2569 if (N >= 0) {
2570 list = new ArrayList();
2571 while (N > 0) {
2572 ActivityManager.RunningTaskInfo info =
2573 ActivityManager.RunningTaskInfo.CREATOR
2574 .createFromParcel(reply);
2575 list.add(info);
2576 N--;
2577 }
2578 }
2579 data.recycle();
2580 reply.recycle();
2581 return list;
2582 }
2583 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002584 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002585 Parcel data = Parcel.obtain();
2586 Parcel reply = Parcel.obtain();
2587 data.writeInterfaceToken(IActivityManager.descriptor);
2588 data.writeInt(maxNum);
2589 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002590 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002591 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2592 reply.readException();
2593 ArrayList<ActivityManager.RecentTaskInfo> list
2594 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2595 data.recycle();
2596 reply.recycle();
2597 return list;
2598 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002599 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002600 Parcel data = Parcel.obtain();
2601 Parcel reply = Parcel.obtain();
2602 data.writeInterfaceToken(IActivityManager.descriptor);
2603 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002604 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002605 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002606 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002607 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002608 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002609 }
2610 data.recycle();
2611 reply.recycle();
2612 return bm;
2613 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002614 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2615 Parcel data = Parcel.obtain();
2616 Parcel reply = Parcel.obtain();
2617 data.writeInterfaceToken(IActivityManager.descriptor);
2618 data.writeInt(id);
2619 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2620 reply.readException();
2621 Bitmap bm = null;
2622 if (reply.readInt() != 0) {
2623 bm = Bitmap.CREATOR.createFromParcel(reply);
2624 }
2625 data.recycle();
2626 reply.recycle();
2627 return bm;
2628 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002629 public List getServices(int maxNum, int flags) throws RemoteException {
2630 Parcel data = Parcel.obtain();
2631 Parcel reply = Parcel.obtain();
2632 data.writeInterfaceToken(IActivityManager.descriptor);
2633 data.writeInt(maxNum);
2634 data.writeInt(flags);
2635 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2636 reply.readException();
2637 ArrayList list = null;
2638 int N = reply.readInt();
2639 if (N >= 0) {
2640 list = new ArrayList();
2641 while (N > 0) {
2642 ActivityManager.RunningServiceInfo info =
2643 ActivityManager.RunningServiceInfo.CREATOR
2644 .createFromParcel(reply);
2645 list.add(info);
2646 N--;
2647 }
2648 }
2649 data.recycle();
2650 reply.recycle();
2651 return list;
2652 }
2653 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2654 throws RemoteException {
2655 Parcel data = Parcel.obtain();
2656 Parcel reply = Parcel.obtain();
2657 data.writeInterfaceToken(IActivityManager.descriptor);
2658 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2659 reply.readException();
2660 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2661 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2662 data.recycle();
2663 reply.recycle();
2664 return list;
2665 }
2666 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2667 throws RemoteException {
2668 Parcel data = Parcel.obtain();
2669 Parcel reply = Parcel.obtain();
2670 data.writeInterfaceToken(IActivityManager.descriptor);
2671 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2672 reply.readException();
2673 ArrayList<ActivityManager.RunningAppProcessInfo> list
2674 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2675 data.recycle();
2676 reply.recycle();
2677 return list;
2678 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002679 public List<ApplicationInfo> getRunningExternalApplications()
2680 throws RemoteException {
2681 Parcel data = Parcel.obtain();
2682 Parcel reply = Parcel.obtain();
2683 data.writeInterfaceToken(IActivityManager.descriptor);
2684 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2685 reply.readException();
2686 ArrayList<ApplicationInfo> list
2687 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2688 data.recycle();
2689 reply.recycle();
2690 return list;
2691 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002692 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002693 {
2694 Parcel data = Parcel.obtain();
2695 Parcel reply = Parcel.obtain();
2696 data.writeInterfaceToken(IActivityManager.descriptor);
2697 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002698 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002699 if (options != null) {
2700 data.writeInt(1);
2701 options.writeToParcel(data, 0);
2702 } else {
2703 data.writeInt(0);
2704 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002705 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2706 reply.readException();
2707 data.recycle();
2708 reply.recycle();
2709 }
2710 public void moveTaskToBack(int task) throws RemoteException
2711 {
2712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeInt(task);
2716 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2717 reply.readException();
2718 data.recycle();
2719 reply.recycle();
2720 }
2721 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2722 throws RemoteException {
2723 Parcel data = Parcel.obtain();
2724 Parcel reply = Parcel.obtain();
2725 data.writeInterfaceToken(IActivityManager.descriptor);
2726 data.writeStrongBinder(token);
2727 data.writeInt(nonRoot ? 1 : 0);
2728 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2729 reply.readException();
2730 boolean res = reply.readInt() != 0;
2731 data.recycle();
2732 reply.recycle();
2733 return res;
2734 }
2735 public void moveTaskBackwards(int task) throws RemoteException
2736 {
2737 Parcel data = Parcel.obtain();
2738 Parcel reply = Parcel.obtain();
2739 data.writeInterfaceToken(IActivityManager.descriptor);
2740 data.writeInt(task);
2741 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2742 reply.readException();
2743 data.recycle();
2744 reply.recycle();
2745 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002746 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002747 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2748 {
2749 Parcel data = Parcel.obtain();
2750 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002751 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002752 data.writeInt(taskId);
2753 data.writeInt(stackId);
2754 data.writeInt(toTop ? 1 : 0);
2755 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2756 reply.readException();
2757 data.recycle();
2758 reply.recycle();
2759 }
2760 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002761 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002762 {
2763 Parcel data = Parcel.obtain();
2764 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002765 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002766 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002767 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002768 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002769 reply.readException();
2770 data.recycle();
2771 reply.recycle();
2772 }
Craig Mautner967212c2013-04-13 21:10:58 -07002773 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002774 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002775 {
2776 Parcel data = Parcel.obtain();
2777 Parcel reply = Parcel.obtain();
2778 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002779 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002780 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002781 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002782 data.recycle();
2783 reply.recycle();
2784 return list;
2785 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002786 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002787 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002788 {
2789 Parcel data = Parcel.obtain();
2790 Parcel reply = Parcel.obtain();
2791 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002792 data.writeInt(stackId);
2793 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002794 reply.readException();
2795 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002796 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002797 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002798 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002799 }
2800 data.recycle();
2801 reply.recycle();
2802 return info;
2803 }
2804 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002805 public void setFocusedStack(int stackId) throws RemoteException
2806 {
2807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeInt(stackId);
2811 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2812 reply.readException();
2813 data.recycle();
2814 reply.recycle();
2815 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2817 {
2818 Parcel data = Parcel.obtain();
2819 Parcel reply = Parcel.obtain();
2820 data.writeInterfaceToken(IActivityManager.descriptor);
2821 data.writeStrongBinder(token);
2822 data.writeInt(onlyRoot ? 1 : 0);
2823 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2824 reply.readException();
2825 int res = reply.readInt();
2826 data.recycle();
2827 reply.recycle();
2828 return res;
2829 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002830 public void reportThumbnail(IBinder token,
2831 Bitmap thumbnail, CharSequence description) throws RemoteException
2832 {
2833 Parcel data = Parcel.obtain();
2834 Parcel reply = Parcel.obtain();
2835 data.writeInterfaceToken(IActivityManager.descriptor);
2836 data.writeStrongBinder(token);
2837 if (thumbnail != null) {
2838 data.writeInt(1);
2839 thumbnail.writeToParcel(data, 0);
2840 } else {
2841 data.writeInt(0);
2842 }
2843 TextUtils.writeToParcel(description, data, 0);
2844 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2845 reply.readException();
2846 data.recycle();
2847 reply.recycle();
2848 }
2849 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002850 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002851 Parcel data = Parcel.obtain();
2852 Parcel reply = Parcel.obtain();
2853 data.writeInterfaceToken(IActivityManager.descriptor);
2854 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2855 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002856 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002857 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002858 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2859 reply.readException();
2860 int res = reply.readInt();
2861 ContentProviderHolder cph = null;
2862 if (res != 0) {
2863 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2864 }
2865 data.recycle();
2866 reply.recycle();
2867 return cph;
2868 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002869 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2870 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002871 Parcel data = Parcel.obtain();
2872 Parcel reply = Parcel.obtain();
2873 data.writeInterfaceToken(IActivityManager.descriptor);
2874 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002875 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002876 data.writeStrongBinder(token);
2877 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2878 reply.readException();
2879 int res = reply.readInt();
2880 ContentProviderHolder cph = null;
2881 if (res != 0) {
2882 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2883 }
2884 data.recycle();
2885 reply.recycle();
2886 return cph;
2887 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002888 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002889 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002890 {
2891 Parcel data = Parcel.obtain();
2892 Parcel reply = Parcel.obtain();
2893 data.writeInterfaceToken(IActivityManager.descriptor);
2894 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2895 data.writeTypedList(providers);
2896 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2897 reply.readException();
2898 data.recycle();
2899 reply.recycle();
2900 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002901 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2902 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002903 Parcel data = Parcel.obtain();
2904 Parcel reply = Parcel.obtain();
2905 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002906 data.writeStrongBinder(connection);
2907 data.writeInt(stable);
2908 data.writeInt(unstable);
2909 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2910 reply.readException();
2911 boolean res = reply.readInt() != 0;
2912 data.recycle();
2913 reply.recycle();
2914 return res;
2915 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002916
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002917 public void unstableProviderDied(IBinder connection) throws RemoteException {
2918 Parcel data = Parcel.obtain();
2919 Parcel reply = Parcel.obtain();
2920 data.writeInterfaceToken(IActivityManager.descriptor);
2921 data.writeStrongBinder(connection);
2922 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2923 reply.readException();
2924 data.recycle();
2925 reply.recycle();
2926 }
2927
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002928 @Override
2929 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
2930 Parcel data = Parcel.obtain();
2931 Parcel reply = Parcel.obtain();
2932 data.writeInterfaceToken(IActivityManager.descriptor);
2933 data.writeStrongBinder(connection);
2934 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
2935 reply.readException();
2936 data.recycle();
2937 reply.recycle();
2938 }
2939
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002940 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
2944 data.writeStrongBinder(connection);
2945 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002946 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2947 reply.readException();
2948 data.recycle();
2949 reply.recycle();
2950 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002951
2952 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2953 Parcel data = Parcel.obtain();
2954 Parcel reply = Parcel.obtain();
2955 data.writeInterfaceToken(IActivityManager.descriptor);
2956 data.writeString(name);
2957 data.writeStrongBinder(token);
2958 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2959 reply.readException();
2960 data.recycle();
2961 reply.recycle();
2962 }
2963
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002964 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2965 throws RemoteException
2966 {
2967 Parcel data = Parcel.obtain();
2968 Parcel reply = Parcel.obtain();
2969 data.writeInterfaceToken(IActivityManager.descriptor);
2970 service.writeToParcel(data, 0);
2971 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2972 reply.readException();
2973 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2974 data.recycle();
2975 reply.recycle();
2976 return res;
2977 }
2978
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002980 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002981 {
2982 Parcel data = Parcel.obtain();
2983 Parcel reply = Parcel.obtain();
2984 data.writeInterfaceToken(IActivityManager.descriptor);
2985 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2986 service.writeToParcel(data, 0);
2987 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002988 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002989 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 ComponentName res = ComponentName.readFromParcel(reply);
2992 data.recycle();
2993 reply.recycle();
2994 return res;
2995 }
2996 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002997 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002998 {
2999 Parcel data = Parcel.obtain();
3000 Parcel reply = Parcel.obtain();
3001 data.writeInterfaceToken(IActivityManager.descriptor);
3002 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3003 service.writeToParcel(data, 0);
3004 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003005 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3007 reply.readException();
3008 int res = reply.readInt();
3009 reply.recycle();
3010 data.recycle();
3011 return res;
3012 }
3013 public boolean stopServiceToken(ComponentName className, IBinder token,
3014 int startId) throws RemoteException {
3015 Parcel data = Parcel.obtain();
3016 Parcel reply = Parcel.obtain();
3017 data.writeInterfaceToken(IActivityManager.descriptor);
3018 ComponentName.writeToParcel(className, data);
3019 data.writeStrongBinder(token);
3020 data.writeInt(startId);
3021 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3022 reply.readException();
3023 boolean res = reply.readInt() != 0;
3024 data.recycle();
3025 reply.recycle();
3026 return res;
3027 }
3028 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003029 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003030 Parcel data = Parcel.obtain();
3031 Parcel reply = Parcel.obtain();
3032 data.writeInterfaceToken(IActivityManager.descriptor);
3033 ComponentName.writeToParcel(className, data);
3034 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003035 data.writeInt(id);
3036 if (notification != null) {
3037 data.writeInt(1);
3038 notification.writeToParcel(data, 0);
3039 } else {
3040 data.writeInt(0);
3041 }
3042 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3044 reply.readException();
3045 data.recycle();
3046 reply.recycle();
3047 }
3048 public int bindService(IApplicationThread caller, IBinder token,
3049 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003050 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003051 Parcel data = Parcel.obtain();
3052 Parcel reply = Parcel.obtain();
3053 data.writeInterfaceToken(IActivityManager.descriptor);
3054 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3055 data.writeStrongBinder(token);
3056 service.writeToParcel(data, 0);
3057 data.writeString(resolvedType);
3058 data.writeStrongBinder(connection.asBinder());
3059 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003060 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003061 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 int res = reply.readInt();
3064 data.recycle();
3065 reply.recycle();
3066 return res;
3067 }
3068 public boolean unbindService(IServiceConnection connection) throws RemoteException
3069 {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 data.writeStrongBinder(connection.asBinder());
3074 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 boolean res = reply.readInt() != 0;
3077 data.recycle();
3078 reply.recycle();
3079 return res;
3080 }
3081
3082 public void publishService(IBinder token,
3083 Intent intent, IBinder service) throws RemoteException {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeStrongBinder(token);
3088 intent.writeToParcel(data, 0);
3089 data.writeStrongBinder(service);
3090 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3091 reply.readException();
3092 data.recycle();
3093 reply.recycle();
3094 }
3095
3096 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3097 throws RemoteException {
3098 Parcel data = Parcel.obtain();
3099 Parcel reply = Parcel.obtain();
3100 data.writeInterfaceToken(IActivityManager.descriptor);
3101 data.writeStrongBinder(token);
3102 intent.writeToParcel(data, 0);
3103 data.writeInt(doRebind ? 1 : 0);
3104 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3105 reply.readException();
3106 data.recycle();
3107 reply.recycle();
3108 }
3109
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003110 public void serviceDoneExecuting(IBinder token, int type, int startId,
3111 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003116 data.writeInt(type);
3117 data.writeInt(startId);
3118 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003119 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3120 reply.readException();
3121 data.recycle();
3122 reply.recycle();
3123 }
3124
3125 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3126 Parcel data = Parcel.obtain();
3127 Parcel reply = Parcel.obtain();
3128 data.writeInterfaceToken(IActivityManager.descriptor);
3129 service.writeToParcel(data, 0);
3130 data.writeString(resolvedType);
3131 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3132 reply.readException();
3133 IBinder binder = reply.readStrongBinder();
3134 reply.recycle();
3135 data.recycle();
3136 return binder;
3137 }
3138
Christopher Tate181fafa2009-05-14 11:12:14 -07003139 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3140 throws RemoteException {
3141 Parcel data = Parcel.obtain();
3142 Parcel reply = Parcel.obtain();
3143 data.writeInterfaceToken(IActivityManager.descriptor);
3144 app.writeToParcel(data, 0);
3145 data.writeInt(backupRestoreMode);
3146 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3147 reply.readException();
3148 boolean success = reply.readInt() != 0;
3149 reply.recycle();
3150 data.recycle();
3151 return success;
3152 }
3153
Christopher Tate346acb12012-10-15 19:20:25 -07003154 public void clearPendingBackup() throws RemoteException {
3155 Parcel data = Parcel.obtain();
3156 Parcel reply = Parcel.obtain();
3157 data.writeInterfaceToken(IActivityManager.descriptor);
3158 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3159 reply.recycle();
3160 data.recycle();
3161 }
3162
Christopher Tate181fafa2009-05-14 11:12:14 -07003163 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 data.writeString(packageName);
3168 data.writeStrongBinder(agent);
3169 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3170 reply.recycle();
3171 data.recycle();
3172 }
3173
3174 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3175 Parcel data = Parcel.obtain();
3176 Parcel reply = Parcel.obtain();
3177 data.writeInterfaceToken(IActivityManager.descriptor);
3178 app.writeToParcel(data, 0);
3179 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3180 reply.readException();
3181 reply.recycle();
3182 data.recycle();
3183 }
3184
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003185 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003186 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3187 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003188 Parcel data = Parcel.obtain();
3189 Parcel reply = Parcel.obtain();
3190 data.writeInterfaceToken(IActivityManager.descriptor);
3191 ComponentName.writeToParcel(className, data);
3192 data.writeString(profileFile);
3193 data.writeInt(flags);
3194 data.writeBundle(arguments);
3195 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003196 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003197 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003198 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3199 reply.readException();
3200 boolean res = reply.readInt() != 0;
3201 reply.recycle();
3202 data.recycle();
3203 return res;
3204 }
3205
3206 public void finishInstrumentation(IApplicationThread target,
3207 int resultCode, Bundle results) throws RemoteException {
3208 Parcel data = Parcel.obtain();
3209 Parcel reply = Parcel.obtain();
3210 data.writeInterfaceToken(IActivityManager.descriptor);
3211 data.writeStrongBinder(target != null ? target.asBinder() : null);
3212 data.writeInt(resultCode);
3213 data.writeBundle(results);
3214 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3215 reply.readException();
3216 data.recycle();
3217 reply.recycle();
3218 }
3219 public Configuration getConfiguration() throws RemoteException
3220 {
3221 Parcel data = Parcel.obtain();
3222 Parcel reply = Parcel.obtain();
3223 data.writeInterfaceToken(IActivityManager.descriptor);
3224 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3225 reply.readException();
3226 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3227 reply.recycle();
3228 data.recycle();
3229 return res;
3230 }
3231 public void updateConfiguration(Configuration values) throws RemoteException
3232 {
3233 Parcel data = Parcel.obtain();
3234 Parcel reply = Parcel.obtain();
3235 data.writeInterfaceToken(IActivityManager.descriptor);
3236 values.writeToParcel(data, 0);
3237 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3238 reply.readException();
3239 data.recycle();
3240 reply.recycle();
3241 }
3242 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3243 throws RemoteException {
3244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 data.writeStrongBinder(token);
3248 data.writeInt(requestedOrientation);
3249 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3250 reply.readException();
3251 data.recycle();
3252 reply.recycle();
3253 }
3254 public int getRequestedOrientation(IBinder token) throws RemoteException {
3255 Parcel data = Parcel.obtain();
3256 Parcel reply = Parcel.obtain();
3257 data.writeInterfaceToken(IActivityManager.descriptor);
3258 data.writeStrongBinder(token);
3259 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3260 reply.readException();
3261 int res = reply.readInt();
3262 data.recycle();
3263 reply.recycle();
3264 return res;
3265 }
3266 public ComponentName getActivityClassForToken(IBinder token)
3267 throws RemoteException {
3268 Parcel data = Parcel.obtain();
3269 Parcel reply = Parcel.obtain();
3270 data.writeInterfaceToken(IActivityManager.descriptor);
3271 data.writeStrongBinder(token);
3272 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3273 reply.readException();
3274 ComponentName res = ComponentName.readFromParcel(reply);
3275 data.recycle();
3276 reply.recycle();
3277 return res;
3278 }
3279 public String getPackageForToken(IBinder token) throws RemoteException
3280 {
3281 Parcel data = Parcel.obtain();
3282 Parcel reply = Parcel.obtain();
3283 data.writeInterfaceToken(IActivityManager.descriptor);
3284 data.writeStrongBinder(token);
3285 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3286 reply.readException();
3287 String res = reply.readString();
3288 data.recycle();
3289 reply.recycle();
3290 return res;
3291 }
3292 public IIntentSender getIntentSender(int type,
3293 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003294 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003295 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003296 Parcel data = Parcel.obtain();
3297 Parcel reply = Parcel.obtain();
3298 data.writeInterfaceToken(IActivityManager.descriptor);
3299 data.writeInt(type);
3300 data.writeString(packageName);
3301 data.writeStrongBinder(token);
3302 data.writeString(resultWho);
3303 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003304 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003305 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003306 data.writeTypedArray(intents, 0);
3307 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003308 } else {
3309 data.writeInt(0);
3310 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003312 if (options != null) {
3313 data.writeInt(1);
3314 options.writeToParcel(data, 0);
3315 } else {
3316 data.writeInt(0);
3317 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003318 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003319 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3320 reply.readException();
3321 IIntentSender res = IIntentSender.Stub.asInterface(
3322 reply.readStrongBinder());
3323 data.recycle();
3324 reply.recycle();
3325 return res;
3326 }
3327 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3328 Parcel data = Parcel.obtain();
3329 Parcel reply = Parcel.obtain();
3330 data.writeInterfaceToken(IActivityManager.descriptor);
3331 data.writeStrongBinder(sender.asBinder());
3332 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 data.recycle();
3335 reply.recycle();
3336 }
3337 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3338 Parcel data = Parcel.obtain();
3339 Parcel reply = Parcel.obtain();
3340 data.writeInterfaceToken(IActivityManager.descriptor);
3341 data.writeStrongBinder(sender.asBinder());
3342 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3343 reply.readException();
3344 String res = reply.readString();
3345 data.recycle();
3346 reply.recycle();
3347 return res;
3348 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003349 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 data.writeStrongBinder(sender.asBinder());
3354 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3355 reply.readException();
3356 int res = reply.readInt();
3357 data.recycle();
3358 reply.recycle();
3359 return res;
3360 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003361 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3362 boolean requireFull, String name, String callerPackage) throws RemoteException {
3363 Parcel data = Parcel.obtain();
3364 Parcel reply = Parcel.obtain();
3365 data.writeInterfaceToken(IActivityManager.descriptor);
3366 data.writeInt(callingPid);
3367 data.writeInt(callingUid);
3368 data.writeInt(userId);
3369 data.writeInt(allowAll ? 1 : 0);
3370 data.writeInt(requireFull ? 1 : 0);
3371 data.writeString(name);
3372 data.writeString(callerPackage);
3373 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3374 reply.readException();
3375 int res = reply.readInt();
3376 data.recycle();
3377 reply.recycle();
3378 return res;
3379 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003380 public void setProcessLimit(int max) throws RemoteException
3381 {
3382 Parcel data = Parcel.obtain();
3383 Parcel reply = Parcel.obtain();
3384 data.writeInterfaceToken(IActivityManager.descriptor);
3385 data.writeInt(max);
3386 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 data.recycle();
3389 reply.recycle();
3390 }
3391 public int getProcessLimit() throws RemoteException
3392 {
3393 Parcel data = Parcel.obtain();
3394 Parcel reply = Parcel.obtain();
3395 data.writeInterfaceToken(IActivityManager.descriptor);
3396 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3397 reply.readException();
3398 int res = reply.readInt();
3399 data.recycle();
3400 reply.recycle();
3401 return res;
3402 }
3403 public void setProcessForeground(IBinder token, int pid,
3404 boolean isForeground) throws RemoteException {
3405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 data.writeStrongBinder(token);
3409 data.writeInt(pid);
3410 data.writeInt(isForeground ? 1 : 0);
3411 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3412 reply.readException();
3413 data.recycle();
3414 reply.recycle();
3415 }
3416 public int checkPermission(String permission, int pid, int uid)
3417 throws RemoteException {
3418 Parcel data = Parcel.obtain();
3419 Parcel reply = Parcel.obtain();
3420 data.writeInterfaceToken(IActivityManager.descriptor);
3421 data.writeString(permission);
3422 data.writeInt(pid);
3423 data.writeInt(uid);
3424 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 int res = reply.readInt();
3427 data.recycle();
3428 reply.recycle();
3429 return res;
3430 }
3431 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003432 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003433 Parcel data = Parcel.obtain();
3434 Parcel reply = Parcel.obtain();
3435 data.writeInterfaceToken(IActivityManager.descriptor);
3436 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003437 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003438 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003439 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3440 reply.readException();
3441 boolean res = reply.readInt() != 0;
3442 data.recycle();
3443 reply.recycle();
3444 return res;
3445 }
3446 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3447 throws RemoteException {
3448 Parcel data = Parcel.obtain();
3449 Parcel reply = Parcel.obtain();
3450 data.writeInterfaceToken(IActivityManager.descriptor);
3451 uri.writeToParcel(data, 0);
3452 data.writeInt(pid);
3453 data.writeInt(uid);
3454 data.writeInt(mode);
3455 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3456 reply.readException();
3457 int res = reply.readInt();
3458 data.recycle();
3459 reply.recycle();
3460 return res;
3461 }
3462 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3463 Uri uri, int mode) throws RemoteException {
3464 Parcel data = Parcel.obtain();
3465 Parcel reply = Parcel.obtain();
3466 data.writeInterfaceToken(IActivityManager.descriptor);
3467 data.writeStrongBinder(caller.asBinder());
3468 data.writeString(targetPkg);
3469 uri.writeToParcel(data, 0);
3470 data.writeInt(mode);
3471 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3472 reply.readException();
3473 data.recycle();
3474 reply.recycle();
3475 }
3476 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3477 int mode) throws RemoteException {
3478 Parcel data = Parcel.obtain();
3479 Parcel reply = Parcel.obtain();
3480 data.writeInterfaceToken(IActivityManager.descriptor);
3481 data.writeStrongBinder(caller.asBinder());
3482 uri.writeToParcel(data, 0);
3483 data.writeInt(mode);
3484 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 data.recycle();
3487 reply.recycle();
3488 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003489
3490 @Override
3491 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3492 Parcel data = Parcel.obtain();
3493 Parcel reply = Parcel.obtain();
3494 data.writeInterfaceToken(IActivityManager.descriptor);
3495 uri.writeToParcel(data, 0);
3496 data.writeInt(mode);
3497 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3498 reply.readException();
3499 data.recycle();
3500 reply.recycle();
3501 }
3502
3503 @Override
3504 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3505 Parcel data = Parcel.obtain();
3506 Parcel reply = Parcel.obtain();
3507 data.writeInterfaceToken(IActivityManager.descriptor);
3508 uri.writeToParcel(data, 0);
3509 data.writeInt(mode);
3510 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3511 reply.readException();
3512 data.recycle();
3513 reply.recycle();
3514 }
3515
3516 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003517 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3518 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003519 Parcel data = Parcel.obtain();
3520 Parcel reply = Parcel.obtain();
3521 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003522 data.writeString(packageName);
3523 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003524 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3525 reply.readException();
3526 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3527 reply);
3528 data.recycle();
3529 reply.recycle();
3530 return perms;
3531 }
3532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003533 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3534 throws RemoteException {
3535 Parcel data = Parcel.obtain();
3536 Parcel reply = Parcel.obtain();
3537 data.writeInterfaceToken(IActivityManager.descriptor);
3538 data.writeStrongBinder(who.asBinder());
3539 data.writeInt(waiting ? 1 : 0);
3540 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3541 reply.readException();
3542 data.recycle();
3543 reply.recycle();
3544 }
3545 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3546 Parcel data = Parcel.obtain();
3547 Parcel reply = Parcel.obtain();
3548 data.writeInterfaceToken(IActivityManager.descriptor);
3549 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 outInfo.readFromParcel(reply);
3552 data.recycle();
3553 reply.recycle();
3554 }
3555 public void unhandledBack() throws RemoteException
3556 {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
3560 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3561 reply.readException();
3562 data.recycle();
3563 reply.recycle();
3564 }
3565 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3566 {
3567 Parcel data = Parcel.obtain();
3568 Parcel reply = Parcel.obtain();
3569 data.writeInterfaceToken(IActivityManager.descriptor);
3570 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3571 reply.readException();
3572 ParcelFileDescriptor pfd = null;
3573 if (reply.readInt() != 0) {
3574 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3575 }
3576 data.recycle();
3577 reply.recycle();
3578 return pfd;
3579 }
3580 public void goingToSleep() throws RemoteException
3581 {
3582 Parcel data = Parcel.obtain();
3583 Parcel reply = Parcel.obtain();
3584 data.writeInterfaceToken(IActivityManager.descriptor);
3585 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3586 reply.readException();
3587 data.recycle();
3588 reply.recycle();
3589 }
3590 public void wakingUp() throws RemoteException
3591 {
3592 Parcel data = Parcel.obtain();
3593 Parcel reply = Parcel.obtain();
3594 data.writeInterfaceToken(IActivityManager.descriptor);
3595 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3596 reply.readException();
3597 data.recycle();
3598 reply.recycle();
3599 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003600 public void setLockScreenShown(boolean shown) throws RemoteException
3601 {
3602 Parcel data = Parcel.obtain();
3603 Parcel reply = Parcel.obtain();
3604 data.writeInterfaceToken(IActivityManager.descriptor);
3605 data.writeInt(shown ? 1 : 0);
3606 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3607 reply.readException();
3608 data.recycle();
3609 reply.recycle();
3610 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003611 public void setDebugApp(
3612 String packageName, boolean waitForDebugger, boolean persistent)
3613 throws RemoteException
3614 {
3615 Parcel data = Parcel.obtain();
3616 Parcel reply = Parcel.obtain();
3617 data.writeInterfaceToken(IActivityManager.descriptor);
3618 data.writeString(packageName);
3619 data.writeInt(waitForDebugger ? 1 : 0);
3620 data.writeInt(persistent ? 1 : 0);
3621 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3622 reply.readException();
3623 data.recycle();
3624 reply.recycle();
3625 }
3626 public void setAlwaysFinish(boolean enabled) throws RemoteException
3627 {
3628 Parcel data = Parcel.obtain();
3629 Parcel reply = Parcel.obtain();
3630 data.writeInterfaceToken(IActivityManager.descriptor);
3631 data.writeInt(enabled ? 1 : 0);
3632 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3633 reply.readException();
3634 data.recycle();
3635 reply.recycle();
3636 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003637 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003638 {
3639 Parcel data = Parcel.obtain();
3640 Parcel reply = Parcel.obtain();
3641 data.writeInterfaceToken(IActivityManager.descriptor);
3642 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003643 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003644 reply.readException();
3645 data.recycle();
3646 reply.recycle();
3647 }
3648 public void enterSafeMode() throws RemoteException {
3649 Parcel data = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3652 data.recycle();
3653 }
3654 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3655 Parcel data = Parcel.obtain();
3656 data.writeStrongBinder(sender.asBinder());
3657 data.writeInterfaceToken(IActivityManager.descriptor);
3658 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3659 data.recycle();
3660 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003661 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003662 Parcel data = Parcel.obtain();
3663 Parcel reply = Parcel.obtain();
3664 data.writeInterfaceToken(IActivityManager.descriptor);
3665 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003666 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003667 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003668 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003669 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003670 boolean res = reply.readInt() != 0;
3671 data.recycle();
3672 reply.recycle();
3673 return res;
3674 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003675 @Override
3676 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3677 Parcel data = Parcel.obtain();
3678 Parcel reply = Parcel.obtain();
3679 data.writeInterfaceToken(IActivityManager.descriptor);
3680 data.writeString(reason);
3681 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3682 boolean res = reply.readInt() != 0;
3683 data.recycle();
3684 reply.recycle();
3685 return res;
3686 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003687 public void startRunning(String pkg, String cls, String action,
3688 String indata) throws RemoteException {
3689 Parcel data = Parcel.obtain();
3690 Parcel reply = Parcel.obtain();
3691 data.writeInterfaceToken(IActivityManager.descriptor);
3692 data.writeString(pkg);
3693 data.writeString(cls);
3694 data.writeString(action);
3695 data.writeString(indata);
3696 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3697 reply.readException();
3698 data.recycle();
3699 reply.recycle();
3700 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003701 public boolean testIsSystemReady()
3702 {
3703 /* this base class version is never called */
3704 return true;
3705 }
Dan Egnor60d87622009-12-16 16:32:58 -08003706 public void handleApplicationCrash(IBinder app,
3707 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3708 {
3709 Parcel data = Parcel.obtain();
3710 Parcel reply = Parcel.obtain();
3711 data.writeInterfaceToken(IActivityManager.descriptor);
3712 data.writeStrongBinder(app);
3713 crashInfo.writeToParcel(data, 0);
3714 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3715 reply.readException();
3716 reply.recycle();
3717 data.recycle();
3718 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003719
Dan Egnor60d87622009-12-16 16:32:58 -08003720 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003721 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003722 {
3723 Parcel data = Parcel.obtain();
3724 Parcel reply = Parcel.obtain();
3725 data.writeInterfaceToken(IActivityManager.descriptor);
3726 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003727 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003728 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003729 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003730 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003731 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003732 reply.recycle();
3733 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003734 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003735 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003736
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003737 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003738 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003739 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003740 {
3741 Parcel data = Parcel.obtain();
3742 Parcel reply = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003745 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003746 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003747 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3748 reply.readException();
3749 reply.recycle();
3750 data.recycle();
3751 }
3752
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003753 public void signalPersistentProcesses(int sig) throws RemoteException {
3754 Parcel data = Parcel.obtain();
3755 Parcel reply = Parcel.obtain();
3756 data.writeInterfaceToken(IActivityManager.descriptor);
3757 data.writeInt(sig);
3758 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3759 reply.readException();
3760 data.recycle();
3761 reply.recycle();
3762 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003763
Dianne Hackborn1676c852012-09-10 14:52:30 -07003764 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003765 Parcel data = Parcel.obtain();
3766 Parcel reply = Parcel.obtain();
3767 data.writeInterfaceToken(IActivityManager.descriptor);
3768 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003769 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003770 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3771 reply.readException();
3772 data.recycle();
3773 reply.recycle();
3774 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003775
3776 public void killAllBackgroundProcesses() throws RemoteException {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3781 reply.readException();
3782 data.recycle();
3783 reply.recycle();
3784 }
3785
Dianne Hackborn1676c852012-09-10 14:52:30 -07003786 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003791 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003792 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 reply.readException();
3794 data.recycle();
3795 reply.recycle();
3796 }
3797
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003798 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3799 throws RemoteException
3800 {
3801 Parcel data = Parcel.obtain();
3802 Parcel reply = Parcel.obtain();
3803 data.writeInterfaceToken(IActivityManager.descriptor);
3804 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3805 reply.readException();
3806 outInfo.readFromParcel(reply);
3807 reply.recycle();
3808 data.recycle();
3809 }
3810
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003811 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3812 {
3813 Parcel data = Parcel.obtain();
3814 Parcel reply = Parcel.obtain();
3815 data.writeInterfaceToken(IActivityManager.descriptor);
3816 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3817 reply.readException();
3818 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3819 reply.recycle();
3820 data.recycle();
3821 return res;
3822 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003823
Dianne Hackborn1676c852012-09-10 14:52:30 -07003824 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003825 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003826 {
3827 Parcel data = Parcel.obtain();
3828 Parcel reply = Parcel.obtain();
3829 data.writeInterfaceToken(IActivityManager.descriptor);
3830 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003831 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003832 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003833 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003834 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003835 if (fd != null) {
3836 data.writeInt(1);
3837 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3838 } else {
3839 data.writeInt(0);
3840 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003841 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3842 reply.readException();
3843 boolean res = reply.readInt() != 0;
3844 reply.recycle();
3845 data.recycle();
3846 return res;
3847 }
3848
Dianne Hackborn55280a92009-05-07 15:53:46 -07003849 public boolean shutdown(int timeout) throws RemoteException
3850 {
3851 Parcel data = Parcel.obtain();
3852 Parcel reply = Parcel.obtain();
3853 data.writeInterfaceToken(IActivityManager.descriptor);
3854 data.writeInt(timeout);
3855 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3856 reply.readException();
3857 boolean res = reply.readInt() != 0;
3858 reply.recycle();
3859 data.recycle();
3860 return res;
3861 }
3862
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003863 public void stopAppSwitches() throws RemoteException {
3864 Parcel data = Parcel.obtain();
3865 Parcel reply = Parcel.obtain();
3866 data.writeInterfaceToken(IActivityManager.descriptor);
3867 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 reply.recycle();
3870 data.recycle();
3871 }
3872
3873 public void resumeAppSwitches() throws RemoteException {
3874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
3877 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3878 reply.readException();
3879 reply.recycle();
3880 data.recycle();
3881 }
3882
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003883 public void killApplicationWithAppId(String pkg, int appid, String reason)
3884 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003885 Parcel data = Parcel.obtain();
3886 Parcel reply = Parcel.obtain();
3887 data.writeInterfaceToken(IActivityManager.descriptor);
3888 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003889 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003890 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003891 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003892 reply.readException();
3893 data.recycle();
3894 reply.recycle();
3895 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003896
3897 public void closeSystemDialogs(String reason) throws RemoteException {
3898 Parcel data = Parcel.obtain();
3899 Parcel reply = Parcel.obtain();
3900 data.writeInterfaceToken(IActivityManager.descriptor);
3901 data.writeString(reason);
3902 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3903 reply.readException();
3904 data.recycle();
3905 reply.recycle();
3906 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003907
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003908 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003909 throws RemoteException {
3910 Parcel data = Parcel.obtain();
3911 Parcel reply = Parcel.obtain();
3912 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003913 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003914 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3915 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003916 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003917 data.recycle();
3918 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003919 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003920 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003921
3922 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3923 Parcel data = Parcel.obtain();
3924 Parcel reply = Parcel.obtain();
3925 data.writeInterfaceToken(IActivityManager.descriptor);
3926 data.writeString(processName);
3927 data.writeInt(uid);
3928 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3929 reply.readException();
3930 data.recycle();
3931 reply.recycle();
3932 }
3933
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003934 public void overridePendingTransition(IBinder token, String packageName,
3935 int enterAnim, int exitAnim) throws RemoteException {
3936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeStrongBinder(token);
3940 data.writeString(packageName);
3941 data.writeInt(enterAnim);
3942 data.writeInt(exitAnim);
3943 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3944 reply.readException();
3945 data.recycle();
3946 reply.recycle();
3947 }
3948
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003949 public boolean isUserAMonkey() throws RemoteException {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 boolean res = reply.readInt() != 0;
3956 data.recycle();
3957 reply.recycle();
3958 return res;
3959 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003960
3961 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3962 Parcel data = Parcel.obtain();
3963 Parcel reply = Parcel.obtain();
3964 data.writeInterfaceToken(IActivityManager.descriptor);
3965 data.writeInt(monkey ? 1 : 0);
3966 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3967 reply.readException();
3968 data.recycle();
3969 reply.recycle();
3970 }
3971
Dianne Hackborn860755f2010-06-03 18:47:52 -07003972 public void finishHeavyWeightApp() throws RemoteException {
3973 Parcel data = Parcel.obtain();
3974 Parcel reply = Parcel.obtain();
3975 data.writeInterfaceToken(IActivityManager.descriptor);
3976 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3977 reply.readException();
3978 data.recycle();
3979 reply.recycle();
3980 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003981
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003982 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07003983 throws RemoteException {
3984 Parcel data = Parcel.obtain();
3985 Parcel reply = Parcel.obtain();
3986 data.writeInterfaceToken(IActivityManager.descriptor);
3987 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07003988 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
3989 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003990 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07003991 data.recycle();
3992 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003993 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07003994 }
3995
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003996 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07003997 throws RemoteException {
3998 Parcel data = Parcel.obtain();
3999 Parcel reply = Parcel.obtain();
4000 data.writeInterfaceToken(IActivityManager.descriptor);
4001 data.writeStrongBinder(token);
4002 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004003 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004004 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004005 data.recycle();
4006 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004007 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004008 }
4009
Daniel Sandler69a48172010-06-23 16:29:36 -04004010 public void setImmersive(IBinder token, boolean immersive)
4011 throws RemoteException {
4012 Parcel data = Parcel.obtain();
4013 Parcel reply = Parcel.obtain();
4014 data.writeInterfaceToken(IActivityManager.descriptor);
4015 data.writeStrongBinder(token);
4016 data.writeInt(immersive ? 1 : 0);
4017 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4018 reply.readException();
4019 data.recycle();
4020 reply.recycle();
4021 }
4022
4023 public boolean isImmersive(IBinder token)
4024 throws RemoteException {
4025 Parcel data = Parcel.obtain();
4026 Parcel reply = Parcel.obtain();
4027 data.writeInterfaceToken(IActivityManager.descriptor);
4028 data.writeStrongBinder(token);
4029 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004030 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004031 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004032 data.recycle();
4033 reply.recycle();
4034 return res;
4035 }
4036
4037 public boolean isTopActivityImmersive()
4038 throws RemoteException {
4039 Parcel data = Parcel.obtain();
4040 Parcel reply = Parcel.obtain();
4041 data.writeInterfaceToken(IActivityManager.descriptor);
4042 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004043 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004044 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004045 data.recycle();
4046 reply.recycle();
4047 return res;
4048 }
4049
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004050 public void crashApplication(int uid, int initialPid, String packageName,
4051 String message) throws RemoteException {
4052 Parcel data = Parcel.obtain();
4053 Parcel reply = Parcel.obtain();
4054 data.writeInterfaceToken(IActivityManager.descriptor);
4055 data.writeInt(uid);
4056 data.writeInt(initialPid);
4057 data.writeString(packageName);
4058 data.writeString(message);
4059 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4060 reply.readException();
4061 data.recycle();
4062 reply.recycle();
4063 }
Andy McFadden824c5102010-07-09 16:26:57 -07004064
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004065 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004066 Parcel data = Parcel.obtain();
4067 Parcel reply = Parcel.obtain();
4068 data.writeInterfaceToken(IActivityManager.descriptor);
4069 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004070 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004071 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4072 reply.readException();
4073 String res = reply.readString();
4074 data.recycle();
4075 reply.recycle();
4076 return res;
4077 }
4078
Dianne Hackborn7e269642010-08-25 19:50:20 -07004079 public IBinder newUriPermissionOwner(String name)
4080 throws RemoteException {
4081 Parcel data = Parcel.obtain();
4082 Parcel reply = Parcel.obtain();
4083 data.writeInterfaceToken(IActivityManager.descriptor);
4084 data.writeString(name);
4085 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4086 reply.readException();
4087 IBinder res = reply.readStrongBinder();
4088 data.recycle();
4089 reply.recycle();
4090 return res;
4091 }
4092
4093 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4094 Uri uri, int mode) throws RemoteException {
4095 Parcel data = Parcel.obtain();
4096 Parcel reply = Parcel.obtain();
4097 data.writeInterfaceToken(IActivityManager.descriptor);
4098 data.writeStrongBinder(owner);
4099 data.writeInt(fromUid);
4100 data.writeString(targetPkg);
4101 uri.writeToParcel(data, 0);
4102 data.writeInt(mode);
4103 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4104 reply.readException();
4105 data.recycle();
4106 reply.recycle();
4107 }
4108
4109 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4110 int mode) throws RemoteException {
4111 Parcel data = Parcel.obtain();
4112 Parcel reply = Parcel.obtain();
4113 data.writeInterfaceToken(IActivityManager.descriptor);
4114 data.writeStrongBinder(owner);
4115 if (uri != null) {
4116 data.writeInt(1);
4117 uri.writeToParcel(data, 0);
4118 } else {
4119 data.writeInt(0);
4120 }
4121 data.writeInt(mode);
4122 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4123 reply.readException();
4124 data.recycle();
4125 reply.recycle();
4126 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004127
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004128 public int checkGrantUriPermission(int callingUid, String targetPkg,
4129 Uri uri, int modeFlags) throws RemoteException {
4130 Parcel data = Parcel.obtain();
4131 Parcel reply = Parcel.obtain();
4132 data.writeInterfaceToken(IActivityManager.descriptor);
4133 data.writeInt(callingUid);
4134 data.writeString(targetPkg);
4135 uri.writeToParcel(data, 0);
4136 data.writeInt(modeFlags);
4137 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4138 reply.readException();
4139 int res = reply.readInt();
4140 data.recycle();
4141 reply.recycle();
4142 return res;
4143 }
4144
Dianne Hackborn1676c852012-09-10 14:52:30 -07004145 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004146 String path, ParcelFileDescriptor fd) throws RemoteException {
4147 Parcel data = Parcel.obtain();
4148 Parcel reply = Parcel.obtain();
4149 data.writeInterfaceToken(IActivityManager.descriptor);
4150 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004151 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004152 data.writeInt(managed ? 1 : 0);
4153 data.writeString(path);
4154 if (fd != null) {
4155 data.writeInt(1);
4156 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4157 } else {
4158 data.writeInt(0);
4159 }
4160 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4161 reply.readException();
4162 boolean res = reply.readInt() != 0;
4163 reply.recycle();
4164 data.recycle();
4165 return res;
4166 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004167
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004168 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004169 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004170 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004171 Parcel data = Parcel.obtain();
4172 Parcel reply = Parcel.obtain();
4173 data.writeInterfaceToken(IActivityManager.descriptor);
4174 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004175 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004176 data.writeTypedArray(intents, 0);
4177 data.writeStringArray(resolvedTypes);
4178 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004179 if (options != null) {
4180 data.writeInt(1);
4181 options.writeToParcel(data, 0);
4182 } else {
4183 data.writeInt(0);
4184 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004185 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004186 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4187 reply.readException();
4188 int result = reply.readInt();
4189 reply.recycle();
4190 data.recycle();
4191 return result;
4192 }
4193
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004194 public int getFrontActivityScreenCompatMode() throws RemoteException {
4195 Parcel data = Parcel.obtain();
4196 Parcel reply = Parcel.obtain();
4197 data.writeInterfaceToken(IActivityManager.descriptor);
4198 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4199 reply.readException();
4200 int mode = reply.readInt();
4201 reply.recycle();
4202 data.recycle();
4203 return mode;
4204 }
4205
4206 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4207 Parcel data = Parcel.obtain();
4208 Parcel reply = Parcel.obtain();
4209 data.writeInterfaceToken(IActivityManager.descriptor);
4210 data.writeInt(mode);
4211 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4212 reply.readException();
4213 reply.recycle();
4214 data.recycle();
4215 }
4216
4217 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4218 Parcel data = Parcel.obtain();
4219 Parcel reply = Parcel.obtain();
4220 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004221 data.writeString(packageName);
4222 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004223 reply.readException();
4224 int mode = reply.readInt();
4225 reply.recycle();
4226 data.recycle();
4227 return mode;
4228 }
4229
4230 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004231 throws RemoteException {
4232 Parcel data = Parcel.obtain();
4233 Parcel reply = Parcel.obtain();
4234 data.writeInterfaceToken(IActivityManager.descriptor);
4235 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004236 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004237 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4238 reply.readException();
4239 reply.recycle();
4240 data.recycle();
4241 }
4242
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004243 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4244 Parcel data = Parcel.obtain();
4245 Parcel reply = Parcel.obtain();
4246 data.writeInterfaceToken(IActivityManager.descriptor);
4247 data.writeString(packageName);
4248 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4249 reply.readException();
4250 boolean ask = reply.readInt() != 0;
4251 reply.recycle();
4252 data.recycle();
4253 return ask;
4254 }
4255
4256 public void setPackageAskScreenCompat(String packageName, boolean ask)
4257 throws RemoteException {
4258 Parcel data = Parcel.obtain();
4259 Parcel reply = Parcel.obtain();
4260 data.writeInterfaceToken(IActivityManager.descriptor);
4261 data.writeString(packageName);
4262 data.writeInt(ask ? 1 : 0);
4263 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4264 reply.readException();
4265 reply.recycle();
4266 data.recycle();
4267 }
4268
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004269 public boolean switchUser(int userid) throws RemoteException {
4270 Parcel data = Parcel.obtain();
4271 Parcel reply = Parcel.obtain();
4272 data.writeInterfaceToken(IActivityManager.descriptor);
4273 data.writeInt(userid);
4274 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4275 reply.readException();
4276 boolean result = reply.readInt() != 0;
4277 reply.recycle();
4278 data.recycle();
4279 return result;
4280 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004281
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004282 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4283 Parcel data = Parcel.obtain();
4284 Parcel reply = Parcel.obtain();
4285 data.writeInterfaceToken(IActivityManager.descriptor);
4286 data.writeInt(userid);
4287 data.writeStrongInterface(callback);
4288 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 int result = reply.readInt();
4291 reply.recycle();
4292 data.recycle();
4293 return result;
4294 }
4295
Amith Yamasani52f1d752012-03-28 18:19:29 -07004296 public UserInfo getCurrentUser() throws RemoteException {
4297 Parcel data = Parcel.obtain();
4298 Parcel reply = Parcel.obtain();
4299 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004300 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004301 reply.readException();
4302 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4303 reply.recycle();
4304 data.recycle();
4305 return userInfo;
4306 }
4307
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004308 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004309 Parcel data = Parcel.obtain();
4310 Parcel reply = Parcel.obtain();
4311 data.writeInterfaceToken(IActivityManager.descriptor);
4312 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004313 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004314 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4315 reply.readException();
4316 boolean result = reply.readInt() != 0;
4317 reply.recycle();
4318 data.recycle();
4319 return result;
4320 }
4321
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004322 public int[] getRunningUserIds() throws RemoteException {
4323 Parcel data = Parcel.obtain();
4324 Parcel reply = Parcel.obtain();
4325 data.writeInterfaceToken(IActivityManager.descriptor);
4326 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4327 reply.readException();
4328 int[] result = reply.createIntArray();
4329 reply.recycle();
4330 data.recycle();
4331 return result;
4332 }
4333
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004334 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4335 Parcel data = Parcel.obtain();
4336 Parcel reply = Parcel.obtain();
4337 data.writeInterfaceToken(IActivityManager.descriptor);
4338 data.writeInt(taskId);
4339 data.writeInt(subTaskIndex);
4340 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4341 reply.readException();
4342 boolean result = reply.readInt() != 0;
4343 reply.recycle();
4344 data.recycle();
4345 return result;
4346 }
4347
4348 public boolean removeTask(int taskId, int flags) throws RemoteException {
4349 Parcel data = Parcel.obtain();
4350 Parcel reply = Parcel.obtain();
4351 data.writeInterfaceToken(IActivityManager.descriptor);
4352 data.writeInt(taskId);
4353 data.writeInt(flags);
4354 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4355 reply.readException();
4356 boolean result = reply.readInt() != 0;
4357 reply.recycle();
4358 data.recycle();
4359 return result;
4360 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004361
Jeff Sharkeya4620792011-05-20 15:29:23 -07004362 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4363 Parcel data = Parcel.obtain();
4364 Parcel reply = Parcel.obtain();
4365 data.writeInterfaceToken(IActivityManager.descriptor);
4366 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4367 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4368 reply.readException();
4369 data.recycle();
4370 reply.recycle();
4371 }
4372
4373 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4374 Parcel data = Parcel.obtain();
4375 Parcel reply = Parcel.obtain();
4376 data.writeInterfaceToken(IActivityManager.descriptor);
4377 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4378 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4379 reply.readException();
4380 data.recycle();
4381 reply.recycle();
4382 }
4383
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004384 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4385 Parcel data = Parcel.obtain();
4386 Parcel reply = Parcel.obtain();
4387 data.writeInterfaceToken(IActivityManager.descriptor);
4388 data.writeStrongBinder(sender.asBinder());
4389 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4390 reply.readException();
4391 boolean res = reply.readInt() != 0;
4392 data.recycle();
4393 reply.recycle();
4394 return res;
4395 }
4396
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004397 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4398 Parcel data = Parcel.obtain();
4399 Parcel reply = Parcel.obtain();
4400 data.writeInterfaceToken(IActivityManager.descriptor);
4401 data.writeStrongBinder(sender.asBinder());
4402 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4403 reply.readException();
4404 boolean res = reply.readInt() != 0;
4405 data.recycle();
4406 reply.recycle();
4407 return res;
4408 }
4409
Dianne Hackborn81038902012-11-26 17:04:09 -08004410 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4411 Parcel data = Parcel.obtain();
4412 Parcel reply = Parcel.obtain();
4413 data.writeInterfaceToken(IActivityManager.descriptor);
4414 data.writeStrongBinder(sender.asBinder());
4415 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4416 reply.readException();
4417 Intent res = reply.readInt() != 0
4418 ? Intent.CREATOR.createFromParcel(reply) : null;
4419 data.recycle();
4420 reply.recycle();
4421 return res;
4422 }
4423
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004424 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4425 {
4426 Parcel data = Parcel.obtain();
4427 Parcel reply = Parcel.obtain();
4428 data.writeInterfaceToken(IActivityManager.descriptor);
4429 values.writeToParcel(data, 0);
4430 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4431 reply.readException();
4432 data.recycle();
4433 reply.recycle();
4434 }
4435
Dianne Hackbornb437e092011-08-05 17:50:29 -07004436 public long[] getProcessPss(int[] pids) throws RemoteException {
4437 Parcel data = Parcel.obtain();
4438 Parcel reply = Parcel.obtain();
4439 data.writeInterfaceToken(IActivityManager.descriptor);
4440 data.writeIntArray(pids);
4441 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4442 reply.readException();
4443 long[] res = reply.createLongArray();
4444 data.recycle();
4445 reply.recycle();
4446 return res;
4447 }
4448
Dianne Hackborn661cd522011-08-22 00:26:20 -07004449 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4450 Parcel data = Parcel.obtain();
4451 Parcel reply = Parcel.obtain();
4452 data.writeInterfaceToken(IActivityManager.descriptor);
4453 TextUtils.writeToParcel(msg, data, 0);
4454 data.writeInt(always ? 1 : 0);
4455 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4456 reply.readException();
4457 data.recycle();
4458 reply.recycle();
4459 }
4460
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004461 public void dismissKeyguardOnNextActivity() throws RemoteException {
4462 Parcel data = Parcel.obtain();
4463 Parcel reply = Parcel.obtain();
4464 data.writeInterfaceToken(IActivityManager.descriptor);
4465 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4466 reply.readException();
4467 data.recycle();
4468 reply.recycle();
4469 }
4470
Adam Powelldd8fab22012-03-22 17:47:27 -07004471 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4472 throws RemoteException {
4473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
4476 data.writeStrongBinder(token);
4477 data.writeString(destAffinity);
4478 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4479 reply.readException();
4480 boolean result = reply.readInt() != 0;
4481 data.recycle();
4482 reply.recycle();
4483 return result;
4484 }
4485
4486 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4487 throws RemoteException {
4488 Parcel data = Parcel.obtain();
4489 Parcel reply = Parcel.obtain();
4490 data.writeInterfaceToken(IActivityManager.descriptor);
4491 data.writeStrongBinder(token);
4492 target.writeToParcel(data, 0);
4493 data.writeInt(resultCode);
4494 if (resultData != null) {
4495 data.writeInt(1);
4496 resultData.writeToParcel(data, 0);
4497 } else {
4498 data.writeInt(0);
4499 }
4500 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4501 reply.readException();
4502 boolean result = reply.readInt() != 0;
4503 data.recycle();
4504 reply.recycle();
4505 return result;
4506 }
4507
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004508 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4509 Parcel data = Parcel.obtain();
4510 Parcel reply = Parcel.obtain();
4511 data.writeInterfaceToken(IActivityManager.descriptor);
4512 data.writeStrongBinder(activityToken);
4513 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4514 reply.readException();
4515 int result = reply.readInt();
4516 data.recycle();
4517 reply.recycle();
4518 return result;
4519 }
4520
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004521 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4522 Parcel data = Parcel.obtain();
4523 Parcel reply = Parcel.obtain();
4524 data.writeInterfaceToken(IActivityManager.descriptor);
4525 data.writeStrongBinder(activityToken);
4526 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4527 reply.readException();
4528 String result = reply.readString();
4529 data.recycle();
4530 reply.recycle();
4531 return result;
4532 }
4533
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004534 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4535 Parcel data = Parcel.obtain();
4536 Parcel reply = Parcel.obtain();
4537 data.writeInterfaceToken(IActivityManager.descriptor);
4538 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4539 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4540 reply.readException();
4541 data.recycle();
4542 reply.recycle();
4543 }
4544
4545 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
4549 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4550 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4551 reply.readException();
4552 data.recycle();
4553 reply.recycle();
4554 }
4555
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004556 public void requestBugReport() throws RemoteException {
4557 Parcel data = Parcel.obtain();
4558 Parcel reply = Parcel.obtain();
4559 data.writeInterfaceToken(IActivityManager.descriptor);
4560 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4561 reply.readException();
4562 data.recycle();
4563 reply.recycle();
4564 }
4565
Jeff Brownbd181bb2013-09-10 16:44:24 -07004566 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4567 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004568 Parcel data = Parcel.obtain();
4569 Parcel reply = Parcel.obtain();
4570 data.writeInterfaceToken(IActivityManager.descriptor);
4571 data.writeInt(pid);
4572 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004573 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004574 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 long res = reply.readInt();
4577 data.recycle();
4578 reply.recycle();
4579 return res;
4580 }
4581
Adam Skorydfc7fd72013-08-05 19:23:41 -07004582 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004583 Parcel data = Parcel.obtain();
4584 Parcel reply = Parcel.obtain();
4585 data.writeInterfaceToken(IActivityManager.descriptor);
4586 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004587 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004588 reply.readException();
4589 Bundle res = reply.readBundle();
4590 data.recycle();
4591 reply.recycle();
4592 return res;
4593 }
4594
Adam Skory7140a252013-09-11 12:04:58 +01004595 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004596 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004597 Parcel data = Parcel.obtain();
4598 Parcel reply = Parcel.obtain();
4599 data.writeInterfaceToken(IActivityManager.descriptor);
4600 data.writeStrongBinder(token);
4601 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004602 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004603 reply.readException();
4604 data.recycle();
4605 reply.recycle();
4606 }
4607
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004608 public void killUid(int uid, String reason) throws RemoteException {
4609 Parcel data = Parcel.obtain();
4610 Parcel reply = Parcel.obtain();
4611 data.writeInterfaceToken(IActivityManager.descriptor);
4612 data.writeInt(uid);
4613 data.writeString(reason);
4614 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 data.recycle();
4617 reply.recycle();
4618 }
4619
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004620 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4621 Parcel data = Parcel.obtain();
4622 Parcel reply = Parcel.obtain();
4623 data.writeInterfaceToken(IActivityManager.descriptor);
4624 data.writeStrongBinder(who);
4625 data.writeInt(allowRestart ? 1 : 0);
4626 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4627 reply.readException();
4628 data.recycle();
4629 reply.recycle();
4630 }
4631
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004632 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4633 Parcel data = Parcel.obtain();
4634 Parcel reply = Parcel.obtain();
4635 data.writeInterfaceToken(IActivityManager.descriptor);
4636 data.writeStrongBinder(token);
4637 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4638 reply.readException();
4639 data.recycle();
4640 reply.recycle();
4641 }
4642
Craig Mautner5eda9b32013-07-02 11:58:16 -07004643 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4644 Parcel data = Parcel.obtain();
4645 Parcel reply = Parcel.obtain();
4646 data.writeInterfaceToken(IActivityManager.descriptor);
4647 data.writeStrongBinder(token);
4648 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4649 reply.readException();
4650 data.recycle();
4651 reply.recycle();
4652 }
4653
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004654 public void restart() throws RemoteException {
4655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
4658 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4659 reply.readException();
4660 data.recycle();
4661 reply.recycle();
4662 }
4663
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004664 public void performIdleMaintenance() throws RemoteException {
4665 Parcel data = Parcel.obtain();
4666 Parcel reply = Parcel.obtain();
4667 data.writeInterfaceToken(IActivityManager.descriptor);
4668 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4669 reply.readException();
4670 data.recycle();
4671 reply.recycle();
4672 }
4673
Craig Mautner4a1cb222013-12-04 16:14:06 -08004674 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4675 IActivityContainerCallback callback) throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 data.writeStrongBinder(parentActivityToken);
4680 data.writeStrongBinder((IBinder)callback);
4681 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4682 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004683 final int result = reply.readInt();
4684 final IActivityContainer res;
4685 if (result == 1) {
4686 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4687 } else {
4688 res = null;
4689 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004690 data.recycle();
4691 reply.recycle();
4692 return res;
4693 }
4694
Craig Mautnere0a38842013-12-16 16:14:02 -08004695 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4696 throws RemoteException {
4697 Parcel data = Parcel.obtain();
4698 Parcel reply = Parcel.obtain();
4699 data.writeInterfaceToken(IActivityManager.descriptor);
4700 data.writeStrongBinder(activityToken);
4701 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4702 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004703 final int result = reply.readInt();
4704 final IActivityContainer res;
4705 if (result == 1) {
4706 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4707 } else {
4708 res = null;
4709 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004710 data.recycle();
4711 reply.recycle();
4712 return res;
4713 }
4714
Craig Mautner4a1cb222013-12-04 16:14:06 -08004715 public IBinder getHomeActivityToken() throws RemoteException {
4716 Parcel data = Parcel.obtain();
4717 Parcel reply = Parcel.obtain();
4718 data.writeInterfaceToken(IActivityManager.descriptor);
4719 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4720 reply.readException();
4721 IBinder res = reply.readStrongBinder();
4722 data.recycle();
4723 reply.recycle();
4724 return res;
4725 }
4726
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004727 private IBinder mRemote;
4728}