blob: 1b2b08f1205b9c7f2045eaf067ebf16622cd7a0b [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 Mautner5eda9b32013-07-02 11:58:16 -07001549 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001550 data.enforceInterface(IActivityManager.descriptor);
1551 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001552 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001553 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001554 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001555 return true;
1556 }
1557
1558 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1559 data.enforceInterface(IActivityManager.descriptor);
1560 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001561 final Bundle bundle;
1562 if (data.readInt() == 0) {
1563 bundle = null;
1564 } else {
1565 bundle = data.readBundle();
1566 }
1567 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1568 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001569 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001570 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001571 return true;
1572 }
1573
Craig Mautner233ceee2014-05-09 17:05:11 -07001574 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1575 data.enforceInterface(IActivityManager.descriptor);
1576 IBinder token = data.readStrongBinder();
1577 final ActivityOptions options = getActivityOptions(token);
1578 reply.writeNoException();
1579 reply.writeBundle(options == null ? null : options.toBundle());
1580 return true;
1581 }
1582
Daniel Sandler69a48172010-06-23 16:29:36 -04001583 case SET_IMMERSIVE_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 IBinder token = data.readStrongBinder();
1586 boolean imm = data.readInt() == 1;
1587 setImmersive(token, imm);
1588 reply.writeNoException();
1589 return true;
1590 }
1591
1592 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001594 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001595 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001596 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001597 return true;
1598 }
1599
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001600 case CRASH_APPLICATION_TRANSACTION: {
1601 data.enforceInterface(IActivityManager.descriptor);
1602 int uid = data.readInt();
1603 int initialPid = data.readInt();
1604 String packageName = data.readString();
1605 String message = data.readString();
1606 crashApplication(uid, initialPid, packageName, message);
1607 reply.writeNoException();
1608 return true;
1609 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001610
1611 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1612 data.enforceInterface(IActivityManager.descriptor);
1613 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001614 int userId = data.readInt();
1615 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001616 reply.writeNoException();
1617 reply.writeString(type);
1618 return true;
1619 }
1620
Dianne Hackborn7e269642010-08-25 19:50:20 -07001621 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1622 data.enforceInterface(IActivityManager.descriptor);
1623 String name = data.readString();
1624 IBinder perm = newUriPermissionOwner(name);
1625 reply.writeNoException();
1626 reply.writeStrongBinder(perm);
1627 return true;
1628 }
1629
1630 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 IBinder owner = data.readStrongBinder();
1633 int fromUid = data.readInt();
1634 String targetPkg = data.readString();
1635 Uri uri = Uri.CREATOR.createFromParcel(data);
1636 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001637 int userId = data.readInt();
1638 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001639 reply.writeNoException();
1640 return true;
1641 }
1642
1643 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1644 data.enforceInterface(IActivityManager.descriptor);
1645 IBinder owner = data.readStrongBinder();
1646 Uri uri = null;
1647 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001648 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001649 }
1650 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001651 int userId = data.readInt();
1652 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001653 reply.writeNoException();
1654 return true;
1655 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001656
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001657 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1658 data.enforceInterface(IActivityManager.descriptor);
1659 int callingUid = data.readInt();
1660 String targetPkg = data.readString();
1661 Uri uri = Uri.CREATOR.createFromParcel(data);
1662 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001663 int userId = data.readInt();
1664 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001665 reply.writeNoException();
1666 reply.writeInt(res);
1667 return true;
1668 }
1669
Andy McFadden824c5102010-07-09 16:26:57 -07001670 case DUMP_HEAP_TRANSACTION: {
1671 data.enforceInterface(IActivityManager.descriptor);
1672 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001673 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001674 boolean managed = data.readInt() != 0;
1675 String path = data.readString();
1676 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001677 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001678 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001679 reply.writeNoException();
1680 reply.writeInt(res ? 1 : 0);
1681 return true;
1682 }
1683
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001684 case START_ACTIVITIES_TRANSACTION:
1685 {
1686 data.enforceInterface(IActivityManager.descriptor);
1687 IBinder b = data.readStrongBinder();
1688 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001689 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001690 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1691 String[] resolvedTypes = data.createStringArray();
1692 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001693 Bundle options = data.readInt() != 0
1694 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001695 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001696 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001697 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001698 reply.writeNoException();
1699 reply.writeInt(result);
1700 return true;
1701 }
1702
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001703 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1704 {
1705 data.enforceInterface(IActivityManager.descriptor);
1706 int mode = getFrontActivityScreenCompatMode();
1707 reply.writeNoException();
1708 reply.writeInt(mode);
1709 return true;
1710 }
1711
1712 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1713 {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 int mode = data.readInt();
1716 setFrontActivityScreenCompatMode(mode);
1717 reply.writeNoException();
1718 reply.writeInt(mode);
1719 return true;
1720 }
1721
1722 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1723 {
1724 data.enforceInterface(IActivityManager.descriptor);
1725 String pkg = data.readString();
1726 int mode = getPackageScreenCompatMode(pkg);
1727 reply.writeNoException();
1728 reply.writeInt(mode);
1729 return true;
1730 }
1731
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001732 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1733 {
1734 data.enforceInterface(IActivityManager.descriptor);
1735 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001736 int mode = data.readInt();
1737 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001738 reply.writeNoException();
1739 return true;
1740 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001741
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001742 case SWITCH_USER_TRANSACTION: {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 int userid = data.readInt();
1745 boolean result = switchUser(userid);
1746 reply.writeNoException();
1747 reply.writeInt(result ? 1 : 0);
1748 return true;
1749 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001750
Kenny Guy08488bf2014-02-21 17:40:37 +00001751 case START_USER_IN_BACKGROUND_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 int userid = data.readInt();
1754 boolean result = startUserInBackground(userid);
1755 reply.writeNoException();
1756 reply.writeInt(result ? 1 : 0);
1757 return true;
1758 }
1759
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001760 case STOP_USER_TRANSACTION: {
1761 data.enforceInterface(IActivityManager.descriptor);
1762 int userid = data.readInt();
1763 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1764 data.readStrongBinder());
1765 int result = stopUser(userid, callback);
1766 reply.writeNoException();
1767 reply.writeInt(result);
1768 return true;
1769 }
1770
Amith Yamasani52f1d752012-03-28 18:19:29 -07001771 case GET_CURRENT_USER_TRANSACTION: {
1772 data.enforceInterface(IActivityManager.descriptor);
1773 UserInfo userInfo = getCurrentUser();
1774 reply.writeNoException();
1775 userInfo.writeToParcel(reply, 0);
1776 return true;
1777 }
1778
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001779 case IS_USER_RUNNING_TRANSACTION: {
1780 data.enforceInterface(IActivityManager.descriptor);
1781 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001782 boolean orStopping = data.readInt() != 0;
1783 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001784 reply.writeNoException();
1785 reply.writeInt(result ? 1 : 0);
1786 return true;
1787 }
1788
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001789 case GET_RUNNING_USER_IDS_TRANSACTION: {
1790 data.enforceInterface(IActivityManager.descriptor);
1791 int[] result = getRunningUserIds();
1792 reply.writeNoException();
1793 reply.writeIntArray(result);
1794 return true;
1795 }
1796
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001797 case REMOVE_TASK_TRANSACTION:
1798 {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 int taskId = data.readInt();
1801 int fl = data.readInt();
1802 boolean result = removeTask(taskId, fl);
1803 reply.writeNoException();
1804 reply.writeInt(result ? 1 : 0);
1805 return true;
1806 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001807
Jeff Sharkeya4620792011-05-20 15:29:23 -07001808 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1809 data.enforceInterface(IActivityManager.descriptor);
1810 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1811 data.readStrongBinder());
1812 registerProcessObserver(observer);
1813 return true;
1814 }
1815
1816 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1817 data.enforceInterface(IActivityManager.descriptor);
1818 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1819 data.readStrongBinder());
1820 unregisterProcessObserver(observer);
1821 return true;
1822 }
1823
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001824 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1825 {
1826 data.enforceInterface(IActivityManager.descriptor);
1827 String pkg = data.readString();
1828 boolean ask = getPackageAskScreenCompat(pkg);
1829 reply.writeNoException();
1830 reply.writeInt(ask ? 1 : 0);
1831 return true;
1832 }
1833
1834 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1835 {
1836 data.enforceInterface(IActivityManager.descriptor);
1837 String pkg = data.readString();
1838 boolean ask = data.readInt() != 0;
1839 setPackageAskScreenCompat(pkg, ask);
1840 reply.writeNoException();
1841 return true;
1842 }
1843
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001844 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1845 data.enforceInterface(IActivityManager.descriptor);
1846 IIntentSender r = IIntentSender.Stub.asInterface(
1847 data.readStrongBinder());
1848 boolean res = isIntentSenderTargetedToPackage(r);
1849 reply.writeNoException();
1850 reply.writeInt(res ? 1 : 0);
1851 return true;
1852 }
1853
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001854 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1855 data.enforceInterface(IActivityManager.descriptor);
1856 IIntentSender r = IIntentSender.Stub.asInterface(
1857 data.readStrongBinder());
1858 boolean res = isIntentSenderAnActivity(r);
1859 reply.writeNoException();
1860 reply.writeInt(res ? 1 : 0);
1861 return true;
1862 }
1863
Dianne Hackborn81038902012-11-26 17:04:09 -08001864 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1865 data.enforceInterface(IActivityManager.descriptor);
1866 IIntentSender r = IIntentSender.Stub.asInterface(
1867 data.readStrongBinder());
1868 Intent intent = getIntentForIntentSender(r);
1869 reply.writeNoException();
1870 if (intent != null) {
1871 reply.writeInt(1);
1872 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1873 } else {
1874 reply.writeInt(0);
1875 }
1876 return true;
1877 }
1878
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001879 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1880 data.enforceInterface(IActivityManager.descriptor);
1881 IIntentSender r = IIntentSender.Stub.asInterface(
1882 data.readStrongBinder());
1883 String prefix = data.readString();
1884 String tag = getTagForIntentSender(r, prefix);
1885 reply.writeNoException();
1886 reply.writeString(tag);
1887 return true;
1888 }
1889
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001890 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1891 data.enforceInterface(IActivityManager.descriptor);
1892 Configuration config = Configuration.CREATOR.createFromParcel(data);
1893 updatePersistentConfiguration(config);
1894 reply.writeNoException();
1895 return true;
1896 }
1897
Dianne Hackbornb437e092011-08-05 17:50:29 -07001898 case GET_PROCESS_PSS_TRANSACTION: {
1899 data.enforceInterface(IActivityManager.descriptor);
1900 int[] pids = data.createIntArray();
1901 long[] pss = getProcessPss(pids);
1902 reply.writeNoException();
1903 reply.writeLongArray(pss);
1904 return true;
1905 }
1906
Dianne Hackborn661cd522011-08-22 00:26:20 -07001907 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1910 boolean always = data.readInt() != 0;
1911 showBootMessage(msg, always);
1912 reply.writeNoException();
1913 return true;
1914 }
1915
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001916 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 dismissKeyguardOnNextActivity();
1919 reply.writeNoException();
1920 return true;
1921 }
1922
Adam Powelldd8fab22012-03-22 17:47:27 -07001923 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1924 data.enforceInterface(IActivityManager.descriptor);
1925 IBinder token = data.readStrongBinder();
1926 String destAffinity = data.readString();
1927 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1928 reply.writeNoException();
1929 reply.writeInt(res ? 1 : 0);
1930 return true;
1931 }
1932
1933 case NAVIGATE_UP_TO_TRANSACTION: {
1934 data.enforceInterface(IActivityManager.descriptor);
1935 IBinder token = data.readStrongBinder();
1936 Intent target = Intent.CREATOR.createFromParcel(data);
1937 int resultCode = data.readInt();
1938 Intent resultData = null;
1939 if (data.readInt() != 0) {
1940 resultData = Intent.CREATOR.createFromParcel(data);
1941 }
1942 boolean res = navigateUpTo(token, target, resultCode, resultData);
1943 reply.writeNoException();
1944 reply.writeInt(res ? 1 : 0);
1945 return true;
1946 }
1947
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001948 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1949 data.enforceInterface(IActivityManager.descriptor);
1950 IBinder token = data.readStrongBinder();
1951 int res = getLaunchedFromUid(token);
1952 reply.writeNoException();
1953 reply.writeInt(res);
1954 return true;
1955 }
1956
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001957 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 IBinder token = data.readStrongBinder();
1960 String res = getLaunchedFromPackage(token);
1961 reply.writeNoException();
1962 reply.writeString(res);
1963 return true;
1964 }
1965
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001966 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1969 data.readStrongBinder());
1970 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001971 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001972 return true;
1973 }
1974
1975 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1978 data.readStrongBinder());
1979 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001980 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001981 return true;
1982 }
1983
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001984 case REQUEST_BUG_REPORT_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001987 reply.writeNoException();
1988 return true;
1989 }
1990
1991 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
1992 data.enforceInterface(IActivityManager.descriptor);
1993 int pid = data.readInt();
1994 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07001995 String reason = data.readString();
1996 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001997 reply.writeNoException();
1998 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001999 return true;
2000 }
2001
Adam Skorydfc7fd72013-08-05 19:23:41 -07002002 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002003 data.enforceInterface(IActivityManager.descriptor);
2004 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002005 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002006 reply.writeNoException();
2007 reply.writeBundle(res);
2008 return true;
2009 }
2010
Adam Skorydfc7fd72013-08-05 19:23:41 -07002011 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002012 data.enforceInterface(IActivityManager.descriptor);
2013 IBinder token = data.readStrongBinder();
2014 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002015 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002016 reply.writeNoException();
2017 return true;
2018 }
2019
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002020 case KILL_UID_TRANSACTION: {
2021 data.enforceInterface(IActivityManager.descriptor);
2022 int uid = data.readInt();
2023 String reason = data.readString();
2024 killUid(uid, reason);
2025 reply.writeNoException();
2026 return true;
2027 }
2028
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002029 case HANG_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 IBinder who = data.readStrongBinder();
2032 boolean allowRestart = data.readInt() != 0;
2033 hang(who, allowRestart);
2034 reply.writeNoException();
2035 return true;
2036 }
2037
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002038 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IBinder token = data.readStrongBinder();
2041 reportActivityFullyDrawn(token);
2042 reply.writeNoException();
2043 return true;
2044 }
2045
Craig Mautner5eda9b32013-07-02 11:58:16 -07002046 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2047 data.enforceInterface(IActivityManager.descriptor);
2048 IBinder token = data.readStrongBinder();
2049 notifyActivityDrawn(token);
2050 reply.writeNoException();
2051 return true;
2052 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002053
2054 case RESTART_TRANSACTION: {
2055 data.enforceInterface(IActivityManager.descriptor);
2056 restart();
2057 reply.writeNoException();
2058 return true;
2059 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002060
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002061 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2062 data.enforceInterface(IActivityManager.descriptor);
2063 performIdleMaintenance();
2064 reply.writeNoException();
2065 return true;
2066 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002067
2068 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2069 data.enforceInterface(IActivityManager.descriptor);
2070 IBinder parentActivityToken = data.readStrongBinder();
2071 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002072 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002073 IActivityContainer activityContainer =
2074 createActivityContainer(parentActivityToken, callback);
2075 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002076 if (activityContainer != null) {
2077 reply.writeInt(1);
2078 reply.writeStrongBinder(activityContainer.asBinder());
2079 } else {
2080 reply.writeInt(0);
2081 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002082 return true;
2083 }
2084
Craig Mautner95da1082014-02-24 17:54:35 -08002085 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2086 data.enforceInterface(IActivityManager.descriptor);
2087 IActivityContainer activityContainer =
2088 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2089 deleteActivityContainer(activityContainer);
2090 reply.writeNoException();
2091 return true;
2092 }
2093
Craig Mautnere0a38842013-12-16 16:14:02 -08002094 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2095 data.enforceInterface(IActivityManager.descriptor);
2096 IBinder activityToken = data.readStrongBinder();
2097 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2098 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002099 if (activityContainer != null) {
2100 reply.writeInt(1);
2101 reply.writeStrongBinder(activityContainer.asBinder());
2102 } else {
2103 reply.writeInt(0);
2104 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002105 return true;
2106 }
2107
Craig Mautner4a1cb222013-12-04 16:14:06 -08002108 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2109 data.enforceInterface(IActivityManager.descriptor);
2110 IBinder homeActivityToken = getHomeActivityToken();
2111 reply.writeNoException();
2112 reply.writeStrongBinder(homeActivityToken);
2113 return true;
2114 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002115
2116 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2117 data.enforceInterface(IActivityManager.descriptor);
2118 final int taskId = data.readInt();
2119 startLockTaskMode(taskId);
2120 reply.writeNoException();
2121 return true;
2122 }
2123
2124 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2125 data.enforceInterface(IActivityManager.descriptor);
2126 IBinder token = data.readStrongBinder();
2127 startLockTaskMode(token);
2128 reply.writeNoException();
2129 return true;
2130 }
2131
Jason Monk62515be2014-05-21 16:06:19 -04002132 case START_LOCK_TASK_BY_CURRENT: {
2133 data.enforceInterface(IActivityManager.descriptor);
2134 startLockTaskModeOnCurrent();
2135 reply.writeNoException();
2136 return true;
2137 }
2138
Craig Mautneraea74a52014-03-08 14:23:10 -08002139 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2140 data.enforceInterface(IActivityManager.descriptor);
2141 stopLockTaskMode();
2142 reply.writeNoException();
2143 return true;
2144 }
2145
Jason Monk62515be2014-05-21 16:06:19 -04002146 case STOP_LOCK_TASK_BY_CURRENT: {
2147 data.enforceInterface(IActivityManager.descriptor);
2148 stopLockTaskModeOnCurrent();
2149 reply.writeNoException();
2150 return true;
2151 }
2152
Craig Mautneraea74a52014-03-08 14:23:10 -08002153 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2154 data.enforceInterface(IActivityManager.descriptor);
2155 final boolean isInLockTaskMode = isInLockTaskMode();
2156 reply.writeNoException();
2157 reply.writeInt(isInLockTaskMode ? 1 : 0);
2158 return true;
2159 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002160
Winson Chunga449dc02014-05-16 11:15:04 -07002161 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002162 data.enforceInterface(IActivityManager.descriptor);
2163 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002164 ActivityManager.TaskDescription values =
2165 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2166 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002167 reply.writeNoException();
2168 return true;
2169 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002170 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002171
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002172 return super.onTransact(code, data, reply, flags);
2173 }
2174
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002175 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002176 return this;
2177 }
2178
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002179 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2180 protected IActivityManager create() {
2181 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002182 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002183 Log.v("ActivityManager", "default service binder = " + b);
2184 }
2185 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002186 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002187 Log.v("ActivityManager", "default service = " + am);
2188 }
2189 return am;
2190 }
2191 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002192}
2193
2194class ActivityManagerProxy implements IActivityManager
2195{
2196 public ActivityManagerProxy(IBinder remote)
2197 {
2198 mRemote = remote;
2199 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201 public IBinder asBinder()
2202 {
2203 return mRemote;
2204 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002205
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002206 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002207 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2208 int startFlags, String profileFile,
2209 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002210 Parcel data = Parcel.obtain();
2211 Parcel reply = Parcel.obtain();
2212 data.writeInterfaceToken(IActivityManager.descriptor);
2213 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002214 data.writeString(callingPackage);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002215 intent.writeToParcel(data, 0);
2216 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002217 data.writeStrongBinder(resultTo);
2218 data.writeString(resultWho);
2219 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002220 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002221 data.writeString(profileFile);
2222 if (profileFd != null) {
2223 data.writeInt(1);
2224 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2225 } else {
2226 data.writeInt(0);
2227 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002228 if (options != null) {
2229 data.writeInt(1);
2230 options.writeToParcel(data, 0);
2231 } else {
2232 data.writeInt(0);
2233 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002234 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2235 reply.readException();
2236 int result = reply.readInt();
2237 reply.recycle();
2238 data.recycle();
2239 return result;
2240 }
Amith Yamasani82644082012-08-03 13:09:11 -07002241
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002242 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002243 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2244 int startFlags, String profileFile,
2245 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2246 Parcel data = Parcel.obtain();
2247 Parcel reply = Parcel.obtain();
2248 data.writeInterfaceToken(IActivityManager.descriptor);
2249 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002250 data.writeString(callingPackage);
Amith Yamasani82644082012-08-03 13:09:11 -07002251 intent.writeToParcel(data, 0);
2252 data.writeString(resolvedType);
2253 data.writeStrongBinder(resultTo);
2254 data.writeString(resultWho);
2255 data.writeInt(requestCode);
2256 data.writeInt(startFlags);
2257 data.writeString(profileFile);
2258 if (profileFd != null) {
2259 data.writeInt(1);
2260 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2261 } else {
2262 data.writeInt(0);
2263 }
2264 if (options != null) {
2265 data.writeInt(1);
2266 options.writeToParcel(data, 0);
2267 } else {
2268 data.writeInt(0);
2269 }
2270 data.writeInt(userId);
2271 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2272 reply.readException();
2273 int result = reply.readInt();
2274 reply.recycle();
2275 data.recycle();
2276 return result;
2277 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002278 public WaitResult startActivityAndWait(IApplicationThread caller, String callingPackage,
2279 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002280 int requestCode, int startFlags, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002281 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002282 Parcel data = Parcel.obtain();
2283 Parcel reply = Parcel.obtain();
2284 data.writeInterfaceToken(IActivityManager.descriptor);
2285 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002286 data.writeString(callingPackage);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002287 intent.writeToParcel(data, 0);
2288 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002289 data.writeStrongBinder(resultTo);
2290 data.writeString(resultWho);
2291 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002292 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002293 data.writeString(profileFile);
2294 if (profileFd != null) {
2295 data.writeInt(1);
2296 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2297 } else {
2298 data.writeInt(0);
2299 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002300 if (options != null) {
2301 data.writeInt(1);
2302 options.writeToParcel(data, 0);
2303 } else {
2304 data.writeInt(0);
2305 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002306 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002307 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2308 reply.readException();
2309 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2310 reply.recycle();
2311 data.recycle();
2312 return result;
2313 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002314 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2315 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002316 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002317 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002318 Parcel data = Parcel.obtain();
2319 Parcel reply = Parcel.obtain();
2320 data.writeInterfaceToken(IActivityManager.descriptor);
2321 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002322 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002323 intent.writeToParcel(data, 0);
2324 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002325 data.writeStrongBinder(resultTo);
2326 data.writeString(resultWho);
2327 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002328 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002329 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002330 if (options != null) {
2331 data.writeInt(1);
2332 options.writeToParcel(data, 0);
2333 } else {
2334 data.writeInt(0);
2335 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002336 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002337 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2338 reply.readException();
2339 int result = reply.readInt();
2340 reply.recycle();
2341 data.recycle();
2342 return result;
2343 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002344 public int startActivityIntentSender(IApplicationThread caller,
2345 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002346 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002347 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002348 Parcel data = Parcel.obtain();
2349 Parcel reply = Parcel.obtain();
2350 data.writeInterfaceToken(IActivityManager.descriptor);
2351 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2352 intent.writeToParcel(data, 0);
2353 if (fillInIntent != null) {
2354 data.writeInt(1);
2355 fillInIntent.writeToParcel(data, 0);
2356 } else {
2357 data.writeInt(0);
2358 }
2359 data.writeString(resolvedType);
2360 data.writeStrongBinder(resultTo);
2361 data.writeString(resultWho);
2362 data.writeInt(requestCode);
2363 data.writeInt(flagsMask);
2364 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002365 if (options != null) {
2366 data.writeInt(1);
2367 options.writeToParcel(data, 0);
2368 } else {
2369 data.writeInt(0);
2370 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002371 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002372 reply.readException();
2373 int result = reply.readInt();
2374 reply.recycle();
2375 data.recycle();
2376 return result;
2377 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002378 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2379 Intent intent, String resolvedType, IVoiceInteractionSession session,
2380 IVoiceInteractor interactor, int startFlags, String profileFile,
2381 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2382 Parcel data = Parcel.obtain();
2383 Parcel reply = Parcel.obtain();
2384 data.writeInterfaceToken(IActivityManager.descriptor);
2385 data.writeString(callingPackage);
2386 data.writeInt(callingPid);
2387 data.writeInt(callingUid);
2388 intent.writeToParcel(data, 0);
2389 data.writeString(resolvedType);
2390 data.writeStrongBinder(session.asBinder());
2391 data.writeStrongBinder(interactor.asBinder());
2392 data.writeInt(startFlags);
2393 data.writeString(profileFile);
2394 if (profileFd != null) {
2395 data.writeInt(1);
2396 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2397 } else {
2398 data.writeInt(0);
2399 }
2400 if (options != null) {
2401 data.writeInt(1);
2402 options.writeToParcel(data, 0);
2403 } else {
2404 data.writeInt(0);
2405 }
2406 data.writeInt(userId);
2407 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2408 reply.readException();
2409 int result = reply.readInt();
2410 reply.recycle();
2411 data.recycle();
2412 return result;
2413 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002414 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002415 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 Parcel data = Parcel.obtain();
2417 Parcel reply = Parcel.obtain();
2418 data.writeInterfaceToken(IActivityManager.descriptor);
2419 data.writeStrongBinder(callingActivity);
2420 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002421 if (options != null) {
2422 data.writeInt(1);
2423 options.writeToParcel(data, 0);
2424 } else {
2425 data.writeInt(0);
2426 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002427 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2428 reply.readException();
2429 int result = reply.readInt();
2430 reply.recycle();
2431 data.recycle();
2432 return result != 0;
2433 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002434 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002435 throws RemoteException {
2436 Parcel data = Parcel.obtain();
2437 Parcel reply = Parcel.obtain();
2438 data.writeInterfaceToken(IActivityManager.descriptor);
2439 data.writeStrongBinder(token);
2440 data.writeInt(resultCode);
2441 if (resultData != null) {
2442 data.writeInt(1);
2443 resultData.writeToParcel(data, 0);
2444 } else {
2445 data.writeInt(0);
2446 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002447 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002448 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2449 reply.readException();
2450 boolean res = reply.readInt() != 0;
2451 data.recycle();
2452 reply.recycle();
2453 return res;
2454 }
2455 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2456 {
2457 Parcel data = Parcel.obtain();
2458 Parcel reply = Parcel.obtain();
2459 data.writeInterfaceToken(IActivityManager.descriptor);
2460 data.writeStrongBinder(token);
2461 data.writeString(resultWho);
2462 data.writeInt(requestCode);
2463 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2464 reply.readException();
2465 data.recycle();
2466 reply.recycle();
2467 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002468 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2469 Parcel data = Parcel.obtain();
2470 Parcel reply = Parcel.obtain();
2471 data.writeInterfaceToken(IActivityManager.descriptor);
2472 data.writeStrongBinder(token);
2473 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2474 reply.readException();
2475 boolean res = reply.readInt() != 0;
2476 data.recycle();
2477 reply.recycle();
2478 return res;
2479 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002480 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2481 Parcel data = Parcel.obtain();
2482 Parcel reply = Parcel.obtain();
2483 data.writeInterfaceToken(IActivityManager.descriptor);
2484 data.writeStrongBinder(session.asBinder());
2485 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2486 reply.readException();
2487 data.recycle();
2488 reply.recycle();
2489 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002490 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2491 Parcel data = Parcel.obtain();
2492 Parcel reply = Parcel.obtain();
2493 data.writeInterfaceToken(IActivityManager.descriptor);
2494 data.writeStrongBinder(token);
2495 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2496 reply.readException();
2497 boolean res = reply.readInt() != 0;
2498 data.recycle();
2499 reply.recycle();
2500 return res;
2501 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002502 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002503 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002504 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002505 {
2506 Parcel data = Parcel.obtain();
2507 Parcel reply = Parcel.obtain();
2508 data.writeInterfaceToken(IActivityManager.descriptor);
2509 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002510 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002511 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2512 filter.writeToParcel(data, 0);
2513 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002514 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002515 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2516 reply.readException();
2517 Intent intent = null;
2518 int haveIntent = reply.readInt();
2519 if (haveIntent != 0) {
2520 intent = Intent.CREATOR.createFromParcel(reply);
2521 }
2522 reply.recycle();
2523 data.recycle();
2524 return intent;
2525 }
2526 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2527 {
2528 Parcel data = Parcel.obtain();
2529 Parcel reply = Parcel.obtain();
2530 data.writeInterfaceToken(IActivityManager.descriptor);
2531 data.writeStrongBinder(receiver.asBinder());
2532 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2533 reply.readException();
2534 data.recycle();
2535 reply.recycle();
2536 }
2537 public int broadcastIntent(IApplicationThread caller,
2538 Intent intent, String resolvedType, IIntentReceiver resultTo,
2539 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002540 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002541 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002542 {
2543 Parcel data = Parcel.obtain();
2544 Parcel reply = Parcel.obtain();
2545 data.writeInterfaceToken(IActivityManager.descriptor);
2546 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2547 intent.writeToParcel(data, 0);
2548 data.writeString(resolvedType);
2549 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2550 data.writeInt(resultCode);
2551 data.writeString(resultData);
2552 data.writeBundle(map);
2553 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002554 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002555 data.writeInt(serialized ? 1 : 0);
2556 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002557 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002558 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2559 reply.readException();
2560 int res = reply.readInt();
2561 reply.recycle();
2562 data.recycle();
2563 return res;
2564 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002565 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2566 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002567 {
2568 Parcel data = Parcel.obtain();
2569 Parcel reply = Parcel.obtain();
2570 data.writeInterfaceToken(IActivityManager.descriptor);
2571 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2572 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002573 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002574 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2575 reply.readException();
2576 data.recycle();
2577 reply.recycle();
2578 }
2579 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2580 {
2581 Parcel data = Parcel.obtain();
2582 Parcel reply = Parcel.obtain();
2583 data.writeInterfaceToken(IActivityManager.descriptor);
2584 data.writeStrongBinder(who);
2585 data.writeInt(resultCode);
2586 data.writeString(resultData);
2587 data.writeBundle(map);
2588 data.writeInt(abortBroadcast ? 1 : 0);
2589 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2590 reply.readException();
2591 data.recycle();
2592 reply.recycle();
2593 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 public void attachApplication(IApplicationThread app) throws RemoteException
2595 {
2596 Parcel data = Parcel.obtain();
2597 Parcel reply = Parcel.obtain();
2598 data.writeInterfaceToken(IActivityManager.descriptor);
2599 data.writeStrongBinder(app.asBinder());
2600 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2601 reply.readException();
2602 data.recycle();
2603 reply.recycle();
2604 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002605 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2606 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002607 {
2608 Parcel data = Parcel.obtain();
2609 Parcel reply = Parcel.obtain();
2610 data.writeInterfaceToken(IActivityManager.descriptor);
2611 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002612 if (config != null) {
2613 data.writeInt(1);
2614 config.writeToParcel(data, 0);
2615 } else {
2616 data.writeInt(0);
2617 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002618 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002619 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2620 reply.readException();
2621 data.recycle();
2622 reply.recycle();
2623 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002624 public void activityResumed(IBinder token) throws RemoteException
2625 {
2626 Parcel data = Parcel.obtain();
2627 Parcel reply = Parcel.obtain();
2628 data.writeInterfaceToken(IActivityManager.descriptor);
2629 data.writeStrongBinder(token);
2630 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2631 reply.readException();
2632 data.recycle();
2633 reply.recycle();
2634 }
Craig Mautnera0026042014-04-23 11:45:37 -07002635 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002636 {
2637 Parcel data = Parcel.obtain();
2638 Parcel reply = Parcel.obtain();
2639 data.writeInterfaceToken(IActivityManager.descriptor);
2640 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002641 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002642 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2643 reply.readException();
2644 data.recycle();
2645 reply.recycle();
2646 }
2647 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002648 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002649 {
2650 Parcel data = Parcel.obtain();
2651 Parcel reply = Parcel.obtain();
2652 data.writeInterfaceToken(IActivityManager.descriptor);
2653 data.writeStrongBinder(token);
2654 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002655 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002656 TextUtils.writeToParcel(description, data, 0);
2657 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2658 reply.readException();
2659 data.recycle();
2660 reply.recycle();
2661 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002662 public void activitySlept(IBinder token) throws RemoteException
2663 {
2664 Parcel data = Parcel.obtain();
2665 Parcel reply = Parcel.obtain();
2666 data.writeInterfaceToken(IActivityManager.descriptor);
2667 data.writeStrongBinder(token);
2668 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2669 reply.readException();
2670 data.recycle();
2671 reply.recycle();
2672 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002673 public void activityDestroyed(IBinder token) throws RemoteException
2674 {
2675 Parcel data = Parcel.obtain();
2676 Parcel reply = Parcel.obtain();
2677 data.writeInterfaceToken(IActivityManager.descriptor);
2678 data.writeStrongBinder(token);
2679 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2680 reply.readException();
2681 data.recycle();
2682 reply.recycle();
2683 }
2684 public String getCallingPackage(IBinder token) throws RemoteException
2685 {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 data.writeStrongBinder(token);
2690 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2691 reply.readException();
2692 String res = reply.readString();
2693 data.recycle();
2694 reply.recycle();
2695 return res;
2696 }
2697 public ComponentName getCallingActivity(IBinder token)
2698 throws RemoteException {
2699 Parcel data = Parcel.obtain();
2700 Parcel reply = Parcel.obtain();
2701 data.writeInterfaceToken(IActivityManager.descriptor);
2702 data.writeStrongBinder(token);
2703 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2704 reply.readException();
2705 ComponentName res = ComponentName.readFromParcel(reply);
2706 data.recycle();
2707 reply.recycle();
2708 return res;
2709 }
Winson Chung1147c402014-05-14 11:05:00 -07002710 public List<IAppTask> getAppTasks() throws RemoteException {
2711 Parcel data = Parcel.obtain();
2712 Parcel reply = Parcel.obtain();
2713 data.writeInterfaceToken(IActivityManager.descriptor);
2714 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2715 reply.readException();
2716 ArrayList<IAppTask> list = null;
2717 int N = reply.readInt();
2718 if (N >= 0) {
2719 list = new ArrayList<IAppTask>();
2720 while (N > 0) {
2721 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2722 list.add(task);
2723 N--;
2724 }
2725 }
2726 data.recycle();
2727 reply.recycle();
2728 return list;
2729 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002730 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002731 Parcel data = Parcel.obtain();
2732 Parcel reply = Parcel.obtain();
2733 data.writeInterfaceToken(IActivityManager.descriptor);
2734 data.writeInt(maxNum);
2735 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002736 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2737 reply.readException();
2738 ArrayList list = null;
2739 int N = reply.readInt();
2740 if (N >= 0) {
2741 list = new ArrayList();
2742 while (N > 0) {
2743 ActivityManager.RunningTaskInfo info =
2744 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002745 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 list.add(info);
2747 N--;
2748 }
2749 }
2750 data.recycle();
2751 reply.recycle();
2752 return list;
2753 }
2754 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002755 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002756 Parcel data = Parcel.obtain();
2757 Parcel reply = Parcel.obtain();
2758 data.writeInterfaceToken(IActivityManager.descriptor);
2759 data.writeInt(maxNum);
2760 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002761 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002762 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2763 reply.readException();
2764 ArrayList<ActivityManager.RecentTaskInfo> list
2765 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2766 data.recycle();
2767 reply.recycle();
2768 return list;
2769 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002770 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002771 Parcel data = Parcel.obtain();
2772 Parcel reply = Parcel.obtain();
2773 data.writeInterfaceToken(IActivityManager.descriptor);
2774 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002775 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002776 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002777 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002778 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002779 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002780 }
2781 data.recycle();
2782 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002783 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002784 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002785 public List getServices(int maxNum, int flags) throws RemoteException {
2786 Parcel data = Parcel.obtain();
2787 Parcel reply = Parcel.obtain();
2788 data.writeInterfaceToken(IActivityManager.descriptor);
2789 data.writeInt(maxNum);
2790 data.writeInt(flags);
2791 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2792 reply.readException();
2793 ArrayList list = null;
2794 int N = reply.readInt();
2795 if (N >= 0) {
2796 list = new ArrayList();
2797 while (N > 0) {
2798 ActivityManager.RunningServiceInfo info =
2799 ActivityManager.RunningServiceInfo.CREATOR
2800 .createFromParcel(reply);
2801 list.add(info);
2802 N--;
2803 }
2804 }
2805 data.recycle();
2806 reply.recycle();
2807 return list;
2808 }
2809 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2810 throws RemoteException {
2811 Parcel data = Parcel.obtain();
2812 Parcel reply = Parcel.obtain();
2813 data.writeInterfaceToken(IActivityManager.descriptor);
2814 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2815 reply.readException();
2816 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2817 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2818 data.recycle();
2819 reply.recycle();
2820 return list;
2821 }
2822 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2823 throws RemoteException {
2824 Parcel data = Parcel.obtain();
2825 Parcel reply = Parcel.obtain();
2826 data.writeInterfaceToken(IActivityManager.descriptor);
2827 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 ArrayList<ActivityManager.RunningAppProcessInfo> list
2830 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2831 data.recycle();
2832 reply.recycle();
2833 return list;
2834 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002835 public List<ApplicationInfo> getRunningExternalApplications()
2836 throws RemoteException {
2837 Parcel data = Parcel.obtain();
2838 Parcel reply = Parcel.obtain();
2839 data.writeInterfaceToken(IActivityManager.descriptor);
2840 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2841 reply.readException();
2842 ArrayList<ApplicationInfo> list
2843 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2844 data.recycle();
2845 reply.recycle();
2846 return list;
2847 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002848 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002849 {
2850 Parcel data = Parcel.obtain();
2851 Parcel reply = Parcel.obtain();
2852 data.writeInterfaceToken(IActivityManager.descriptor);
2853 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002854 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002855 if (options != null) {
2856 data.writeInt(1);
2857 options.writeToParcel(data, 0);
2858 } else {
2859 data.writeInt(0);
2860 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002861 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2862 reply.readException();
2863 data.recycle();
2864 reply.recycle();
2865 }
2866 public void moveTaskToBack(int task) throws RemoteException
2867 {
2868 Parcel data = Parcel.obtain();
2869 Parcel reply = Parcel.obtain();
2870 data.writeInterfaceToken(IActivityManager.descriptor);
2871 data.writeInt(task);
2872 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2873 reply.readException();
2874 data.recycle();
2875 reply.recycle();
2876 }
2877 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2878 throws RemoteException {
2879 Parcel data = Parcel.obtain();
2880 Parcel reply = Parcel.obtain();
2881 data.writeInterfaceToken(IActivityManager.descriptor);
2882 data.writeStrongBinder(token);
2883 data.writeInt(nonRoot ? 1 : 0);
2884 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2885 reply.readException();
2886 boolean res = reply.readInt() != 0;
2887 data.recycle();
2888 reply.recycle();
2889 return res;
2890 }
2891 public void moveTaskBackwards(int task) throws RemoteException
2892 {
2893 Parcel data = Parcel.obtain();
2894 Parcel reply = Parcel.obtain();
2895 data.writeInterfaceToken(IActivityManager.descriptor);
2896 data.writeInt(task);
2897 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2898 reply.readException();
2899 data.recycle();
2900 reply.recycle();
2901 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002902 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002903 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2904 {
2905 Parcel data = Parcel.obtain();
2906 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002907 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002908 data.writeInt(taskId);
2909 data.writeInt(stackId);
2910 data.writeInt(toTop ? 1 : 0);
2911 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2912 reply.readException();
2913 data.recycle();
2914 reply.recycle();
2915 }
2916 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002917 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002918 {
2919 Parcel data = Parcel.obtain();
2920 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002921 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002922 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002923 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002924 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002925 reply.readException();
2926 data.recycle();
2927 reply.recycle();
2928 }
Craig Mautner967212c2013-04-13 21:10:58 -07002929 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002930 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002931 {
2932 Parcel data = Parcel.obtain();
2933 Parcel reply = Parcel.obtain();
2934 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002935 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002936 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002937 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002938 data.recycle();
2939 reply.recycle();
2940 return list;
2941 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002942 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002943 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002944 {
2945 Parcel data = Parcel.obtain();
2946 Parcel reply = Parcel.obtain();
2947 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002948 data.writeInt(stackId);
2949 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002950 reply.readException();
2951 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002952 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002953 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002954 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002955 }
2956 data.recycle();
2957 reply.recycle();
2958 return info;
2959 }
2960 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002961 public boolean isInHomeStack(int taskId) throws RemoteException {
2962 Parcel data = Parcel.obtain();
2963 Parcel reply = Parcel.obtain();
2964 data.writeInterfaceToken(IActivityManager.descriptor);
2965 data.writeInt(taskId);
2966 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
2967 reply.readException();
2968 boolean isInHomeStack = reply.readInt() > 0;
2969 data.recycle();
2970 reply.recycle();
2971 return isInHomeStack;
2972 }
2973 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07002974 public void setFocusedStack(int stackId) throws RemoteException
2975 {
2976 Parcel data = Parcel.obtain();
2977 Parcel reply = Parcel.obtain();
2978 data.writeInterfaceToken(IActivityManager.descriptor);
2979 data.writeInt(stackId);
2980 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2981 reply.readException();
2982 data.recycle();
2983 reply.recycle();
2984 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002985 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
2986 {
2987 Parcel data = Parcel.obtain();
2988 Parcel reply = Parcel.obtain();
2989 data.writeInterfaceToken(IActivityManager.descriptor);
2990 data.writeStrongBinder(token);
2991 data.writeInt(onlyRoot ? 1 : 0);
2992 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
2993 reply.readException();
2994 int res = reply.readInt();
2995 data.recycle();
2996 reply.recycle();
2997 return res;
2998 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002999 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003000 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003001 Parcel data = Parcel.obtain();
3002 Parcel reply = Parcel.obtain();
3003 data.writeInterfaceToken(IActivityManager.descriptor);
3004 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3005 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003006 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003007 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003008 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3009 reply.readException();
3010 int res = reply.readInt();
3011 ContentProviderHolder cph = null;
3012 if (res != 0) {
3013 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3014 }
3015 data.recycle();
3016 reply.recycle();
3017 return cph;
3018 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003019 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3020 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003021 Parcel data = Parcel.obtain();
3022 Parcel reply = Parcel.obtain();
3023 data.writeInterfaceToken(IActivityManager.descriptor);
3024 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003025 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003026 data.writeStrongBinder(token);
3027 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3028 reply.readException();
3029 int res = reply.readInt();
3030 ContentProviderHolder cph = null;
3031 if (res != 0) {
3032 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3033 }
3034 data.recycle();
3035 reply.recycle();
3036 return cph;
3037 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003038 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003039 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003040 {
3041 Parcel data = Parcel.obtain();
3042 Parcel reply = Parcel.obtain();
3043 data.writeInterfaceToken(IActivityManager.descriptor);
3044 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3045 data.writeTypedList(providers);
3046 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3047 reply.readException();
3048 data.recycle();
3049 reply.recycle();
3050 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003051 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3052 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003053 Parcel data = Parcel.obtain();
3054 Parcel reply = Parcel.obtain();
3055 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003056 data.writeStrongBinder(connection);
3057 data.writeInt(stable);
3058 data.writeInt(unstable);
3059 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3060 reply.readException();
3061 boolean res = reply.readInt() != 0;
3062 data.recycle();
3063 reply.recycle();
3064 return res;
3065 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003066
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003067 public void unstableProviderDied(IBinder connection) throws RemoteException {
3068 Parcel data = Parcel.obtain();
3069 Parcel reply = Parcel.obtain();
3070 data.writeInterfaceToken(IActivityManager.descriptor);
3071 data.writeStrongBinder(connection);
3072 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3073 reply.readException();
3074 data.recycle();
3075 reply.recycle();
3076 }
3077
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003078 @Override
3079 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3080 Parcel data = Parcel.obtain();
3081 Parcel reply = Parcel.obtain();
3082 data.writeInterfaceToken(IActivityManager.descriptor);
3083 data.writeStrongBinder(connection);
3084 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3085 reply.readException();
3086 data.recycle();
3087 reply.recycle();
3088 }
3089
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003090 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3091 Parcel data = Parcel.obtain();
3092 Parcel reply = Parcel.obtain();
3093 data.writeInterfaceToken(IActivityManager.descriptor);
3094 data.writeStrongBinder(connection);
3095 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003096 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3097 reply.readException();
3098 data.recycle();
3099 reply.recycle();
3100 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003101
3102 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3103 Parcel data = Parcel.obtain();
3104 Parcel reply = Parcel.obtain();
3105 data.writeInterfaceToken(IActivityManager.descriptor);
3106 data.writeString(name);
3107 data.writeStrongBinder(token);
3108 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 data.recycle();
3111 reply.recycle();
3112 }
3113
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003114 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3115 throws RemoteException
3116 {
3117 Parcel data = Parcel.obtain();
3118 Parcel reply = Parcel.obtain();
3119 data.writeInterfaceToken(IActivityManager.descriptor);
3120 service.writeToParcel(data, 0);
3121 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3122 reply.readException();
3123 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3124 data.recycle();
3125 reply.recycle();
3126 return res;
3127 }
3128
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003129 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003130 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003131 {
3132 Parcel data = Parcel.obtain();
3133 Parcel reply = Parcel.obtain();
3134 data.writeInterfaceToken(IActivityManager.descriptor);
3135 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3136 service.writeToParcel(data, 0);
3137 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003138 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003139 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3140 reply.readException();
3141 ComponentName res = ComponentName.readFromParcel(reply);
3142 data.recycle();
3143 reply.recycle();
3144 return res;
3145 }
3146 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003147 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003148 {
3149 Parcel data = Parcel.obtain();
3150 Parcel reply = Parcel.obtain();
3151 data.writeInterfaceToken(IActivityManager.descriptor);
3152 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3153 service.writeToParcel(data, 0);
3154 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003155 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003156 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3157 reply.readException();
3158 int res = reply.readInt();
3159 reply.recycle();
3160 data.recycle();
3161 return res;
3162 }
3163 public boolean stopServiceToken(ComponentName className, IBinder token,
3164 int startId) throws RemoteException {
3165 Parcel data = Parcel.obtain();
3166 Parcel reply = Parcel.obtain();
3167 data.writeInterfaceToken(IActivityManager.descriptor);
3168 ComponentName.writeToParcel(className, data);
3169 data.writeStrongBinder(token);
3170 data.writeInt(startId);
3171 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3172 reply.readException();
3173 boolean res = reply.readInt() != 0;
3174 data.recycle();
3175 reply.recycle();
3176 return res;
3177 }
3178 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003179 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003180 Parcel data = Parcel.obtain();
3181 Parcel reply = Parcel.obtain();
3182 data.writeInterfaceToken(IActivityManager.descriptor);
3183 ComponentName.writeToParcel(className, data);
3184 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003185 data.writeInt(id);
3186 if (notification != null) {
3187 data.writeInt(1);
3188 notification.writeToParcel(data, 0);
3189 } else {
3190 data.writeInt(0);
3191 }
3192 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003193 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3194 reply.readException();
3195 data.recycle();
3196 reply.recycle();
3197 }
3198 public int bindService(IApplicationThread caller, IBinder token,
3199 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003200 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3205 data.writeStrongBinder(token);
3206 service.writeToParcel(data, 0);
3207 data.writeString(resolvedType);
3208 data.writeStrongBinder(connection.asBinder());
3209 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003210 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003211 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3212 reply.readException();
3213 int res = reply.readInt();
3214 data.recycle();
3215 reply.recycle();
3216 return res;
3217 }
3218 public boolean unbindService(IServiceConnection connection) throws RemoteException
3219 {
3220 Parcel data = Parcel.obtain();
3221 Parcel reply = Parcel.obtain();
3222 data.writeInterfaceToken(IActivityManager.descriptor);
3223 data.writeStrongBinder(connection.asBinder());
3224 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3225 reply.readException();
3226 boolean res = reply.readInt() != 0;
3227 data.recycle();
3228 reply.recycle();
3229 return res;
3230 }
3231
3232 public void publishService(IBinder token,
3233 Intent intent, IBinder service) throws RemoteException {
3234 Parcel data = Parcel.obtain();
3235 Parcel reply = Parcel.obtain();
3236 data.writeInterfaceToken(IActivityManager.descriptor);
3237 data.writeStrongBinder(token);
3238 intent.writeToParcel(data, 0);
3239 data.writeStrongBinder(service);
3240 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3241 reply.readException();
3242 data.recycle();
3243 reply.recycle();
3244 }
3245
3246 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3247 throws RemoteException {
3248 Parcel data = Parcel.obtain();
3249 Parcel reply = Parcel.obtain();
3250 data.writeInterfaceToken(IActivityManager.descriptor);
3251 data.writeStrongBinder(token);
3252 intent.writeToParcel(data, 0);
3253 data.writeInt(doRebind ? 1 : 0);
3254 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3255 reply.readException();
3256 data.recycle();
3257 reply.recycle();
3258 }
3259
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003260 public void serviceDoneExecuting(IBinder token, int type, int startId,
3261 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003262 Parcel data = Parcel.obtain();
3263 Parcel reply = Parcel.obtain();
3264 data.writeInterfaceToken(IActivityManager.descriptor);
3265 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003266 data.writeInt(type);
3267 data.writeInt(startId);
3268 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003269 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3270 reply.readException();
3271 data.recycle();
3272 reply.recycle();
3273 }
3274
3275 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3276 Parcel data = Parcel.obtain();
3277 Parcel reply = Parcel.obtain();
3278 data.writeInterfaceToken(IActivityManager.descriptor);
3279 service.writeToParcel(data, 0);
3280 data.writeString(resolvedType);
3281 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3282 reply.readException();
3283 IBinder binder = reply.readStrongBinder();
3284 reply.recycle();
3285 data.recycle();
3286 return binder;
3287 }
3288
Christopher Tate181fafa2009-05-14 11:12:14 -07003289 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3290 throws RemoteException {
3291 Parcel data = Parcel.obtain();
3292 Parcel reply = Parcel.obtain();
3293 data.writeInterfaceToken(IActivityManager.descriptor);
3294 app.writeToParcel(data, 0);
3295 data.writeInt(backupRestoreMode);
3296 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3297 reply.readException();
3298 boolean success = reply.readInt() != 0;
3299 reply.recycle();
3300 data.recycle();
3301 return success;
3302 }
3303
Christopher Tate346acb12012-10-15 19:20:25 -07003304 public void clearPendingBackup() throws RemoteException {
3305 Parcel data = Parcel.obtain();
3306 Parcel reply = Parcel.obtain();
3307 data.writeInterfaceToken(IActivityManager.descriptor);
3308 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3309 reply.recycle();
3310 data.recycle();
3311 }
3312
Christopher Tate181fafa2009-05-14 11:12:14 -07003313 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3314 Parcel data = Parcel.obtain();
3315 Parcel reply = Parcel.obtain();
3316 data.writeInterfaceToken(IActivityManager.descriptor);
3317 data.writeString(packageName);
3318 data.writeStrongBinder(agent);
3319 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3320 reply.recycle();
3321 data.recycle();
3322 }
3323
3324 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3325 Parcel data = Parcel.obtain();
3326 Parcel reply = Parcel.obtain();
3327 data.writeInterfaceToken(IActivityManager.descriptor);
3328 app.writeToParcel(data, 0);
3329 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3330 reply.readException();
3331 reply.recycle();
3332 data.recycle();
3333 }
3334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003335 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003336 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003337 IUiAutomationConnection connection, int userId, String instructionSet)
3338 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003339 Parcel data = Parcel.obtain();
3340 Parcel reply = Parcel.obtain();
3341 data.writeInterfaceToken(IActivityManager.descriptor);
3342 ComponentName.writeToParcel(className, data);
3343 data.writeString(profileFile);
3344 data.writeInt(flags);
3345 data.writeBundle(arguments);
3346 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003347 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003348 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003349 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003350 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3351 reply.readException();
3352 boolean res = reply.readInt() != 0;
3353 reply.recycle();
3354 data.recycle();
3355 return res;
3356 }
3357
3358 public void finishInstrumentation(IApplicationThread target,
3359 int resultCode, Bundle results) throws RemoteException {
3360 Parcel data = Parcel.obtain();
3361 Parcel reply = Parcel.obtain();
3362 data.writeInterfaceToken(IActivityManager.descriptor);
3363 data.writeStrongBinder(target != null ? target.asBinder() : null);
3364 data.writeInt(resultCode);
3365 data.writeBundle(results);
3366 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3367 reply.readException();
3368 data.recycle();
3369 reply.recycle();
3370 }
3371 public Configuration getConfiguration() throws RemoteException
3372 {
3373 Parcel data = Parcel.obtain();
3374 Parcel reply = Parcel.obtain();
3375 data.writeInterfaceToken(IActivityManager.descriptor);
3376 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3377 reply.readException();
3378 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3379 reply.recycle();
3380 data.recycle();
3381 return res;
3382 }
3383 public void updateConfiguration(Configuration values) throws RemoteException
3384 {
3385 Parcel data = Parcel.obtain();
3386 Parcel reply = Parcel.obtain();
3387 data.writeInterfaceToken(IActivityManager.descriptor);
3388 values.writeToParcel(data, 0);
3389 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3390 reply.readException();
3391 data.recycle();
3392 reply.recycle();
3393 }
3394 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3395 throws RemoteException {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeStrongBinder(token);
3400 data.writeInt(requestedOrientation);
3401 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3402 reply.readException();
3403 data.recycle();
3404 reply.recycle();
3405 }
3406 public int getRequestedOrientation(IBinder token) throws RemoteException {
3407 Parcel data = Parcel.obtain();
3408 Parcel reply = Parcel.obtain();
3409 data.writeInterfaceToken(IActivityManager.descriptor);
3410 data.writeStrongBinder(token);
3411 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3412 reply.readException();
3413 int res = reply.readInt();
3414 data.recycle();
3415 reply.recycle();
3416 return res;
3417 }
3418 public ComponentName getActivityClassForToken(IBinder token)
3419 throws RemoteException {
3420 Parcel data = Parcel.obtain();
3421 Parcel reply = Parcel.obtain();
3422 data.writeInterfaceToken(IActivityManager.descriptor);
3423 data.writeStrongBinder(token);
3424 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3425 reply.readException();
3426 ComponentName res = ComponentName.readFromParcel(reply);
3427 data.recycle();
3428 reply.recycle();
3429 return res;
3430 }
3431 public String getPackageForToken(IBinder token) throws RemoteException
3432 {
3433 Parcel data = Parcel.obtain();
3434 Parcel reply = Parcel.obtain();
3435 data.writeInterfaceToken(IActivityManager.descriptor);
3436 data.writeStrongBinder(token);
3437 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 String res = reply.readString();
3440 data.recycle();
3441 reply.recycle();
3442 return res;
3443 }
3444 public IIntentSender getIntentSender(int type,
3445 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003446 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003447 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003448 Parcel data = Parcel.obtain();
3449 Parcel reply = Parcel.obtain();
3450 data.writeInterfaceToken(IActivityManager.descriptor);
3451 data.writeInt(type);
3452 data.writeString(packageName);
3453 data.writeStrongBinder(token);
3454 data.writeString(resultWho);
3455 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003456 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003457 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003458 data.writeTypedArray(intents, 0);
3459 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003460 } else {
3461 data.writeInt(0);
3462 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003463 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003464 if (options != null) {
3465 data.writeInt(1);
3466 options.writeToParcel(data, 0);
3467 } else {
3468 data.writeInt(0);
3469 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003470 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003471 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3472 reply.readException();
3473 IIntentSender res = IIntentSender.Stub.asInterface(
3474 reply.readStrongBinder());
3475 data.recycle();
3476 reply.recycle();
3477 return res;
3478 }
3479 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3480 Parcel data = Parcel.obtain();
3481 Parcel reply = Parcel.obtain();
3482 data.writeInterfaceToken(IActivityManager.descriptor);
3483 data.writeStrongBinder(sender.asBinder());
3484 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3485 reply.readException();
3486 data.recycle();
3487 reply.recycle();
3488 }
3489 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3490 Parcel data = Parcel.obtain();
3491 Parcel reply = Parcel.obtain();
3492 data.writeInterfaceToken(IActivityManager.descriptor);
3493 data.writeStrongBinder(sender.asBinder());
3494 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3495 reply.readException();
3496 String res = reply.readString();
3497 data.recycle();
3498 reply.recycle();
3499 return res;
3500 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003501 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3502 Parcel data = Parcel.obtain();
3503 Parcel reply = Parcel.obtain();
3504 data.writeInterfaceToken(IActivityManager.descriptor);
3505 data.writeStrongBinder(sender.asBinder());
3506 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3507 reply.readException();
3508 int res = reply.readInt();
3509 data.recycle();
3510 reply.recycle();
3511 return res;
3512 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003513 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3514 boolean requireFull, String name, String callerPackage) throws RemoteException {
3515 Parcel data = Parcel.obtain();
3516 Parcel reply = Parcel.obtain();
3517 data.writeInterfaceToken(IActivityManager.descriptor);
3518 data.writeInt(callingPid);
3519 data.writeInt(callingUid);
3520 data.writeInt(userId);
3521 data.writeInt(allowAll ? 1 : 0);
3522 data.writeInt(requireFull ? 1 : 0);
3523 data.writeString(name);
3524 data.writeString(callerPackage);
3525 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3526 reply.readException();
3527 int res = reply.readInt();
3528 data.recycle();
3529 reply.recycle();
3530 return res;
3531 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003532 public void setProcessLimit(int max) throws RemoteException
3533 {
3534 Parcel data = Parcel.obtain();
3535 Parcel reply = Parcel.obtain();
3536 data.writeInterfaceToken(IActivityManager.descriptor);
3537 data.writeInt(max);
3538 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3539 reply.readException();
3540 data.recycle();
3541 reply.recycle();
3542 }
3543 public int getProcessLimit() throws RemoteException
3544 {
3545 Parcel data = Parcel.obtain();
3546 Parcel reply = Parcel.obtain();
3547 data.writeInterfaceToken(IActivityManager.descriptor);
3548 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3549 reply.readException();
3550 int res = reply.readInt();
3551 data.recycle();
3552 reply.recycle();
3553 return res;
3554 }
3555 public void setProcessForeground(IBinder token, int pid,
3556 boolean isForeground) throws RemoteException {
3557 Parcel data = Parcel.obtain();
3558 Parcel reply = Parcel.obtain();
3559 data.writeInterfaceToken(IActivityManager.descriptor);
3560 data.writeStrongBinder(token);
3561 data.writeInt(pid);
3562 data.writeInt(isForeground ? 1 : 0);
3563 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3564 reply.readException();
3565 data.recycle();
3566 reply.recycle();
3567 }
3568 public int checkPermission(String permission, int pid, int uid)
3569 throws RemoteException {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeString(permission);
3574 data.writeInt(pid);
3575 data.writeInt(uid);
3576 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3577 reply.readException();
3578 int res = reply.readInt();
3579 data.recycle();
3580 reply.recycle();
3581 return res;
3582 }
3583 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003584 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003585 Parcel data = Parcel.obtain();
3586 Parcel reply = Parcel.obtain();
3587 data.writeInterfaceToken(IActivityManager.descriptor);
3588 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003589 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003590 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003591 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3592 reply.readException();
3593 boolean res = reply.readInt() != 0;
3594 data.recycle();
3595 reply.recycle();
3596 return res;
3597 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003598 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003599 throws RemoteException {
3600 Parcel data = Parcel.obtain();
3601 Parcel reply = Parcel.obtain();
3602 data.writeInterfaceToken(IActivityManager.descriptor);
3603 uri.writeToParcel(data, 0);
3604 data.writeInt(pid);
3605 data.writeInt(uid);
3606 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003607 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003608 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3609 reply.readException();
3610 int res = reply.readInt();
3611 data.recycle();
3612 reply.recycle();
3613 return res;
3614 }
3615 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003616 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003617 Parcel data = Parcel.obtain();
3618 Parcel reply = Parcel.obtain();
3619 data.writeInterfaceToken(IActivityManager.descriptor);
3620 data.writeStrongBinder(caller.asBinder());
3621 data.writeString(targetPkg);
3622 uri.writeToParcel(data, 0);
3623 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003624 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003625 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3626 reply.readException();
3627 data.recycle();
3628 reply.recycle();
3629 }
3630 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003631 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003632 Parcel data = Parcel.obtain();
3633 Parcel reply = Parcel.obtain();
3634 data.writeInterfaceToken(IActivityManager.descriptor);
3635 data.writeStrongBinder(caller.asBinder());
3636 uri.writeToParcel(data, 0);
3637 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003638 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003639 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3640 reply.readException();
3641 data.recycle();
3642 reply.recycle();
3643 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003644
3645 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003646 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3647 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003648 Parcel data = Parcel.obtain();
3649 Parcel reply = Parcel.obtain();
3650 data.writeInterfaceToken(IActivityManager.descriptor);
3651 uri.writeToParcel(data, 0);
3652 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003653 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003654 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3655 reply.readException();
3656 data.recycle();
3657 reply.recycle();
3658 }
3659
3660 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003661 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3662 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003663 Parcel data = Parcel.obtain();
3664 Parcel reply = Parcel.obtain();
3665 data.writeInterfaceToken(IActivityManager.descriptor);
3666 uri.writeToParcel(data, 0);
3667 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003668 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003669 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3670 reply.readException();
3671 data.recycle();
3672 reply.recycle();
3673 }
3674
3675 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003676 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3677 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003678 Parcel data = Parcel.obtain();
3679 Parcel reply = Parcel.obtain();
3680 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003681 data.writeString(packageName);
3682 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003683 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3684 reply.readException();
3685 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3686 reply);
3687 data.recycle();
3688 reply.recycle();
3689 return perms;
3690 }
3691
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003692 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3693 throws RemoteException {
3694 Parcel data = Parcel.obtain();
3695 Parcel reply = Parcel.obtain();
3696 data.writeInterfaceToken(IActivityManager.descriptor);
3697 data.writeStrongBinder(who.asBinder());
3698 data.writeInt(waiting ? 1 : 0);
3699 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3700 reply.readException();
3701 data.recycle();
3702 reply.recycle();
3703 }
3704 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3705 Parcel data = Parcel.obtain();
3706 Parcel reply = Parcel.obtain();
3707 data.writeInterfaceToken(IActivityManager.descriptor);
3708 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3709 reply.readException();
3710 outInfo.readFromParcel(reply);
3711 data.recycle();
3712 reply.recycle();
3713 }
3714 public void unhandledBack() throws RemoteException
3715 {
3716 Parcel data = Parcel.obtain();
3717 Parcel reply = Parcel.obtain();
3718 data.writeInterfaceToken(IActivityManager.descriptor);
3719 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 data.recycle();
3722 reply.recycle();
3723 }
3724 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3725 {
3726 Parcel data = Parcel.obtain();
3727 Parcel reply = Parcel.obtain();
3728 data.writeInterfaceToken(IActivityManager.descriptor);
3729 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3730 reply.readException();
3731 ParcelFileDescriptor pfd = null;
3732 if (reply.readInt() != 0) {
3733 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3734 }
3735 data.recycle();
3736 reply.recycle();
3737 return pfd;
3738 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003739 public void setLockScreenShown(boolean shown) throws RemoteException
3740 {
3741 Parcel data = Parcel.obtain();
3742 Parcel reply = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 data.writeInt(shown ? 1 : 0);
3745 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3746 reply.readException();
3747 data.recycle();
3748 reply.recycle();
3749 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003750 public void setDebugApp(
3751 String packageName, boolean waitForDebugger, boolean persistent)
3752 throws RemoteException
3753 {
3754 Parcel data = Parcel.obtain();
3755 Parcel reply = Parcel.obtain();
3756 data.writeInterfaceToken(IActivityManager.descriptor);
3757 data.writeString(packageName);
3758 data.writeInt(waitForDebugger ? 1 : 0);
3759 data.writeInt(persistent ? 1 : 0);
3760 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3761 reply.readException();
3762 data.recycle();
3763 reply.recycle();
3764 }
3765 public void setAlwaysFinish(boolean enabled) throws RemoteException
3766 {
3767 Parcel data = Parcel.obtain();
3768 Parcel reply = Parcel.obtain();
3769 data.writeInterfaceToken(IActivityManager.descriptor);
3770 data.writeInt(enabled ? 1 : 0);
3771 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3772 reply.readException();
3773 data.recycle();
3774 reply.recycle();
3775 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003776 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003777 {
3778 Parcel data = Parcel.obtain();
3779 Parcel reply = Parcel.obtain();
3780 data.writeInterfaceToken(IActivityManager.descriptor);
3781 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003782 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003783 reply.readException();
3784 data.recycle();
3785 reply.recycle();
3786 }
3787 public void enterSafeMode() throws RemoteException {
3788 Parcel data = Parcel.obtain();
3789 data.writeInterfaceToken(IActivityManager.descriptor);
3790 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3791 data.recycle();
3792 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003793 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3794 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003795 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003796 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003797 data.writeStrongBinder(sender.asBinder());
3798 data.writeInt(sourceUid);
3799 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003800 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3801 data.recycle();
3802 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003803 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003804 Parcel data = Parcel.obtain();
3805 Parcel reply = Parcel.obtain();
3806 data.writeInterfaceToken(IActivityManager.descriptor);
3807 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003808 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003809 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003810 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003811 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003812 boolean res = reply.readInt() != 0;
3813 data.recycle();
3814 reply.recycle();
3815 return res;
3816 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003817 @Override
3818 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3819 Parcel data = Parcel.obtain();
3820 Parcel reply = Parcel.obtain();
3821 data.writeInterfaceToken(IActivityManager.descriptor);
3822 data.writeString(reason);
3823 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3824 boolean res = reply.readInt() != 0;
3825 data.recycle();
3826 reply.recycle();
3827 return res;
3828 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003829 public boolean testIsSystemReady()
3830 {
3831 /* this base class version is never called */
3832 return true;
3833 }
Dan Egnor60d87622009-12-16 16:32:58 -08003834 public void handleApplicationCrash(IBinder app,
3835 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3836 {
3837 Parcel data = Parcel.obtain();
3838 Parcel reply = Parcel.obtain();
3839 data.writeInterfaceToken(IActivityManager.descriptor);
3840 data.writeStrongBinder(app);
3841 crashInfo.writeToParcel(data, 0);
3842 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3843 reply.readException();
3844 reply.recycle();
3845 data.recycle();
3846 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003847
Dan Egnor60d87622009-12-16 16:32:58 -08003848 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003849 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003850 {
3851 Parcel data = Parcel.obtain();
3852 Parcel reply = Parcel.obtain();
3853 data.writeInterfaceToken(IActivityManager.descriptor);
3854 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003855 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003856 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003857 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003858 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003859 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003860 reply.recycle();
3861 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003862 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003863 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003864
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003865 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003866 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003867 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003868 {
3869 Parcel data = Parcel.obtain();
3870 Parcel reply = Parcel.obtain();
3871 data.writeInterfaceToken(IActivityManager.descriptor);
3872 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003873 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003874 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003875 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3876 reply.readException();
3877 reply.recycle();
3878 data.recycle();
3879 }
3880
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003881 public void signalPersistentProcesses(int sig) throws RemoteException {
3882 Parcel data = Parcel.obtain();
3883 Parcel reply = Parcel.obtain();
3884 data.writeInterfaceToken(IActivityManager.descriptor);
3885 data.writeInt(sig);
3886 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3887 reply.readException();
3888 data.recycle();
3889 reply.recycle();
3890 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003891
Dianne Hackborn1676c852012-09-10 14:52:30 -07003892 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003893 Parcel data = Parcel.obtain();
3894 Parcel reply = Parcel.obtain();
3895 data.writeInterfaceToken(IActivityManager.descriptor);
3896 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003897 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003898 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3899 reply.readException();
3900 data.recycle();
3901 reply.recycle();
3902 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003903
3904 public void killAllBackgroundProcesses() throws RemoteException {
3905 Parcel data = Parcel.obtain();
3906 Parcel reply = Parcel.obtain();
3907 data.writeInterfaceToken(IActivityManager.descriptor);
3908 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3909 reply.readException();
3910 data.recycle();
3911 reply.recycle();
3912 }
3913
Dianne Hackborn1676c852012-09-10 14:52:30 -07003914 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003915 Parcel data = Parcel.obtain();
3916 Parcel reply = Parcel.obtain();
3917 data.writeInterfaceToken(IActivityManager.descriptor);
3918 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003919 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003920 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003921 reply.readException();
3922 data.recycle();
3923 reply.recycle();
3924 }
3925
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003926 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3927 throws RemoteException
3928 {
3929 Parcel data = Parcel.obtain();
3930 Parcel reply = Parcel.obtain();
3931 data.writeInterfaceToken(IActivityManager.descriptor);
3932 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3933 reply.readException();
3934 outInfo.readFromParcel(reply);
3935 reply.recycle();
3936 data.recycle();
3937 }
3938
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003939 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3940 {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3947 reply.recycle();
3948 data.recycle();
3949 return res;
3950 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003951
Dianne Hackborn1676c852012-09-10 14:52:30 -07003952 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003953 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003954 {
3955 Parcel data = Parcel.obtain();
3956 Parcel reply = Parcel.obtain();
3957 data.writeInterfaceToken(IActivityManager.descriptor);
3958 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003959 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003960 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003961 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003962 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003963 if (fd != null) {
3964 data.writeInt(1);
3965 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
3966 } else {
3967 data.writeInt(0);
3968 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003969 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
3970 reply.readException();
3971 boolean res = reply.readInt() != 0;
3972 reply.recycle();
3973 data.recycle();
3974 return res;
3975 }
3976
Dianne Hackborn55280a92009-05-07 15:53:46 -07003977 public boolean shutdown(int timeout) throws RemoteException
3978 {
3979 Parcel data = Parcel.obtain();
3980 Parcel reply = Parcel.obtain();
3981 data.writeInterfaceToken(IActivityManager.descriptor);
3982 data.writeInt(timeout);
3983 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
3984 reply.readException();
3985 boolean res = reply.readInt() != 0;
3986 reply.recycle();
3987 data.recycle();
3988 return res;
3989 }
3990
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07003991 public void stopAppSwitches() throws RemoteException {
3992 Parcel data = Parcel.obtain();
3993 Parcel reply = Parcel.obtain();
3994 data.writeInterfaceToken(IActivityManager.descriptor);
3995 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
3996 reply.readException();
3997 reply.recycle();
3998 data.recycle();
3999 }
4000
4001 public void resumeAppSwitches() throws RemoteException {
4002 Parcel data = Parcel.obtain();
4003 Parcel reply = Parcel.obtain();
4004 data.writeInterfaceToken(IActivityManager.descriptor);
4005 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4006 reply.readException();
4007 reply.recycle();
4008 data.recycle();
4009 }
4010
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004011 public void killApplicationWithAppId(String pkg, int appid, String reason)
4012 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004013 Parcel data = Parcel.obtain();
4014 Parcel reply = Parcel.obtain();
4015 data.writeInterfaceToken(IActivityManager.descriptor);
4016 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004017 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004018 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004019 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004020 reply.readException();
4021 data.recycle();
4022 reply.recycle();
4023 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004024
4025 public void closeSystemDialogs(String reason) throws RemoteException {
4026 Parcel data = Parcel.obtain();
4027 Parcel reply = Parcel.obtain();
4028 data.writeInterfaceToken(IActivityManager.descriptor);
4029 data.writeString(reason);
4030 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4031 reply.readException();
4032 data.recycle();
4033 reply.recycle();
4034 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004035
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004036 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004037 throws RemoteException {
4038 Parcel data = Parcel.obtain();
4039 Parcel reply = Parcel.obtain();
4040 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004041 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004042 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4043 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004044 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004045 data.recycle();
4046 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004047 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004048 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004049
4050 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4051 Parcel data = Parcel.obtain();
4052 Parcel reply = Parcel.obtain();
4053 data.writeInterfaceToken(IActivityManager.descriptor);
4054 data.writeString(processName);
4055 data.writeInt(uid);
4056 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4057 reply.readException();
4058 data.recycle();
4059 reply.recycle();
4060 }
4061
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004062 public void overridePendingTransition(IBinder token, String packageName,
4063 int enterAnim, int exitAnim) throws RemoteException {
4064 Parcel data = Parcel.obtain();
4065 Parcel reply = Parcel.obtain();
4066 data.writeInterfaceToken(IActivityManager.descriptor);
4067 data.writeStrongBinder(token);
4068 data.writeString(packageName);
4069 data.writeInt(enterAnim);
4070 data.writeInt(exitAnim);
4071 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4072 reply.readException();
4073 data.recycle();
4074 reply.recycle();
4075 }
4076
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004077 public boolean isUserAMonkey() throws RemoteException {
4078 Parcel data = Parcel.obtain();
4079 Parcel reply = Parcel.obtain();
4080 data.writeInterfaceToken(IActivityManager.descriptor);
4081 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4082 reply.readException();
4083 boolean res = reply.readInt() != 0;
4084 data.recycle();
4085 reply.recycle();
4086 return res;
4087 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004088
4089 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4090 Parcel data = Parcel.obtain();
4091 Parcel reply = Parcel.obtain();
4092 data.writeInterfaceToken(IActivityManager.descriptor);
4093 data.writeInt(monkey ? 1 : 0);
4094 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4095 reply.readException();
4096 data.recycle();
4097 reply.recycle();
4098 }
4099
Dianne Hackborn860755f2010-06-03 18:47:52 -07004100 public void finishHeavyWeightApp() throws RemoteException {
4101 Parcel data = Parcel.obtain();
4102 Parcel reply = Parcel.obtain();
4103 data.writeInterfaceToken(IActivityManager.descriptor);
4104 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4105 reply.readException();
4106 data.recycle();
4107 reply.recycle();
4108 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004109
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004110 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004111 throws RemoteException {
4112 Parcel data = Parcel.obtain();
4113 Parcel reply = Parcel.obtain();
4114 data.writeInterfaceToken(IActivityManager.descriptor);
4115 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004116 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4117 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004118 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004119 data.recycle();
4120 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004121 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004122 }
4123
Craig Mautner233ceee2014-05-09 17:05:11 -07004124 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004125 throws RemoteException {
4126 Parcel data = Parcel.obtain();
4127 Parcel reply = Parcel.obtain();
4128 data.writeInterfaceToken(IActivityManager.descriptor);
4129 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004130 if (options == null) {
4131 data.writeInt(0);
4132 } else {
4133 data.writeInt(1);
4134 data.writeBundle(options.toBundle());
4135 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004136 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004137 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004138 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004139 data.recycle();
4140 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004141 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004142 }
4143
Craig Mautner233ceee2014-05-09 17:05:11 -07004144 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4145 Parcel data = Parcel.obtain();
4146 Parcel reply = Parcel.obtain();
4147 data.writeInterfaceToken(IActivityManager.descriptor);
4148 data.writeStrongBinder(token);
4149 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4150 reply.readException();
4151 Bundle bundle = reply.readBundle();
4152 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4153 data.recycle();
4154 reply.recycle();
4155 return options;
4156 }
4157
Daniel Sandler69a48172010-06-23 16:29:36 -04004158 public void setImmersive(IBinder token, boolean immersive)
4159 throws RemoteException {
4160 Parcel data = Parcel.obtain();
4161 Parcel reply = Parcel.obtain();
4162 data.writeInterfaceToken(IActivityManager.descriptor);
4163 data.writeStrongBinder(token);
4164 data.writeInt(immersive ? 1 : 0);
4165 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4166 reply.readException();
4167 data.recycle();
4168 reply.recycle();
4169 }
4170
4171 public boolean isImmersive(IBinder token)
4172 throws RemoteException {
4173 Parcel data = Parcel.obtain();
4174 Parcel reply = Parcel.obtain();
4175 data.writeInterfaceToken(IActivityManager.descriptor);
4176 data.writeStrongBinder(token);
4177 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004178 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004179 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004180 data.recycle();
4181 reply.recycle();
4182 return res;
4183 }
4184
4185 public boolean isTopActivityImmersive()
4186 throws RemoteException {
4187 Parcel data = Parcel.obtain();
4188 Parcel reply = Parcel.obtain();
4189 data.writeInterfaceToken(IActivityManager.descriptor);
4190 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004191 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004192 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004193 data.recycle();
4194 reply.recycle();
4195 return res;
4196 }
4197
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004198 public void crashApplication(int uid, int initialPid, String packageName,
4199 String message) throws RemoteException {
4200 Parcel data = Parcel.obtain();
4201 Parcel reply = Parcel.obtain();
4202 data.writeInterfaceToken(IActivityManager.descriptor);
4203 data.writeInt(uid);
4204 data.writeInt(initialPid);
4205 data.writeString(packageName);
4206 data.writeString(message);
4207 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4208 reply.readException();
4209 data.recycle();
4210 reply.recycle();
4211 }
Andy McFadden824c5102010-07-09 16:26:57 -07004212
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004213 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004214 Parcel data = Parcel.obtain();
4215 Parcel reply = Parcel.obtain();
4216 data.writeInterfaceToken(IActivityManager.descriptor);
4217 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004218 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004219 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4220 reply.readException();
4221 String res = reply.readString();
4222 data.recycle();
4223 reply.recycle();
4224 return res;
4225 }
4226
Dianne Hackborn7e269642010-08-25 19:50:20 -07004227 public IBinder newUriPermissionOwner(String name)
4228 throws RemoteException {
4229 Parcel data = Parcel.obtain();
4230 Parcel reply = Parcel.obtain();
4231 data.writeInterfaceToken(IActivityManager.descriptor);
4232 data.writeString(name);
4233 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4234 reply.readException();
4235 IBinder res = reply.readStrongBinder();
4236 data.recycle();
4237 reply.recycle();
4238 return res;
4239 }
4240
4241 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004242 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004243 Parcel data = Parcel.obtain();
4244 Parcel reply = Parcel.obtain();
4245 data.writeInterfaceToken(IActivityManager.descriptor);
4246 data.writeStrongBinder(owner);
4247 data.writeInt(fromUid);
4248 data.writeString(targetPkg);
4249 uri.writeToParcel(data, 0);
4250 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004251 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004252 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4253 reply.readException();
4254 data.recycle();
4255 reply.recycle();
4256 }
4257
4258 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004259 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004260 Parcel data = Parcel.obtain();
4261 Parcel reply = Parcel.obtain();
4262 data.writeInterfaceToken(IActivityManager.descriptor);
4263 data.writeStrongBinder(owner);
4264 if (uri != null) {
4265 data.writeInt(1);
4266 uri.writeToParcel(data, 0);
4267 } else {
4268 data.writeInt(0);
4269 }
4270 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004271 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004272 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4273 reply.readException();
4274 data.recycle();
4275 reply.recycle();
4276 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004277
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004278 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004279 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004280 Parcel data = Parcel.obtain();
4281 Parcel reply = Parcel.obtain();
4282 data.writeInterfaceToken(IActivityManager.descriptor);
4283 data.writeInt(callingUid);
4284 data.writeString(targetPkg);
4285 uri.writeToParcel(data, 0);
4286 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004287 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004288 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4289 reply.readException();
4290 int res = reply.readInt();
4291 data.recycle();
4292 reply.recycle();
4293 return res;
4294 }
4295
Dianne Hackborn1676c852012-09-10 14:52:30 -07004296 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004297 String path, ParcelFileDescriptor fd) throws RemoteException {
4298 Parcel data = Parcel.obtain();
4299 Parcel reply = Parcel.obtain();
4300 data.writeInterfaceToken(IActivityManager.descriptor);
4301 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004302 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004303 data.writeInt(managed ? 1 : 0);
4304 data.writeString(path);
4305 if (fd != null) {
4306 data.writeInt(1);
4307 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4308 } else {
4309 data.writeInt(0);
4310 }
4311 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4312 reply.readException();
4313 boolean res = reply.readInt() != 0;
4314 reply.recycle();
4315 data.recycle();
4316 return res;
4317 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004318
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004319 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004320 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004321 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004322 Parcel data = Parcel.obtain();
4323 Parcel reply = Parcel.obtain();
4324 data.writeInterfaceToken(IActivityManager.descriptor);
4325 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004326 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004327 data.writeTypedArray(intents, 0);
4328 data.writeStringArray(resolvedTypes);
4329 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004330 if (options != null) {
4331 data.writeInt(1);
4332 options.writeToParcel(data, 0);
4333 } else {
4334 data.writeInt(0);
4335 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004336 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004337 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4338 reply.readException();
4339 int result = reply.readInt();
4340 reply.recycle();
4341 data.recycle();
4342 return result;
4343 }
4344
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004345 public int getFrontActivityScreenCompatMode() throws RemoteException {
4346 Parcel data = Parcel.obtain();
4347 Parcel reply = Parcel.obtain();
4348 data.writeInterfaceToken(IActivityManager.descriptor);
4349 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4350 reply.readException();
4351 int mode = reply.readInt();
4352 reply.recycle();
4353 data.recycle();
4354 return mode;
4355 }
4356
4357 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4358 Parcel data = Parcel.obtain();
4359 Parcel reply = Parcel.obtain();
4360 data.writeInterfaceToken(IActivityManager.descriptor);
4361 data.writeInt(mode);
4362 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4363 reply.readException();
4364 reply.recycle();
4365 data.recycle();
4366 }
4367
4368 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4369 Parcel data = Parcel.obtain();
4370 Parcel reply = Parcel.obtain();
4371 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004372 data.writeString(packageName);
4373 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004374 reply.readException();
4375 int mode = reply.readInt();
4376 reply.recycle();
4377 data.recycle();
4378 return mode;
4379 }
4380
4381 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004382 throws RemoteException {
4383 Parcel data = Parcel.obtain();
4384 Parcel reply = Parcel.obtain();
4385 data.writeInterfaceToken(IActivityManager.descriptor);
4386 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004387 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004388 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4389 reply.readException();
4390 reply.recycle();
4391 data.recycle();
4392 }
4393
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004394 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4395 Parcel data = Parcel.obtain();
4396 Parcel reply = Parcel.obtain();
4397 data.writeInterfaceToken(IActivityManager.descriptor);
4398 data.writeString(packageName);
4399 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4400 reply.readException();
4401 boolean ask = reply.readInt() != 0;
4402 reply.recycle();
4403 data.recycle();
4404 return ask;
4405 }
4406
4407 public void setPackageAskScreenCompat(String packageName, boolean ask)
4408 throws RemoteException {
4409 Parcel data = Parcel.obtain();
4410 Parcel reply = Parcel.obtain();
4411 data.writeInterfaceToken(IActivityManager.descriptor);
4412 data.writeString(packageName);
4413 data.writeInt(ask ? 1 : 0);
4414 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4415 reply.readException();
4416 reply.recycle();
4417 data.recycle();
4418 }
4419
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004420 public boolean switchUser(int userid) throws RemoteException {
4421 Parcel data = Parcel.obtain();
4422 Parcel reply = Parcel.obtain();
4423 data.writeInterfaceToken(IActivityManager.descriptor);
4424 data.writeInt(userid);
4425 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4426 reply.readException();
4427 boolean result = reply.readInt() != 0;
4428 reply.recycle();
4429 data.recycle();
4430 return result;
4431 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004432
Kenny Guy08488bf2014-02-21 17:40:37 +00004433 public boolean startUserInBackground(int userid) throws RemoteException {
4434 Parcel data = Parcel.obtain();
4435 Parcel reply = Parcel.obtain();
4436 data.writeInterfaceToken(IActivityManager.descriptor);
4437 data.writeInt(userid);
4438 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4439 reply.readException();
4440 boolean result = reply.readInt() != 0;
4441 reply.recycle();
4442 data.recycle();
4443 return result;
4444 }
4445
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004446 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4447 Parcel data = Parcel.obtain();
4448 Parcel reply = Parcel.obtain();
4449 data.writeInterfaceToken(IActivityManager.descriptor);
4450 data.writeInt(userid);
4451 data.writeStrongInterface(callback);
4452 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4453 reply.readException();
4454 int result = reply.readInt();
4455 reply.recycle();
4456 data.recycle();
4457 return result;
4458 }
4459
Amith Yamasani52f1d752012-03-28 18:19:29 -07004460 public UserInfo getCurrentUser() throws RemoteException {
4461 Parcel data = Parcel.obtain();
4462 Parcel reply = Parcel.obtain();
4463 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004464 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004465 reply.readException();
4466 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4467 reply.recycle();
4468 data.recycle();
4469 return userInfo;
4470 }
4471
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004472 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004473 Parcel data = Parcel.obtain();
4474 Parcel reply = Parcel.obtain();
4475 data.writeInterfaceToken(IActivityManager.descriptor);
4476 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004477 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004478 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4479 reply.readException();
4480 boolean result = reply.readInt() != 0;
4481 reply.recycle();
4482 data.recycle();
4483 return result;
4484 }
4485
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004486 public int[] getRunningUserIds() throws RemoteException {
4487 Parcel data = Parcel.obtain();
4488 Parcel reply = Parcel.obtain();
4489 data.writeInterfaceToken(IActivityManager.descriptor);
4490 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4491 reply.readException();
4492 int[] result = reply.createIntArray();
4493 reply.recycle();
4494 data.recycle();
4495 return result;
4496 }
4497
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004498 public boolean removeTask(int taskId, int flags) throws RemoteException {
4499 Parcel data = Parcel.obtain();
4500 Parcel reply = Parcel.obtain();
4501 data.writeInterfaceToken(IActivityManager.descriptor);
4502 data.writeInt(taskId);
4503 data.writeInt(flags);
4504 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4505 reply.readException();
4506 boolean result = reply.readInt() != 0;
4507 reply.recycle();
4508 data.recycle();
4509 return result;
4510 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004511
Jeff Sharkeya4620792011-05-20 15:29:23 -07004512 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4513 Parcel data = Parcel.obtain();
4514 Parcel reply = Parcel.obtain();
4515 data.writeInterfaceToken(IActivityManager.descriptor);
4516 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4517 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4518 reply.readException();
4519 data.recycle();
4520 reply.recycle();
4521 }
4522
4523 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4524 Parcel data = Parcel.obtain();
4525 Parcel reply = Parcel.obtain();
4526 data.writeInterfaceToken(IActivityManager.descriptor);
4527 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4528 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4529 reply.readException();
4530 data.recycle();
4531 reply.recycle();
4532 }
4533
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004534 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4535 Parcel data = Parcel.obtain();
4536 Parcel reply = Parcel.obtain();
4537 data.writeInterfaceToken(IActivityManager.descriptor);
4538 data.writeStrongBinder(sender.asBinder());
4539 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4540 reply.readException();
4541 boolean res = reply.readInt() != 0;
4542 data.recycle();
4543 reply.recycle();
4544 return res;
4545 }
4546
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004547 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4548 Parcel data = Parcel.obtain();
4549 Parcel reply = Parcel.obtain();
4550 data.writeInterfaceToken(IActivityManager.descriptor);
4551 data.writeStrongBinder(sender.asBinder());
4552 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4553 reply.readException();
4554 boolean res = reply.readInt() != 0;
4555 data.recycle();
4556 reply.recycle();
4557 return res;
4558 }
4559
Dianne Hackborn81038902012-11-26 17:04:09 -08004560 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4561 Parcel data = Parcel.obtain();
4562 Parcel reply = Parcel.obtain();
4563 data.writeInterfaceToken(IActivityManager.descriptor);
4564 data.writeStrongBinder(sender.asBinder());
4565 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4566 reply.readException();
4567 Intent res = reply.readInt() != 0
4568 ? Intent.CREATOR.createFromParcel(reply) : null;
4569 data.recycle();
4570 reply.recycle();
4571 return res;
4572 }
4573
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004574 public String getTagForIntentSender(IIntentSender sender, String prefix)
4575 throws RemoteException {
4576 Parcel data = Parcel.obtain();
4577 Parcel reply = Parcel.obtain();
4578 data.writeInterfaceToken(IActivityManager.descriptor);
4579 data.writeStrongBinder(sender.asBinder());
4580 data.writeString(prefix);
4581 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4582 reply.readException();
4583 String res = reply.readString();
4584 data.recycle();
4585 reply.recycle();
4586 return res;
4587 }
4588
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004589 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4590 {
4591 Parcel data = Parcel.obtain();
4592 Parcel reply = Parcel.obtain();
4593 data.writeInterfaceToken(IActivityManager.descriptor);
4594 values.writeToParcel(data, 0);
4595 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4596 reply.readException();
4597 data.recycle();
4598 reply.recycle();
4599 }
4600
Dianne Hackbornb437e092011-08-05 17:50:29 -07004601 public long[] getProcessPss(int[] pids) throws RemoteException {
4602 Parcel data = Parcel.obtain();
4603 Parcel reply = Parcel.obtain();
4604 data.writeInterfaceToken(IActivityManager.descriptor);
4605 data.writeIntArray(pids);
4606 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4607 reply.readException();
4608 long[] res = reply.createLongArray();
4609 data.recycle();
4610 reply.recycle();
4611 return res;
4612 }
4613
Dianne Hackborn661cd522011-08-22 00:26:20 -07004614 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4615 Parcel data = Parcel.obtain();
4616 Parcel reply = Parcel.obtain();
4617 data.writeInterfaceToken(IActivityManager.descriptor);
4618 TextUtils.writeToParcel(msg, data, 0);
4619 data.writeInt(always ? 1 : 0);
4620 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4621 reply.readException();
4622 data.recycle();
4623 reply.recycle();
4624 }
4625
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004626 public void dismissKeyguardOnNextActivity() throws RemoteException {
4627 Parcel data = Parcel.obtain();
4628 Parcel reply = Parcel.obtain();
4629 data.writeInterfaceToken(IActivityManager.descriptor);
4630 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4631 reply.readException();
4632 data.recycle();
4633 reply.recycle();
4634 }
4635
Adam Powelldd8fab22012-03-22 17:47:27 -07004636 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4637 throws RemoteException {
4638 Parcel data = Parcel.obtain();
4639 Parcel reply = Parcel.obtain();
4640 data.writeInterfaceToken(IActivityManager.descriptor);
4641 data.writeStrongBinder(token);
4642 data.writeString(destAffinity);
4643 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4644 reply.readException();
4645 boolean result = reply.readInt() != 0;
4646 data.recycle();
4647 reply.recycle();
4648 return result;
4649 }
4650
4651 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4652 throws RemoteException {
4653 Parcel data = Parcel.obtain();
4654 Parcel reply = Parcel.obtain();
4655 data.writeInterfaceToken(IActivityManager.descriptor);
4656 data.writeStrongBinder(token);
4657 target.writeToParcel(data, 0);
4658 data.writeInt(resultCode);
4659 if (resultData != null) {
4660 data.writeInt(1);
4661 resultData.writeToParcel(data, 0);
4662 } else {
4663 data.writeInt(0);
4664 }
4665 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4666 reply.readException();
4667 boolean result = reply.readInt() != 0;
4668 data.recycle();
4669 reply.recycle();
4670 return result;
4671 }
4672
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004673 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4674 Parcel data = Parcel.obtain();
4675 Parcel reply = Parcel.obtain();
4676 data.writeInterfaceToken(IActivityManager.descriptor);
4677 data.writeStrongBinder(activityToken);
4678 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4679 reply.readException();
4680 int result = reply.readInt();
4681 data.recycle();
4682 reply.recycle();
4683 return result;
4684 }
4685
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004686 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4687 Parcel data = Parcel.obtain();
4688 Parcel reply = Parcel.obtain();
4689 data.writeInterfaceToken(IActivityManager.descriptor);
4690 data.writeStrongBinder(activityToken);
4691 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4692 reply.readException();
4693 String result = reply.readString();
4694 data.recycle();
4695 reply.recycle();
4696 return result;
4697 }
4698
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004699 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4700 Parcel data = Parcel.obtain();
4701 Parcel reply = Parcel.obtain();
4702 data.writeInterfaceToken(IActivityManager.descriptor);
4703 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4704 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4705 reply.readException();
4706 data.recycle();
4707 reply.recycle();
4708 }
4709
4710 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4711 Parcel data = Parcel.obtain();
4712 Parcel reply = Parcel.obtain();
4713 data.writeInterfaceToken(IActivityManager.descriptor);
4714 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4715 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4716 reply.readException();
4717 data.recycle();
4718 reply.recycle();
4719 }
4720
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004721 public void requestBugReport() throws RemoteException {
4722 Parcel data = Parcel.obtain();
4723 Parcel reply = Parcel.obtain();
4724 data.writeInterfaceToken(IActivityManager.descriptor);
4725 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4726 reply.readException();
4727 data.recycle();
4728 reply.recycle();
4729 }
4730
Jeff Brownbd181bb2013-09-10 16:44:24 -07004731 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4732 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004733 Parcel data = Parcel.obtain();
4734 Parcel reply = Parcel.obtain();
4735 data.writeInterfaceToken(IActivityManager.descriptor);
4736 data.writeInt(pid);
4737 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004738 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004739 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4740 reply.readException();
4741 long res = reply.readInt();
4742 data.recycle();
4743 reply.recycle();
4744 return res;
4745 }
4746
Adam Skorydfc7fd72013-08-05 19:23:41 -07004747 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004748 Parcel data = Parcel.obtain();
4749 Parcel reply = Parcel.obtain();
4750 data.writeInterfaceToken(IActivityManager.descriptor);
4751 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004752 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004753 reply.readException();
4754 Bundle res = reply.readBundle();
4755 data.recycle();
4756 reply.recycle();
4757 return res;
4758 }
4759
Adam Skory7140a252013-09-11 12:04:58 +01004760 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004761 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004762 Parcel data = Parcel.obtain();
4763 Parcel reply = Parcel.obtain();
4764 data.writeInterfaceToken(IActivityManager.descriptor);
4765 data.writeStrongBinder(token);
4766 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004767 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004768 reply.readException();
4769 data.recycle();
4770 reply.recycle();
4771 }
4772
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004773 public void killUid(int uid, String reason) throws RemoteException {
4774 Parcel data = Parcel.obtain();
4775 Parcel reply = Parcel.obtain();
4776 data.writeInterfaceToken(IActivityManager.descriptor);
4777 data.writeInt(uid);
4778 data.writeString(reason);
4779 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4780 reply.readException();
4781 data.recycle();
4782 reply.recycle();
4783 }
4784
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004785 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4786 Parcel data = Parcel.obtain();
4787 Parcel reply = Parcel.obtain();
4788 data.writeInterfaceToken(IActivityManager.descriptor);
4789 data.writeStrongBinder(who);
4790 data.writeInt(allowRestart ? 1 : 0);
4791 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4792 reply.readException();
4793 data.recycle();
4794 reply.recycle();
4795 }
4796
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004797 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4798 Parcel data = Parcel.obtain();
4799 Parcel reply = Parcel.obtain();
4800 data.writeInterfaceToken(IActivityManager.descriptor);
4801 data.writeStrongBinder(token);
4802 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4803 reply.readException();
4804 data.recycle();
4805 reply.recycle();
4806 }
4807
Craig Mautner5eda9b32013-07-02 11:58:16 -07004808 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4809 Parcel data = Parcel.obtain();
4810 Parcel reply = Parcel.obtain();
4811 data.writeInterfaceToken(IActivityManager.descriptor);
4812 data.writeStrongBinder(token);
4813 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4814 reply.readException();
4815 data.recycle();
4816 reply.recycle();
4817 }
4818
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004819 public void restart() throws RemoteException {
4820 Parcel data = Parcel.obtain();
4821 Parcel reply = Parcel.obtain();
4822 data.writeInterfaceToken(IActivityManager.descriptor);
4823 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4824 reply.readException();
4825 data.recycle();
4826 reply.recycle();
4827 }
4828
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004829 public void performIdleMaintenance() throws RemoteException {
4830 Parcel data = Parcel.obtain();
4831 Parcel reply = Parcel.obtain();
4832 data.writeInterfaceToken(IActivityManager.descriptor);
4833 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4834 reply.readException();
4835 data.recycle();
4836 reply.recycle();
4837 }
4838
Craig Mautner4a1cb222013-12-04 16:14:06 -08004839 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4840 IActivityContainerCallback callback) throws RemoteException {
4841 Parcel data = Parcel.obtain();
4842 Parcel reply = Parcel.obtain();
4843 data.writeInterfaceToken(IActivityManager.descriptor);
4844 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004845 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004846 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4847 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004848 final int result = reply.readInt();
4849 final IActivityContainer res;
4850 if (result == 1) {
4851 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4852 } else {
4853 res = null;
4854 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004855 data.recycle();
4856 reply.recycle();
4857 return res;
4858 }
4859
Craig Mautner95da1082014-02-24 17:54:35 -08004860 public void deleteActivityContainer(IActivityContainer activityContainer)
4861 throws RemoteException {
4862 Parcel data = Parcel.obtain();
4863 Parcel reply = Parcel.obtain();
4864 data.writeInterfaceToken(IActivityManager.descriptor);
4865 data.writeStrongBinder(activityContainer.asBinder());
4866 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4867 reply.readException();
4868 data.recycle();
4869 reply.recycle();
4870 }
4871
Craig Mautnere0a38842013-12-16 16:14:02 -08004872 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4873 throws RemoteException {
4874 Parcel data = Parcel.obtain();
4875 Parcel reply = Parcel.obtain();
4876 data.writeInterfaceToken(IActivityManager.descriptor);
4877 data.writeStrongBinder(activityToken);
4878 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4879 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004880 final int result = reply.readInt();
4881 final IActivityContainer res;
4882 if (result == 1) {
4883 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4884 } else {
4885 res = null;
4886 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004887 data.recycle();
4888 reply.recycle();
4889 return res;
4890 }
4891
Craig Mautner4a1cb222013-12-04 16:14:06 -08004892 public IBinder getHomeActivityToken() throws RemoteException {
4893 Parcel data = Parcel.obtain();
4894 Parcel reply = Parcel.obtain();
4895 data.writeInterfaceToken(IActivityManager.descriptor);
4896 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4897 reply.readException();
4898 IBinder res = reply.readStrongBinder();
4899 data.recycle();
4900 reply.recycle();
4901 return res;
4902 }
4903
Craig Mautneraea74a52014-03-08 14:23:10 -08004904 @Override
4905 public void startLockTaskMode(int taskId) throws RemoteException {
4906 Parcel data = Parcel.obtain();
4907 Parcel reply = Parcel.obtain();
4908 data.writeInterfaceToken(IActivityManager.descriptor);
4909 data.writeInt(taskId);
4910 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4911 reply.readException();
4912 data.recycle();
4913 reply.recycle();
4914 }
4915
4916 @Override
4917 public void startLockTaskMode(IBinder token) throws RemoteException {
4918 Parcel data = Parcel.obtain();
4919 Parcel reply = Parcel.obtain();
4920 data.writeInterfaceToken(IActivityManager.descriptor);
4921 data.writeStrongBinder(token);
4922 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4923 reply.readException();
4924 data.recycle();
4925 reply.recycle();
4926 }
4927
4928 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004929 public void startLockTaskModeOnCurrent() throws RemoteException {
4930 Parcel data = Parcel.obtain();
4931 Parcel reply = Parcel.obtain();
4932 data.writeInterfaceToken(IActivityManager.descriptor);
4933 mRemote.transact(START_LOCK_TASK_BY_CURRENT, data, reply, 0);
4934 reply.readException();
4935 data.recycle();
4936 reply.recycle();
4937 }
4938
4939 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004940 public void stopLockTaskMode() throws RemoteException {
4941 Parcel data = Parcel.obtain();
4942 Parcel reply = Parcel.obtain();
4943 data.writeInterfaceToken(IActivityManager.descriptor);
4944 mRemote.transact(STOP_LOCK_TASK_MODE_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 stopLockTaskModeOnCurrent() throws RemoteException {
4952 Parcel data = Parcel.obtain();
4953 Parcel reply = Parcel.obtain();
4954 data.writeInterfaceToken(IActivityManager.descriptor);
4955 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT, data, reply, 0);
4956 reply.readException();
4957 data.recycle();
4958 reply.recycle();
4959 }
4960
4961 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004962 public boolean isInLockTaskMode() throws RemoteException {
4963 Parcel data = Parcel.obtain();
4964 Parcel reply = Parcel.obtain();
4965 data.writeInterfaceToken(IActivityManager.descriptor);
4966 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4967 reply.readException();
4968 boolean isInLockTaskMode = reply.readInt() == 1;
4969 data.recycle();
4970 reply.recycle();
4971 return isInLockTaskMode;
4972 }
4973
Craig Mautner688b5102014-03-27 16:55:03 -07004974 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07004975 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07004976 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07004977 Parcel data = Parcel.obtain();
4978 Parcel reply = Parcel.obtain();
4979 data.writeInterfaceToken(IActivityManager.descriptor);
4980 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07004981 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07004982 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07004983 reply.readException();
4984 data.recycle();
4985 reply.recycle();
4986 }
4987
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004988 private IBinder mRemote;
4989}