blob: 9e10e3d05caa39338ba37e1634652f4ea0a0a2a5 [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;
Craig Mautnera0026042014-04-23 11:45:37 -070043import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070046import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070047import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080050import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070051import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import java.util.ArrayList;
54import java.util.List;
55
56/** {@hide} */
57public abstract class ActivityManagerNative extends Binder implements IActivityManager
58{
59 /**
60 * Cast a Binder object into an activity manager interface, generating
61 * a proxy if needed.
62 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080063 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064 if (obj == null) {
65 return null;
66 }
67 IActivityManager in =
68 (IActivityManager)obj.queryLocalInterface(descriptor);
69 if (in != null) {
70 return in;
71 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 return new ActivityManagerProxy(obj);
74 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 /**
77 * Retrieve the system's default/global activity manager.
78 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079 static public IActivityManager getDefault() {
80 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 }
82
83 /**
84 * Convenience for checking whether the system is ready. For internal use only.
85 */
86 static public boolean isSystemReady() {
87 if (!sSystemReady) {
88 sSystemReady = getDefault().testIsSystemReady();
89 }
90 return sSystemReady;
91 }
92 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 /**
95 * Convenience for sending a sticky broadcast. For internal use only.
96 * If you don't care about permission, use null.
97 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 try {
100 getDefault().broadcastIntent(
101 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800102 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 } catch (RemoteException ex) {
104 }
105 }
106
Dianne Hackborn099bc622014-01-22 13:39:16 -0800107 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 } catch (RemoteException ex) {
111 }
112 }
113
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800114 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 attachInterface(this, descriptor);
116 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700117
118 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
120 throws RemoteException {
121 switch (code) {
122 case START_ACTIVITY_TRANSACTION:
123 {
124 data.enforceInterface(IActivityManager.descriptor);
125 IBinder b = data.readStrongBinder();
126 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800127 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 Intent intent = Intent.CREATOR.createFromParcel(data);
129 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800131 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700133 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700134 String profileFile = data.readString();
135 ParcelFileDescriptor profileFd = data.readInt() != 0
136 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 Bundle options = data.readInt() != 0
138 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800139 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700140 resultTo, resultWho, requestCode, startFlags,
141 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
159 String profileFile = data.readString();
160 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700161 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700162 Bundle options = data.readInt() != 0
163 ? Bundle.CREATOR.createFromParcel(data) : null;
164 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800165 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700166 resultTo, resultWho, requestCode, startFlags,
167 profileFile, profileFd, options, userId);
168 reply.writeNoException();
169 reply.writeInt(result);
170 return true;
171 }
172
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 case START_ACTIVITY_AND_WAIT_TRANSACTION:
174 {
175 data.enforceInterface(IActivityManager.descriptor);
176 IBinder b = data.readStrongBinder();
177 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800178 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800179 Intent intent = Intent.CREATOR.createFromParcel(data);
180 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800182 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700185 String profileFile = data.readString();
186 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700187 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700188 Bundle options = data.readInt() != 0
189 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800191 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700192 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700193 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 reply.writeNoException();
195 result.writeToParcel(reply, 0);
196 return true;
197 }
198
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
200 {
201 data.enforceInterface(IActivityManager.descriptor);
202 IBinder b = data.readStrongBinder();
203 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800204 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Intent intent = Intent.CREATOR.createFromParcel(data);
206 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700207 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700208 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700210 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700212 Bundle options = data.readInt() != 0
213 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700214 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800215 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700216 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700217 reply.writeNoException();
218 reply.writeInt(result);
219 return true;
220 }
221
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700222 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700223 {
224 data.enforceInterface(IActivityManager.descriptor);
225 IBinder b = data.readStrongBinder();
226 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700227 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700228 Intent fillInIntent = null;
229 if (data.readInt() != 0) {
230 fillInIntent = Intent.CREATOR.createFromParcel(data);
231 }
232 String resolvedType = data.readString();
233 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700234 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 int requestCode = data.readInt();
236 int flagsMask = data.readInt();
237 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700238 Bundle options = data.readInt() != 0
239 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700240 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700241 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 reply.writeNoException();
244 reply.writeInt(result);
245 return true;
246 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700247
Dianne Hackborn91097de2014-04-04 18:02:06 -0700248 case START_VOICE_ACTIVITY_TRANSACTION:
249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 String callingPackage = data.readString();
252 int callingPid = data.readInt();
253 int callingUid = data.readInt();
254 Intent intent = Intent.CREATOR.createFromParcel(data);
255 String resolvedType = data.readString();
256 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
257 data.readStrongBinder());
258 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
259 data.readStrongBinder());
260 int startFlags = data.readInt();
261 String profileFile = data.readString();
262 ParcelFileDescriptor profileFd = data.readInt() != 0
263 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
264 Bundle options = data.readInt() != 0
265 ? Bundle.CREATOR.createFromParcel(data) : null;
266 int userId = data.readInt();
267 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
268 intent, resolvedType, session, interactor, startFlags,
269 profileFile, profileFd, options, userId);
270 reply.writeNoException();
271 reply.writeInt(result);
272 return true;
273 }
274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
276 {
277 data.enforceInterface(IActivityManager.descriptor);
278 IBinder callingActivity = data.readStrongBinder();
279 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700280 Bundle options = data.readInt() != 0
281 ? Bundle.CREATOR.createFromParcel(data) : null;
282 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 reply.writeNoException();
284 reply.writeInt(result ? 1 : 0);
285 return true;
286 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 case FINISH_ACTIVITY_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 Intent resultData = null;
292 int resultCode = data.readInt();
293 if (data.readInt() != 0) {
294 resultData = Intent.CREATOR.createFromParcel(data);
295 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700296 boolean finishTask = (data.readInt() != 0);
297 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 reply.writeNoException();
299 reply.writeInt(res ? 1 : 0);
300 return true;
301 }
302
303 case FINISH_SUB_ACTIVITY_TRANSACTION: {
304 data.enforceInterface(IActivityManager.descriptor);
305 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700306 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 int requestCode = data.readInt();
308 finishSubActivity(token, resultWho, requestCode);
309 reply.writeNoException();
310 return true;
311 }
312
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700313 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
314 data.enforceInterface(IActivityManager.descriptor);
315 IBinder token = data.readStrongBinder();
316 boolean res = finishActivityAffinity(token);
317 reply.writeNoException();
318 reply.writeInt(res ? 1 : 0);
319 return true;
320 }
321
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800322 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
323 data.enforceInterface(IActivityManager.descriptor);
324 IBinder token = data.readStrongBinder();
325 boolean res = willActivityBeVisible(token);
326 reply.writeNoException();
327 reply.writeInt(res ? 1 : 0);
328 return true;
329 }
330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800331 case REGISTER_RECEIVER_TRANSACTION:
332 {
333 data.enforceInterface(IActivityManager.descriptor);
334 IBinder b = data.readStrongBinder();
335 IApplicationThread app =
336 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700337 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800338 b = data.readStrongBinder();
339 IIntentReceiver rec
340 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
341 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
342 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700343 int userId = data.readInt();
344 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 reply.writeNoException();
346 if (intent != null) {
347 reply.writeInt(1);
348 intent.writeToParcel(reply, 0);
349 } else {
350 reply.writeInt(0);
351 }
352 return true;
353 }
354
355 case UNREGISTER_RECEIVER_TRANSACTION:
356 {
357 data.enforceInterface(IActivityManager.descriptor);
358 IBinder b = data.readStrongBinder();
359 if (b == null) {
360 return true;
361 }
362 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
363 unregisterReceiver(rec);
364 reply.writeNoException();
365 return true;
366 }
367
368 case BROADCAST_INTENT_TRANSACTION:
369 {
370 data.enforceInterface(IActivityManager.descriptor);
371 IBinder b = data.readStrongBinder();
372 IApplicationThread app =
373 b != null ? ApplicationThreadNative.asInterface(b) : null;
374 Intent intent = Intent.CREATOR.createFromParcel(data);
375 String resolvedType = data.readString();
376 b = data.readStrongBinder();
377 IIntentReceiver resultTo =
378 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
379 int resultCode = data.readInt();
380 String resultData = data.readString();
381 Bundle resultExtras = data.readBundle();
382 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800383 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 boolean serialized = data.readInt() != 0;
385 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700386 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800388 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700389 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 reply.writeNoException();
391 reply.writeInt(res);
392 return true;
393 }
394
395 case UNBROADCAST_INTENT_TRANSACTION:
396 {
397 data.enforceInterface(IActivityManager.descriptor);
398 IBinder b = data.readStrongBinder();
399 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
400 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700401 int userId = data.readInt();
402 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 reply.writeNoException();
404 return true;
405 }
406
407 case FINISH_RECEIVER_TRANSACTION: {
408 data.enforceInterface(IActivityManager.descriptor);
409 IBinder who = data.readStrongBinder();
410 int resultCode = data.readInt();
411 String resultData = data.readString();
412 Bundle resultExtras = data.readBundle();
413 boolean resultAbort = data.readInt() != 0;
414 if (who != null) {
415 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
416 }
417 reply.writeNoException();
418 return true;
419 }
420
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800421 case ATTACH_APPLICATION_TRANSACTION: {
422 data.enforceInterface(IActivityManager.descriptor);
423 IApplicationThread app = ApplicationThreadNative.asInterface(
424 data.readStrongBinder());
425 if (app != null) {
426 attachApplication(app);
427 }
428 reply.writeNoException();
429 return true;
430 }
431
432 case ACTIVITY_IDLE_TRANSACTION: {
433 data.enforceInterface(IActivityManager.descriptor);
434 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700435 Configuration config = null;
436 if (data.readInt() != 0) {
437 config = Configuration.CREATOR.createFromParcel(data);
438 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700439 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800440 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700441 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800442 }
443 reply.writeNoException();
444 return true;
445 }
446
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700447 case ACTIVITY_RESUMED_TRANSACTION: {
448 data.enforceInterface(IActivityManager.descriptor);
449 IBinder token = data.readStrongBinder();
450 activityResumed(token);
451 reply.writeNoException();
452 return true;
453 }
454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800455 case ACTIVITY_PAUSED_TRANSACTION: {
456 data.enforceInterface(IActivityManager.descriptor);
457 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700458 PersistableBundle persistentState = data.readPersistableBundle();
459 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800460 reply.writeNoException();
461 return true;
462 }
463
464 case ACTIVITY_STOPPED_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800467 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700468 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700470 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800471 reply.writeNoException();
472 return true;
473 }
474
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800475 case ACTIVITY_SLEPT_TRANSACTION: {
476 data.enforceInterface(IActivityManager.descriptor);
477 IBinder token = data.readStrongBinder();
478 activitySlept(token);
479 reply.writeNoException();
480 return true;
481 }
482
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 case ACTIVITY_DESTROYED_TRANSACTION: {
484 data.enforceInterface(IActivityManager.descriptor);
485 IBinder token = data.readStrongBinder();
486 activityDestroyed(token);
487 reply.writeNoException();
488 return true;
489 }
490
491 case GET_CALLING_PACKAGE_TRANSACTION: {
492 data.enforceInterface(IActivityManager.descriptor);
493 IBinder token = data.readStrongBinder();
494 String res = token != null ? getCallingPackage(token) : null;
495 reply.writeNoException();
496 reply.writeString(res);
497 return true;
498 }
499
500 case GET_CALLING_ACTIVITY_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 IBinder token = data.readStrongBinder();
503 ComponentName cn = getCallingActivity(token);
504 reply.writeNoException();
505 ComponentName.writeToParcel(cn, reply);
506 return true;
507 }
508
Winson Chung1147c402014-05-14 11:05:00 -0700509 case GET_APP_TASKS_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 List<IAppTask> list = getAppTasks();
512 reply.writeNoException();
513 int N = list != null ? list.size() : -1;
514 reply.writeInt(N);
515 int i;
516 for (i=0; i<N; i++) {
517 IAppTask task = list.get(i);
518 reply.writeStrongBinder(task.asBinder());
519 }
520 return true;
521 }
522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800523 case GET_TASKS_TRANSACTION: {
524 data.enforceInterface(IActivityManager.descriptor);
525 int maxNum = data.readInt();
526 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700527 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800528 reply.writeNoException();
529 int N = list != null ? list.size() : -1;
530 reply.writeInt(N);
531 int i;
532 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700533 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 info.writeToParcel(reply, 0);
535 }
536 return true;
537 }
538
539 case GET_RECENT_TASKS_TRANSACTION: {
540 data.enforceInterface(IActivityManager.descriptor);
541 int maxNum = data.readInt();
542 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700543 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800544 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700545 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800546 reply.writeNoException();
547 reply.writeTypedList(list);
548 return true;
549 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700550
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700551 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800552 data.enforceInterface(IActivityManager.descriptor);
553 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700554 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800555 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700556 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800557 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700558 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700559 } else {
560 reply.writeInt(0);
561 }
562 return true;
563 }
564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 case GET_SERVICES_TRANSACTION: {
566 data.enforceInterface(IActivityManager.descriptor);
567 int maxNum = data.readInt();
568 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700569 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800570 reply.writeNoException();
571 int N = list != null ? list.size() : -1;
572 reply.writeInt(N);
573 int i;
574 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700575 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800576 info.writeToParcel(reply, 0);
577 }
578 return true;
579 }
580
581 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
582 data.enforceInterface(IActivityManager.descriptor);
583 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
584 reply.writeNoException();
585 reply.writeTypedList(list);
586 return true;
587 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700588
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
590 data.enforceInterface(IActivityManager.descriptor);
591 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
592 reply.writeNoException();
593 reply.writeTypedList(list);
594 return true;
595 }
596
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700597 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
598 data.enforceInterface(IActivityManager.descriptor);
599 List<ApplicationInfo> list = getRunningExternalApplications();
600 reply.writeNoException();
601 reply.writeTypedList(list);
602 return true;
603 }
604
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 case MOVE_TASK_TO_FRONT_TRANSACTION: {
606 data.enforceInterface(IActivityManager.descriptor);
607 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800608 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700609 Bundle options = data.readInt() != 0
610 ? Bundle.CREATOR.createFromParcel(data) : null;
611 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 reply.writeNoException();
613 return true;
614 }
615
616 case MOVE_TASK_TO_BACK_TRANSACTION: {
617 data.enforceInterface(IActivityManager.descriptor);
618 int task = data.readInt();
619 moveTaskToBack(task);
620 reply.writeNoException();
621 return true;
622 }
623
624 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
625 data.enforceInterface(IActivityManager.descriptor);
626 IBinder token = data.readStrongBinder();
627 boolean nonRoot = data.readInt() != 0;
628 boolean res = moveActivityTaskToBack(token, nonRoot);
629 reply.writeNoException();
630 reply.writeInt(res ? 1 : 0);
631 return true;
632 }
633
634 case MOVE_TASK_BACKWARDS_TRANSACTION: {
635 data.enforceInterface(IActivityManager.descriptor);
636 int task = data.readInt();
637 moveTaskBackwards(task);
638 reply.writeNoException();
639 return true;
640 }
641
Craig Mautnerc00204b2013-03-05 15:02:14 -0800642 case MOVE_TASK_TO_STACK_TRANSACTION: {
643 data.enforceInterface(IActivityManager.descriptor);
644 int taskId = data.readInt();
645 int stackId = data.readInt();
646 boolean toTop = data.readInt() != 0;
647 moveTaskToStack(taskId, stackId, toTop);
648 reply.writeNoException();
649 return true;
650 }
651
652 case RESIZE_STACK_TRANSACTION: {
653 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800654 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800655 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800656 Rect r = Rect.CREATOR.createFromParcel(data);
657 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800658 reply.writeNoException();
659 return true;
660 }
661
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800662 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700663 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800664 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700665 reply.writeNoException();
666 reply.writeTypedList(list);
667 return true;
668 }
669
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800670 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700671 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800672 int stackId = data.readInt();
673 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700674 reply.writeNoException();
675 if (info != null) {
676 reply.writeInt(1);
677 info.writeToParcel(reply, 0);
678 } else {
679 reply.writeInt(0);
680 }
681 return true;
682 }
683
Winson Chung303e1ff2014-03-07 15:06:19 -0800684 case IS_IN_HOME_STACK_TRANSACTION: {
685 data.enforceInterface(IActivityManager.descriptor);
686 int taskId = data.readInt();
687 boolean isInHomeStack = isInHomeStack(taskId);
688 reply.writeNoException();
689 reply.writeInt(isInHomeStack ? 1 : 0);
690 return true;
691 }
692
Craig Mautnercf910b02013-04-23 11:23:27 -0700693 case SET_FOCUSED_STACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 int stackId = data.readInt();
696 setFocusedStack(stackId);
697 reply.writeNoException();
698 return true;
699 }
700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800701 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
702 data.enforceInterface(IActivityManager.descriptor);
703 IBinder token = data.readStrongBinder();
704 boolean onlyRoot = data.readInt() != 0;
705 int res = token != null
706 ? getTaskForActivity(token, onlyRoot) : -1;
707 reply.writeNoException();
708 reply.writeInt(res);
709 return true;
710 }
711
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800712 case GET_CONTENT_PROVIDER_TRANSACTION: {
713 data.enforceInterface(IActivityManager.descriptor);
714 IBinder b = data.readStrongBinder();
715 IApplicationThread app = ApplicationThreadNative.asInterface(b);
716 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700717 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700718 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700719 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -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
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800730 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
731 data.enforceInterface(IActivityManager.descriptor);
732 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700733 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800734 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700735 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800736 reply.writeNoException();
737 if (cph != null) {
738 reply.writeInt(1);
739 cph.writeToParcel(reply, 0);
740 } else {
741 reply.writeInt(0);
742 }
743 return true;
744 }
745
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800746 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
747 data.enforceInterface(IActivityManager.descriptor);
748 IBinder b = data.readStrongBinder();
749 IApplicationThread app = ApplicationThreadNative.asInterface(b);
750 ArrayList<ContentProviderHolder> providers =
751 data.createTypedArrayList(ContentProviderHolder.CREATOR);
752 publishContentProviders(app, providers);
753 reply.writeNoException();
754 return true;
755 }
756
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700757 case REF_CONTENT_PROVIDER_TRANSACTION: {
758 data.enforceInterface(IActivityManager.descriptor);
759 IBinder b = data.readStrongBinder();
760 int stable = data.readInt();
761 int unstable = data.readInt();
762 boolean res = refContentProvider(b, stable, unstable);
763 reply.writeNoException();
764 reply.writeInt(res ? 1 : 0);
765 return true;
766 }
767
768 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
769 data.enforceInterface(IActivityManager.descriptor);
770 IBinder b = data.readStrongBinder();
771 unstableProviderDied(b);
772 reply.writeNoException();
773 return true;
774 }
775
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700776 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
777 data.enforceInterface(IActivityManager.descriptor);
778 IBinder b = data.readStrongBinder();
779 appNotRespondingViaProvider(b);
780 reply.writeNoException();
781 return true;
782 }
783
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
785 data.enforceInterface(IActivityManager.descriptor);
786 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700787 boolean stable = data.readInt() != 0;
788 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800789 reply.writeNoException();
790 return true;
791 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800792
793 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
794 data.enforceInterface(IActivityManager.descriptor);
795 String name = data.readString();
796 IBinder token = data.readStrongBinder();
797 removeContentProviderExternal(name, token);
798 reply.writeNoException();
799 return true;
800 }
801
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700802 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
803 data.enforceInterface(IActivityManager.descriptor);
804 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
805 PendingIntent pi = getRunningServiceControlPanel(comp);
806 reply.writeNoException();
807 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
808 return true;
809 }
810
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800811 case START_SERVICE_TRANSACTION: {
812 data.enforceInterface(IActivityManager.descriptor);
813 IBinder b = data.readStrongBinder();
814 IApplicationThread app = ApplicationThreadNative.asInterface(b);
815 Intent service = Intent.CREATOR.createFromParcel(data);
816 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700817 int userId = data.readInt();
818 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800819 reply.writeNoException();
820 ComponentName.writeToParcel(cn, reply);
821 return true;
822 }
823
824 case STOP_SERVICE_TRANSACTION: {
825 data.enforceInterface(IActivityManager.descriptor);
826 IBinder b = data.readStrongBinder();
827 IApplicationThread app = ApplicationThreadNative.asInterface(b);
828 Intent service = Intent.CREATOR.createFromParcel(data);
829 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700830 int userId = data.readInt();
831 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800832 reply.writeNoException();
833 reply.writeInt(res);
834 return true;
835 }
836
837 case STOP_SERVICE_TOKEN_TRANSACTION: {
838 data.enforceInterface(IActivityManager.descriptor);
839 ComponentName className = ComponentName.readFromParcel(data);
840 IBinder token = data.readStrongBinder();
841 int startId = data.readInt();
842 boolean res = stopServiceToken(className, token, startId);
843 reply.writeNoException();
844 reply.writeInt(res ? 1 : 0);
845 return true;
846 }
847
848 case SET_SERVICE_FOREGROUND_TRANSACTION: {
849 data.enforceInterface(IActivityManager.descriptor);
850 ComponentName className = ComponentName.readFromParcel(data);
851 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700852 int id = data.readInt();
853 Notification notification = null;
854 if (data.readInt() != 0) {
855 notification = Notification.CREATOR.createFromParcel(data);
856 }
857 boolean removeNotification = data.readInt() != 0;
858 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800859 reply.writeNoException();
860 return true;
861 }
862
863 case BIND_SERVICE_TRANSACTION: {
864 data.enforceInterface(IActivityManager.descriptor);
865 IBinder b = data.readStrongBinder();
866 IApplicationThread app = ApplicationThreadNative.asInterface(b);
867 IBinder token = data.readStrongBinder();
868 Intent service = Intent.CREATOR.createFromParcel(data);
869 String resolvedType = data.readString();
870 b = data.readStrongBinder();
871 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800872 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800873 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800874 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800875 reply.writeNoException();
876 reply.writeInt(res);
877 return true;
878 }
879
880 case UNBIND_SERVICE_TRANSACTION: {
881 data.enforceInterface(IActivityManager.descriptor);
882 IBinder b = data.readStrongBinder();
883 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
884 boolean res = unbindService(conn);
885 reply.writeNoException();
886 reply.writeInt(res ? 1 : 0);
887 return true;
888 }
889
890 case PUBLISH_SERVICE_TRANSACTION: {
891 data.enforceInterface(IActivityManager.descriptor);
892 IBinder token = data.readStrongBinder();
893 Intent intent = Intent.CREATOR.createFromParcel(data);
894 IBinder service = data.readStrongBinder();
895 publishService(token, intent, service);
896 reply.writeNoException();
897 return true;
898 }
899
900 case UNBIND_FINISHED_TRANSACTION: {
901 data.enforceInterface(IActivityManager.descriptor);
902 IBinder token = data.readStrongBinder();
903 Intent intent = Intent.CREATOR.createFromParcel(data);
904 boolean doRebind = data.readInt() != 0;
905 unbindFinished(token, intent, doRebind);
906 reply.writeNoException();
907 return true;
908 }
909
910 case SERVICE_DONE_EXECUTING_TRANSACTION: {
911 data.enforceInterface(IActivityManager.descriptor);
912 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700913 int type = data.readInt();
914 int startId = data.readInt();
915 int res = data.readInt();
916 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800917 reply.writeNoException();
918 return true;
919 }
920
921 case START_INSTRUMENTATION_TRANSACTION: {
922 data.enforceInterface(IActivityManager.descriptor);
923 ComponentName className = ComponentName.readFromParcel(data);
924 String profileFile = data.readString();
925 int fl = data.readInt();
926 Bundle arguments = data.readBundle();
927 IBinder b = data.readStrongBinder();
928 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800929 b = data.readStrongBinder();
930 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700931 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100932 String abiOverride = data.readString();
933 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
934 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800935 reply.writeNoException();
936 reply.writeInt(res ? 1 : 0);
937 return true;
938 }
939
940
941 case FINISH_INSTRUMENTATION_TRANSACTION: {
942 data.enforceInterface(IActivityManager.descriptor);
943 IBinder b = data.readStrongBinder();
944 IApplicationThread app = ApplicationThreadNative.asInterface(b);
945 int resultCode = data.readInt();
946 Bundle results = data.readBundle();
947 finishInstrumentation(app, resultCode, results);
948 reply.writeNoException();
949 return true;
950 }
951
952 case GET_CONFIGURATION_TRANSACTION: {
953 data.enforceInterface(IActivityManager.descriptor);
954 Configuration config = getConfiguration();
955 reply.writeNoException();
956 config.writeToParcel(reply, 0);
957 return true;
958 }
959
960 case UPDATE_CONFIGURATION_TRANSACTION: {
961 data.enforceInterface(IActivityManager.descriptor);
962 Configuration config = Configuration.CREATOR.createFromParcel(data);
963 updateConfiguration(config);
964 reply.writeNoException();
965 return true;
966 }
967
968 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
969 data.enforceInterface(IActivityManager.descriptor);
970 IBinder token = data.readStrongBinder();
971 int requestedOrientation = data.readInt();
972 setRequestedOrientation(token, requestedOrientation);
973 reply.writeNoException();
974 return true;
975 }
976
977 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
980 int req = getRequestedOrientation(token);
981 reply.writeNoException();
982 reply.writeInt(req);
983 return true;
984 }
985
986 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder token = data.readStrongBinder();
989 ComponentName cn = getActivityClassForToken(token);
990 reply.writeNoException();
991 ComponentName.writeToParcel(cn, reply);
992 return true;
993 }
994
995 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
996 data.enforceInterface(IActivityManager.descriptor);
997 IBinder token = data.readStrongBinder();
998 reply.writeNoException();
999 reply.writeString(getPackageForToken(token));
1000 return true;
1001 }
1002
1003 case GET_INTENT_SENDER_TRANSACTION: {
1004 data.enforceInterface(IActivityManager.descriptor);
1005 int type = data.readInt();
1006 String packageName = data.readString();
1007 IBinder token = data.readStrongBinder();
1008 String resultWho = data.readString();
1009 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001010 Intent[] requestIntents;
1011 String[] requestResolvedTypes;
1012 if (data.readInt() != 0) {
1013 requestIntents = data.createTypedArray(Intent.CREATOR);
1014 requestResolvedTypes = data.createStringArray();
1015 } else {
1016 requestIntents = null;
1017 requestResolvedTypes = null;
1018 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001019 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001020 Bundle options = data.readInt() != 0
1021 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001022 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001023 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001024 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001025 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001026 reply.writeNoException();
1027 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1028 return true;
1029 }
1030
1031 case CANCEL_INTENT_SENDER_TRANSACTION: {
1032 data.enforceInterface(IActivityManager.descriptor);
1033 IIntentSender r = IIntentSender.Stub.asInterface(
1034 data.readStrongBinder());
1035 cancelIntentSender(r);
1036 reply.writeNoException();
1037 return true;
1038 }
1039
1040 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IIntentSender r = IIntentSender.Stub.asInterface(
1043 data.readStrongBinder());
1044 String res = getPackageForIntentSender(r);
1045 reply.writeNoException();
1046 reply.writeString(res);
1047 return true;
1048 }
1049
Christopher Tatec4a07d12012-04-06 14:19:13 -07001050 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1051 data.enforceInterface(IActivityManager.descriptor);
1052 IIntentSender r = IIntentSender.Stub.asInterface(
1053 data.readStrongBinder());
1054 int res = getUidForIntentSender(r);
1055 reply.writeNoException();
1056 reply.writeInt(res);
1057 return true;
1058 }
1059
Dianne Hackborn41203752012-08-31 14:05:51 -07001060 case HANDLE_INCOMING_USER_TRANSACTION: {
1061 data.enforceInterface(IActivityManager.descriptor);
1062 int callingPid = data.readInt();
1063 int callingUid = data.readInt();
1064 int userId = data.readInt();
1065 boolean allowAll = data.readInt() != 0 ;
1066 boolean requireFull = data.readInt() != 0;
1067 String name = data.readString();
1068 String callerPackage = data.readString();
1069 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1070 requireFull, name, callerPackage);
1071 reply.writeNoException();
1072 reply.writeInt(res);
1073 return true;
1074 }
1075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001076 case SET_PROCESS_LIMIT_TRANSACTION: {
1077 data.enforceInterface(IActivityManager.descriptor);
1078 int max = data.readInt();
1079 setProcessLimit(max);
1080 reply.writeNoException();
1081 return true;
1082 }
1083
1084 case GET_PROCESS_LIMIT_TRANSACTION: {
1085 data.enforceInterface(IActivityManager.descriptor);
1086 int limit = getProcessLimit();
1087 reply.writeNoException();
1088 reply.writeInt(limit);
1089 return true;
1090 }
1091
1092 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1093 data.enforceInterface(IActivityManager.descriptor);
1094 IBinder token = data.readStrongBinder();
1095 int pid = data.readInt();
1096 boolean isForeground = data.readInt() != 0;
1097 setProcessForeground(token, pid, isForeground);
1098 reply.writeNoException();
1099 return true;
1100 }
1101
1102 case CHECK_PERMISSION_TRANSACTION: {
1103 data.enforceInterface(IActivityManager.descriptor);
1104 String perm = data.readString();
1105 int pid = data.readInt();
1106 int uid = data.readInt();
1107 int res = checkPermission(perm, pid, uid);
1108 reply.writeNoException();
1109 reply.writeInt(res);
1110 return true;
1111 }
1112
1113 case CHECK_URI_PERMISSION_TRANSACTION: {
1114 data.enforceInterface(IActivityManager.descriptor);
1115 Uri uri = Uri.CREATOR.createFromParcel(data);
1116 int pid = data.readInt();
1117 int uid = data.readInt();
1118 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001119 int userId = data.readInt();
1120 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 reply.writeNoException();
1122 reply.writeInt(res);
1123 return true;
1124 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001125
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001126 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001127 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001128 String packageName = data.readString();
1129 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1130 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001131 int userId = data.readInt();
1132 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001133 reply.writeNoException();
1134 reply.writeInt(res ? 1 : 0);
1135 return true;
1136 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 case GRANT_URI_PERMISSION_TRANSACTION: {
1139 data.enforceInterface(IActivityManager.descriptor);
1140 IBinder b = data.readStrongBinder();
1141 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1142 String targetPkg = data.readString();
1143 Uri uri = Uri.CREATOR.createFromParcel(data);
1144 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001145 int userId = data.readInt();
1146 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 reply.writeNoException();
1148 return true;
1149 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 case REVOKE_URI_PERMISSION_TRANSACTION: {
1152 data.enforceInterface(IActivityManager.descriptor);
1153 IBinder b = data.readStrongBinder();
1154 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1155 Uri uri = Uri.CREATOR.createFromParcel(data);
1156 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001157 int userId = data.readInt();
1158 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001159 reply.writeNoException();
1160 return true;
1161 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001162
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001163 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1164 data.enforceInterface(IActivityManager.descriptor);
1165 Uri uri = Uri.CREATOR.createFromParcel(data);
1166 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001167 int userId = data.readInt();
1168 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001169 reply.writeNoException();
1170 return true;
1171 }
1172
1173 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1174 data.enforceInterface(IActivityManager.descriptor);
1175 Uri uri = Uri.CREATOR.createFromParcel(data);
1176 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001177 int userId = data.readInt();
1178 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001179 reply.writeNoException();
1180 return true;
1181 }
1182
1183 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1184 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001185 final String packageName = data.readString();
1186 final boolean incoming = data.readInt() != 0;
1187 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1188 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001189 reply.writeNoException();
1190 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1191 return true;
1192 }
1193
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001194 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1195 data.enforceInterface(IActivityManager.descriptor);
1196 IBinder b = data.readStrongBinder();
1197 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1198 boolean waiting = data.readInt() != 0;
1199 showWaitingForDebugger(app, waiting);
1200 reply.writeNoException();
1201 return true;
1202 }
1203
1204 case GET_MEMORY_INFO_TRANSACTION: {
1205 data.enforceInterface(IActivityManager.descriptor);
1206 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1207 getMemoryInfo(mi);
1208 reply.writeNoException();
1209 mi.writeToParcel(reply, 0);
1210 return true;
1211 }
1212
1213 case UNHANDLED_BACK_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 unhandledBack();
1216 reply.writeNoException();
1217 return true;
1218 }
1219
1220 case OPEN_CONTENT_URI_TRANSACTION: {
1221 data.enforceInterface(IActivityManager.descriptor);
1222 Uri uri = Uri.parse(data.readString());
1223 ParcelFileDescriptor pfd = openContentUri(uri);
1224 reply.writeNoException();
1225 if (pfd != null) {
1226 reply.writeInt(1);
1227 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1228 } else {
1229 reply.writeInt(0);
1230 }
1231 return true;
1232 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001233
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001234 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1235 data.enforceInterface(IActivityManager.descriptor);
1236 setLockScreenShown(data.readInt() != 0);
1237 reply.writeNoException();
1238 return true;
1239 }
1240
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 case SET_DEBUG_APP_TRANSACTION: {
1242 data.enforceInterface(IActivityManager.descriptor);
1243 String pn = data.readString();
1244 boolean wfd = data.readInt() != 0;
1245 boolean per = data.readInt() != 0;
1246 setDebugApp(pn, wfd, per);
1247 reply.writeNoException();
1248 return true;
1249 }
1250
1251 case SET_ALWAYS_FINISH_TRANSACTION: {
1252 data.enforceInterface(IActivityManager.descriptor);
1253 boolean enabled = data.readInt() != 0;
1254 setAlwaysFinish(enabled);
1255 reply.writeNoException();
1256 return true;
1257 }
1258
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001259 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001260 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001261 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001262 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001263 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001264 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001265 return true;
1266 }
1267
1268 case ENTER_SAFE_MODE_TRANSACTION: {
1269 data.enforceInterface(IActivityManager.descriptor);
1270 enterSafeMode();
1271 reply.writeNoException();
1272 return true;
1273 }
1274
1275 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1276 data.enforceInterface(IActivityManager.descriptor);
1277 IIntentSender is = IIntentSender.Stub.asInterface(
1278 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001279 int sourceUid = data.readInt();
1280 String sourcePkg = data.readString();
1281 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 reply.writeNoException();
1283 return true;
1284 }
1285
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001286 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001287 data.enforceInterface(IActivityManager.descriptor);
1288 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001289 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001290 boolean secure = data.readInt() != 0;
1291 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001292 reply.writeNoException();
1293 reply.writeInt(res ? 1 : 0);
1294 return true;
1295 }
1296
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001297 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1298 data.enforceInterface(IActivityManager.descriptor);
1299 String reason = data.readString();
1300 boolean res = killProcessesBelowForeground(reason);
1301 reply.writeNoException();
1302 reply.writeInt(res ? 1 : 0);
1303 return true;
1304 }
1305
Dan Egnor60d87622009-12-16 16:32:58 -08001306 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 IBinder app = data.readStrongBinder();
1309 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1310 handleApplicationCrash(app, ci);
1311 reply.writeNoException();
1312 return true;
1313 }
1314
1315 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001316 data.enforceInterface(IActivityManager.descriptor);
1317 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001319 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001320 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001321 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001322 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001323 return true;
1324 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001325
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001326 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1327 data.enforceInterface(IActivityManager.descriptor);
1328 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001329 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001330 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1331 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001332 reply.writeNoException();
1333 return true;
1334 }
1335
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001336 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1337 data.enforceInterface(IActivityManager.descriptor);
1338 int sig = data.readInt();
1339 signalPersistentProcesses(sig);
1340 reply.writeNoException();
1341 return true;
1342 }
1343
Dianne Hackborn03abb812010-01-04 18:43:19 -08001344 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1345 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001346 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001347 int userId = data.readInt();
1348 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001349 reply.writeNoException();
1350 return true;
1351 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001352
1353 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
1355 killAllBackgroundProcesses();
1356 reply.writeNoException();
1357 return true;
1358 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001359
Dianne Hackborn03abb812010-01-04 18:43:19 -08001360 case FORCE_STOP_PACKAGE_TRANSACTION: {
1361 data.enforceInterface(IActivityManager.descriptor);
1362 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001363 int userId = data.readInt();
1364 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001365 reply.writeNoException();
1366 return true;
1367 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001368
1369 case GET_MY_MEMORY_STATE_TRANSACTION: {
1370 data.enforceInterface(IActivityManager.descriptor);
1371 ActivityManager.RunningAppProcessInfo info =
1372 new ActivityManager.RunningAppProcessInfo();
1373 getMyMemoryState(info);
1374 reply.writeNoException();
1375 info.writeToParcel(reply, 0);
1376 return true;
1377 }
1378
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001379 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1380 data.enforceInterface(IActivityManager.descriptor);
1381 ConfigurationInfo config = getDeviceConfigurationInfo();
1382 reply.writeNoException();
1383 config.writeToParcel(reply, 0);
1384 return true;
1385 }
1386
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001387 case PROFILE_CONTROL_TRANSACTION: {
1388 data.enforceInterface(IActivityManager.descriptor);
1389 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001390 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001391 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001392 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001393 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001394 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001395 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001396 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001397 reply.writeNoException();
1398 reply.writeInt(res ? 1 : 0);
1399 return true;
1400 }
1401
Dianne Hackborn55280a92009-05-07 15:53:46 -07001402 case SHUTDOWN_TRANSACTION: {
1403 data.enforceInterface(IActivityManager.descriptor);
1404 boolean res = shutdown(data.readInt());
1405 reply.writeNoException();
1406 reply.writeInt(res ? 1 : 0);
1407 return true;
1408 }
1409
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001410 case STOP_APP_SWITCHES_TRANSACTION: {
1411 data.enforceInterface(IActivityManager.descriptor);
1412 stopAppSwitches();
1413 reply.writeNoException();
1414 return true;
1415 }
1416
1417 case RESUME_APP_SWITCHES_TRANSACTION: {
1418 data.enforceInterface(IActivityManager.descriptor);
1419 resumeAppSwitches();
1420 reply.writeNoException();
1421 return true;
1422 }
1423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001424 case PEEK_SERVICE_TRANSACTION: {
1425 data.enforceInterface(IActivityManager.descriptor);
1426 Intent service = Intent.CREATOR.createFromParcel(data);
1427 String resolvedType = data.readString();
1428 IBinder binder = peekService(service, resolvedType);
1429 reply.writeNoException();
1430 reply.writeStrongBinder(binder);
1431 return true;
1432 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001433
1434 case START_BACKUP_AGENT_TRANSACTION: {
1435 data.enforceInterface(IActivityManager.descriptor);
1436 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1437 int backupRestoreMode = data.readInt();
1438 boolean success = bindBackupAgent(info, backupRestoreMode);
1439 reply.writeNoException();
1440 reply.writeInt(success ? 1 : 0);
1441 return true;
1442 }
1443
1444 case BACKUP_AGENT_CREATED_TRANSACTION: {
1445 data.enforceInterface(IActivityManager.descriptor);
1446 String packageName = data.readString();
1447 IBinder agent = data.readStrongBinder();
1448 backupAgentCreated(packageName, agent);
1449 reply.writeNoException();
1450 return true;
1451 }
1452
1453 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1456 unbindBackupAgent(info);
1457 reply.writeNoException();
1458 return true;
1459 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001460
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001461 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001462 data.enforceInterface(IActivityManager.descriptor);
1463 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001464 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001465 String reason = data.readString();
1466 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001467 reply.writeNoException();
1468 return true;
1469 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001470
1471 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1472 data.enforceInterface(IActivityManager.descriptor);
1473 String reason = data.readString();
1474 closeSystemDialogs(reason);
1475 reply.writeNoException();
1476 return true;
1477 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001478
1479 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1480 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001481 int[] pids = data.createIntArray();
1482 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001483 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001484 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001485 return true;
1486 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001487
1488 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
1490 String processName = data.readString();
1491 int uid = data.readInt();
1492 killApplicationProcess(processName, uid);
1493 reply.writeNoException();
1494 return true;
1495 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001496
1497 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 IBinder token = data.readStrongBinder();
1500 String packageName = data.readString();
1501 int enterAnim = data.readInt();
1502 int exitAnim = data.readInt();
1503 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001504 reply.writeNoException();
1505 return true;
1506 }
1507
1508 case IS_USER_A_MONKEY_TRANSACTION: {
1509 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001510 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001511 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001512 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001513 return true;
1514 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001515
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001516 case SET_USER_IS_MONKEY_TRANSACTION: {
1517 data.enforceInterface(IActivityManager.descriptor);
1518 final boolean monkey = (data.readInt() == 1);
1519 setUserIsMonkey(monkey);
1520 reply.writeNoException();
1521 return true;
1522 }
1523
Dianne Hackborn860755f2010-06-03 18:47:52 -07001524 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1525 data.enforceInterface(IActivityManager.descriptor);
1526 finishHeavyWeightApp();
1527 reply.writeNoException();
1528 return true;
1529 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001530
1531 case IS_IMMERSIVE_TRANSACTION: {
1532 data.enforceInterface(IActivityManager.descriptor);
1533 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001534 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001535 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001536 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001537 return true;
1538 }
1539
Craig Mautner5eda9b32013-07-02 11:58:16 -07001540 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001541 data.enforceInterface(IActivityManager.descriptor);
1542 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001543 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001544 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001545 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001546 return true;
1547 }
1548
1549 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1550 data.enforceInterface(IActivityManager.descriptor);
1551 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001552 final Bundle bundle;
1553 if (data.readInt() == 0) {
1554 bundle = null;
1555 } else {
1556 bundle = data.readBundle();
1557 }
1558 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1559 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001560 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001561 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001562 return true;
1563 }
1564
Craig Mautner233ceee2014-05-09 17:05:11 -07001565 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1566 data.enforceInterface(IActivityManager.descriptor);
1567 IBinder token = data.readStrongBinder();
1568 final ActivityOptions options = getActivityOptions(token);
1569 reply.writeNoException();
1570 reply.writeBundle(options == null ? null : options.toBundle());
1571 return true;
1572 }
1573
Daniel Sandler69a48172010-06-23 16:29:36 -04001574 case SET_IMMERSIVE_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 IBinder token = data.readStrongBinder();
1577 boolean imm = data.readInt() == 1;
1578 setImmersive(token, imm);
1579 reply.writeNoException();
1580 return true;
1581 }
1582
1583 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001585 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001586 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001587 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001588 return true;
1589 }
1590
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001591 case CRASH_APPLICATION_TRANSACTION: {
1592 data.enforceInterface(IActivityManager.descriptor);
1593 int uid = data.readInt();
1594 int initialPid = data.readInt();
1595 String packageName = data.readString();
1596 String message = data.readString();
1597 crashApplication(uid, initialPid, packageName, message);
1598 reply.writeNoException();
1599 return true;
1600 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001601
1602 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1603 data.enforceInterface(IActivityManager.descriptor);
1604 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001605 int userId = data.readInt();
1606 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001607 reply.writeNoException();
1608 reply.writeString(type);
1609 return true;
1610 }
1611
Dianne Hackborn7e269642010-08-25 19:50:20 -07001612 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1613 data.enforceInterface(IActivityManager.descriptor);
1614 String name = data.readString();
1615 IBinder perm = newUriPermissionOwner(name);
1616 reply.writeNoException();
1617 reply.writeStrongBinder(perm);
1618 return true;
1619 }
1620
1621 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 IBinder owner = data.readStrongBinder();
1624 int fromUid = data.readInt();
1625 String targetPkg = data.readString();
1626 Uri uri = Uri.CREATOR.createFromParcel(data);
1627 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001628 int userId = data.readInt();
1629 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001630 reply.writeNoException();
1631 return true;
1632 }
1633
1634 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1635 data.enforceInterface(IActivityManager.descriptor);
1636 IBinder owner = data.readStrongBinder();
1637 Uri uri = null;
1638 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001639 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001640 }
1641 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001642 int userId = data.readInt();
1643 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001644 reply.writeNoException();
1645 return true;
1646 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001647
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001648 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1649 data.enforceInterface(IActivityManager.descriptor);
1650 int callingUid = data.readInt();
1651 String targetPkg = data.readString();
1652 Uri uri = Uri.CREATOR.createFromParcel(data);
1653 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001654 int userId = data.readInt();
1655 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001656 reply.writeNoException();
1657 reply.writeInt(res);
1658 return true;
1659 }
1660
Andy McFadden824c5102010-07-09 16:26:57 -07001661 case DUMP_HEAP_TRANSACTION: {
1662 data.enforceInterface(IActivityManager.descriptor);
1663 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001664 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001665 boolean managed = data.readInt() != 0;
1666 String path = data.readString();
1667 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001668 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001669 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001670 reply.writeNoException();
1671 reply.writeInt(res ? 1 : 0);
1672 return true;
1673 }
1674
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001675 case START_ACTIVITIES_TRANSACTION:
1676 {
1677 data.enforceInterface(IActivityManager.descriptor);
1678 IBinder b = data.readStrongBinder();
1679 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001680 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001681 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1682 String[] resolvedTypes = data.createStringArray();
1683 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001684 Bundle options = data.readInt() != 0
1685 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001686 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001687 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001688 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001689 reply.writeNoException();
1690 reply.writeInt(result);
1691 return true;
1692 }
1693
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001694 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1695 {
1696 data.enforceInterface(IActivityManager.descriptor);
1697 int mode = getFrontActivityScreenCompatMode();
1698 reply.writeNoException();
1699 reply.writeInt(mode);
1700 return true;
1701 }
1702
1703 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1704 {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 int mode = data.readInt();
1707 setFrontActivityScreenCompatMode(mode);
1708 reply.writeNoException();
1709 reply.writeInt(mode);
1710 return true;
1711 }
1712
1713 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1714 {
1715 data.enforceInterface(IActivityManager.descriptor);
1716 String pkg = data.readString();
1717 int mode = getPackageScreenCompatMode(pkg);
1718 reply.writeNoException();
1719 reply.writeInt(mode);
1720 return true;
1721 }
1722
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001723 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1724 {
1725 data.enforceInterface(IActivityManager.descriptor);
1726 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001727 int mode = data.readInt();
1728 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001729 reply.writeNoException();
1730 return true;
1731 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001732
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001733 case SWITCH_USER_TRANSACTION: {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 int userid = data.readInt();
1736 boolean result = switchUser(userid);
1737 reply.writeNoException();
1738 reply.writeInt(result ? 1 : 0);
1739 return true;
1740 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001741
Kenny Guy08488bf2014-02-21 17:40:37 +00001742 case START_USER_IN_BACKGROUND_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 int userid = data.readInt();
1745 boolean result = startUserInBackground(userid);
1746 reply.writeNoException();
1747 reply.writeInt(result ? 1 : 0);
1748 return true;
1749 }
1750
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001751 case STOP_USER_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 int userid = data.readInt();
1754 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1755 data.readStrongBinder());
1756 int result = stopUser(userid, callback);
1757 reply.writeNoException();
1758 reply.writeInt(result);
1759 return true;
1760 }
1761
Amith Yamasani52f1d752012-03-28 18:19:29 -07001762 case GET_CURRENT_USER_TRANSACTION: {
1763 data.enforceInterface(IActivityManager.descriptor);
1764 UserInfo userInfo = getCurrentUser();
1765 reply.writeNoException();
1766 userInfo.writeToParcel(reply, 0);
1767 return true;
1768 }
1769
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001770 case IS_USER_RUNNING_TRANSACTION: {
1771 data.enforceInterface(IActivityManager.descriptor);
1772 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001773 boolean orStopping = data.readInt() != 0;
1774 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001775 reply.writeNoException();
1776 reply.writeInt(result ? 1 : 0);
1777 return true;
1778 }
1779
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001780 case GET_RUNNING_USER_IDS_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 int[] result = getRunningUserIds();
1783 reply.writeNoException();
1784 reply.writeIntArray(result);
1785 return true;
1786 }
1787
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001788 case REMOVE_TASK_TRANSACTION:
1789 {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 int taskId = data.readInt();
1792 int fl = data.readInt();
1793 boolean result = removeTask(taskId, fl);
1794 reply.writeNoException();
1795 reply.writeInt(result ? 1 : 0);
1796 return true;
1797 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001798
Jeff Sharkeya4620792011-05-20 15:29:23 -07001799 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1800 data.enforceInterface(IActivityManager.descriptor);
1801 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1802 data.readStrongBinder());
1803 registerProcessObserver(observer);
1804 return true;
1805 }
1806
1807 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1808 data.enforceInterface(IActivityManager.descriptor);
1809 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1810 data.readStrongBinder());
1811 unregisterProcessObserver(observer);
1812 return true;
1813 }
1814
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001815 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1816 {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 String pkg = data.readString();
1819 boolean ask = getPackageAskScreenCompat(pkg);
1820 reply.writeNoException();
1821 reply.writeInt(ask ? 1 : 0);
1822 return true;
1823 }
1824
1825 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1826 {
1827 data.enforceInterface(IActivityManager.descriptor);
1828 String pkg = data.readString();
1829 boolean ask = data.readInt() != 0;
1830 setPackageAskScreenCompat(pkg, ask);
1831 reply.writeNoException();
1832 return true;
1833 }
1834
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001835 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1836 data.enforceInterface(IActivityManager.descriptor);
1837 IIntentSender r = IIntentSender.Stub.asInterface(
1838 data.readStrongBinder());
1839 boolean res = isIntentSenderTargetedToPackage(r);
1840 reply.writeNoException();
1841 reply.writeInt(res ? 1 : 0);
1842 return true;
1843 }
1844
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001845 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1846 data.enforceInterface(IActivityManager.descriptor);
1847 IIntentSender r = IIntentSender.Stub.asInterface(
1848 data.readStrongBinder());
1849 boolean res = isIntentSenderAnActivity(r);
1850 reply.writeNoException();
1851 reply.writeInt(res ? 1 : 0);
1852 return true;
1853 }
1854
Dianne Hackborn81038902012-11-26 17:04:09 -08001855 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1856 data.enforceInterface(IActivityManager.descriptor);
1857 IIntentSender r = IIntentSender.Stub.asInterface(
1858 data.readStrongBinder());
1859 Intent intent = getIntentForIntentSender(r);
1860 reply.writeNoException();
1861 if (intent != null) {
1862 reply.writeInt(1);
1863 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1864 } else {
1865 reply.writeInt(0);
1866 }
1867 return true;
1868 }
1869
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001870 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1871 data.enforceInterface(IActivityManager.descriptor);
1872 IIntentSender r = IIntentSender.Stub.asInterface(
1873 data.readStrongBinder());
1874 String prefix = data.readString();
1875 String tag = getTagForIntentSender(r, prefix);
1876 reply.writeNoException();
1877 reply.writeString(tag);
1878 return true;
1879 }
1880
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001881 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1882 data.enforceInterface(IActivityManager.descriptor);
1883 Configuration config = Configuration.CREATOR.createFromParcel(data);
1884 updatePersistentConfiguration(config);
1885 reply.writeNoException();
1886 return true;
1887 }
1888
Dianne Hackbornb437e092011-08-05 17:50:29 -07001889 case GET_PROCESS_PSS_TRANSACTION: {
1890 data.enforceInterface(IActivityManager.descriptor);
1891 int[] pids = data.createIntArray();
1892 long[] pss = getProcessPss(pids);
1893 reply.writeNoException();
1894 reply.writeLongArray(pss);
1895 return true;
1896 }
1897
Dianne Hackborn661cd522011-08-22 00:26:20 -07001898 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1899 data.enforceInterface(IActivityManager.descriptor);
1900 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1901 boolean always = data.readInt() != 0;
1902 showBootMessage(msg, always);
1903 reply.writeNoException();
1904 return true;
1905 }
1906
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001907 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 dismissKeyguardOnNextActivity();
1910 reply.writeNoException();
1911 return true;
1912 }
1913
Adam Powelldd8fab22012-03-22 17:47:27 -07001914 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1915 data.enforceInterface(IActivityManager.descriptor);
1916 IBinder token = data.readStrongBinder();
1917 String destAffinity = data.readString();
1918 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1919 reply.writeNoException();
1920 reply.writeInt(res ? 1 : 0);
1921 return true;
1922 }
1923
1924 case NAVIGATE_UP_TO_TRANSACTION: {
1925 data.enforceInterface(IActivityManager.descriptor);
1926 IBinder token = data.readStrongBinder();
1927 Intent target = Intent.CREATOR.createFromParcel(data);
1928 int resultCode = data.readInt();
1929 Intent resultData = null;
1930 if (data.readInt() != 0) {
1931 resultData = Intent.CREATOR.createFromParcel(data);
1932 }
1933 boolean res = navigateUpTo(token, target, resultCode, resultData);
1934 reply.writeNoException();
1935 reply.writeInt(res ? 1 : 0);
1936 return true;
1937 }
1938
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001939 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1940 data.enforceInterface(IActivityManager.descriptor);
1941 IBinder token = data.readStrongBinder();
1942 int res = getLaunchedFromUid(token);
1943 reply.writeNoException();
1944 reply.writeInt(res);
1945 return true;
1946 }
1947
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001948 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 IBinder token = data.readStrongBinder();
1951 String res = getLaunchedFromPackage(token);
1952 reply.writeNoException();
1953 reply.writeString(res);
1954 return true;
1955 }
1956
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001957 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1960 data.readStrongBinder());
1961 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001962 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001963 return true;
1964 }
1965
1966 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1969 data.readStrongBinder());
1970 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001971 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001972 return true;
1973 }
1974
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001975 case REQUEST_BUG_REPORT_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001978 reply.writeNoException();
1979 return true;
1980 }
1981
1982 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1983 data.enforceInterface(IActivityManager.descriptor);
1984 int pid = data.readInt();
1985 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001986 String reason = data.readString();
1987 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001988 reply.writeNoException();
1989 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001990 return true;
1991 }
1992
Adam Skorydfc7fd72013-08-05 19:23:41 -07001993 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001994 data.enforceInterface(IActivityManager.descriptor);
1995 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07001996 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08001997 reply.writeNoException();
1998 reply.writeBundle(res);
1999 return true;
2000 }
2001
Adam Skorydfc7fd72013-08-05 19:23:41 -07002002 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002003 data.enforceInterface(IActivityManager.descriptor);
2004 IBinder token = data.readStrongBinder();
2005 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002006 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002007 reply.writeNoException();
2008 return true;
2009 }
2010
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002011 case KILL_UID_TRANSACTION: {
2012 data.enforceInterface(IActivityManager.descriptor);
2013 int uid = data.readInt();
2014 String reason = data.readString();
2015 killUid(uid, reason);
2016 reply.writeNoException();
2017 return true;
2018 }
2019
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002020 case HANG_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 IBinder who = data.readStrongBinder();
2023 boolean allowRestart = data.readInt() != 0;
2024 hang(who, allowRestart);
2025 reply.writeNoException();
2026 return true;
2027 }
2028
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002029 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 IBinder token = data.readStrongBinder();
2032 reportActivityFullyDrawn(token);
2033 reply.writeNoException();
2034 return true;
2035 }
2036
Craig Mautner5eda9b32013-07-02 11:58:16 -07002037 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2038 data.enforceInterface(IActivityManager.descriptor);
2039 IBinder token = data.readStrongBinder();
2040 notifyActivityDrawn(token);
2041 reply.writeNoException();
2042 return true;
2043 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002044
2045 case RESTART_TRANSACTION: {
2046 data.enforceInterface(IActivityManager.descriptor);
2047 restart();
2048 reply.writeNoException();
2049 return true;
2050 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002051
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002052 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2053 data.enforceInterface(IActivityManager.descriptor);
2054 performIdleMaintenance();
2055 reply.writeNoException();
2056 return true;
2057 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002058
2059 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2060 data.enforceInterface(IActivityManager.descriptor);
2061 IBinder parentActivityToken = data.readStrongBinder();
2062 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002063 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002064 IActivityContainer activityContainer =
2065 createActivityContainer(parentActivityToken, callback);
2066 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002067 if (activityContainer != null) {
2068 reply.writeInt(1);
2069 reply.writeStrongBinder(activityContainer.asBinder());
2070 } else {
2071 reply.writeInt(0);
2072 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002073 return true;
2074 }
2075
Craig Mautner95da1082014-02-24 17:54:35 -08002076 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2077 data.enforceInterface(IActivityManager.descriptor);
2078 IActivityContainer activityContainer =
2079 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2080 deleteActivityContainer(activityContainer);
2081 reply.writeNoException();
2082 return true;
2083 }
2084
Craig Mautnere0a38842013-12-16 16:14:02 -08002085 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2086 data.enforceInterface(IActivityManager.descriptor);
2087 IBinder activityToken = data.readStrongBinder();
2088 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2089 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002090 if (activityContainer != null) {
2091 reply.writeInt(1);
2092 reply.writeStrongBinder(activityContainer.asBinder());
2093 } else {
2094 reply.writeInt(0);
2095 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002096 return true;
2097 }
2098
Craig Mautner4a1cb222013-12-04 16:14:06 -08002099 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2100 data.enforceInterface(IActivityManager.descriptor);
2101 IBinder homeActivityToken = getHomeActivityToken();
2102 reply.writeNoException();
2103 reply.writeStrongBinder(homeActivityToken);
2104 return true;
2105 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002106
2107 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2108 data.enforceInterface(IActivityManager.descriptor);
2109 final int taskId = data.readInt();
2110 startLockTaskMode(taskId);
2111 reply.writeNoException();
2112 return true;
2113 }
2114
2115 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2116 data.enforceInterface(IActivityManager.descriptor);
2117 IBinder token = data.readStrongBinder();
2118 startLockTaskMode(token);
2119 reply.writeNoException();
2120 return true;
2121 }
2122
Jason Monk62515be2014-05-21 16:06:19 -04002123 case START_LOCK_TASK_BY_CURRENT: {
2124 data.enforceInterface(IActivityManager.descriptor);
2125 startLockTaskModeOnCurrent();
2126 reply.writeNoException();
2127 return true;
2128 }
2129
Craig Mautneraea74a52014-03-08 14:23:10 -08002130 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2131 data.enforceInterface(IActivityManager.descriptor);
2132 stopLockTaskMode();
2133 reply.writeNoException();
2134 return true;
2135 }
2136
Jason Monk62515be2014-05-21 16:06:19 -04002137 case STOP_LOCK_TASK_BY_CURRENT: {
2138 data.enforceInterface(IActivityManager.descriptor);
2139 stopLockTaskModeOnCurrent();
2140 reply.writeNoException();
2141 return true;
2142 }
2143
Craig Mautneraea74a52014-03-08 14:23:10 -08002144 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2145 data.enforceInterface(IActivityManager.descriptor);
2146 final boolean isInLockTaskMode = isInLockTaskMode();
2147 reply.writeNoException();
2148 reply.writeInt(isInLockTaskMode ? 1 : 0);
2149 return true;
2150 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002151
Winson Chunga449dc02014-05-16 11:15:04 -07002152 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002153 data.enforceInterface(IActivityManager.descriptor);
2154 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002155 ActivityManager.TaskDescription values =
2156 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2157 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002158 reply.writeNoException();
2159 return true;
2160 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002161 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002163 return super.onTransact(code, data, reply, flags);
2164 }
2165
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002166 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002167 return this;
2168 }
2169
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002170 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2171 protected IActivityManager create() {
2172 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002173 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002174 Log.v("ActivityManager", "default service binder = " + b);
2175 }
2176 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002177 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002178 Log.v("ActivityManager", "default service = " + am);
2179 }
2180 return am;
2181 }
2182 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002183}
2184
2185class ActivityManagerProxy implements IActivityManager
2186{
2187 public ActivityManagerProxy(IBinder remote)
2188 {
2189 mRemote = remote;
2190 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002191
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002192 public IBinder asBinder()
2193 {
2194 return mRemote;
2195 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002196
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002197 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002198 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2199 int startFlags, String profileFile,
2200 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201 Parcel data = Parcel.obtain();
2202 Parcel reply = Parcel.obtain();
2203 data.writeInterfaceToken(IActivityManager.descriptor);
2204 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002205 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002206 intent.writeToParcel(data, 0);
2207 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002208 data.writeStrongBinder(resultTo);
2209 data.writeString(resultWho);
2210 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002211 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002212 data.writeString(profileFile);
2213 if (profileFd != null) {
2214 data.writeInt(1);
2215 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2216 } else {
2217 data.writeInt(0);
2218 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002219 if (options != null) {
2220 data.writeInt(1);
2221 options.writeToParcel(data, 0);
2222 } else {
2223 data.writeInt(0);
2224 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002225 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2226 reply.readException();
2227 int result = reply.readInt();
2228 reply.recycle();
2229 data.recycle();
2230 return result;
2231 }
Amith Yamasani82644082012-08-03 13:09:11 -07002232
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002233 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002234 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2235 int startFlags, String profileFile,
2236 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2237 Parcel data = Parcel.obtain();
2238 Parcel reply = Parcel.obtain();
2239 data.writeInterfaceToken(IActivityManager.descriptor);
2240 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002241 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002242 intent.writeToParcel(data, 0);
2243 data.writeString(resolvedType);
2244 data.writeStrongBinder(resultTo);
2245 data.writeString(resultWho);
2246 data.writeInt(requestCode);
2247 data.writeInt(startFlags);
2248 data.writeString(profileFile);
2249 if (profileFd != null) {
2250 data.writeInt(1);
2251 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2252 } else {
2253 data.writeInt(0);
2254 }
2255 if (options != null) {
2256 data.writeInt(1);
2257 options.writeToParcel(data, 0);
2258 } else {
2259 data.writeInt(0);
2260 }
2261 data.writeInt(userId);
2262 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2263 reply.readException();
2264 int result = reply.readInt();
2265 reply.recycle();
2266 data.recycle();
2267 return result;
2268 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002269 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2270 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002271 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002272 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002273 Parcel data = Parcel.obtain();
2274 Parcel reply = Parcel.obtain();
2275 data.writeInterfaceToken(IActivityManager.descriptor);
2276 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002277 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002278 intent.writeToParcel(data, 0);
2279 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002280 data.writeStrongBinder(resultTo);
2281 data.writeString(resultWho);
2282 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002283 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002284 data.writeString(profileFile);
2285 if (profileFd != null) {
2286 data.writeInt(1);
2287 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2288 } else {
2289 data.writeInt(0);
2290 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002291 if (options != null) {
2292 data.writeInt(1);
2293 options.writeToParcel(data, 0);
2294 } else {
2295 data.writeInt(0);
2296 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002297 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002298 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2299 reply.readException();
2300 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2301 reply.recycle();
2302 data.recycle();
2303 return result;
2304 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002305 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2306 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002307 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002308 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002309 Parcel data = Parcel.obtain();
2310 Parcel reply = Parcel.obtain();
2311 data.writeInterfaceToken(IActivityManager.descriptor);
2312 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002313 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002314 intent.writeToParcel(data, 0);
2315 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002316 data.writeStrongBinder(resultTo);
2317 data.writeString(resultWho);
2318 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002319 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002320 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002321 if (options != null) {
2322 data.writeInt(1);
2323 options.writeToParcel(data, 0);
2324 } else {
2325 data.writeInt(0);
2326 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002327 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002328 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2329 reply.readException();
2330 int result = reply.readInt();
2331 reply.recycle();
2332 data.recycle();
2333 return result;
2334 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002335 public int startActivityIntentSender(IApplicationThread caller,
2336 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002337 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002338 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002339 Parcel data = Parcel.obtain();
2340 Parcel reply = Parcel.obtain();
2341 data.writeInterfaceToken(IActivityManager.descriptor);
2342 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2343 intent.writeToParcel(data, 0);
2344 if (fillInIntent != null) {
2345 data.writeInt(1);
2346 fillInIntent.writeToParcel(data, 0);
2347 } else {
2348 data.writeInt(0);
2349 }
2350 data.writeString(resolvedType);
2351 data.writeStrongBinder(resultTo);
2352 data.writeString(resultWho);
2353 data.writeInt(requestCode);
2354 data.writeInt(flagsMask);
2355 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002356 if (options != null) {
2357 data.writeInt(1);
2358 options.writeToParcel(data, 0);
2359 } else {
2360 data.writeInt(0);
2361 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002362 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002363 reply.readException();
2364 int result = reply.readInt();
2365 reply.recycle();
2366 data.recycle();
2367 return result;
2368 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002369 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2370 Intent intent, String resolvedType, IVoiceInteractionSession session,
2371 IVoiceInteractor interactor, int startFlags, String profileFile,
2372 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2373 Parcel data = Parcel.obtain();
2374 Parcel reply = Parcel.obtain();
2375 data.writeInterfaceToken(IActivityManager.descriptor);
2376 data.writeString(callingPackage);
2377 data.writeInt(callingPid);
2378 data.writeInt(callingUid);
2379 intent.writeToParcel(data, 0);
2380 data.writeString(resolvedType);
2381 data.writeStrongBinder(session.asBinder());
2382 data.writeStrongBinder(interactor.asBinder());
2383 data.writeInt(startFlags);
2384 data.writeString(profileFile);
2385 if (profileFd != null) {
2386 data.writeInt(1);
2387 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2388 } else {
2389 data.writeInt(0);
2390 }
2391 if (options != null) {
2392 data.writeInt(1);
2393 options.writeToParcel(data, 0);
2394 } else {
2395 data.writeInt(0);
2396 }
2397 data.writeInt(userId);
2398 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2399 reply.readException();
2400 int result = reply.readInt();
2401 reply.recycle();
2402 data.recycle();
2403 return result;
2404 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002405 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002406 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002407 Parcel data = Parcel.obtain();
2408 Parcel reply = Parcel.obtain();
2409 data.writeInterfaceToken(IActivityManager.descriptor);
2410 data.writeStrongBinder(callingActivity);
2411 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002412 if (options != null) {
2413 data.writeInt(1);
2414 options.writeToParcel(data, 0);
2415 } else {
2416 data.writeInt(0);
2417 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002418 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2419 reply.readException();
2420 int result = reply.readInt();
2421 reply.recycle();
2422 data.recycle();
2423 return result != 0;
2424 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002425 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002426 throws RemoteException {
2427 Parcel data = Parcel.obtain();
2428 Parcel reply = Parcel.obtain();
2429 data.writeInterfaceToken(IActivityManager.descriptor);
2430 data.writeStrongBinder(token);
2431 data.writeInt(resultCode);
2432 if (resultData != null) {
2433 data.writeInt(1);
2434 resultData.writeToParcel(data, 0);
2435 } else {
2436 data.writeInt(0);
2437 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002438 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002439 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2440 reply.readException();
2441 boolean res = reply.readInt() != 0;
2442 data.recycle();
2443 reply.recycle();
2444 return res;
2445 }
2446 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2447 {
2448 Parcel data = Parcel.obtain();
2449 Parcel reply = Parcel.obtain();
2450 data.writeInterfaceToken(IActivityManager.descriptor);
2451 data.writeStrongBinder(token);
2452 data.writeString(resultWho);
2453 data.writeInt(requestCode);
2454 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2455 reply.readException();
2456 data.recycle();
2457 reply.recycle();
2458 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002459 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2460 Parcel data = Parcel.obtain();
2461 Parcel reply = Parcel.obtain();
2462 data.writeInterfaceToken(IActivityManager.descriptor);
2463 data.writeStrongBinder(token);
2464 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2465 reply.readException();
2466 boolean res = reply.readInt() != 0;
2467 data.recycle();
2468 reply.recycle();
2469 return res;
2470 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002471 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2472 Parcel data = Parcel.obtain();
2473 Parcel reply = Parcel.obtain();
2474 data.writeInterfaceToken(IActivityManager.descriptor);
2475 data.writeStrongBinder(token);
2476 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2477 reply.readException();
2478 boolean res = reply.readInt() != 0;
2479 data.recycle();
2480 reply.recycle();
2481 return res;
2482 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002483 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002484 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002485 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002486 {
2487 Parcel data = Parcel.obtain();
2488 Parcel reply = Parcel.obtain();
2489 data.writeInterfaceToken(IActivityManager.descriptor);
2490 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002491 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002492 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2493 filter.writeToParcel(data, 0);
2494 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002495 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002496 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2497 reply.readException();
2498 Intent intent = null;
2499 int haveIntent = reply.readInt();
2500 if (haveIntent != 0) {
2501 intent = Intent.CREATOR.createFromParcel(reply);
2502 }
2503 reply.recycle();
2504 data.recycle();
2505 return intent;
2506 }
2507 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2508 {
2509 Parcel data = Parcel.obtain();
2510 Parcel reply = Parcel.obtain();
2511 data.writeInterfaceToken(IActivityManager.descriptor);
2512 data.writeStrongBinder(receiver.asBinder());
2513 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2514 reply.readException();
2515 data.recycle();
2516 reply.recycle();
2517 }
2518 public int broadcastIntent(IApplicationThread caller,
2519 Intent intent, String resolvedType, IIntentReceiver resultTo,
2520 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002521 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002522 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002523 {
2524 Parcel data = Parcel.obtain();
2525 Parcel reply = Parcel.obtain();
2526 data.writeInterfaceToken(IActivityManager.descriptor);
2527 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2528 intent.writeToParcel(data, 0);
2529 data.writeString(resolvedType);
2530 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2531 data.writeInt(resultCode);
2532 data.writeString(resultData);
2533 data.writeBundle(map);
2534 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002535 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002536 data.writeInt(serialized ? 1 : 0);
2537 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002538 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002539 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2540 reply.readException();
2541 int res = reply.readInt();
2542 reply.recycle();
2543 data.recycle();
2544 return res;
2545 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002546 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2547 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002548 {
2549 Parcel data = Parcel.obtain();
2550 Parcel reply = Parcel.obtain();
2551 data.writeInterfaceToken(IActivityManager.descriptor);
2552 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2553 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002554 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002555 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2556 reply.readException();
2557 data.recycle();
2558 reply.recycle();
2559 }
2560 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2561 {
2562 Parcel data = Parcel.obtain();
2563 Parcel reply = Parcel.obtain();
2564 data.writeInterfaceToken(IActivityManager.descriptor);
2565 data.writeStrongBinder(who);
2566 data.writeInt(resultCode);
2567 data.writeString(resultData);
2568 data.writeBundle(map);
2569 data.writeInt(abortBroadcast ? 1 : 0);
2570 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2571 reply.readException();
2572 data.recycle();
2573 reply.recycle();
2574 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 public void attachApplication(IApplicationThread app) throws RemoteException
2576 {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 data.writeStrongBinder(app.asBinder());
2581 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2582 reply.readException();
2583 data.recycle();
2584 reply.recycle();
2585 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002586 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2587 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002588 {
2589 Parcel data = Parcel.obtain();
2590 Parcel reply = Parcel.obtain();
2591 data.writeInterfaceToken(IActivityManager.descriptor);
2592 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002593 if (config != null) {
2594 data.writeInt(1);
2595 config.writeToParcel(data, 0);
2596 } else {
2597 data.writeInt(0);
2598 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002599 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002600 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2601 reply.readException();
2602 data.recycle();
2603 reply.recycle();
2604 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002605 public void activityResumed(IBinder token) throws RemoteException
2606 {
2607 Parcel data = Parcel.obtain();
2608 Parcel reply = Parcel.obtain();
2609 data.writeInterfaceToken(IActivityManager.descriptor);
2610 data.writeStrongBinder(token);
2611 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2612 reply.readException();
2613 data.recycle();
2614 reply.recycle();
2615 }
Craig Mautnera0026042014-04-23 11:45:37 -07002616 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002617 {
2618 Parcel data = Parcel.obtain();
2619 Parcel reply = Parcel.obtain();
2620 data.writeInterfaceToken(IActivityManager.descriptor);
2621 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002622 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002623 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2624 reply.readException();
2625 data.recycle();
2626 reply.recycle();
2627 }
2628 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002629 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002630 {
2631 Parcel data = Parcel.obtain();
2632 Parcel reply = Parcel.obtain();
2633 data.writeInterfaceToken(IActivityManager.descriptor);
2634 data.writeStrongBinder(token);
2635 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002636 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002637 TextUtils.writeToParcel(description, data, 0);
2638 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2639 reply.readException();
2640 data.recycle();
2641 reply.recycle();
2642 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002643 public void activitySlept(IBinder token) throws RemoteException
2644 {
2645 Parcel data = Parcel.obtain();
2646 Parcel reply = Parcel.obtain();
2647 data.writeInterfaceToken(IActivityManager.descriptor);
2648 data.writeStrongBinder(token);
2649 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2650 reply.readException();
2651 data.recycle();
2652 reply.recycle();
2653 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002654 public void activityDestroyed(IBinder token) throws RemoteException
2655 {
2656 Parcel data = Parcel.obtain();
2657 Parcel reply = Parcel.obtain();
2658 data.writeInterfaceToken(IActivityManager.descriptor);
2659 data.writeStrongBinder(token);
2660 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2661 reply.readException();
2662 data.recycle();
2663 reply.recycle();
2664 }
2665 public String getCallingPackage(IBinder token) throws RemoteException
2666 {
2667 Parcel data = Parcel.obtain();
2668 Parcel reply = Parcel.obtain();
2669 data.writeInterfaceToken(IActivityManager.descriptor);
2670 data.writeStrongBinder(token);
2671 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2672 reply.readException();
2673 String res = reply.readString();
2674 data.recycle();
2675 reply.recycle();
2676 return res;
2677 }
2678 public ComponentName getCallingActivity(IBinder token)
2679 throws RemoteException {
2680 Parcel data = Parcel.obtain();
2681 Parcel reply = Parcel.obtain();
2682 data.writeInterfaceToken(IActivityManager.descriptor);
2683 data.writeStrongBinder(token);
2684 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2685 reply.readException();
2686 ComponentName res = ComponentName.readFromParcel(reply);
2687 data.recycle();
2688 reply.recycle();
2689 return res;
2690 }
Winson Chung1147c402014-05-14 11:05:00 -07002691 public List<IAppTask> getAppTasks() throws RemoteException {
2692 Parcel data = Parcel.obtain();
2693 Parcel reply = Parcel.obtain();
2694 data.writeInterfaceToken(IActivityManager.descriptor);
2695 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2696 reply.readException();
2697 ArrayList<IAppTask> list = null;
2698 int N = reply.readInt();
2699 if (N >= 0) {
2700 list = new ArrayList<IAppTask>();
2701 while (N > 0) {
2702 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2703 list.add(task);
2704 N--;
2705 }
2706 }
2707 data.recycle();
2708 reply.recycle();
2709 return list;
2710 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002711 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002712 Parcel data = Parcel.obtain();
2713 Parcel reply = Parcel.obtain();
2714 data.writeInterfaceToken(IActivityManager.descriptor);
2715 data.writeInt(maxNum);
2716 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002717 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2718 reply.readException();
2719 ArrayList list = null;
2720 int N = reply.readInt();
2721 if (N >= 0) {
2722 list = new ArrayList();
2723 while (N > 0) {
2724 ActivityManager.RunningTaskInfo info =
2725 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002726 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002727 list.add(info);
2728 N--;
2729 }
2730 }
2731 data.recycle();
2732 reply.recycle();
2733 return list;
2734 }
2735 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002736 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002737 Parcel data = Parcel.obtain();
2738 Parcel reply = Parcel.obtain();
2739 data.writeInterfaceToken(IActivityManager.descriptor);
2740 data.writeInt(maxNum);
2741 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002742 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002743 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2744 reply.readException();
2745 ArrayList<ActivityManager.RecentTaskInfo> list
2746 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2747 data.recycle();
2748 reply.recycle();
2749 return list;
2750 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002751 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002752 Parcel data = Parcel.obtain();
2753 Parcel reply = Parcel.obtain();
2754 data.writeInterfaceToken(IActivityManager.descriptor);
2755 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002756 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002757 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002758 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002759 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002760 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002761 }
2762 data.recycle();
2763 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002764 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002765 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002766 public List getServices(int maxNum, int flags) throws RemoteException {
2767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeInt(maxNum);
2771 data.writeInt(flags);
2772 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 ArrayList list = null;
2775 int N = reply.readInt();
2776 if (N >= 0) {
2777 list = new ArrayList();
2778 while (N > 0) {
2779 ActivityManager.RunningServiceInfo info =
2780 ActivityManager.RunningServiceInfo.CREATOR
2781 .createFromParcel(reply);
2782 list.add(info);
2783 N--;
2784 }
2785 }
2786 data.recycle();
2787 reply.recycle();
2788 return list;
2789 }
2790 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2791 throws RemoteException {
2792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2796 reply.readException();
2797 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2798 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2799 data.recycle();
2800 reply.recycle();
2801 return list;
2802 }
2803 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2804 throws RemoteException {
2805 Parcel data = Parcel.obtain();
2806 Parcel reply = Parcel.obtain();
2807 data.writeInterfaceToken(IActivityManager.descriptor);
2808 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2809 reply.readException();
2810 ArrayList<ActivityManager.RunningAppProcessInfo> list
2811 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2812 data.recycle();
2813 reply.recycle();
2814 return list;
2815 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002816 public List<ApplicationInfo> getRunningExternalApplications()
2817 throws RemoteException {
2818 Parcel data = Parcel.obtain();
2819 Parcel reply = Parcel.obtain();
2820 data.writeInterfaceToken(IActivityManager.descriptor);
2821 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2822 reply.readException();
2823 ArrayList<ApplicationInfo> list
2824 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2825 data.recycle();
2826 reply.recycle();
2827 return list;
2828 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002829 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002830 {
2831 Parcel data = Parcel.obtain();
2832 Parcel reply = Parcel.obtain();
2833 data.writeInterfaceToken(IActivityManager.descriptor);
2834 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002835 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002836 if (options != null) {
2837 data.writeInt(1);
2838 options.writeToParcel(data, 0);
2839 } else {
2840 data.writeInt(0);
2841 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002842 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2843 reply.readException();
2844 data.recycle();
2845 reply.recycle();
2846 }
2847 public void moveTaskToBack(int task) throws RemoteException
2848 {
2849 Parcel data = Parcel.obtain();
2850 Parcel reply = Parcel.obtain();
2851 data.writeInterfaceToken(IActivityManager.descriptor);
2852 data.writeInt(task);
2853 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2854 reply.readException();
2855 data.recycle();
2856 reply.recycle();
2857 }
2858 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2859 throws RemoteException {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 data.writeStrongBinder(token);
2864 data.writeInt(nonRoot ? 1 : 0);
2865 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2866 reply.readException();
2867 boolean res = reply.readInt() != 0;
2868 data.recycle();
2869 reply.recycle();
2870 return res;
2871 }
2872 public void moveTaskBackwards(int task) throws RemoteException
2873 {
2874 Parcel data = Parcel.obtain();
2875 Parcel reply = Parcel.obtain();
2876 data.writeInterfaceToken(IActivityManager.descriptor);
2877 data.writeInt(task);
2878 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2879 reply.readException();
2880 data.recycle();
2881 reply.recycle();
2882 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002883 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002884 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2885 {
2886 Parcel data = Parcel.obtain();
2887 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002888 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002889 data.writeInt(taskId);
2890 data.writeInt(stackId);
2891 data.writeInt(toTop ? 1 : 0);
2892 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2893 reply.readException();
2894 data.recycle();
2895 reply.recycle();
2896 }
2897 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002898 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002899 {
2900 Parcel data = Parcel.obtain();
2901 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002902 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002903 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002904 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002905 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002906 reply.readException();
2907 data.recycle();
2908 reply.recycle();
2909 }
Craig Mautner967212c2013-04-13 21:10:58 -07002910 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002911 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002912 {
2913 Parcel data = Parcel.obtain();
2914 Parcel reply = Parcel.obtain();
2915 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002916 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002917 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002918 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002919 data.recycle();
2920 reply.recycle();
2921 return list;
2922 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002923 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002924 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002925 {
2926 Parcel data = Parcel.obtain();
2927 Parcel reply = Parcel.obtain();
2928 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002929 data.writeInt(stackId);
2930 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002931 reply.readException();
2932 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002933 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002934 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002935 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002936 }
2937 data.recycle();
2938 reply.recycle();
2939 return info;
2940 }
2941 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002942 public boolean isInHomeStack(int taskId) throws RemoteException {
2943 Parcel data = Parcel.obtain();
2944 Parcel reply = Parcel.obtain();
2945 data.writeInterfaceToken(IActivityManager.descriptor);
2946 data.writeInt(taskId);
2947 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 boolean isInHomeStack = reply.readInt() > 0;
2950 data.recycle();
2951 reply.recycle();
2952 return isInHomeStack;
2953 }
2954 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002955 public void setFocusedStack(int stackId) throws RemoteException
2956 {
2957 Parcel data = Parcel.obtain();
2958 Parcel reply = Parcel.obtain();
2959 data.writeInterfaceToken(IActivityManager.descriptor);
2960 data.writeInt(stackId);
2961 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2962 reply.readException();
2963 data.recycle();
2964 reply.recycle();
2965 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002966 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2967 {
2968 Parcel data = Parcel.obtain();
2969 Parcel reply = Parcel.obtain();
2970 data.writeInterfaceToken(IActivityManager.descriptor);
2971 data.writeStrongBinder(token);
2972 data.writeInt(onlyRoot ? 1 : 0);
2973 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2974 reply.readException();
2975 int res = reply.readInt();
2976 data.recycle();
2977 reply.recycle();
2978 return res;
2979 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002980 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07002981 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002982 Parcel data = Parcel.obtain();
2983 Parcel reply = Parcel.obtain();
2984 data.writeInterfaceToken(IActivityManager.descriptor);
2985 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2986 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07002987 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07002988 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002989 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
2990 reply.readException();
2991 int res = reply.readInt();
2992 ContentProviderHolder cph = null;
2993 if (res != 0) {
2994 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
2995 }
2996 data.recycle();
2997 reply.recycle();
2998 return cph;
2999 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003000 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3001 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003002 Parcel data = Parcel.obtain();
3003 Parcel reply = Parcel.obtain();
3004 data.writeInterfaceToken(IActivityManager.descriptor);
3005 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003006 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003007 data.writeStrongBinder(token);
3008 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3009 reply.readException();
3010 int res = reply.readInt();
3011 ContentProviderHolder cph = null;
3012 if (res != 0) {
3013 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3014 }
3015 data.recycle();
3016 reply.recycle();
3017 return cph;
3018 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003019 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003020 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003021 {
3022 Parcel data = Parcel.obtain();
3023 Parcel reply = Parcel.obtain();
3024 data.writeInterfaceToken(IActivityManager.descriptor);
3025 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3026 data.writeTypedList(providers);
3027 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 data.recycle();
3030 reply.recycle();
3031 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003032 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3033 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003034 Parcel data = Parcel.obtain();
3035 Parcel reply = Parcel.obtain();
3036 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003037 data.writeStrongBinder(connection);
3038 data.writeInt(stable);
3039 data.writeInt(unstable);
3040 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3041 reply.readException();
3042 boolean res = reply.readInt() != 0;
3043 data.recycle();
3044 reply.recycle();
3045 return res;
3046 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003047
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003048 public void unstableProviderDied(IBinder connection) throws RemoteException {
3049 Parcel data = Parcel.obtain();
3050 Parcel reply = Parcel.obtain();
3051 data.writeInterfaceToken(IActivityManager.descriptor);
3052 data.writeStrongBinder(connection);
3053 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3054 reply.readException();
3055 data.recycle();
3056 reply.recycle();
3057 }
3058
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003059 @Override
3060 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3061 Parcel data = Parcel.obtain();
3062 Parcel reply = Parcel.obtain();
3063 data.writeInterfaceToken(IActivityManager.descriptor);
3064 data.writeStrongBinder(connection);
3065 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3066 reply.readException();
3067 data.recycle();
3068 reply.recycle();
3069 }
3070
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003071 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3072 Parcel data = Parcel.obtain();
3073 Parcel reply = Parcel.obtain();
3074 data.writeInterfaceToken(IActivityManager.descriptor);
3075 data.writeStrongBinder(connection);
3076 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003077 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3078 reply.readException();
3079 data.recycle();
3080 reply.recycle();
3081 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003082
3083 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3084 Parcel data = Parcel.obtain();
3085 Parcel reply = Parcel.obtain();
3086 data.writeInterfaceToken(IActivityManager.descriptor);
3087 data.writeString(name);
3088 data.writeStrongBinder(token);
3089 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3090 reply.readException();
3091 data.recycle();
3092 reply.recycle();
3093 }
3094
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003095 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3096 throws RemoteException
3097 {
3098 Parcel data = Parcel.obtain();
3099 Parcel reply = Parcel.obtain();
3100 data.writeInterfaceToken(IActivityManager.descriptor);
3101 service.writeToParcel(data, 0);
3102 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3103 reply.readException();
3104 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3105 data.recycle();
3106 reply.recycle();
3107 return res;
3108 }
3109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003110 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003111 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003112 {
3113 Parcel data = Parcel.obtain();
3114 Parcel reply = Parcel.obtain();
3115 data.writeInterfaceToken(IActivityManager.descriptor);
3116 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3117 service.writeToParcel(data, 0);
3118 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003119 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003120 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3121 reply.readException();
3122 ComponentName res = ComponentName.readFromParcel(reply);
3123 data.recycle();
3124 reply.recycle();
3125 return res;
3126 }
3127 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003128 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003129 {
3130 Parcel data = Parcel.obtain();
3131 Parcel reply = Parcel.obtain();
3132 data.writeInterfaceToken(IActivityManager.descriptor);
3133 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3134 service.writeToParcel(data, 0);
3135 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003136 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003137 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3138 reply.readException();
3139 int res = reply.readInt();
3140 reply.recycle();
3141 data.recycle();
3142 return res;
3143 }
3144 public boolean stopServiceToken(ComponentName className, IBinder token,
3145 int startId) throws RemoteException {
3146 Parcel data = Parcel.obtain();
3147 Parcel reply = Parcel.obtain();
3148 data.writeInterfaceToken(IActivityManager.descriptor);
3149 ComponentName.writeToParcel(className, data);
3150 data.writeStrongBinder(token);
3151 data.writeInt(startId);
3152 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3153 reply.readException();
3154 boolean res = reply.readInt() != 0;
3155 data.recycle();
3156 reply.recycle();
3157 return res;
3158 }
3159 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003160 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003161 Parcel data = Parcel.obtain();
3162 Parcel reply = Parcel.obtain();
3163 data.writeInterfaceToken(IActivityManager.descriptor);
3164 ComponentName.writeToParcel(className, data);
3165 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003166 data.writeInt(id);
3167 if (notification != null) {
3168 data.writeInt(1);
3169 notification.writeToParcel(data, 0);
3170 } else {
3171 data.writeInt(0);
3172 }
3173 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003174 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3175 reply.readException();
3176 data.recycle();
3177 reply.recycle();
3178 }
3179 public int bindService(IApplicationThread caller, IBinder token,
3180 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003181 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003182 Parcel data = Parcel.obtain();
3183 Parcel reply = Parcel.obtain();
3184 data.writeInterfaceToken(IActivityManager.descriptor);
3185 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3186 data.writeStrongBinder(token);
3187 service.writeToParcel(data, 0);
3188 data.writeString(resolvedType);
3189 data.writeStrongBinder(connection.asBinder());
3190 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003191 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003192 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 int res = reply.readInt();
3195 data.recycle();
3196 reply.recycle();
3197 return res;
3198 }
3199 public boolean unbindService(IServiceConnection connection) throws RemoteException
3200 {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeStrongBinder(connection.asBinder());
3205 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3206 reply.readException();
3207 boolean res = reply.readInt() != 0;
3208 data.recycle();
3209 reply.recycle();
3210 return res;
3211 }
3212
3213 public void publishService(IBinder token,
3214 Intent intent, IBinder service) throws RemoteException {
3215 Parcel data = Parcel.obtain();
3216 Parcel reply = Parcel.obtain();
3217 data.writeInterfaceToken(IActivityManager.descriptor);
3218 data.writeStrongBinder(token);
3219 intent.writeToParcel(data, 0);
3220 data.writeStrongBinder(service);
3221 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3222 reply.readException();
3223 data.recycle();
3224 reply.recycle();
3225 }
3226
3227 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3228 throws RemoteException {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeStrongBinder(token);
3233 intent.writeToParcel(data, 0);
3234 data.writeInt(doRebind ? 1 : 0);
3235 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3236 reply.readException();
3237 data.recycle();
3238 reply.recycle();
3239 }
3240
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003241 public void serviceDoneExecuting(IBinder token, int type, int startId,
3242 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003247 data.writeInt(type);
3248 data.writeInt(startId);
3249 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003250 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3251 reply.readException();
3252 data.recycle();
3253 reply.recycle();
3254 }
3255
3256 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 service.writeToParcel(data, 0);
3261 data.writeString(resolvedType);
3262 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3263 reply.readException();
3264 IBinder binder = reply.readStrongBinder();
3265 reply.recycle();
3266 data.recycle();
3267 return binder;
3268 }
3269
Christopher Tate181fafa2009-05-14 11:12:14 -07003270 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3271 throws RemoteException {
3272 Parcel data = Parcel.obtain();
3273 Parcel reply = Parcel.obtain();
3274 data.writeInterfaceToken(IActivityManager.descriptor);
3275 app.writeToParcel(data, 0);
3276 data.writeInt(backupRestoreMode);
3277 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3278 reply.readException();
3279 boolean success = reply.readInt() != 0;
3280 reply.recycle();
3281 data.recycle();
3282 return success;
3283 }
3284
Christopher Tate346acb12012-10-15 19:20:25 -07003285 public void clearPendingBackup() throws RemoteException {
3286 Parcel data = Parcel.obtain();
3287 Parcel reply = Parcel.obtain();
3288 data.writeInterfaceToken(IActivityManager.descriptor);
3289 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3290 reply.recycle();
3291 data.recycle();
3292 }
3293
Christopher Tate181fafa2009-05-14 11:12:14 -07003294 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3295 Parcel data = Parcel.obtain();
3296 Parcel reply = Parcel.obtain();
3297 data.writeInterfaceToken(IActivityManager.descriptor);
3298 data.writeString(packageName);
3299 data.writeStrongBinder(agent);
3300 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3301 reply.recycle();
3302 data.recycle();
3303 }
3304
3305 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3306 Parcel data = Parcel.obtain();
3307 Parcel reply = Parcel.obtain();
3308 data.writeInterfaceToken(IActivityManager.descriptor);
3309 app.writeToParcel(data, 0);
3310 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3311 reply.readException();
3312 reply.recycle();
3313 data.recycle();
3314 }
3315
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003316 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003317 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003318 IUiAutomationConnection connection, int userId, String instructionSet)
3319 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003320 Parcel data = Parcel.obtain();
3321 Parcel reply = Parcel.obtain();
3322 data.writeInterfaceToken(IActivityManager.descriptor);
3323 ComponentName.writeToParcel(className, data);
3324 data.writeString(profileFile);
3325 data.writeInt(flags);
3326 data.writeBundle(arguments);
3327 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003328 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003329 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003330 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003331 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3332 reply.readException();
3333 boolean res = reply.readInt() != 0;
3334 reply.recycle();
3335 data.recycle();
3336 return res;
3337 }
3338
3339 public void finishInstrumentation(IApplicationThread target,
3340 int resultCode, Bundle results) throws RemoteException {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 data.writeStrongBinder(target != null ? target.asBinder() : null);
3345 data.writeInt(resultCode);
3346 data.writeBundle(results);
3347 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3348 reply.readException();
3349 data.recycle();
3350 reply.recycle();
3351 }
3352 public Configuration getConfiguration() throws RemoteException
3353 {
3354 Parcel data = Parcel.obtain();
3355 Parcel reply = Parcel.obtain();
3356 data.writeInterfaceToken(IActivityManager.descriptor);
3357 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3358 reply.readException();
3359 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3360 reply.recycle();
3361 data.recycle();
3362 return res;
3363 }
3364 public void updateConfiguration(Configuration values) throws RemoteException
3365 {
3366 Parcel data = Parcel.obtain();
3367 Parcel reply = Parcel.obtain();
3368 data.writeInterfaceToken(IActivityManager.descriptor);
3369 values.writeToParcel(data, 0);
3370 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3371 reply.readException();
3372 data.recycle();
3373 reply.recycle();
3374 }
3375 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3376 throws RemoteException {
3377 Parcel data = Parcel.obtain();
3378 Parcel reply = Parcel.obtain();
3379 data.writeInterfaceToken(IActivityManager.descriptor);
3380 data.writeStrongBinder(token);
3381 data.writeInt(requestedOrientation);
3382 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3383 reply.readException();
3384 data.recycle();
3385 reply.recycle();
3386 }
3387 public int getRequestedOrientation(IBinder token) throws RemoteException {
3388 Parcel data = Parcel.obtain();
3389 Parcel reply = Parcel.obtain();
3390 data.writeInterfaceToken(IActivityManager.descriptor);
3391 data.writeStrongBinder(token);
3392 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3393 reply.readException();
3394 int res = reply.readInt();
3395 data.recycle();
3396 reply.recycle();
3397 return res;
3398 }
3399 public ComponentName getActivityClassForToken(IBinder token)
3400 throws RemoteException {
3401 Parcel data = Parcel.obtain();
3402 Parcel reply = Parcel.obtain();
3403 data.writeInterfaceToken(IActivityManager.descriptor);
3404 data.writeStrongBinder(token);
3405 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3406 reply.readException();
3407 ComponentName res = ComponentName.readFromParcel(reply);
3408 data.recycle();
3409 reply.recycle();
3410 return res;
3411 }
3412 public String getPackageForToken(IBinder token) throws RemoteException
3413 {
3414 Parcel data = Parcel.obtain();
3415 Parcel reply = Parcel.obtain();
3416 data.writeInterfaceToken(IActivityManager.descriptor);
3417 data.writeStrongBinder(token);
3418 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3419 reply.readException();
3420 String res = reply.readString();
3421 data.recycle();
3422 reply.recycle();
3423 return res;
3424 }
3425 public IIntentSender getIntentSender(int type,
3426 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003427 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003428 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003429 Parcel data = Parcel.obtain();
3430 Parcel reply = Parcel.obtain();
3431 data.writeInterfaceToken(IActivityManager.descriptor);
3432 data.writeInt(type);
3433 data.writeString(packageName);
3434 data.writeStrongBinder(token);
3435 data.writeString(resultWho);
3436 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003437 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003438 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003439 data.writeTypedArray(intents, 0);
3440 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003441 } else {
3442 data.writeInt(0);
3443 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003444 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003445 if (options != null) {
3446 data.writeInt(1);
3447 options.writeToParcel(data, 0);
3448 } else {
3449 data.writeInt(0);
3450 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003451 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003452 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3453 reply.readException();
3454 IIntentSender res = IIntentSender.Stub.asInterface(
3455 reply.readStrongBinder());
3456 data.recycle();
3457 reply.recycle();
3458 return res;
3459 }
3460 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3461 Parcel data = Parcel.obtain();
3462 Parcel reply = Parcel.obtain();
3463 data.writeInterfaceToken(IActivityManager.descriptor);
3464 data.writeStrongBinder(sender.asBinder());
3465 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3466 reply.readException();
3467 data.recycle();
3468 reply.recycle();
3469 }
3470 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3471 Parcel data = Parcel.obtain();
3472 Parcel reply = Parcel.obtain();
3473 data.writeInterfaceToken(IActivityManager.descriptor);
3474 data.writeStrongBinder(sender.asBinder());
3475 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3476 reply.readException();
3477 String res = reply.readString();
3478 data.recycle();
3479 reply.recycle();
3480 return res;
3481 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003482 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3483 Parcel data = Parcel.obtain();
3484 Parcel reply = Parcel.obtain();
3485 data.writeInterfaceToken(IActivityManager.descriptor);
3486 data.writeStrongBinder(sender.asBinder());
3487 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3488 reply.readException();
3489 int res = reply.readInt();
3490 data.recycle();
3491 reply.recycle();
3492 return res;
3493 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003494 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3495 boolean requireFull, String name, String callerPackage) throws RemoteException {
3496 Parcel data = Parcel.obtain();
3497 Parcel reply = Parcel.obtain();
3498 data.writeInterfaceToken(IActivityManager.descriptor);
3499 data.writeInt(callingPid);
3500 data.writeInt(callingUid);
3501 data.writeInt(userId);
3502 data.writeInt(allowAll ? 1 : 0);
3503 data.writeInt(requireFull ? 1 : 0);
3504 data.writeString(name);
3505 data.writeString(callerPackage);
3506 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 int res = reply.readInt();
3509 data.recycle();
3510 reply.recycle();
3511 return res;
3512 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003513 public void setProcessLimit(int max) throws RemoteException
3514 {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeInt(max);
3519 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3520 reply.readException();
3521 data.recycle();
3522 reply.recycle();
3523 }
3524 public int getProcessLimit() throws RemoteException
3525 {
3526 Parcel data = Parcel.obtain();
3527 Parcel reply = Parcel.obtain();
3528 data.writeInterfaceToken(IActivityManager.descriptor);
3529 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3530 reply.readException();
3531 int res = reply.readInt();
3532 data.recycle();
3533 reply.recycle();
3534 return res;
3535 }
3536 public void setProcessForeground(IBinder token, int pid,
3537 boolean isForeground) throws RemoteException {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeStrongBinder(token);
3542 data.writeInt(pid);
3543 data.writeInt(isForeground ? 1 : 0);
3544 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3545 reply.readException();
3546 data.recycle();
3547 reply.recycle();
3548 }
3549 public int checkPermission(String permission, int pid, int uid)
3550 throws RemoteException {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 data.writeString(permission);
3555 data.writeInt(pid);
3556 data.writeInt(uid);
3557 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 int res = reply.readInt();
3560 data.recycle();
3561 reply.recycle();
3562 return res;
3563 }
3564 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003565 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003570 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003571 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003572 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3573 reply.readException();
3574 boolean res = reply.readInt() != 0;
3575 data.recycle();
3576 reply.recycle();
3577 return res;
3578 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003579 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003580 throws RemoteException {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 uri.writeToParcel(data, 0);
3585 data.writeInt(pid);
3586 data.writeInt(uid);
3587 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003588 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003589 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3590 reply.readException();
3591 int res = reply.readInt();
3592 data.recycle();
3593 reply.recycle();
3594 return res;
3595 }
3596 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003597 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003598 Parcel data = Parcel.obtain();
3599 Parcel reply = Parcel.obtain();
3600 data.writeInterfaceToken(IActivityManager.descriptor);
3601 data.writeStrongBinder(caller.asBinder());
3602 data.writeString(targetPkg);
3603 uri.writeToParcel(data, 0);
3604 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003605 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3607 reply.readException();
3608 data.recycle();
3609 reply.recycle();
3610 }
3611 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003612 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003613 Parcel data = Parcel.obtain();
3614 Parcel reply = Parcel.obtain();
3615 data.writeInterfaceToken(IActivityManager.descriptor);
3616 data.writeStrongBinder(caller.asBinder());
3617 uri.writeToParcel(data, 0);
3618 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003619 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003620 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3621 reply.readException();
3622 data.recycle();
3623 reply.recycle();
3624 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003625
3626 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003627 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3628 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003629 Parcel data = Parcel.obtain();
3630 Parcel reply = Parcel.obtain();
3631 data.writeInterfaceToken(IActivityManager.descriptor);
3632 uri.writeToParcel(data, 0);
3633 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003634 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003635 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3636 reply.readException();
3637 data.recycle();
3638 reply.recycle();
3639 }
3640
3641 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003642 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3643 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003644 Parcel data = Parcel.obtain();
3645 Parcel reply = Parcel.obtain();
3646 data.writeInterfaceToken(IActivityManager.descriptor);
3647 uri.writeToParcel(data, 0);
3648 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003649 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003650 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3651 reply.readException();
3652 data.recycle();
3653 reply.recycle();
3654 }
3655
3656 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003657 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3658 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003659 Parcel data = Parcel.obtain();
3660 Parcel reply = Parcel.obtain();
3661 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003662 data.writeString(packageName);
3663 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003664 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3665 reply.readException();
3666 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3667 reply);
3668 data.recycle();
3669 reply.recycle();
3670 return perms;
3671 }
3672
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003673 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3674 throws RemoteException {
3675 Parcel data = Parcel.obtain();
3676 Parcel reply = Parcel.obtain();
3677 data.writeInterfaceToken(IActivityManager.descriptor);
3678 data.writeStrongBinder(who.asBinder());
3679 data.writeInt(waiting ? 1 : 0);
3680 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3681 reply.readException();
3682 data.recycle();
3683 reply.recycle();
3684 }
3685 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3686 Parcel data = Parcel.obtain();
3687 Parcel reply = Parcel.obtain();
3688 data.writeInterfaceToken(IActivityManager.descriptor);
3689 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3690 reply.readException();
3691 outInfo.readFromParcel(reply);
3692 data.recycle();
3693 reply.recycle();
3694 }
3695 public void unhandledBack() throws RemoteException
3696 {
3697 Parcel data = Parcel.obtain();
3698 Parcel reply = Parcel.obtain();
3699 data.writeInterfaceToken(IActivityManager.descriptor);
3700 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3701 reply.readException();
3702 data.recycle();
3703 reply.recycle();
3704 }
3705 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3706 {
3707 Parcel data = Parcel.obtain();
3708 Parcel reply = Parcel.obtain();
3709 data.writeInterfaceToken(IActivityManager.descriptor);
3710 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3711 reply.readException();
3712 ParcelFileDescriptor pfd = null;
3713 if (reply.readInt() != 0) {
3714 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3715 }
3716 data.recycle();
3717 reply.recycle();
3718 return pfd;
3719 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003720 public void setLockScreenShown(boolean shown) throws RemoteException
3721 {
3722 Parcel data = Parcel.obtain();
3723 Parcel reply = Parcel.obtain();
3724 data.writeInterfaceToken(IActivityManager.descriptor);
3725 data.writeInt(shown ? 1 : 0);
3726 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3727 reply.readException();
3728 data.recycle();
3729 reply.recycle();
3730 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003731 public void setDebugApp(
3732 String packageName, boolean waitForDebugger, boolean persistent)
3733 throws RemoteException
3734 {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 data.writeString(packageName);
3739 data.writeInt(waitForDebugger ? 1 : 0);
3740 data.writeInt(persistent ? 1 : 0);
3741 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3742 reply.readException();
3743 data.recycle();
3744 reply.recycle();
3745 }
3746 public void setAlwaysFinish(boolean enabled) throws RemoteException
3747 {
3748 Parcel data = Parcel.obtain();
3749 Parcel reply = Parcel.obtain();
3750 data.writeInterfaceToken(IActivityManager.descriptor);
3751 data.writeInt(enabled ? 1 : 0);
3752 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3753 reply.readException();
3754 data.recycle();
3755 reply.recycle();
3756 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003757 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003758 {
3759 Parcel data = Parcel.obtain();
3760 Parcel reply = Parcel.obtain();
3761 data.writeInterfaceToken(IActivityManager.descriptor);
3762 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003763 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003764 reply.readException();
3765 data.recycle();
3766 reply.recycle();
3767 }
3768 public void enterSafeMode() throws RemoteException {
3769 Parcel data = Parcel.obtain();
3770 data.writeInterfaceToken(IActivityManager.descriptor);
3771 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3772 data.recycle();
3773 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003774 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3775 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003776 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003777 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003778 data.writeStrongBinder(sender.asBinder());
3779 data.writeInt(sourceUid);
3780 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003781 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3782 data.recycle();
3783 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003784 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003785 Parcel data = Parcel.obtain();
3786 Parcel reply = Parcel.obtain();
3787 data.writeInterfaceToken(IActivityManager.descriptor);
3788 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003789 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003790 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003791 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003792 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 boolean res = reply.readInt() != 0;
3794 data.recycle();
3795 reply.recycle();
3796 return res;
3797 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003798 @Override
3799 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3800 Parcel data = Parcel.obtain();
3801 Parcel reply = Parcel.obtain();
3802 data.writeInterfaceToken(IActivityManager.descriptor);
3803 data.writeString(reason);
3804 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3805 boolean res = reply.readInt() != 0;
3806 data.recycle();
3807 reply.recycle();
3808 return res;
3809 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003810 public boolean testIsSystemReady()
3811 {
3812 /* this base class version is never called */
3813 return true;
3814 }
Dan Egnor60d87622009-12-16 16:32:58 -08003815 public void handleApplicationCrash(IBinder app,
3816 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3817 {
3818 Parcel data = Parcel.obtain();
3819 Parcel reply = Parcel.obtain();
3820 data.writeInterfaceToken(IActivityManager.descriptor);
3821 data.writeStrongBinder(app);
3822 crashInfo.writeToParcel(data, 0);
3823 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3824 reply.readException();
3825 reply.recycle();
3826 data.recycle();
3827 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003828
Dan Egnor60d87622009-12-16 16:32:58 -08003829 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003830 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003831 {
3832 Parcel data = Parcel.obtain();
3833 Parcel reply = Parcel.obtain();
3834 data.writeInterfaceToken(IActivityManager.descriptor);
3835 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003837 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003838 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003839 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003840 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 reply.recycle();
3842 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003843 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003844 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003845
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003846 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003847 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003848 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003849 {
3850 Parcel data = Parcel.obtain();
3851 Parcel reply = Parcel.obtain();
3852 data.writeInterfaceToken(IActivityManager.descriptor);
3853 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003854 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003855 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003856 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3857 reply.readException();
3858 reply.recycle();
3859 data.recycle();
3860 }
3861
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003862 public void signalPersistentProcesses(int sig) throws RemoteException {
3863 Parcel data = Parcel.obtain();
3864 Parcel reply = Parcel.obtain();
3865 data.writeInterfaceToken(IActivityManager.descriptor);
3866 data.writeInt(sig);
3867 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3868 reply.readException();
3869 data.recycle();
3870 reply.recycle();
3871 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003872
Dianne Hackborn1676c852012-09-10 14:52:30 -07003873 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003874 Parcel data = Parcel.obtain();
3875 Parcel reply = Parcel.obtain();
3876 data.writeInterfaceToken(IActivityManager.descriptor);
3877 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003878 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003879 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3880 reply.readException();
3881 data.recycle();
3882 reply.recycle();
3883 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003884
3885 public void killAllBackgroundProcesses() throws RemoteException {
3886 Parcel data = Parcel.obtain();
3887 Parcel reply = Parcel.obtain();
3888 data.writeInterfaceToken(IActivityManager.descriptor);
3889 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3890 reply.readException();
3891 data.recycle();
3892 reply.recycle();
3893 }
3894
Dianne Hackborn1676c852012-09-10 14:52:30 -07003895 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003896 Parcel data = Parcel.obtain();
3897 Parcel reply = Parcel.obtain();
3898 data.writeInterfaceToken(IActivityManager.descriptor);
3899 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003900 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003901 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902 reply.readException();
3903 data.recycle();
3904 reply.recycle();
3905 }
3906
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003907 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3908 throws RemoteException
3909 {
3910 Parcel data = Parcel.obtain();
3911 Parcel reply = Parcel.obtain();
3912 data.writeInterfaceToken(IActivityManager.descriptor);
3913 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3914 reply.readException();
3915 outInfo.readFromParcel(reply);
3916 reply.recycle();
3917 data.recycle();
3918 }
3919
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003920 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3921 {
3922 Parcel data = Parcel.obtain();
3923 Parcel reply = Parcel.obtain();
3924 data.writeInterfaceToken(IActivityManager.descriptor);
3925 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3926 reply.readException();
3927 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3928 reply.recycle();
3929 data.recycle();
3930 return res;
3931 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003932
Dianne Hackborn1676c852012-09-10 14:52:30 -07003933 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003934 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003935 {
3936 Parcel data = Parcel.obtain();
3937 Parcel reply = Parcel.obtain();
3938 data.writeInterfaceToken(IActivityManager.descriptor);
3939 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003940 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003941 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003942 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003943 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003944 if (fd != null) {
3945 data.writeInt(1);
3946 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3947 } else {
3948 data.writeInt(0);
3949 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003950 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3951 reply.readException();
3952 boolean res = reply.readInt() != 0;
3953 reply.recycle();
3954 data.recycle();
3955 return res;
3956 }
3957
Dianne Hackborn55280a92009-05-07 15:53:46 -07003958 public boolean shutdown(int timeout) throws RemoteException
3959 {
3960 Parcel data = Parcel.obtain();
3961 Parcel reply = Parcel.obtain();
3962 data.writeInterfaceToken(IActivityManager.descriptor);
3963 data.writeInt(timeout);
3964 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3965 reply.readException();
3966 boolean res = reply.readInt() != 0;
3967 reply.recycle();
3968 data.recycle();
3969 return res;
3970 }
3971
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003972 public void stopAppSwitches() throws RemoteException {
3973 Parcel data = Parcel.obtain();
3974 Parcel reply = Parcel.obtain();
3975 data.writeInterfaceToken(IActivityManager.descriptor);
3976 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3977 reply.readException();
3978 reply.recycle();
3979 data.recycle();
3980 }
3981
3982 public void resumeAppSwitches() throws RemoteException {
3983 Parcel data = Parcel.obtain();
3984 Parcel reply = Parcel.obtain();
3985 data.writeInterfaceToken(IActivityManager.descriptor);
3986 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
3987 reply.readException();
3988 reply.recycle();
3989 data.recycle();
3990 }
3991
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003992 public void killApplicationWithAppId(String pkg, int appid, String reason)
3993 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07003994 Parcel data = Parcel.obtain();
3995 Parcel reply = Parcel.obtain();
3996 data.writeInterfaceToken(IActivityManager.descriptor);
3997 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003998 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07003999 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004000 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004001 reply.readException();
4002 data.recycle();
4003 reply.recycle();
4004 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004005
4006 public void closeSystemDialogs(String reason) throws RemoteException {
4007 Parcel data = Parcel.obtain();
4008 Parcel reply = Parcel.obtain();
4009 data.writeInterfaceToken(IActivityManager.descriptor);
4010 data.writeString(reason);
4011 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4012 reply.readException();
4013 data.recycle();
4014 reply.recycle();
4015 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004016
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004017 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004018 throws RemoteException {
4019 Parcel data = Parcel.obtain();
4020 Parcel reply = Parcel.obtain();
4021 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004022 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004023 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4024 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004025 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004026 data.recycle();
4027 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004028 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004029 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004030
4031 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4032 Parcel data = Parcel.obtain();
4033 Parcel reply = Parcel.obtain();
4034 data.writeInterfaceToken(IActivityManager.descriptor);
4035 data.writeString(processName);
4036 data.writeInt(uid);
4037 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4038 reply.readException();
4039 data.recycle();
4040 reply.recycle();
4041 }
4042
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004043 public void overridePendingTransition(IBinder token, String packageName,
4044 int enterAnim, int exitAnim) throws RemoteException {
4045 Parcel data = Parcel.obtain();
4046 Parcel reply = Parcel.obtain();
4047 data.writeInterfaceToken(IActivityManager.descriptor);
4048 data.writeStrongBinder(token);
4049 data.writeString(packageName);
4050 data.writeInt(enterAnim);
4051 data.writeInt(exitAnim);
4052 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4053 reply.readException();
4054 data.recycle();
4055 reply.recycle();
4056 }
4057
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004058 public boolean isUserAMonkey() throws RemoteException {
4059 Parcel data = Parcel.obtain();
4060 Parcel reply = Parcel.obtain();
4061 data.writeInterfaceToken(IActivityManager.descriptor);
4062 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4063 reply.readException();
4064 boolean res = reply.readInt() != 0;
4065 data.recycle();
4066 reply.recycle();
4067 return res;
4068 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004069
4070 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4071 Parcel data = Parcel.obtain();
4072 Parcel reply = Parcel.obtain();
4073 data.writeInterfaceToken(IActivityManager.descriptor);
4074 data.writeInt(monkey ? 1 : 0);
4075 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4076 reply.readException();
4077 data.recycle();
4078 reply.recycle();
4079 }
4080
Dianne Hackborn860755f2010-06-03 18:47:52 -07004081 public void finishHeavyWeightApp() throws RemoteException {
4082 Parcel data = Parcel.obtain();
4083 Parcel reply = Parcel.obtain();
4084 data.writeInterfaceToken(IActivityManager.descriptor);
4085 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4086 reply.readException();
4087 data.recycle();
4088 reply.recycle();
4089 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004090
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004091 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004092 throws RemoteException {
4093 Parcel data = Parcel.obtain();
4094 Parcel reply = Parcel.obtain();
4095 data.writeInterfaceToken(IActivityManager.descriptor);
4096 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004097 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4098 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004099 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004100 data.recycle();
4101 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004102 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004103 }
4104
Craig Mautner233ceee2014-05-09 17:05:11 -07004105 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004106 throws RemoteException {
4107 Parcel data = Parcel.obtain();
4108 Parcel reply = Parcel.obtain();
4109 data.writeInterfaceToken(IActivityManager.descriptor);
4110 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004111 if (options == null) {
4112 data.writeInt(0);
4113 } else {
4114 data.writeInt(1);
4115 data.writeBundle(options.toBundle());
4116 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004117 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004118 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004119 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004120 data.recycle();
4121 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004122 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004123 }
4124
Craig Mautner233ceee2014-05-09 17:05:11 -07004125 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4126 Parcel data = Parcel.obtain();
4127 Parcel reply = Parcel.obtain();
4128 data.writeInterfaceToken(IActivityManager.descriptor);
4129 data.writeStrongBinder(token);
4130 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4131 reply.readException();
4132 Bundle bundle = reply.readBundle();
4133 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4134 data.recycle();
4135 reply.recycle();
4136 return options;
4137 }
4138
Daniel Sandler69a48172010-06-23 16:29:36 -04004139 public void setImmersive(IBinder token, boolean immersive)
4140 throws RemoteException {
4141 Parcel data = Parcel.obtain();
4142 Parcel reply = Parcel.obtain();
4143 data.writeInterfaceToken(IActivityManager.descriptor);
4144 data.writeStrongBinder(token);
4145 data.writeInt(immersive ? 1 : 0);
4146 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4147 reply.readException();
4148 data.recycle();
4149 reply.recycle();
4150 }
4151
4152 public boolean isImmersive(IBinder token)
4153 throws RemoteException {
4154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeStrongBinder(token);
4158 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004159 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004160 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004161 data.recycle();
4162 reply.recycle();
4163 return res;
4164 }
4165
4166 public boolean isTopActivityImmersive()
4167 throws RemoteException {
4168 Parcel data = Parcel.obtain();
4169 Parcel reply = Parcel.obtain();
4170 data.writeInterfaceToken(IActivityManager.descriptor);
4171 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004172 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004173 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004174 data.recycle();
4175 reply.recycle();
4176 return res;
4177 }
4178
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004179 public void crashApplication(int uid, int initialPid, String packageName,
4180 String message) throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeInt(uid);
4185 data.writeInt(initialPid);
4186 data.writeString(packageName);
4187 data.writeString(message);
4188 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4189 reply.readException();
4190 data.recycle();
4191 reply.recycle();
4192 }
Andy McFadden824c5102010-07-09 16:26:57 -07004193
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004194 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004195 Parcel data = Parcel.obtain();
4196 Parcel reply = Parcel.obtain();
4197 data.writeInterfaceToken(IActivityManager.descriptor);
4198 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004199 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004200 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4201 reply.readException();
4202 String res = reply.readString();
4203 data.recycle();
4204 reply.recycle();
4205 return res;
4206 }
4207
Dianne Hackborn7e269642010-08-25 19:50:20 -07004208 public IBinder newUriPermissionOwner(String name)
4209 throws RemoteException {
4210 Parcel data = Parcel.obtain();
4211 Parcel reply = Parcel.obtain();
4212 data.writeInterfaceToken(IActivityManager.descriptor);
4213 data.writeString(name);
4214 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4215 reply.readException();
4216 IBinder res = reply.readStrongBinder();
4217 data.recycle();
4218 reply.recycle();
4219 return res;
4220 }
4221
4222 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004223 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004224 Parcel data = Parcel.obtain();
4225 Parcel reply = Parcel.obtain();
4226 data.writeInterfaceToken(IActivityManager.descriptor);
4227 data.writeStrongBinder(owner);
4228 data.writeInt(fromUid);
4229 data.writeString(targetPkg);
4230 uri.writeToParcel(data, 0);
4231 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004232 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004233 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4234 reply.readException();
4235 data.recycle();
4236 reply.recycle();
4237 }
4238
4239 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004240 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004241 Parcel data = Parcel.obtain();
4242 Parcel reply = Parcel.obtain();
4243 data.writeInterfaceToken(IActivityManager.descriptor);
4244 data.writeStrongBinder(owner);
4245 if (uri != null) {
4246 data.writeInt(1);
4247 uri.writeToParcel(data, 0);
4248 } else {
4249 data.writeInt(0);
4250 }
4251 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004252 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004253 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4254 reply.readException();
4255 data.recycle();
4256 reply.recycle();
4257 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004258
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004259 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004260 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004261 Parcel data = Parcel.obtain();
4262 Parcel reply = Parcel.obtain();
4263 data.writeInterfaceToken(IActivityManager.descriptor);
4264 data.writeInt(callingUid);
4265 data.writeString(targetPkg);
4266 uri.writeToParcel(data, 0);
4267 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004268 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004269 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4270 reply.readException();
4271 int res = reply.readInt();
4272 data.recycle();
4273 reply.recycle();
4274 return res;
4275 }
4276
Dianne Hackborn1676c852012-09-10 14:52:30 -07004277 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004278 String path, ParcelFileDescriptor fd) throws RemoteException {
4279 Parcel data = Parcel.obtain();
4280 Parcel reply = Parcel.obtain();
4281 data.writeInterfaceToken(IActivityManager.descriptor);
4282 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004283 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004284 data.writeInt(managed ? 1 : 0);
4285 data.writeString(path);
4286 if (fd != null) {
4287 data.writeInt(1);
4288 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4289 } else {
4290 data.writeInt(0);
4291 }
4292 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4293 reply.readException();
4294 boolean res = reply.readInt() != 0;
4295 reply.recycle();
4296 data.recycle();
4297 return res;
4298 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004299
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004300 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004301 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004302 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004303 Parcel data = Parcel.obtain();
4304 Parcel reply = Parcel.obtain();
4305 data.writeInterfaceToken(IActivityManager.descriptor);
4306 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004307 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004308 data.writeTypedArray(intents, 0);
4309 data.writeStringArray(resolvedTypes);
4310 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004311 if (options != null) {
4312 data.writeInt(1);
4313 options.writeToParcel(data, 0);
4314 } else {
4315 data.writeInt(0);
4316 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004317 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004318 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4319 reply.readException();
4320 int result = reply.readInt();
4321 reply.recycle();
4322 data.recycle();
4323 return result;
4324 }
4325
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004326 public int getFrontActivityScreenCompatMode() throws RemoteException {
4327 Parcel data = Parcel.obtain();
4328 Parcel reply = Parcel.obtain();
4329 data.writeInterfaceToken(IActivityManager.descriptor);
4330 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4331 reply.readException();
4332 int mode = reply.readInt();
4333 reply.recycle();
4334 data.recycle();
4335 return mode;
4336 }
4337
4338 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4339 Parcel data = Parcel.obtain();
4340 Parcel reply = Parcel.obtain();
4341 data.writeInterfaceToken(IActivityManager.descriptor);
4342 data.writeInt(mode);
4343 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4344 reply.readException();
4345 reply.recycle();
4346 data.recycle();
4347 }
4348
4349 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4350 Parcel data = Parcel.obtain();
4351 Parcel reply = Parcel.obtain();
4352 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004353 data.writeString(packageName);
4354 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004355 reply.readException();
4356 int mode = reply.readInt();
4357 reply.recycle();
4358 data.recycle();
4359 return mode;
4360 }
4361
4362 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004363 throws RemoteException {
4364 Parcel data = Parcel.obtain();
4365 Parcel reply = Parcel.obtain();
4366 data.writeInterfaceToken(IActivityManager.descriptor);
4367 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004368 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004369 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4370 reply.readException();
4371 reply.recycle();
4372 data.recycle();
4373 }
4374
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004375 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4376 Parcel data = Parcel.obtain();
4377 Parcel reply = Parcel.obtain();
4378 data.writeInterfaceToken(IActivityManager.descriptor);
4379 data.writeString(packageName);
4380 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4381 reply.readException();
4382 boolean ask = reply.readInt() != 0;
4383 reply.recycle();
4384 data.recycle();
4385 return ask;
4386 }
4387
4388 public void setPackageAskScreenCompat(String packageName, boolean ask)
4389 throws RemoteException {
4390 Parcel data = Parcel.obtain();
4391 Parcel reply = Parcel.obtain();
4392 data.writeInterfaceToken(IActivityManager.descriptor);
4393 data.writeString(packageName);
4394 data.writeInt(ask ? 1 : 0);
4395 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4396 reply.readException();
4397 reply.recycle();
4398 data.recycle();
4399 }
4400
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004401 public boolean switchUser(int userid) throws RemoteException {
4402 Parcel data = Parcel.obtain();
4403 Parcel reply = Parcel.obtain();
4404 data.writeInterfaceToken(IActivityManager.descriptor);
4405 data.writeInt(userid);
4406 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4407 reply.readException();
4408 boolean result = reply.readInt() != 0;
4409 reply.recycle();
4410 data.recycle();
4411 return result;
4412 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004413
Kenny Guy08488bf2014-02-21 17:40:37 +00004414 public boolean startUserInBackground(int userid) throws RemoteException {
4415 Parcel data = Parcel.obtain();
4416 Parcel reply = Parcel.obtain();
4417 data.writeInterfaceToken(IActivityManager.descriptor);
4418 data.writeInt(userid);
4419 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4420 reply.readException();
4421 boolean result = reply.readInt() != 0;
4422 reply.recycle();
4423 data.recycle();
4424 return result;
4425 }
4426
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004427 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4428 Parcel data = Parcel.obtain();
4429 Parcel reply = Parcel.obtain();
4430 data.writeInterfaceToken(IActivityManager.descriptor);
4431 data.writeInt(userid);
4432 data.writeStrongInterface(callback);
4433 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4434 reply.readException();
4435 int result = reply.readInt();
4436 reply.recycle();
4437 data.recycle();
4438 return result;
4439 }
4440
Amith Yamasani52f1d752012-03-28 18:19:29 -07004441 public UserInfo getCurrentUser() throws RemoteException {
4442 Parcel data = Parcel.obtain();
4443 Parcel reply = Parcel.obtain();
4444 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004445 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004446 reply.readException();
4447 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4448 reply.recycle();
4449 data.recycle();
4450 return userInfo;
4451 }
4452
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004453 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004454 Parcel data = Parcel.obtain();
4455 Parcel reply = Parcel.obtain();
4456 data.writeInterfaceToken(IActivityManager.descriptor);
4457 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004458 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004459 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4460 reply.readException();
4461 boolean result = reply.readInt() != 0;
4462 reply.recycle();
4463 data.recycle();
4464 return result;
4465 }
4466
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004467 public int[] getRunningUserIds() throws RemoteException {
4468 Parcel data = Parcel.obtain();
4469 Parcel reply = Parcel.obtain();
4470 data.writeInterfaceToken(IActivityManager.descriptor);
4471 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4472 reply.readException();
4473 int[] result = reply.createIntArray();
4474 reply.recycle();
4475 data.recycle();
4476 return result;
4477 }
4478
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004479 public boolean removeTask(int taskId, int flags) throws RemoteException {
4480 Parcel data = Parcel.obtain();
4481 Parcel reply = Parcel.obtain();
4482 data.writeInterfaceToken(IActivityManager.descriptor);
4483 data.writeInt(taskId);
4484 data.writeInt(flags);
4485 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4486 reply.readException();
4487 boolean result = reply.readInt() != 0;
4488 reply.recycle();
4489 data.recycle();
4490 return result;
4491 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004492
Jeff Sharkeya4620792011-05-20 15:29:23 -07004493 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4494 Parcel data = Parcel.obtain();
4495 Parcel reply = Parcel.obtain();
4496 data.writeInterfaceToken(IActivityManager.descriptor);
4497 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4498 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4499 reply.readException();
4500 data.recycle();
4501 reply.recycle();
4502 }
4503
4504 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4505 Parcel data = Parcel.obtain();
4506 Parcel reply = Parcel.obtain();
4507 data.writeInterfaceToken(IActivityManager.descriptor);
4508 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4509 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4510 reply.readException();
4511 data.recycle();
4512 reply.recycle();
4513 }
4514
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004515 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4516 Parcel data = Parcel.obtain();
4517 Parcel reply = Parcel.obtain();
4518 data.writeInterfaceToken(IActivityManager.descriptor);
4519 data.writeStrongBinder(sender.asBinder());
4520 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4521 reply.readException();
4522 boolean res = reply.readInt() != 0;
4523 data.recycle();
4524 reply.recycle();
4525 return res;
4526 }
4527
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004528 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4529 Parcel data = Parcel.obtain();
4530 Parcel reply = Parcel.obtain();
4531 data.writeInterfaceToken(IActivityManager.descriptor);
4532 data.writeStrongBinder(sender.asBinder());
4533 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4534 reply.readException();
4535 boolean res = reply.readInt() != 0;
4536 data.recycle();
4537 reply.recycle();
4538 return res;
4539 }
4540
Dianne Hackborn81038902012-11-26 17:04:09 -08004541 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4542 Parcel data = Parcel.obtain();
4543 Parcel reply = Parcel.obtain();
4544 data.writeInterfaceToken(IActivityManager.descriptor);
4545 data.writeStrongBinder(sender.asBinder());
4546 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4547 reply.readException();
4548 Intent res = reply.readInt() != 0
4549 ? Intent.CREATOR.createFromParcel(reply) : null;
4550 data.recycle();
4551 reply.recycle();
4552 return res;
4553 }
4554
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004555 public String getTagForIntentSender(IIntentSender sender, String prefix)
4556 throws RemoteException {
4557 Parcel data = Parcel.obtain();
4558 Parcel reply = Parcel.obtain();
4559 data.writeInterfaceToken(IActivityManager.descriptor);
4560 data.writeStrongBinder(sender.asBinder());
4561 data.writeString(prefix);
4562 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4563 reply.readException();
4564 String res = reply.readString();
4565 data.recycle();
4566 reply.recycle();
4567 return res;
4568 }
4569
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004570 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4571 {
4572 Parcel data = Parcel.obtain();
4573 Parcel reply = Parcel.obtain();
4574 data.writeInterfaceToken(IActivityManager.descriptor);
4575 values.writeToParcel(data, 0);
4576 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4577 reply.readException();
4578 data.recycle();
4579 reply.recycle();
4580 }
4581
Dianne Hackbornb437e092011-08-05 17:50:29 -07004582 public long[] getProcessPss(int[] pids) throws RemoteException {
4583 Parcel data = Parcel.obtain();
4584 Parcel reply = Parcel.obtain();
4585 data.writeInterfaceToken(IActivityManager.descriptor);
4586 data.writeIntArray(pids);
4587 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4588 reply.readException();
4589 long[] res = reply.createLongArray();
4590 data.recycle();
4591 reply.recycle();
4592 return res;
4593 }
4594
Dianne Hackborn661cd522011-08-22 00:26:20 -07004595 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4596 Parcel data = Parcel.obtain();
4597 Parcel reply = Parcel.obtain();
4598 data.writeInterfaceToken(IActivityManager.descriptor);
4599 TextUtils.writeToParcel(msg, data, 0);
4600 data.writeInt(always ? 1 : 0);
4601 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4602 reply.readException();
4603 data.recycle();
4604 reply.recycle();
4605 }
4606
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004607 public void dismissKeyguardOnNextActivity() throws RemoteException {
4608 Parcel data = Parcel.obtain();
4609 Parcel reply = Parcel.obtain();
4610 data.writeInterfaceToken(IActivityManager.descriptor);
4611 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4612 reply.readException();
4613 data.recycle();
4614 reply.recycle();
4615 }
4616
Adam Powelldd8fab22012-03-22 17:47:27 -07004617 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4618 throws RemoteException {
4619 Parcel data = Parcel.obtain();
4620 Parcel reply = Parcel.obtain();
4621 data.writeInterfaceToken(IActivityManager.descriptor);
4622 data.writeStrongBinder(token);
4623 data.writeString(destAffinity);
4624 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4625 reply.readException();
4626 boolean result = reply.readInt() != 0;
4627 data.recycle();
4628 reply.recycle();
4629 return result;
4630 }
4631
4632 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4633 throws RemoteException {
4634 Parcel data = Parcel.obtain();
4635 Parcel reply = Parcel.obtain();
4636 data.writeInterfaceToken(IActivityManager.descriptor);
4637 data.writeStrongBinder(token);
4638 target.writeToParcel(data, 0);
4639 data.writeInt(resultCode);
4640 if (resultData != null) {
4641 data.writeInt(1);
4642 resultData.writeToParcel(data, 0);
4643 } else {
4644 data.writeInt(0);
4645 }
4646 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4647 reply.readException();
4648 boolean result = reply.readInt() != 0;
4649 data.recycle();
4650 reply.recycle();
4651 return result;
4652 }
4653
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004654 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4655 Parcel data = Parcel.obtain();
4656 Parcel reply = Parcel.obtain();
4657 data.writeInterfaceToken(IActivityManager.descriptor);
4658 data.writeStrongBinder(activityToken);
4659 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4660 reply.readException();
4661 int result = reply.readInt();
4662 data.recycle();
4663 reply.recycle();
4664 return result;
4665 }
4666
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004667 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4668 Parcel data = Parcel.obtain();
4669 Parcel reply = Parcel.obtain();
4670 data.writeInterfaceToken(IActivityManager.descriptor);
4671 data.writeStrongBinder(activityToken);
4672 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4673 reply.readException();
4674 String result = reply.readString();
4675 data.recycle();
4676 reply.recycle();
4677 return result;
4678 }
4679
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004680 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4681 Parcel data = Parcel.obtain();
4682 Parcel reply = Parcel.obtain();
4683 data.writeInterfaceToken(IActivityManager.descriptor);
4684 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4685 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4686 reply.readException();
4687 data.recycle();
4688 reply.recycle();
4689 }
4690
4691 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4692 Parcel data = Parcel.obtain();
4693 Parcel reply = Parcel.obtain();
4694 data.writeInterfaceToken(IActivityManager.descriptor);
4695 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4696 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4697 reply.readException();
4698 data.recycle();
4699 reply.recycle();
4700 }
4701
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004702 public void requestBugReport() throws RemoteException {
4703 Parcel data = Parcel.obtain();
4704 Parcel reply = Parcel.obtain();
4705 data.writeInterfaceToken(IActivityManager.descriptor);
4706 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4707 reply.readException();
4708 data.recycle();
4709 reply.recycle();
4710 }
4711
Jeff Brownbd181bb2013-09-10 16:44:24 -07004712 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4713 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004714 Parcel data = Parcel.obtain();
4715 Parcel reply = Parcel.obtain();
4716 data.writeInterfaceToken(IActivityManager.descriptor);
4717 data.writeInt(pid);
4718 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004719 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004720 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4721 reply.readException();
4722 long res = reply.readInt();
4723 data.recycle();
4724 reply.recycle();
4725 return res;
4726 }
4727
Adam Skorydfc7fd72013-08-05 19:23:41 -07004728 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004729 Parcel data = Parcel.obtain();
4730 Parcel reply = Parcel.obtain();
4731 data.writeInterfaceToken(IActivityManager.descriptor);
4732 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004733 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004734 reply.readException();
4735 Bundle res = reply.readBundle();
4736 data.recycle();
4737 reply.recycle();
4738 return res;
4739 }
4740
Adam Skory7140a252013-09-11 12:04:58 +01004741 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004742 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004743 Parcel data = Parcel.obtain();
4744 Parcel reply = Parcel.obtain();
4745 data.writeInterfaceToken(IActivityManager.descriptor);
4746 data.writeStrongBinder(token);
4747 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004748 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004749 reply.readException();
4750 data.recycle();
4751 reply.recycle();
4752 }
4753
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004754 public void killUid(int uid, String reason) throws RemoteException {
4755 Parcel data = Parcel.obtain();
4756 Parcel reply = Parcel.obtain();
4757 data.writeInterfaceToken(IActivityManager.descriptor);
4758 data.writeInt(uid);
4759 data.writeString(reason);
4760 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4761 reply.readException();
4762 data.recycle();
4763 reply.recycle();
4764 }
4765
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004766 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4767 Parcel data = Parcel.obtain();
4768 Parcel reply = Parcel.obtain();
4769 data.writeInterfaceToken(IActivityManager.descriptor);
4770 data.writeStrongBinder(who);
4771 data.writeInt(allowRestart ? 1 : 0);
4772 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4773 reply.readException();
4774 data.recycle();
4775 reply.recycle();
4776 }
4777
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004778 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4779 Parcel data = Parcel.obtain();
4780 Parcel reply = Parcel.obtain();
4781 data.writeInterfaceToken(IActivityManager.descriptor);
4782 data.writeStrongBinder(token);
4783 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4784 reply.readException();
4785 data.recycle();
4786 reply.recycle();
4787 }
4788
Craig Mautner5eda9b32013-07-02 11:58:16 -07004789 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4790 Parcel data = Parcel.obtain();
4791 Parcel reply = Parcel.obtain();
4792 data.writeInterfaceToken(IActivityManager.descriptor);
4793 data.writeStrongBinder(token);
4794 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4795 reply.readException();
4796 data.recycle();
4797 reply.recycle();
4798 }
4799
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004800 public void restart() throws RemoteException {
4801 Parcel data = Parcel.obtain();
4802 Parcel reply = Parcel.obtain();
4803 data.writeInterfaceToken(IActivityManager.descriptor);
4804 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4805 reply.readException();
4806 data.recycle();
4807 reply.recycle();
4808 }
4809
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004810 public void performIdleMaintenance() throws RemoteException {
4811 Parcel data = Parcel.obtain();
4812 Parcel reply = Parcel.obtain();
4813 data.writeInterfaceToken(IActivityManager.descriptor);
4814 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4815 reply.readException();
4816 data.recycle();
4817 reply.recycle();
4818 }
4819
Craig Mautner4a1cb222013-12-04 16:14:06 -08004820 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4821 IActivityContainerCallback callback) throws RemoteException {
4822 Parcel data = Parcel.obtain();
4823 Parcel reply = Parcel.obtain();
4824 data.writeInterfaceToken(IActivityManager.descriptor);
4825 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004826 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004827 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4828 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004829 final int result = reply.readInt();
4830 final IActivityContainer res;
4831 if (result == 1) {
4832 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4833 } else {
4834 res = null;
4835 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004836 data.recycle();
4837 reply.recycle();
4838 return res;
4839 }
4840
Craig Mautner95da1082014-02-24 17:54:35 -08004841 public void deleteActivityContainer(IActivityContainer activityContainer)
4842 throws RemoteException {
4843 Parcel data = Parcel.obtain();
4844 Parcel reply = Parcel.obtain();
4845 data.writeInterfaceToken(IActivityManager.descriptor);
4846 data.writeStrongBinder(activityContainer.asBinder());
4847 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4848 reply.readException();
4849 data.recycle();
4850 reply.recycle();
4851 }
4852
Craig Mautnere0a38842013-12-16 16:14:02 -08004853 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4854 throws RemoteException {
4855 Parcel data = Parcel.obtain();
4856 Parcel reply = Parcel.obtain();
4857 data.writeInterfaceToken(IActivityManager.descriptor);
4858 data.writeStrongBinder(activityToken);
4859 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4860 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004861 final int result = reply.readInt();
4862 final IActivityContainer res;
4863 if (result == 1) {
4864 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4865 } else {
4866 res = null;
4867 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004868 data.recycle();
4869 reply.recycle();
4870 return res;
4871 }
4872
Craig Mautner4a1cb222013-12-04 16:14:06 -08004873 public IBinder getHomeActivityToken() throws RemoteException {
4874 Parcel data = Parcel.obtain();
4875 Parcel reply = Parcel.obtain();
4876 data.writeInterfaceToken(IActivityManager.descriptor);
4877 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4878 reply.readException();
4879 IBinder res = reply.readStrongBinder();
4880 data.recycle();
4881 reply.recycle();
4882 return res;
4883 }
4884
Craig Mautneraea74a52014-03-08 14:23:10 -08004885 @Override
4886 public void startLockTaskMode(int taskId) throws RemoteException {
4887 Parcel data = Parcel.obtain();
4888 Parcel reply = Parcel.obtain();
4889 data.writeInterfaceToken(IActivityManager.descriptor);
4890 data.writeInt(taskId);
4891 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4892 reply.readException();
4893 data.recycle();
4894 reply.recycle();
4895 }
4896
4897 @Override
4898 public void startLockTaskMode(IBinder token) throws RemoteException {
4899 Parcel data = Parcel.obtain();
4900 Parcel reply = Parcel.obtain();
4901 data.writeInterfaceToken(IActivityManager.descriptor);
4902 data.writeStrongBinder(token);
4903 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4904 reply.readException();
4905 data.recycle();
4906 reply.recycle();
4907 }
4908
4909 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004910 public void startLockTaskModeOnCurrent() throws RemoteException {
4911 Parcel data = Parcel.obtain();
4912 Parcel reply = Parcel.obtain();
4913 data.writeInterfaceToken(IActivityManager.descriptor);
4914 mRemote.transact(START_LOCK_TASK_BY_CURRENT, data, reply, 0);
4915 reply.readException();
4916 data.recycle();
4917 reply.recycle();
4918 }
4919
4920 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004921 public void stopLockTaskMode() throws RemoteException {
4922 Parcel data = Parcel.obtain();
4923 Parcel reply = Parcel.obtain();
4924 data.writeInterfaceToken(IActivityManager.descriptor);
4925 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4926 reply.readException();
4927 data.recycle();
4928 reply.recycle();
4929 }
4930
4931 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004932 public void stopLockTaskModeOnCurrent() throws RemoteException {
4933 Parcel data = Parcel.obtain();
4934 Parcel reply = Parcel.obtain();
4935 data.writeInterfaceToken(IActivityManager.descriptor);
4936 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT, data, reply, 0);
4937 reply.readException();
4938 data.recycle();
4939 reply.recycle();
4940 }
4941
4942 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004943 public boolean isInLockTaskMode() throws RemoteException {
4944 Parcel data = Parcel.obtain();
4945 Parcel reply = Parcel.obtain();
4946 data.writeInterfaceToken(IActivityManager.descriptor);
4947 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4948 reply.readException();
4949 boolean isInLockTaskMode = reply.readInt() == 1;
4950 data.recycle();
4951 reply.recycle();
4952 return isInLockTaskMode;
4953 }
4954
Craig Mautner688b5102014-03-27 16:55:03 -07004955 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07004956 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07004957 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07004958 Parcel data = Parcel.obtain();
4959 Parcel reply = Parcel.obtain();
4960 data.writeInterfaceToken(IActivityManager.descriptor);
4961 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07004962 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07004963 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07004964 reply.readException();
4965 data.recycle();
4966 reply.recycle();
4967 }
4968
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004969 private IBinder mRemote;
4970}