blob: 707a038f4f09d4748590ab2a5f46683637f378d3 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
33import android.graphics.Bitmap;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080034import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.net.Uri;
36import android.os.Binder;
37import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070038import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.os.IBinder;
40import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070041import android.os.ParcelFileDescriptor;
42import android.os.Parcelable;
43import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070045import android.os.StrictMode;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080048import android.util.Singleton;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050import java.util.ArrayList;
51import java.util.List;
52
53/** {@hide} */
54public abstract class ActivityManagerNative extends Binder implements IActivityManager
55{
56 /**
57 * Cast a Binder object into an activity manager interface, generating
58 * a proxy if needed.
59 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080060 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061 if (obj == null) {
62 return null;
63 }
64 IActivityManager in =
65 (IActivityManager)obj.queryLocalInterface(descriptor);
66 if (in != null) {
67 return in;
68 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080069
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070 return new ActivityManagerProxy(obj);
71 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 /**
74 * Retrieve the system's default/global activity manager.
75 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080076 static public IActivityManager getDefault() {
77 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080078 }
79
80 /**
81 * Convenience for checking whether the system is ready. For internal use only.
82 */
83 static public boolean isSystemReady() {
84 if (!sSystemReady) {
85 sSystemReady = getDefault().testIsSystemReady();
86 }
87 return sSystemReady;
88 }
89 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080090
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091 /**
92 * Convenience for sending a sticky broadcast. For internal use only.
93 * If you don't care about permission, use null.
94 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070095 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 try {
97 getDefault().broadcastIntent(
98 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -080099 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 } catch (RemoteException ex) {
101 }
102 }
103
Dianne Hackborn099bc622014-01-22 13:39:16 -0800104 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800106 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107 } catch (RemoteException ex) {
108 }
109 }
110
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800111 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800112 attachInterface(this, descriptor);
113 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700114
115 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
117 throws RemoteException {
118 switch (code) {
119 case START_ACTIVITY_TRANSACTION:
120 {
121 data.enforceInterface(IActivityManager.descriptor);
122 IBinder b = data.readStrongBinder();
123 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800124 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125 Intent intent = Intent.CREATOR.createFromParcel(data);
126 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800127 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800128 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800129 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700130 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700131 String profileFile = data.readString();
132 ParcelFileDescriptor profileFd = data.readInt() != 0
133 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700134 Bundle options = data.readInt() != 0
135 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800136 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 resultTo, resultWho, requestCode, startFlags,
138 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 reply.writeNoException();
140 reply.writeInt(result);
141 return true;
142 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700143
Amith Yamasani82644082012-08-03 13:09:11 -0700144 case START_ACTIVITY_AS_USER_TRANSACTION:
145 {
146 data.enforceInterface(IActivityManager.descriptor);
147 IBinder b = data.readStrongBinder();
148 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800149 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700150 Intent intent = Intent.CREATOR.createFromParcel(data);
151 String resolvedType = data.readString();
152 IBinder resultTo = data.readStrongBinder();
153 String resultWho = data.readString();
154 int requestCode = data.readInt();
155 int startFlags = data.readInt();
156 String profileFile = data.readString();
157 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700158 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700159 Bundle options = data.readInt() != 0
160 ? Bundle.CREATOR.createFromParcel(data) : null;
161 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800162 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700163 resultTo, resultWho, requestCode, startFlags,
164 profileFile, profileFd, options, userId);
165 reply.writeNoException();
166 reply.writeInt(result);
167 return true;
168 }
169
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800170 case START_ACTIVITY_AND_WAIT_TRANSACTION:
171 {
172 data.enforceInterface(IActivityManager.descriptor);
173 IBinder b = data.readStrongBinder();
174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800175 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800176 Intent intent = Intent.CREATOR.createFromParcel(data);
177 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800178 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800179 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800180 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700181 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700182 String profileFile = data.readString();
183 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700184 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700185 Bundle options = data.readInt() != 0
186 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700187 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800188 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700189 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800191 reply.writeNoException();
192 result.writeToParcel(reply, 0);
193 return true;
194 }
195
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700196 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
197 {
198 data.enforceInterface(IActivityManager.descriptor);
199 IBinder b = data.readStrongBinder();
200 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800201 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700202 Intent intent = Intent.CREATOR.createFromParcel(data);
203 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700204 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700205 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700206 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700207 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700208 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700209 Bundle options = data.readInt() != 0
210 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700211 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800212 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700213 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700214 reply.writeNoException();
215 reply.writeInt(result);
216 return true;
217 }
218
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700219 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700220 {
221 data.enforceInterface(IActivityManager.descriptor);
222 IBinder b = data.readStrongBinder();
223 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700224 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700225 Intent fillInIntent = null;
226 if (data.readInt() != 0) {
227 fillInIntent = Intent.CREATOR.createFromParcel(data);
228 }
229 String resolvedType = data.readString();
230 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700231 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700232 int requestCode = data.readInt();
233 int flagsMask = data.readInt();
234 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700235 Bundle options = data.readInt() != 0
236 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700237 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700238 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700239 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700240 reply.writeNoException();
241 reply.writeInt(result);
242 return true;
243 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800245 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
246 {
247 data.enforceInterface(IActivityManager.descriptor);
248 IBinder callingActivity = data.readStrongBinder();
249 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700250 Bundle options = data.readInt() != 0
251 ? Bundle.CREATOR.createFromParcel(data) : null;
252 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 reply.writeNoException();
254 reply.writeInt(result ? 1 : 0);
255 return true;
256 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258 case FINISH_ACTIVITY_TRANSACTION: {
259 data.enforceInterface(IActivityManager.descriptor);
260 IBinder token = data.readStrongBinder();
261 Intent resultData = null;
262 int resultCode = data.readInt();
263 if (data.readInt() != 0) {
264 resultData = Intent.CREATOR.createFromParcel(data);
265 }
266 boolean res = finishActivity(token, resultCode, resultData);
267 reply.writeNoException();
268 reply.writeInt(res ? 1 : 0);
269 return true;
270 }
271
272 case FINISH_SUB_ACTIVITY_TRANSACTION: {
273 data.enforceInterface(IActivityManager.descriptor);
274 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700275 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800276 int requestCode = data.readInt();
277 finishSubActivity(token, resultWho, requestCode);
278 reply.writeNoException();
279 return true;
280 }
281
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700282 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
283 data.enforceInterface(IActivityManager.descriptor);
284 IBinder token = data.readStrongBinder();
285 boolean res = finishActivityAffinity(token);
286 reply.writeNoException();
287 reply.writeInt(res ? 1 : 0);
288 return true;
289 }
290
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800291 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
292 data.enforceInterface(IActivityManager.descriptor);
293 IBinder token = data.readStrongBinder();
294 boolean res = willActivityBeVisible(token);
295 reply.writeNoException();
296 reply.writeInt(res ? 1 : 0);
297 return true;
298 }
299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 case REGISTER_RECEIVER_TRANSACTION:
301 {
302 data.enforceInterface(IActivityManager.descriptor);
303 IBinder b = data.readStrongBinder();
304 IApplicationThread app =
305 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700306 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 b = data.readStrongBinder();
308 IIntentReceiver rec
309 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
310 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
311 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700312 int userId = data.readInt();
313 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800314 reply.writeNoException();
315 if (intent != null) {
316 reply.writeInt(1);
317 intent.writeToParcel(reply, 0);
318 } else {
319 reply.writeInt(0);
320 }
321 return true;
322 }
323
324 case UNREGISTER_RECEIVER_TRANSACTION:
325 {
326 data.enforceInterface(IActivityManager.descriptor);
327 IBinder b = data.readStrongBinder();
328 if (b == null) {
329 return true;
330 }
331 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
332 unregisterReceiver(rec);
333 reply.writeNoException();
334 return true;
335 }
336
337 case BROADCAST_INTENT_TRANSACTION:
338 {
339 data.enforceInterface(IActivityManager.descriptor);
340 IBinder b = data.readStrongBinder();
341 IApplicationThread app =
342 b != null ? ApplicationThreadNative.asInterface(b) : null;
343 Intent intent = Intent.CREATOR.createFromParcel(data);
344 String resolvedType = data.readString();
345 b = data.readStrongBinder();
346 IIntentReceiver resultTo =
347 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
348 int resultCode = data.readInt();
349 String resultData = data.readString();
350 Bundle resultExtras = data.readBundle();
351 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800352 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 boolean serialized = data.readInt() != 0;
354 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700355 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800356 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800357 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700358 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800359 reply.writeNoException();
360 reply.writeInt(res);
361 return true;
362 }
363
364 case UNBROADCAST_INTENT_TRANSACTION:
365 {
366 data.enforceInterface(IActivityManager.descriptor);
367 IBinder b = data.readStrongBinder();
368 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
369 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700370 int userId = data.readInt();
371 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800372 reply.writeNoException();
373 return true;
374 }
375
376 case FINISH_RECEIVER_TRANSACTION: {
377 data.enforceInterface(IActivityManager.descriptor);
378 IBinder who = data.readStrongBinder();
379 int resultCode = data.readInt();
380 String resultData = data.readString();
381 Bundle resultExtras = data.readBundle();
382 boolean resultAbort = data.readInt() != 0;
383 if (who != null) {
384 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
385 }
386 reply.writeNoException();
387 return true;
388 }
389
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 case ATTACH_APPLICATION_TRANSACTION: {
391 data.enforceInterface(IActivityManager.descriptor);
392 IApplicationThread app = ApplicationThreadNative.asInterface(
393 data.readStrongBinder());
394 if (app != null) {
395 attachApplication(app);
396 }
397 reply.writeNoException();
398 return true;
399 }
400
401 case ACTIVITY_IDLE_TRANSACTION: {
402 data.enforceInterface(IActivityManager.descriptor);
403 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700404 Configuration config = null;
405 if (data.readInt() != 0) {
406 config = Configuration.CREATOR.createFromParcel(data);
407 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700408 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800409 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700410 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 }
412 reply.writeNoException();
413 return true;
414 }
415
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700416 case ACTIVITY_RESUMED_TRANSACTION: {
417 data.enforceInterface(IActivityManager.descriptor);
418 IBinder token = data.readStrongBinder();
419 activityResumed(token);
420 reply.writeNoException();
421 return true;
422 }
423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800424 case ACTIVITY_PAUSED_TRANSACTION: {
425 data.enforceInterface(IActivityManager.descriptor);
426 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800427 activityPaused(token);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800428 reply.writeNoException();
429 return true;
430 }
431
432 case ACTIVITY_STOPPED_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800435 Bundle map = data.readBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 Bitmap thumbnail = data.readInt() != 0
437 ? Bitmap.CREATOR.createFromParcel(data) : null;
438 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800439 activityStopped(token, map, thumbnail, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 reply.writeNoException();
441 return true;
442 }
443
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800444 case ACTIVITY_SLEPT_TRANSACTION: {
445 data.enforceInterface(IActivityManager.descriptor);
446 IBinder token = data.readStrongBinder();
447 activitySlept(token);
448 reply.writeNoException();
449 return true;
450 }
451
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800452 case ACTIVITY_DESTROYED_TRANSACTION: {
453 data.enforceInterface(IActivityManager.descriptor);
454 IBinder token = data.readStrongBinder();
455 activityDestroyed(token);
456 reply.writeNoException();
457 return true;
458 }
459
460 case GET_CALLING_PACKAGE_TRANSACTION: {
461 data.enforceInterface(IActivityManager.descriptor);
462 IBinder token = data.readStrongBinder();
463 String res = token != null ? getCallingPackage(token) : null;
464 reply.writeNoException();
465 reply.writeString(res);
466 return true;
467 }
468
469 case GET_CALLING_ACTIVITY_TRANSACTION: {
470 data.enforceInterface(IActivityManager.descriptor);
471 IBinder token = data.readStrongBinder();
472 ComponentName cn = getCallingActivity(token);
473 reply.writeNoException();
474 ComponentName.writeToParcel(cn, reply);
475 return true;
476 }
477
478 case GET_TASKS_TRANSACTION: {
479 data.enforceInterface(IActivityManager.descriptor);
480 int maxNum = data.readInt();
481 int fl = data.readInt();
482 IBinder receiverBinder = data.readStrongBinder();
483 IThumbnailReceiver receiver = receiverBinder != null
484 ? IThumbnailReceiver.Stub.asInterface(receiverBinder)
485 : null;
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700486 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl, receiver);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800487 reply.writeNoException();
488 int N = list != null ? list.size() : -1;
489 reply.writeInt(N);
490 int i;
491 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700492 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800493 info.writeToParcel(reply, 0);
494 }
495 return true;
496 }
497
498 case GET_RECENT_TASKS_TRANSACTION: {
499 data.enforceInterface(IActivityManager.descriptor);
500 int maxNum = data.readInt();
501 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700502 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800503 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700504 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 reply.writeNoException();
506 reply.writeTypedList(list);
507 return true;
508 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700509
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700510 case GET_TASK_THUMBNAILS_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800511 data.enforceInterface(IActivityManager.descriptor);
512 int id = data.readInt();
Dianne Hackbornf26fd992011-04-08 18:14:09 -0700513 ActivityManager.TaskThumbnails bm = getTaskThumbnails(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800514 reply.writeNoException();
515 if (bm != null) {
516 reply.writeInt(1);
517 bm.writeToParcel(reply, 0);
518 } else {
519 reply.writeInt(0);
520 }
521 return true;
522 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700523
524 case GET_TASK_TOP_THUMBNAIL_TRANSACTION: {
525 data.enforceInterface(IActivityManager.descriptor);
526 int id = data.readInt();
527 Bitmap bm = getTaskTopThumbnail(id);
528 reply.writeNoException();
529 if (bm != null) {
530 reply.writeInt(1);
531 bm.writeToParcel(reply, 0);
532 } else {
533 reply.writeInt(0);
534 }
535 return true;
536 }
537
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800538 case GET_SERVICES_TRANSACTION: {
539 data.enforceInterface(IActivityManager.descriptor);
540 int maxNum = data.readInt();
541 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700542 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 reply.writeNoException();
544 int N = list != null ? list.size() : -1;
545 reply.writeInt(N);
546 int i;
547 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700548 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800549 info.writeToParcel(reply, 0);
550 }
551 return true;
552 }
553
554 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
555 data.enforceInterface(IActivityManager.descriptor);
556 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
557 reply.writeNoException();
558 reply.writeTypedList(list);
559 return true;
560 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700561
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800562 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
563 data.enforceInterface(IActivityManager.descriptor);
564 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
565 reply.writeNoException();
566 reply.writeTypedList(list);
567 return true;
568 }
569
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700570 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
571 data.enforceInterface(IActivityManager.descriptor);
572 List<ApplicationInfo> list = getRunningExternalApplications();
573 reply.writeNoException();
574 reply.writeTypedList(list);
575 return true;
576 }
577
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 case MOVE_TASK_TO_FRONT_TRANSACTION: {
579 data.enforceInterface(IActivityManager.descriptor);
580 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800581 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700582 Bundle options = data.readInt() != 0
583 ? Bundle.CREATOR.createFromParcel(data) : null;
584 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 reply.writeNoException();
586 return true;
587 }
588
589 case MOVE_TASK_TO_BACK_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 int task = data.readInt();
592 moveTaskToBack(task);
593 reply.writeNoException();
594 return true;
595 }
596
597 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 IBinder token = data.readStrongBinder();
600 boolean nonRoot = data.readInt() != 0;
601 boolean res = moveActivityTaskToBack(token, nonRoot);
602 reply.writeNoException();
603 reply.writeInt(res ? 1 : 0);
604 return true;
605 }
606
607 case MOVE_TASK_BACKWARDS_TRANSACTION: {
608 data.enforceInterface(IActivityManager.descriptor);
609 int task = data.readInt();
610 moveTaskBackwards(task);
611 reply.writeNoException();
612 return true;
613 }
614
Craig Mautnerc00204b2013-03-05 15:02:14 -0800615 case MOVE_TASK_TO_STACK_TRANSACTION: {
616 data.enforceInterface(IActivityManager.descriptor);
617 int taskId = data.readInt();
618 int stackId = data.readInt();
619 boolean toTop = data.readInt() != 0;
620 moveTaskToStack(taskId, stackId, toTop);
621 reply.writeNoException();
622 return true;
623 }
624
625 case RESIZE_STACK_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800627 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800628 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800629 Rect r = Rect.CREATOR.createFromParcel(data);
630 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800631 reply.writeNoException();
632 return true;
633 }
634
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800635 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700636 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800637 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700638 reply.writeNoException();
639 reply.writeTypedList(list);
640 return true;
641 }
642
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800643 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700644 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800645 int stackId = data.readInt();
646 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700647 reply.writeNoException();
648 if (info != null) {
649 reply.writeInt(1);
650 info.writeToParcel(reply, 0);
651 } else {
652 reply.writeInt(0);
653 }
654 return true;
655 }
656
Winson Chung303e1ff2014-03-07 15:06:19 -0800657 case IS_IN_HOME_STACK_TRANSACTION: {
658 data.enforceInterface(IActivityManager.descriptor);
659 int taskId = data.readInt();
660 boolean isInHomeStack = isInHomeStack(taskId);
661 reply.writeNoException();
662 reply.writeInt(isInHomeStack ? 1 : 0);
663 return true;
664 }
665
Craig Mautnercf910b02013-04-23 11:23:27 -0700666 case SET_FOCUSED_STACK_TRANSACTION: {
667 data.enforceInterface(IActivityManager.descriptor);
668 int stackId = data.readInt();
669 setFocusedStack(stackId);
670 reply.writeNoException();
671 return true;
672 }
673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800674 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
675 data.enforceInterface(IActivityManager.descriptor);
676 IBinder token = data.readStrongBinder();
677 boolean onlyRoot = data.readInt() != 0;
678 int res = token != null
679 ? getTaskForActivity(token, onlyRoot) : -1;
680 reply.writeNoException();
681 reply.writeInt(res);
682 return true;
683 }
684
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800685 case REPORT_THUMBNAIL_TRANSACTION: {
686 data.enforceInterface(IActivityManager.descriptor);
687 IBinder token = data.readStrongBinder();
688 Bitmap thumbnail = data.readInt() != 0
689 ? Bitmap.CREATOR.createFromParcel(data) : null;
690 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
691 reportThumbnail(token, thumbnail, description);
692 reply.writeNoException();
693 return true;
694 }
695
696 case GET_CONTENT_PROVIDER_TRANSACTION: {
697 data.enforceInterface(IActivityManager.descriptor);
698 IBinder b = data.readStrongBinder();
699 IApplicationThread app = ApplicationThreadNative.asInterface(b);
700 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700701 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700702 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700703 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800704 reply.writeNoException();
705 if (cph != null) {
706 reply.writeInt(1);
707 cph.writeToParcel(reply, 0);
708 } else {
709 reply.writeInt(0);
710 }
711 return true;
712 }
713
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800714 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
715 data.enforceInterface(IActivityManager.descriptor);
716 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700717 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800718 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700719 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800720 reply.writeNoException();
721 if (cph != null) {
722 reply.writeInt(1);
723 cph.writeToParcel(reply, 0);
724 } else {
725 reply.writeInt(0);
726 }
727 return true;
728 }
729
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800730 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
731 data.enforceInterface(IActivityManager.descriptor);
732 IBinder b = data.readStrongBinder();
733 IApplicationThread app = ApplicationThreadNative.asInterface(b);
734 ArrayList<ContentProviderHolder> providers =
735 data.createTypedArrayList(ContentProviderHolder.CREATOR);
736 publishContentProviders(app, providers);
737 reply.writeNoException();
738 return true;
739 }
740
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700741 case REF_CONTENT_PROVIDER_TRANSACTION: {
742 data.enforceInterface(IActivityManager.descriptor);
743 IBinder b = data.readStrongBinder();
744 int stable = data.readInt();
745 int unstable = data.readInt();
746 boolean res = refContentProvider(b, stable, unstable);
747 reply.writeNoException();
748 reply.writeInt(res ? 1 : 0);
749 return true;
750 }
751
752 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
753 data.enforceInterface(IActivityManager.descriptor);
754 IBinder b = data.readStrongBinder();
755 unstableProviderDied(b);
756 reply.writeNoException();
757 return true;
758 }
759
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700760 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
761 data.enforceInterface(IActivityManager.descriptor);
762 IBinder b = data.readStrongBinder();
763 appNotRespondingViaProvider(b);
764 reply.writeNoException();
765 return true;
766 }
767
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800768 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700771 boolean stable = data.readInt() != 0;
772 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800773 reply.writeNoException();
774 return true;
775 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800776
777 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 String name = data.readString();
780 IBinder token = data.readStrongBinder();
781 removeContentProviderExternal(name, token);
782 reply.writeNoException();
783 return true;
784 }
785
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700786 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
787 data.enforceInterface(IActivityManager.descriptor);
788 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
789 PendingIntent pi = getRunningServiceControlPanel(comp);
790 reply.writeNoException();
791 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
792 return true;
793 }
794
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800795 case START_SERVICE_TRANSACTION: {
796 data.enforceInterface(IActivityManager.descriptor);
797 IBinder b = data.readStrongBinder();
798 IApplicationThread app = ApplicationThreadNative.asInterface(b);
799 Intent service = Intent.CREATOR.createFromParcel(data);
800 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700801 int userId = data.readInt();
802 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800803 reply.writeNoException();
804 ComponentName.writeToParcel(cn, reply);
805 return true;
806 }
807
808 case STOP_SERVICE_TRANSACTION: {
809 data.enforceInterface(IActivityManager.descriptor);
810 IBinder b = data.readStrongBinder();
811 IApplicationThread app = ApplicationThreadNative.asInterface(b);
812 Intent service = Intent.CREATOR.createFromParcel(data);
813 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700814 int userId = data.readInt();
815 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 reply.writeNoException();
817 reply.writeInt(res);
818 return true;
819 }
820
821 case STOP_SERVICE_TOKEN_TRANSACTION: {
822 data.enforceInterface(IActivityManager.descriptor);
823 ComponentName className = ComponentName.readFromParcel(data);
824 IBinder token = data.readStrongBinder();
825 int startId = data.readInt();
826 boolean res = stopServiceToken(className, token, startId);
827 reply.writeNoException();
828 reply.writeInt(res ? 1 : 0);
829 return true;
830 }
831
832 case SET_SERVICE_FOREGROUND_TRANSACTION: {
833 data.enforceInterface(IActivityManager.descriptor);
834 ComponentName className = ComponentName.readFromParcel(data);
835 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700836 int id = data.readInt();
837 Notification notification = null;
838 if (data.readInt() != 0) {
839 notification = Notification.CREATOR.createFromParcel(data);
840 }
841 boolean removeNotification = data.readInt() != 0;
842 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800843 reply.writeNoException();
844 return true;
845 }
846
847 case BIND_SERVICE_TRANSACTION: {
848 data.enforceInterface(IActivityManager.descriptor);
849 IBinder b = data.readStrongBinder();
850 IApplicationThread app = ApplicationThreadNative.asInterface(b);
851 IBinder token = data.readStrongBinder();
852 Intent service = Intent.CREATOR.createFromParcel(data);
853 String resolvedType = data.readString();
854 b = data.readStrongBinder();
855 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800856 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800857 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800858 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 reply.writeNoException();
860 reply.writeInt(res);
861 return true;
862 }
863
864 case UNBIND_SERVICE_TRANSACTION: {
865 data.enforceInterface(IActivityManager.descriptor);
866 IBinder b = data.readStrongBinder();
867 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
868 boolean res = unbindService(conn);
869 reply.writeNoException();
870 reply.writeInt(res ? 1 : 0);
871 return true;
872 }
873
874 case PUBLISH_SERVICE_TRANSACTION: {
875 data.enforceInterface(IActivityManager.descriptor);
876 IBinder token = data.readStrongBinder();
877 Intent intent = Intent.CREATOR.createFromParcel(data);
878 IBinder service = data.readStrongBinder();
879 publishService(token, intent, service);
880 reply.writeNoException();
881 return true;
882 }
883
884 case UNBIND_FINISHED_TRANSACTION: {
885 data.enforceInterface(IActivityManager.descriptor);
886 IBinder token = data.readStrongBinder();
887 Intent intent = Intent.CREATOR.createFromParcel(data);
888 boolean doRebind = data.readInt() != 0;
889 unbindFinished(token, intent, doRebind);
890 reply.writeNoException();
891 return true;
892 }
893
894 case SERVICE_DONE_EXECUTING_TRANSACTION: {
895 data.enforceInterface(IActivityManager.descriptor);
896 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700897 int type = data.readInt();
898 int startId = data.readInt();
899 int res = data.readInt();
900 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800901 reply.writeNoException();
902 return true;
903 }
904
905 case START_INSTRUMENTATION_TRANSACTION: {
906 data.enforceInterface(IActivityManager.descriptor);
907 ComponentName className = ComponentName.readFromParcel(data);
908 String profileFile = data.readString();
909 int fl = data.readInt();
910 Bundle arguments = data.readBundle();
911 IBinder b = data.readStrongBinder();
912 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800913 b = data.readStrongBinder();
914 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700915 int userId = data.readInt();
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800916 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 reply.writeNoException();
918 reply.writeInt(res ? 1 : 0);
919 return true;
920 }
921
922
923 case FINISH_INSTRUMENTATION_TRANSACTION: {
924 data.enforceInterface(IActivityManager.descriptor);
925 IBinder b = data.readStrongBinder();
926 IApplicationThread app = ApplicationThreadNative.asInterface(b);
927 int resultCode = data.readInt();
928 Bundle results = data.readBundle();
929 finishInstrumentation(app, resultCode, results);
930 reply.writeNoException();
931 return true;
932 }
933
934 case GET_CONFIGURATION_TRANSACTION: {
935 data.enforceInterface(IActivityManager.descriptor);
936 Configuration config = getConfiguration();
937 reply.writeNoException();
938 config.writeToParcel(reply, 0);
939 return true;
940 }
941
942 case UPDATE_CONFIGURATION_TRANSACTION: {
943 data.enforceInterface(IActivityManager.descriptor);
944 Configuration config = Configuration.CREATOR.createFromParcel(data);
945 updateConfiguration(config);
946 reply.writeNoException();
947 return true;
948 }
949
950 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder token = data.readStrongBinder();
953 int requestedOrientation = data.readInt();
954 setRequestedOrientation(token, requestedOrientation);
955 reply.writeNoException();
956 return true;
957 }
958
959 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
960 data.enforceInterface(IActivityManager.descriptor);
961 IBinder token = data.readStrongBinder();
962 int req = getRequestedOrientation(token);
963 reply.writeNoException();
964 reply.writeInt(req);
965 return true;
966 }
967
968 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 ComponentName cn = getActivityClassForToken(token);
972 reply.writeNoException();
973 ComponentName.writeToParcel(cn, reply);
974 return true;
975 }
976
977 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
980 reply.writeNoException();
981 reply.writeString(getPackageForToken(token));
982 return true;
983 }
984
985 case GET_INTENT_SENDER_TRANSACTION: {
986 data.enforceInterface(IActivityManager.descriptor);
987 int type = data.readInt();
988 String packageName = data.readString();
989 IBinder token = data.readStrongBinder();
990 String resultWho = data.readString();
991 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800992 Intent[] requestIntents;
993 String[] requestResolvedTypes;
994 if (data.readInt() != 0) {
995 requestIntents = data.createTypedArray(Intent.CREATOR);
996 requestResolvedTypes = data.createStringArray();
997 } else {
998 requestIntents = null;
999 requestResolvedTypes = null;
1000 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001002 Bundle options = data.readInt() != 0
1003 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001004 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001006 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001007 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001008 reply.writeNoException();
1009 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1010 return true;
1011 }
1012
1013 case CANCEL_INTENT_SENDER_TRANSACTION: {
1014 data.enforceInterface(IActivityManager.descriptor);
1015 IIntentSender r = IIntentSender.Stub.asInterface(
1016 data.readStrongBinder());
1017 cancelIntentSender(r);
1018 reply.writeNoException();
1019 return true;
1020 }
1021
1022 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1023 data.enforceInterface(IActivityManager.descriptor);
1024 IIntentSender r = IIntentSender.Stub.asInterface(
1025 data.readStrongBinder());
1026 String res = getPackageForIntentSender(r);
1027 reply.writeNoException();
1028 reply.writeString(res);
1029 return true;
1030 }
1031
Christopher Tatec4a07d12012-04-06 14:19:13 -07001032 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1033 data.enforceInterface(IActivityManager.descriptor);
1034 IIntentSender r = IIntentSender.Stub.asInterface(
1035 data.readStrongBinder());
1036 int res = getUidForIntentSender(r);
1037 reply.writeNoException();
1038 reply.writeInt(res);
1039 return true;
1040 }
1041
Dianne Hackborn41203752012-08-31 14:05:51 -07001042 case HANDLE_INCOMING_USER_TRANSACTION: {
1043 data.enforceInterface(IActivityManager.descriptor);
1044 int callingPid = data.readInt();
1045 int callingUid = data.readInt();
1046 int userId = data.readInt();
1047 boolean allowAll = data.readInt() != 0 ;
1048 boolean requireFull = data.readInt() != 0;
1049 String name = data.readString();
1050 String callerPackage = data.readString();
1051 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1052 requireFull, name, callerPackage);
1053 reply.writeNoException();
1054 reply.writeInt(res);
1055 return true;
1056 }
1057
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001058 case SET_PROCESS_LIMIT_TRANSACTION: {
1059 data.enforceInterface(IActivityManager.descriptor);
1060 int max = data.readInt();
1061 setProcessLimit(max);
1062 reply.writeNoException();
1063 return true;
1064 }
1065
1066 case GET_PROCESS_LIMIT_TRANSACTION: {
1067 data.enforceInterface(IActivityManager.descriptor);
1068 int limit = getProcessLimit();
1069 reply.writeNoException();
1070 reply.writeInt(limit);
1071 return true;
1072 }
1073
1074 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1075 data.enforceInterface(IActivityManager.descriptor);
1076 IBinder token = data.readStrongBinder();
1077 int pid = data.readInt();
1078 boolean isForeground = data.readInt() != 0;
1079 setProcessForeground(token, pid, isForeground);
1080 reply.writeNoException();
1081 return true;
1082 }
1083
1084 case CHECK_PERMISSION_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 String perm = data.readString();
1087 int pid = data.readInt();
1088 int uid = data.readInt();
1089 int res = checkPermission(perm, pid, uid);
1090 reply.writeNoException();
1091 reply.writeInt(res);
1092 return true;
1093 }
1094
1095 case CHECK_URI_PERMISSION_TRANSACTION: {
1096 data.enforceInterface(IActivityManager.descriptor);
1097 Uri uri = Uri.CREATOR.createFromParcel(data);
1098 int pid = data.readInt();
1099 int uid = data.readInt();
1100 int mode = data.readInt();
1101 int res = checkUriPermission(uri, pid, uid, mode);
1102 reply.writeNoException();
1103 reply.writeInt(res);
1104 return true;
1105 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001107 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001108 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001109 String packageName = data.readString();
1110 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1111 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001112 int userId = data.readInt();
1113 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001114 reply.writeNoException();
1115 reply.writeInt(res ? 1 : 0);
1116 return true;
1117 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001118
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001119 case GRANT_URI_PERMISSION_TRANSACTION: {
1120 data.enforceInterface(IActivityManager.descriptor);
1121 IBinder b = data.readStrongBinder();
1122 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1123 String targetPkg = data.readString();
1124 Uri uri = Uri.CREATOR.createFromParcel(data);
1125 int mode = data.readInt();
1126 grantUriPermission(app, targetPkg, uri, mode);
1127 reply.writeNoException();
1128 return true;
1129 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001130
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 case REVOKE_URI_PERMISSION_TRANSACTION: {
1132 data.enforceInterface(IActivityManager.descriptor);
1133 IBinder b = data.readStrongBinder();
1134 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1135 Uri uri = Uri.CREATOR.createFromParcel(data);
1136 int mode = data.readInt();
1137 revokeUriPermission(app, uri, mode);
1138 reply.writeNoException();
1139 return true;
1140 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001141
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001142 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1143 data.enforceInterface(IActivityManager.descriptor);
1144 Uri uri = Uri.CREATOR.createFromParcel(data);
1145 int mode = data.readInt();
1146 takePersistableUriPermission(uri, mode);
1147 reply.writeNoException();
1148 return true;
1149 }
1150
1151 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 Uri uri = Uri.CREATOR.createFromParcel(data);
1154 int mode = data.readInt();
1155 releasePersistableUriPermission(uri, mode);
1156 reply.writeNoException();
1157 return true;
1158 }
1159
1160 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001162 final String packageName = data.readString();
1163 final boolean incoming = data.readInt() != 0;
1164 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1165 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001166 reply.writeNoException();
1167 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1168 return true;
1169 }
1170
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001171 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1172 data.enforceInterface(IActivityManager.descriptor);
1173 IBinder b = data.readStrongBinder();
1174 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1175 boolean waiting = data.readInt() != 0;
1176 showWaitingForDebugger(app, waiting);
1177 reply.writeNoException();
1178 return true;
1179 }
1180
1181 case GET_MEMORY_INFO_TRANSACTION: {
1182 data.enforceInterface(IActivityManager.descriptor);
1183 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1184 getMemoryInfo(mi);
1185 reply.writeNoException();
1186 mi.writeToParcel(reply, 0);
1187 return true;
1188 }
1189
1190 case UNHANDLED_BACK_TRANSACTION: {
1191 data.enforceInterface(IActivityManager.descriptor);
1192 unhandledBack();
1193 reply.writeNoException();
1194 return true;
1195 }
1196
1197 case OPEN_CONTENT_URI_TRANSACTION: {
1198 data.enforceInterface(IActivityManager.descriptor);
1199 Uri uri = Uri.parse(data.readString());
1200 ParcelFileDescriptor pfd = openContentUri(uri);
1201 reply.writeNoException();
1202 if (pfd != null) {
1203 reply.writeInt(1);
1204 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1205 } else {
1206 reply.writeInt(0);
1207 }
1208 return true;
1209 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001210
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001211 case GOING_TO_SLEEP_TRANSACTION: {
1212 data.enforceInterface(IActivityManager.descriptor);
1213 goingToSleep();
1214 reply.writeNoException();
1215 return true;
1216 }
1217
1218 case WAKING_UP_TRANSACTION: {
1219 data.enforceInterface(IActivityManager.descriptor);
1220 wakingUp();
1221 reply.writeNoException();
1222 return true;
1223 }
1224
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001225 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1226 data.enforceInterface(IActivityManager.descriptor);
1227 setLockScreenShown(data.readInt() != 0);
1228 reply.writeNoException();
1229 return true;
1230 }
1231
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001232 case SET_DEBUG_APP_TRANSACTION: {
1233 data.enforceInterface(IActivityManager.descriptor);
1234 String pn = data.readString();
1235 boolean wfd = data.readInt() != 0;
1236 boolean per = data.readInt() != 0;
1237 setDebugApp(pn, wfd, per);
1238 reply.writeNoException();
1239 return true;
1240 }
1241
1242 case SET_ALWAYS_FINISH_TRANSACTION: {
1243 data.enforceInterface(IActivityManager.descriptor);
1244 boolean enabled = data.readInt() != 0;
1245 setAlwaysFinish(enabled);
1246 reply.writeNoException();
1247 return true;
1248 }
1249
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001250 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001252 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001254 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001255 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001256 return true;
1257 }
1258
1259 case ENTER_SAFE_MODE_TRANSACTION: {
1260 data.enforceInterface(IActivityManager.descriptor);
1261 enterSafeMode();
1262 reply.writeNoException();
1263 return true;
1264 }
1265
1266 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1267 data.enforceInterface(IActivityManager.descriptor);
1268 IIntentSender is = IIntentSender.Stub.asInterface(
1269 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001270 int sourceUid = data.readInt();
1271 String sourcePkg = data.readString();
1272 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001273 reply.writeNoException();
1274 return true;
1275 }
1276
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001277 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001278 data.enforceInterface(IActivityManager.descriptor);
1279 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001280 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001281 boolean secure = data.readInt() != 0;
1282 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001283 reply.writeNoException();
1284 reply.writeInt(res ? 1 : 0);
1285 return true;
1286 }
1287
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001288 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1289 data.enforceInterface(IActivityManager.descriptor);
1290 String reason = data.readString();
1291 boolean res = killProcessesBelowForeground(reason);
1292 reply.writeNoException();
1293 reply.writeInt(res ? 1 : 0);
1294 return true;
1295 }
1296
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001297 case START_RUNNING_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 String pkg = data.readString();
1300 String cls = data.readString();
1301 String action = data.readString();
1302 String indata = data.readString();
1303 startRunning(pkg, cls, action, indata);
1304 reply.writeNoException();
1305 return true;
1306 }
1307
Dan Egnor60d87622009-12-16 16:32:58 -08001308 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1309 data.enforceInterface(IActivityManager.descriptor);
1310 IBinder app = data.readStrongBinder();
1311 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1312 handleApplicationCrash(app, ci);
1313 reply.writeNoException();
1314 return true;
1315 }
1316
1317 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 data.enforceInterface(IActivityManager.descriptor);
1319 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001320 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001321 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001322 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001323 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001324 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325 return true;
1326 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001327
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001328 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1329 data.enforceInterface(IActivityManager.descriptor);
1330 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001331 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001332 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1333 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001334 reply.writeNoException();
1335 return true;
1336 }
1337
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001338 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1339 data.enforceInterface(IActivityManager.descriptor);
1340 int sig = data.readInt();
1341 signalPersistentProcesses(sig);
1342 reply.writeNoException();
1343 return true;
1344 }
1345
Dianne Hackborn03abb812010-01-04 18:43:19 -08001346 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1347 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001348 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001349 int userId = data.readInt();
1350 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001351 reply.writeNoException();
1352 return true;
1353 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001354
1355 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1356 data.enforceInterface(IActivityManager.descriptor);
1357 killAllBackgroundProcesses();
1358 reply.writeNoException();
1359 return true;
1360 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001361
Dianne Hackborn03abb812010-01-04 18:43:19 -08001362 case FORCE_STOP_PACKAGE_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001365 int userId = data.readInt();
1366 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001367 reply.writeNoException();
1368 return true;
1369 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001370
1371 case GET_MY_MEMORY_STATE_TRANSACTION: {
1372 data.enforceInterface(IActivityManager.descriptor);
1373 ActivityManager.RunningAppProcessInfo info =
1374 new ActivityManager.RunningAppProcessInfo();
1375 getMyMemoryState(info);
1376 reply.writeNoException();
1377 info.writeToParcel(reply, 0);
1378 return true;
1379 }
1380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001381 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1382 data.enforceInterface(IActivityManager.descriptor);
1383 ConfigurationInfo config = getDeviceConfigurationInfo();
1384 reply.writeNoException();
1385 config.writeToParcel(reply, 0);
1386 return true;
1387 }
1388
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001389 case PROFILE_CONTROL_TRANSACTION: {
1390 data.enforceInterface(IActivityManager.descriptor);
1391 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001392 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001393 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001394 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001395 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001396 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001397 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001398 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001399 reply.writeNoException();
1400 reply.writeInt(res ? 1 : 0);
1401 return true;
1402 }
1403
Dianne Hackborn55280a92009-05-07 15:53:46 -07001404 case SHUTDOWN_TRANSACTION: {
1405 data.enforceInterface(IActivityManager.descriptor);
1406 boolean res = shutdown(data.readInt());
1407 reply.writeNoException();
1408 reply.writeInt(res ? 1 : 0);
1409 return true;
1410 }
1411
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001412 case STOP_APP_SWITCHES_TRANSACTION: {
1413 data.enforceInterface(IActivityManager.descriptor);
1414 stopAppSwitches();
1415 reply.writeNoException();
1416 return true;
1417 }
1418
1419 case RESUME_APP_SWITCHES_TRANSACTION: {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 resumeAppSwitches();
1422 reply.writeNoException();
1423 return true;
1424 }
1425
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001426 case PEEK_SERVICE_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 Intent service = Intent.CREATOR.createFromParcel(data);
1429 String resolvedType = data.readString();
1430 IBinder binder = peekService(service, resolvedType);
1431 reply.writeNoException();
1432 reply.writeStrongBinder(binder);
1433 return true;
1434 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001435
1436 case START_BACKUP_AGENT_TRANSACTION: {
1437 data.enforceInterface(IActivityManager.descriptor);
1438 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1439 int backupRestoreMode = data.readInt();
1440 boolean success = bindBackupAgent(info, backupRestoreMode);
1441 reply.writeNoException();
1442 reply.writeInt(success ? 1 : 0);
1443 return true;
1444 }
1445
1446 case BACKUP_AGENT_CREATED_TRANSACTION: {
1447 data.enforceInterface(IActivityManager.descriptor);
1448 String packageName = data.readString();
1449 IBinder agent = data.readStrongBinder();
1450 backupAgentCreated(packageName, agent);
1451 reply.writeNoException();
1452 return true;
1453 }
1454
1455 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1456 data.enforceInterface(IActivityManager.descriptor);
1457 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1458 unbindBackupAgent(info);
1459 reply.writeNoException();
1460 return true;
1461 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001462
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001463 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001464 data.enforceInterface(IActivityManager.descriptor);
1465 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001466 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001467 String reason = data.readString();
1468 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001469 reply.writeNoException();
1470 return true;
1471 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001472
1473 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1474 data.enforceInterface(IActivityManager.descriptor);
1475 String reason = data.readString();
1476 closeSystemDialogs(reason);
1477 reply.writeNoException();
1478 return true;
1479 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001480
1481 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1482 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001483 int[] pids = data.createIntArray();
1484 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001485 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001486 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001487 return true;
1488 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001489
1490 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1491 data.enforceInterface(IActivityManager.descriptor);
1492 String processName = data.readString();
1493 int uid = data.readInt();
1494 killApplicationProcess(processName, uid);
1495 reply.writeNoException();
1496 return true;
1497 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001498
1499 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1500 data.enforceInterface(IActivityManager.descriptor);
1501 IBinder token = data.readStrongBinder();
1502 String packageName = data.readString();
1503 int enterAnim = data.readInt();
1504 int exitAnim = data.readInt();
1505 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001506 reply.writeNoException();
1507 return true;
1508 }
1509
1510 case IS_USER_A_MONKEY_TRANSACTION: {
1511 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001512 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001513 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001514 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001515 return true;
1516 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001517
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001518 case SET_USER_IS_MONKEY_TRANSACTION: {
1519 data.enforceInterface(IActivityManager.descriptor);
1520 final boolean monkey = (data.readInt() == 1);
1521 setUserIsMonkey(monkey);
1522 reply.writeNoException();
1523 return true;
1524 }
1525
Dianne Hackborn860755f2010-06-03 18:47:52 -07001526 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1527 data.enforceInterface(IActivityManager.descriptor);
1528 finishHeavyWeightApp();
1529 reply.writeNoException();
1530 return true;
1531 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001532
1533 case IS_IMMERSIVE_TRANSACTION: {
1534 data.enforceInterface(IActivityManager.descriptor);
1535 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001536 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001537 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001538 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001539 return true;
1540 }
1541
Craig Mautner5eda9b32013-07-02 11:58:16 -07001542 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001543 data.enforceInterface(IActivityManager.descriptor);
1544 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001545 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001546 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001547 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001548 return true;
1549 }
1550
1551 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1552 data.enforceInterface(IActivityManager.descriptor);
1553 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001554 boolean converted = convertToTranslucent(token);
Craig Mautner4addfc52013-06-25 08:05:45 -07001555 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001556 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001557 return true;
1558 }
1559
Daniel Sandler69a48172010-06-23 16:29:36 -04001560 case SET_IMMERSIVE_TRANSACTION: {
1561 data.enforceInterface(IActivityManager.descriptor);
1562 IBinder token = data.readStrongBinder();
1563 boolean imm = data.readInt() == 1;
1564 setImmersive(token, imm);
1565 reply.writeNoException();
1566 return true;
1567 }
1568
1569 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1570 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001571 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001572 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001573 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001574 return true;
1575 }
1576
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001577 case CRASH_APPLICATION_TRANSACTION: {
1578 data.enforceInterface(IActivityManager.descriptor);
1579 int uid = data.readInt();
1580 int initialPid = data.readInt();
1581 String packageName = data.readString();
1582 String message = data.readString();
1583 crashApplication(uid, initialPid, packageName, message);
1584 reply.writeNoException();
1585 return true;
1586 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001587
1588 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1589 data.enforceInterface(IActivityManager.descriptor);
1590 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001591 int userId = data.readInt();
1592 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001593 reply.writeNoException();
1594 reply.writeString(type);
1595 return true;
1596 }
1597
Dianne Hackborn7e269642010-08-25 19:50:20 -07001598 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1599 data.enforceInterface(IActivityManager.descriptor);
1600 String name = data.readString();
1601 IBinder perm = newUriPermissionOwner(name);
1602 reply.writeNoException();
1603 reply.writeStrongBinder(perm);
1604 return true;
1605 }
1606
1607 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1608 data.enforceInterface(IActivityManager.descriptor);
1609 IBinder owner = data.readStrongBinder();
1610 int fromUid = data.readInt();
1611 String targetPkg = data.readString();
1612 Uri uri = Uri.CREATOR.createFromParcel(data);
1613 int mode = data.readInt();
1614 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode);
1615 reply.writeNoException();
1616 return true;
1617 }
1618
1619 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1620 data.enforceInterface(IActivityManager.descriptor);
1621 IBinder owner = data.readStrongBinder();
1622 Uri uri = null;
1623 if (data.readInt() != 0) {
1624 Uri.CREATOR.createFromParcel(data);
1625 }
1626 int mode = data.readInt();
1627 revokeUriPermissionFromOwner(owner, uri, mode);
1628 reply.writeNoException();
1629 return true;
1630 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001631
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001632 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1633 data.enforceInterface(IActivityManager.descriptor);
1634 int callingUid = data.readInt();
1635 String targetPkg = data.readString();
1636 Uri uri = Uri.CREATOR.createFromParcel(data);
1637 int modeFlags = data.readInt();
1638 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags);
1639 reply.writeNoException();
1640 reply.writeInt(res);
1641 return true;
1642 }
1643
Andy McFadden824c5102010-07-09 16:26:57 -07001644 case DUMP_HEAP_TRANSACTION: {
1645 data.enforceInterface(IActivityManager.descriptor);
1646 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001647 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001648 boolean managed = data.readInt() != 0;
1649 String path = data.readString();
1650 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001651 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001652 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001653 reply.writeNoException();
1654 reply.writeInt(res ? 1 : 0);
1655 return true;
1656 }
1657
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001658 case START_ACTIVITIES_TRANSACTION:
1659 {
1660 data.enforceInterface(IActivityManager.descriptor);
1661 IBinder b = data.readStrongBinder();
1662 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001663 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001664 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1665 String[] resolvedTypes = data.createStringArray();
1666 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001667 Bundle options = data.readInt() != 0
1668 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001669 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001670 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001671 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001672 reply.writeNoException();
1673 reply.writeInt(result);
1674 return true;
1675 }
1676
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001677 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1678 {
1679 data.enforceInterface(IActivityManager.descriptor);
1680 int mode = getFrontActivityScreenCompatMode();
1681 reply.writeNoException();
1682 reply.writeInt(mode);
1683 return true;
1684 }
1685
1686 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1687 {
1688 data.enforceInterface(IActivityManager.descriptor);
1689 int mode = data.readInt();
1690 setFrontActivityScreenCompatMode(mode);
1691 reply.writeNoException();
1692 reply.writeInt(mode);
1693 return true;
1694 }
1695
1696 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1697 {
1698 data.enforceInterface(IActivityManager.descriptor);
1699 String pkg = data.readString();
1700 int mode = getPackageScreenCompatMode(pkg);
1701 reply.writeNoException();
1702 reply.writeInt(mode);
1703 return true;
1704 }
1705
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001706 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1707 {
1708 data.enforceInterface(IActivityManager.descriptor);
1709 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001710 int mode = data.readInt();
1711 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001712 reply.writeNoException();
1713 return true;
1714 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001715
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001716 case SWITCH_USER_TRANSACTION: {
1717 data.enforceInterface(IActivityManager.descriptor);
1718 int userid = data.readInt();
1719 boolean result = switchUser(userid);
1720 reply.writeNoException();
1721 reply.writeInt(result ? 1 : 0);
1722 return true;
1723 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001724
Kenny Guy08488bf2014-02-21 17:40:37 +00001725 case START_USER_IN_BACKGROUND_TRANSACTION: {
1726 data.enforceInterface(IActivityManager.descriptor);
1727 int userid = data.readInt();
1728 boolean result = startUserInBackground(userid);
1729 reply.writeNoException();
1730 reply.writeInt(result ? 1 : 0);
1731 return true;
1732 }
1733
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001734 case STOP_USER_TRANSACTION: {
1735 data.enforceInterface(IActivityManager.descriptor);
1736 int userid = data.readInt();
1737 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1738 data.readStrongBinder());
1739 int result = stopUser(userid, callback);
1740 reply.writeNoException();
1741 reply.writeInt(result);
1742 return true;
1743 }
1744
Amith Yamasani52f1d752012-03-28 18:19:29 -07001745 case GET_CURRENT_USER_TRANSACTION: {
1746 data.enforceInterface(IActivityManager.descriptor);
1747 UserInfo userInfo = getCurrentUser();
1748 reply.writeNoException();
1749 userInfo.writeToParcel(reply, 0);
1750 return true;
1751 }
1752
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001753 case IS_USER_RUNNING_TRANSACTION: {
1754 data.enforceInterface(IActivityManager.descriptor);
1755 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001756 boolean orStopping = data.readInt() != 0;
1757 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001758 reply.writeNoException();
1759 reply.writeInt(result ? 1 : 0);
1760 return true;
1761 }
1762
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001763 case GET_RUNNING_USER_IDS_TRANSACTION: {
1764 data.enforceInterface(IActivityManager.descriptor);
1765 int[] result = getRunningUserIds();
1766 reply.writeNoException();
1767 reply.writeIntArray(result);
1768 return true;
1769 }
1770
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001771 case REMOVE_SUB_TASK_TRANSACTION:
1772 {
1773 data.enforceInterface(IActivityManager.descriptor);
1774 int taskId = data.readInt();
1775 int subTaskIndex = data.readInt();
1776 boolean result = removeSubTask(taskId, subTaskIndex);
1777 reply.writeNoException();
1778 reply.writeInt(result ? 1 : 0);
1779 return true;
1780 }
1781
1782 case REMOVE_TASK_TRANSACTION:
1783 {
1784 data.enforceInterface(IActivityManager.descriptor);
1785 int taskId = data.readInt();
1786 int fl = data.readInt();
1787 boolean result = removeTask(taskId, fl);
1788 reply.writeNoException();
1789 reply.writeInt(result ? 1 : 0);
1790 return true;
1791 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001792
Jeff Sharkeya4620792011-05-20 15:29:23 -07001793 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1794 data.enforceInterface(IActivityManager.descriptor);
1795 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1796 data.readStrongBinder());
1797 registerProcessObserver(observer);
1798 return true;
1799 }
1800
1801 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1802 data.enforceInterface(IActivityManager.descriptor);
1803 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1804 data.readStrongBinder());
1805 unregisterProcessObserver(observer);
1806 return true;
1807 }
1808
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001809 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1810 {
1811 data.enforceInterface(IActivityManager.descriptor);
1812 String pkg = data.readString();
1813 boolean ask = getPackageAskScreenCompat(pkg);
1814 reply.writeNoException();
1815 reply.writeInt(ask ? 1 : 0);
1816 return true;
1817 }
1818
1819 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1820 {
1821 data.enforceInterface(IActivityManager.descriptor);
1822 String pkg = data.readString();
1823 boolean ask = data.readInt() != 0;
1824 setPackageAskScreenCompat(pkg, ask);
1825 reply.writeNoException();
1826 return true;
1827 }
1828
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001829 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1830 data.enforceInterface(IActivityManager.descriptor);
1831 IIntentSender r = IIntentSender.Stub.asInterface(
1832 data.readStrongBinder());
1833 boolean res = isIntentSenderTargetedToPackage(r);
1834 reply.writeNoException();
1835 reply.writeInt(res ? 1 : 0);
1836 return true;
1837 }
1838
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001839 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1840 data.enforceInterface(IActivityManager.descriptor);
1841 IIntentSender r = IIntentSender.Stub.asInterface(
1842 data.readStrongBinder());
1843 boolean res = isIntentSenderAnActivity(r);
1844 reply.writeNoException();
1845 reply.writeInt(res ? 1 : 0);
1846 return true;
1847 }
1848
Dianne Hackborn81038902012-11-26 17:04:09 -08001849 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1850 data.enforceInterface(IActivityManager.descriptor);
1851 IIntentSender r = IIntentSender.Stub.asInterface(
1852 data.readStrongBinder());
1853 Intent intent = getIntentForIntentSender(r);
1854 reply.writeNoException();
1855 if (intent != null) {
1856 reply.writeInt(1);
1857 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1858 } else {
1859 reply.writeInt(0);
1860 }
1861 return true;
1862 }
1863
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001864 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 IIntentSender r = IIntentSender.Stub.asInterface(
1867 data.readStrongBinder());
1868 String prefix = data.readString();
1869 String tag = getTagForIntentSender(r, prefix);
1870 reply.writeNoException();
1871 reply.writeString(tag);
1872 return true;
1873 }
1874
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001875 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1876 data.enforceInterface(IActivityManager.descriptor);
1877 Configuration config = Configuration.CREATOR.createFromParcel(data);
1878 updatePersistentConfiguration(config);
1879 reply.writeNoException();
1880 return true;
1881 }
1882
Dianne Hackbornb437e092011-08-05 17:50:29 -07001883 case GET_PROCESS_PSS_TRANSACTION: {
1884 data.enforceInterface(IActivityManager.descriptor);
1885 int[] pids = data.createIntArray();
1886 long[] pss = getProcessPss(pids);
1887 reply.writeNoException();
1888 reply.writeLongArray(pss);
1889 return true;
1890 }
1891
Dianne Hackborn661cd522011-08-22 00:26:20 -07001892 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1893 data.enforceInterface(IActivityManager.descriptor);
1894 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1895 boolean always = data.readInt() != 0;
1896 showBootMessage(msg, always);
1897 reply.writeNoException();
1898 return true;
1899 }
1900
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001901 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1902 data.enforceInterface(IActivityManager.descriptor);
1903 dismissKeyguardOnNextActivity();
1904 reply.writeNoException();
1905 return true;
1906 }
1907
Adam Powelldd8fab22012-03-22 17:47:27 -07001908 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1909 data.enforceInterface(IActivityManager.descriptor);
1910 IBinder token = data.readStrongBinder();
1911 String destAffinity = data.readString();
1912 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1913 reply.writeNoException();
1914 reply.writeInt(res ? 1 : 0);
1915 return true;
1916 }
1917
1918 case NAVIGATE_UP_TO_TRANSACTION: {
1919 data.enforceInterface(IActivityManager.descriptor);
1920 IBinder token = data.readStrongBinder();
1921 Intent target = Intent.CREATOR.createFromParcel(data);
1922 int resultCode = data.readInt();
1923 Intent resultData = null;
1924 if (data.readInt() != 0) {
1925 resultData = Intent.CREATOR.createFromParcel(data);
1926 }
1927 boolean res = navigateUpTo(token, target, resultCode, resultData);
1928 reply.writeNoException();
1929 reply.writeInt(res ? 1 : 0);
1930 return true;
1931 }
1932
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001933 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 int res = getLaunchedFromUid(token);
1937 reply.writeNoException();
1938 reply.writeInt(res);
1939 return true;
1940 }
1941
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001942 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IBinder token = data.readStrongBinder();
1945 String res = getLaunchedFromPackage(token);
1946 reply.writeNoException();
1947 reply.writeString(res);
1948 return true;
1949 }
1950
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001951 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1952 data.enforceInterface(IActivityManager.descriptor);
1953 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1954 data.readStrongBinder());
1955 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001956 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001957 return true;
1958 }
1959
1960 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1961 data.enforceInterface(IActivityManager.descriptor);
1962 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1963 data.readStrongBinder());
1964 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001965 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001966 return true;
1967 }
1968
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001969 case REQUEST_BUG_REPORT_TRANSACTION: {
1970 data.enforceInterface(IActivityManager.descriptor);
1971 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001972 reply.writeNoException();
1973 return true;
1974 }
1975
1976 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1977 data.enforceInterface(IActivityManager.descriptor);
1978 int pid = data.readInt();
1979 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001980 String reason = data.readString();
1981 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001982 reply.writeNoException();
1983 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001984 return true;
1985 }
1986
Adam Skorydfc7fd72013-08-05 19:23:41 -07001987 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001988 data.enforceInterface(IActivityManager.descriptor);
1989 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001990 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001991 reply.writeNoException();
1992 reply.writeBundle(res);
1993 return true;
1994 }
1995
Adam Skorydfc7fd72013-08-05 19:23:41 -07001996 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001997 data.enforceInterface(IActivityManager.descriptor);
1998 IBinder token = data.readStrongBinder();
1999 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002000 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002001 reply.writeNoException();
2002 return true;
2003 }
2004
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002005 case KILL_UID_TRANSACTION: {
2006 data.enforceInterface(IActivityManager.descriptor);
2007 int uid = data.readInt();
2008 String reason = data.readString();
2009 killUid(uid, reason);
2010 reply.writeNoException();
2011 return true;
2012 }
2013
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002014 case HANG_TRANSACTION: {
2015 data.enforceInterface(IActivityManager.descriptor);
2016 IBinder who = data.readStrongBinder();
2017 boolean allowRestart = data.readInt() != 0;
2018 hang(who, allowRestart);
2019 reply.writeNoException();
2020 return true;
2021 }
2022
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002023 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2024 data.enforceInterface(IActivityManager.descriptor);
2025 IBinder token = data.readStrongBinder();
2026 reportActivityFullyDrawn(token);
2027 reply.writeNoException();
2028 return true;
2029 }
2030
Craig Mautner5eda9b32013-07-02 11:58:16 -07002031 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2032 data.enforceInterface(IActivityManager.descriptor);
2033 IBinder token = data.readStrongBinder();
2034 notifyActivityDrawn(token);
2035 reply.writeNoException();
2036 return true;
2037 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002038
2039 case RESTART_TRANSACTION: {
2040 data.enforceInterface(IActivityManager.descriptor);
2041 restart();
2042 reply.writeNoException();
2043 return true;
2044 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002045
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002046 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 performIdleMaintenance();
2049 reply.writeNoException();
2050 return true;
2051 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002052
2053 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2054 data.enforceInterface(IActivityManager.descriptor);
2055 IBinder parentActivityToken = data.readStrongBinder();
2056 IActivityContainerCallback callback =
2057 (IActivityContainerCallback) data.readStrongBinder();
2058 IActivityContainer activityContainer =
2059 createActivityContainer(parentActivityToken, callback);
2060 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002061 if (activityContainer != null) {
2062 reply.writeInt(1);
2063 reply.writeStrongBinder(activityContainer.asBinder());
2064 } else {
2065 reply.writeInt(0);
2066 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002067 return true;
2068 }
2069
Craig Mautner95da1082014-02-24 17:54:35 -08002070 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 IActivityContainer activityContainer =
2073 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2074 deleteActivityContainer(activityContainer);
2075 reply.writeNoException();
2076 return true;
2077 }
2078
Craig Mautnere0a38842013-12-16 16:14:02 -08002079 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2080 data.enforceInterface(IActivityManager.descriptor);
2081 IBinder activityToken = data.readStrongBinder();
2082 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2083 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002084 if (activityContainer != null) {
2085 reply.writeInt(1);
2086 reply.writeStrongBinder(activityContainer.asBinder());
2087 } else {
2088 reply.writeInt(0);
2089 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002090 return true;
2091 }
2092
Craig Mautner4a1cb222013-12-04 16:14:06 -08002093 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2094 data.enforceInterface(IActivityManager.descriptor);
2095 IBinder homeActivityToken = getHomeActivityToken();
2096 reply.writeNoException();
2097 reply.writeStrongBinder(homeActivityToken);
2098 return true;
2099 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002100
2101 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2102 data.enforceInterface(IActivityManager.descriptor);
2103 final int taskId = data.readInt();
2104 startLockTaskMode(taskId);
2105 reply.writeNoException();
2106 return true;
2107 }
2108
2109 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2110 data.enforceInterface(IActivityManager.descriptor);
2111 IBinder token = data.readStrongBinder();
2112 startLockTaskMode(token);
2113 reply.writeNoException();
2114 return true;
2115 }
2116
2117 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 stopLockTaskMode();
2120 reply.writeNoException();
2121 return true;
2122 }
2123
2124 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 final boolean isInLockTaskMode = isInLockTaskMode();
2127 reply.writeNoException();
2128 reply.writeInt(isInLockTaskMode ? 1 : 0);
2129 return true;
2130 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002131
2132 case SET_RECENTS_LABEL_TRANSACTION: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 IBinder token = data.readStrongBinder();
2135 CharSequence recentsLabel = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
2136 setRecentsLabel(token, recentsLabel);
2137 reply.writeNoException();
2138 return true;
2139 }
2140
2141 case SET_RECENTS_ICON_TRANSACTION: {
2142 data.enforceInterface(IActivityManager.descriptor);
2143 IBinder token = data.readStrongBinder();
2144 Bitmap recentsIcon = data.readInt() != 0
2145 ? Bitmap.CREATOR.createFromParcel(data) : null;
2146 setRecentsIcon(token, recentsIcon);
2147 reply.writeNoException();
2148 return true;
2149 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002152 return super.onTransact(code, data, reply, flags);
2153 }
2154
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002155 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002156 return this;
2157 }
2158
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002159 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2160 protected IActivityManager create() {
2161 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002162 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002163 Log.v("ActivityManager", "default service binder = " + b);
2164 }
2165 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002166 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002167 Log.v("ActivityManager", "default service = " + am);
2168 }
2169 return am;
2170 }
2171 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002172}
2173
2174class ActivityManagerProxy implements IActivityManager
2175{
2176 public ActivityManagerProxy(IBinder remote)
2177 {
2178 mRemote = remote;
2179 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002180
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002181 public IBinder asBinder()
2182 {
2183 return mRemote;
2184 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002185
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002186 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002187 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2188 int startFlags, String profileFile,
2189 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002190 Parcel data = Parcel.obtain();
2191 Parcel reply = Parcel.obtain();
2192 data.writeInterfaceToken(IActivityManager.descriptor);
2193 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002194 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002195 intent.writeToParcel(data, 0);
2196 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002197 data.writeStrongBinder(resultTo);
2198 data.writeString(resultWho);
2199 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002200 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002201 data.writeString(profileFile);
2202 if (profileFd != null) {
2203 data.writeInt(1);
2204 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2205 } else {
2206 data.writeInt(0);
2207 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002208 if (options != null) {
2209 data.writeInt(1);
2210 options.writeToParcel(data, 0);
2211 } else {
2212 data.writeInt(0);
2213 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002214 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2215 reply.readException();
2216 int result = reply.readInt();
2217 reply.recycle();
2218 data.recycle();
2219 return result;
2220 }
Amith Yamasani82644082012-08-03 13:09:11 -07002221
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002222 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002223 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2224 int startFlags, String profileFile,
2225 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2226 Parcel data = Parcel.obtain();
2227 Parcel reply = Parcel.obtain();
2228 data.writeInterfaceToken(IActivityManager.descriptor);
2229 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002230 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002231 intent.writeToParcel(data, 0);
2232 data.writeString(resolvedType);
2233 data.writeStrongBinder(resultTo);
2234 data.writeString(resultWho);
2235 data.writeInt(requestCode);
2236 data.writeInt(startFlags);
2237 data.writeString(profileFile);
2238 if (profileFd != null) {
2239 data.writeInt(1);
2240 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2241 } else {
2242 data.writeInt(0);
2243 }
2244 if (options != null) {
2245 data.writeInt(1);
2246 options.writeToParcel(data, 0);
2247 } else {
2248 data.writeInt(0);
2249 }
2250 data.writeInt(userId);
2251 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2252 reply.readException();
2253 int result = reply.readInt();
2254 reply.recycle();
2255 data.recycle();
2256 return result;
2257 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002258 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2259 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002260 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002261 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002262 Parcel data = Parcel.obtain();
2263 Parcel reply = Parcel.obtain();
2264 data.writeInterfaceToken(IActivityManager.descriptor);
2265 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002266 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002267 intent.writeToParcel(data, 0);
2268 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002269 data.writeStrongBinder(resultTo);
2270 data.writeString(resultWho);
2271 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002272 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002273 data.writeString(profileFile);
2274 if (profileFd != null) {
2275 data.writeInt(1);
2276 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2277 } else {
2278 data.writeInt(0);
2279 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002280 if (options != null) {
2281 data.writeInt(1);
2282 options.writeToParcel(data, 0);
2283 } else {
2284 data.writeInt(0);
2285 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002286 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002287 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2288 reply.readException();
2289 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2290 reply.recycle();
2291 data.recycle();
2292 return result;
2293 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002294 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2295 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002296 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002297 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002298 Parcel data = Parcel.obtain();
2299 Parcel reply = Parcel.obtain();
2300 data.writeInterfaceToken(IActivityManager.descriptor);
2301 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002302 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002303 intent.writeToParcel(data, 0);
2304 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002305 data.writeStrongBinder(resultTo);
2306 data.writeString(resultWho);
2307 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002308 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002309 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002310 if (options != null) {
2311 data.writeInt(1);
2312 options.writeToParcel(data, 0);
2313 } else {
2314 data.writeInt(0);
2315 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002316 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002317 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2318 reply.readException();
2319 int result = reply.readInt();
2320 reply.recycle();
2321 data.recycle();
2322 return result;
2323 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002324 public int startActivityIntentSender(IApplicationThread caller,
2325 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002326 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002327 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002328 Parcel data = Parcel.obtain();
2329 Parcel reply = Parcel.obtain();
2330 data.writeInterfaceToken(IActivityManager.descriptor);
2331 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2332 intent.writeToParcel(data, 0);
2333 if (fillInIntent != null) {
2334 data.writeInt(1);
2335 fillInIntent.writeToParcel(data, 0);
2336 } else {
2337 data.writeInt(0);
2338 }
2339 data.writeString(resolvedType);
2340 data.writeStrongBinder(resultTo);
2341 data.writeString(resultWho);
2342 data.writeInt(requestCode);
2343 data.writeInt(flagsMask);
2344 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002345 if (options != null) {
2346 data.writeInt(1);
2347 options.writeToParcel(data, 0);
2348 } else {
2349 data.writeInt(0);
2350 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002351 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002352 reply.readException();
2353 int result = reply.readInt();
2354 reply.recycle();
2355 data.recycle();
2356 return result;
2357 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002358 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002359 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002360 Parcel data = Parcel.obtain();
2361 Parcel reply = Parcel.obtain();
2362 data.writeInterfaceToken(IActivityManager.descriptor);
2363 data.writeStrongBinder(callingActivity);
2364 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002365 if (options != null) {
2366 data.writeInt(1);
2367 options.writeToParcel(data, 0);
2368 } else {
2369 data.writeInt(0);
2370 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002371 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2372 reply.readException();
2373 int result = reply.readInt();
2374 reply.recycle();
2375 data.recycle();
2376 return result != 0;
2377 }
2378 public boolean finishActivity(IBinder token, int resultCode, Intent resultData)
2379 throws RemoteException {
2380 Parcel data = Parcel.obtain();
2381 Parcel reply = Parcel.obtain();
2382 data.writeInterfaceToken(IActivityManager.descriptor);
2383 data.writeStrongBinder(token);
2384 data.writeInt(resultCode);
2385 if (resultData != null) {
2386 data.writeInt(1);
2387 resultData.writeToParcel(data, 0);
2388 } else {
2389 data.writeInt(0);
2390 }
2391 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2392 reply.readException();
2393 boolean res = reply.readInt() != 0;
2394 data.recycle();
2395 reply.recycle();
2396 return res;
2397 }
2398 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2399 {
2400 Parcel data = Parcel.obtain();
2401 Parcel reply = Parcel.obtain();
2402 data.writeInterfaceToken(IActivityManager.descriptor);
2403 data.writeStrongBinder(token);
2404 data.writeString(resultWho);
2405 data.writeInt(requestCode);
2406 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2407 reply.readException();
2408 data.recycle();
2409 reply.recycle();
2410 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002411 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2412 Parcel data = Parcel.obtain();
2413 Parcel reply = Parcel.obtain();
2414 data.writeInterfaceToken(IActivityManager.descriptor);
2415 data.writeStrongBinder(token);
2416 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2417 reply.readException();
2418 boolean res = reply.readInt() != 0;
2419 data.recycle();
2420 reply.recycle();
2421 return res;
2422 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002423 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2424 Parcel data = Parcel.obtain();
2425 Parcel reply = Parcel.obtain();
2426 data.writeInterfaceToken(IActivityManager.descriptor);
2427 data.writeStrongBinder(token);
2428 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2429 reply.readException();
2430 boolean res = reply.readInt() != 0;
2431 data.recycle();
2432 reply.recycle();
2433 return res;
2434 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002435 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002436 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002437 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002438 {
2439 Parcel data = Parcel.obtain();
2440 Parcel reply = Parcel.obtain();
2441 data.writeInterfaceToken(IActivityManager.descriptor);
2442 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002443 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002444 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2445 filter.writeToParcel(data, 0);
2446 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002447 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002448 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 Intent intent = null;
2451 int haveIntent = reply.readInt();
2452 if (haveIntent != 0) {
2453 intent = Intent.CREATOR.createFromParcel(reply);
2454 }
2455 reply.recycle();
2456 data.recycle();
2457 return intent;
2458 }
2459 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2460 {
2461 Parcel data = Parcel.obtain();
2462 Parcel reply = Parcel.obtain();
2463 data.writeInterfaceToken(IActivityManager.descriptor);
2464 data.writeStrongBinder(receiver.asBinder());
2465 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2466 reply.readException();
2467 data.recycle();
2468 reply.recycle();
2469 }
2470 public int broadcastIntent(IApplicationThread caller,
2471 Intent intent, String resolvedType, IIntentReceiver resultTo,
2472 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002473 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002474 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002475 {
2476 Parcel data = Parcel.obtain();
2477 Parcel reply = Parcel.obtain();
2478 data.writeInterfaceToken(IActivityManager.descriptor);
2479 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2480 intent.writeToParcel(data, 0);
2481 data.writeString(resolvedType);
2482 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2483 data.writeInt(resultCode);
2484 data.writeString(resultData);
2485 data.writeBundle(map);
2486 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002487 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488 data.writeInt(serialized ? 1 : 0);
2489 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002490 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002491 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2492 reply.readException();
2493 int res = reply.readInt();
2494 reply.recycle();
2495 data.recycle();
2496 return res;
2497 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002498 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2499 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(caller != null ? caller.asBinder() : null);
2505 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002506 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002507 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2508 reply.readException();
2509 data.recycle();
2510 reply.recycle();
2511 }
2512 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2513 {
2514 Parcel data = Parcel.obtain();
2515 Parcel reply = Parcel.obtain();
2516 data.writeInterfaceToken(IActivityManager.descriptor);
2517 data.writeStrongBinder(who);
2518 data.writeInt(resultCode);
2519 data.writeString(resultData);
2520 data.writeBundle(map);
2521 data.writeInt(abortBroadcast ? 1 : 0);
2522 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2523 reply.readException();
2524 data.recycle();
2525 reply.recycle();
2526 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002527 public void attachApplication(IApplicationThread app) throws RemoteException
2528 {
2529 Parcel data = Parcel.obtain();
2530 Parcel reply = Parcel.obtain();
2531 data.writeInterfaceToken(IActivityManager.descriptor);
2532 data.writeStrongBinder(app.asBinder());
2533 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2534 reply.readException();
2535 data.recycle();
2536 reply.recycle();
2537 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002538 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2539 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002540 {
2541 Parcel data = Parcel.obtain();
2542 Parcel reply = Parcel.obtain();
2543 data.writeInterfaceToken(IActivityManager.descriptor);
2544 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002545 if (config != null) {
2546 data.writeInt(1);
2547 config.writeToParcel(data, 0);
2548 } else {
2549 data.writeInt(0);
2550 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002551 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002552 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2553 reply.readException();
2554 data.recycle();
2555 reply.recycle();
2556 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002557 public void activityResumed(IBinder token) throws RemoteException
2558 {
2559 Parcel data = Parcel.obtain();
2560 Parcel reply = Parcel.obtain();
2561 data.writeInterfaceToken(IActivityManager.descriptor);
2562 data.writeStrongBinder(token);
2563 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2564 reply.readException();
2565 data.recycle();
2566 reply.recycle();
2567 }
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002568 public void activityPaused(IBinder token) throws RemoteException
2569 {
2570 Parcel data = Parcel.obtain();
2571 Parcel reply = Parcel.obtain();
2572 data.writeInterfaceToken(IActivityManager.descriptor);
2573 data.writeStrongBinder(token);
2574 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2575 reply.readException();
2576 data.recycle();
2577 reply.recycle();
2578 }
2579 public void activityStopped(IBinder token, Bundle state,
2580 Bitmap thumbnail, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002581 {
2582 Parcel data = Parcel.obtain();
2583 Parcel reply = Parcel.obtain();
2584 data.writeInterfaceToken(IActivityManager.descriptor);
2585 data.writeStrongBinder(token);
2586 data.writeBundle(state);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002587 if (thumbnail != null) {
2588 data.writeInt(1);
2589 thumbnail.writeToParcel(data, 0);
2590 } else {
2591 data.writeInt(0);
2592 }
2593 TextUtils.writeToParcel(description, data, 0);
2594 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2595 reply.readException();
2596 data.recycle();
2597 reply.recycle();
2598 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002599 public void activitySlept(IBinder token) throws RemoteException
2600 {
2601 Parcel data = Parcel.obtain();
2602 Parcel reply = Parcel.obtain();
2603 data.writeInterfaceToken(IActivityManager.descriptor);
2604 data.writeStrongBinder(token);
2605 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2606 reply.readException();
2607 data.recycle();
2608 reply.recycle();
2609 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002610 public void activityDestroyed(IBinder token) throws RemoteException
2611 {
2612 Parcel data = Parcel.obtain();
2613 Parcel reply = Parcel.obtain();
2614 data.writeInterfaceToken(IActivityManager.descriptor);
2615 data.writeStrongBinder(token);
2616 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2617 reply.readException();
2618 data.recycle();
2619 reply.recycle();
2620 }
2621 public String getCallingPackage(IBinder token) throws RemoteException
2622 {
2623 Parcel data = Parcel.obtain();
2624 Parcel reply = Parcel.obtain();
2625 data.writeInterfaceToken(IActivityManager.descriptor);
2626 data.writeStrongBinder(token);
2627 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2628 reply.readException();
2629 String res = reply.readString();
2630 data.recycle();
2631 reply.recycle();
2632 return res;
2633 }
2634 public ComponentName getCallingActivity(IBinder token)
2635 throws RemoteException {
2636 Parcel data = Parcel.obtain();
2637 Parcel reply = Parcel.obtain();
2638 data.writeInterfaceToken(IActivityManager.descriptor);
2639 data.writeStrongBinder(token);
2640 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2641 reply.readException();
2642 ComponentName res = ComponentName.readFromParcel(reply);
2643 data.recycle();
2644 reply.recycle();
2645 return res;
2646 }
2647 public List getTasks(int maxNum, int flags,
2648 IThumbnailReceiver receiver) throws RemoteException {
2649 Parcel data = Parcel.obtain();
2650 Parcel reply = Parcel.obtain();
2651 data.writeInterfaceToken(IActivityManager.descriptor);
2652 data.writeInt(maxNum);
2653 data.writeInt(flags);
2654 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2655 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2656 reply.readException();
2657 ArrayList list = null;
2658 int N = reply.readInt();
2659 if (N >= 0) {
2660 list = new ArrayList();
2661 while (N > 0) {
2662 ActivityManager.RunningTaskInfo info =
2663 ActivityManager.RunningTaskInfo.CREATOR
2664 .createFromParcel(reply);
2665 list.add(info);
2666 N--;
2667 }
2668 }
2669 data.recycle();
2670 reply.recycle();
2671 return list;
2672 }
2673 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002674 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002675 Parcel data = Parcel.obtain();
2676 Parcel reply = Parcel.obtain();
2677 data.writeInterfaceToken(IActivityManager.descriptor);
2678 data.writeInt(maxNum);
2679 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002680 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002681 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2682 reply.readException();
2683 ArrayList<ActivityManager.RecentTaskInfo> list
2684 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2685 data.recycle();
2686 reply.recycle();
2687 return list;
2688 }
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002689 public ActivityManager.TaskThumbnails getTaskThumbnails(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002690 Parcel data = Parcel.obtain();
2691 Parcel reply = Parcel.obtain();
2692 data.writeInterfaceToken(IActivityManager.descriptor);
2693 data.writeInt(id);
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002694 mRemote.transact(GET_TASK_THUMBNAILS_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002695 reply.readException();
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002696 ActivityManager.TaskThumbnails bm = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002697 if (reply.readInt() != 0) {
Dianne Hackbornf26fd992011-04-08 18:14:09 -07002698 bm = ActivityManager.TaskThumbnails.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002699 }
2700 data.recycle();
2701 reply.recycle();
2702 return bm;
2703 }
Dianne Hackborn15491c62012-09-19 10:59:14 -07002704 public Bitmap getTaskTopThumbnail(int id) throws RemoteException {
2705 Parcel data = Parcel.obtain();
2706 Parcel reply = Parcel.obtain();
2707 data.writeInterfaceToken(IActivityManager.descriptor);
2708 data.writeInt(id);
2709 mRemote.transact(GET_TASK_TOP_THUMBNAIL_TRANSACTION, data, reply, 0);
2710 reply.readException();
2711 Bitmap bm = null;
2712 if (reply.readInt() != 0) {
2713 bm = Bitmap.CREATOR.createFromParcel(reply);
2714 }
2715 data.recycle();
2716 reply.recycle();
2717 return bm;
2718 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002719 public List getServices(int maxNum, int flags) throws RemoteException {
2720 Parcel data = Parcel.obtain();
2721 Parcel reply = Parcel.obtain();
2722 data.writeInterfaceToken(IActivityManager.descriptor);
2723 data.writeInt(maxNum);
2724 data.writeInt(flags);
2725 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2726 reply.readException();
2727 ArrayList list = null;
2728 int N = reply.readInt();
2729 if (N >= 0) {
2730 list = new ArrayList();
2731 while (N > 0) {
2732 ActivityManager.RunningServiceInfo info =
2733 ActivityManager.RunningServiceInfo.CREATOR
2734 .createFromParcel(reply);
2735 list.add(info);
2736 N--;
2737 }
2738 }
2739 data.recycle();
2740 reply.recycle();
2741 return list;
2742 }
2743 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2744 throws RemoteException {
2745 Parcel data = Parcel.obtain();
2746 Parcel reply = Parcel.obtain();
2747 data.writeInterfaceToken(IActivityManager.descriptor);
2748 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2749 reply.readException();
2750 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2751 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2752 data.recycle();
2753 reply.recycle();
2754 return list;
2755 }
2756 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2757 throws RemoteException {
2758 Parcel data = Parcel.obtain();
2759 Parcel reply = Parcel.obtain();
2760 data.writeInterfaceToken(IActivityManager.descriptor);
2761 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2762 reply.readException();
2763 ArrayList<ActivityManager.RunningAppProcessInfo> list
2764 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2765 data.recycle();
2766 reply.recycle();
2767 return list;
2768 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002769 public List<ApplicationInfo> getRunningExternalApplications()
2770 throws RemoteException {
2771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
2773 data.writeInterfaceToken(IActivityManager.descriptor);
2774 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2775 reply.readException();
2776 ArrayList<ApplicationInfo> list
2777 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2778 data.recycle();
2779 reply.recycle();
2780 return list;
2781 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002782 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002783 {
2784 Parcel data = Parcel.obtain();
2785 Parcel reply = Parcel.obtain();
2786 data.writeInterfaceToken(IActivityManager.descriptor);
2787 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002788 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002789 if (options != null) {
2790 data.writeInt(1);
2791 options.writeToParcel(data, 0);
2792 } else {
2793 data.writeInt(0);
2794 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002795 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2796 reply.readException();
2797 data.recycle();
2798 reply.recycle();
2799 }
2800 public void moveTaskToBack(int task) throws RemoteException
2801 {
2802 Parcel data = Parcel.obtain();
2803 Parcel reply = Parcel.obtain();
2804 data.writeInterfaceToken(IActivityManager.descriptor);
2805 data.writeInt(task);
2806 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2807 reply.readException();
2808 data.recycle();
2809 reply.recycle();
2810 }
2811 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2812 throws RemoteException {
2813 Parcel data = Parcel.obtain();
2814 Parcel reply = Parcel.obtain();
2815 data.writeInterfaceToken(IActivityManager.descriptor);
2816 data.writeStrongBinder(token);
2817 data.writeInt(nonRoot ? 1 : 0);
2818 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2819 reply.readException();
2820 boolean res = reply.readInt() != 0;
2821 data.recycle();
2822 reply.recycle();
2823 return res;
2824 }
2825 public void moveTaskBackwards(int task) throws RemoteException
2826 {
2827 Parcel data = Parcel.obtain();
2828 Parcel reply = Parcel.obtain();
2829 data.writeInterfaceToken(IActivityManager.descriptor);
2830 data.writeInt(task);
2831 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2832 reply.readException();
2833 data.recycle();
2834 reply.recycle();
2835 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002836 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002837 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2838 {
2839 Parcel data = Parcel.obtain();
2840 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002841 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002842 data.writeInt(taskId);
2843 data.writeInt(stackId);
2844 data.writeInt(toTop ? 1 : 0);
2845 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2846 reply.readException();
2847 data.recycle();
2848 reply.recycle();
2849 }
2850 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002851 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002852 {
2853 Parcel data = Parcel.obtain();
2854 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002855 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002856 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002857 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002858 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002859 reply.readException();
2860 data.recycle();
2861 reply.recycle();
2862 }
Craig Mautner967212c2013-04-13 21:10:58 -07002863 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002864 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002865 {
2866 Parcel data = Parcel.obtain();
2867 Parcel reply = Parcel.obtain();
2868 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002869 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002870 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002871 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002872 data.recycle();
2873 reply.recycle();
2874 return list;
2875 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002876 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002877 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002878 {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002882 data.writeInt(stackId);
2883 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002884 reply.readException();
2885 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002886 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002887 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002888 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002889 }
2890 data.recycle();
2891 reply.recycle();
2892 return info;
2893 }
2894 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002895 public boolean isInHomeStack(int taskId) throws RemoteException {
2896 Parcel data = Parcel.obtain();
2897 Parcel reply = Parcel.obtain();
2898 data.writeInterfaceToken(IActivityManager.descriptor);
2899 data.writeInt(taskId);
2900 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2901 reply.readException();
2902 boolean isInHomeStack = reply.readInt() > 0;
2903 data.recycle();
2904 reply.recycle();
2905 return isInHomeStack;
2906 }
2907 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002908 public void setFocusedStack(int stackId) throws RemoteException
2909 {
2910 Parcel data = Parcel.obtain();
2911 Parcel reply = Parcel.obtain();
2912 data.writeInterfaceToken(IActivityManager.descriptor);
2913 data.writeInt(stackId);
2914 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2915 reply.readException();
2916 data.recycle();
2917 reply.recycle();
2918 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002919 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2920 {
2921 Parcel data = Parcel.obtain();
2922 Parcel reply = Parcel.obtain();
2923 data.writeInterfaceToken(IActivityManager.descriptor);
2924 data.writeStrongBinder(token);
2925 data.writeInt(onlyRoot ? 1 : 0);
2926 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2927 reply.readException();
2928 int res = reply.readInt();
2929 data.recycle();
2930 reply.recycle();
2931 return res;
2932 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002933 public void reportThumbnail(IBinder token,
2934 Bitmap thumbnail, CharSequence description) throws RemoteException
2935 {
2936 Parcel data = Parcel.obtain();
2937 Parcel reply = Parcel.obtain();
2938 data.writeInterfaceToken(IActivityManager.descriptor);
2939 data.writeStrongBinder(token);
2940 if (thumbnail != null) {
2941 data.writeInt(1);
2942 thumbnail.writeToParcel(data, 0);
2943 } else {
2944 data.writeInt(0);
2945 }
2946 TextUtils.writeToParcel(description, data, 0);
2947 mRemote.transact(REPORT_THUMBNAIL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2948 reply.readException();
2949 data.recycle();
2950 reply.recycle();
2951 }
2952 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002953 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
2957 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2958 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002959 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002960 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002961 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2962 reply.readException();
2963 int res = reply.readInt();
2964 ContentProviderHolder cph = null;
2965 if (res != 0) {
2966 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2967 }
2968 data.recycle();
2969 reply.recycle();
2970 return cph;
2971 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07002972 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
2973 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002974 Parcel data = Parcel.obtain();
2975 Parcel reply = Parcel.obtain();
2976 data.writeInterfaceToken(IActivityManager.descriptor);
2977 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002978 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08002979 data.writeStrongBinder(token);
2980 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
2981 reply.readException();
2982 int res = reply.readInt();
2983 ContentProviderHolder cph = null;
2984 if (res != 0) {
2985 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2986 }
2987 data.recycle();
2988 reply.recycle();
2989 return cph;
2990 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002991 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002992 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002993 {
2994 Parcel data = Parcel.obtain();
2995 Parcel reply = Parcel.obtain();
2996 data.writeInterfaceToken(IActivityManager.descriptor);
2997 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2998 data.writeTypedList(providers);
2999 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3000 reply.readException();
3001 data.recycle();
3002 reply.recycle();
3003 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003004 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3005 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003006 Parcel data = Parcel.obtain();
3007 Parcel reply = Parcel.obtain();
3008 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003009 data.writeStrongBinder(connection);
3010 data.writeInt(stable);
3011 data.writeInt(unstable);
3012 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3013 reply.readException();
3014 boolean res = reply.readInt() != 0;
3015 data.recycle();
3016 reply.recycle();
3017 return res;
3018 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003019
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003020 public void unstableProviderDied(IBinder connection) throws RemoteException {
3021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeStrongBinder(connection);
3025 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3026 reply.readException();
3027 data.recycle();
3028 reply.recycle();
3029 }
3030
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003031 @Override
3032 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3033 Parcel data = Parcel.obtain();
3034 Parcel reply = Parcel.obtain();
3035 data.writeInterfaceToken(IActivityManager.descriptor);
3036 data.writeStrongBinder(connection);
3037 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3038 reply.readException();
3039 data.recycle();
3040 reply.recycle();
3041 }
3042
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003043 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3044 Parcel data = Parcel.obtain();
3045 Parcel reply = Parcel.obtain();
3046 data.writeInterfaceToken(IActivityManager.descriptor);
3047 data.writeStrongBinder(connection);
3048 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3050 reply.readException();
3051 data.recycle();
3052 reply.recycle();
3053 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003054
3055 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3056 Parcel data = Parcel.obtain();
3057 Parcel reply = Parcel.obtain();
3058 data.writeInterfaceToken(IActivityManager.descriptor);
3059 data.writeString(name);
3060 data.writeStrongBinder(token);
3061 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3062 reply.readException();
3063 data.recycle();
3064 reply.recycle();
3065 }
3066
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003067 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3068 throws RemoteException
3069 {
3070 Parcel data = Parcel.obtain();
3071 Parcel reply = Parcel.obtain();
3072 data.writeInterfaceToken(IActivityManager.descriptor);
3073 service.writeToParcel(data, 0);
3074 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3075 reply.readException();
3076 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3077 data.recycle();
3078 reply.recycle();
3079 return res;
3080 }
3081
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003082 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003083 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003084 {
3085 Parcel data = Parcel.obtain();
3086 Parcel reply = Parcel.obtain();
3087 data.writeInterfaceToken(IActivityManager.descriptor);
3088 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3089 service.writeToParcel(data, 0);
3090 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003091 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003092 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3093 reply.readException();
3094 ComponentName res = ComponentName.readFromParcel(reply);
3095 data.recycle();
3096 reply.recycle();
3097 return res;
3098 }
3099 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003100 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003101 {
3102 Parcel data = Parcel.obtain();
3103 Parcel reply = Parcel.obtain();
3104 data.writeInterfaceToken(IActivityManager.descriptor);
3105 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3106 service.writeToParcel(data, 0);
3107 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003108 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003109 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3110 reply.readException();
3111 int res = reply.readInt();
3112 reply.recycle();
3113 data.recycle();
3114 return res;
3115 }
3116 public boolean stopServiceToken(ComponentName className, IBinder token,
3117 int startId) throws RemoteException {
3118 Parcel data = Parcel.obtain();
3119 Parcel reply = Parcel.obtain();
3120 data.writeInterfaceToken(IActivityManager.descriptor);
3121 ComponentName.writeToParcel(className, data);
3122 data.writeStrongBinder(token);
3123 data.writeInt(startId);
3124 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3125 reply.readException();
3126 boolean res = reply.readInt() != 0;
3127 data.recycle();
3128 reply.recycle();
3129 return res;
3130 }
3131 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003132 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003133 Parcel data = Parcel.obtain();
3134 Parcel reply = Parcel.obtain();
3135 data.writeInterfaceToken(IActivityManager.descriptor);
3136 ComponentName.writeToParcel(className, data);
3137 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003138 data.writeInt(id);
3139 if (notification != null) {
3140 data.writeInt(1);
3141 notification.writeToParcel(data, 0);
3142 } else {
3143 data.writeInt(0);
3144 }
3145 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003146 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3147 reply.readException();
3148 data.recycle();
3149 reply.recycle();
3150 }
3151 public int bindService(IApplicationThread caller, IBinder token,
3152 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003153 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003154 Parcel data = Parcel.obtain();
3155 Parcel reply = Parcel.obtain();
3156 data.writeInterfaceToken(IActivityManager.descriptor);
3157 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3158 data.writeStrongBinder(token);
3159 service.writeToParcel(data, 0);
3160 data.writeString(resolvedType);
3161 data.writeStrongBinder(connection.asBinder());
3162 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003163 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003164 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3165 reply.readException();
3166 int res = reply.readInt();
3167 data.recycle();
3168 reply.recycle();
3169 return res;
3170 }
3171 public boolean unbindService(IServiceConnection connection) throws RemoteException
3172 {
3173 Parcel data = Parcel.obtain();
3174 Parcel reply = Parcel.obtain();
3175 data.writeInterfaceToken(IActivityManager.descriptor);
3176 data.writeStrongBinder(connection.asBinder());
3177 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3178 reply.readException();
3179 boolean res = reply.readInt() != 0;
3180 data.recycle();
3181 reply.recycle();
3182 return res;
3183 }
3184
3185 public void publishService(IBinder token,
3186 Intent intent, IBinder service) throws RemoteException {
3187 Parcel data = Parcel.obtain();
3188 Parcel reply = Parcel.obtain();
3189 data.writeInterfaceToken(IActivityManager.descriptor);
3190 data.writeStrongBinder(token);
3191 intent.writeToParcel(data, 0);
3192 data.writeStrongBinder(service);
3193 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3194 reply.readException();
3195 data.recycle();
3196 reply.recycle();
3197 }
3198
3199 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3200 throws RemoteException {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeStrongBinder(token);
3205 intent.writeToParcel(data, 0);
3206 data.writeInt(doRebind ? 1 : 0);
3207 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 data.recycle();
3210 reply.recycle();
3211 }
3212
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003213 public void serviceDoneExecuting(IBinder token, int type, int startId,
3214 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003215 Parcel data = Parcel.obtain();
3216 Parcel reply = Parcel.obtain();
3217 data.writeInterfaceToken(IActivityManager.descriptor);
3218 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003219 data.writeInt(type);
3220 data.writeInt(startId);
3221 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003222 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3223 reply.readException();
3224 data.recycle();
3225 reply.recycle();
3226 }
3227
3228 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 service.writeToParcel(data, 0);
3233 data.writeString(resolvedType);
3234 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3235 reply.readException();
3236 IBinder binder = reply.readStrongBinder();
3237 reply.recycle();
3238 data.recycle();
3239 return binder;
3240 }
3241
Christopher Tate181fafa2009-05-14 11:12:14 -07003242 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3243 throws RemoteException {
3244 Parcel data = Parcel.obtain();
3245 Parcel reply = Parcel.obtain();
3246 data.writeInterfaceToken(IActivityManager.descriptor);
3247 app.writeToParcel(data, 0);
3248 data.writeInt(backupRestoreMode);
3249 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3250 reply.readException();
3251 boolean success = reply.readInt() != 0;
3252 reply.recycle();
3253 data.recycle();
3254 return success;
3255 }
3256
Christopher Tate346acb12012-10-15 19:20:25 -07003257 public void clearPendingBackup() throws RemoteException {
3258 Parcel data = Parcel.obtain();
3259 Parcel reply = Parcel.obtain();
3260 data.writeInterfaceToken(IActivityManager.descriptor);
3261 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3262 reply.recycle();
3263 data.recycle();
3264 }
3265
Christopher Tate181fafa2009-05-14 11:12:14 -07003266 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3267 Parcel data = Parcel.obtain();
3268 Parcel reply = Parcel.obtain();
3269 data.writeInterfaceToken(IActivityManager.descriptor);
3270 data.writeString(packageName);
3271 data.writeStrongBinder(agent);
3272 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3273 reply.recycle();
3274 data.recycle();
3275 }
3276
3277 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3278 Parcel data = Parcel.obtain();
3279 Parcel reply = Parcel.obtain();
3280 data.writeInterfaceToken(IActivityManager.descriptor);
3281 app.writeToParcel(data, 0);
3282 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3283 reply.readException();
3284 reply.recycle();
3285 data.recycle();
3286 }
3287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003288 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003289 int flags, Bundle arguments, IInstrumentationWatcher watcher,
3290 IUiAutomationConnection connection, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 ComponentName.writeToParcel(className, data);
3295 data.writeString(profileFile);
3296 data.writeInt(flags);
3297 data.writeBundle(arguments);
3298 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003299 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003300 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003301 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3302 reply.readException();
3303 boolean res = reply.readInt() != 0;
3304 reply.recycle();
3305 data.recycle();
3306 return res;
3307 }
3308
3309 public void finishInstrumentation(IApplicationThread target,
3310 int resultCode, Bundle results) throws RemoteException {
3311 Parcel data = Parcel.obtain();
3312 Parcel reply = Parcel.obtain();
3313 data.writeInterfaceToken(IActivityManager.descriptor);
3314 data.writeStrongBinder(target != null ? target.asBinder() : null);
3315 data.writeInt(resultCode);
3316 data.writeBundle(results);
3317 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 data.recycle();
3320 reply.recycle();
3321 }
3322 public Configuration getConfiguration() throws RemoteException
3323 {
3324 Parcel data = Parcel.obtain();
3325 Parcel reply = Parcel.obtain();
3326 data.writeInterfaceToken(IActivityManager.descriptor);
3327 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3328 reply.readException();
3329 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3330 reply.recycle();
3331 data.recycle();
3332 return res;
3333 }
3334 public void updateConfiguration(Configuration values) throws RemoteException
3335 {
3336 Parcel data = Parcel.obtain();
3337 Parcel reply = Parcel.obtain();
3338 data.writeInterfaceToken(IActivityManager.descriptor);
3339 values.writeToParcel(data, 0);
3340 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3341 reply.readException();
3342 data.recycle();
3343 reply.recycle();
3344 }
3345 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3346 throws RemoteException {
3347 Parcel data = Parcel.obtain();
3348 Parcel reply = Parcel.obtain();
3349 data.writeInterfaceToken(IActivityManager.descriptor);
3350 data.writeStrongBinder(token);
3351 data.writeInt(requestedOrientation);
3352 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3353 reply.readException();
3354 data.recycle();
3355 reply.recycle();
3356 }
3357 public int getRequestedOrientation(IBinder token) throws RemoteException {
3358 Parcel data = Parcel.obtain();
3359 Parcel reply = Parcel.obtain();
3360 data.writeInterfaceToken(IActivityManager.descriptor);
3361 data.writeStrongBinder(token);
3362 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3363 reply.readException();
3364 int res = reply.readInt();
3365 data.recycle();
3366 reply.recycle();
3367 return res;
3368 }
3369 public ComponentName getActivityClassForToken(IBinder token)
3370 throws RemoteException {
3371 Parcel data = Parcel.obtain();
3372 Parcel reply = Parcel.obtain();
3373 data.writeInterfaceToken(IActivityManager.descriptor);
3374 data.writeStrongBinder(token);
3375 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3376 reply.readException();
3377 ComponentName res = ComponentName.readFromParcel(reply);
3378 data.recycle();
3379 reply.recycle();
3380 return res;
3381 }
3382 public String getPackageForToken(IBinder token) throws RemoteException
3383 {
3384 Parcel data = Parcel.obtain();
3385 Parcel reply = Parcel.obtain();
3386 data.writeInterfaceToken(IActivityManager.descriptor);
3387 data.writeStrongBinder(token);
3388 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3389 reply.readException();
3390 String res = reply.readString();
3391 data.recycle();
3392 reply.recycle();
3393 return res;
3394 }
3395 public IIntentSender getIntentSender(int type,
3396 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003397 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003398 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003399 Parcel data = Parcel.obtain();
3400 Parcel reply = Parcel.obtain();
3401 data.writeInterfaceToken(IActivityManager.descriptor);
3402 data.writeInt(type);
3403 data.writeString(packageName);
3404 data.writeStrongBinder(token);
3405 data.writeString(resultWho);
3406 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003407 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003408 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003409 data.writeTypedArray(intents, 0);
3410 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003411 } else {
3412 data.writeInt(0);
3413 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003414 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003415 if (options != null) {
3416 data.writeInt(1);
3417 options.writeToParcel(data, 0);
3418 } else {
3419 data.writeInt(0);
3420 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003421 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003422 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3423 reply.readException();
3424 IIntentSender res = IIntentSender.Stub.asInterface(
3425 reply.readStrongBinder());
3426 data.recycle();
3427 reply.recycle();
3428 return res;
3429 }
3430 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3431 Parcel data = Parcel.obtain();
3432 Parcel reply = Parcel.obtain();
3433 data.writeInterfaceToken(IActivityManager.descriptor);
3434 data.writeStrongBinder(sender.asBinder());
3435 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3436 reply.readException();
3437 data.recycle();
3438 reply.recycle();
3439 }
3440 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3441 Parcel data = Parcel.obtain();
3442 Parcel reply = Parcel.obtain();
3443 data.writeInterfaceToken(IActivityManager.descriptor);
3444 data.writeStrongBinder(sender.asBinder());
3445 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3446 reply.readException();
3447 String res = reply.readString();
3448 data.recycle();
3449 reply.recycle();
3450 return res;
3451 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003452 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3453 Parcel data = Parcel.obtain();
3454 Parcel reply = Parcel.obtain();
3455 data.writeInterfaceToken(IActivityManager.descriptor);
3456 data.writeStrongBinder(sender.asBinder());
3457 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3458 reply.readException();
3459 int res = reply.readInt();
3460 data.recycle();
3461 reply.recycle();
3462 return res;
3463 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003464 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3465 boolean requireFull, String name, String callerPackage) throws RemoteException {
3466 Parcel data = Parcel.obtain();
3467 Parcel reply = Parcel.obtain();
3468 data.writeInterfaceToken(IActivityManager.descriptor);
3469 data.writeInt(callingPid);
3470 data.writeInt(callingUid);
3471 data.writeInt(userId);
3472 data.writeInt(allowAll ? 1 : 0);
3473 data.writeInt(requireFull ? 1 : 0);
3474 data.writeString(name);
3475 data.writeString(callerPackage);
3476 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3477 reply.readException();
3478 int res = reply.readInt();
3479 data.recycle();
3480 reply.recycle();
3481 return res;
3482 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003483 public void setProcessLimit(int max) throws RemoteException
3484 {
3485 Parcel data = Parcel.obtain();
3486 Parcel reply = Parcel.obtain();
3487 data.writeInterfaceToken(IActivityManager.descriptor);
3488 data.writeInt(max);
3489 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3490 reply.readException();
3491 data.recycle();
3492 reply.recycle();
3493 }
3494 public int getProcessLimit() throws RemoteException
3495 {
3496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
3498 data.writeInterfaceToken(IActivityManager.descriptor);
3499 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3500 reply.readException();
3501 int res = reply.readInt();
3502 data.recycle();
3503 reply.recycle();
3504 return res;
3505 }
3506 public void setProcessForeground(IBinder token, int pid,
3507 boolean isForeground) throws RemoteException {
3508 Parcel data = Parcel.obtain();
3509 Parcel reply = Parcel.obtain();
3510 data.writeInterfaceToken(IActivityManager.descriptor);
3511 data.writeStrongBinder(token);
3512 data.writeInt(pid);
3513 data.writeInt(isForeground ? 1 : 0);
3514 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3515 reply.readException();
3516 data.recycle();
3517 reply.recycle();
3518 }
3519 public int checkPermission(String permission, int pid, int uid)
3520 throws RemoteException {
3521 Parcel data = Parcel.obtain();
3522 Parcel reply = Parcel.obtain();
3523 data.writeInterfaceToken(IActivityManager.descriptor);
3524 data.writeString(permission);
3525 data.writeInt(pid);
3526 data.writeInt(uid);
3527 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3528 reply.readException();
3529 int res = reply.readInt();
3530 data.recycle();
3531 reply.recycle();
3532 return res;
3533 }
3534 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003535 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003536 Parcel data = Parcel.obtain();
3537 Parcel reply = Parcel.obtain();
3538 data.writeInterfaceToken(IActivityManager.descriptor);
3539 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003540 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003541 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003542 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 boolean res = reply.readInt() != 0;
3545 data.recycle();
3546 reply.recycle();
3547 return res;
3548 }
3549 public int checkUriPermission(Uri uri, int pid, int uid, int mode)
3550 throws RemoteException {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 uri.writeToParcel(data, 0);
3555 data.writeInt(pid);
3556 data.writeInt(uid);
3557 data.writeInt(mode);
3558 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3559 reply.readException();
3560 int res = reply.readInt();
3561 data.recycle();
3562 reply.recycle();
3563 return res;
3564 }
3565 public void grantUriPermission(IApplicationThread caller, String targetPkg,
3566 Uri uri, int mode) throws RemoteException {
3567 Parcel data = Parcel.obtain();
3568 Parcel reply = Parcel.obtain();
3569 data.writeInterfaceToken(IActivityManager.descriptor);
3570 data.writeStrongBinder(caller.asBinder());
3571 data.writeString(targetPkg);
3572 uri.writeToParcel(data, 0);
3573 data.writeInt(mode);
3574 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 data.recycle();
3577 reply.recycle();
3578 }
3579 public void revokeUriPermission(IApplicationThread caller, Uri uri,
3580 int mode) throws RemoteException {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 data.writeStrongBinder(caller.asBinder());
3585 uri.writeToParcel(data, 0);
3586 data.writeInt(mode);
3587 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3588 reply.readException();
3589 data.recycle();
3590 reply.recycle();
3591 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003592
3593 @Override
3594 public void takePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3595 Parcel data = Parcel.obtain();
3596 Parcel reply = Parcel.obtain();
3597 data.writeInterfaceToken(IActivityManager.descriptor);
3598 uri.writeToParcel(data, 0);
3599 data.writeInt(mode);
3600 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 data.recycle();
3603 reply.recycle();
3604 }
3605
3606 @Override
3607 public void releasePersistableUriPermission(Uri uri, int mode) throws RemoteException {
3608 Parcel data = Parcel.obtain();
3609 Parcel reply = Parcel.obtain();
3610 data.writeInterfaceToken(IActivityManager.descriptor);
3611 uri.writeToParcel(data, 0);
3612 data.writeInt(mode);
3613 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3614 reply.readException();
3615 data.recycle();
3616 reply.recycle();
3617 }
3618
3619 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003620 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3621 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003622 Parcel data = Parcel.obtain();
3623 Parcel reply = Parcel.obtain();
3624 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003625 data.writeString(packageName);
3626 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003627 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3628 reply.readException();
3629 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3630 reply);
3631 data.recycle();
3632 reply.recycle();
3633 return perms;
3634 }
3635
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003636 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3637 throws RemoteException {
3638 Parcel data = Parcel.obtain();
3639 Parcel reply = Parcel.obtain();
3640 data.writeInterfaceToken(IActivityManager.descriptor);
3641 data.writeStrongBinder(who.asBinder());
3642 data.writeInt(waiting ? 1 : 0);
3643 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3644 reply.readException();
3645 data.recycle();
3646 reply.recycle();
3647 }
3648 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3649 Parcel data = Parcel.obtain();
3650 Parcel reply = Parcel.obtain();
3651 data.writeInterfaceToken(IActivityManager.descriptor);
3652 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3653 reply.readException();
3654 outInfo.readFromParcel(reply);
3655 data.recycle();
3656 reply.recycle();
3657 }
3658 public void unhandledBack() throws RemoteException
3659 {
3660 Parcel data = Parcel.obtain();
3661 Parcel reply = Parcel.obtain();
3662 data.writeInterfaceToken(IActivityManager.descriptor);
3663 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3664 reply.readException();
3665 data.recycle();
3666 reply.recycle();
3667 }
3668 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3669 {
3670 Parcel data = Parcel.obtain();
3671 Parcel reply = Parcel.obtain();
3672 data.writeInterfaceToken(IActivityManager.descriptor);
3673 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3674 reply.readException();
3675 ParcelFileDescriptor pfd = null;
3676 if (reply.readInt() != 0) {
3677 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3678 }
3679 data.recycle();
3680 reply.recycle();
3681 return pfd;
3682 }
3683 public void goingToSleep() throws RemoteException
3684 {
3685 Parcel data = Parcel.obtain();
3686 Parcel reply = Parcel.obtain();
3687 data.writeInterfaceToken(IActivityManager.descriptor);
3688 mRemote.transact(GOING_TO_SLEEP_TRANSACTION, data, reply, 0);
3689 reply.readException();
3690 data.recycle();
3691 reply.recycle();
3692 }
3693 public void wakingUp() throws RemoteException
3694 {
3695 Parcel data = Parcel.obtain();
3696 Parcel reply = Parcel.obtain();
3697 data.writeInterfaceToken(IActivityManager.descriptor);
3698 mRemote.transact(WAKING_UP_TRANSACTION, data, reply, 0);
3699 reply.readException();
3700 data.recycle();
3701 reply.recycle();
3702 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003703 public void setLockScreenShown(boolean shown) throws RemoteException
3704 {
3705 Parcel data = Parcel.obtain();
3706 Parcel reply = Parcel.obtain();
3707 data.writeInterfaceToken(IActivityManager.descriptor);
3708 data.writeInt(shown ? 1 : 0);
3709 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3710 reply.readException();
3711 data.recycle();
3712 reply.recycle();
3713 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003714 public void setDebugApp(
3715 String packageName, boolean waitForDebugger, boolean persistent)
3716 throws RemoteException
3717 {
3718 Parcel data = Parcel.obtain();
3719 Parcel reply = Parcel.obtain();
3720 data.writeInterfaceToken(IActivityManager.descriptor);
3721 data.writeString(packageName);
3722 data.writeInt(waitForDebugger ? 1 : 0);
3723 data.writeInt(persistent ? 1 : 0);
3724 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3725 reply.readException();
3726 data.recycle();
3727 reply.recycle();
3728 }
3729 public void setAlwaysFinish(boolean enabled) throws RemoteException
3730 {
3731 Parcel data = Parcel.obtain();
3732 Parcel reply = Parcel.obtain();
3733 data.writeInterfaceToken(IActivityManager.descriptor);
3734 data.writeInt(enabled ? 1 : 0);
3735 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3736 reply.readException();
3737 data.recycle();
3738 reply.recycle();
3739 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003740 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003741 {
3742 Parcel data = Parcel.obtain();
3743 Parcel reply = Parcel.obtain();
3744 data.writeInterfaceToken(IActivityManager.descriptor);
3745 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003746 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003747 reply.readException();
3748 data.recycle();
3749 reply.recycle();
3750 }
3751 public void enterSafeMode() throws RemoteException {
3752 Parcel data = Parcel.obtain();
3753 data.writeInterfaceToken(IActivityManager.descriptor);
3754 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3755 data.recycle();
3756 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003757 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3758 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003759 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003760 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003761 data.writeStrongBinder(sender.asBinder());
3762 data.writeInt(sourceUid);
3763 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003764 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3765 data.recycle();
3766 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003767 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003768 Parcel data = Parcel.obtain();
3769 Parcel reply = Parcel.obtain();
3770 data.writeInterfaceToken(IActivityManager.descriptor);
3771 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003772 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003773 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003774 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003775 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003776 boolean res = reply.readInt() != 0;
3777 data.recycle();
3778 reply.recycle();
3779 return res;
3780 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003781 @Override
3782 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3783 Parcel data = Parcel.obtain();
3784 Parcel reply = Parcel.obtain();
3785 data.writeInterfaceToken(IActivityManager.descriptor);
3786 data.writeString(reason);
3787 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3788 boolean res = reply.readInt() != 0;
3789 data.recycle();
3790 reply.recycle();
3791 return res;
3792 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 public void startRunning(String pkg, String cls, String action,
3794 String indata) throws RemoteException {
3795 Parcel data = Parcel.obtain();
3796 Parcel reply = Parcel.obtain();
3797 data.writeInterfaceToken(IActivityManager.descriptor);
3798 data.writeString(pkg);
3799 data.writeString(cls);
3800 data.writeString(action);
3801 data.writeString(indata);
3802 mRemote.transact(START_RUNNING_TRANSACTION, data, reply, 0);
3803 reply.readException();
3804 data.recycle();
3805 reply.recycle();
3806 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003807 public boolean testIsSystemReady()
3808 {
3809 /* this base class version is never called */
3810 return true;
3811 }
Dan Egnor60d87622009-12-16 16:32:58 -08003812 public void handleApplicationCrash(IBinder app,
3813 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3814 {
3815 Parcel data = Parcel.obtain();
3816 Parcel reply = Parcel.obtain();
3817 data.writeInterfaceToken(IActivityManager.descriptor);
3818 data.writeStrongBinder(app);
3819 crashInfo.writeToParcel(data, 0);
3820 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3821 reply.readException();
3822 reply.recycle();
3823 data.recycle();
3824 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003825
Dan Egnor60d87622009-12-16 16:32:58 -08003826 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003827 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003828 {
3829 Parcel data = Parcel.obtain();
3830 Parcel reply = Parcel.obtain();
3831 data.writeInterfaceToken(IActivityManager.descriptor);
3832 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003833 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003834 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003835 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003837 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003838 reply.recycle();
3839 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003840 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003842
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003843 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003844 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003845 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003846 {
3847 Parcel data = Parcel.obtain();
3848 Parcel reply = Parcel.obtain();
3849 data.writeInterfaceToken(IActivityManager.descriptor);
3850 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003851 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003852 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003853 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3854 reply.readException();
3855 reply.recycle();
3856 data.recycle();
3857 }
3858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003859 public void signalPersistentProcesses(int sig) throws RemoteException {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeInt(sig);
3864 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3865 reply.readException();
3866 data.recycle();
3867 reply.recycle();
3868 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003869
Dianne Hackborn1676c852012-09-10 14:52:30 -07003870 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003871 Parcel data = Parcel.obtain();
3872 Parcel reply = Parcel.obtain();
3873 data.writeInterfaceToken(IActivityManager.descriptor);
3874 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003875 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003876 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3877 reply.readException();
3878 data.recycle();
3879 reply.recycle();
3880 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003881
3882 public void killAllBackgroundProcesses() throws RemoteException {
3883 Parcel data = Parcel.obtain();
3884 Parcel reply = Parcel.obtain();
3885 data.writeInterfaceToken(IActivityManager.descriptor);
3886 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3887 reply.readException();
3888 data.recycle();
3889 reply.recycle();
3890 }
3891
Dianne Hackborn1676c852012-09-10 14:52:30 -07003892 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003897 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003898 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003899 reply.readException();
3900 data.recycle();
3901 reply.recycle();
3902 }
3903
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003904 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3905 throws RemoteException
3906 {
3907 Parcel data = Parcel.obtain();
3908 Parcel reply = Parcel.obtain();
3909 data.writeInterfaceToken(IActivityManager.descriptor);
3910 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3911 reply.readException();
3912 outInfo.readFromParcel(reply);
3913 reply.recycle();
3914 data.recycle();
3915 }
3916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003917 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3918 {
3919 Parcel data = Parcel.obtain();
3920 Parcel reply = Parcel.obtain();
3921 data.writeInterfaceToken(IActivityManager.descriptor);
3922 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3923 reply.readException();
3924 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3925 reply.recycle();
3926 data.recycle();
3927 return res;
3928 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003929
Dianne Hackborn1676c852012-09-10 14:52:30 -07003930 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003931 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003932 {
3933 Parcel data = Parcel.obtain();
3934 Parcel reply = Parcel.obtain();
3935 data.writeInterfaceToken(IActivityManager.descriptor);
3936 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003937 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003938 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003939 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003940 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003941 if (fd != null) {
3942 data.writeInt(1);
3943 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3944 } else {
3945 data.writeInt(0);
3946 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003947 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3948 reply.readException();
3949 boolean res = reply.readInt() != 0;
3950 reply.recycle();
3951 data.recycle();
3952 return res;
3953 }
3954
Dianne Hackborn55280a92009-05-07 15:53:46 -07003955 public boolean shutdown(int timeout) throws RemoteException
3956 {
3957 Parcel data = Parcel.obtain();
3958 Parcel reply = Parcel.obtain();
3959 data.writeInterfaceToken(IActivityManager.descriptor);
3960 data.writeInt(timeout);
3961 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3962 reply.readException();
3963 boolean res = reply.readInt() != 0;
3964 reply.recycle();
3965 data.recycle();
3966 return res;
3967 }
3968
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003969 public void stopAppSwitches() throws RemoteException {
3970 Parcel data = Parcel.obtain();
3971 Parcel reply = Parcel.obtain();
3972 data.writeInterfaceToken(IActivityManager.descriptor);
3973 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3974 reply.readException();
3975 reply.recycle();
3976 data.recycle();
3977 }
3978
3979 public void resumeAppSwitches() throws RemoteException {
3980 Parcel data = Parcel.obtain();
3981 Parcel reply = Parcel.obtain();
3982 data.writeInterfaceToken(IActivityManager.descriptor);
3983 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3984 reply.readException();
3985 reply.recycle();
3986 data.recycle();
3987 }
3988
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003989 public void killApplicationWithAppId(String pkg, int appid, String reason)
3990 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003991 Parcel data = Parcel.obtain();
3992 Parcel reply = Parcel.obtain();
3993 data.writeInterfaceToken(IActivityManager.descriptor);
3994 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003995 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003996 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003997 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003998 reply.readException();
3999 data.recycle();
4000 reply.recycle();
4001 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004002
4003 public void closeSystemDialogs(String reason) throws RemoteException {
4004 Parcel data = Parcel.obtain();
4005 Parcel reply = Parcel.obtain();
4006 data.writeInterfaceToken(IActivityManager.descriptor);
4007 data.writeString(reason);
4008 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4009 reply.readException();
4010 data.recycle();
4011 reply.recycle();
4012 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004013
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004014 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004015 throws RemoteException {
4016 Parcel data = Parcel.obtain();
4017 Parcel reply = Parcel.obtain();
4018 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004019 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004020 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4021 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004022 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004023 data.recycle();
4024 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004025 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004026 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004027
4028 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4029 Parcel data = Parcel.obtain();
4030 Parcel reply = Parcel.obtain();
4031 data.writeInterfaceToken(IActivityManager.descriptor);
4032 data.writeString(processName);
4033 data.writeInt(uid);
4034 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4035 reply.readException();
4036 data.recycle();
4037 reply.recycle();
4038 }
4039
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004040 public void overridePendingTransition(IBinder token, String packageName,
4041 int enterAnim, int exitAnim) throws RemoteException {
4042 Parcel data = Parcel.obtain();
4043 Parcel reply = Parcel.obtain();
4044 data.writeInterfaceToken(IActivityManager.descriptor);
4045 data.writeStrongBinder(token);
4046 data.writeString(packageName);
4047 data.writeInt(enterAnim);
4048 data.writeInt(exitAnim);
4049 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4050 reply.readException();
4051 data.recycle();
4052 reply.recycle();
4053 }
4054
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004055 public boolean isUserAMonkey() throws RemoteException {
4056 Parcel data = Parcel.obtain();
4057 Parcel reply = Parcel.obtain();
4058 data.writeInterfaceToken(IActivityManager.descriptor);
4059 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4060 reply.readException();
4061 boolean res = reply.readInt() != 0;
4062 data.recycle();
4063 reply.recycle();
4064 return res;
4065 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004066
4067 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4068 Parcel data = Parcel.obtain();
4069 Parcel reply = Parcel.obtain();
4070 data.writeInterfaceToken(IActivityManager.descriptor);
4071 data.writeInt(monkey ? 1 : 0);
4072 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4073 reply.readException();
4074 data.recycle();
4075 reply.recycle();
4076 }
4077
Dianne Hackborn860755f2010-06-03 18:47:52 -07004078 public void finishHeavyWeightApp() throws RemoteException {
4079 Parcel data = Parcel.obtain();
4080 Parcel reply = Parcel.obtain();
4081 data.writeInterfaceToken(IActivityManager.descriptor);
4082 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4083 reply.readException();
4084 data.recycle();
4085 reply.recycle();
4086 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004087
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004088 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004089 throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004094 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4095 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004096 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004097 data.recycle();
4098 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004099 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004100 }
4101
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004102 public boolean convertToTranslucent(IBinder token)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004103 throws RemoteException {
4104 Parcel data = Parcel.obtain();
4105 Parcel reply = Parcel.obtain();
4106 data.writeInterfaceToken(IActivityManager.descriptor);
4107 data.writeStrongBinder(token);
4108 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004109 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004110 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004111 data.recycle();
4112 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004113 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004114 }
4115
Daniel Sandler69a48172010-06-23 16:29:36 -04004116 public void setImmersive(IBinder token, boolean immersive)
4117 throws RemoteException {
4118 Parcel data = Parcel.obtain();
4119 Parcel reply = Parcel.obtain();
4120 data.writeInterfaceToken(IActivityManager.descriptor);
4121 data.writeStrongBinder(token);
4122 data.writeInt(immersive ? 1 : 0);
4123 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4124 reply.readException();
4125 data.recycle();
4126 reply.recycle();
4127 }
4128
4129 public boolean isImmersive(IBinder token)
4130 throws RemoteException {
4131 Parcel data = Parcel.obtain();
4132 Parcel reply = Parcel.obtain();
4133 data.writeInterfaceToken(IActivityManager.descriptor);
4134 data.writeStrongBinder(token);
4135 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004136 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004137 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004138 data.recycle();
4139 reply.recycle();
4140 return res;
4141 }
4142
4143 public boolean isTopActivityImmersive()
4144 throws RemoteException {
4145 Parcel data = Parcel.obtain();
4146 Parcel reply = Parcel.obtain();
4147 data.writeInterfaceToken(IActivityManager.descriptor);
4148 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004149 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004150 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004151 data.recycle();
4152 reply.recycle();
4153 return res;
4154 }
4155
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004156 public void crashApplication(int uid, int initialPid, String packageName,
4157 String message) throws RemoteException {
4158 Parcel data = Parcel.obtain();
4159 Parcel reply = Parcel.obtain();
4160 data.writeInterfaceToken(IActivityManager.descriptor);
4161 data.writeInt(uid);
4162 data.writeInt(initialPid);
4163 data.writeString(packageName);
4164 data.writeString(message);
4165 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 data.recycle();
4168 reply.recycle();
4169 }
Andy McFadden824c5102010-07-09 16:26:57 -07004170
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004171 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004172 Parcel data = Parcel.obtain();
4173 Parcel reply = Parcel.obtain();
4174 data.writeInterfaceToken(IActivityManager.descriptor);
4175 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004176 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004177 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4178 reply.readException();
4179 String res = reply.readString();
4180 data.recycle();
4181 reply.recycle();
4182 return res;
4183 }
4184
Dianne Hackborn7e269642010-08-25 19:50:20 -07004185 public IBinder newUriPermissionOwner(String name)
4186 throws RemoteException {
4187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 data.writeString(name);
4191 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4192 reply.readException();
4193 IBinder res = reply.readStrongBinder();
4194 data.recycle();
4195 reply.recycle();
4196 return res;
4197 }
4198
4199 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
4200 Uri uri, int mode) throws RemoteException {
4201 Parcel data = Parcel.obtain();
4202 Parcel reply = Parcel.obtain();
4203 data.writeInterfaceToken(IActivityManager.descriptor);
4204 data.writeStrongBinder(owner);
4205 data.writeInt(fromUid);
4206 data.writeString(targetPkg);
4207 uri.writeToParcel(data, 0);
4208 data.writeInt(mode);
4209 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4210 reply.readException();
4211 data.recycle();
4212 reply.recycle();
4213 }
4214
4215 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
4216 int mode) throws RemoteException {
4217 Parcel data = Parcel.obtain();
4218 Parcel reply = Parcel.obtain();
4219 data.writeInterfaceToken(IActivityManager.descriptor);
4220 data.writeStrongBinder(owner);
4221 if (uri != null) {
4222 data.writeInt(1);
4223 uri.writeToParcel(data, 0);
4224 } else {
4225 data.writeInt(0);
4226 }
4227 data.writeInt(mode);
4228 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4229 reply.readException();
4230 data.recycle();
4231 reply.recycle();
4232 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004233
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004234 public int checkGrantUriPermission(int callingUid, String targetPkg,
4235 Uri uri, int modeFlags) throws RemoteException {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 data.writeInt(callingUid);
4240 data.writeString(targetPkg);
4241 uri.writeToParcel(data, 0);
4242 data.writeInt(modeFlags);
4243 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4244 reply.readException();
4245 int res = reply.readInt();
4246 data.recycle();
4247 reply.recycle();
4248 return res;
4249 }
4250
Dianne Hackborn1676c852012-09-10 14:52:30 -07004251 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004252 String path, ParcelFileDescriptor fd) throws RemoteException {
4253 Parcel data = Parcel.obtain();
4254 Parcel reply = Parcel.obtain();
4255 data.writeInterfaceToken(IActivityManager.descriptor);
4256 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004257 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004258 data.writeInt(managed ? 1 : 0);
4259 data.writeString(path);
4260 if (fd != null) {
4261 data.writeInt(1);
4262 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4263 } else {
4264 data.writeInt(0);
4265 }
4266 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4267 reply.readException();
4268 boolean res = reply.readInt() != 0;
4269 reply.recycle();
4270 data.recycle();
4271 return res;
4272 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004273
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004274 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004275 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004276 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004277 Parcel data = Parcel.obtain();
4278 Parcel reply = Parcel.obtain();
4279 data.writeInterfaceToken(IActivityManager.descriptor);
4280 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004281 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004282 data.writeTypedArray(intents, 0);
4283 data.writeStringArray(resolvedTypes);
4284 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004285 if (options != null) {
4286 data.writeInt(1);
4287 options.writeToParcel(data, 0);
4288 } else {
4289 data.writeInt(0);
4290 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004291 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004292 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 int result = reply.readInt();
4295 reply.recycle();
4296 data.recycle();
4297 return result;
4298 }
4299
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004300 public int getFrontActivityScreenCompatMode() throws RemoteException {
4301 Parcel data = Parcel.obtain();
4302 Parcel reply = Parcel.obtain();
4303 data.writeInterfaceToken(IActivityManager.descriptor);
4304 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4305 reply.readException();
4306 int mode = reply.readInt();
4307 reply.recycle();
4308 data.recycle();
4309 return mode;
4310 }
4311
4312 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4313 Parcel data = Parcel.obtain();
4314 Parcel reply = Parcel.obtain();
4315 data.writeInterfaceToken(IActivityManager.descriptor);
4316 data.writeInt(mode);
4317 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4318 reply.readException();
4319 reply.recycle();
4320 data.recycle();
4321 }
4322
4323 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4324 Parcel data = Parcel.obtain();
4325 Parcel reply = Parcel.obtain();
4326 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004327 data.writeString(packageName);
4328 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004329 reply.readException();
4330 int mode = reply.readInt();
4331 reply.recycle();
4332 data.recycle();
4333 return mode;
4334 }
4335
4336 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004337 throws RemoteException {
4338 Parcel data = Parcel.obtain();
4339 Parcel reply = Parcel.obtain();
4340 data.writeInterfaceToken(IActivityManager.descriptor);
4341 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004342 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004343 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4344 reply.readException();
4345 reply.recycle();
4346 data.recycle();
4347 }
4348
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004349 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4350 Parcel data = Parcel.obtain();
4351 Parcel reply = Parcel.obtain();
4352 data.writeInterfaceToken(IActivityManager.descriptor);
4353 data.writeString(packageName);
4354 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4355 reply.readException();
4356 boolean ask = reply.readInt() != 0;
4357 reply.recycle();
4358 data.recycle();
4359 return ask;
4360 }
4361
4362 public void setPackageAskScreenCompat(String packageName, boolean ask)
4363 throws RemoteException {
4364 Parcel data = Parcel.obtain();
4365 Parcel reply = Parcel.obtain();
4366 data.writeInterfaceToken(IActivityManager.descriptor);
4367 data.writeString(packageName);
4368 data.writeInt(ask ? 1 : 0);
4369 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4370 reply.readException();
4371 reply.recycle();
4372 data.recycle();
4373 }
4374
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004375 public boolean switchUser(int userid) throws RemoteException {
4376 Parcel data = Parcel.obtain();
4377 Parcel reply = Parcel.obtain();
4378 data.writeInterfaceToken(IActivityManager.descriptor);
4379 data.writeInt(userid);
4380 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4381 reply.readException();
4382 boolean result = reply.readInt() != 0;
4383 reply.recycle();
4384 data.recycle();
4385 return result;
4386 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004387
Kenny Guy08488bf2014-02-21 17:40:37 +00004388 public boolean startUserInBackground(int userid) throws RemoteException {
4389 Parcel data = Parcel.obtain();
4390 Parcel reply = Parcel.obtain();
4391 data.writeInterfaceToken(IActivityManager.descriptor);
4392 data.writeInt(userid);
4393 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4394 reply.readException();
4395 boolean result = reply.readInt() != 0;
4396 reply.recycle();
4397 data.recycle();
4398 return result;
4399 }
4400
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004401 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 data.writeInt(userid);
4406 data.writeStrongInterface(callback);
4407 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4408 reply.readException();
4409 int result = reply.readInt();
4410 reply.recycle();
4411 data.recycle();
4412 return result;
4413 }
4414
Amith Yamasani52f1d752012-03-28 18:19:29 -07004415 public UserInfo getCurrentUser() throws RemoteException {
4416 Parcel data = Parcel.obtain();
4417 Parcel reply = Parcel.obtain();
4418 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004419 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004420 reply.readException();
4421 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4422 reply.recycle();
4423 data.recycle();
4424 return userInfo;
4425 }
4426
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004427 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004428 Parcel data = Parcel.obtain();
4429 Parcel reply = Parcel.obtain();
4430 data.writeInterfaceToken(IActivityManager.descriptor);
4431 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004432 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004433 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4434 reply.readException();
4435 boolean result = reply.readInt() != 0;
4436 reply.recycle();
4437 data.recycle();
4438 return result;
4439 }
4440
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004441 public int[] getRunningUserIds() throws RemoteException {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
4445 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4446 reply.readException();
4447 int[] result = reply.createIntArray();
4448 reply.recycle();
4449 data.recycle();
4450 return result;
4451 }
4452
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004453 public boolean removeSubTask(int taskId, int subTaskIndex) throws RemoteException {
4454 Parcel data = Parcel.obtain();
4455 Parcel reply = Parcel.obtain();
4456 data.writeInterfaceToken(IActivityManager.descriptor);
4457 data.writeInt(taskId);
4458 data.writeInt(subTaskIndex);
4459 mRemote.transact(REMOVE_SUB_TASK_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 boolean result = reply.readInt() != 0;
4462 reply.recycle();
4463 data.recycle();
4464 return result;
4465 }
4466
4467 public boolean removeTask(int taskId, int flags) throws RemoteException {
4468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 data.writeInt(taskId);
4472 data.writeInt(flags);
4473 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4474 reply.readException();
4475 boolean result = reply.readInt() != 0;
4476 reply.recycle();
4477 data.recycle();
4478 return result;
4479 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004480
Jeff Sharkeya4620792011-05-20 15:29:23 -07004481 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4482 Parcel data = Parcel.obtain();
4483 Parcel reply = Parcel.obtain();
4484 data.writeInterfaceToken(IActivityManager.descriptor);
4485 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4486 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4487 reply.readException();
4488 data.recycle();
4489 reply.recycle();
4490 }
4491
4492 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4493 Parcel data = Parcel.obtain();
4494 Parcel reply = Parcel.obtain();
4495 data.writeInterfaceToken(IActivityManager.descriptor);
4496 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4497 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4498 reply.readException();
4499 data.recycle();
4500 reply.recycle();
4501 }
4502
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004503 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4504 Parcel data = Parcel.obtain();
4505 Parcel reply = Parcel.obtain();
4506 data.writeInterfaceToken(IActivityManager.descriptor);
4507 data.writeStrongBinder(sender.asBinder());
4508 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4509 reply.readException();
4510 boolean res = reply.readInt() != 0;
4511 data.recycle();
4512 reply.recycle();
4513 return res;
4514 }
4515
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004516 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4517 Parcel data = Parcel.obtain();
4518 Parcel reply = Parcel.obtain();
4519 data.writeInterfaceToken(IActivityManager.descriptor);
4520 data.writeStrongBinder(sender.asBinder());
4521 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4522 reply.readException();
4523 boolean res = reply.readInt() != 0;
4524 data.recycle();
4525 reply.recycle();
4526 return res;
4527 }
4528
Dianne Hackborn81038902012-11-26 17:04:09 -08004529 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4530 Parcel data = Parcel.obtain();
4531 Parcel reply = Parcel.obtain();
4532 data.writeInterfaceToken(IActivityManager.descriptor);
4533 data.writeStrongBinder(sender.asBinder());
4534 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4535 reply.readException();
4536 Intent res = reply.readInt() != 0
4537 ? Intent.CREATOR.createFromParcel(reply) : null;
4538 data.recycle();
4539 reply.recycle();
4540 return res;
4541 }
4542
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004543 public String getTagForIntentSender(IIntentSender sender, String prefix)
4544 throws RemoteException {
4545 Parcel data = Parcel.obtain();
4546 Parcel reply = Parcel.obtain();
4547 data.writeInterfaceToken(IActivityManager.descriptor);
4548 data.writeStrongBinder(sender.asBinder());
4549 data.writeString(prefix);
4550 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4551 reply.readException();
4552 String res = reply.readString();
4553 data.recycle();
4554 reply.recycle();
4555 return res;
4556 }
4557
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004558 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4559 {
4560 Parcel data = Parcel.obtain();
4561 Parcel reply = Parcel.obtain();
4562 data.writeInterfaceToken(IActivityManager.descriptor);
4563 values.writeToParcel(data, 0);
4564 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4565 reply.readException();
4566 data.recycle();
4567 reply.recycle();
4568 }
4569
Dianne Hackbornb437e092011-08-05 17:50:29 -07004570 public long[] getProcessPss(int[] pids) throws RemoteException {
4571 Parcel data = Parcel.obtain();
4572 Parcel reply = Parcel.obtain();
4573 data.writeInterfaceToken(IActivityManager.descriptor);
4574 data.writeIntArray(pids);
4575 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4576 reply.readException();
4577 long[] res = reply.createLongArray();
4578 data.recycle();
4579 reply.recycle();
4580 return res;
4581 }
4582
Dianne Hackborn661cd522011-08-22 00:26:20 -07004583 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 TextUtils.writeToParcel(msg, data, 0);
4588 data.writeInt(always ? 1 : 0);
4589 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4590 reply.readException();
4591 data.recycle();
4592 reply.recycle();
4593 }
4594
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004595 public void dismissKeyguardOnNextActivity() throws RemoteException {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4600 reply.readException();
4601 data.recycle();
4602 reply.recycle();
4603 }
4604
Adam Powelldd8fab22012-03-22 17:47:27 -07004605 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4606 throws RemoteException {
4607 Parcel data = Parcel.obtain();
4608 Parcel reply = Parcel.obtain();
4609 data.writeInterfaceToken(IActivityManager.descriptor);
4610 data.writeStrongBinder(token);
4611 data.writeString(destAffinity);
4612 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4613 reply.readException();
4614 boolean result = reply.readInt() != 0;
4615 data.recycle();
4616 reply.recycle();
4617 return result;
4618 }
4619
4620 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4621 throws RemoteException {
4622 Parcel data = Parcel.obtain();
4623 Parcel reply = Parcel.obtain();
4624 data.writeInterfaceToken(IActivityManager.descriptor);
4625 data.writeStrongBinder(token);
4626 target.writeToParcel(data, 0);
4627 data.writeInt(resultCode);
4628 if (resultData != null) {
4629 data.writeInt(1);
4630 resultData.writeToParcel(data, 0);
4631 } else {
4632 data.writeInt(0);
4633 }
4634 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4635 reply.readException();
4636 boolean result = reply.readInt() != 0;
4637 data.recycle();
4638 reply.recycle();
4639 return result;
4640 }
4641
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004642 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4643 Parcel data = Parcel.obtain();
4644 Parcel reply = Parcel.obtain();
4645 data.writeInterfaceToken(IActivityManager.descriptor);
4646 data.writeStrongBinder(activityToken);
4647 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4648 reply.readException();
4649 int result = reply.readInt();
4650 data.recycle();
4651 reply.recycle();
4652 return result;
4653 }
4654
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004655 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4656 Parcel data = Parcel.obtain();
4657 Parcel reply = Parcel.obtain();
4658 data.writeInterfaceToken(IActivityManager.descriptor);
4659 data.writeStrongBinder(activityToken);
4660 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4661 reply.readException();
4662 String result = reply.readString();
4663 data.recycle();
4664 reply.recycle();
4665 return result;
4666 }
4667
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004668 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4669 Parcel data = Parcel.obtain();
4670 Parcel reply = Parcel.obtain();
4671 data.writeInterfaceToken(IActivityManager.descriptor);
4672 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4673 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4674 reply.readException();
4675 data.recycle();
4676 reply.recycle();
4677 }
4678
4679 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4680 Parcel data = Parcel.obtain();
4681 Parcel reply = Parcel.obtain();
4682 data.writeInterfaceToken(IActivityManager.descriptor);
4683 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4684 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4685 reply.readException();
4686 data.recycle();
4687 reply.recycle();
4688 }
4689
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004690 public void requestBugReport() throws RemoteException {
4691 Parcel data = Parcel.obtain();
4692 Parcel reply = Parcel.obtain();
4693 data.writeInterfaceToken(IActivityManager.descriptor);
4694 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4695 reply.readException();
4696 data.recycle();
4697 reply.recycle();
4698 }
4699
Jeff Brownbd181bb2013-09-10 16:44:24 -07004700 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4701 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004702 Parcel data = Parcel.obtain();
4703 Parcel reply = Parcel.obtain();
4704 data.writeInterfaceToken(IActivityManager.descriptor);
4705 data.writeInt(pid);
4706 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004707 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004708 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4709 reply.readException();
4710 long res = reply.readInt();
4711 data.recycle();
4712 reply.recycle();
4713 return res;
4714 }
4715
Adam Skorydfc7fd72013-08-05 19:23:41 -07004716 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004717 Parcel data = Parcel.obtain();
4718 Parcel reply = Parcel.obtain();
4719 data.writeInterfaceToken(IActivityManager.descriptor);
4720 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004721 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004722 reply.readException();
4723 Bundle res = reply.readBundle();
4724 data.recycle();
4725 reply.recycle();
4726 return res;
4727 }
4728
Adam Skory7140a252013-09-11 12:04:58 +01004729 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004730 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004731 Parcel data = Parcel.obtain();
4732 Parcel reply = Parcel.obtain();
4733 data.writeInterfaceToken(IActivityManager.descriptor);
4734 data.writeStrongBinder(token);
4735 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004736 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004737 reply.readException();
4738 data.recycle();
4739 reply.recycle();
4740 }
4741
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004742 public void killUid(int uid, String reason) throws RemoteException {
4743 Parcel data = Parcel.obtain();
4744 Parcel reply = Parcel.obtain();
4745 data.writeInterfaceToken(IActivityManager.descriptor);
4746 data.writeInt(uid);
4747 data.writeString(reason);
4748 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4749 reply.readException();
4750 data.recycle();
4751 reply.recycle();
4752 }
4753
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004754 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4755 Parcel data = Parcel.obtain();
4756 Parcel reply = Parcel.obtain();
4757 data.writeInterfaceToken(IActivityManager.descriptor);
4758 data.writeStrongBinder(who);
4759 data.writeInt(allowRestart ? 1 : 0);
4760 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4761 reply.readException();
4762 data.recycle();
4763 reply.recycle();
4764 }
4765
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004766 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4767 Parcel data = Parcel.obtain();
4768 Parcel reply = Parcel.obtain();
4769 data.writeInterfaceToken(IActivityManager.descriptor);
4770 data.writeStrongBinder(token);
4771 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4772 reply.readException();
4773 data.recycle();
4774 reply.recycle();
4775 }
4776
Craig Mautner5eda9b32013-07-02 11:58:16 -07004777 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4778 Parcel data = Parcel.obtain();
4779 Parcel reply = Parcel.obtain();
4780 data.writeInterfaceToken(IActivityManager.descriptor);
4781 data.writeStrongBinder(token);
4782 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4783 reply.readException();
4784 data.recycle();
4785 reply.recycle();
4786 }
4787
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004788 public void restart() throws RemoteException {
4789 Parcel data = Parcel.obtain();
4790 Parcel reply = Parcel.obtain();
4791 data.writeInterfaceToken(IActivityManager.descriptor);
4792 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4793 reply.readException();
4794 data.recycle();
4795 reply.recycle();
4796 }
4797
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004798 public void performIdleMaintenance() throws RemoteException {
4799 Parcel data = Parcel.obtain();
4800 Parcel reply = Parcel.obtain();
4801 data.writeInterfaceToken(IActivityManager.descriptor);
4802 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4803 reply.readException();
4804 data.recycle();
4805 reply.recycle();
4806 }
4807
Craig Mautner4a1cb222013-12-04 16:14:06 -08004808 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4809 IActivityContainerCallback callback) throws RemoteException {
4810 Parcel data = Parcel.obtain();
4811 Parcel reply = Parcel.obtain();
4812 data.writeInterfaceToken(IActivityManager.descriptor);
4813 data.writeStrongBinder(parentActivityToken);
4814 data.writeStrongBinder((IBinder)callback);
4815 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4816 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004817 final int result = reply.readInt();
4818 final IActivityContainer res;
4819 if (result == 1) {
4820 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4821 } else {
4822 res = null;
4823 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004824 data.recycle();
4825 reply.recycle();
4826 return res;
4827 }
4828
Craig Mautner95da1082014-02-24 17:54:35 -08004829 public void deleteActivityContainer(IActivityContainer activityContainer)
4830 throws RemoteException {
4831 Parcel data = Parcel.obtain();
4832 Parcel reply = Parcel.obtain();
4833 data.writeInterfaceToken(IActivityManager.descriptor);
4834 data.writeStrongBinder(activityContainer.asBinder());
4835 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4836 reply.readException();
4837 data.recycle();
4838 reply.recycle();
4839 }
4840
Craig Mautnere0a38842013-12-16 16:14:02 -08004841 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4842 throws RemoteException {
4843 Parcel data = Parcel.obtain();
4844 Parcel reply = Parcel.obtain();
4845 data.writeInterfaceToken(IActivityManager.descriptor);
4846 data.writeStrongBinder(activityToken);
4847 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4848 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004849 final int result = reply.readInt();
4850 final IActivityContainer res;
4851 if (result == 1) {
4852 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4853 } else {
4854 res = null;
4855 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004856 data.recycle();
4857 reply.recycle();
4858 return res;
4859 }
4860
Craig Mautner4a1cb222013-12-04 16:14:06 -08004861 public IBinder getHomeActivityToken() throws RemoteException {
4862 Parcel data = Parcel.obtain();
4863 Parcel reply = Parcel.obtain();
4864 data.writeInterfaceToken(IActivityManager.descriptor);
4865 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4866 reply.readException();
4867 IBinder res = reply.readStrongBinder();
4868 data.recycle();
4869 reply.recycle();
4870 return res;
4871 }
4872
Craig Mautneraea74a52014-03-08 14:23:10 -08004873 @Override
4874 public void startLockTaskMode(int taskId) throws RemoteException {
4875 Parcel data = Parcel.obtain();
4876 Parcel reply = Parcel.obtain();
4877 data.writeInterfaceToken(IActivityManager.descriptor);
4878 data.writeInt(taskId);
4879 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4880 reply.readException();
4881 data.recycle();
4882 reply.recycle();
4883 }
4884
4885 @Override
4886 public void startLockTaskMode(IBinder token) throws RemoteException {
4887 Parcel data = Parcel.obtain();
4888 Parcel reply = Parcel.obtain();
4889 data.writeInterfaceToken(IActivityManager.descriptor);
4890 data.writeStrongBinder(token);
4891 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4892 reply.readException();
4893 data.recycle();
4894 reply.recycle();
4895 }
4896
4897 @Override
4898 public void stopLockTaskMode() throws RemoteException {
4899 Parcel data = Parcel.obtain();
4900 Parcel reply = Parcel.obtain();
4901 data.writeInterfaceToken(IActivityManager.descriptor);
4902 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4903 reply.readException();
4904 data.recycle();
4905 reply.recycle();
4906 }
4907
4908 @Override
4909 public boolean isInLockTaskMode() throws RemoteException {
4910 Parcel data = Parcel.obtain();
4911 Parcel reply = Parcel.obtain();
4912 data.writeInterfaceToken(IActivityManager.descriptor);
4913 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4914 reply.readException();
4915 boolean isInLockTaskMode = reply.readInt() == 1;
4916 data.recycle();
4917 reply.recycle();
4918 return isInLockTaskMode;
4919 }
4920
Craig Mautner2fbd7542014-03-21 09:34:07 -07004921 public void setRecentsLabel(IBinder token, CharSequence recentsLabel) throws RemoteException
4922 {
4923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeStrongBinder(token);
4927 TextUtils.writeToParcel(recentsLabel, data, 0);
4928 mRemote.transact(SET_RECENTS_LABEL_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4929 reply.readException();
4930 data.recycle();
4931 reply.recycle();
4932 }
4933
4934 public void setRecentsIcon(IBinder token, Bitmap recentsBitmap) throws RemoteException
4935 {
4936 Parcel data = Parcel.obtain();
4937 Parcel reply = Parcel.obtain();
4938 data.writeInterfaceToken(IActivityManager.descriptor);
4939 data.writeStrongBinder(token);
4940 if (recentsBitmap != null) {
4941 data.writeInt(1);
4942 recentsBitmap.writeToParcel(data, 0);
4943 } else {
4944 data.writeInt(0);
4945 }
4946 mRemote.transact(SET_RECENTS_ICON_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
4947 reply.readException();
4948 data.recycle();
4949 reply.recycle();
4950 }
4951
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004952 private IBinder mRemote;
4953}