blob: 7695eccabc609c1f14de39a1b49dfe3d9a7a61d8 [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 Mautner95da1082014-02-24 17:54:35 -08002039 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 IActivityContainer activityContainer =
2042 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2043 deleteActivityContainer(activityContainer);
2044 reply.writeNoException();
2045 return true;
2046 }
2047
Craig Mautnere0a38842013-12-16 16:14:02 -08002048 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2049 data.enforceInterface(IActivityManager.descriptor);
2050 IBinder activityToken = data.readStrongBinder();
2051 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2052 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002053 if (activityContainer != null) {
2054 reply.writeInt(1);
2055 reply.writeStrongBinder(activityContainer.asBinder());
2056 } else {
2057 reply.writeInt(0);
2058 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002059 return true;
2060 }
2061
Craig Mautner4a1cb222013-12-04 16:14:06 -08002062 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2063 data.enforceInterface(IActivityManager.descriptor);
2064 IBinder homeActivityToken = getHomeActivityToken();
2065 reply.writeNoException();
2066 reply.writeStrongBinder(homeActivityToken);
2067 return true;
2068 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002069 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002070
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002071 return super.onTransact(code, data, reply, flags);
2072 }
2073
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002074 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002075 return this;
2076 }
2077
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002078 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2079 protected IActivityManager create() {
2080 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002081 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002082 Log.v("ActivityManager", "default service binder = " + b);
2083 }
2084 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002085 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002086 Log.v("ActivityManager", "default service = " + am);
2087 }
2088 return am;
2089 }
2090 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002091}
2092
2093class ActivityManagerProxy implements IActivityManager
2094{
2095 public ActivityManagerProxy(IBinder remote)
2096 {
2097 mRemote = remote;
2098 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002100 public IBinder asBinder()
2101 {
2102 return mRemote;
2103 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002104
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002105 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002106 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2107 int startFlags, String profileFile,
2108 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002109 Parcel data = Parcel.obtain();
2110 Parcel reply = Parcel.obtain();
2111 data.writeInterfaceToken(IActivityManager.descriptor);
2112 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002113 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002114 intent.writeToParcel(data, 0);
2115 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002116 data.writeStrongBinder(resultTo);
2117 data.writeString(resultWho);
2118 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002119 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002120 data.writeString(profileFile);
2121 if (profileFd != null) {
2122 data.writeInt(1);
2123 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2124 } else {
2125 data.writeInt(0);
2126 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002127 if (options != null) {
2128 data.writeInt(1);
2129 options.writeToParcel(data, 0);
2130 } else {
2131 data.writeInt(0);
2132 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002133 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2134 reply.readException();
2135 int result = reply.readInt();
2136 reply.recycle();
2137 data.recycle();
2138 return result;
2139 }
Amith Yamasani82644082012-08-03 13:09:11 -07002140
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002141 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002142 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2143 int startFlags, String profileFile,
2144 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2145 Parcel data = Parcel.obtain();
2146 Parcel reply = Parcel.obtain();
2147 data.writeInterfaceToken(IActivityManager.descriptor);
2148 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002149 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002150 intent.writeToParcel(data, 0);
2151 data.writeString(resolvedType);
2152 data.writeStrongBinder(resultTo);
2153 data.writeString(resultWho);
2154 data.writeInt(requestCode);
2155 data.writeInt(startFlags);
2156 data.writeString(profileFile);
2157 if (profileFd != null) {
2158 data.writeInt(1);
2159 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2160 } else {
2161 data.writeInt(0);
2162 }
2163 if (options != null) {
2164 data.writeInt(1);
2165 options.writeToParcel(data, 0);
2166 } else {
2167 data.writeInt(0);
2168 }
2169 data.writeInt(userId);
2170 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2171 reply.readException();
2172 int result = reply.readInt();
2173 reply.recycle();
2174 data.recycle();
2175 return result;
2176 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002177 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2178 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002179 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002180 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002181 Parcel data = Parcel.obtain();
2182 Parcel reply = Parcel.obtain();
2183 data.writeInterfaceToken(IActivityManager.descriptor);
2184 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002185 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002186 intent.writeToParcel(data, 0);
2187 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002188 data.writeStrongBinder(resultTo);
2189 data.writeString(resultWho);
2190 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002191 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002192 data.writeString(profileFile);
2193 if (profileFd != null) {
2194 data.writeInt(1);
2195 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2196 } else {
2197 data.writeInt(0);
2198 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002199 if (options != null) {
2200 data.writeInt(1);
2201 options.writeToParcel(data, 0);
2202 } else {
2203 data.writeInt(0);
2204 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002205 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002206 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2207 reply.readException();
2208 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2209 reply.recycle();
2210 data.recycle();
2211 return result;
2212 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002213 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2214 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002215 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002216 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002217 Parcel data = Parcel.obtain();
2218 Parcel reply = Parcel.obtain();
2219 data.writeInterfaceToken(IActivityManager.descriptor);
2220 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002221 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002222 intent.writeToParcel(data, 0);
2223 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002224 data.writeStrongBinder(resultTo);
2225 data.writeString(resultWho);
2226 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002227 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002228 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002229 if (options != null) {
2230 data.writeInt(1);
2231 options.writeToParcel(data, 0);
2232 } else {
2233 data.writeInt(0);
2234 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002235 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002236 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2237 reply.readException();
2238 int result = reply.readInt();
2239 reply.recycle();
2240 data.recycle();
2241 return result;
2242 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002243 public int startActivityIntentSender(IApplicationThread caller,
2244 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002245 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002246 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002247 Parcel data = Parcel.obtain();
2248 Parcel reply = Parcel.obtain();
2249 data.writeInterfaceToken(IActivityManager.descriptor);
2250 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2251 intent.writeToParcel(data, 0);
2252 if (fillInIntent != null) {
2253 data.writeInt(1);
2254 fillInIntent.writeToParcel(data, 0);
2255 } else {
2256 data.writeInt(0);
2257 }
2258 data.writeString(resolvedType);
2259 data.writeStrongBinder(resultTo);
2260 data.writeString(resultWho);
2261 data.writeInt(requestCode);
2262 data.writeInt(flagsMask);
2263 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002264 if (options != null) {
2265 data.writeInt(1);
2266 options.writeToParcel(data, 0);
2267 } else {
2268 data.writeInt(0);
2269 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002270 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002271 reply.readException();
2272 int result = reply.readInt();
2273 reply.recycle();
2274 data.recycle();
2275 return result;
2276 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002277 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002278 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002279 Parcel data = Parcel.obtain();
2280 Parcel reply = Parcel.obtain();
2281 data.writeInterfaceToken(IActivityManager.descriptor);
2282 data.writeStrongBinder(callingActivity);
2283 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002284 if (options != null) {
2285 data.writeInt(1);
2286 options.writeToParcel(data, 0);
2287 } else {
2288 data.writeInt(0);
2289 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2291 reply.readException();
2292 int result = reply.readInt();
2293 reply.recycle();
2294 data.recycle();
2295 return result != 0;
2296 }
2297 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2298 throws RemoteException {
2299 Parcel data = Parcel.obtain();
2300 Parcel reply = Parcel.obtain();
2301 data.writeInterfaceToken(IActivityManager.descriptor);
2302 data.writeStrongBinder(token);
2303 data.writeInt(resultCode);
2304 if (resultData != null) {
2305 data.writeInt(1);
2306 resultData.writeToParcel(data, 0);
2307 } else {
2308 data.writeInt(0);
2309 }
2310 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2311 reply.readException();
2312 boolean res = reply.readInt() != 0;
2313 data.recycle();
2314 reply.recycle();
2315 return res;
2316 }
2317 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2318 {
2319 Parcel data = Parcel.obtain();
2320 Parcel reply = Parcel.obtain();
2321 data.writeInterfaceToken(IActivityManager.descriptor);
2322 data.writeStrongBinder(token);
2323 data.writeString(resultWho);
2324 data.writeInt(requestCode);
2325 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2326 reply.readException();
2327 data.recycle();
2328 reply.recycle();
2329 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002330 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2331 Parcel data = Parcel.obtain();
2332 Parcel reply = Parcel.obtain();
2333 data.writeInterfaceToken(IActivityManager.descriptor);
2334 data.writeStrongBinder(token);
2335 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2336 reply.readException();
2337 boolean res = reply.readInt() != 0;
2338 data.recycle();
2339 reply.recycle();
2340 return res;
2341 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002342 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2343 Parcel data = Parcel.obtain();
2344 Parcel reply = Parcel.obtain();
2345 data.writeInterfaceToken(IActivityManager.descriptor);
2346 data.writeStrongBinder(token);
2347 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2348 reply.readException();
2349 boolean res = reply.readInt() != 0;
2350 data.recycle();
2351 reply.recycle();
2352 return res;
2353 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002354 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002355 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002356 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002357 {
2358 Parcel data = Parcel.obtain();
2359 Parcel reply = Parcel.obtain();
2360 data.writeInterfaceToken(IActivityManager.descriptor);
2361 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002362 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002363 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2364 filter.writeToParcel(data, 0);
2365 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002366 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002367 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2368 reply.readException();
2369 Intent intent = null;
2370 int haveIntent = reply.readInt();
2371 if (haveIntent != 0) {
2372 intent = Intent.CREATOR.createFromParcel(reply);
2373 }
2374 reply.recycle();
2375 data.recycle();
2376 return intent;
2377 }
2378 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2379 {
2380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeStrongBinder(receiver.asBinder());
2384 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2385 reply.readException();
2386 data.recycle();
2387 reply.recycle();
2388 }
2389 public int broadcastIntent(IApplicationThread caller,
2390 Intent intent, String resolvedType, IIntentReceiver resultTo,
2391 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002392 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002393 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002394 {
2395 Parcel data = Parcel.obtain();
2396 Parcel reply = Parcel.obtain();
2397 data.writeInterfaceToken(IActivityManager.descriptor);
2398 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2399 intent.writeToParcel(data, 0);
2400 data.writeString(resolvedType);
2401 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2402 data.writeInt(resultCode);
2403 data.writeString(resultData);
2404 data.writeBundle(map);
2405 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002406 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002407 data.writeInt(serialized ? 1 : 0);
2408 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002409 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002410 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2411 reply.readException();
2412 int res = reply.readInt();
2413 reply.recycle();
2414 data.recycle();
2415 return res;
2416 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002417 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2418 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002419 {
2420 Parcel data = Parcel.obtain();
2421 Parcel reply = Parcel.obtain();
2422 data.writeInterfaceToken(IActivityManager.descriptor);
2423 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2424 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002425 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002426 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2427 reply.readException();
2428 data.recycle();
2429 reply.recycle();
2430 }
2431 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2432 {
2433 Parcel data = Parcel.obtain();
2434 Parcel reply = Parcel.obtain();
2435 data.writeInterfaceToken(IActivityManager.descriptor);
2436 data.writeStrongBinder(who);
2437 data.writeInt(resultCode);
2438 data.writeString(resultData);
2439 data.writeBundle(map);
2440 data.writeInt(abortBroadcast ? 1 : 0);
2441 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2442 reply.readException();
2443 data.recycle();
2444 reply.recycle();
2445 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002446 public void attachApplication(IApplicationThread app) throws RemoteException
2447 {
2448 Parcel data = Parcel.obtain();
2449 Parcel reply = Parcel.obtain();
2450 data.writeInterfaceToken(IActivityManager.descriptor);
2451 data.writeStrongBinder(app.asBinder());
2452 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2453 reply.readException();
2454 data.recycle();
2455 reply.recycle();
2456 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002457 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2458 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002459 {
2460 Parcel data = Parcel.obtain();
2461 Parcel reply = Parcel.obtain();
2462 data.writeInterfaceToken(IActivityManager.descriptor);
2463 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002464 if (config != null) {
2465 data.writeInt(1);
2466 config.writeToParcel(data, 0);
2467 } else {
2468 data.writeInt(0);
2469 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002470 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002471 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2472 reply.readException();
2473 data.recycle();
2474 reply.recycle();
2475 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002476 public void activityResumed(IBinder token) throws RemoteException
2477 {
2478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 data.writeStrongBinder(token);
2482 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2483 reply.readException();
2484 data.recycle();
2485 reply.recycle();
2486 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002487 public void activityPaused(IBinder token) throws RemoteException
2488 {
2489 Parcel data = Parcel.obtain();
2490 Parcel reply = Parcel.obtain();
2491 data.writeInterfaceToken(IActivityManager.descriptor);
2492 data.writeStrongBinder(token);
2493 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2494 reply.readException();
2495 data.recycle();
2496 reply.recycle();
2497 }
2498 public void activityStopped(IBinder token, Bundle state,
2499 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002500 {
2501 Parcel data = Parcel.obtain();
2502 Parcel reply = Parcel.obtain();
2503 data.writeInterfaceToken(IActivityManager.descriptor);
2504 data.writeStrongBinder(token);
2505 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002506 if (thumbnail != null) {
2507 data.writeInt(1);
2508 thumbnail.writeToParcel(data, 0);
2509 } else {
2510 data.writeInt(0);
2511 }
2512 TextUtils.writeToParcel(description, data, 0);
2513 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2514 reply.readException();
2515 data.recycle();
2516 reply.recycle();
2517 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002518 public void activitySlept(IBinder token) throws RemoteException
2519 {
2520 Parcel data = Parcel.obtain();
2521 Parcel reply = Parcel.obtain();
2522 data.writeInterfaceToken(IActivityManager.descriptor);
2523 data.writeStrongBinder(token);
2524 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2525 reply.readException();
2526 data.recycle();
2527 reply.recycle();
2528 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002529 public void activityDestroyed(IBinder token) throws RemoteException
2530 {
2531 Parcel data = Parcel.obtain();
2532 Parcel reply = Parcel.obtain();
2533 data.writeInterfaceToken(IActivityManager.descriptor);
2534 data.writeStrongBinder(token);
2535 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2536 reply.readException();
2537 data.recycle();
2538 reply.recycle();
2539 }
2540 public String getCallingPackage(IBinder token) throws RemoteException
2541 {
2542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeStrongBinder(token);
2546 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2547 reply.readException();
2548 String res = reply.readString();
2549 data.recycle();
2550 reply.recycle();
2551 return res;
2552 }
2553 public ComponentName getCallingActivity(IBinder token)
2554 throws RemoteException {
2555 Parcel data = Parcel.obtain();
2556 Parcel reply = Parcel.obtain();
2557 data.writeInterfaceToken(IActivityManager.descriptor);
2558 data.writeStrongBinder(token);
2559 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2560 reply.readException();
2561 ComponentName res = ComponentName.readFromParcel(reply);
2562 data.recycle();
2563 reply.recycle();
2564 return res;
2565 }
2566 public List getTasks(int maxNum, int flags,
2567 IThumbnailReceiver receiver) throws RemoteException {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 data.writeInt(maxNum);
2572 data.writeInt(flags);
2573 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2574 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2575 reply.readException();
2576 ArrayList list = null;
2577 int N = reply.readInt();
2578 if (N >= 0) {
2579 list = new ArrayList();
2580 while (N > 0) {
2581 ActivityManager.RunningTaskInfo info =
2582 ActivityManager.RunningTaskInfo.CREATOR
2583 .createFromParcel(reply);
2584 list.add(info);
2585 N--;
2586 }
2587 }
2588 data.recycle();
2589 reply.recycle();
2590 return list;
2591 }
2592 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002593 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 Parcel data = Parcel.obtain();
2595 Parcel reply = Parcel.obtain();
2596 data.writeInterfaceToken(IActivityManager.descriptor);
2597 data.writeInt(maxNum);
2598 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002599 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002600 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2601 reply.readException();
2602 ArrayList<ActivityManager.RecentTaskInfo> list
2603 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2604 data.recycle();
2605 reply.recycle();
2606 return list;
2607 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002608 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002609 Parcel data = Parcel.obtain();
2610 Parcel reply = Parcel.obtain();
2611 data.writeInterfaceToken(IActivityManager.descriptor);
2612 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002613 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002614 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002615 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002616 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002617 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002618 }
2619 data.recycle();
2620 reply.recycle();
2621 return bm;
2622 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002623 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2624 Parcel data = Parcel.obtain();
2625 Parcel reply = Parcel.obtain();
2626 data.writeInterfaceToken(IActivityManager.descriptor);
2627 data.writeInt(id);
2628 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2629 reply.readException();
2630 Bitmap bm = null;
2631 if (reply.readInt() != 0) {
2632 bm = Bitmap.CREATOR.createFromParcel(reply);
2633 }
2634 data.recycle();
2635 reply.recycle();
2636 return bm;
2637 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002638 public List getServices(int maxNum, int flags) throws RemoteException {
2639 Parcel data = Parcel.obtain();
2640 Parcel reply = Parcel.obtain();
2641 data.writeInterfaceToken(IActivityManager.descriptor);
2642 data.writeInt(maxNum);
2643 data.writeInt(flags);
2644 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2645 reply.readException();
2646 ArrayList list = null;
2647 int N = reply.readInt();
2648 if (N >= 0) {
2649 list = new ArrayList();
2650 while (N > 0) {
2651 ActivityManager.RunningServiceInfo info =
2652 ActivityManager.RunningServiceInfo.CREATOR
2653 .createFromParcel(reply);
2654 list.add(info);
2655 N--;
2656 }
2657 }
2658 data.recycle();
2659 reply.recycle();
2660 return list;
2661 }
2662 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2663 throws RemoteException {
2664 Parcel data = Parcel.obtain();
2665 Parcel reply = Parcel.obtain();
2666 data.writeInterfaceToken(IActivityManager.descriptor);
2667 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2668 reply.readException();
2669 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2670 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2671 data.recycle();
2672 reply.recycle();
2673 return list;
2674 }
2675 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2676 throws RemoteException {
2677 Parcel data = Parcel.obtain();
2678 Parcel reply = Parcel.obtain();
2679 data.writeInterfaceToken(IActivityManager.descriptor);
2680 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2681 reply.readException();
2682 ArrayList<ActivityManager.RunningAppProcessInfo> list
2683 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2684 data.recycle();
2685 reply.recycle();
2686 return list;
2687 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002688 public List<ApplicationInfo> getRunningExternalApplications()
2689 throws RemoteException {
2690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2694 reply.readException();
2695 ArrayList<ApplicationInfo> list
2696 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2697 data.recycle();
2698 reply.recycle();
2699 return list;
2700 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002701 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002702 {
2703 Parcel data = Parcel.obtain();
2704 Parcel reply = Parcel.obtain();
2705 data.writeInterfaceToken(IActivityManager.descriptor);
2706 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002707 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002708 if (options != null) {
2709 data.writeInt(1);
2710 options.writeToParcel(data, 0);
2711 } else {
2712 data.writeInt(0);
2713 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002714 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2715 reply.readException();
2716 data.recycle();
2717 reply.recycle();
2718 }
2719 public void moveTaskToBack(int task) throws RemoteException
2720 {
2721 Parcel data = Parcel.obtain();
2722 Parcel reply = Parcel.obtain();
2723 data.writeInterfaceToken(IActivityManager.descriptor);
2724 data.writeInt(task);
2725 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2726 reply.readException();
2727 data.recycle();
2728 reply.recycle();
2729 }
2730 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2731 throws RemoteException {
2732 Parcel data = Parcel.obtain();
2733 Parcel reply = Parcel.obtain();
2734 data.writeInterfaceToken(IActivityManager.descriptor);
2735 data.writeStrongBinder(token);
2736 data.writeInt(nonRoot ? 1 : 0);
2737 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2738 reply.readException();
2739 boolean res = reply.readInt() != 0;
2740 data.recycle();
2741 reply.recycle();
2742 return res;
2743 }
2744 public void moveTaskBackwards(int task) throws RemoteException
2745 {
2746 Parcel data = Parcel.obtain();
2747 Parcel reply = Parcel.obtain();
2748 data.writeInterfaceToken(IActivityManager.descriptor);
2749 data.writeInt(task);
2750 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2751 reply.readException();
2752 data.recycle();
2753 reply.recycle();
2754 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002755 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002756 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2757 {
2758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002760 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002761 data.writeInt(taskId);
2762 data.writeInt(stackId);
2763 data.writeInt(toTop ? 1 : 0);
2764 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2765 reply.readException();
2766 data.recycle();
2767 reply.recycle();
2768 }
2769 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002770 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002771 {
2772 Parcel data = Parcel.obtain();
2773 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002774 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002775 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002776 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002777 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002778 reply.readException();
2779 data.recycle();
2780 reply.recycle();
2781 }
Craig Mautner967212c2013-04-13 21:10:58 -07002782 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002783 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002784 {
2785 Parcel data = Parcel.obtain();
2786 Parcel reply = Parcel.obtain();
2787 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002788 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002789 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002790 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002791 data.recycle();
2792 reply.recycle();
2793 return list;
2794 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002795 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002796 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002797 {
2798 Parcel data = Parcel.obtain();
2799 Parcel reply = Parcel.obtain();
2800 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002801 data.writeInt(stackId);
2802 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002803 reply.readException();
2804 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002805 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002806 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002807 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002808 }
2809 data.recycle();
2810 reply.recycle();
2811 return info;
2812 }
2813 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002814 public void setFocusedStack(int stackId) throws RemoteException
2815 {
2816 Parcel data = Parcel.obtain();
2817 Parcel reply = Parcel.obtain();
2818 data.writeInterfaceToken(IActivityManager.descriptor);
2819 data.writeInt(stackId);
2820 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2821 reply.readException();
2822 data.recycle();
2823 reply.recycle();
2824 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002825 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2826 {
2827 Parcel data = Parcel.obtain();
2828 Parcel reply = Parcel.obtain();
2829 data.writeInterfaceToken(IActivityManager.descriptor);
2830 data.writeStrongBinder(token);
2831 data.writeInt(onlyRoot ? 1 : 0);
2832 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2833 reply.readException();
2834 int res = reply.readInt();
2835 data.recycle();
2836 reply.recycle();
2837 return res;
2838 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002839 public void reportThumbnail(IBinder token,
2840 Bitmap thumbnail, CharSequence description) throws RemoteException
2841 {
2842 Parcel data = Parcel.obtain();
2843 Parcel reply = Parcel.obtain();
2844 data.writeInterfaceToken(IActivityManager.descriptor);
2845 data.writeStrongBinder(token);
2846 if (thumbnail != null) {
2847 data.writeInt(1);
2848 thumbnail.writeToParcel(data, 0);
2849 } else {
2850 data.writeInt(0);
2851 }
2852 TextUtils.writeToParcel(description, data, 0);
2853 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
2858 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002859 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2864 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002865 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002866 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002867 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2868 reply.readException();
2869 int res = reply.readInt();
2870 ContentProviderHolder cph = null;
2871 if (res != 0) {
2872 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2873 }
2874 data.recycle();
2875 reply.recycle();
2876 return cph;
2877 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002878 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2879 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002880 Parcel data = Parcel.obtain();
2881 Parcel reply = Parcel.obtain();
2882 data.writeInterfaceToken(IActivityManager.descriptor);
2883 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002884 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002885 data.writeStrongBinder(token);
2886 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2887 reply.readException();
2888 int res = reply.readInt();
2889 ContentProviderHolder cph = null;
2890 if (res != 0) {
2891 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2892 }
2893 data.recycle();
2894 reply.recycle();
2895 return cph;
2896 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002897 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002898 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002899 {
2900 Parcel data = Parcel.obtain();
2901 Parcel reply = Parcel.obtain();
2902 data.writeInterfaceToken(IActivityManager.descriptor);
2903 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2904 data.writeTypedList(providers);
2905 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
2906 reply.readException();
2907 data.recycle();
2908 reply.recycle();
2909 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002910 public boolean refContentProvider(IBinder connection, int stable, int unstable)
2911 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 Parcel data = Parcel.obtain();
2913 Parcel reply = Parcel.obtain();
2914 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002915 data.writeStrongBinder(connection);
2916 data.writeInt(stable);
2917 data.writeInt(unstable);
2918 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2919 reply.readException();
2920 boolean res = reply.readInt() != 0;
2921 data.recycle();
2922 reply.recycle();
2923 return res;
2924 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002925
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002926 public void unstableProviderDied(IBinder connection) throws RemoteException {
2927 Parcel data = Parcel.obtain();
2928 Parcel reply = Parcel.obtain();
2929 data.writeInterfaceToken(IActivityManager.descriptor);
2930 data.writeStrongBinder(connection);
2931 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
2932 reply.readException();
2933 data.recycle();
2934 reply.recycle();
2935 }
2936
Jeff Sharkey7aa76012013-09-30 14:26:27 -07002937 @Override
2938 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
2939 Parcel data = Parcel.obtain();
2940 Parcel reply = Parcel.obtain();
2941 data.writeInterfaceToken(IActivityManager.descriptor);
2942 data.writeStrongBinder(connection);
2943 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
2944 reply.readException();
2945 data.recycle();
2946 reply.recycle();
2947 }
2948
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002949 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
2950 Parcel data = Parcel.obtain();
2951 Parcel reply = Parcel.obtain();
2952 data.writeInterfaceToken(IActivityManager.descriptor);
2953 data.writeStrongBinder(connection);
2954 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002955 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2956 reply.readException();
2957 data.recycle();
2958 reply.recycle();
2959 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002960
2961 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
2962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
2964 data.writeInterfaceToken(IActivityManager.descriptor);
2965 data.writeString(name);
2966 data.writeStrongBinder(token);
2967 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2968 reply.readException();
2969 data.recycle();
2970 reply.recycle();
2971 }
2972
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07002973 public PendingIntent getRunningServiceControlPanel(ComponentName service)
2974 throws RemoteException
2975 {
2976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 service.writeToParcel(data, 0);
2980 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
2983 data.recycle();
2984 reply.recycle();
2985 return res;
2986 }
2987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002988 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002989 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002990 {
2991 Parcel data = Parcel.obtain();
2992 Parcel reply = Parcel.obtain();
2993 data.writeInterfaceToken(IActivityManager.descriptor);
2994 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2995 service.writeToParcel(data, 0);
2996 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07002997 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002998 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
2999 reply.readException();
3000 ComponentName res = ComponentName.readFromParcel(reply);
3001 data.recycle();
3002 reply.recycle();
3003 return res;
3004 }
3005 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003006 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003007 {
3008 Parcel data = Parcel.obtain();
3009 Parcel reply = Parcel.obtain();
3010 data.writeInterfaceToken(IActivityManager.descriptor);
3011 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3012 service.writeToParcel(data, 0);
3013 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003014 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003015 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3016 reply.readException();
3017 int res = reply.readInt();
3018 reply.recycle();
3019 data.recycle();
3020 return res;
3021 }
3022 public boolean stopServiceToken(ComponentName className, IBinder token,
3023 int startId) throws RemoteException {
3024 Parcel data = Parcel.obtain();
3025 Parcel reply = Parcel.obtain();
3026 data.writeInterfaceToken(IActivityManager.descriptor);
3027 ComponentName.writeToParcel(className, data);
3028 data.writeStrongBinder(token);
3029 data.writeInt(startId);
3030 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3031 reply.readException();
3032 boolean res = reply.readInt() != 0;
3033 data.recycle();
3034 reply.recycle();
3035 return res;
3036 }
3037 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003038 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003039 Parcel data = Parcel.obtain();
3040 Parcel reply = Parcel.obtain();
3041 data.writeInterfaceToken(IActivityManager.descriptor);
3042 ComponentName.writeToParcel(className, data);
3043 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003044 data.writeInt(id);
3045 if (notification != null) {
3046 data.writeInt(1);
3047 notification.writeToParcel(data, 0);
3048 } else {
3049 data.writeInt(0);
3050 }
3051 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003052 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3053 reply.readException();
3054 data.recycle();
3055 reply.recycle();
3056 }
3057 public int bindService(IApplicationThread caller, IBinder token,
3058 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003059 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003060 Parcel data = Parcel.obtain();
3061 Parcel reply = Parcel.obtain();
3062 data.writeInterfaceToken(IActivityManager.descriptor);
3063 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3064 data.writeStrongBinder(token);
3065 service.writeToParcel(data, 0);
3066 data.writeString(resolvedType);
3067 data.writeStrongBinder(connection.asBinder());
3068 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003069 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003070 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3071 reply.readException();
3072 int res = reply.readInt();
3073 data.recycle();
3074 reply.recycle();
3075 return res;
3076 }
3077 public boolean unbindService(IServiceConnection connection) throws RemoteException
3078 {
3079 Parcel data = Parcel.obtain();
3080 Parcel reply = Parcel.obtain();
3081 data.writeInterfaceToken(IActivityManager.descriptor);
3082 data.writeStrongBinder(connection.asBinder());
3083 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3084 reply.readException();
3085 boolean res = reply.readInt() != 0;
3086 data.recycle();
3087 reply.recycle();
3088 return res;
3089 }
3090
3091 public void publishService(IBinder token,
3092 Intent intent, IBinder service) throws RemoteException {
3093 Parcel data = Parcel.obtain();
3094 Parcel reply = Parcel.obtain();
3095 data.writeInterfaceToken(IActivityManager.descriptor);
3096 data.writeStrongBinder(token);
3097 intent.writeToParcel(data, 0);
3098 data.writeStrongBinder(service);
3099 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3100 reply.readException();
3101 data.recycle();
3102 reply.recycle();
3103 }
3104
3105 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3106 throws RemoteException {
3107 Parcel data = Parcel.obtain();
3108 Parcel reply = Parcel.obtain();
3109 data.writeInterfaceToken(IActivityManager.descriptor);
3110 data.writeStrongBinder(token);
3111 intent.writeToParcel(data, 0);
3112 data.writeInt(doRebind ? 1 : 0);
3113 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3114 reply.readException();
3115 data.recycle();
3116 reply.recycle();
3117 }
3118
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003119 public void serviceDoneExecuting(IBinder token, int type, int startId,
3120 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003121 Parcel data = Parcel.obtain();
3122 Parcel reply = Parcel.obtain();
3123 data.writeInterfaceToken(IActivityManager.descriptor);
3124 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003125 data.writeInt(type);
3126 data.writeInt(startId);
3127 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3129 reply.readException();
3130 data.recycle();
3131 reply.recycle();
3132 }
3133
3134 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3135 Parcel data = Parcel.obtain();
3136 Parcel reply = Parcel.obtain();
3137 data.writeInterfaceToken(IActivityManager.descriptor);
3138 service.writeToParcel(data, 0);
3139 data.writeString(resolvedType);
3140 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3141 reply.readException();
3142 IBinder binder = reply.readStrongBinder();
3143 reply.recycle();
3144 data.recycle();
3145 return binder;
3146 }
3147
Christopher Tate181fafa2009-05-14 11:12:14 -07003148 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3149 throws RemoteException {
3150 Parcel data = Parcel.obtain();
3151 Parcel reply = Parcel.obtain();
3152 data.writeInterfaceToken(IActivityManager.descriptor);
3153 app.writeToParcel(data, 0);
3154 data.writeInt(backupRestoreMode);
3155 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3156 reply.readException();
3157 boolean success = reply.readInt() != 0;
3158 reply.recycle();
3159 data.recycle();
3160 return success;
3161 }
3162
Christopher Tate346acb12012-10-15 19:20:25 -07003163 public void clearPendingBackup() throws RemoteException {
3164 Parcel data = Parcel.obtain();
3165 Parcel reply = Parcel.obtain();
3166 data.writeInterfaceToken(IActivityManager.descriptor);
3167 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3168 reply.recycle();
3169 data.recycle();
3170 }
3171
Christopher Tate181fafa2009-05-14 11:12:14 -07003172 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeString(packageName);
3177 data.writeStrongBinder(agent);
3178 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3179 reply.recycle();
3180 data.recycle();
3181 }
3182
3183 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3184 Parcel data = Parcel.obtain();
3185 Parcel reply = Parcel.obtain();
3186 data.writeInterfaceToken(IActivityManager.descriptor);
3187 app.writeToParcel(data, 0);
3188 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3189 reply.readException();
3190 reply.recycle();
3191 data.recycle();
3192 }
3193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003194 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003195 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3196 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003197 Parcel data = Parcel.obtain();
3198 Parcel reply = Parcel.obtain();
3199 data.writeInterfaceToken(IActivityManager.descriptor);
3200 ComponentName.writeToParcel(className, data);
3201 data.writeString(profileFile);
3202 data.writeInt(flags);
3203 data.writeBundle(arguments);
3204 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003205 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003206 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003207 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 boolean res = reply.readInt() != 0;
3210 reply.recycle();
3211 data.recycle();
3212 return res;
3213 }
3214
3215 public void finishInstrumentation(IApplicationThread target,
3216 int resultCode, Bundle results) throws RemoteException {
3217 Parcel data = Parcel.obtain();
3218 Parcel reply = Parcel.obtain();
3219 data.writeInterfaceToken(IActivityManager.descriptor);
3220 data.writeStrongBinder(target != null ? target.asBinder() : null);
3221 data.writeInt(resultCode);
3222 data.writeBundle(results);
3223 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3224 reply.readException();
3225 data.recycle();
3226 reply.recycle();
3227 }
3228 public Configuration getConfiguration() throws RemoteException
3229 {
3230 Parcel data = Parcel.obtain();
3231 Parcel reply = Parcel.obtain();
3232 data.writeInterfaceToken(IActivityManager.descriptor);
3233 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3234 reply.readException();
3235 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3236 reply.recycle();
3237 data.recycle();
3238 return res;
3239 }
3240 public void updateConfiguration(Configuration values) throws RemoteException
3241 {
3242 Parcel data = Parcel.obtain();
3243 Parcel reply = Parcel.obtain();
3244 data.writeInterfaceToken(IActivityManager.descriptor);
3245 values.writeToParcel(data, 0);
3246 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3247 reply.readException();
3248 data.recycle();
3249 reply.recycle();
3250 }
3251 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3252 throws RemoteException {
3253 Parcel data = Parcel.obtain();
3254 Parcel reply = Parcel.obtain();
3255 data.writeInterfaceToken(IActivityManager.descriptor);
3256 data.writeStrongBinder(token);
3257 data.writeInt(requestedOrientation);
3258 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3259 reply.readException();
3260 data.recycle();
3261 reply.recycle();
3262 }
3263 public int getRequestedOrientation(IBinder token) throws RemoteException {
3264 Parcel data = Parcel.obtain();
3265 Parcel reply = Parcel.obtain();
3266 data.writeInterfaceToken(IActivityManager.descriptor);
3267 data.writeStrongBinder(token);
3268 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3269 reply.readException();
3270 int res = reply.readInt();
3271 data.recycle();
3272 reply.recycle();
3273 return res;
3274 }
3275 public ComponentName getActivityClassForToken(IBinder token)
3276 throws RemoteException {
3277 Parcel data = Parcel.obtain();
3278 Parcel reply = Parcel.obtain();
3279 data.writeInterfaceToken(IActivityManager.descriptor);
3280 data.writeStrongBinder(token);
3281 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3282 reply.readException();
3283 ComponentName res = ComponentName.readFromParcel(reply);
3284 data.recycle();
3285 reply.recycle();
3286 return res;
3287 }
3288 public String getPackageForToken(IBinder token) throws RemoteException
3289 {
3290 Parcel data = Parcel.obtain();
3291 Parcel reply = Parcel.obtain();
3292 data.writeInterfaceToken(IActivityManager.descriptor);
3293 data.writeStrongBinder(token);
3294 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3295 reply.readException();
3296 String res = reply.readString();
3297 data.recycle();
3298 reply.recycle();
3299 return res;
3300 }
3301 public IIntentSender getIntentSender(int type,
3302 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003303 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003304 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 data.writeInt(type);
3309 data.writeString(packageName);
3310 data.writeStrongBinder(token);
3311 data.writeString(resultWho);
3312 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003313 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003314 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003315 data.writeTypedArray(intents, 0);
3316 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003317 } else {
3318 data.writeInt(0);
3319 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003321 if (options != null) {
3322 data.writeInt(1);
3323 options.writeToParcel(data, 0);
3324 } else {
3325 data.writeInt(0);
3326 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003327 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003328 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3329 reply.readException();
3330 IIntentSender res = IIntentSender.Stub.asInterface(
3331 reply.readStrongBinder());
3332 data.recycle();
3333 reply.recycle();
3334 return res;
3335 }
3336 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3337 Parcel data = Parcel.obtain();
3338 Parcel reply = Parcel.obtain();
3339 data.writeInterfaceToken(IActivityManager.descriptor);
3340 data.writeStrongBinder(sender.asBinder());
3341 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3342 reply.readException();
3343 data.recycle();
3344 reply.recycle();
3345 }
3346 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 data.writeStrongBinder(sender.asBinder());
3351 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3352 reply.readException();
3353 String res = reply.readString();
3354 data.recycle();
3355 reply.recycle();
3356 return res;
3357 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003358 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3359 Parcel data = Parcel.obtain();
3360 Parcel reply = Parcel.obtain();
3361 data.writeInterfaceToken(IActivityManager.descriptor);
3362 data.writeStrongBinder(sender.asBinder());
3363 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3364 reply.readException();
3365 int res = reply.readInt();
3366 data.recycle();
3367 reply.recycle();
3368 return res;
3369 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003370 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3371 boolean requireFull, String name, String callerPackage) throws RemoteException {
3372 Parcel data = Parcel.obtain();
3373 Parcel reply = Parcel.obtain();
3374 data.writeInterfaceToken(IActivityManager.descriptor);
3375 data.writeInt(callingPid);
3376 data.writeInt(callingUid);
3377 data.writeInt(userId);
3378 data.writeInt(allowAll ? 1 : 0);
3379 data.writeInt(requireFull ? 1 : 0);
3380 data.writeString(name);
3381 data.writeString(callerPackage);
3382 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 int res = reply.readInt();
3385 data.recycle();
3386 reply.recycle();
3387 return res;
3388 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003389 public void setProcessLimit(int max) throws RemoteException
3390 {
3391 Parcel data = Parcel.obtain();
3392 Parcel reply = Parcel.obtain();
3393 data.writeInterfaceToken(IActivityManager.descriptor);
3394 data.writeInt(max);
3395 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3396 reply.readException();
3397 data.recycle();
3398 reply.recycle();
3399 }
3400 public int getProcessLimit() throws RemoteException
3401 {
3402 Parcel data = Parcel.obtain();
3403 Parcel reply = Parcel.obtain();
3404 data.writeInterfaceToken(IActivityManager.descriptor);
3405 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3406 reply.readException();
3407 int res = reply.readInt();
3408 data.recycle();
3409 reply.recycle();
3410 return res;
3411 }
3412 public void setProcessForeground(IBinder token, int pid,
3413 boolean isForeground) throws RemoteException {
3414 Parcel data = Parcel.obtain();
3415 Parcel reply = Parcel.obtain();
3416 data.writeInterfaceToken(IActivityManager.descriptor);
3417 data.writeStrongBinder(token);
3418 data.writeInt(pid);
3419 data.writeInt(isForeground ? 1 : 0);
3420 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3421 reply.readException();
3422 data.recycle();
3423 reply.recycle();
3424 }
3425 public int checkPermission(String permission, int pid, int uid)
3426 throws RemoteException {
3427 Parcel data = Parcel.obtain();
3428 Parcel reply = Parcel.obtain();
3429 data.writeInterfaceToken(IActivityManager.descriptor);
3430 data.writeString(permission);
3431 data.writeInt(pid);
3432 data.writeInt(uid);
3433 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 int res = reply.readInt();
3436 data.recycle();
3437 reply.recycle();
3438 return res;
3439 }
3440 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003441 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003442 Parcel data = Parcel.obtain();
3443 Parcel reply = Parcel.obtain();
3444 data.writeInterfaceToken(IActivityManager.descriptor);
3445 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003446 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003447 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003448 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3449 reply.readException();
3450 boolean res = reply.readInt() != 0;
3451 data.recycle();
3452 reply.recycle();
3453 return res;
3454 }
3455 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3456 throws RemoteException {
3457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 uri.writeToParcel(data, 0);
3461 data.writeInt(pid);
3462 data.writeInt(uid);
3463 data.writeInt(mode);
3464 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3465 reply.readException();
3466 int res = reply.readInt();
3467 data.recycle();
3468 reply.recycle();
3469 return res;
3470 }
3471 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3472 Uri uri, int mode) throws RemoteException {
3473 Parcel data = Parcel.obtain();
3474 Parcel reply = Parcel.obtain();
3475 data.writeInterfaceToken(IActivityManager.descriptor);
3476 data.writeStrongBinder(caller.asBinder());
3477 data.writeString(targetPkg);
3478 uri.writeToParcel(data, 0);
3479 data.writeInt(mode);
3480 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 data.recycle();
3483 reply.recycle();
3484 }
3485 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3486 int mode) throws RemoteException {
3487 Parcel data = Parcel.obtain();
3488 Parcel reply = Parcel.obtain();
3489 data.writeInterfaceToken(IActivityManager.descriptor);
3490 data.writeStrongBinder(caller.asBinder());
3491 uri.writeToParcel(data, 0);
3492 data.writeInt(mode);
3493 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 data.recycle();
3496 reply.recycle();
3497 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003498
3499 @Override
3500 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3501 Parcel data = Parcel.obtain();
3502 Parcel reply = Parcel.obtain();
3503 data.writeInterfaceToken(IActivityManager.descriptor);
3504 uri.writeToParcel(data, 0);
3505 data.writeInt(mode);
3506 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 data.recycle();
3509 reply.recycle();
3510 }
3511
3512 @Override
3513 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3514 Parcel data = Parcel.obtain();
3515 Parcel reply = Parcel.obtain();
3516 data.writeInterfaceToken(IActivityManager.descriptor);
3517 uri.writeToParcel(data, 0);
3518 data.writeInt(mode);
3519 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 data.recycle();
3522 reply.recycle();
3523 }
3524
3525 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003526 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3527 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003528 Parcel data = Parcel.obtain();
3529 Parcel reply = Parcel.obtain();
3530 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003531 data.writeString(packageName);
3532 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003533 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3534 reply.readException();
3535 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3536 reply);
3537 data.recycle();
3538 reply.recycle();
3539 return perms;
3540 }
3541
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003542 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3543 throws RemoteException {
3544 Parcel data = Parcel.obtain();
3545 Parcel reply = Parcel.obtain();
3546 data.writeInterfaceToken(IActivityManager.descriptor);
3547 data.writeStrongBinder(who.asBinder());
3548 data.writeInt(waiting ? 1 : 0);
3549 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3550 reply.readException();
3551 data.recycle();
3552 reply.recycle();
3553 }
3554 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3555 Parcel data = Parcel.obtain();
3556 Parcel reply = Parcel.obtain();
3557 data.writeInterfaceToken(IActivityManager.descriptor);
3558 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3559 reply.readException();
3560 outInfo.readFromParcel(reply);
3561 data.recycle();
3562 reply.recycle();
3563 }
3564 public void unhandledBack() throws RemoteException
3565 {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3570 reply.readException();
3571 data.recycle();
3572 reply.recycle();
3573 }
3574 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3575 {
3576 Parcel data = Parcel.obtain();
3577 Parcel reply = Parcel.obtain();
3578 data.writeInterfaceToken(IActivityManager.descriptor);
3579 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3580 reply.readException();
3581 ParcelFileDescriptor pfd = null;
3582 if (reply.readInt() != 0) {
3583 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3584 }
3585 data.recycle();
3586 reply.recycle();
3587 return pfd;
3588 }
3589 public void goingToSleep() throws RemoteException
3590 {
3591 Parcel data = Parcel.obtain();
3592 Parcel reply = Parcel.obtain();
3593 data.writeInterfaceToken(IActivityManager.descriptor);
3594 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3595 reply.readException();
3596 data.recycle();
3597 reply.recycle();
3598 }
3599 public void wakingUp() throws RemoteException
3600 {
3601 Parcel data = Parcel.obtain();
3602 Parcel reply = Parcel.obtain();
3603 data.writeInterfaceToken(IActivityManager.descriptor);
3604 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3605 reply.readException();
3606 data.recycle();
3607 reply.recycle();
3608 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003609 public void setLockScreenShown(boolean shown) throws RemoteException
3610 {
3611 Parcel data = Parcel.obtain();
3612 Parcel reply = Parcel.obtain();
3613 data.writeInterfaceToken(IActivityManager.descriptor);
3614 data.writeInt(shown ? 1 : 0);
3615 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3616 reply.readException();
3617 data.recycle();
3618 reply.recycle();
3619 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003620 public void setDebugApp(
3621 String packageName, boolean waitForDebugger, boolean persistent)
3622 throws RemoteException
3623 {
3624 Parcel data = Parcel.obtain();
3625 Parcel reply = Parcel.obtain();
3626 data.writeInterfaceToken(IActivityManager.descriptor);
3627 data.writeString(packageName);
3628 data.writeInt(waitForDebugger ? 1 : 0);
3629 data.writeInt(persistent ? 1 : 0);
3630 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3631 reply.readException();
3632 data.recycle();
3633 reply.recycle();
3634 }
3635 public void setAlwaysFinish(boolean enabled) throws RemoteException
3636 {
3637 Parcel data = Parcel.obtain();
3638 Parcel reply = Parcel.obtain();
3639 data.writeInterfaceToken(IActivityManager.descriptor);
3640 data.writeInt(enabled ? 1 : 0);
3641 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3642 reply.readException();
3643 data.recycle();
3644 reply.recycle();
3645 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003646 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003647 {
3648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003652 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003653 reply.readException();
3654 data.recycle();
3655 reply.recycle();
3656 }
3657 public void enterSafeMode() throws RemoteException {
3658 Parcel data = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3661 data.recycle();
3662 }
3663 public void noteWakeupAlarm(IIntentSender sender) throws RemoteException {
3664 Parcel data = Parcel.obtain();
3665 data.writeStrongBinder(sender.asBinder());
3666 data.writeInterfaceToken(IActivityManager.descriptor);
3667 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3668 data.recycle();
3669 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003670 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003671 Parcel data = Parcel.obtain();
3672 Parcel reply = Parcel.obtain();
3673 data.writeInterfaceToken(IActivityManager.descriptor);
3674 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003675 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003676 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003677 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003678 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003679 boolean res = reply.readInt() != 0;
3680 data.recycle();
3681 reply.recycle();
3682 return res;
3683 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003684 @Override
3685 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3686 Parcel data = Parcel.obtain();
3687 Parcel reply = Parcel.obtain();
3688 data.writeInterfaceToken(IActivityManager.descriptor);
3689 data.writeString(reason);
3690 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3691 boolean res = reply.readInt() != 0;
3692 data.recycle();
3693 reply.recycle();
3694 return res;
3695 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003696 public void startRunning(String pkg, String cls, String action,
3697 String indata) throws RemoteException {
3698 Parcel data = Parcel.obtain();
3699 Parcel reply = Parcel.obtain();
3700 data.writeInterfaceToken(IActivityManager.descriptor);
3701 data.writeString(pkg);
3702 data.writeString(cls);
3703 data.writeString(action);
3704 data.writeString(indata);
3705 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3706 reply.readException();
3707 data.recycle();
3708 reply.recycle();
3709 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003710 public boolean testIsSystemReady()
3711 {
3712 /* this base class version is never called */
3713 return true;
3714 }
Dan Egnor60d87622009-12-16 16:32:58 -08003715 public void handleApplicationCrash(IBinder app,
3716 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3717 {
3718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeStrongBinder(app);
3722 crashInfo.writeToParcel(data, 0);
3723 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3724 reply.readException();
3725 reply.recycle();
3726 data.recycle();
3727 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003728
Dan Egnor60d87622009-12-16 16:32:58 -08003729 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003730 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731 {
3732 Parcel data = Parcel.obtain();
3733 Parcel reply = Parcel.obtain();
3734 data.writeInterfaceToken(IActivityManager.descriptor);
3735 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003736 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003737 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003738 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003739 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003740 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003741 reply.recycle();
3742 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003743 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003744 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003745
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003746 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003747 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003748 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003749 {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003754 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003755 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003756 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3757 reply.readException();
3758 reply.recycle();
3759 data.recycle();
3760 }
3761
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003762 public void signalPersistentProcesses(int sig) throws RemoteException {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeInt(sig);
3767 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3768 reply.readException();
3769 data.recycle();
3770 reply.recycle();
3771 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003772
Dianne Hackborn1676c852012-09-10 14:52:30 -07003773 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003774 Parcel data = Parcel.obtain();
3775 Parcel reply = Parcel.obtain();
3776 data.writeInterfaceToken(IActivityManager.descriptor);
3777 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003778 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003779 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3780 reply.readException();
3781 data.recycle();
3782 reply.recycle();
3783 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003784
3785 public void killAllBackgroundProcesses() throws RemoteException {
3786 Parcel data = Parcel.obtain();
3787 Parcel reply = Parcel.obtain();
3788 data.writeInterfaceToken(IActivityManager.descriptor);
3789 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3790 reply.readException();
3791 data.recycle();
3792 reply.recycle();
3793 }
3794
Dianne Hackborn1676c852012-09-10 14:52:30 -07003795 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003796 Parcel data = Parcel.obtain();
3797 Parcel reply = Parcel.obtain();
3798 data.writeInterfaceToken(IActivityManager.descriptor);
3799 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003800 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003801 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003802 reply.readException();
3803 data.recycle();
3804 reply.recycle();
3805 }
3806
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003807 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3808 throws RemoteException
3809 {
3810 Parcel data = Parcel.obtain();
3811 Parcel reply = Parcel.obtain();
3812 data.writeInterfaceToken(IActivityManager.descriptor);
3813 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3814 reply.readException();
3815 outInfo.readFromParcel(reply);
3816 reply.recycle();
3817 data.recycle();
3818 }
3819
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003820 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3821 {
3822 Parcel data = Parcel.obtain();
3823 Parcel reply = Parcel.obtain();
3824 data.writeInterfaceToken(IActivityManager.descriptor);
3825 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3826 reply.readException();
3827 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3828 reply.recycle();
3829 data.recycle();
3830 return res;
3831 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003832
Dianne Hackborn1676c852012-09-10 14:52:30 -07003833 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003834 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003835 {
3836 Parcel data = Parcel.obtain();
3837 Parcel reply = Parcel.obtain();
3838 data.writeInterfaceToken(IActivityManager.descriptor);
3839 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003840 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003841 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003842 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003843 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003844 if (fd != null) {
3845 data.writeInt(1);
3846 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3847 } else {
3848 data.writeInt(0);
3849 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003850 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3851 reply.readException();
3852 boolean res = reply.readInt() != 0;
3853 reply.recycle();
3854 data.recycle();
3855 return res;
3856 }
3857
Dianne Hackborn55280a92009-05-07 15:53:46 -07003858 public boolean shutdown(int timeout) throws RemoteException
3859 {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeInt(timeout);
3864 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 boolean res = reply.readInt() != 0;
3867 reply.recycle();
3868 data.recycle();
3869 return res;
3870 }
3871
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003872 public void stopAppSwitches() throws RemoteException {
3873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3877 reply.readException();
3878 reply.recycle();
3879 data.recycle();
3880 }
3881
3882 public void resumeAppSwitches() throws RemoteException {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3887 reply.readException();
3888 reply.recycle();
3889 data.recycle();
3890 }
3891
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003892 public void killApplicationWithAppId(String pkg, int appid, String reason)
3893 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003894 Parcel data = Parcel.obtain();
3895 Parcel reply = Parcel.obtain();
3896 data.writeInterfaceToken(IActivityManager.descriptor);
3897 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003898 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003899 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003900 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003901 reply.readException();
3902 data.recycle();
3903 reply.recycle();
3904 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07003905
3906 public void closeSystemDialogs(String reason) throws RemoteException {
3907 Parcel data = Parcel.obtain();
3908 Parcel reply = Parcel.obtain();
3909 data.writeInterfaceToken(IActivityManager.descriptor);
3910 data.writeString(reason);
3911 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 data.recycle();
3914 reply.recycle();
3915 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003916
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003917 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003918 throws RemoteException {
3919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003922 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003923 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
3924 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003925 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003926 data.recycle();
3927 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07003928 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07003929 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07003930
3931 public void killApplicationProcess(String processName, int uid) throws RemoteException {
3932 Parcel data = Parcel.obtain();
3933 Parcel reply = Parcel.obtain();
3934 data.writeInterfaceToken(IActivityManager.descriptor);
3935 data.writeString(processName);
3936 data.writeInt(uid);
3937 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
3938 reply.readException();
3939 data.recycle();
3940 reply.recycle();
3941 }
3942
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07003943 public void overridePendingTransition(IBinder token, String packageName,
3944 int enterAnim, int exitAnim) throws RemoteException {
3945 Parcel data = Parcel.obtain();
3946 Parcel reply = Parcel.obtain();
3947 data.writeInterfaceToken(IActivityManager.descriptor);
3948 data.writeStrongBinder(token);
3949 data.writeString(packageName);
3950 data.writeInt(enterAnim);
3951 data.writeInt(exitAnim);
3952 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
3953 reply.readException();
3954 data.recycle();
3955 reply.recycle();
3956 }
3957
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08003958 public boolean isUserAMonkey() throws RemoteException {
3959 Parcel data = Parcel.obtain();
3960 Parcel reply = Parcel.obtain();
3961 data.writeInterfaceToken(IActivityManager.descriptor);
3962 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
3963 reply.readException();
3964 boolean res = reply.readInt() != 0;
3965 data.recycle();
3966 reply.recycle();
3967 return res;
3968 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07003969
3970 public void setUserIsMonkey(boolean monkey) throws RemoteException {
3971 Parcel data = Parcel.obtain();
3972 Parcel reply = Parcel.obtain();
3973 data.writeInterfaceToken(IActivityManager.descriptor);
3974 data.writeInt(monkey ? 1 : 0);
3975 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
3976 reply.readException();
3977 data.recycle();
3978 reply.recycle();
3979 }
3980
Dianne Hackborn860755f2010-06-03 18:47:52 -07003981 public void finishHeavyWeightApp() throws RemoteException {
3982 Parcel data = Parcel.obtain();
3983 Parcel reply = Parcel.obtain();
3984 data.writeInterfaceToken(IActivityManager.descriptor);
3985 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
3986 reply.readException();
3987 data.recycle();
3988 reply.recycle();
3989 }
Craig Mautner4addfc52013-06-25 08:05:45 -07003990
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003991 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07003992 throws RemoteException {
3993 Parcel data = Parcel.obtain();
3994 Parcel reply = Parcel.obtain();
3995 data.writeInterfaceToken(IActivityManager.descriptor);
3996 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07003997 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
3998 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07003999 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004000 data.recycle();
4001 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004002 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004003 }
4004
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004005 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004006 throws RemoteException {
4007 Parcel data = Parcel.obtain();
4008 Parcel reply = Parcel.obtain();
4009 data.writeInterfaceToken(IActivityManager.descriptor);
4010 data.writeStrongBinder(token);
4011 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004012 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004013 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004014 data.recycle();
4015 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004016 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004017 }
4018
Daniel Sandler69a48172010-06-23 16:29:36 -04004019 public void setImmersive(IBinder token, boolean immersive)
4020 throws RemoteException {
4021 Parcel data = Parcel.obtain();
4022 Parcel reply = Parcel.obtain();
4023 data.writeInterfaceToken(IActivityManager.descriptor);
4024 data.writeStrongBinder(token);
4025 data.writeInt(immersive ? 1 : 0);
4026 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4027 reply.readException();
4028 data.recycle();
4029 reply.recycle();
4030 }
4031
4032 public boolean isImmersive(IBinder token)
4033 throws RemoteException {
4034 Parcel data = Parcel.obtain();
4035 Parcel reply = Parcel.obtain();
4036 data.writeInterfaceToken(IActivityManager.descriptor);
4037 data.writeStrongBinder(token);
4038 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004039 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004040 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004041 data.recycle();
4042 reply.recycle();
4043 return res;
4044 }
4045
4046 public boolean isTopActivityImmersive()
4047 throws RemoteException {
4048 Parcel data = Parcel.obtain();
4049 Parcel reply = Parcel.obtain();
4050 data.writeInterfaceToken(IActivityManager.descriptor);
4051 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004052 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004053 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004054 data.recycle();
4055 reply.recycle();
4056 return res;
4057 }
4058
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004059 public void crashApplication(int uid, int initialPid, String packageName,
4060 String message) throws RemoteException {
4061 Parcel data = Parcel.obtain();
4062 Parcel reply = Parcel.obtain();
4063 data.writeInterfaceToken(IActivityManager.descriptor);
4064 data.writeInt(uid);
4065 data.writeInt(initialPid);
4066 data.writeString(packageName);
4067 data.writeString(message);
4068 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4069 reply.readException();
4070 data.recycle();
4071 reply.recycle();
4072 }
Andy McFadden824c5102010-07-09 16:26:57 -07004073
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004074 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004075 Parcel data = Parcel.obtain();
4076 Parcel reply = Parcel.obtain();
4077 data.writeInterfaceToken(IActivityManager.descriptor);
4078 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004079 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004080 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4081 reply.readException();
4082 String res = reply.readString();
4083 data.recycle();
4084 reply.recycle();
4085 return res;
4086 }
4087
Dianne Hackborn7e269642010-08-25 19:50:20 -07004088 public IBinder newUriPermissionOwner(String name)
4089 throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 data.writeString(name);
4094 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 IBinder res = reply.readStrongBinder();
4097 data.recycle();
4098 reply.recycle();
4099 return res;
4100 }
4101
4102 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4103 Uri uri, int mode) throws RemoteException {
4104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 data.writeStrongBinder(owner);
4108 data.writeInt(fromUid);
4109 data.writeString(targetPkg);
4110 uri.writeToParcel(data, 0);
4111 data.writeInt(mode);
4112 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4113 reply.readException();
4114 data.recycle();
4115 reply.recycle();
4116 }
4117
4118 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4119 int mode) throws RemoteException {
4120 Parcel data = Parcel.obtain();
4121 Parcel reply = Parcel.obtain();
4122 data.writeInterfaceToken(IActivityManager.descriptor);
4123 data.writeStrongBinder(owner);
4124 if (uri != null) {
4125 data.writeInt(1);
4126 uri.writeToParcel(data, 0);
4127 } else {
4128 data.writeInt(0);
4129 }
4130 data.writeInt(mode);
4131 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4132 reply.readException();
4133 data.recycle();
4134 reply.recycle();
4135 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004136
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004137 public int checkGrantUriPermission(int callingUid, String targetPkg,
4138 Uri uri, int modeFlags) throws RemoteException {
4139 Parcel data = Parcel.obtain();
4140 Parcel reply = Parcel.obtain();
4141 data.writeInterfaceToken(IActivityManager.descriptor);
4142 data.writeInt(callingUid);
4143 data.writeString(targetPkg);
4144 uri.writeToParcel(data, 0);
4145 data.writeInt(modeFlags);
4146 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 int res = reply.readInt();
4149 data.recycle();
4150 reply.recycle();
4151 return res;
4152 }
4153
Dianne Hackborn1676c852012-09-10 14:52:30 -07004154 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004155 String path, ParcelFileDescriptor fd) throws RemoteException {
4156 Parcel data = Parcel.obtain();
4157 Parcel reply = Parcel.obtain();
4158 data.writeInterfaceToken(IActivityManager.descriptor);
4159 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004160 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004161 data.writeInt(managed ? 1 : 0);
4162 data.writeString(path);
4163 if (fd != null) {
4164 data.writeInt(1);
4165 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4166 } else {
4167 data.writeInt(0);
4168 }
4169 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4170 reply.readException();
4171 boolean res = reply.readInt() != 0;
4172 reply.recycle();
4173 data.recycle();
4174 return res;
4175 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004176
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004177 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004178 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004179 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004180 Parcel data = Parcel.obtain();
4181 Parcel reply = Parcel.obtain();
4182 data.writeInterfaceToken(IActivityManager.descriptor);
4183 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004184 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004185 data.writeTypedArray(intents, 0);
4186 data.writeStringArray(resolvedTypes);
4187 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004188 if (options != null) {
4189 data.writeInt(1);
4190 options.writeToParcel(data, 0);
4191 } else {
4192 data.writeInt(0);
4193 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004194 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004195 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4196 reply.readException();
4197 int result = reply.readInt();
4198 reply.recycle();
4199 data.recycle();
4200 return result;
4201 }
4202
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004203 public int getFrontActivityScreenCompatMode() throws RemoteException {
4204 Parcel data = Parcel.obtain();
4205 Parcel reply = Parcel.obtain();
4206 data.writeInterfaceToken(IActivityManager.descriptor);
4207 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4208 reply.readException();
4209 int mode = reply.readInt();
4210 reply.recycle();
4211 data.recycle();
4212 return mode;
4213 }
4214
4215 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4216 Parcel data = Parcel.obtain();
4217 Parcel reply = Parcel.obtain();
4218 data.writeInterfaceToken(IActivityManager.descriptor);
4219 data.writeInt(mode);
4220 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4221 reply.readException();
4222 reply.recycle();
4223 data.recycle();
4224 }
4225
4226 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4227 Parcel data = Parcel.obtain();
4228 Parcel reply = Parcel.obtain();
4229 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004230 data.writeString(packageName);
4231 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004232 reply.readException();
4233 int mode = reply.readInt();
4234 reply.recycle();
4235 data.recycle();
4236 return mode;
4237 }
4238
4239 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004240 throws RemoteException {
4241 Parcel data = Parcel.obtain();
4242 Parcel reply = Parcel.obtain();
4243 data.writeInterfaceToken(IActivityManager.descriptor);
4244 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004245 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004246 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4247 reply.readException();
4248 reply.recycle();
4249 data.recycle();
4250 }
4251
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004252 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4253 Parcel data = Parcel.obtain();
4254 Parcel reply = Parcel.obtain();
4255 data.writeInterfaceToken(IActivityManager.descriptor);
4256 data.writeString(packageName);
4257 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4258 reply.readException();
4259 boolean ask = reply.readInt() != 0;
4260 reply.recycle();
4261 data.recycle();
4262 return ask;
4263 }
4264
4265 public void setPackageAskScreenCompat(String packageName, boolean ask)
4266 throws RemoteException {
4267 Parcel data = Parcel.obtain();
4268 Parcel reply = Parcel.obtain();
4269 data.writeInterfaceToken(IActivityManager.descriptor);
4270 data.writeString(packageName);
4271 data.writeInt(ask ? 1 : 0);
4272 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4273 reply.readException();
4274 reply.recycle();
4275 data.recycle();
4276 }
4277
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004278 public boolean switchUser(int userid) throws RemoteException {
4279 Parcel data = Parcel.obtain();
4280 Parcel reply = Parcel.obtain();
4281 data.writeInterfaceToken(IActivityManager.descriptor);
4282 data.writeInt(userid);
4283 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4284 reply.readException();
4285 boolean result = reply.readInt() != 0;
4286 reply.recycle();
4287 data.recycle();
4288 return result;
4289 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004290
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004291 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4292 Parcel data = Parcel.obtain();
4293 Parcel reply = Parcel.obtain();
4294 data.writeInterfaceToken(IActivityManager.descriptor);
4295 data.writeInt(userid);
4296 data.writeStrongInterface(callback);
4297 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4298 reply.readException();
4299 int result = reply.readInt();
4300 reply.recycle();
4301 data.recycle();
4302 return result;
4303 }
4304
Amith Yamasani52f1d752012-03-28 18:19:29 -07004305 public UserInfo getCurrentUser() throws RemoteException {
4306 Parcel data = Parcel.obtain();
4307 Parcel reply = Parcel.obtain();
4308 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004309 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004310 reply.readException();
4311 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4312 reply.recycle();
4313 data.recycle();
4314 return userInfo;
4315 }
4316
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004317 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004318 Parcel data = Parcel.obtain();
4319 Parcel reply = Parcel.obtain();
4320 data.writeInterfaceToken(IActivityManager.descriptor);
4321 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004322 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004323 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4324 reply.readException();
4325 boolean result = reply.readInt() != 0;
4326 reply.recycle();
4327 data.recycle();
4328 return result;
4329 }
4330
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004331 public int[] getRunningUserIds() throws RemoteException {
4332 Parcel data = Parcel.obtain();
4333 Parcel reply = Parcel.obtain();
4334 data.writeInterfaceToken(IActivityManager.descriptor);
4335 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4336 reply.readException();
4337 int[] result = reply.createIntArray();
4338 reply.recycle();
4339 data.recycle();
4340 return result;
4341 }
4342
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004343 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4344 Parcel data = Parcel.obtain();
4345 Parcel reply = Parcel.obtain();
4346 data.writeInterfaceToken(IActivityManager.descriptor);
4347 data.writeInt(taskId);
4348 data.writeInt(subTaskIndex);
4349 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4350 reply.readException();
4351 boolean result = reply.readInt() != 0;
4352 reply.recycle();
4353 data.recycle();
4354 return result;
4355 }
4356
4357 public boolean removeTask(int taskId, int flags) throws RemoteException {
4358 Parcel data = Parcel.obtain();
4359 Parcel reply = Parcel.obtain();
4360 data.writeInterfaceToken(IActivityManager.descriptor);
4361 data.writeInt(taskId);
4362 data.writeInt(flags);
4363 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4364 reply.readException();
4365 boolean result = reply.readInt() != 0;
4366 reply.recycle();
4367 data.recycle();
4368 return result;
4369 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004370
Jeff Sharkeya4620792011-05-20 15:29:23 -07004371 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4372 Parcel data = Parcel.obtain();
4373 Parcel reply = Parcel.obtain();
4374 data.writeInterfaceToken(IActivityManager.descriptor);
4375 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4376 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4377 reply.readException();
4378 data.recycle();
4379 reply.recycle();
4380 }
4381
4382 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4387 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4388 reply.readException();
4389 data.recycle();
4390 reply.recycle();
4391 }
4392
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004393 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4394 Parcel data = Parcel.obtain();
4395 Parcel reply = Parcel.obtain();
4396 data.writeInterfaceToken(IActivityManager.descriptor);
4397 data.writeStrongBinder(sender.asBinder());
4398 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4399 reply.readException();
4400 boolean res = reply.readInt() != 0;
4401 data.recycle();
4402 reply.recycle();
4403 return res;
4404 }
4405
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004406 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 data.writeStrongBinder(sender.asBinder());
4411 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 boolean res = reply.readInt() != 0;
4414 data.recycle();
4415 reply.recycle();
4416 return res;
4417 }
4418
Dianne Hackborn81038902012-11-26 17:04:09 -08004419 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4420 Parcel data = Parcel.obtain();
4421 Parcel reply = Parcel.obtain();
4422 data.writeInterfaceToken(IActivityManager.descriptor);
4423 data.writeStrongBinder(sender.asBinder());
4424 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4425 reply.readException();
4426 Intent res = reply.readInt() != 0
4427 ? Intent.CREATOR.createFromParcel(reply) : null;
4428 data.recycle();
4429 reply.recycle();
4430 return res;
4431 }
4432
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004433 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4434 {
4435 Parcel data = Parcel.obtain();
4436 Parcel reply = Parcel.obtain();
4437 data.writeInterfaceToken(IActivityManager.descriptor);
4438 values.writeToParcel(data, 0);
4439 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4440 reply.readException();
4441 data.recycle();
4442 reply.recycle();
4443 }
4444
Dianne Hackbornb437e092011-08-05 17:50:29 -07004445 public long[] getProcessPss(int[] pids) throws RemoteException {
4446 Parcel data = Parcel.obtain();
4447 Parcel reply = Parcel.obtain();
4448 data.writeInterfaceToken(IActivityManager.descriptor);
4449 data.writeIntArray(pids);
4450 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4451 reply.readException();
4452 long[] res = reply.createLongArray();
4453 data.recycle();
4454 reply.recycle();
4455 return res;
4456 }
4457
Dianne Hackborn661cd522011-08-22 00:26:20 -07004458 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4459 Parcel data = Parcel.obtain();
4460 Parcel reply = Parcel.obtain();
4461 data.writeInterfaceToken(IActivityManager.descriptor);
4462 TextUtils.writeToParcel(msg, data, 0);
4463 data.writeInt(always ? 1 : 0);
4464 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4465 reply.readException();
4466 data.recycle();
4467 reply.recycle();
4468 }
4469
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004470 public void dismissKeyguardOnNextActivity() throws RemoteException {
4471 Parcel data = Parcel.obtain();
4472 Parcel reply = Parcel.obtain();
4473 data.writeInterfaceToken(IActivityManager.descriptor);
4474 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4475 reply.readException();
4476 data.recycle();
4477 reply.recycle();
4478 }
4479
Adam Powelldd8fab22012-03-22 17:47:27 -07004480 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4481 throws RemoteException {
4482 Parcel data = Parcel.obtain();
4483 Parcel reply = Parcel.obtain();
4484 data.writeInterfaceToken(IActivityManager.descriptor);
4485 data.writeStrongBinder(token);
4486 data.writeString(destAffinity);
4487 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4488 reply.readException();
4489 boolean result = reply.readInt() != 0;
4490 data.recycle();
4491 reply.recycle();
4492 return result;
4493 }
4494
4495 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4496 throws RemoteException {
4497 Parcel data = Parcel.obtain();
4498 Parcel reply = Parcel.obtain();
4499 data.writeInterfaceToken(IActivityManager.descriptor);
4500 data.writeStrongBinder(token);
4501 target.writeToParcel(data, 0);
4502 data.writeInt(resultCode);
4503 if (resultData != null) {
4504 data.writeInt(1);
4505 resultData.writeToParcel(data, 0);
4506 } else {
4507 data.writeInt(0);
4508 }
4509 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4510 reply.readException();
4511 boolean result = reply.readInt() != 0;
4512 data.recycle();
4513 reply.recycle();
4514 return result;
4515 }
4516
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004517 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4518 Parcel data = Parcel.obtain();
4519 Parcel reply = Parcel.obtain();
4520 data.writeInterfaceToken(IActivityManager.descriptor);
4521 data.writeStrongBinder(activityToken);
4522 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4523 reply.readException();
4524 int result = reply.readInt();
4525 data.recycle();
4526 reply.recycle();
4527 return result;
4528 }
4529
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004530 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4531 Parcel data = Parcel.obtain();
4532 Parcel reply = Parcel.obtain();
4533 data.writeInterfaceToken(IActivityManager.descriptor);
4534 data.writeStrongBinder(activityToken);
4535 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4536 reply.readException();
4537 String result = reply.readString();
4538 data.recycle();
4539 reply.recycle();
4540 return result;
4541 }
4542
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004543 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4544 Parcel data = Parcel.obtain();
4545 Parcel reply = Parcel.obtain();
4546 data.writeInterfaceToken(IActivityManager.descriptor);
4547 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4548 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4549 reply.readException();
4550 data.recycle();
4551 reply.recycle();
4552 }
4553
4554 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4555 Parcel data = Parcel.obtain();
4556 Parcel reply = Parcel.obtain();
4557 data.writeInterfaceToken(IActivityManager.descriptor);
4558 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4559 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4560 reply.readException();
4561 data.recycle();
4562 reply.recycle();
4563 }
4564
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004565 public void requestBugReport() throws RemoteException {
4566 Parcel data = Parcel.obtain();
4567 Parcel reply = Parcel.obtain();
4568 data.writeInterfaceToken(IActivityManager.descriptor);
4569 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4570 reply.readException();
4571 data.recycle();
4572 reply.recycle();
4573 }
4574
Jeff Brownbd181bb2013-09-10 16:44:24 -07004575 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4576 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004577 Parcel data = Parcel.obtain();
4578 Parcel reply = Parcel.obtain();
4579 data.writeInterfaceToken(IActivityManager.descriptor);
4580 data.writeInt(pid);
4581 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004582 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004583 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4584 reply.readException();
4585 long res = reply.readInt();
4586 data.recycle();
4587 reply.recycle();
4588 return res;
4589 }
4590
Adam Skorydfc7fd72013-08-05 19:23:41 -07004591 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004592 Parcel data = Parcel.obtain();
4593 Parcel reply = Parcel.obtain();
4594 data.writeInterfaceToken(IActivityManager.descriptor);
4595 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004596 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004597 reply.readException();
4598 Bundle res = reply.readBundle();
4599 data.recycle();
4600 reply.recycle();
4601 return res;
4602 }
4603
Adam Skory7140a252013-09-11 12:04:58 +01004604 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004605 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004606 Parcel data = Parcel.obtain();
4607 Parcel reply = Parcel.obtain();
4608 data.writeInterfaceToken(IActivityManager.descriptor);
4609 data.writeStrongBinder(token);
4610 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004611 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004612 reply.readException();
4613 data.recycle();
4614 reply.recycle();
4615 }
4616
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004617 public void killUid(int uid, String reason) throws RemoteException {
4618 Parcel data = Parcel.obtain();
4619 Parcel reply = Parcel.obtain();
4620 data.writeInterfaceToken(IActivityManager.descriptor);
4621 data.writeInt(uid);
4622 data.writeString(reason);
4623 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4624 reply.readException();
4625 data.recycle();
4626 reply.recycle();
4627 }
4628
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004629 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4630 Parcel data = Parcel.obtain();
4631 Parcel reply = Parcel.obtain();
4632 data.writeInterfaceToken(IActivityManager.descriptor);
4633 data.writeStrongBinder(who);
4634 data.writeInt(allowRestart ? 1 : 0);
4635 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4636 reply.readException();
4637 data.recycle();
4638 reply.recycle();
4639 }
4640
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004641 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4642 Parcel data = Parcel.obtain();
4643 Parcel reply = Parcel.obtain();
4644 data.writeInterfaceToken(IActivityManager.descriptor);
4645 data.writeStrongBinder(token);
4646 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4647 reply.readException();
4648 data.recycle();
4649 reply.recycle();
4650 }
4651
Craig Mautner5eda9b32013-07-02 11:58:16 -07004652 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 data.writeStrongBinder(token);
4657 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4658 reply.readException();
4659 data.recycle();
4660 reply.recycle();
4661 }
4662
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004663 public void restart() throws RemoteException {
4664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
4667 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4668 reply.readException();
4669 data.recycle();
4670 reply.recycle();
4671 }
4672
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004673 public void performIdleMaintenance() throws RemoteException {
4674 Parcel data = Parcel.obtain();
4675 Parcel reply = Parcel.obtain();
4676 data.writeInterfaceToken(IActivityManager.descriptor);
4677 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4678 reply.readException();
4679 data.recycle();
4680 reply.recycle();
4681 }
4682
Craig Mautner4a1cb222013-12-04 16:14:06 -08004683 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4684 IActivityContainerCallback callback) throws RemoteException {
4685 Parcel data = Parcel.obtain();
4686 Parcel reply = Parcel.obtain();
4687 data.writeInterfaceToken(IActivityManager.descriptor);
4688 data.writeStrongBinder(parentActivityToken);
4689 data.writeStrongBinder((IBinder)callback);
4690 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4691 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004692 final int result = reply.readInt();
4693 final IActivityContainer res;
4694 if (result == 1) {
4695 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4696 } else {
4697 res = null;
4698 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004699 data.recycle();
4700 reply.recycle();
4701 return res;
4702 }
4703
Craig Mautner95da1082014-02-24 17:54:35 -08004704 public void deleteActivityContainer(IActivityContainer activityContainer)
4705 throws RemoteException {
4706 Parcel data = Parcel.obtain();
4707 Parcel reply = Parcel.obtain();
4708 data.writeInterfaceToken(IActivityManager.descriptor);
4709 data.writeStrongBinder(activityContainer.asBinder());
4710 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4711 reply.readException();
4712 data.recycle();
4713 reply.recycle();
4714 }
4715
Craig Mautnere0a38842013-12-16 16:14:02 -08004716 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4717 throws RemoteException {
4718 Parcel data = Parcel.obtain();
4719 Parcel reply = Parcel.obtain();
4720 data.writeInterfaceToken(IActivityManager.descriptor);
4721 data.writeStrongBinder(activityToken);
4722 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4723 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004724 final int result = reply.readInt();
4725 final IActivityContainer res;
4726 if (result == 1) {
4727 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4728 } else {
4729 res = null;
4730 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004731 data.recycle();
4732 reply.recycle();
4733 return res;
4734 }
4735
Craig Mautner4a1cb222013-12-04 16:14:06 -08004736 public IBinder getHomeActivityToken() throws RemoteException {
4737 Parcel data = Parcel.obtain();
4738 Parcel reply = Parcel.obtain();
4739 data.writeInterfaceToken(IActivityManager.descriptor);
4740 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4741 reply.readException();
4742 IBinder res = reply.readStrongBinder();
4743 data.recycle();
4744 reply.recycle();
4745 return res;
4746 }
4747
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004748 private IBinder mRemote;
4749}