blob: ce36fd8714780ba4ab09866a0e7eec7f5918912e [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 Hackborn6ea0d0a2014-07-02 16:23:21 -0700322 case FINISH_VOICE_TASK_TRANSACTION: {
323 data.enforceInterface(IActivityManager.descriptor);
324 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
325 data.readStrongBinder());
326 finishVoiceTask(session);
327 reply.writeNoException();
328 return true;
329 }
330
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800331 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
334 boolean res = willActivityBeVisible(token);
335 reply.writeNoException();
336 reply.writeInt(res ? 1 : 0);
337 return true;
338 }
339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 case REGISTER_RECEIVER_TRANSACTION:
341 {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder b = data.readStrongBinder();
344 IApplicationThread app =
345 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700346 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 b = data.readStrongBinder();
348 IIntentReceiver rec
349 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
350 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
351 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700352 int userId = data.readInt();
353 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 if (intent != null) {
356 reply.writeInt(1);
357 intent.writeToParcel(reply, 0);
358 } else {
359 reply.writeInt(0);
360 }
361 return true;
362 }
363
364 case UNREGISTER_RECEIVER_TRANSACTION:
365 {
366 data.enforceInterface(IActivityManager.descriptor);
367 IBinder b = data.readStrongBinder();
368 if (b == null) {
369 return true;
370 }
371 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
372 unregisterReceiver(rec);
373 reply.writeNoException();
374 return true;
375 }
376
377 case BROADCAST_INTENT_TRANSACTION:
378 {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder b = data.readStrongBinder();
381 IApplicationThread app =
382 b != null ? ApplicationThreadNative.asInterface(b) : null;
383 Intent intent = Intent.CREATOR.createFromParcel(data);
384 String resolvedType = data.readString();
385 b = data.readStrongBinder();
386 IIntentReceiver resultTo =
387 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
388 int resultCode = data.readInt();
389 String resultData = data.readString();
390 Bundle resultExtras = data.readBundle();
391 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800392 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 boolean serialized = data.readInt() != 0;
394 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700395 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800397 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700398 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 reply.writeNoException();
400 reply.writeInt(res);
401 return true;
402 }
403
404 case UNBROADCAST_INTENT_TRANSACTION:
405 {
406 data.enforceInterface(IActivityManager.descriptor);
407 IBinder b = data.readStrongBinder();
408 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
409 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700410 int userId = data.readInt();
411 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800412 reply.writeNoException();
413 return true;
414 }
415
416 case FINISH_RECEIVER_TRANSACTION: {
417 data.enforceInterface(IActivityManager.descriptor);
418 IBinder who = data.readStrongBinder();
419 int resultCode = data.readInt();
420 String resultData = data.readString();
421 Bundle resultExtras = data.readBundle();
422 boolean resultAbort = data.readInt() != 0;
423 if (who != null) {
424 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
425 }
426 reply.writeNoException();
427 return true;
428 }
429
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 case ATTACH_APPLICATION_TRANSACTION: {
431 data.enforceInterface(IActivityManager.descriptor);
432 IApplicationThread app = ApplicationThreadNative.asInterface(
433 data.readStrongBinder());
434 if (app != null) {
435 attachApplication(app);
436 }
437 reply.writeNoException();
438 return true;
439 }
440
441 case ACTIVITY_IDLE_TRANSACTION: {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700444 Configuration config = null;
445 if (data.readInt() != 0) {
446 config = Configuration.CREATOR.createFromParcel(data);
447 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700448 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700450 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800451 }
452 reply.writeNoException();
453 return true;
454 }
455
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700456 case ACTIVITY_RESUMED_TRANSACTION: {
457 data.enforceInterface(IActivityManager.descriptor);
458 IBinder token = data.readStrongBinder();
459 activityResumed(token);
460 reply.writeNoException();
461 return true;
462 }
463
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 case ACTIVITY_PAUSED_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700467 PersistableBundle persistentState = data.readPersistableBundle();
468 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 reply.writeNoException();
470 return true;
471 }
472
473 case ACTIVITY_STOPPED_TRANSACTION: {
474 data.enforceInterface(IActivityManager.descriptor);
475 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800476 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700477 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700479 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800480 reply.writeNoException();
481 return true;
482 }
483
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800484 case ACTIVITY_SLEPT_TRANSACTION: {
485 data.enforceInterface(IActivityManager.descriptor);
486 IBinder token = data.readStrongBinder();
487 activitySlept(token);
488 reply.writeNoException();
489 return true;
490 }
491
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 case ACTIVITY_DESTROYED_TRANSACTION: {
493 data.enforceInterface(IActivityManager.descriptor);
494 IBinder token = data.readStrongBinder();
495 activityDestroyed(token);
496 reply.writeNoException();
497 return true;
498 }
499
500 case GET_CALLING_PACKAGE_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 IBinder token = data.readStrongBinder();
503 String res = token != null ? getCallingPackage(token) : null;
504 reply.writeNoException();
505 reply.writeString(res);
506 return true;
507 }
508
509 case GET_CALLING_ACTIVITY_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 IBinder token = data.readStrongBinder();
512 ComponentName cn = getCallingActivity(token);
513 reply.writeNoException();
514 ComponentName.writeToParcel(cn, reply);
515 return true;
516 }
517
Winson Chung1147c402014-05-14 11:05:00 -0700518 case GET_APP_TASKS_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 List<IAppTask> list = getAppTasks();
521 reply.writeNoException();
522 int N = list != null ? list.size() : -1;
523 reply.writeInt(N);
524 int i;
525 for (i=0; i<N; i++) {
526 IAppTask task = list.get(i);
527 reply.writeStrongBinder(task.asBinder());
528 }
529 return true;
530 }
531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 case GET_TASKS_TRANSACTION: {
533 data.enforceInterface(IActivityManager.descriptor);
534 int maxNum = data.readInt();
535 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700536 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 reply.writeNoException();
538 int N = list != null ? list.size() : -1;
539 reply.writeInt(N);
540 int i;
541 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700542 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 info.writeToParcel(reply, 0);
544 }
545 return true;
546 }
547
548 case GET_RECENT_TASKS_TRANSACTION: {
549 data.enforceInterface(IActivityManager.descriptor);
550 int maxNum = data.readInt();
551 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700552 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700554 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555 reply.writeNoException();
556 reply.writeTypedList(list);
557 return true;
558 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700559
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700560 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800561 data.enforceInterface(IActivityManager.descriptor);
562 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700563 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800564 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700565 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800566 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700567 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700568 } else {
569 reply.writeInt(0);
570 }
571 return true;
572 }
573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800574 case GET_SERVICES_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 int maxNum = data.readInt();
577 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700578 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 reply.writeNoException();
580 int N = list != null ? list.size() : -1;
581 reply.writeInt(N);
582 int i;
583 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700584 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 info.writeToParcel(reply, 0);
586 }
587 return true;
588 }
589
590 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
593 reply.writeNoException();
594 reply.writeTypedList(list);
595 return true;
596 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700597
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
599 data.enforceInterface(IActivityManager.descriptor);
600 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
601 reply.writeNoException();
602 reply.writeTypedList(list);
603 return true;
604 }
605
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700606 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
607 data.enforceInterface(IActivityManager.descriptor);
608 List<ApplicationInfo> list = getRunningExternalApplications();
609 reply.writeNoException();
610 reply.writeTypedList(list);
611 return true;
612 }
613
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 case MOVE_TASK_TO_FRONT_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800617 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700618 Bundle options = data.readInt() != 0
619 ? Bundle.CREATOR.createFromParcel(data) : null;
620 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 reply.writeNoException();
622 return true;
623 }
624
625 case MOVE_TASK_TO_BACK_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 int task = data.readInt();
628 moveTaskToBack(task);
629 reply.writeNoException();
630 return true;
631 }
632
633 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 IBinder token = data.readStrongBinder();
636 boolean nonRoot = data.readInt() != 0;
637 boolean res = moveActivityTaskToBack(token, nonRoot);
638 reply.writeNoException();
639 reply.writeInt(res ? 1 : 0);
640 return true;
641 }
642
643 case MOVE_TASK_BACKWARDS_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 int task = data.readInt();
646 moveTaskBackwards(task);
647 reply.writeNoException();
648 return true;
649 }
650
Craig Mautnerc00204b2013-03-05 15:02:14 -0800651 case MOVE_TASK_TO_STACK_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 int taskId = data.readInt();
654 int stackId = data.readInt();
655 boolean toTop = data.readInt() != 0;
656 moveTaskToStack(taskId, stackId, toTop);
657 reply.writeNoException();
658 return true;
659 }
660
661 case RESIZE_STACK_TRANSACTION: {
662 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800663 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800664 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800665 Rect r = Rect.CREATOR.createFromParcel(data);
666 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800667 reply.writeNoException();
668 return true;
669 }
670
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800671 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700672 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800673 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700674 reply.writeNoException();
675 reply.writeTypedList(list);
676 return true;
677 }
678
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800679 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700680 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800681 int stackId = data.readInt();
682 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700683 reply.writeNoException();
684 if (info != null) {
685 reply.writeInt(1);
686 info.writeToParcel(reply, 0);
687 } else {
688 reply.writeInt(0);
689 }
690 return true;
691 }
692
Winson Chung303e1ff2014-03-07 15:06:19 -0800693 case IS_IN_HOME_STACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 int taskId = data.readInt();
696 boolean isInHomeStack = isInHomeStack(taskId);
697 reply.writeNoException();
698 reply.writeInt(isInHomeStack ? 1 : 0);
699 return true;
700 }
701
Craig Mautnercf910b02013-04-23 11:23:27 -0700702 case SET_FOCUSED_STACK_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 int stackId = data.readInt();
705 setFocusedStack(stackId);
706 reply.writeNoException();
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 IBinder token = data.readStrongBinder();
713 boolean onlyRoot = data.readInt() != 0;
714 int res = token != null
715 ? getTaskForActivity(token, onlyRoot) : -1;
716 reply.writeNoException();
717 reply.writeInt(res);
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case GET_CONTENT_PROVIDER_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder b = data.readStrongBinder();
724 IApplicationThread app = ApplicationThreadNative.asInterface(b);
725 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700726 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700727 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700728 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 reply.writeNoException();
730 if (cph != null) {
731 reply.writeInt(1);
732 cph.writeToParcel(reply, 0);
733 } else {
734 reply.writeInt(0);
735 }
736 return true;
737 }
738
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800739 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700742 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800743 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700744 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800745 reply.writeNoException();
746 if (cph != null) {
747 reply.writeInt(1);
748 cph.writeToParcel(reply, 0);
749 } else {
750 reply.writeInt(0);
751 }
752 return true;
753 }
754
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800755 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
756 data.enforceInterface(IActivityManager.descriptor);
757 IBinder b = data.readStrongBinder();
758 IApplicationThread app = ApplicationThreadNative.asInterface(b);
759 ArrayList<ContentProviderHolder> providers =
760 data.createTypedArrayList(ContentProviderHolder.CREATOR);
761 publishContentProviders(app, providers);
762 reply.writeNoException();
763 return true;
764 }
765
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700766 case REF_CONTENT_PROVIDER_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 IBinder b = data.readStrongBinder();
769 int stable = data.readInt();
770 int unstable = data.readInt();
771 boolean res = refContentProvider(b, stable, unstable);
772 reply.writeNoException();
773 reply.writeInt(res ? 1 : 0);
774 return true;
775 }
776
777 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder b = data.readStrongBinder();
780 unstableProviderDied(b);
781 reply.writeNoException();
782 return true;
783 }
784
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700785 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
786 data.enforceInterface(IActivityManager.descriptor);
787 IBinder b = data.readStrongBinder();
788 appNotRespondingViaProvider(b);
789 reply.writeNoException();
790 return true;
791 }
792
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800793 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
794 data.enforceInterface(IActivityManager.descriptor);
795 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700796 boolean stable = data.readInt() != 0;
797 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800798 reply.writeNoException();
799 return true;
800 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800801
802 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
803 data.enforceInterface(IActivityManager.descriptor);
804 String name = data.readString();
805 IBinder token = data.readStrongBinder();
806 removeContentProviderExternal(name, token);
807 reply.writeNoException();
808 return true;
809 }
810
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700811 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
812 data.enforceInterface(IActivityManager.descriptor);
813 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
814 PendingIntent pi = getRunningServiceControlPanel(comp);
815 reply.writeNoException();
816 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
817 return true;
818 }
819
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800820 case START_SERVICE_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder b = data.readStrongBinder();
823 IApplicationThread app = ApplicationThreadNative.asInterface(b);
824 Intent service = Intent.CREATOR.createFromParcel(data);
825 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700826 int userId = data.readInt();
827 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828 reply.writeNoException();
829 ComponentName.writeToParcel(cn, reply);
830 return true;
831 }
832
833 case STOP_SERVICE_TRANSACTION: {
834 data.enforceInterface(IActivityManager.descriptor);
835 IBinder b = data.readStrongBinder();
836 IApplicationThread app = ApplicationThreadNative.asInterface(b);
837 Intent service = Intent.CREATOR.createFromParcel(data);
838 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700839 int userId = data.readInt();
840 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 reply.writeNoException();
842 reply.writeInt(res);
843 return true;
844 }
845
846 case STOP_SERVICE_TOKEN_TRANSACTION: {
847 data.enforceInterface(IActivityManager.descriptor);
848 ComponentName className = ComponentName.readFromParcel(data);
849 IBinder token = data.readStrongBinder();
850 int startId = data.readInt();
851 boolean res = stopServiceToken(className, token, startId);
852 reply.writeNoException();
853 reply.writeInt(res ? 1 : 0);
854 return true;
855 }
856
857 case SET_SERVICE_FOREGROUND_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 ComponentName className = ComponentName.readFromParcel(data);
860 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700861 int id = data.readInt();
862 Notification notification = null;
863 if (data.readInt() != 0) {
864 notification = Notification.CREATOR.createFromParcel(data);
865 }
866 boolean removeNotification = data.readInt() != 0;
867 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 reply.writeNoException();
869 return true;
870 }
871
872 case BIND_SERVICE_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 IBinder b = data.readStrongBinder();
875 IApplicationThread app = ApplicationThreadNative.asInterface(b);
876 IBinder token = data.readStrongBinder();
877 Intent service = Intent.CREATOR.createFromParcel(data);
878 String resolvedType = data.readString();
879 b = data.readStrongBinder();
880 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800881 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800882 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800883 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800884 reply.writeNoException();
885 reply.writeInt(res);
886 return true;
887 }
888
889 case UNBIND_SERVICE_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 IBinder b = data.readStrongBinder();
892 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
893 boolean res = unbindService(conn);
894 reply.writeNoException();
895 reply.writeInt(res ? 1 : 0);
896 return true;
897 }
898
899 case PUBLISH_SERVICE_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder token = data.readStrongBinder();
902 Intent intent = Intent.CREATOR.createFromParcel(data);
903 IBinder service = data.readStrongBinder();
904 publishService(token, intent, service);
905 reply.writeNoException();
906 return true;
907 }
908
909 case UNBIND_FINISHED_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 IBinder token = data.readStrongBinder();
912 Intent intent = Intent.CREATOR.createFromParcel(data);
913 boolean doRebind = data.readInt() != 0;
914 unbindFinished(token, intent, doRebind);
915 reply.writeNoException();
916 return true;
917 }
918
919 case SERVICE_DONE_EXECUTING_TRANSACTION: {
920 data.enforceInterface(IActivityManager.descriptor);
921 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700922 int type = data.readInt();
923 int startId = data.readInt();
924 int res = data.readInt();
925 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 reply.writeNoException();
927 return true;
928 }
929
930 case START_INSTRUMENTATION_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 ComponentName className = ComponentName.readFromParcel(data);
933 String profileFile = data.readString();
934 int fl = data.readInt();
935 Bundle arguments = data.readBundle();
936 IBinder b = data.readStrongBinder();
937 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800938 b = data.readStrongBinder();
939 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700940 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100941 String abiOverride = data.readString();
942 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
943 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 reply.writeNoException();
945 reply.writeInt(res ? 1 : 0);
946 return true;
947 }
948
949
950 case FINISH_INSTRUMENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder b = data.readStrongBinder();
953 IApplicationThread app = ApplicationThreadNative.asInterface(b);
954 int resultCode = data.readInt();
955 Bundle results = data.readBundle();
956 finishInstrumentation(app, resultCode, results);
957 reply.writeNoException();
958 return true;
959 }
960
961 case GET_CONFIGURATION_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 Configuration config = getConfiguration();
964 reply.writeNoException();
965 config.writeToParcel(reply, 0);
966 return true;
967 }
968
969 case UPDATE_CONFIGURATION_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 Configuration config = Configuration.CREATOR.createFromParcel(data);
972 updateConfiguration(config);
973 reply.writeNoException();
974 return true;
975 }
976
977 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
980 int requestedOrientation = data.readInt();
981 setRequestedOrientation(token, requestedOrientation);
982 reply.writeNoException();
983 return true;
984 }
985
986 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder token = data.readStrongBinder();
989 int req = getRequestedOrientation(token);
990 reply.writeNoException();
991 reply.writeInt(req);
992 return true;
993 }
994
995 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
996 data.enforceInterface(IActivityManager.descriptor);
997 IBinder token = data.readStrongBinder();
998 ComponentName cn = getActivityClassForToken(token);
999 reply.writeNoException();
1000 ComponentName.writeToParcel(cn, reply);
1001 return true;
1002 }
1003
1004 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IBinder token = data.readStrongBinder();
1007 reply.writeNoException();
1008 reply.writeString(getPackageForToken(token));
1009 return true;
1010 }
1011
1012 case GET_INTENT_SENDER_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 int type = data.readInt();
1015 String packageName = data.readString();
1016 IBinder token = data.readStrongBinder();
1017 String resultWho = data.readString();
1018 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001019 Intent[] requestIntents;
1020 String[] requestResolvedTypes;
1021 if (data.readInt() != 0) {
1022 requestIntents = data.createTypedArray(Intent.CREATOR);
1023 requestResolvedTypes = data.createStringArray();
1024 } else {
1025 requestIntents = null;
1026 requestResolvedTypes = null;
1027 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001028 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001029 Bundle options = data.readInt() != 0
1030 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001031 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001032 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001033 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001034 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001035 reply.writeNoException();
1036 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1037 return true;
1038 }
1039
1040 case CANCEL_INTENT_SENDER_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IIntentSender r = IIntentSender.Stub.asInterface(
1043 data.readStrongBinder());
1044 cancelIntentSender(r);
1045 reply.writeNoException();
1046 return true;
1047 }
1048
1049 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 IIntentSender r = IIntentSender.Stub.asInterface(
1052 data.readStrongBinder());
1053 String res = getPackageForIntentSender(r);
1054 reply.writeNoException();
1055 reply.writeString(res);
1056 return true;
1057 }
1058
Christopher Tatec4a07d12012-04-06 14:19:13 -07001059 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 IIntentSender r = IIntentSender.Stub.asInterface(
1062 data.readStrongBinder());
1063 int res = getUidForIntentSender(r);
1064 reply.writeNoException();
1065 reply.writeInt(res);
1066 return true;
1067 }
1068
Dianne Hackborn41203752012-08-31 14:05:51 -07001069 case HANDLE_INCOMING_USER_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 int callingPid = data.readInt();
1072 int callingUid = data.readInt();
1073 int userId = data.readInt();
1074 boolean allowAll = data.readInt() != 0 ;
1075 boolean requireFull = data.readInt() != 0;
1076 String name = data.readString();
1077 String callerPackage = data.readString();
1078 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1079 requireFull, name, callerPackage);
1080 reply.writeNoException();
1081 reply.writeInt(res);
1082 return true;
1083 }
1084
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001085 case SET_PROCESS_LIMIT_TRANSACTION: {
1086 data.enforceInterface(IActivityManager.descriptor);
1087 int max = data.readInt();
1088 setProcessLimit(max);
1089 reply.writeNoException();
1090 return true;
1091 }
1092
1093 case GET_PROCESS_LIMIT_TRANSACTION: {
1094 data.enforceInterface(IActivityManager.descriptor);
1095 int limit = getProcessLimit();
1096 reply.writeNoException();
1097 reply.writeInt(limit);
1098 return true;
1099 }
1100
1101 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 IBinder token = data.readStrongBinder();
1104 int pid = data.readInt();
1105 boolean isForeground = data.readInt() != 0;
1106 setProcessForeground(token, pid, isForeground);
1107 reply.writeNoException();
1108 return true;
1109 }
1110
1111 case CHECK_PERMISSION_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 String perm = data.readString();
1114 int pid = data.readInt();
1115 int uid = data.readInt();
1116 int res = checkPermission(perm, pid, uid);
1117 reply.writeNoException();
1118 reply.writeInt(res);
1119 return true;
1120 }
1121
1122 case CHECK_URI_PERMISSION_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 Uri uri = Uri.CREATOR.createFromParcel(data);
1125 int pid = data.readInt();
1126 int uid = data.readInt();
1127 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001128 int userId = data.readInt();
1129 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 reply.writeNoException();
1131 reply.writeInt(res);
1132 return true;
1133 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001136 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001137 String packageName = data.readString();
1138 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1139 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001140 int userId = data.readInt();
1141 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 reply.writeNoException();
1143 reply.writeInt(res ? 1 : 0);
1144 return true;
1145 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 case GRANT_URI_PERMISSION_TRANSACTION: {
1148 data.enforceInterface(IActivityManager.descriptor);
1149 IBinder b = data.readStrongBinder();
1150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1151 String targetPkg = data.readString();
1152 Uri uri = Uri.CREATOR.createFromParcel(data);
1153 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001154 int userId = data.readInt();
1155 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 reply.writeNoException();
1157 return true;
1158 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001159
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001160 case REVOKE_URI_PERMISSION_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 IBinder b = data.readStrongBinder();
1163 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1164 Uri uri = Uri.CREATOR.createFromParcel(data);
1165 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001166 int userId = data.readInt();
1167 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 reply.writeNoException();
1169 return true;
1170 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001171
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001172 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 Uri uri = Uri.CREATOR.createFromParcel(data);
1175 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001176 int userId = data.readInt();
1177 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001178 reply.writeNoException();
1179 return true;
1180 }
1181
1182 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 Uri uri = Uri.CREATOR.createFromParcel(data);
1185 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001186 int userId = data.readInt();
1187 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001188 reply.writeNoException();
1189 return true;
1190 }
1191
1192 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1193 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001194 final String packageName = data.readString();
1195 final boolean incoming = data.readInt() != 0;
1196 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1197 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001198 reply.writeNoException();
1199 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1200 return true;
1201 }
1202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1204 data.enforceInterface(IActivityManager.descriptor);
1205 IBinder b = data.readStrongBinder();
1206 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1207 boolean waiting = data.readInt() != 0;
1208 showWaitingForDebugger(app, waiting);
1209 reply.writeNoException();
1210 return true;
1211 }
1212
1213 case GET_MEMORY_INFO_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1216 getMemoryInfo(mi);
1217 reply.writeNoException();
1218 mi.writeToParcel(reply, 0);
1219 return true;
1220 }
1221
1222 case UNHANDLED_BACK_TRANSACTION: {
1223 data.enforceInterface(IActivityManager.descriptor);
1224 unhandledBack();
1225 reply.writeNoException();
1226 return true;
1227 }
1228
1229 case OPEN_CONTENT_URI_TRANSACTION: {
1230 data.enforceInterface(IActivityManager.descriptor);
1231 Uri uri = Uri.parse(data.readString());
1232 ParcelFileDescriptor pfd = openContentUri(uri);
1233 reply.writeNoException();
1234 if (pfd != null) {
1235 reply.writeInt(1);
1236 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1237 } else {
1238 reply.writeInt(0);
1239 }
1240 return true;
1241 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001242
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001243 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
1245 setLockScreenShown(data.readInt() != 0);
1246 reply.writeNoException();
1247 return true;
1248 }
1249
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001250 case SET_DEBUG_APP_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 String pn = data.readString();
1253 boolean wfd = data.readInt() != 0;
1254 boolean per = data.readInt() != 0;
1255 setDebugApp(pn, wfd, per);
1256 reply.writeNoException();
1257 return true;
1258 }
1259
1260 case SET_ALWAYS_FINISH_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 boolean enabled = data.readInt() != 0;
1263 setAlwaysFinish(enabled);
1264 reply.writeNoException();
1265 return true;
1266 }
1267
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001268 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001270 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001272 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001273 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 return true;
1275 }
1276
1277 case ENTER_SAFE_MODE_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 enterSafeMode();
1280 reply.writeNoException();
1281 return true;
1282 }
1283
1284 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 IIntentSender is = IIntentSender.Stub.asInterface(
1287 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001288 int sourceUid = data.readInt();
1289 String sourcePkg = data.readString();
1290 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001291 reply.writeNoException();
1292 return true;
1293 }
1294
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001295 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 data.enforceInterface(IActivityManager.descriptor);
1297 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001298 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001299 boolean secure = data.readInt() != 0;
1300 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001301 reply.writeNoException();
1302 reply.writeInt(res ? 1 : 0);
1303 return true;
1304 }
1305
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001306 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 String reason = data.readString();
1309 boolean res = killProcessesBelowForeground(reason);
1310 reply.writeNoException();
1311 reply.writeInt(res ? 1 : 0);
1312 return true;
1313 }
1314
Dan Egnor60d87622009-12-16 16:32:58 -08001315 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 IBinder app = data.readStrongBinder();
1318 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1319 handleApplicationCrash(app, ci);
1320 reply.writeNoException();
1321 return true;
1322 }
1323
1324 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325 data.enforceInterface(IActivityManager.descriptor);
1326 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001328 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001329 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001331 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 return true;
1333 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001334
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001335 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001338 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001339 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1340 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001341 reply.writeNoException();
1342 return true;
1343 }
1344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001345 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 int sig = data.readInt();
1348 signalPersistentProcesses(sig);
1349 reply.writeNoException();
1350 return true;
1351 }
1352
Dianne Hackborn03abb812010-01-04 18:43:19 -08001353 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001356 int userId = data.readInt();
1357 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001361
1362 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 killAllBackgroundProcesses();
1365 reply.writeNoException();
1366 return true;
1367 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001368
Dianne Hackborn03abb812010-01-04 18:43:19 -08001369 case FORCE_STOP_PACKAGE_TRANSACTION: {
1370 data.enforceInterface(IActivityManager.descriptor);
1371 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001372 int userId = data.readInt();
1373 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001374 reply.writeNoException();
1375 return true;
1376 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001377
1378 case GET_MY_MEMORY_STATE_TRANSACTION: {
1379 data.enforceInterface(IActivityManager.descriptor);
1380 ActivityManager.RunningAppProcessInfo info =
1381 new ActivityManager.RunningAppProcessInfo();
1382 getMyMemoryState(info);
1383 reply.writeNoException();
1384 info.writeToParcel(reply, 0);
1385 return true;
1386 }
1387
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001388 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 ConfigurationInfo config = getDeviceConfigurationInfo();
1391 reply.writeNoException();
1392 config.writeToParcel(reply, 0);
1393 return true;
1394 }
1395
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001396 case PROFILE_CONTROL_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001399 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001400 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001401 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001402 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001403 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001404 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001405 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001406 reply.writeNoException();
1407 reply.writeInt(res ? 1 : 0);
1408 return true;
1409 }
1410
Dianne Hackborn55280a92009-05-07 15:53:46 -07001411 case SHUTDOWN_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 boolean res = shutdown(data.readInt());
1414 reply.writeNoException();
1415 reply.writeInt(res ? 1 : 0);
1416 return true;
1417 }
1418
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001419 case STOP_APP_SWITCHES_TRANSACTION: {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 stopAppSwitches();
1422 reply.writeNoException();
1423 return true;
1424 }
1425
1426 case RESUME_APP_SWITCHES_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 resumeAppSwitches();
1429 reply.writeNoException();
1430 return true;
1431 }
1432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 case PEEK_SERVICE_TRANSACTION: {
1434 data.enforceInterface(IActivityManager.descriptor);
1435 Intent service = Intent.CREATOR.createFromParcel(data);
1436 String resolvedType = data.readString();
1437 IBinder binder = peekService(service, resolvedType);
1438 reply.writeNoException();
1439 reply.writeStrongBinder(binder);
1440 return true;
1441 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001442
1443 case START_BACKUP_AGENT_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
1445 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1446 int backupRestoreMode = data.readInt();
1447 boolean success = bindBackupAgent(info, backupRestoreMode);
1448 reply.writeNoException();
1449 reply.writeInt(success ? 1 : 0);
1450 return true;
1451 }
1452
1453 case BACKUP_AGENT_CREATED_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 String packageName = data.readString();
1456 IBinder agent = data.readStrongBinder();
1457 backupAgentCreated(packageName, agent);
1458 reply.writeNoException();
1459 return true;
1460 }
1461
1462 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1465 unbindBackupAgent(info);
1466 reply.writeNoException();
1467 return true;
1468 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001469
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001470 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001471 data.enforceInterface(IActivityManager.descriptor);
1472 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001473 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001474 String reason = data.readString();
1475 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001476 reply.writeNoException();
1477 return true;
1478 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001479
1480 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 String reason = data.readString();
1483 closeSystemDialogs(reason);
1484 reply.writeNoException();
1485 return true;
1486 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001487
1488 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001490 int[] pids = data.createIntArray();
1491 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001492 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001493 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001494 return true;
1495 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001496
1497 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 String processName = data.readString();
1500 int uid = data.readInt();
1501 killApplicationProcess(processName, uid);
1502 reply.writeNoException();
1503 return true;
1504 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001505
1506 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1507 data.enforceInterface(IActivityManager.descriptor);
1508 IBinder token = data.readStrongBinder();
1509 String packageName = data.readString();
1510 int enterAnim = data.readInt();
1511 int exitAnim = data.readInt();
1512 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001513 reply.writeNoException();
1514 return true;
1515 }
1516
1517 case IS_USER_A_MONKEY_TRANSACTION: {
1518 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001519 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001520 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001521 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001522 return true;
1523 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001524
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001525 case SET_USER_IS_MONKEY_TRANSACTION: {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 final boolean monkey = (data.readInt() == 1);
1528 setUserIsMonkey(monkey);
1529 reply.writeNoException();
1530 return true;
1531 }
1532
Dianne Hackborn860755f2010-06-03 18:47:52 -07001533 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1534 data.enforceInterface(IActivityManager.descriptor);
1535 finishHeavyWeightApp();
1536 reply.writeNoException();
1537 return true;
1538 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001539
1540 case IS_IMMERSIVE_TRANSACTION: {
1541 data.enforceInterface(IActivityManager.descriptor);
1542 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001543 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001544 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001545 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001546 return true;
1547 }
1548
Craig Mautnerd61dc202014-07-07 11:09:11 -07001549 case IS_TOP_OF_TASK_TRANSACTION: {
1550 data.enforceInterface(IActivityManager.descriptor);
1551 IBinder token = data.readStrongBinder();
1552 final boolean isTopOfTask = isTopOfTask(token);
1553 reply.writeNoException();
1554 reply.writeInt(isTopOfTask ? 1 : 0);
1555 return true;
1556 }
1557
Craig Mautner5eda9b32013-07-02 11:58:16 -07001558 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001559 data.enforceInterface(IActivityManager.descriptor);
1560 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001561 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001562 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001563 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001564 return true;
1565 }
1566
1567 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001570 final Bundle bundle;
1571 if (data.readInt() == 0) {
1572 bundle = null;
1573 } else {
1574 bundle = data.readBundle();
1575 }
1576 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1577 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001578 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001579 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001580 return true;
1581 }
1582
Craig Mautner233ceee2014-05-09 17:05:11 -07001583 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 IBinder token = data.readStrongBinder();
1586 final ActivityOptions options = getActivityOptions(token);
1587 reply.writeNoException();
1588 reply.writeBundle(options == null ? null : options.toBundle());
1589 return true;
1590 }
1591
Daniel Sandler69a48172010-06-23 16:29:36 -04001592 case SET_IMMERSIVE_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 IBinder token = data.readStrongBinder();
1595 boolean imm = data.readInt() == 1;
1596 setImmersive(token, imm);
1597 reply.writeNoException();
1598 return true;
1599 }
1600
1601 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001603 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001604 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001605 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001606 return true;
1607 }
1608
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001609 case CRASH_APPLICATION_TRANSACTION: {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 int uid = data.readInt();
1612 int initialPid = data.readInt();
1613 String packageName = data.readString();
1614 String message = data.readString();
1615 crashApplication(uid, initialPid, packageName, message);
1616 reply.writeNoException();
1617 return true;
1618 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001619
1620 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1621 data.enforceInterface(IActivityManager.descriptor);
1622 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001623 int userId = data.readInt();
1624 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001625 reply.writeNoException();
1626 reply.writeString(type);
1627 return true;
1628 }
1629
Dianne Hackborn7e269642010-08-25 19:50:20 -07001630 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 String name = data.readString();
1633 IBinder perm = newUriPermissionOwner(name);
1634 reply.writeNoException();
1635 reply.writeStrongBinder(perm);
1636 return true;
1637 }
1638
1639 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 IBinder owner = data.readStrongBinder();
1642 int fromUid = data.readInt();
1643 String targetPkg = data.readString();
1644 Uri uri = Uri.CREATOR.createFromParcel(data);
1645 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001646 int userId = data.readInt();
1647 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001648 reply.writeNoException();
1649 return true;
1650 }
1651
1652 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1653 data.enforceInterface(IActivityManager.descriptor);
1654 IBinder owner = data.readStrongBinder();
1655 Uri uri = null;
1656 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001657 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001658 }
1659 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001660 int userId = data.readInt();
1661 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001662 reply.writeNoException();
1663 return true;
1664 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001665
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001666 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 int callingUid = data.readInt();
1669 String targetPkg = data.readString();
1670 Uri uri = Uri.CREATOR.createFromParcel(data);
1671 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001672 int userId = data.readInt();
1673 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001674 reply.writeNoException();
1675 reply.writeInt(res);
1676 return true;
1677 }
1678
Andy McFadden824c5102010-07-09 16:26:57 -07001679 case DUMP_HEAP_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001682 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001683 boolean managed = data.readInt() != 0;
1684 String path = data.readString();
1685 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001686 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001687 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001688 reply.writeNoException();
1689 reply.writeInt(res ? 1 : 0);
1690 return true;
1691 }
1692
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001693 case START_ACTIVITIES_TRANSACTION:
1694 {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 IBinder b = data.readStrongBinder();
1697 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001698 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001699 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1700 String[] resolvedTypes = data.createStringArray();
1701 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001702 Bundle options = data.readInt() != 0
1703 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001704 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001705 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001706 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001707 reply.writeNoException();
1708 reply.writeInt(result);
1709 return true;
1710 }
1711
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001712 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1713 {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 int mode = getFrontActivityScreenCompatMode();
1716 reply.writeNoException();
1717 reply.writeInt(mode);
1718 return true;
1719 }
1720
1721 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1722 {
1723 data.enforceInterface(IActivityManager.descriptor);
1724 int mode = data.readInt();
1725 setFrontActivityScreenCompatMode(mode);
1726 reply.writeNoException();
1727 reply.writeInt(mode);
1728 return true;
1729 }
1730
1731 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1732 {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 String pkg = data.readString();
1735 int mode = getPackageScreenCompatMode(pkg);
1736 reply.writeNoException();
1737 reply.writeInt(mode);
1738 return true;
1739 }
1740
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001741 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1742 {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001745 int mode = data.readInt();
1746 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001747 reply.writeNoException();
1748 return true;
1749 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001750
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001751 case SWITCH_USER_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 int userid = data.readInt();
1754 boolean result = switchUser(userid);
1755 reply.writeNoException();
1756 reply.writeInt(result ? 1 : 0);
1757 return true;
1758 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001759
Kenny Guy08488bf2014-02-21 17:40:37 +00001760 case START_USER_IN_BACKGROUND_TRANSACTION: {
1761 data.enforceInterface(IActivityManager.descriptor);
1762 int userid = data.readInt();
1763 boolean result = startUserInBackground(userid);
1764 reply.writeNoException();
1765 reply.writeInt(result ? 1 : 0);
1766 return true;
1767 }
1768
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001769 case STOP_USER_TRANSACTION: {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 int userid = data.readInt();
1772 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1773 data.readStrongBinder());
1774 int result = stopUser(userid, callback);
1775 reply.writeNoException();
1776 reply.writeInt(result);
1777 return true;
1778 }
1779
Amith Yamasani52f1d752012-03-28 18:19:29 -07001780 case GET_CURRENT_USER_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 UserInfo userInfo = getCurrentUser();
1783 reply.writeNoException();
1784 userInfo.writeToParcel(reply, 0);
1785 return true;
1786 }
1787
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001788 case IS_USER_RUNNING_TRANSACTION: {
1789 data.enforceInterface(IActivityManager.descriptor);
1790 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001791 boolean orStopping = data.readInt() != 0;
1792 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001793 reply.writeNoException();
1794 reply.writeInt(result ? 1 : 0);
1795 return true;
1796 }
1797
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001798 case GET_RUNNING_USER_IDS_TRANSACTION: {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 int[] result = getRunningUserIds();
1801 reply.writeNoException();
1802 reply.writeIntArray(result);
1803 return true;
1804 }
1805
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001806 case REMOVE_TASK_TRANSACTION:
1807 {
1808 data.enforceInterface(IActivityManager.descriptor);
1809 int taskId = data.readInt();
1810 int fl = data.readInt();
1811 boolean result = removeTask(taskId, fl);
1812 reply.writeNoException();
1813 reply.writeInt(result ? 1 : 0);
1814 return true;
1815 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001816
Jeff Sharkeya4620792011-05-20 15:29:23 -07001817 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1818 data.enforceInterface(IActivityManager.descriptor);
1819 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1820 data.readStrongBinder());
1821 registerProcessObserver(observer);
1822 return true;
1823 }
1824
1825 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1826 data.enforceInterface(IActivityManager.descriptor);
1827 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1828 data.readStrongBinder());
1829 unregisterProcessObserver(observer);
1830 return true;
1831 }
1832
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001833 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1834 {
1835 data.enforceInterface(IActivityManager.descriptor);
1836 String pkg = data.readString();
1837 boolean ask = getPackageAskScreenCompat(pkg);
1838 reply.writeNoException();
1839 reply.writeInt(ask ? 1 : 0);
1840 return true;
1841 }
1842
1843 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1844 {
1845 data.enforceInterface(IActivityManager.descriptor);
1846 String pkg = data.readString();
1847 boolean ask = data.readInt() != 0;
1848 setPackageAskScreenCompat(pkg, ask);
1849 reply.writeNoException();
1850 return true;
1851 }
1852
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001853 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1854 data.enforceInterface(IActivityManager.descriptor);
1855 IIntentSender r = IIntentSender.Stub.asInterface(
1856 data.readStrongBinder());
1857 boolean res = isIntentSenderTargetedToPackage(r);
1858 reply.writeNoException();
1859 reply.writeInt(res ? 1 : 0);
1860 return true;
1861 }
1862
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001863 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 IIntentSender r = IIntentSender.Stub.asInterface(
1866 data.readStrongBinder());
1867 boolean res = isIntentSenderAnActivity(r);
1868 reply.writeNoException();
1869 reply.writeInt(res ? 1 : 0);
1870 return true;
1871 }
1872
Dianne Hackborn81038902012-11-26 17:04:09 -08001873 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 IIntentSender r = IIntentSender.Stub.asInterface(
1876 data.readStrongBinder());
1877 Intent intent = getIntentForIntentSender(r);
1878 reply.writeNoException();
1879 if (intent != null) {
1880 reply.writeInt(1);
1881 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1882 } else {
1883 reply.writeInt(0);
1884 }
1885 return true;
1886 }
1887
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001888 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1889 data.enforceInterface(IActivityManager.descriptor);
1890 IIntentSender r = IIntentSender.Stub.asInterface(
1891 data.readStrongBinder());
1892 String prefix = data.readString();
1893 String tag = getTagForIntentSender(r, prefix);
1894 reply.writeNoException();
1895 reply.writeString(tag);
1896 return true;
1897 }
1898
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001899 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 Configuration config = Configuration.CREATOR.createFromParcel(data);
1902 updatePersistentConfiguration(config);
1903 reply.writeNoException();
1904 return true;
1905 }
1906
Dianne Hackbornb437e092011-08-05 17:50:29 -07001907 case GET_PROCESS_PSS_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 int[] pids = data.createIntArray();
1910 long[] pss = getProcessPss(pids);
1911 reply.writeNoException();
1912 reply.writeLongArray(pss);
1913 return true;
1914 }
1915
Dianne Hackborn661cd522011-08-22 00:26:20 -07001916 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1919 boolean always = data.readInt() != 0;
1920 showBootMessage(msg, always);
1921 reply.writeNoException();
1922 return true;
1923 }
1924
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001925 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1926 data.enforceInterface(IActivityManager.descriptor);
1927 dismissKeyguardOnNextActivity();
1928 reply.writeNoException();
1929 return true;
1930 }
1931
Adam Powelldd8fab22012-03-22 17:47:27 -07001932 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 IBinder token = data.readStrongBinder();
1935 String destAffinity = data.readString();
1936 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1937 reply.writeNoException();
1938 reply.writeInt(res ? 1 : 0);
1939 return true;
1940 }
1941
1942 case NAVIGATE_UP_TO_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IBinder token = data.readStrongBinder();
1945 Intent target = Intent.CREATOR.createFromParcel(data);
1946 int resultCode = data.readInt();
1947 Intent resultData = null;
1948 if (data.readInt() != 0) {
1949 resultData = Intent.CREATOR.createFromParcel(data);
1950 }
1951 boolean res = navigateUpTo(token, target, resultCode, resultData);
1952 reply.writeNoException();
1953 reply.writeInt(res ? 1 : 0);
1954 return true;
1955 }
1956
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001957 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 IBinder token = data.readStrongBinder();
1960 int res = getLaunchedFromUid(token);
1961 reply.writeNoException();
1962 reply.writeInt(res);
1963 return true;
1964 }
1965
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001966 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 IBinder token = data.readStrongBinder();
1969 String res = getLaunchedFromPackage(token);
1970 reply.writeNoException();
1971 reply.writeString(res);
1972 return true;
1973 }
1974
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001975 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1978 data.readStrongBinder());
1979 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001980 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001981 return true;
1982 }
1983
1984 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1987 data.readStrongBinder());
1988 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001989 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001990 return true;
1991 }
1992
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001993 case REQUEST_BUG_REPORT_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001996 reply.writeNoException();
1997 return true;
1998 }
1999
2000 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 int pid = data.readInt();
2003 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002004 String reason = data.readString();
2005 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002006 reply.writeNoException();
2007 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002008 return true;
2009 }
2010
Adam Skorydfc7fd72013-08-05 19:23:41 -07002011 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002012 data.enforceInterface(IActivityManager.descriptor);
2013 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002014 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002015 reply.writeNoException();
2016 reply.writeBundle(res);
2017 return true;
2018 }
2019
Adam Skorydfc7fd72013-08-05 19:23:41 -07002020 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002021 data.enforceInterface(IActivityManager.descriptor);
2022 IBinder token = data.readStrongBinder();
2023 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002024 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002025 reply.writeNoException();
2026 return true;
2027 }
2028
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002029 case KILL_UID_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 int uid = data.readInt();
2032 String reason = data.readString();
2033 killUid(uid, reason);
2034 reply.writeNoException();
2035 return true;
2036 }
2037
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002038 case HANG_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IBinder who = data.readStrongBinder();
2041 boolean allowRestart = data.readInt() != 0;
2042 hang(who, allowRestart);
2043 reply.writeNoException();
2044 return true;
2045 }
2046
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002047 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 IBinder token = data.readStrongBinder();
2050 reportActivityFullyDrawn(token);
2051 reply.writeNoException();
2052 return true;
2053 }
2054
Craig Mautner5eda9b32013-07-02 11:58:16 -07002055 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2056 data.enforceInterface(IActivityManager.descriptor);
2057 IBinder token = data.readStrongBinder();
2058 notifyActivityDrawn(token);
2059 reply.writeNoException();
2060 return true;
2061 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002062
2063 case RESTART_TRANSACTION: {
2064 data.enforceInterface(IActivityManager.descriptor);
2065 restart();
2066 reply.writeNoException();
2067 return true;
2068 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002069
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002070 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 performIdleMaintenance();
2073 reply.writeNoException();
2074 return true;
2075 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002076
2077 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 IBinder parentActivityToken = data.readStrongBinder();
2080 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002081 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002082 IActivityContainer activityContainer =
2083 createActivityContainer(parentActivityToken, callback);
2084 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002085 if (activityContainer != null) {
2086 reply.writeInt(1);
2087 reply.writeStrongBinder(activityContainer.asBinder());
2088 } else {
2089 reply.writeInt(0);
2090 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002091 return true;
2092 }
2093
Craig Mautner95da1082014-02-24 17:54:35 -08002094 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2095 data.enforceInterface(IActivityManager.descriptor);
2096 IActivityContainer activityContainer =
2097 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2098 deleteActivityContainer(activityContainer);
2099 reply.writeNoException();
2100 return true;
2101 }
2102
Craig Mautnere0a38842013-12-16 16:14:02 -08002103 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2104 data.enforceInterface(IActivityManager.descriptor);
2105 IBinder activityToken = data.readStrongBinder();
2106 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2107 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002108 if (activityContainer != null) {
2109 reply.writeInt(1);
2110 reply.writeStrongBinder(activityContainer.asBinder());
2111 } else {
2112 reply.writeInt(0);
2113 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002114 return true;
2115 }
2116
Craig Mautner4a1cb222013-12-04 16:14:06 -08002117 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 IBinder homeActivityToken = getHomeActivityToken();
2120 reply.writeNoException();
2121 reply.writeStrongBinder(homeActivityToken);
2122 return true;
2123 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002124
2125 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2126 data.enforceInterface(IActivityManager.descriptor);
2127 final int taskId = data.readInt();
2128 startLockTaskMode(taskId);
2129 reply.writeNoException();
2130 return true;
2131 }
2132
2133 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2134 data.enforceInterface(IActivityManager.descriptor);
2135 IBinder token = data.readStrongBinder();
2136 startLockTaskMode(token);
2137 reply.writeNoException();
2138 return true;
2139 }
2140
Craig Mautnerd61dc202014-07-07 11:09:11 -07002141 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002142 data.enforceInterface(IActivityManager.descriptor);
2143 startLockTaskModeOnCurrent();
2144 reply.writeNoException();
2145 return true;
2146 }
2147
Craig Mautneraea74a52014-03-08 14:23:10 -08002148 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2149 data.enforceInterface(IActivityManager.descriptor);
2150 stopLockTaskMode();
2151 reply.writeNoException();
2152 return true;
2153 }
2154
Craig Mautnerd61dc202014-07-07 11:09:11 -07002155 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002156 data.enforceInterface(IActivityManager.descriptor);
2157 stopLockTaskModeOnCurrent();
2158 reply.writeNoException();
2159 return true;
2160 }
2161
Craig Mautneraea74a52014-03-08 14:23:10 -08002162 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2163 data.enforceInterface(IActivityManager.descriptor);
2164 final boolean isInLockTaskMode = isInLockTaskMode();
2165 reply.writeNoException();
2166 reply.writeInt(isInLockTaskMode ? 1 : 0);
2167 return true;
2168 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002169
Winson Chunga449dc02014-05-16 11:15:04 -07002170 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002171 data.enforceInterface(IActivityManager.descriptor);
2172 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002173 ActivityManager.TaskDescription values =
2174 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2175 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002176 reply.writeNoException();
2177 return true;
2178 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002179 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002180
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002181 return super.onTransact(code, data, reply, flags);
2182 }
2183
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002184 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002185 return this;
2186 }
2187
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002188 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2189 protected IActivityManager create() {
2190 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002191 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002192 Log.v("ActivityManager", "default service binder = " + b);
2193 }
2194 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002195 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002196 Log.v("ActivityManager", "default service = " + am);
2197 }
2198 return am;
2199 }
2200 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201}
2202
2203class ActivityManagerProxy implements IActivityManager
2204{
2205 public ActivityManagerProxy(IBinder remote)
2206 {
2207 mRemote = remote;
2208 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002209
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002210 public IBinder asBinder()
2211 {
2212 return mRemote;
2213 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002214
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002215 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002216 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2217 int startFlags, String profileFile,
2218 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002219 Parcel data = Parcel.obtain();
2220 Parcel reply = Parcel.obtain();
2221 data.writeInterfaceToken(IActivityManager.descriptor);
2222 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002223 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002224 intent.writeToParcel(data, 0);
2225 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002226 data.writeStrongBinder(resultTo);
2227 data.writeString(resultWho);
2228 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002229 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002230 data.writeString(profileFile);
2231 if (profileFd != null) {
2232 data.writeInt(1);
2233 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2234 } else {
2235 data.writeInt(0);
2236 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002237 if (options != null) {
2238 data.writeInt(1);
2239 options.writeToParcel(data, 0);
2240 } else {
2241 data.writeInt(0);
2242 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2244 reply.readException();
2245 int result = reply.readInt();
2246 reply.recycle();
2247 data.recycle();
2248 return result;
2249 }
Amith Yamasani82644082012-08-03 13:09:11 -07002250
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002251 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002252 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2253 int startFlags, String profileFile,
2254 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2255 Parcel data = Parcel.obtain();
2256 Parcel reply = Parcel.obtain();
2257 data.writeInterfaceToken(IActivityManager.descriptor);
2258 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002259 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002260 intent.writeToParcel(data, 0);
2261 data.writeString(resolvedType);
2262 data.writeStrongBinder(resultTo);
2263 data.writeString(resultWho);
2264 data.writeInt(requestCode);
2265 data.writeInt(startFlags);
2266 data.writeString(profileFile);
2267 if (profileFd != null) {
2268 data.writeInt(1);
2269 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2270 } else {
2271 data.writeInt(0);
2272 }
2273 if (options != null) {
2274 data.writeInt(1);
2275 options.writeToParcel(data, 0);
2276 } else {
2277 data.writeInt(0);
2278 }
2279 data.writeInt(userId);
2280 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2281 reply.readException();
2282 int result = reply.readInt();
2283 reply.recycle();
2284 data.recycle();
2285 return result;
2286 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002287 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2288 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002289 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002290 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002291 Parcel data = Parcel.obtain();
2292 Parcel reply = Parcel.obtain();
2293 data.writeInterfaceToken(IActivityManager.descriptor);
2294 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002295 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002296 intent.writeToParcel(data, 0);
2297 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002298 data.writeStrongBinder(resultTo);
2299 data.writeString(resultWho);
2300 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002301 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002302 data.writeString(profileFile);
2303 if (profileFd != null) {
2304 data.writeInt(1);
2305 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2306 } else {
2307 data.writeInt(0);
2308 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002309 if (options != null) {
2310 data.writeInt(1);
2311 options.writeToParcel(data, 0);
2312 } else {
2313 data.writeInt(0);
2314 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002315 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002316 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2317 reply.readException();
2318 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2319 reply.recycle();
2320 data.recycle();
2321 return result;
2322 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002323 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2324 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002325 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002326 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002327 Parcel data = Parcel.obtain();
2328 Parcel reply = Parcel.obtain();
2329 data.writeInterfaceToken(IActivityManager.descriptor);
2330 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002331 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002332 intent.writeToParcel(data, 0);
2333 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002334 data.writeStrongBinder(resultTo);
2335 data.writeString(resultWho);
2336 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002337 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002338 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002339 if (options != null) {
2340 data.writeInt(1);
2341 options.writeToParcel(data, 0);
2342 } else {
2343 data.writeInt(0);
2344 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002345 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002346 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2347 reply.readException();
2348 int result = reply.readInt();
2349 reply.recycle();
2350 data.recycle();
2351 return result;
2352 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002353 public int startActivityIntentSender(IApplicationThread caller,
2354 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002355 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002356 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002357 Parcel data = Parcel.obtain();
2358 Parcel reply = Parcel.obtain();
2359 data.writeInterfaceToken(IActivityManager.descriptor);
2360 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2361 intent.writeToParcel(data, 0);
2362 if (fillInIntent != null) {
2363 data.writeInt(1);
2364 fillInIntent.writeToParcel(data, 0);
2365 } else {
2366 data.writeInt(0);
2367 }
2368 data.writeString(resolvedType);
2369 data.writeStrongBinder(resultTo);
2370 data.writeString(resultWho);
2371 data.writeInt(requestCode);
2372 data.writeInt(flagsMask);
2373 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002374 if (options != null) {
2375 data.writeInt(1);
2376 options.writeToParcel(data, 0);
2377 } else {
2378 data.writeInt(0);
2379 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002380 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002381 reply.readException();
2382 int result = reply.readInt();
2383 reply.recycle();
2384 data.recycle();
2385 return result;
2386 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002387 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2388 Intent intent, String resolvedType, IVoiceInteractionSession session,
2389 IVoiceInteractor interactor, int startFlags, String profileFile,
2390 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2391 Parcel data = Parcel.obtain();
2392 Parcel reply = Parcel.obtain();
2393 data.writeInterfaceToken(IActivityManager.descriptor);
2394 data.writeString(callingPackage);
2395 data.writeInt(callingPid);
2396 data.writeInt(callingUid);
2397 intent.writeToParcel(data, 0);
2398 data.writeString(resolvedType);
2399 data.writeStrongBinder(session.asBinder());
2400 data.writeStrongBinder(interactor.asBinder());
2401 data.writeInt(startFlags);
2402 data.writeString(profileFile);
2403 if (profileFd != null) {
2404 data.writeInt(1);
2405 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2406 } else {
2407 data.writeInt(0);
2408 }
2409 if (options != null) {
2410 data.writeInt(1);
2411 options.writeToParcel(data, 0);
2412 } else {
2413 data.writeInt(0);
2414 }
2415 data.writeInt(userId);
2416 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2417 reply.readException();
2418 int result = reply.readInt();
2419 reply.recycle();
2420 data.recycle();
2421 return result;
2422 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002423 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002424 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002425 Parcel data = Parcel.obtain();
2426 Parcel reply = Parcel.obtain();
2427 data.writeInterfaceToken(IActivityManager.descriptor);
2428 data.writeStrongBinder(callingActivity);
2429 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002430 if (options != null) {
2431 data.writeInt(1);
2432 options.writeToParcel(data, 0);
2433 } else {
2434 data.writeInt(0);
2435 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002436 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2437 reply.readException();
2438 int result = reply.readInt();
2439 reply.recycle();
2440 data.recycle();
2441 return result != 0;
2442 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002443 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002444 throws RemoteException {
2445 Parcel data = Parcel.obtain();
2446 Parcel reply = Parcel.obtain();
2447 data.writeInterfaceToken(IActivityManager.descriptor);
2448 data.writeStrongBinder(token);
2449 data.writeInt(resultCode);
2450 if (resultData != null) {
2451 data.writeInt(1);
2452 resultData.writeToParcel(data, 0);
2453 } else {
2454 data.writeInt(0);
2455 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002456 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002457 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2458 reply.readException();
2459 boolean res = reply.readInt() != 0;
2460 data.recycle();
2461 reply.recycle();
2462 return res;
2463 }
2464 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2465 {
2466 Parcel data = Parcel.obtain();
2467 Parcel reply = Parcel.obtain();
2468 data.writeInterfaceToken(IActivityManager.descriptor);
2469 data.writeStrongBinder(token);
2470 data.writeString(resultWho);
2471 data.writeInt(requestCode);
2472 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2473 reply.readException();
2474 data.recycle();
2475 reply.recycle();
2476 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002477 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2478 Parcel data = Parcel.obtain();
2479 Parcel reply = Parcel.obtain();
2480 data.writeInterfaceToken(IActivityManager.descriptor);
2481 data.writeStrongBinder(token);
2482 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2483 reply.readException();
2484 boolean res = reply.readInt() != 0;
2485 data.recycle();
2486 reply.recycle();
2487 return res;
2488 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002489 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2490 Parcel data = Parcel.obtain();
2491 Parcel reply = Parcel.obtain();
2492 data.writeInterfaceToken(IActivityManager.descriptor);
2493 data.writeStrongBinder(session.asBinder());
2494 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2495 reply.readException();
2496 data.recycle();
2497 reply.recycle();
2498 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002499 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2500 Parcel data = Parcel.obtain();
2501 Parcel reply = Parcel.obtain();
2502 data.writeInterfaceToken(IActivityManager.descriptor);
2503 data.writeStrongBinder(token);
2504 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2505 reply.readException();
2506 boolean res = reply.readInt() != 0;
2507 data.recycle();
2508 reply.recycle();
2509 return res;
2510 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002511 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002512 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002513 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002514 {
2515 Parcel data = Parcel.obtain();
2516 Parcel reply = Parcel.obtain();
2517 data.writeInterfaceToken(IActivityManager.descriptor);
2518 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002519 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002520 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2521 filter.writeToParcel(data, 0);
2522 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002523 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002524 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2525 reply.readException();
2526 Intent intent = null;
2527 int haveIntent = reply.readInt();
2528 if (haveIntent != 0) {
2529 intent = Intent.CREATOR.createFromParcel(reply);
2530 }
2531 reply.recycle();
2532 data.recycle();
2533 return intent;
2534 }
2535 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2536 {
2537 Parcel data = Parcel.obtain();
2538 Parcel reply = Parcel.obtain();
2539 data.writeInterfaceToken(IActivityManager.descriptor);
2540 data.writeStrongBinder(receiver.asBinder());
2541 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2542 reply.readException();
2543 data.recycle();
2544 reply.recycle();
2545 }
2546 public int broadcastIntent(IApplicationThread caller,
2547 Intent intent, String resolvedType, IIntentReceiver resultTo,
2548 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002549 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002550 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 {
2552 Parcel data = Parcel.obtain();
2553 Parcel reply = Parcel.obtain();
2554 data.writeInterfaceToken(IActivityManager.descriptor);
2555 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2556 intent.writeToParcel(data, 0);
2557 data.writeString(resolvedType);
2558 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2559 data.writeInt(resultCode);
2560 data.writeString(resultData);
2561 data.writeBundle(map);
2562 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002563 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002564 data.writeInt(serialized ? 1 : 0);
2565 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002566 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002567 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2568 reply.readException();
2569 int res = reply.readInt();
2570 reply.recycle();
2571 data.recycle();
2572 return res;
2573 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002574 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2575 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002576 {
2577 Parcel data = Parcel.obtain();
2578 Parcel reply = Parcel.obtain();
2579 data.writeInterfaceToken(IActivityManager.descriptor);
2580 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2581 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002582 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002583 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2584 reply.readException();
2585 data.recycle();
2586 reply.recycle();
2587 }
2588 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2589 {
2590 Parcel data = Parcel.obtain();
2591 Parcel reply = Parcel.obtain();
2592 data.writeInterfaceToken(IActivityManager.descriptor);
2593 data.writeStrongBinder(who);
2594 data.writeInt(resultCode);
2595 data.writeString(resultData);
2596 data.writeBundle(map);
2597 data.writeInt(abortBroadcast ? 1 : 0);
2598 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2599 reply.readException();
2600 data.recycle();
2601 reply.recycle();
2602 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 public void attachApplication(IApplicationThread app) throws RemoteException
2604 {
2605 Parcel data = Parcel.obtain();
2606 Parcel reply = Parcel.obtain();
2607 data.writeInterfaceToken(IActivityManager.descriptor);
2608 data.writeStrongBinder(app.asBinder());
2609 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2610 reply.readException();
2611 data.recycle();
2612 reply.recycle();
2613 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002614 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2615 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002621 if (config != null) {
2622 data.writeInt(1);
2623 config.writeToParcel(data, 0);
2624 } else {
2625 data.writeInt(0);
2626 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002627 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002628 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2629 reply.readException();
2630 data.recycle();
2631 reply.recycle();
2632 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002633 public void activityResumed(IBinder token) throws RemoteException
2634 {
2635 Parcel data = Parcel.obtain();
2636 Parcel reply = Parcel.obtain();
2637 data.writeInterfaceToken(IActivityManager.descriptor);
2638 data.writeStrongBinder(token);
2639 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2640 reply.readException();
2641 data.recycle();
2642 reply.recycle();
2643 }
Craig Mautnera0026042014-04-23 11:45:37 -07002644 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002645 {
2646 Parcel data = Parcel.obtain();
2647 Parcel reply = Parcel.obtain();
2648 data.writeInterfaceToken(IActivityManager.descriptor);
2649 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002650 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002651 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2652 reply.readException();
2653 data.recycle();
2654 reply.recycle();
2655 }
2656 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002657 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002658 {
2659 Parcel data = Parcel.obtain();
2660 Parcel reply = Parcel.obtain();
2661 data.writeInterfaceToken(IActivityManager.descriptor);
2662 data.writeStrongBinder(token);
2663 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002664 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002665 TextUtils.writeToParcel(description, data, 0);
2666 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2667 reply.readException();
2668 data.recycle();
2669 reply.recycle();
2670 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002671 public void activitySlept(IBinder token) throws RemoteException
2672 {
2673 Parcel data = Parcel.obtain();
2674 Parcel reply = Parcel.obtain();
2675 data.writeInterfaceToken(IActivityManager.descriptor);
2676 data.writeStrongBinder(token);
2677 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2678 reply.readException();
2679 data.recycle();
2680 reply.recycle();
2681 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002682 public void activityDestroyed(IBinder token) throws RemoteException
2683 {
2684 Parcel data = Parcel.obtain();
2685 Parcel reply = Parcel.obtain();
2686 data.writeInterfaceToken(IActivityManager.descriptor);
2687 data.writeStrongBinder(token);
2688 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2689 reply.readException();
2690 data.recycle();
2691 reply.recycle();
2692 }
2693 public String getCallingPackage(IBinder token) throws RemoteException
2694 {
2695 Parcel data = Parcel.obtain();
2696 Parcel reply = Parcel.obtain();
2697 data.writeInterfaceToken(IActivityManager.descriptor);
2698 data.writeStrongBinder(token);
2699 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2700 reply.readException();
2701 String res = reply.readString();
2702 data.recycle();
2703 reply.recycle();
2704 return res;
2705 }
2706 public ComponentName getCallingActivity(IBinder token)
2707 throws RemoteException {
2708 Parcel data = Parcel.obtain();
2709 Parcel reply = Parcel.obtain();
2710 data.writeInterfaceToken(IActivityManager.descriptor);
2711 data.writeStrongBinder(token);
2712 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2713 reply.readException();
2714 ComponentName res = ComponentName.readFromParcel(reply);
2715 data.recycle();
2716 reply.recycle();
2717 return res;
2718 }
Winson Chung1147c402014-05-14 11:05:00 -07002719 public List<IAppTask> getAppTasks() throws RemoteException {
2720 Parcel data = Parcel.obtain();
2721 Parcel reply = Parcel.obtain();
2722 data.writeInterfaceToken(IActivityManager.descriptor);
2723 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2724 reply.readException();
2725 ArrayList<IAppTask> list = null;
2726 int N = reply.readInt();
2727 if (N >= 0) {
2728 list = new ArrayList<IAppTask>();
2729 while (N > 0) {
2730 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2731 list.add(task);
2732 N--;
2733 }
2734 }
2735 data.recycle();
2736 reply.recycle();
2737 return list;
2738 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002739 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 Parcel data = Parcel.obtain();
2741 Parcel reply = Parcel.obtain();
2742 data.writeInterfaceToken(IActivityManager.descriptor);
2743 data.writeInt(maxNum);
2744 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002745 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2746 reply.readException();
2747 ArrayList list = null;
2748 int N = reply.readInt();
2749 if (N >= 0) {
2750 list = new ArrayList();
2751 while (N > 0) {
2752 ActivityManager.RunningTaskInfo info =
2753 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002754 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002755 list.add(info);
2756 N--;
2757 }
2758 }
2759 data.recycle();
2760 reply.recycle();
2761 return list;
2762 }
2763 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002764 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 Parcel data = Parcel.obtain();
2766 Parcel reply = Parcel.obtain();
2767 data.writeInterfaceToken(IActivityManager.descriptor);
2768 data.writeInt(maxNum);
2769 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002770 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2772 reply.readException();
2773 ArrayList<ActivityManager.RecentTaskInfo> list
2774 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2775 data.recycle();
2776 reply.recycle();
2777 return list;
2778 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002779 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002780 Parcel data = Parcel.obtain();
2781 Parcel reply = Parcel.obtain();
2782 data.writeInterfaceToken(IActivityManager.descriptor);
2783 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002784 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002785 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002786 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002787 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002788 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002789 }
2790 data.recycle();
2791 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002792 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002793 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002794 public List getServices(int maxNum, int flags) throws RemoteException {
2795 Parcel data = Parcel.obtain();
2796 Parcel reply = Parcel.obtain();
2797 data.writeInterfaceToken(IActivityManager.descriptor);
2798 data.writeInt(maxNum);
2799 data.writeInt(flags);
2800 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2801 reply.readException();
2802 ArrayList list = null;
2803 int N = reply.readInt();
2804 if (N >= 0) {
2805 list = new ArrayList();
2806 while (N > 0) {
2807 ActivityManager.RunningServiceInfo info =
2808 ActivityManager.RunningServiceInfo.CREATOR
2809 .createFromParcel(reply);
2810 list.add(info);
2811 N--;
2812 }
2813 }
2814 data.recycle();
2815 reply.recycle();
2816 return list;
2817 }
2818 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2819 throws RemoteException {
2820 Parcel data = Parcel.obtain();
2821 Parcel reply = Parcel.obtain();
2822 data.writeInterfaceToken(IActivityManager.descriptor);
2823 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2824 reply.readException();
2825 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2826 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2827 data.recycle();
2828 reply.recycle();
2829 return list;
2830 }
2831 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2832 throws RemoteException {
2833 Parcel data = Parcel.obtain();
2834 Parcel reply = Parcel.obtain();
2835 data.writeInterfaceToken(IActivityManager.descriptor);
2836 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2837 reply.readException();
2838 ArrayList<ActivityManager.RunningAppProcessInfo> list
2839 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2840 data.recycle();
2841 reply.recycle();
2842 return list;
2843 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002844 public List<ApplicationInfo> getRunningExternalApplications()
2845 throws RemoteException {
2846 Parcel data = Parcel.obtain();
2847 Parcel reply = Parcel.obtain();
2848 data.writeInterfaceToken(IActivityManager.descriptor);
2849 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2850 reply.readException();
2851 ArrayList<ApplicationInfo> list
2852 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2853 data.recycle();
2854 reply.recycle();
2855 return list;
2856 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002857 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002858 {
2859 Parcel data = Parcel.obtain();
2860 Parcel reply = Parcel.obtain();
2861 data.writeInterfaceToken(IActivityManager.descriptor);
2862 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002863 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002864 if (options != null) {
2865 data.writeInt(1);
2866 options.writeToParcel(data, 0);
2867 } else {
2868 data.writeInt(0);
2869 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002870 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2871 reply.readException();
2872 data.recycle();
2873 reply.recycle();
2874 }
2875 public void moveTaskToBack(int task) throws RemoteException
2876 {
2877 Parcel data = Parcel.obtain();
2878 Parcel reply = Parcel.obtain();
2879 data.writeInterfaceToken(IActivityManager.descriptor);
2880 data.writeInt(task);
2881 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2882 reply.readException();
2883 data.recycle();
2884 reply.recycle();
2885 }
2886 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2887 throws RemoteException {
2888 Parcel data = Parcel.obtain();
2889 Parcel reply = Parcel.obtain();
2890 data.writeInterfaceToken(IActivityManager.descriptor);
2891 data.writeStrongBinder(token);
2892 data.writeInt(nonRoot ? 1 : 0);
2893 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2894 reply.readException();
2895 boolean res = reply.readInt() != 0;
2896 data.recycle();
2897 reply.recycle();
2898 return res;
2899 }
2900 public void moveTaskBackwards(int task) throws RemoteException
2901 {
2902 Parcel data = Parcel.obtain();
2903 Parcel reply = Parcel.obtain();
2904 data.writeInterfaceToken(IActivityManager.descriptor);
2905 data.writeInt(task);
2906 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2907 reply.readException();
2908 data.recycle();
2909 reply.recycle();
2910 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002911 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002912 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2913 {
2914 Parcel data = Parcel.obtain();
2915 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002916 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002917 data.writeInt(taskId);
2918 data.writeInt(stackId);
2919 data.writeInt(toTop ? 1 : 0);
2920 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 data.recycle();
2923 reply.recycle();
2924 }
2925 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002926 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002927 {
2928 Parcel data = Parcel.obtain();
2929 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002930 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002931 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002932 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002933 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002934 reply.readException();
2935 data.recycle();
2936 reply.recycle();
2937 }
Craig Mautner967212c2013-04-13 21:10:58 -07002938 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002939 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002940 {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
2943 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002944 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002945 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002946 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002947 data.recycle();
2948 reply.recycle();
2949 return list;
2950 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002951 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002952 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002953 {
2954 Parcel data = Parcel.obtain();
2955 Parcel reply = Parcel.obtain();
2956 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002957 data.writeInt(stackId);
2958 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002959 reply.readException();
2960 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002961 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002962 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002963 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002964 }
2965 data.recycle();
2966 reply.recycle();
2967 return info;
2968 }
2969 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002970 public boolean isInHomeStack(int taskId) throws RemoteException {
2971 Parcel data = Parcel.obtain();
2972 Parcel reply = Parcel.obtain();
2973 data.writeInterfaceToken(IActivityManager.descriptor);
2974 data.writeInt(taskId);
2975 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2976 reply.readException();
2977 boolean isInHomeStack = reply.readInt() > 0;
2978 data.recycle();
2979 reply.recycle();
2980 return isInHomeStack;
2981 }
2982 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002983 public void setFocusedStack(int stackId) throws RemoteException
2984 {
2985 Parcel data = Parcel.obtain();
2986 Parcel reply = Parcel.obtain();
2987 data.writeInterfaceToken(IActivityManager.descriptor);
2988 data.writeInt(stackId);
2989 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2990 reply.readException();
2991 data.recycle();
2992 reply.recycle();
2993 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002994 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2995 {
2996 Parcel data = Parcel.obtain();
2997 Parcel reply = Parcel.obtain();
2998 data.writeInterfaceToken(IActivityManager.descriptor);
2999 data.writeStrongBinder(token);
3000 data.writeInt(onlyRoot ? 1 : 0);
3001 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3002 reply.readException();
3003 int res = reply.readInt();
3004 data.recycle();
3005 reply.recycle();
3006 return res;
3007 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003009 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003010 Parcel data = Parcel.obtain();
3011 Parcel reply = Parcel.obtain();
3012 data.writeInterfaceToken(IActivityManager.descriptor);
3013 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3014 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003015 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003016 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3018 reply.readException();
3019 int res = reply.readInt();
3020 ContentProviderHolder cph = null;
3021 if (res != 0) {
3022 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3023 }
3024 data.recycle();
3025 reply.recycle();
3026 return cph;
3027 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003028 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3029 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003030 Parcel data = Parcel.obtain();
3031 Parcel reply = Parcel.obtain();
3032 data.writeInterfaceToken(IActivityManager.descriptor);
3033 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003034 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003035 data.writeStrongBinder(token);
3036 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3037 reply.readException();
3038 int res = reply.readInt();
3039 ContentProviderHolder cph = null;
3040 if (res != 0) {
3041 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3042 }
3043 data.recycle();
3044 reply.recycle();
3045 return cph;
3046 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003047 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003048 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003049 {
3050 Parcel data = Parcel.obtain();
3051 Parcel reply = Parcel.obtain();
3052 data.writeInterfaceToken(IActivityManager.descriptor);
3053 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3054 data.writeTypedList(providers);
3055 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3056 reply.readException();
3057 data.recycle();
3058 reply.recycle();
3059 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003060 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3061 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003062 Parcel data = Parcel.obtain();
3063 Parcel reply = Parcel.obtain();
3064 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003065 data.writeStrongBinder(connection);
3066 data.writeInt(stable);
3067 data.writeInt(unstable);
3068 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3069 reply.readException();
3070 boolean res = reply.readInt() != 0;
3071 data.recycle();
3072 reply.recycle();
3073 return res;
3074 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003075
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003076 public void unstableProviderDied(IBinder connection) throws RemoteException {
3077 Parcel data = Parcel.obtain();
3078 Parcel reply = Parcel.obtain();
3079 data.writeInterfaceToken(IActivityManager.descriptor);
3080 data.writeStrongBinder(connection);
3081 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3082 reply.readException();
3083 data.recycle();
3084 reply.recycle();
3085 }
3086
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003087 @Override
3088 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
3092 data.writeStrongBinder(connection);
3093 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3094 reply.readException();
3095 data.recycle();
3096 reply.recycle();
3097 }
3098
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003099 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3100 Parcel data = Parcel.obtain();
3101 Parcel reply = Parcel.obtain();
3102 data.writeInterfaceToken(IActivityManager.descriptor);
3103 data.writeStrongBinder(connection);
3104 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003105 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3106 reply.readException();
3107 data.recycle();
3108 reply.recycle();
3109 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003110
3111 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3112 Parcel data = Parcel.obtain();
3113 Parcel reply = Parcel.obtain();
3114 data.writeInterfaceToken(IActivityManager.descriptor);
3115 data.writeString(name);
3116 data.writeStrongBinder(token);
3117 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3118 reply.readException();
3119 data.recycle();
3120 reply.recycle();
3121 }
3122
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003123 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3124 throws RemoteException
3125 {
3126 Parcel data = Parcel.obtain();
3127 Parcel reply = Parcel.obtain();
3128 data.writeInterfaceToken(IActivityManager.descriptor);
3129 service.writeToParcel(data, 0);
3130 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3131 reply.readException();
3132 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3133 data.recycle();
3134 reply.recycle();
3135 return res;
3136 }
3137
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003138 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003139 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003140 {
3141 Parcel data = Parcel.obtain();
3142 Parcel reply = Parcel.obtain();
3143 data.writeInterfaceToken(IActivityManager.descriptor);
3144 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3145 service.writeToParcel(data, 0);
3146 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003147 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3149 reply.readException();
3150 ComponentName res = ComponentName.readFromParcel(reply);
3151 data.recycle();
3152 reply.recycle();
3153 return res;
3154 }
3155 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003156 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003157 {
3158 Parcel data = Parcel.obtain();
3159 Parcel reply = Parcel.obtain();
3160 data.writeInterfaceToken(IActivityManager.descriptor);
3161 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3162 service.writeToParcel(data, 0);
3163 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003164 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003165 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3166 reply.readException();
3167 int res = reply.readInt();
3168 reply.recycle();
3169 data.recycle();
3170 return res;
3171 }
3172 public boolean stopServiceToken(ComponentName className, IBinder token,
3173 int startId) throws RemoteException {
3174 Parcel data = Parcel.obtain();
3175 Parcel reply = Parcel.obtain();
3176 data.writeInterfaceToken(IActivityManager.descriptor);
3177 ComponentName.writeToParcel(className, data);
3178 data.writeStrongBinder(token);
3179 data.writeInt(startId);
3180 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3181 reply.readException();
3182 boolean res = reply.readInt() != 0;
3183 data.recycle();
3184 reply.recycle();
3185 return res;
3186 }
3187 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003188 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003189 Parcel data = Parcel.obtain();
3190 Parcel reply = Parcel.obtain();
3191 data.writeInterfaceToken(IActivityManager.descriptor);
3192 ComponentName.writeToParcel(className, data);
3193 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003194 data.writeInt(id);
3195 if (notification != null) {
3196 data.writeInt(1);
3197 notification.writeToParcel(data, 0);
3198 } else {
3199 data.writeInt(0);
3200 }
3201 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003202 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3203 reply.readException();
3204 data.recycle();
3205 reply.recycle();
3206 }
3207 public int bindService(IApplicationThread caller, IBinder token,
3208 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003209 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003210 Parcel data = Parcel.obtain();
3211 Parcel reply = Parcel.obtain();
3212 data.writeInterfaceToken(IActivityManager.descriptor);
3213 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3214 data.writeStrongBinder(token);
3215 service.writeToParcel(data, 0);
3216 data.writeString(resolvedType);
3217 data.writeStrongBinder(connection.asBinder());
3218 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003219 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003220 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3221 reply.readException();
3222 int res = reply.readInt();
3223 data.recycle();
3224 reply.recycle();
3225 return res;
3226 }
3227 public boolean unbindService(IServiceConnection connection) throws RemoteException
3228 {
3229 Parcel data = Parcel.obtain();
3230 Parcel reply = Parcel.obtain();
3231 data.writeInterfaceToken(IActivityManager.descriptor);
3232 data.writeStrongBinder(connection.asBinder());
3233 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3234 reply.readException();
3235 boolean res = reply.readInt() != 0;
3236 data.recycle();
3237 reply.recycle();
3238 return res;
3239 }
3240
3241 public void publishService(IBinder token,
3242 Intent intent, IBinder service) throws RemoteException {
3243 Parcel data = Parcel.obtain();
3244 Parcel reply = Parcel.obtain();
3245 data.writeInterfaceToken(IActivityManager.descriptor);
3246 data.writeStrongBinder(token);
3247 intent.writeToParcel(data, 0);
3248 data.writeStrongBinder(service);
3249 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3250 reply.readException();
3251 data.recycle();
3252 reply.recycle();
3253 }
3254
3255 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3256 throws RemoteException {
3257 Parcel data = Parcel.obtain();
3258 Parcel reply = Parcel.obtain();
3259 data.writeInterfaceToken(IActivityManager.descriptor);
3260 data.writeStrongBinder(token);
3261 intent.writeToParcel(data, 0);
3262 data.writeInt(doRebind ? 1 : 0);
3263 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3264 reply.readException();
3265 data.recycle();
3266 reply.recycle();
3267 }
3268
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003269 public void serviceDoneExecuting(IBinder token, int type, int startId,
3270 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003271 Parcel data = Parcel.obtain();
3272 Parcel reply = Parcel.obtain();
3273 data.writeInterfaceToken(IActivityManager.descriptor);
3274 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003275 data.writeInt(type);
3276 data.writeInt(startId);
3277 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003278 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3279 reply.readException();
3280 data.recycle();
3281 reply.recycle();
3282 }
3283
3284 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3285 Parcel data = Parcel.obtain();
3286 Parcel reply = Parcel.obtain();
3287 data.writeInterfaceToken(IActivityManager.descriptor);
3288 service.writeToParcel(data, 0);
3289 data.writeString(resolvedType);
3290 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 IBinder binder = reply.readStrongBinder();
3293 reply.recycle();
3294 data.recycle();
3295 return binder;
3296 }
3297
Christopher Tate181fafa2009-05-14 11:12:14 -07003298 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3299 throws RemoteException {
3300 Parcel data = Parcel.obtain();
3301 Parcel reply = Parcel.obtain();
3302 data.writeInterfaceToken(IActivityManager.descriptor);
3303 app.writeToParcel(data, 0);
3304 data.writeInt(backupRestoreMode);
3305 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3306 reply.readException();
3307 boolean success = reply.readInt() != 0;
3308 reply.recycle();
3309 data.recycle();
3310 return success;
3311 }
3312
Christopher Tate346acb12012-10-15 19:20:25 -07003313 public void clearPendingBackup() throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3318 reply.recycle();
3319 data.recycle();
3320 }
3321
Christopher Tate181fafa2009-05-14 11:12:14 -07003322 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3323 Parcel data = Parcel.obtain();
3324 Parcel reply = Parcel.obtain();
3325 data.writeInterfaceToken(IActivityManager.descriptor);
3326 data.writeString(packageName);
3327 data.writeStrongBinder(agent);
3328 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3329 reply.recycle();
3330 data.recycle();
3331 }
3332
3333 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3334 Parcel data = Parcel.obtain();
3335 Parcel reply = Parcel.obtain();
3336 data.writeInterfaceToken(IActivityManager.descriptor);
3337 app.writeToParcel(data, 0);
3338 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3339 reply.readException();
3340 reply.recycle();
3341 data.recycle();
3342 }
3343
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003344 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003345 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003346 IUiAutomationConnection connection, int userId, String instructionSet)
3347 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003348 Parcel data = Parcel.obtain();
3349 Parcel reply = Parcel.obtain();
3350 data.writeInterfaceToken(IActivityManager.descriptor);
3351 ComponentName.writeToParcel(className, data);
3352 data.writeString(profileFile);
3353 data.writeInt(flags);
3354 data.writeBundle(arguments);
3355 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003356 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003357 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003358 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003359 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3360 reply.readException();
3361 boolean res = reply.readInt() != 0;
3362 reply.recycle();
3363 data.recycle();
3364 return res;
3365 }
3366
3367 public void finishInstrumentation(IApplicationThread target,
3368 int resultCode, Bundle results) throws RemoteException {
3369 Parcel data = Parcel.obtain();
3370 Parcel reply = Parcel.obtain();
3371 data.writeInterfaceToken(IActivityManager.descriptor);
3372 data.writeStrongBinder(target != null ? target.asBinder() : null);
3373 data.writeInt(resultCode);
3374 data.writeBundle(results);
3375 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3376 reply.readException();
3377 data.recycle();
3378 reply.recycle();
3379 }
3380 public Configuration getConfiguration() throws RemoteException
3381 {
3382 Parcel data = Parcel.obtain();
3383 Parcel reply = Parcel.obtain();
3384 data.writeInterfaceToken(IActivityManager.descriptor);
3385 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3386 reply.readException();
3387 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3388 reply.recycle();
3389 data.recycle();
3390 return res;
3391 }
3392 public void updateConfiguration(Configuration values) throws RemoteException
3393 {
3394 Parcel data = Parcel.obtain();
3395 Parcel reply = Parcel.obtain();
3396 data.writeInterfaceToken(IActivityManager.descriptor);
3397 values.writeToParcel(data, 0);
3398 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3399 reply.readException();
3400 data.recycle();
3401 reply.recycle();
3402 }
3403 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3404 throws RemoteException {
3405 Parcel data = Parcel.obtain();
3406 Parcel reply = Parcel.obtain();
3407 data.writeInterfaceToken(IActivityManager.descriptor);
3408 data.writeStrongBinder(token);
3409 data.writeInt(requestedOrientation);
3410 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3411 reply.readException();
3412 data.recycle();
3413 reply.recycle();
3414 }
3415 public int getRequestedOrientation(IBinder token) throws RemoteException {
3416 Parcel data = Parcel.obtain();
3417 Parcel reply = Parcel.obtain();
3418 data.writeInterfaceToken(IActivityManager.descriptor);
3419 data.writeStrongBinder(token);
3420 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3421 reply.readException();
3422 int res = reply.readInt();
3423 data.recycle();
3424 reply.recycle();
3425 return res;
3426 }
3427 public ComponentName getActivityClassForToken(IBinder token)
3428 throws RemoteException {
3429 Parcel data = Parcel.obtain();
3430 Parcel reply = Parcel.obtain();
3431 data.writeInterfaceToken(IActivityManager.descriptor);
3432 data.writeStrongBinder(token);
3433 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3434 reply.readException();
3435 ComponentName res = ComponentName.readFromParcel(reply);
3436 data.recycle();
3437 reply.recycle();
3438 return res;
3439 }
3440 public String getPackageForToken(IBinder token) throws RemoteException
3441 {
3442 Parcel data = Parcel.obtain();
3443 Parcel reply = Parcel.obtain();
3444 data.writeInterfaceToken(IActivityManager.descriptor);
3445 data.writeStrongBinder(token);
3446 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3447 reply.readException();
3448 String res = reply.readString();
3449 data.recycle();
3450 reply.recycle();
3451 return res;
3452 }
3453 public IIntentSender getIntentSender(int type,
3454 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003455 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003456 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003457 Parcel data = Parcel.obtain();
3458 Parcel reply = Parcel.obtain();
3459 data.writeInterfaceToken(IActivityManager.descriptor);
3460 data.writeInt(type);
3461 data.writeString(packageName);
3462 data.writeStrongBinder(token);
3463 data.writeString(resultWho);
3464 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003465 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003466 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003467 data.writeTypedArray(intents, 0);
3468 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003469 } else {
3470 data.writeInt(0);
3471 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003473 if (options != null) {
3474 data.writeInt(1);
3475 options.writeToParcel(data, 0);
3476 } else {
3477 data.writeInt(0);
3478 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003479 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003480 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3481 reply.readException();
3482 IIntentSender res = IIntentSender.Stub.asInterface(
3483 reply.readStrongBinder());
3484 data.recycle();
3485 reply.recycle();
3486 return res;
3487 }
3488 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3489 Parcel data = Parcel.obtain();
3490 Parcel reply = Parcel.obtain();
3491 data.writeInterfaceToken(IActivityManager.descriptor);
3492 data.writeStrongBinder(sender.asBinder());
3493 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3494 reply.readException();
3495 data.recycle();
3496 reply.recycle();
3497 }
3498 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3499 Parcel data = Parcel.obtain();
3500 Parcel reply = Parcel.obtain();
3501 data.writeInterfaceToken(IActivityManager.descriptor);
3502 data.writeStrongBinder(sender.asBinder());
3503 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3504 reply.readException();
3505 String res = reply.readString();
3506 data.recycle();
3507 reply.recycle();
3508 return res;
3509 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003510 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3511 Parcel data = Parcel.obtain();
3512 Parcel reply = Parcel.obtain();
3513 data.writeInterfaceToken(IActivityManager.descriptor);
3514 data.writeStrongBinder(sender.asBinder());
3515 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3516 reply.readException();
3517 int res = reply.readInt();
3518 data.recycle();
3519 reply.recycle();
3520 return res;
3521 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003522 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3523 boolean requireFull, String name, String callerPackage) throws RemoteException {
3524 Parcel data = Parcel.obtain();
3525 Parcel reply = Parcel.obtain();
3526 data.writeInterfaceToken(IActivityManager.descriptor);
3527 data.writeInt(callingPid);
3528 data.writeInt(callingUid);
3529 data.writeInt(userId);
3530 data.writeInt(allowAll ? 1 : 0);
3531 data.writeInt(requireFull ? 1 : 0);
3532 data.writeString(name);
3533 data.writeString(callerPackage);
3534 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3535 reply.readException();
3536 int res = reply.readInt();
3537 data.recycle();
3538 reply.recycle();
3539 return res;
3540 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 public void setProcessLimit(int max) throws RemoteException
3542 {
3543 Parcel data = Parcel.obtain();
3544 Parcel reply = Parcel.obtain();
3545 data.writeInterfaceToken(IActivityManager.descriptor);
3546 data.writeInt(max);
3547 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3548 reply.readException();
3549 data.recycle();
3550 reply.recycle();
3551 }
3552 public int getProcessLimit() throws RemoteException
3553 {
3554 Parcel data = Parcel.obtain();
3555 Parcel reply = Parcel.obtain();
3556 data.writeInterfaceToken(IActivityManager.descriptor);
3557 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3558 reply.readException();
3559 int res = reply.readInt();
3560 data.recycle();
3561 reply.recycle();
3562 return res;
3563 }
3564 public void setProcessForeground(IBinder token, int pid,
3565 boolean isForeground) throws RemoteException {
3566 Parcel data = Parcel.obtain();
3567 Parcel reply = Parcel.obtain();
3568 data.writeInterfaceToken(IActivityManager.descriptor);
3569 data.writeStrongBinder(token);
3570 data.writeInt(pid);
3571 data.writeInt(isForeground ? 1 : 0);
3572 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3573 reply.readException();
3574 data.recycle();
3575 reply.recycle();
3576 }
3577 public int checkPermission(String permission, int pid, int uid)
3578 throws RemoteException {
3579 Parcel data = Parcel.obtain();
3580 Parcel reply = Parcel.obtain();
3581 data.writeInterfaceToken(IActivityManager.descriptor);
3582 data.writeString(permission);
3583 data.writeInt(pid);
3584 data.writeInt(uid);
3585 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3586 reply.readException();
3587 int res = reply.readInt();
3588 data.recycle();
3589 reply.recycle();
3590 return res;
3591 }
3592 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003593 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003594 Parcel data = Parcel.obtain();
3595 Parcel reply = Parcel.obtain();
3596 data.writeInterfaceToken(IActivityManager.descriptor);
3597 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003598 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003599 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003600 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3601 reply.readException();
3602 boolean res = reply.readInt() != 0;
3603 data.recycle();
3604 reply.recycle();
3605 return res;
3606 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003607 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003608 throws RemoteException {
3609 Parcel data = Parcel.obtain();
3610 Parcel reply = Parcel.obtain();
3611 data.writeInterfaceToken(IActivityManager.descriptor);
3612 uri.writeToParcel(data, 0);
3613 data.writeInt(pid);
3614 data.writeInt(uid);
3615 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003616 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003617 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3618 reply.readException();
3619 int res = reply.readInt();
3620 data.recycle();
3621 reply.recycle();
3622 return res;
3623 }
3624 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003625 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003626 Parcel data = Parcel.obtain();
3627 Parcel reply = Parcel.obtain();
3628 data.writeInterfaceToken(IActivityManager.descriptor);
3629 data.writeStrongBinder(caller.asBinder());
3630 data.writeString(targetPkg);
3631 uri.writeToParcel(data, 0);
3632 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003633 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003634 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3635 reply.readException();
3636 data.recycle();
3637 reply.recycle();
3638 }
3639 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003640 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003641 Parcel data = Parcel.obtain();
3642 Parcel reply = Parcel.obtain();
3643 data.writeInterfaceToken(IActivityManager.descriptor);
3644 data.writeStrongBinder(caller.asBinder());
3645 uri.writeToParcel(data, 0);
3646 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003647 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003648 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3649 reply.readException();
3650 data.recycle();
3651 reply.recycle();
3652 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003653
3654 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003655 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3656 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003657 Parcel data = Parcel.obtain();
3658 Parcel reply = Parcel.obtain();
3659 data.writeInterfaceToken(IActivityManager.descriptor);
3660 uri.writeToParcel(data, 0);
3661 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003662 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003663 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3664 reply.readException();
3665 data.recycle();
3666 reply.recycle();
3667 }
3668
3669 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003670 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3671 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003672 Parcel data = Parcel.obtain();
3673 Parcel reply = Parcel.obtain();
3674 data.writeInterfaceToken(IActivityManager.descriptor);
3675 uri.writeToParcel(data, 0);
3676 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003677 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003678 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3679 reply.readException();
3680 data.recycle();
3681 reply.recycle();
3682 }
3683
3684 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003685 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3686 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003687 Parcel data = Parcel.obtain();
3688 Parcel reply = Parcel.obtain();
3689 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003690 data.writeString(packageName);
3691 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003692 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3693 reply.readException();
3694 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3695 reply);
3696 data.recycle();
3697 reply.recycle();
3698 return perms;
3699 }
3700
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003701 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3702 throws RemoteException {
3703 Parcel data = Parcel.obtain();
3704 Parcel reply = Parcel.obtain();
3705 data.writeInterfaceToken(IActivityManager.descriptor);
3706 data.writeStrongBinder(who.asBinder());
3707 data.writeInt(waiting ? 1 : 0);
3708 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 data.recycle();
3711 reply.recycle();
3712 }
3713 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
3717 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3718 reply.readException();
3719 outInfo.readFromParcel(reply);
3720 data.recycle();
3721 reply.recycle();
3722 }
3723 public void unhandledBack() throws RemoteException
3724 {
3725 Parcel data = Parcel.obtain();
3726 Parcel reply = Parcel.obtain();
3727 data.writeInterfaceToken(IActivityManager.descriptor);
3728 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3729 reply.readException();
3730 data.recycle();
3731 reply.recycle();
3732 }
3733 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3734 {
3735 Parcel data = Parcel.obtain();
3736 Parcel reply = Parcel.obtain();
3737 data.writeInterfaceToken(IActivityManager.descriptor);
3738 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3739 reply.readException();
3740 ParcelFileDescriptor pfd = null;
3741 if (reply.readInt() != 0) {
3742 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3743 }
3744 data.recycle();
3745 reply.recycle();
3746 return pfd;
3747 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003748 public void setLockScreenShown(boolean shown) throws RemoteException
3749 {
3750 Parcel data = Parcel.obtain();
3751 Parcel reply = Parcel.obtain();
3752 data.writeInterfaceToken(IActivityManager.descriptor);
3753 data.writeInt(shown ? 1 : 0);
3754 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3755 reply.readException();
3756 data.recycle();
3757 reply.recycle();
3758 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003759 public void setDebugApp(
3760 String packageName, boolean waitForDebugger, boolean persistent)
3761 throws RemoteException
3762 {
3763 Parcel data = Parcel.obtain();
3764 Parcel reply = Parcel.obtain();
3765 data.writeInterfaceToken(IActivityManager.descriptor);
3766 data.writeString(packageName);
3767 data.writeInt(waitForDebugger ? 1 : 0);
3768 data.writeInt(persistent ? 1 : 0);
3769 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3770 reply.readException();
3771 data.recycle();
3772 reply.recycle();
3773 }
3774 public void setAlwaysFinish(boolean enabled) throws RemoteException
3775 {
3776 Parcel data = Parcel.obtain();
3777 Parcel reply = Parcel.obtain();
3778 data.writeInterfaceToken(IActivityManager.descriptor);
3779 data.writeInt(enabled ? 1 : 0);
3780 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3781 reply.readException();
3782 data.recycle();
3783 reply.recycle();
3784 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003785 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003786 {
3787 Parcel data = Parcel.obtain();
3788 Parcel reply = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003791 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003792 reply.readException();
3793 data.recycle();
3794 reply.recycle();
3795 }
3796 public void enterSafeMode() throws RemoteException {
3797 Parcel data = Parcel.obtain();
3798 data.writeInterfaceToken(IActivityManager.descriptor);
3799 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3800 data.recycle();
3801 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003802 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3803 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003804 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003805 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003806 data.writeStrongBinder(sender.asBinder());
3807 data.writeInt(sourceUid);
3808 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003809 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3810 data.recycle();
3811 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003812 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003813 Parcel data = Parcel.obtain();
3814 Parcel reply = Parcel.obtain();
3815 data.writeInterfaceToken(IActivityManager.descriptor);
3816 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003817 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003818 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003819 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003820 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003821 boolean res = reply.readInt() != 0;
3822 data.recycle();
3823 reply.recycle();
3824 return res;
3825 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003826 @Override
3827 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3828 Parcel data = Parcel.obtain();
3829 Parcel reply = Parcel.obtain();
3830 data.writeInterfaceToken(IActivityManager.descriptor);
3831 data.writeString(reason);
3832 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3833 boolean res = reply.readInt() != 0;
3834 data.recycle();
3835 reply.recycle();
3836 return res;
3837 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003838 public boolean testIsSystemReady()
3839 {
3840 /* this base class version is never called */
3841 return true;
3842 }
Dan Egnor60d87622009-12-16 16:32:58 -08003843 public void handleApplicationCrash(IBinder app,
3844 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3845 {
3846 Parcel data = Parcel.obtain();
3847 Parcel reply = Parcel.obtain();
3848 data.writeInterfaceToken(IActivityManager.descriptor);
3849 data.writeStrongBinder(app);
3850 crashInfo.writeToParcel(data, 0);
3851 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3852 reply.readException();
3853 reply.recycle();
3854 data.recycle();
3855 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003856
Dan Egnor60d87622009-12-16 16:32:58 -08003857 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003858 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003859 {
3860 Parcel data = Parcel.obtain();
3861 Parcel reply = Parcel.obtain();
3862 data.writeInterfaceToken(IActivityManager.descriptor);
3863 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003864 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003865 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003866 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003867 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003868 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003869 reply.recycle();
3870 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003871 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003872 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003873
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003874 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003875 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003876 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003877 {
3878 Parcel data = Parcel.obtain();
3879 Parcel reply = Parcel.obtain();
3880 data.writeInterfaceToken(IActivityManager.descriptor);
3881 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003882 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003883 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003884 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3885 reply.readException();
3886 reply.recycle();
3887 data.recycle();
3888 }
3889
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003890 public void signalPersistentProcesses(int sig) throws RemoteException {
3891 Parcel data = Parcel.obtain();
3892 Parcel reply = Parcel.obtain();
3893 data.writeInterfaceToken(IActivityManager.descriptor);
3894 data.writeInt(sig);
3895 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3896 reply.readException();
3897 data.recycle();
3898 reply.recycle();
3899 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003900
Dianne Hackborn1676c852012-09-10 14:52:30 -07003901 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003902 Parcel data = Parcel.obtain();
3903 Parcel reply = Parcel.obtain();
3904 data.writeInterfaceToken(IActivityManager.descriptor);
3905 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003906 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003907 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3908 reply.readException();
3909 data.recycle();
3910 reply.recycle();
3911 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003912
3913 public void killAllBackgroundProcesses() throws RemoteException {
3914 Parcel data = Parcel.obtain();
3915 Parcel reply = Parcel.obtain();
3916 data.writeInterfaceToken(IActivityManager.descriptor);
3917 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3918 reply.readException();
3919 data.recycle();
3920 reply.recycle();
3921 }
3922
Dianne Hackborn1676c852012-09-10 14:52:30 -07003923 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003924 Parcel data = Parcel.obtain();
3925 Parcel reply = Parcel.obtain();
3926 data.writeInterfaceToken(IActivityManager.descriptor);
3927 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003928 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003929 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003930 reply.readException();
3931 data.recycle();
3932 reply.recycle();
3933 }
3934
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003935 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3936 throws RemoteException
3937 {
3938 Parcel data = Parcel.obtain();
3939 Parcel reply = Parcel.obtain();
3940 data.writeInterfaceToken(IActivityManager.descriptor);
3941 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3942 reply.readException();
3943 outInfo.readFromParcel(reply);
3944 reply.recycle();
3945 data.recycle();
3946 }
3947
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003948 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3949 {
3950 Parcel data = Parcel.obtain();
3951 Parcel reply = Parcel.obtain();
3952 data.writeInterfaceToken(IActivityManager.descriptor);
3953 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3954 reply.readException();
3955 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3956 reply.recycle();
3957 data.recycle();
3958 return res;
3959 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003960
Dianne Hackborn1676c852012-09-10 14:52:30 -07003961 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003962 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003963 {
3964 Parcel data = Parcel.obtain();
3965 Parcel reply = Parcel.obtain();
3966 data.writeInterfaceToken(IActivityManager.descriptor);
3967 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003968 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003969 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003970 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003971 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003972 if (fd != null) {
3973 data.writeInt(1);
3974 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3975 } else {
3976 data.writeInt(0);
3977 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003978 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3979 reply.readException();
3980 boolean res = reply.readInt() != 0;
3981 reply.recycle();
3982 data.recycle();
3983 return res;
3984 }
3985
Dianne Hackborn55280a92009-05-07 15:53:46 -07003986 public boolean shutdown(int timeout) throws RemoteException
3987 {
3988 Parcel data = Parcel.obtain();
3989 Parcel reply = Parcel.obtain();
3990 data.writeInterfaceToken(IActivityManager.descriptor);
3991 data.writeInt(timeout);
3992 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3993 reply.readException();
3994 boolean res = reply.readInt() != 0;
3995 reply.recycle();
3996 data.recycle();
3997 return res;
3998 }
3999
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004000 public void stopAppSwitches() throws RemoteException {
4001 Parcel data = Parcel.obtain();
4002 Parcel reply = Parcel.obtain();
4003 data.writeInterfaceToken(IActivityManager.descriptor);
4004 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4005 reply.readException();
4006 reply.recycle();
4007 data.recycle();
4008 }
4009
4010 public void resumeAppSwitches() throws RemoteException {
4011 Parcel data = Parcel.obtain();
4012 Parcel reply = Parcel.obtain();
4013 data.writeInterfaceToken(IActivityManager.descriptor);
4014 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4015 reply.readException();
4016 reply.recycle();
4017 data.recycle();
4018 }
4019
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004020 public void killApplicationWithAppId(String pkg, int appid, String reason)
4021 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004022 Parcel data = Parcel.obtain();
4023 Parcel reply = Parcel.obtain();
4024 data.writeInterfaceToken(IActivityManager.descriptor);
4025 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004026 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004027 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004028 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004029 reply.readException();
4030 data.recycle();
4031 reply.recycle();
4032 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004033
4034 public void closeSystemDialogs(String reason) throws RemoteException {
4035 Parcel data = Parcel.obtain();
4036 Parcel reply = Parcel.obtain();
4037 data.writeInterfaceToken(IActivityManager.descriptor);
4038 data.writeString(reason);
4039 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4040 reply.readException();
4041 data.recycle();
4042 reply.recycle();
4043 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004044
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004045 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004046 throws RemoteException {
4047 Parcel data = Parcel.obtain();
4048 Parcel reply = Parcel.obtain();
4049 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004050 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004051 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4052 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004053 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004054 data.recycle();
4055 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004056 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004057 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004058
4059 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4060 Parcel data = Parcel.obtain();
4061 Parcel reply = Parcel.obtain();
4062 data.writeInterfaceToken(IActivityManager.descriptor);
4063 data.writeString(processName);
4064 data.writeInt(uid);
4065 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4066 reply.readException();
4067 data.recycle();
4068 reply.recycle();
4069 }
4070
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004071 public void overridePendingTransition(IBinder token, String packageName,
4072 int enterAnim, int exitAnim) throws RemoteException {
4073 Parcel data = Parcel.obtain();
4074 Parcel reply = Parcel.obtain();
4075 data.writeInterfaceToken(IActivityManager.descriptor);
4076 data.writeStrongBinder(token);
4077 data.writeString(packageName);
4078 data.writeInt(enterAnim);
4079 data.writeInt(exitAnim);
4080 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4081 reply.readException();
4082 data.recycle();
4083 reply.recycle();
4084 }
4085
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004086 public boolean isUserAMonkey() throws RemoteException {
4087 Parcel data = Parcel.obtain();
4088 Parcel reply = Parcel.obtain();
4089 data.writeInterfaceToken(IActivityManager.descriptor);
4090 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4091 reply.readException();
4092 boolean res = reply.readInt() != 0;
4093 data.recycle();
4094 reply.recycle();
4095 return res;
4096 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004097
4098 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4099 Parcel data = Parcel.obtain();
4100 Parcel reply = Parcel.obtain();
4101 data.writeInterfaceToken(IActivityManager.descriptor);
4102 data.writeInt(monkey ? 1 : 0);
4103 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4104 reply.readException();
4105 data.recycle();
4106 reply.recycle();
4107 }
4108
Dianne Hackborn860755f2010-06-03 18:47:52 -07004109 public void finishHeavyWeightApp() throws RemoteException {
4110 Parcel data = Parcel.obtain();
4111 Parcel reply = Parcel.obtain();
4112 data.writeInterfaceToken(IActivityManager.descriptor);
4113 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4114 reply.readException();
4115 data.recycle();
4116 reply.recycle();
4117 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004118
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004119 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004120 throws RemoteException {
4121 Parcel data = Parcel.obtain();
4122 Parcel reply = Parcel.obtain();
4123 data.writeInterfaceToken(IActivityManager.descriptor);
4124 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004125 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4126 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004127 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004128 data.recycle();
4129 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004130 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004131 }
4132
Craig Mautner233ceee2014-05-09 17:05:11 -07004133 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004134 throws RemoteException {
4135 Parcel data = Parcel.obtain();
4136 Parcel reply = Parcel.obtain();
4137 data.writeInterfaceToken(IActivityManager.descriptor);
4138 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004139 if (options == null) {
4140 data.writeInt(0);
4141 } else {
4142 data.writeInt(1);
4143 data.writeBundle(options.toBundle());
4144 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004145 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004146 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004147 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004148 data.recycle();
4149 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004150 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004151 }
4152
Craig Mautner233ceee2014-05-09 17:05:11 -07004153 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4154 Parcel data = Parcel.obtain();
4155 Parcel reply = Parcel.obtain();
4156 data.writeInterfaceToken(IActivityManager.descriptor);
4157 data.writeStrongBinder(token);
4158 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4159 reply.readException();
4160 Bundle bundle = reply.readBundle();
4161 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4162 data.recycle();
4163 reply.recycle();
4164 return options;
4165 }
4166
Daniel Sandler69a48172010-06-23 16:29:36 -04004167 public void setImmersive(IBinder token, boolean immersive)
4168 throws RemoteException {
4169 Parcel data = Parcel.obtain();
4170 Parcel reply = Parcel.obtain();
4171 data.writeInterfaceToken(IActivityManager.descriptor);
4172 data.writeStrongBinder(token);
4173 data.writeInt(immersive ? 1 : 0);
4174 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4175 reply.readException();
4176 data.recycle();
4177 reply.recycle();
4178 }
4179
4180 public boolean isImmersive(IBinder token)
4181 throws RemoteException {
4182 Parcel data = Parcel.obtain();
4183 Parcel reply = Parcel.obtain();
4184 data.writeInterfaceToken(IActivityManager.descriptor);
4185 data.writeStrongBinder(token);
4186 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004187 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004188 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004189 data.recycle();
4190 reply.recycle();
4191 return res;
4192 }
4193
Craig Mautnerd61dc202014-07-07 11:09:11 -07004194 public boolean isTopOfTask(IBinder token) throws RemoteException {
4195 Parcel data = Parcel.obtain();
4196 Parcel reply = Parcel.obtain();
4197 data.writeInterfaceToken(IActivityManager.descriptor);
4198 data.writeStrongBinder(token);
4199 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4200 reply.readException();
4201 boolean res = reply.readInt() == 1;
4202 data.recycle();
4203 reply.recycle();
4204 return res;
4205 }
4206
Daniel Sandler69a48172010-06-23 16:29:36 -04004207 public boolean isTopActivityImmersive()
4208 throws RemoteException {
4209 Parcel data = Parcel.obtain();
4210 Parcel reply = Parcel.obtain();
4211 data.writeInterfaceToken(IActivityManager.descriptor);
4212 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004213 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004214 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004215 data.recycle();
4216 reply.recycle();
4217 return res;
4218 }
4219
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004220 public void crashApplication(int uid, int initialPid, String packageName,
4221 String message) throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 data.writeInt(uid);
4226 data.writeInt(initialPid);
4227 data.writeString(packageName);
4228 data.writeString(message);
4229 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4230 reply.readException();
4231 data.recycle();
4232 reply.recycle();
4233 }
Andy McFadden824c5102010-07-09 16:26:57 -07004234
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004235 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004240 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004241 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4242 reply.readException();
4243 String res = reply.readString();
4244 data.recycle();
4245 reply.recycle();
4246 return res;
4247 }
4248
Dianne Hackborn7e269642010-08-25 19:50:20 -07004249 public IBinder newUriPermissionOwner(String name)
4250 throws RemoteException {
4251 Parcel data = Parcel.obtain();
4252 Parcel reply = Parcel.obtain();
4253 data.writeInterfaceToken(IActivityManager.descriptor);
4254 data.writeString(name);
4255 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4256 reply.readException();
4257 IBinder res = reply.readStrongBinder();
4258 data.recycle();
4259 reply.recycle();
4260 return res;
4261 }
4262
4263 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004264 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004265 Parcel data = Parcel.obtain();
4266 Parcel reply = Parcel.obtain();
4267 data.writeInterfaceToken(IActivityManager.descriptor);
4268 data.writeStrongBinder(owner);
4269 data.writeInt(fromUid);
4270 data.writeString(targetPkg);
4271 uri.writeToParcel(data, 0);
4272 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004273 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004274 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4275 reply.readException();
4276 data.recycle();
4277 reply.recycle();
4278 }
4279
4280 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004281 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004282 Parcel data = Parcel.obtain();
4283 Parcel reply = Parcel.obtain();
4284 data.writeInterfaceToken(IActivityManager.descriptor);
4285 data.writeStrongBinder(owner);
4286 if (uri != null) {
4287 data.writeInt(1);
4288 uri.writeToParcel(data, 0);
4289 } else {
4290 data.writeInt(0);
4291 }
4292 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004293 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004294 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4295 reply.readException();
4296 data.recycle();
4297 reply.recycle();
4298 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004299
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004300 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004301 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004302 Parcel data = Parcel.obtain();
4303 Parcel reply = Parcel.obtain();
4304 data.writeInterfaceToken(IActivityManager.descriptor);
4305 data.writeInt(callingUid);
4306 data.writeString(targetPkg);
4307 uri.writeToParcel(data, 0);
4308 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004309 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004310 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4311 reply.readException();
4312 int res = reply.readInt();
4313 data.recycle();
4314 reply.recycle();
4315 return res;
4316 }
4317
Dianne Hackborn1676c852012-09-10 14:52:30 -07004318 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004319 String path, ParcelFileDescriptor fd) throws RemoteException {
4320 Parcel data = Parcel.obtain();
4321 Parcel reply = Parcel.obtain();
4322 data.writeInterfaceToken(IActivityManager.descriptor);
4323 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004324 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004325 data.writeInt(managed ? 1 : 0);
4326 data.writeString(path);
4327 if (fd != null) {
4328 data.writeInt(1);
4329 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4330 } else {
4331 data.writeInt(0);
4332 }
4333 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4334 reply.readException();
4335 boolean res = reply.readInt() != 0;
4336 reply.recycle();
4337 data.recycle();
4338 return res;
4339 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004340
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004341 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004342 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004343 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004344 Parcel data = Parcel.obtain();
4345 Parcel reply = Parcel.obtain();
4346 data.writeInterfaceToken(IActivityManager.descriptor);
4347 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004348 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004349 data.writeTypedArray(intents, 0);
4350 data.writeStringArray(resolvedTypes);
4351 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004352 if (options != null) {
4353 data.writeInt(1);
4354 options.writeToParcel(data, 0);
4355 } else {
4356 data.writeInt(0);
4357 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004358 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004359 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4360 reply.readException();
4361 int result = reply.readInt();
4362 reply.recycle();
4363 data.recycle();
4364 return result;
4365 }
4366
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004367 public int getFrontActivityScreenCompatMode() throws RemoteException {
4368 Parcel data = Parcel.obtain();
4369 Parcel reply = Parcel.obtain();
4370 data.writeInterfaceToken(IActivityManager.descriptor);
4371 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4372 reply.readException();
4373 int mode = reply.readInt();
4374 reply.recycle();
4375 data.recycle();
4376 return mode;
4377 }
4378
4379 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4380 Parcel data = Parcel.obtain();
4381 Parcel reply = Parcel.obtain();
4382 data.writeInterfaceToken(IActivityManager.descriptor);
4383 data.writeInt(mode);
4384 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4385 reply.readException();
4386 reply.recycle();
4387 data.recycle();
4388 }
4389
4390 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4391 Parcel data = Parcel.obtain();
4392 Parcel reply = Parcel.obtain();
4393 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004394 data.writeString(packageName);
4395 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004396 reply.readException();
4397 int mode = reply.readInt();
4398 reply.recycle();
4399 data.recycle();
4400 return mode;
4401 }
4402
4403 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004404 throws RemoteException {
4405 Parcel data = Parcel.obtain();
4406 Parcel reply = Parcel.obtain();
4407 data.writeInterfaceToken(IActivityManager.descriptor);
4408 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004409 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004410 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4411 reply.readException();
4412 reply.recycle();
4413 data.recycle();
4414 }
4415
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004416 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4417 Parcel data = Parcel.obtain();
4418 Parcel reply = Parcel.obtain();
4419 data.writeInterfaceToken(IActivityManager.descriptor);
4420 data.writeString(packageName);
4421 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4422 reply.readException();
4423 boolean ask = reply.readInt() != 0;
4424 reply.recycle();
4425 data.recycle();
4426 return ask;
4427 }
4428
4429 public void setPackageAskScreenCompat(String packageName, boolean ask)
4430 throws RemoteException {
4431 Parcel data = Parcel.obtain();
4432 Parcel reply = Parcel.obtain();
4433 data.writeInterfaceToken(IActivityManager.descriptor);
4434 data.writeString(packageName);
4435 data.writeInt(ask ? 1 : 0);
4436 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4437 reply.readException();
4438 reply.recycle();
4439 data.recycle();
4440 }
4441
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004442 public boolean switchUser(int userid) throws RemoteException {
4443 Parcel data = Parcel.obtain();
4444 Parcel reply = Parcel.obtain();
4445 data.writeInterfaceToken(IActivityManager.descriptor);
4446 data.writeInt(userid);
4447 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4448 reply.readException();
4449 boolean result = reply.readInt() != 0;
4450 reply.recycle();
4451 data.recycle();
4452 return result;
4453 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004454
Kenny Guy08488bf2014-02-21 17:40:37 +00004455 public boolean startUserInBackground(int userid) throws RemoteException {
4456 Parcel data = Parcel.obtain();
4457 Parcel reply = Parcel.obtain();
4458 data.writeInterfaceToken(IActivityManager.descriptor);
4459 data.writeInt(userid);
4460 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4461 reply.readException();
4462 boolean result = reply.readInt() != 0;
4463 reply.recycle();
4464 data.recycle();
4465 return result;
4466 }
4467
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004468 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4469 Parcel data = Parcel.obtain();
4470 Parcel reply = Parcel.obtain();
4471 data.writeInterfaceToken(IActivityManager.descriptor);
4472 data.writeInt(userid);
4473 data.writeStrongInterface(callback);
4474 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4475 reply.readException();
4476 int result = reply.readInt();
4477 reply.recycle();
4478 data.recycle();
4479 return result;
4480 }
4481
Amith Yamasani52f1d752012-03-28 18:19:29 -07004482 public UserInfo getCurrentUser() throws RemoteException {
4483 Parcel data = Parcel.obtain();
4484 Parcel reply = Parcel.obtain();
4485 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004486 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004487 reply.readException();
4488 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4489 reply.recycle();
4490 data.recycle();
4491 return userInfo;
4492 }
4493
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004494 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004495 Parcel data = Parcel.obtain();
4496 Parcel reply = Parcel.obtain();
4497 data.writeInterfaceToken(IActivityManager.descriptor);
4498 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004499 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004500 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4501 reply.readException();
4502 boolean result = reply.readInt() != 0;
4503 reply.recycle();
4504 data.recycle();
4505 return result;
4506 }
4507
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004508 public int[] getRunningUserIds() throws RemoteException {
4509 Parcel data = Parcel.obtain();
4510 Parcel reply = Parcel.obtain();
4511 data.writeInterfaceToken(IActivityManager.descriptor);
4512 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4513 reply.readException();
4514 int[] result = reply.createIntArray();
4515 reply.recycle();
4516 data.recycle();
4517 return result;
4518 }
4519
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004520 public boolean removeTask(int taskId, int flags) throws RemoteException {
4521 Parcel data = Parcel.obtain();
4522 Parcel reply = Parcel.obtain();
4523 data.writeInterfaceToken(IActivityManager.descriptor);
4524 data.writeInt(taskId);
4525 data.writeInt(flags);
4526 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4527 reply.readException();
4528 boolean result = reply.readInt() != 0;
4529 reply.recycle();
4530 data.recycle();
4531 return result;
4532 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004533
Jeff Sharkeya4620792011-05-20 15:29:23 -07004534 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4535 Parcel data = Parcel.obtain();
4536 Parcel reply = Parcel.obtain();
4537 data.writeInterfaceToken(IActivityManager.descriptor);
4538 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4539 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4540 reply.readException();
4541 data.recycle();
4542 reply.recycle();
4543 }
4544
4545 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4546 Parcel data = Parcel.obtain();
4547 Parcel reply = Parcel.obtain();
4548 data.writeInterfaceToken(IActivityManager.descriptor);
4549 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4550 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4551 reply.readException();
4552 data.recycle();
4553 reply.recycle();
4554 }
4555
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004556 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4557 Parcel data = Parcel.obtain();
4558 Parcel reply = Parcel.obtain();
4559 data.writeInterfaceToken(IActivityManager.descriptor);
4560 data.writeStrongBinder(sender.asBinder());
4561 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4562 reply.readException();
4563 boolean res = reply.readInt() != 0;
4564 data.recycle();
4565 reply.recycle();
4566 return res;
4567 }
4568
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004569 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4570 Parcel data = Parcel.obtain();
4571 Parcel reply = Parcel.obtain();
4572 data.writeInterfaceToken(IActivityManager.descriptor);
4573 data.writeStrongBinder(sender.asBinder());
4574 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4575 reply.readException();
4576 boolean res = reply.readInt() != 0;
4577 data.recycle();
4578 reply.recycle();
4579 return res;
4580 }
4581
Dianne Hackborn81038902012-11-26 17:04:09 -08004582 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4583 Parcel data = Parcel.obtain();
4584 Parcel reply = Parcel.obtain();
4585 data.writeInterfaceToken(IActivityManager.descriptor);
4586 data.writeStrongBinder(sender.asBinder());
4587 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4588 reply.readException();
4589 Intent res = reply.readInt() != 0
4590 ? Intent.CREATOR.createFromParcel(reply) : null;
4591 data.recycle();
4592 reply.recycle();
4593 return res;
4594 }
4595
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004596 public String getTagForIntentSender(IIntentSender sender, String prefix)
4597 throws RemoteException {
4598 Parcel data = Parcel.obtain();
4599 Parcel reply = Parcel.obtain();
4600 data.writeInterfaceToken(IActivityManager.descriptor);
4601 data.writeStrongBinder(sender.asBinder());
4602 data.writeString(prefix);
4603 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4604 reply.readException();
4605 String res = reply.readString();
4606 data.recycle();
4607 reply.recycle();
4608 return res;
4609 }
4610
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004611 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4612 {
4613 Parcel data = Parcel.obtain();
4614 Parcel reply = Parcel.obtain();
4615 data.writeInterfaceToken(IActivityManager.descriptor);
4616 values.writeToParcel(data, 0);
4617 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4618 reply.readException();
4619 data.recycle();
4620 reply.recycle();
4621 }
4622
Dianne Hackbornb437e092011-08-05 17:50:29 -07004623 public long[] getProcessPss(int[] pids) throws RemoteException {
4624 Parcel data = Parcel.obtain();
4625 Parcel reply = Parcel.obtain();
4626 data.writeInterfaceToken(IActivityManager.descriptor);
4627 data.writeIntArray(pids);
4628 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4629 reply.readException();
4630 long[] res = reply.createLongArray();
4631 data.recycle();
4632 reply.recycle();
4633 return res;
4634 }
4635
Dianne Hackborn661cd522011-08-22 00:26:20 -07004636 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4637 Parcel data = Parcel.obtain();
4638 Parcel reply = Parcel.obtain();
4639 data.writeInterfaceToken(IActivityManager.descriptor);
4640 TextUtils.writeToParcel(msg, data, 0);
4641 data.writeInt(always ? 1 : 0);
4642 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4643 reply.readException();
4644 data.recycle();
4645 reply.recycle();
4646 }
4647
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004648 public void dismissKeyguardOnNextActivity() throws RemoteException {
4649 Parcel data = Parcel.obtain();
4650 Parcel reply = Parcel.obtain();
4651 data.writeInterfaceToken(IActivityManager.descriptor);
4652 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4653 reply.readException();
4654 data.recycle();
4655 reply.recycle();
4656 }
4657
Adam Powelldd8fab22012-03-22 17:47:27 -07004658 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4659 throws RemoteException {
4660 Parcel data = Parcel.obtain();
4661 Parcel reply = Parcel.obtain();
4662 data.writeInterfaceToken(IActivityManager.descriptor);
4663 data.writeStrongBinder(token);
4664 data.writeString(destAffinity);
4665 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 boolean result = reply.readInt() != 0;
4668 data.recycle();
4669 reply.recycle();
4670 return result;
4671 }
4672
4673 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4674 throws RemoteException {
4675 Parcel data = Parcel.obtain();
4676 Parcel reply = Parcel.obtain();
4677 data.writeInterfaceToken(IActivityManager.descriptor);
4678 data.writeStrongBinder(token);
4679 target.writeToParcel(data, 0);
4680 data.writeInt(resultCode);
4681 if (resultData != null) {
4682 data.writeInt(1);
4683 resultData.writeToParcel(data, 0);
4684 } else {
4685 data.writeInt(0);
4686 }
4687 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4688 reply.readException();
4689 boolean result = reply.readInt() != 0;
4690 data.recycle();
4691 reply.recycle();
4692 return result;
4693 }
4694
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004695 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4696 Parcel data = Parcel.obtain();
4697 Parcel reply = Parcel.obtain();
4698 data.writeInterfaceToken(IActivityManager.descriptor);
4699 data.writeStrongBinder(activityToken);
4700 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4701 reply.readException();
4702 int result = reply.readInt();
4703 data.recycle();
4704 reply.recycle();
4705 return result;
4706 }
4707
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004708 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4709 Parcel data = Parcel.obtain();
4710 Parcel reply = Parcel.obtain();
4711 data.writeInterfaceToken(IActivityManager.descriptor);
4712 data.writeStrongBinder(activityToken);
4713 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4714 reply.readException();
4715 String result = reply.readString();
4716 data.recycle();
4717 reply.recycle();
4718 return result;
4719 }
4720
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004721 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4722 Parcel data = Parcel.obtain();
4723 Parcel reply = Parcel.obtain();
4724 data.writeInterfaceToken(IActivityManager.descriptor);
4725 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4726 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4727 reply.readException();
4728 data.recycle();
4729 reply.recycle();
4730 }
4731
4732 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4733 Parcel data = Parcel.obtain();
4734 Parcel reply = Parcel.obtain();
4735 data.writeInterfaceToken(IActivityManager.descriptor);
4736 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4737 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4738 reply.readException();
4739 data.recycle();
4740 reply.recycle();
4741 }
4742
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004743 public void requestBugReport() throws RemoteException {
4744 Parcel data = Parcel.obtain();
4745 Parcel reply = Parcel.obtain();
4746 data.writeInterfaceToken(IActivityManager.descriptor);
4747 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4748 reply.readException();
4749 data.recycle();
4750 reply.recycle();
4751 }
4752
Jeff Brownbd181bb2013-09-10 16:44:24 -07004753 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4754 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004755 Parcel data = Parcel.obtain();
4756 Parcel reply = Parcel.obtain();
4757 data.writeInterfaceToken(IActivityManager.descriptor);
4758 data.writeInt(pid);
4759 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004760 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004761 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4762 reply.readException();
4763 long res = reply.readInt();
4764 data.recycle();
4765 reply.recycle();
4766 return res;
4767 }
4768
Adam Skorydfc7fd72013-08-05 19:23:41 -07004769 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004770 Parcel data = Parcel.obtain();
4771 Parcel reply = Parcel.obtain();
4772 data.writeInterfaceToken(IActivityManager.descriptor);
4773 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004774 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004775 reply.readException();
4776 Bundle res = reply.readBundle();
4777 data.recycle();
4778 reply.recycle();
4779 return res;
4780 }
4781
Adam Skory7140a252013-09-11 12:04:58 +01004782 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004783 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004784 Parcel data = Parcel.obtain();
4785 Parcel reply = Parcel.obtain();
4786 data.writeInterfaceToken(IActivityManager.descriptor);
4787 data.writeStrongBinder(token);
4788 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004789 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004790 reply.readException();
4791 data.recycle();
4792 reply.recycle();
4793 }
4794
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004795 public void killUid(int uid, String reason) throws RemoteException {
4796 Parcel data = Parcel.obtain();
4797 Parcel reply = Parcel.obtain();
4798 data.writeInterfaceToken(IActivityManager.descriptor);
4799 data.writeInt(uid);
4800 data.writeString(reason);
4801 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4802 reply.readException();
4803 data.recycle();
4804 reply.recycle();
4805 }
4806
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004807 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4808 Parcel data = Parcel.obtain();
4809 Parcel reply = Parcel.obtain();
4810 data.writeInterfaceToken(IActivityManager.descriptor);
4811 data.writeStrongBinder(who);
4812 data.writeInt(allowRestart ? 1 : 0);
4813 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 data.recycle();
4816 reply.recycle();
4817 }
4818
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004819 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4820 Parcel data = Parcel.obtain();
4821 Parcel reply = Parcel.obtain();
4822 data.writeInterfaceToken(IActivityManager.descriptor);
4823 data.writeStrongBinder(token);
4824 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4825 reply.readException();
4826 data.recycle();
4827 reply.recycle();
4828 }
4829
Craig Mautner5eda9b32013-07-02 11:58:16 -07004830 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4831 Parcel data = Parcel.obtain();
4832 Parcel reply = Parcel.obtain();
4833 data.writeInterfaceToken(IActivityManager.descriptor);
4834 data.writeStrongBinder(token);
4835 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4836 reply.readException();
4837 data.recycle();
4838 reply.recycle();
4839 }
4840
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004841 public void restart() throws RemoteException {
4842 Parcel data = Parcel.obtain();
4843 Parcel reply = Parcel.obtain();
4844 data.writeInterfaceToken(IActivityManager.descriptor);
4845 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4846 reply.readException();
4847 data.recycle();
4848 reply.recycle();
4849 }
4850
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004851 public void performIdleMaintenance() throws RemoteException {
4852 Parcel data = Parcel.obtain();
4853 Parcel reply = Parcel.obtain();
4854 data.writeInterfaceToken(IActivityManager.descriptor);
4855 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4856 reply.readException();
4857 data.recycle();
4858 reply.recycle();
4859 }
4860
Craig Mautner4a1cb222013-12-04 16:14:06 -08004861 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4862 IActivityContainerCallback callback) throws RemoteException {
4863 Parcel data = Parcel.obtain();
4864 Parcel reply = Parcel.obtain();
4865 data.writeInterfaceToken(IActivityManager.descriptor);
4866 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004867 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004868 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4869 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004870 final int result = reply.readInt();
4871 final IActivityContainer res;
4872 if (result == 1) {
4873 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4874 } else {
4875 res = null;
4876 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004877 data.recycle();
4878 reply.recycle();
4879 return res;
4880 }
4881
Craig Mautner95da1082014-02-24 17:54:35 -08004882 public void deleteActivityContainer(IActivityContainer activityContainer)
4883 throws RemoteException {
4884 Parcel data = Parcel.obtain();
4885 Parcel reply = Parcel.obtain();
4886 data.writeInterfaceToken(IActivityManager.descriptor);
4887 data.writeStrongBinder(activityContainer.asBinder());
4888 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4889 reply.readException();
4890 data.recycle();
4891 reply.recycle();
4892 }
4893
Craig Mautnere0a38842013-12-16 16:14:02 -08004894 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4895 throws RemoteException {
4896 Parcel data = Parcel.obtain();
4897 Parcel reply = Parcel.obtain();
4898 data.writeInterfaceToken(IActivityManager.descriptor);
4899 data.writeStrongBinder(activityToken);
4900 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4901 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004902 final int result = reply.readInt();
4903 final IActivityContainer res;
4904 if (result == 1) {
4905 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4906 } else {
4907 res = null;
4908 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004909 data.recycle();
4910 reply.recycle();
4911 return res;
4912 }
4913
Craig Mautner4a1cb222013-12-04 16:14:06 -08004914 public IBinder getHomeActivityToken() throws RemoteException {
4915 Parcel data = Parcel.obtain();
4916 Parcel reply = Parcel.obtain();
4917 data.writeInterfaceToken(IActivityManager.descriptor);
4918 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4919 reply.readException();
4920 IBinder res = reply.readStrongBinder();
4921 data.recycle();
4922 reply.recycle();
4923 return res;
4924 }
4925
Craig Mautneraea74a52014-03-08 14:23:10 -08004926 @Override
4927 public void startLockTaskMode(int taskId) throws RemoteException {
4928 Parcel data = Parcel.obtain();
4929 Parcel reply = Parcel.obtain();
4930 data.writeInterfaceToken(IActivityManager.descriptor);
4931 data.writeInt(taskId);
4932 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4933 reply.readException();
4934 data.recycle();
4935 reply.recycle();
4936 }
4937
4938 @Override
4939 public void startLockTaskMode(IBinder token) throws RemoteException {
4940 Parcel data = Parcel.obtain();
4941 Parcel reply = Parcel.obtain();
4942 data.writeInterfaceToken(IActivityManager.descriptor);
4943 data.writeStrongBinder(token);
4944 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4945 reply.readException();
4946 data.recycle();
4947 reply.recycle();
4948 }
4949
4950 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004951 public void startLockTaskModeOnCurrent() throws RemoteException {
4952 Parcel data = Parcel.obtain();
4953 Parcel reply = Parcel.obtain();
4954 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07004955 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04004956 reply.readException();
4957 data.recycle();
4958 reply.recycle();
4959 }
4960
4961 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004962 public void stopLockTaskMode() throws RemoteException {
4963 Parcel data = Parcel.obtain();
4964 Parcel reply = Parcel.obtain();
4965 data.writeInterfaceToken(IActivityManager.descriptor);
4966 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 data.recycle();
4969 reply.recycle();
4970 }
4971
4972 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004973 public void stopLockTaskModeOnCurrent() throws RemoteException {
4974 Parcel data = Parcel.obtain();
4975 Parcel reply = Parcel.obtain();
4976 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07004977 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04004978 reply.readException();
4979 data.recycle();
4980 reply.recycle();
4981 }
4982
4983 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004984 public boolean isInLockTaskMode() throws RemoteException {
4985 Parcel data = Parcel.obtain();
4986 Parcel reply = Parcel.obtain();
4987 data.writeInterfaceToken(IActivityManager.descriptor);
4988 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4989 reply.readException();
4990 boolean isInLockTaskMode = reply.readInt() == 1;
4991 data.recycle();
4992 reply.recycle();
4993 return isInLockTaskMode;
4994 }
4995
Craig Mautner688b5102014-03-27 16:55:03 -07004996 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07004997 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07004998 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07004999 Parcel data = Parcel.obtain();
5000 Parcel reply = Parcel.obtain();
5001 data.writeInterfaceToken(IActivityManager.descriptor);
5002 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005003 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005004 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005005 reply.readException();
5006 data.recycle();
5007 reply.recycle();
5008 }
5009
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005010 private IBinder mRemote;
5011}