blob: 4a70e15e925676be97f4b5ba58976b1228fc9669 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.app;
18
Craig Mautnerbdc748af2013-12-02 14:08:25 -080019import android.app.ActivityManager.StackInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020import android.content.ComponentName;
Adam Powelldd8fab22012-03-22 17:47:27 -070021import android.content.IIntentReceiver;
22import android.content.IIntentSender;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.Intent;
24import android.content.IntentFilter;
Dianne Hackbornfa82f222009-09-17 15:14:12 -070025import android.content.IntentSender;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070026import android.content.UriPermission;
Christopher Tate181fafa2009-05-14 11:12:14 -070027import android.content.pm.ApplicationInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.pm.ConfigurationInfo;
29import android.content.pm.IPackageDataObserver;
Jeff Sharkeye66c1772013-09-20 14:30:59 -070030import android.content.pm.ParceledListSlice;
Amith Yamasani52f1d752012-03-28 18:19:29 -070031import android.content.pm.UserInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.res.Configuration;
33import android.graphics.Bitmap;
Craig Mautnerbdc748af2013-12-02 14:08:25 -080034import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080035import android.net.Uri;
36import android.os.Binder;
37import android.os.Bundle;
Dianne Hackborn3025ef32009-08-31 21:31:47 -070038import android.os.Debug;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080039import android.os.IBinder;
40import android.os.Parcel;
Adam Powelldd8fab22012-03-22 17:47:27 -070041import android.os.ParcelFileDescriptor;
42import android.os.Parcelable;
Craig Mautnera0026042014-04-23 11:45:37 -070043import android.os.PersistableBundle;
Adam Powelldd8fab22012-03-22 17:47:27 -070044import android.os.RemoteException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.os.ServiceManager;
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -070046import android.os.StrictMode;
Dianne Hackborn91097de2014-04-04 18:02:06 -070047import android.service.voice.IVoiceInteractionSession;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import android.text.TextUtils;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049import android.util.Log;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080050import android.util.Singleton;
Dianne Hackborn91097de2014-04-04 18:02:06 -070051import com.android.internal.app.IVoiceInteractor;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053import java.util.ArrayList;
54import java.util.List;
55
56/** {@hide} */
57public abstract class ActivityManagerNative extends Binder implements IActivityManager
58{
59 /**
60 * Cast a Binder object into an activity manager interface, generating
61 * a proxy if needed.
62 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080063 static public IActivityManager asInterface(IBinder obj) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064 if (obj == null) {
65 return null;
66 }
67 IActivityManager in =
68 (IActivityManager)obj.queryLocalInterface(descriptor);
69 if (in != null) {
70 return in;
71 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073 return new ActivityManagerProxy(obj);
74 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080076 /**
77 * Retrieve the system's default/global activity manager.
78 */
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080079 static public IActivityManager getDefault() {
80 return gDefault.get();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 }
82
83 /**
84 * Convenience for checking whether the system is ready. For internal use only.
85 */
86 static public boolean isSystemReady() {
87 if (!sSystemReady) {
88 sSystemReady = getDefault().testIsSystemReady();
89 }
90 return sSystemReady;
91 }
92 static boolean sSystemReady = false;
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -080093
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 /**
95 * Convenience for sending a sticky broadcast. For internal use only.
96 * If you don't care about permission, use null.
97 */
Dianne Hackborn5ac72a22012-08-29 18:32:08 -070098 static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099 try {
100 getDefault().broadcastIntent(
101 null, intent, null, null, Activity.RESULT_OK, null, null,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800102 null /*permission*/, AppOpsManager.OP_NONE, false, true, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 } catch (RemoteException ex) {
104 }
105 }
106
Dianne Hackborn099bc622014-01-22 13:39:16 -0800107 static public void noteWakeupAlarm(PendingIntent ps, int sourceUid, String sourcePkg) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 try {
Dianne Hackborn099bc622014-01-22 13:39:16 -0800109 getDefault().noteWakeupAlarm(ps.getTarget(), sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 } catch (RemoteException ex) {
111 }
112 }
113
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -0800114 public ActivityManagerNative() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800115 attachInterface(this, descriptor);
116 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700117
118 @Override
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800119 public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
120 throws RemoteException {
121 switch (code) {
122 case START_ACTIVITY_TRANSACTION:
123 {
124 data.enforceInterface(IActivityManager.descriptor);
125 IBinder b = data.readStrongBinder();
126 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800127 String callingPackage = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800128 Intent intent = Intent.CREATOR.createFromParcel(data);
129 String resolvedType = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800131 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800132 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700133 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700134 String profileFile = data.readString();
135 ParcelFileDescriptor profileFd = data.readInt() != 0
136 ? data.readFileDescriptor() : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700137 Bundle options = data.readInt() != 0
138 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800139 int result = startActivity(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700140 resultTo, resultWho, requestCode, startFlags,
141 profileFile, profileFd, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800142 reply.writeNoException();
143 reply.writeInt(result);
144 return true;
145 }
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700146
Amith Yamasani82644082012-08-03 13:09:11 -0700147 case START_ACTIVITY_AS_USER_TRANSACTION:
148 {
149 data.enforceInterface(IActivityManager.descriptor);
150 IBinder b = data.readStrongBinder();
151 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800152 String callingPackage = data.readString();
Amith Yamasani82644082012-08-03 13:09:11 -0700153 Intent intent = Intent.CREATOR.createFromParcel(data);
154 String resolvedType = data.readString();
155 IBinder resultTo = data.readStrongBinder();
156 String resultWho = data.readString();
157 int requestCode = data.readInt();
158 int startFlags = data.readInt();
159 String profileFile = data.readString();
160 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700161 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Amith Yamasani82644082012-08-03 13:09:11 -0700162 Bundle options = data.readInt() != 0
163 ? Bundle.CREATOR.createFromParcel(data) : null;
164 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800165 int result = startActivityAsUser(app, callingPackage, intent, resolvedType,
Amith Yamasani82644082012-08-03 13:09:11 -0700166 resultTo, resultWho, requestCode, startFlags,
167 profileFile, profileFd, options, userId);
168 reply.writeNoException();
169 reply.writeInt(result);
170 return true;
171 }
172
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800173 case START_ACTIVITY_AND_WAIT_TRANSACTION:
174 {
175 data.enforceInterface(IActivityManager.descriptor);
176 IBinder b = data.readStrongBinder();
177 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800178 String callingPackage = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800179 Intent intent = Intent.CREATOR.createFromParcel(data);
180 String resolvedType = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800181 IBinder resultTo = data.readStrongBinder();
Siva Velusamy92a8b222012-03-09 16:24:04 -0800182 String resultWho = data.readString();
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800183 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700184 int startFlags = data.readInt();
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700185 String profileFile = data.readString();
186 ParcelFileDescriptor profileFd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -0700187 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborna4972e92012-03-14 10:38:05 -0700188 Bundle options = data.readInt() != 0
189 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700190 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800191 WaitResult result = startActivityAndWait(app, callingPackage, intent, resolvedType,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700192 resultTo, resultWho, requestCode, startFlags,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700193 profileFile, profileFd, options, userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -0800194 reply.writeNoException();
195 result.writeToParcel(reply, 0);
196 return true;
197 }
198
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700199 case START_ACTIVITY_WITH_CONFIG_TRANSACTION:
200 {
201 data.enforceInterface(IActivityManager.descriptor);
202 IBinder b = data.readStrongBinder();
203 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800204 String callingPackage = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700205 Intent intent = Intent.CREATOR.createFromParcel(data);
206 String resolvedType = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700207 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700208 String resultWho = data.readString();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700209 int requestCode = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700210 int startFlags = data.readInt();
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700211 Configuration config = Configuration.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700212 Bundle options = data.readInt() != 0
213 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -0700214 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -0800215 int result = startActivityWithConfig(app, callingPackage, intent, resolvedType,
Dianne Hackborn41203752012-08-31 14:05:51 -0700216 resultTo, resultWho, requestCode, startFlags, config, options, userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -0700217 reply.writeNoException();
218 reply.writeInt(result);
219 return true;
220 }
221
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700222 case START_ACTIVITY_INTENT_SENDER_TRANSACTION:
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700223 {
224 data.enforceInterface(IActivityManager.descriptor);
225 IBinder b = data.readStrongBinder();
226 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700227 IntentSender intent = IntentSender.CREATOR.createFromParcel(data);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700228 Intent fillInIntent = null;
229 if (data.readInt() != 0) {
230 fillInIntent = Intent.CREATOR.createFromParcel(data);
231 }
232 String resolvedType = data.readString();
233 IBinder resultTo = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700234 String resultWho = data.readString();
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700235 int requestCode = data.readInt();
236 int flagsMask = data.readInt();
237 int flagsValues = data.readInt();
Dianne Hackborna4972e92012-03-14 10:38:05 -0700238 Bundle options = data.readInt() != 0
239 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackbornfa82f222009-09-17 15:14:12 -0700240 int result = startActivityIntentSender(app, intent,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700241 fillInIntent, resolvedType, resultTo, resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -0700242 requestCode, flagsMask, flagsValues, options);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -0700243 reply.writeNoException();
244 reply.writeInt(result);
245 return true;
246 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700247
Dianne Hackborn91097de2014-04-04 18:02:06 -0700248 case START_VOICE_ACTIVITY_TRANSACTION:
249 {
250 data.enforceInterface(IActivityManager.descriptor);
251 String callingPackage = data.readString();
252 int callingPid = data.readInt();
253 int callingUid = data.readInt();
254 Intent intent = Intent.CREATOR.createFromParcel(data);
255 String resolvedType = data.readString();
256 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
257 data.readStrongBinder());
258 IVoiceInteractor interactor = IVoiceInteractor.Stub.asInterface(
259 data.readStrongBinder());
260 int startFlags = data.readInt();
261 String profileFile = data.readString();
262 ParcelFileDescriptor profileFd = data.readInt() != 0
263 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
264 Bundle options = data.readInt() != 0
265 ? Bundle.CREATOR.createFromParcel(data) : null;
266 int userId = data.readInt();
267 int result = startVoiceActivity(callingPackage, callingPid, callingUid,
268 intent, resolvedType, session, interactor, startFlags,
269 profileFile, profileFd, options, userId);
270 reply.writeNoException();
271 reply.writeInt(result);
272 return true;
273 }
274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 case START_NEXT_MATCHING_ACTIVITY_TRANSACTION:
276 {
277 data.enforceInterface(IActivityManager.descriptor);
278 IBinder callingActivity = data.readStrongBinder();
279 Intent intent = Intent.CREATOR.createFromParcel(data);
Dianne Hackborna4972e92012-03-14 10:38:05 -0700280 Bundle options = data.readInt() != 0
281 ? Bundle.CREATOR.createFromParcel(data) : null;
282 boolean result = startNextMatchingActivity(callingActivity, intent, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 reply.writeNoException();
284 reply.writeInt(result ? 1 : 0);
285 return true;
286 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700287
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 case FINISH_ACTIVITY_TRANSACTION: {
289 data.enforceInterface(IActivityManager.descriptor);
290 IBinder token = data.readStrongBinder();
291 Intent resultData = null;
292 int resultCode = data.readInt();
293 if (data.readInt() != 0) {
294 resultData = Intent.CREATOR.createFromParcel(data);
295 }
Winson Chung3b3f4642014-04-22 10:08:18 -0700296 boolean finishTask = (data.readInt() != 0);
297 boolean res = finishActivity(token, resultCode, resultData, finishTask);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800298 reply.writeNoException();
299 reply.writeInt(res ? 1 : 0);
300 return true;
301 }
302
303 case FINISH_SUB_ACTIVITY_TRANSACTION: {
304 data.enforceInterface(IActivityManager.descriptor);
305 IBinder token = data.readStrongBinder();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700306 String resultWho = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800307 int requestCode = data.readInt();
308 finishSubActivity(token, resultWho, requestCode);
309 reply.writeNoException();
310 return true;
311 }
312
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -0700313 case FINISH_ACTIVITY_AFFINITY_TRANSACTION: {
314 data.enforceInterface(IActivityManager.descriptor);
315 IBinder token = data.readStrongBinder();
316 boolean res = finishActivityAffinity(token);
317 reply.writeNoException();
318 reply.writeInt(res ? 1 : 0);
319 return true;
320 }
321
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -0700322 case FINISH_VOICE_TASK_TRANSACTION: {
323 data.enforceInterface(IActivityManager.descriptor);
324 IVoiceInteractionSession session = IVoiceInteractionSession.Stub.asInterface(
325 data.readStrongBinder());
326 finishVoiceTask(session);
327 reply.writeNoException();
328 return true;
329 }
330
Dianne Hackborn061d58a2010-03-12 15:07:06 -0800331 case WILL_ACTIVITY_BE_VISIBLE_TRANSACTION: {
332 data.enforceInterface(IActivityManager.descriptor);
333 IBinder token = data.readStrongBinder();
334 boolean res = willActivityBeVisible(token);
335 reply.writeNoException();
336 reply.writeInt(res ? 1 : 0);
337 return true;
338 }
339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 case REGISTER_RECEIVER_TRANSACTION:
341 {
342 data.enforceInterface(IActivityManager.descriptor);
343 IBinder b = data.readStrongBinder();
344 IApplicationThread app =
345 b != null ? ApplicationThreadNative.asInterface(b) : null;
Dianne Hackborn6c418d52011-06-29 14:05:33 -0700346 String packageName = data.readString();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800347 b = data.readStrongBinder();
348 IIntentReceiver rec
349 = b != null ? IIntentReceiver.Stub.asInterface(b) : null;
350 IntentFilter filter = IntentFilter.CREATOR.createFromParcel(data);
351 String perm = data.readString();
Dianne Hackborn20e80982012-08-31 19:00:44 -0700352 int userId = data.readInt();
353 Intent intent = registerReceiver(app, packageName, rec, filter, perm, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 reply.writeNoException();
355 if (intent != null) {
356 reply.writeInt(1);
357 intent.writeToParcel(reply, 0);
358 } else {
359 reply.writeInt(0);
360 }
361 return true;
362 }
363
364 case UNREGISTER_RECEIVER_TRANSACTION:
365 {
366 data.enforceInterface(IActivityManager.descriptor);
367 IBinder b = data.readStrongBinder();
368 if (b == null) {
369 return true;
370 }
371 IIntentReceiver rec = IIntentReceiver.Stub.asInterface(b);
372 unregisterReceiver(rec);
373 reply.writeNoException();
374 return true;
375 }
376
377 case BROADCAST_INTENT_TRANSACTION:
378 {
379 data.enforceInterface(IActivityManager.descriptor);
380 IBinder b = data.readStrongBinder();
381 IApplicationThread app =
382 b != null ? ApplicationThreadNative.asInterface(b) : null;
383 Intent intent = Intent.CREATOR.createFromParcel(data);
384 String resolvedType = data.readString();
385 b = data.readStrongBinder();
386 IIntentReceiver resultTo =
387 b != null ? IIntentReceiver.Stub.asInterface(b) : null;
388 int resultCode = data.readInt();
389 String resultData = data.readString();
390 Bundle resultExtras = data.readBundle();
391 String perm = data.readString();
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800392 int appOp = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 boolean serialized = data.readInt() != 0;
394 boolean sticky = data.readInt() != 0;
Amith Yamasani742a6712011-05-04 14:49:28 -0700395 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 int res = broadcastIntent(app, intent, resolvedType, resultTo,
Dianne Hackbornf51f6122013-02-04 18:23:34 -0800397 resultCode, resultData, resultExtras, perm, appOp,
Amith Yamasani742a6712011-05-04 14:49:28 -0700398 serialized, sticky, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 reply.writeNoException();
400 reply.writeInt(res);
401 return true;
402 }
403
404 case UNBROADCAST_INTENT_TRANSACTION:
405 {
406 data.enforceInterface(IActivityManager.descriptor);
407 IBinder b = data.readStrongBinder();
408 IApplicationThread app = b != null ? ApplicationThreadNative.asInterface(b) : null;
409 Intent intent = Intent.CREATOR.createFromParcel(data);
Amith Yamasani742a6712011-05-04 14:49:28 -0700410 int userId = data.readInt();
411 unbroadcastIntent(app, intent, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800412 reply.writeNoException();
413 return true;
414 }
415
416 case FINISH_RECEIVER_TRANSACTION: {
417 data.enforceInterface(IActivityManager.descriptor);
418 IBinder who = data.readStrongBinder();
419 int resultCode = data.readInt();
420 String resultData = data.readString();
421 Bundle resultExtras = data.readBundle();
422 boolean resultAbort = data.readInt() != 0;
423 if (who != null) {
424 finishReceiver(who, resultCode, resultData, resultExtras, resultAbort);
425 }
426 reply.writeNoException();
427 return true;
428 }
429
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 case ATTACH_APPLICATION_TRANSACTION: {
431 data.enforceInterface(IActivityManager.descriptor);
432 IApplicationThread app = ApplicationThreadNative.asInterface(
433 data.readStrongBinder());
434 if (app != null) {
435 attachApplication(app);
436 }
437 reply.writeNoException();
438 return true;
439 }
440
441 case ACTIVITY_IDLE_TRANSACTION: {
442 data.enforceInterface(IActivityManager.descriptor);
443 IBinder token = data.readStrongBinder();
Dianne Hackborne88846e2009-09-30 21:34:25 -0700444 Configuration config = null;
445 if (data.readInt() != 0) {
446 config = Configuration.CREATOR.createFromParcel(data);
447 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700448 boolean stopProfiling = data.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 if (token != null) {
Dianne Hackborn62f20ec2011-08-15 17:40:28 -0700450 activityIdle(token, config, stopProfiling);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800451 }
452 reply.writeNoException();
453 return true;
454 }
455
Dianne Hackbornad9b32112012-09-17 15:35:01 -0700456 case ACTIVITY_RESUMED_TRANSACTION: {
457 data.enforceInterface(IActivityManager.descriptor);
458 IBinder token = data.readStrongBinder();
459 activityResumed(token);
460 reply.writeNoException();
461 return true;
462 }
463
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800464 case ACTIVITY_PAUSED_TRANSACTION: {
465 data.enforceInterface(IActivityManager.descriptor);
466 IBinder token = data.readStrongBinder();
Craig Mautnera0026042014-04-23 11:45:37 -0700467 PersistableBundle persistentState = data.readPersistableBundle();
468 activityPaused(token, persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 reply.writeNoException();
470 return true;
471 }
472
473 case ACTIVITY_STOPPED_TRANSACTION: {
474 data.enforceInterface(IActivityManager.descriptor);
475 IBinder token = data.readStrongBinder();
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800476 Bundle map = data.readBundle();
Craig Mautnera0026042014-04-23 11:45:37 -0700477 PersistableBundle persistentState = data.readPersistableBundle();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 CharSequence description = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
Craig Mautnera0026042014-04-23 11:45:37 -0700479 activityStopped(token, map, persistentState, description);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800480 reply.writeNoException();
481 return true;
482 }
483
Dianne Hackborn4eba96b2011-01-21 13:34:36 -0800484 case ACTIVITY_SLEPT_TRANSACTION: {
485 data.enforceInterface(IActivityManager.descriptor);
486 IBinder token = data.readStrongBinder();
487 activitySlept(token);
488 reply.writeNoException();
489 return true;
490 }
491
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800492 case ACTIVITY_DESTROYED_TRANSACTION: {
493 data.enforceInterface(IActivityManager.descriptor);
494 IBinder token = data.readStrongBinder();
495 activityDestroyed(token);
496 reply.writeNoException();
497 return true;
498 }
499
500 case GET_CALLING_PACKAGE_TRANSACTION: {
501 data.enforceInterface(IActivityManager.descriptor);
502 IBinder token = data.readStrongBinder();
503 String res = token != null ? getCallingPackage(token) : null;
504 reply.writeNoException();
505 reply.writeString(res);
506 return true;
507 }
508
509 case GET_CALLING_ACTIVITY_TRANSACTION: {
510 data.enforceInterface(IActivityManager.descriptor);
511 IBinder token = data.readStrongBinder();
512 ComponentName cn = getCallingActivity(token);
513 reply.writeNoException();
514 ComponentName.writeToParcel(cn, reply);
515 return true;
516 }
517
Winson Chung1147c402014-05-14 11:05:00 -0700518 case GET_APP_TASKS_TRANSACTION: {
519 data.enforceInterface(IActivityManager.descriptor);
520 List<IAppTask> list = getAppTasks();
521 reply.writeNoException();
522 int N = list != null ? list.size() : -1;
523 reply.writeInt(N);
524 int i;
525 for (i=0; i<N; i++) {
526 IAppTask task = list.get(i);
527 reply.writeStrongBinder(task.asBinder());
528 }
529 return true;
530 }
531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 case GET_TASKS_TRANSACTION: {
533 data.enforceInterface(IActivityManager.descriptor);
534 int maxNum = data.readInt();
535 int fl = data.readInt();
Dianne Hackborn09233282014-04-30 11:33:59 -0700536 List<ActivityManager.RunningTaskInfo> list = getTasks(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 reply.writeNoException();
538 int N = list != null ? list.size() : -1;
539 reply.writeInt(N);
540 int i;
541 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700542 ActivityManager.RunningTaskInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800543 info.writeToParcel(reply, 0);
544 }
545 return true;
546 }
547
548 case GET_RECENT_TASKS_TRANSACTION: {
549 data.enforceInterface(IActivityManager.descriptor);
550 int maxNum = data.readInt();
551 int fl = data.readInt();
Amith Yamasani82644082012-08-03 13:09:11 -0700552 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800553 List<ActivityManager.RecentTaskInfo> list = getRecentTasks(maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -0700554 fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800555 reply.writeNoException();
556 reply.writeTypedList(list);
557 return true;
558 }
Dianne Hackborn15491c62012-09-19 10:59:14 -0700559
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700560 case GET_TASK_THUMBNAIL_TRANSACTION: {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800561 data.enforceInterface(IActivityManager.descriptor);
562 int id = data.readInt();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700563 ActivityManager.TaskThumbnail taskThumbnail = getTaskThumbnail(id);
Dianne Hackbornd94df452011-02-16 18:53:31 -0800564 reply.writeNoException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700565 if (taskThumbnail != null) {
Dianne Hackbornd94df452011-02-16 18:53:31 -0800566 reply.writeInt(1);
Craig Mautnerc0ffce52014-07-01 12:38:52 -0700567 taskThumbnail.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn15491c62012-09-19 10:59:14 -0700568 } else {
569 reply.writeInt(0);
570 }
571 return true;
572 }
573
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800574 case GET_SERVICES_TRANSACTION: {
575 data.enforceInterface(IActivityManager.descriptor);
576 int maxNum = data.readInt();
577 int fl = data.readInt();
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700578 List<ActivityManager.RunningServiceInfo> list = getServices(maxNum, fl);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 reply.writeNoException();
580 int N = list != null ? list.size() : -1;
581 reply.writeInt(N);
582 int i;
583 for (i=0; i<N; i++) {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700584 ActivityManager.RunningServiceInfo info = list.get(i);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800585 info.writeToParcel(reply, 0);
586 }
587 return true;
588 }
589
590 case GET_PROCESSES_IN_ERROR_STATE_TRANSACTION: {
591 data.enforceInterface(IActivityManager.descriptor);
592 List<ActivityManager.ProcessErrorStateInfo> list = getProcessesInErrorState();
593 reply.writeNoException();
594 reply.writeTypedList(list);
595 return true;
596 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -0700597
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 case GET_RUNNING_APP_PROCESSES_TRANSACTION: {
599 data.enforceInterface(IActivityManager.descriptor);
600 List<ActivityManager.RunningAppProcessInfo> list = getRunningAppProcesses();
601 reply.writeNoException();
602 reply.writeTypedList(list);
603 return true;
604 }
605
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -0700606 case GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION: {
607 data.enforceInterface(IActivityManager.descriptor);
608 List<ApplicationInfo> list = getRunningExternalApplications();
609 reply.writeNoException();
610 reply.writeTypedList(list);
611 return true;
612 }
613
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800614 case MOVE_TASK_TO_FRONT_TRANSACTION: {
615 data.enforceInterface(IActivityManager.descriptor);
616 int task = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -0800617 int fl = data.readInt();
Dianne Hackborn8078d8c2012-03-20 11:11:26 -0700618 Bundle options = data.readInt() != 0
619 ? Bundle.CREATOR.createFromParcel(data) : null;
620 moveTaskToFront(task, fl, options);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 reply.writeNoException();
622 return true;
623 }
624
625 case MOVE_TASK_TO_BACK_TRANSACTION: {
626 data.enforceInterface(IActivityManager.descriptor);
627 int task = data.readInt();
628 moveTaskToBack(task);
629 reply.writeNoException();
630 return true;
631 }
632
633 case MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION: {
634 data.enforceInterface(IActivityManager.descriptor);
635 IBinder token = data.readStrongBinder();
636 boolean nonRoot = data.readInt() != 0;
637 boolean res = moveActivityTaskToBack(token, nonRoot);
638 reply.writeNoException();
639 reply.writeInt(res ? 1 : 0);
640 return true;
641 }
642
643 case MOVE_TASK_BACKWARDS_TRANSACTION: {
644 data.enforceInterface(IActivityManager.descriptor);
645 int task = data.readInt();
646 moveTaskBackwards(task);
647 reply.writeNoException();
648 return true;
649 }
650
Craig Mautnerc00204b2013-03-05 15:02:14 -0800651 case MOVE_TASK_TO_STACK_TRANSACTION: {
652 data.enforceInterface(IActivityManager.descriptor);
653 int taskId = data.readInt();
654 int stackId = data.readInt();
655 boolean toTop = data.readInt() != 0;
656 moveTaskToStack(taskId, stackId, toTop);
657 reply.writeNoException();
658 return true;
659 }
660
661 case RESIZE_STACK_TRANSACTION: {
662 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800663 int stackId = data.readInt();
Craig Mautnerc00204b2013-03-05 15:02:14 -0800664 float weight = data.readFloat();
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800665 Rect r = Rect.CREATOR.createFromParcel(data);
666 resizeStack(stackId, r);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800667 reply.writeNoException();
668 return true;
669 }
670
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800671 case GET_ALL_STACK_INFOS_TRANSACTION: {
Craig Mautner5ff12102013-05-24 12:50:15 -0700672 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800673 List<StackInfo> list = getAllStackInfos();
Craig Mautner5ff12102013-05-24 12:50:15 -0700674 reply.writeNoException();
675 reply.writeTypedList(list);
676 return true;
677 }
678
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800679 case GET_STACK_INFO_TRANSACTION: {
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700680 data.enforceInterface(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -0800681 int stackId = data.readInt();
682 StackInfo info = getStackInfo(stackId);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -0700683 reply.writeNoException();
684 if (info != null) {
685 reply.writeInt(1);
686 info.writeToParcel(reply, 0);
687 } else {
688 reply.writeInt(0);
689 }
690 return true;
691 }
692
Winson Chung303e1ff2014-03-07 15:06:19 -0800693 case IS_IN_HOME_STACK_TRANSACTION: {
694 data.enforceInterface(IActivityManager.descriptor);
695 int taskId = data.readInt();
696 boolean isInHomeStack = isInHomeStack(taskId);
697 reply.writeNoException();
698 reply.writeInt(isInHomeStack ? 1 : 0);
699 return true;
700 }
701
Craig Mautnercf910b02013-04-23 11:23:27 -0700702 case SET_FOCUSED_STACK_TRANSACTION: {
703 data.enforceInterface(IActivityManager.descriptor);
704 int stackId = data.readInt();
705 setFocusedStack(stackId);
706 reply.writeNoException();
707 return true;
708 }
709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
711 data.enforceInterface(IActivityManager.descriptor);
712 IBinder token = data.readStrongBinder();
713 boolean onlyRoot = data.readInt() != 0;
714 int res = token != null
715 ? getTaskForActivity(token, onlyRoot) : -1;
716 reply.writeNoException();
717 reply.writeInt(res);
718 return true;
719 }
720
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800721 case GET_CONTENT_PROVIDER_TRANSACTION: {
722 data.enforceInterface(IActivityManager.descriptor);
723 IBinder b = data.readStrongBinder();
724 IApplicationThread app = ApplicationThreadNative.asInterface(b);
725 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700726 int userId = data.readInt();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700727 boolean stable = data.readInt() != 0;
Jeff Sharkey6d515712012-09-20 16:06:08 -0700728 ContentProviderHolder cph = getContentProvider(app, name, userId, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800729 reply.writeNoException();
730 if (cph != null) {
731 reply.writeInt(1);
732 cph.writeToParcel(reply, 0);
733 } else {
734 reply.writeInt(0);
735 }
736 return true;
737 }
738
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800739 case GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
740 data.enforceInterface(IActivityManager.descriptor);
741 String name = data.readString();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700742 int userId = data.readInt();
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800743 IBinder token = data.readStrongBinder();
Jeff Sharkey6d515712012-09-20 16:06:08 -0700744 ContentProviderHolder cph = getContentProviderExternal(name, userId, token);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800745 reply.writeNoException();
746 if (cph != null) {
747 reply.writeInt(1);
748 cph.writeToParcel(reply, 0);
749 } else {
750 reply.writeInt(0);
751 }
752 return true;
753 }
754
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800755 case PUBLISH_CONTENT_PROVIDERS_TRANSACTION: {
756 data.enforceInterface(IActivityManager.descriptor);
757 IBinder b = data.readStrongBinder();
758 IApplicationThread app = ApplicationThreadNative.asInterface(b);
759 ArrayList<ContentProviderHolder> providers =
760 data.createTypedArrayList(ContentProviderHolder.CREATOR);
761 publishContentProviders(app, providers);
762 reply.writeNoException();
763 return true;
764 }
765
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700766 case REF_CONTENT_PROVIDER_TRANSACTION: {
767 data.enforceInterface(IActivityManager.descriptor);
768 IBinder b = data.readStrongBinder();
769 int stable = data.readInt();
770 int unstable = data.readInt();
771 boolean res = refContentProvider(b, stable, unstable);
772 reply.writeNoException();
773 reply.writeInt(res ? 1 : 0);
774 return true;
775 }
776
777 case UNSTABLE_PROVIDER_DIED_TRANSACTION: {
778 data.enforceInterface(IActivityManager.descriptor);
779 IBinder b = data.readStrongBinder();
780 unstableProviderDied(b);
781 reply.writeNoException();
782 return true;
783 }
784
Jeff Sharkey7aa76012013-09-30 14:26:27 -0700785 case APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION: {
786 data.enforceInterface(IActivityManager.descriptor);
787 IBinder b = data.readStrongBinder();
788 appNotRespondingViaProvider(b);
789 reply.writeNoException();
790 return true;
791 }
792
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800793 case REMOVE_CONTENT_PROVIDER_TRANSACTION: {
794 data.enforceInterface(IActivityManager.descriptor);
795 IBinder b = data.readStrongBinder();
Dianne Hackborn6ae8d182012-05-23 13:12:42 -0700796 boolean stable = data.readInt() != 0;
797 removeContentProvider(b, stable);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800798 reply.writeNoException();
799 return true;
800 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -0800801
802 case REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION: {
803 data.enforceInterface(IActivityManager.descriptor);
804 String name = data.readString();
805 IBinder token = data.readStrongBinder();
806 removeContentProviderExternal(name, token);
807 reply.writeNoException();
808 return true;
809 }
810
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700811 case GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION: {
812 data.enforceInterface(IActivityManager.descriptor);
813 ComponentName comp = ComponentName.CREATOR.createFromParcel(data);
814 PendingIntent pi = getRunningServiceControlPanel(comp);
815 reply.writeNoException();
816 PendingIntent.writePendingIntentOrNullToParcel(pi, reply);
817 return true;
818 }
819
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800820 case START_SERVICE_TRANSACTION: {
821 data.enforceInterface(IActivityManager.descriptor);
822 IBinder b = data.readStrongBinder();
823 IApplicationThread app = ApplicationThreadNative.asInterface(b);
824 Intent service = Intent.CREATOR.createFromParcel(data);
825 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700826 int userId = data.readInt();
827 ComponentName cn = startService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800828 reply.writeNoException();
829 ComponentName.writeToParcel(cn, reply);
830 return true;
831 }
832
833 case STOP_SERVICE_TRANSACTION: {
834 data.enforceInterface(IActivityManager.descriptor);
835 IBinder b = data.readStrongBinder();
836 IApplicationThread app = ApplicationThreadNative.asInterface(b);
837 Intent service = Intent.CREATOR.createFromParcel(data);
838 String resolvedType = data.readString();
Dianne Hackborn7767eac2012-08-23 18:25:40 -0700839 int userId = data.readInt();
840 int res = stopService(app, service, resolvedType, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800841 reply.writeNoException();
842 reply.writeInt(res);
843 return true;
844 }
845
846 case STOP_SERVICE_TOKEN_TRANSACTION: {
847 data.enforceInterface(IActivityManager.descriptor);
848 ComponentName className = ComponentName.readFromParcel(data);
849 IBinder token = data.readStrongBinder();
850 int startId = data.readInt();
851 boolean res = stopServiceToken(className, token, startId);
852 reply.writeNoException();
853 reply.writeInt(res ? 1 : 0);
854 return true;
855 }
856
857 case SET_SERVICE_FOREGROUND_TRANSACTION: {
858 data.enforceInterface(IActivityManager.descriptor);
859 ComponentName className = ComponentName.readFromParcel(data);
860 IBinder token = data.readStrongBinder();
Dianne Hackbornd8a43f62009-08-17 23:33:56 -0700861 int id = data.readInt();
862 Notification notification = null;
863 if (data.readInt() != 0) {
864 notification = Notification.CREATOR.createFromParcel(data);
865 }
866 boolean removeNotification = data.readInt() != 0;
867 setServiceForeground(className, token, id, notification, removeNotification);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800868 reply.writeNoException();
869 return true;
870 }
871
872 case BIND_SERVICE_TRANSACTION: {
873 data.enforceInterface(IActivityManager.descriptor);
874 IBinder b = data.readStrongBinder();
875 IApplicationThread app = ApplicationThreadNative.asInterface(b);
876 IBinder token = data.readStrongBinder();
877 Intent service = Intent.CREATOR.createFromParcel(data);
878 String resolvedType = data.readString();
879 b = data.readStrongBinder();
880 int fl = data.readInt();
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800881 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800882 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
Amith Yamasani37ce3a82012-02-06 12:04:42 -0800883 int res = bindService(app, token, service, resolvedType, conn, fl, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800884 reply.writeNoException();
885 reply.writeInt(res);
886 return true;
887 }
888
889 case UNBIND_SERVICE_TRANSACTION: {
890 data.enforceInterface(IActivityManager.descriptor);
891 IBinder b = data.readStrongBinder();
892 IServiceConnection conn = IServiceConnection.Stub.asInterface(b);
893 boolean res = unbindService(conn);
894 reply.writeNoException();
895 reply.writeInt(res ? 1 : 0);
896 return true;
897 }
898
899 case PUBLISH_SERVICE_TRANSACTION: {
900 data.enforceInterface(IActivityManager.descriptor);
901 IBinder token = data.readStrongBinder();
902 Intent intent = Intent.CREATOR.createFromParcel(data);
903 IBinder service = data.readStrongBinder();
904 publishService(token, intent, service);
905 reply.writeNoException();
906 return true;
907 }
908
909 case UNBIND_FINISHED_TRANSACTION: {
910 data.enforceInterface(IActivityManager.descriptor);
911 IBinder token = data.readStrongBinder();
912 Intent intent = Intent.CREATOR.createFromParcel(data);
913 boolean doRebind = data.readInt() != 0;
914 unbindFinished(token, intent, doRebind);
915 reply.writeNoException();
916 return true;
917 }
918
919 case SERVICE_DONE_EXECUTING_TRANSACTION: {
920 data.enforceInterface(IActivityManager.descriptor);
921 IBinder token = data.readStrongBinder();
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700922 int type = data.readInt();
923 int startId = data.readInt();
924 int res = data.readInt();
925 serviceDoneExecuting(token, type, startId, res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800926 reply.writeNoException();
927 return true;
928 }
929
930 case START_INSTRUMENTATION_TRANSACTION: {
931 data.enforceInterface(IActivityManager.descriptor);
932 ComponentName className = ComponentName.readFromParcel(data);
933 String profileFile = data.readString();
934 int fl = data.readInt();
935 Bundle arguments = data.readBundle();
936 IBinder b = data.readStrongBinder();
937 IInstrumentationWatcher w = IInstrumentationWatcher.Stub.asInterface(b);
Svetoslav Ganov80943d82013-01-02 10:25:37 -0800938 b = data.readStrongBinder();
939 IUiAutomationConnection c = IUiAutomationConnection.Stub.asInterface(b);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -0700940 int userId = data.readInt();
Narayan Kamath8dcfefd2014-05-15 18:12:59 +0100941 String abiOverride = data.readString();
942 boolean res = startInstrumentation(className, profileFile, fl, arguments, w, c, userId,
943 abiOverride);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 reply.writeNoException();
945 reply.writeInt(res ? 1 : 0);
946 return true;
947 }
948
949
950 case FINISH_INSTRUMENTATION_TRANSACTION: {
951 data.enforceInterface(IActivityManager.descriptor);
952 IBinder b = data.readStrongBinder();
953 IApplicationThread app = ApplicationThreadNative.asInterface(b);
954 int resultCode = data.readInt();
955 Bundle results = data.readBundle();
956 finishInstrumentation(app, resultCode, results);
957 reply.writeNoException();
958 return true;
959 }
960
961 case GET_CONFIGURATION_TRANSACTION: {
962 data.enforceInterface(IActivityManager.descriptor);
963 Configuration config = getConfiguration();
964 reply.writeNoException();
965 config.writeToParcel(reply, 0);
966 return true;
967 }
968
969 case UPDATE_CONFIGURATION_TRANSACTION: {
970 data.enforceInterface(IActivityManager.descriptor);
971 Configuration config = Configuration.CREATOR.createFromParcel(data);
972 updateConfiguration(config);
973 reply.writeNoException();
974 return true;
975 }
976
977 case SET_REQUESTED_ORIENTATION_TRANSACTION: {
978 data.enforceInterface(IActivityManager.descriptor);
979 IBinder token = data.readStrongBinder();
980 int requestedOrientation = data.readInt();
981 setRequestedOrientation(token, requestedOrientation);
982 reply.writeNoException();
983 return true;
984 }
985
986 case GET_REQUESTED_ORIENTATION_TRANSACTION: {
987 data.enforceInterface(IActivityManager.descriptor);
988 IBinder token = data.readStrongBinder();
989 int req = getRequestedOrientation(token);
990 reply.writeNoException();
991 reply.writeInt(req);
992 return true;
993 }
994
995 case GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION: {
996 data.enforceInterface(IActivityManager.descriptor);
997 IBinder token = data.readStrongBinder();
998 ComponentName cn = getActivityClassForToken(token);
999 reply.writeNoException();
1000 ComponentName.writeToParcel(cn, reply);
1001 return true;
1002 }
1003
1004 case GET_PACKAGE_FOR_TOKEN_TRANSACTION: {
1005 data.enforceInterface(IActivityManager.descriptor);
1006 IBinder token = data.readStrongBinder();
1007 reply.writeNoException();
1008 reply.writeString(getPackageForToken(token));
1009 return true;
1010 }
1011
1012 case GET_INTENT_SENDER_TRANSACTION: {
1013 data.enforceInterface(IActivityManager.descriptor);
1014 int type = data.readInt();
1015 String packageName = data.readString();
1016 IBinder token = data.readStrongBinder();
1017 String resultWho = data.readString();
1018 int requestCode = data.readInt();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001019 Intent[] requestIntents;
1020 String[] requestResolvedTypes;
1021 if (data.readInt() != 0) {
1022 requestIntents = data.createTypedArray(Intent.CREATOR);
1023 requestResolvedTypes = data.createStringArray();
1024 } else {
1025 requestIntents = null;
1026 requestResolvedTypes = null;
1027 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001028 int fl = data.readInt();
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07001029 Bundle options = data.readInt() != 0
1030 ? Bundle.CREATOR.createFromParcel(data) : null;
Dianne Hackborn41203752012-08-31 14:05:51 -07001031 int userId = data.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001032 IIntentSender res = getIntentSender(type, packageName, token,
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001033 resultWho, requestCode, requestIntents,
Dianne Hackborn41203752012-08-31 14:05:51 -07001034 requestResolvedTypes, fl, options, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001035 reply.writeNoException();
1036 reply.writeStrongBinder(res != null ? res.asBinder() : null);
1037 return true;
1038 }
1039
1040 case CANCEL_INTENT_SENDER_TRANSACTION: {
1041 data.enforceInterface(IActivityManager.descriptor);
1042 IIntentSender r = IIntentSender.Stub.asInterface(
1043 data.readStrongBinder());
1044 cancelIntentSender(r);
1045 reply.writeNoException();
1046 return true;
1047 }
1048
1049 case GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION: {
1050 data.enforceInterface(IActivityManager.descriptor);
1051 IIntentSender r = IIntentSender.Stub.asInterface(
1052 data.readStrongBinder());
1053 String res = getPackageForIntentSender(r);
1054 reply.writeNoException();
1055 reply.writeString(res);
1056 return true;
1057 }
1058
Christopher Tatec4a07d12012-04-06 14:19:13 -07001059 case GET_UID_FOR_INTENT_SENDER_TRANSACTION: {
1060 data.enforceInterface(IActivityManager.descriptor);
1061 IIntentSender r = IIntentSender.Stub.asInterface(
1062 data.readStrongBinder());
1063 int res = getUidForIntentSender(r);
1064 reply.writeNoException();
1065 reply.writeInt(res);
1066 return true;
1067 }
1068
Dianne Hackborn41203752012-08-31 14:05:51 -07001069 case HANDLE_INCOMING_USER_TRANSACTION: {
1070 data.enforceInterface(IActivityManager.descriptor);
1071 int callingPid = data.readInt();
1072 int callingUid = data.readInt();
1073 int userId = data.readInt();
1074 boolean allowAll = data.readInt() != 0 ;
1075 boolean requireFull = data.readInt() != 0;
1076 String name = data.readString();
1077 String callerPackage = data.readString();
1078 int res = handleIncomingUser(callingPid, callingUid, userId, allowAll,
1079 requireFull, name, callerPackage);
1080 reply.writeNoException();
1081 reply.writeInt(res);
1082 return true;
1083 }
1084
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001085 case SET_PROCESS_LIMIT_TRANSACTION: {
1086 data.enforceInterface(IActivityManager.descriptor);
1087 int max = data.readInt();
1088 setProcessLimit(max);
1089 reply.writeNoException();
1090 return true;
1091 }
1092
1093 case GET_PROCESS_LIMIT_TRANSACTION: {
1094 data.enforceInterface(IActivityManager.descriptor);
1095 int limit = getProcessLimit();
1096 reply.writeNoException();
1097 reply.writeInt(limit);
1098 return true;
1099 }
1100
1101 case SET_PROCESS_FOREGROUND_TRANSACTION: {
1102 data.enforceInterface(IActivityManager.descriptor);
1103 IBinder token = data.readStrongBinder();
1104 int pid = data.readInt();
1105 boolean isForeground = data.readInt() != 0;
1106 setProcessForeground(token, pid, isForeground);
1107 reply.writeNoException();
1108 return true;
1109 }
1110
1111 case CHECK_PERMISSION_TRANSACTION: {
1112 data.enforceInterface(IActivityManager.descriptor);
1113 String perm = data.readString();
1114 int pid = data.readInt();
1115 int uid = data.readInt();
1116 int res = checkPermission(perm, pid, uid);
1117 reply.writeNoException();
1118 reply.writeInt(res);
1119 return true;
1120 }
1121
1122 case CHECK_URI_PERMISSION_TRANSACTION: {
1123 data.enforceInterface(IActivityManager.descriptor);
1124 Uri uri = Uri.CREATOR.createFromParcel(data);
1125 int pid = data.readInt();
1126 int uid = data.readInt();
1127 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001128 int userId = data.readInt();
1129 int res = checkUriPermission(uri, pid, uid, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001130 reply.writeNoException();
1131 reply.writeInt(res);
1132 return true;
1133 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001135 case CLEAR_APP_DATA_TRANSACTION: {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001136 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001137 String packageName = data.readString();
1138 IPackageDataObserver observer = IPackageDataObserver.Stub.asInterface(
1139 data.readStrongBinder());
Amith Yamasani742a6712011-05-04 14:49:28 -07001140 int userId = data.readInt();
1141 boolean res = clearApplicationUserData(packageName, observer, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001142 reply.writeNoException();
1143 reply.writeInt(res ? 1 : 0);
1144 return true;
1145 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001146
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 case GRANT_URI_PERMISSION_TRANSACTION: {
1148 data.enforceInterface(IActivityManager.descriptor);
1149 IBinder b = data.readStrongBinder();
1150 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1151 String targetPkg = data.readString();
1152 Uri uri = Uri.CREATOR.createFromParcel(data);
1153 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001154 int userId = data.readInt();
1155 grantUriPermission(app, targetPkg, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 reply.writeNoException();
1157 return true;
1158 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001159
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001160 case REVOKE_URI_PERMISSION_TRANSACTION: {
1161 data.enforceInterface(IActivityManager.descriptor);
1162 IBinder b = data.readStrongBinder();
1163 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1164 Uri uri = Uri.CREATOR.createFromParcel(data);
1165 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001166 int userId = data.readInt();
1167 revokeUriPermission(app, uri, mode, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 reply.writeNoException();
1169 return true;
1170 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001171
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001172 case TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1173 data.enforceInterface(IActivityManager.descriptor);
1174 Uri uri = Uri.CREATOR.createFromParcel(data);
1175 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001176 int userId = data.readInt();
1177 takePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001178 reply.writeNoException();
1179 return true;
1180 }
1181
1182 case RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION: {
1183 data.enforceInterface(IActivityManager.descriptor);
1184 Uri uri = Uri.CREATOR.createFromParcel(data);
1185 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001186 int userId = data.readInt();
1187 releasePersistableUriPermission(uri, mode, userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001188 reply.writeNoException();
1189 return true;
1190 }
1191
1192 case GET_PERSISTED_URI_PERMISSIONS_TRANSACTION: {
1193 data.enforceInterface(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07001194 final String packageName = data.readString();
1195 final boolean incoming = data.readInt() != 0;
1196 final ParceledListSlice<UriPermission> perms = getPersistedUriPermissions(
1197 packageName, incoming);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07001198 reply.writeNoException();
1199 perms.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1200 return true;
1201 }
1202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 case SHOW_WAITING_FOR_DEBUGGER_TRANSACTION: {
1204 data.enforceInterface(IActivityManager.descriptor);
1205 IBinder b = data.readStrongBinder();
1206 IApplicationThread app = ApplicationThreadNative.asInterface(b);
1207 boolean waiting = data.readInt() != 0;
1208 showWaitingForDebugger(app, waiting);
1209 reply.writeNoException();
1210 return true;
1211 }
1212
1213 case GET_MEMORY_INFO_TRANSACTION: {
1214 data.enforceInterface(IActivityManager.descriptor);
1215 ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
1216 getMemoryInfo(mi);
1217 reply.writeNoException();
1218 mi.writeToParcel(reply, 0);
1219 return true;
1220 }
1221
1222 case UNHANDLED_BACK_TRANSACTION: {
1223 data.enforceInterface(IActivityManager.descriptor);
1224 unhandledBack();
1225 reply.writeNoException();
1226 return true;
1227 }
1228
1229 case OPEN_CONTENT_URI_TRANSACTION: {
1230 data.enforceInterface(IActivityManager.descriptor);
1231 Uri uri = Uri.parse(data.readString());
1232 ParcelFileDescriptor pfd = openContentUri(uri);
1233 reply.writeNoException();
1234 if (pfd != null) {
1235 reply.writeInt(1);
1236 pfd.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1237 } else {
1238 reply.writeInt(0);
1239 }
1240 return true;
1241 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001242
Dianne Hackbornff5b1582012-04-12 17:24:07 -07001243 case SET_LOCK_SCREEN_SHOWN_TRANSACTION: {
1244 data.enforceInterface(IActivityManager.descriptor);
1245 setLockScreenShown(data.readInt() != 0);
1246 reply.writeNoException();
1247 return true;
1248 }
1249
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001250 case SET_DEBUG_APP_TRANSACTION: {
1251 data.enforceInterface(IActivityManager.descriptor);
1252 String pn = data.readString();
1253 boolean wfd = data.readInt() != 0;
1254 boolean per = data.readInt() != 0;
1255 setDebugApp(pn, wfd, per);
1256 reply.writeNoException();
1257 return true;
1258 }
1259
1260 case SET_ALWAYS_FINISH_TRANSACTION: {
1261 data.enforceInterface(IActivityManager.descriptor);
1262 boolean enabled = data.readInt() != 0;
1263 setAlwaysFinish(enabled);
1264 reply.writeNoException();
1265 return true;
1266 }
1267
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001268 case SET_ACTIVITY_CONTROLLER_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001269 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001270 IActivityController watcher = IActivityController.Stub.asInterface(
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001271 data.readStrongBinder());
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001272 setActivityController(watcher);
Sungmin Choicdb86bb2012-12-20 14:08:59 +09001273 reply.writeNoException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001274 return true;
1275 }
1276
1277 case ENTER_SAFE_MODE_TRANSACTION: {
1278 data.enforceInterface(IActivityManager.descriptor);
1279 enterSafeMode();
1280 reply.writeNoException();
1281 return true;
1282 }
1283
1284 case NOTE_WAKEUP_ALARM_TRANSACTION: {
1285 data.enforceInterface(IActivityManager.descriptor);
1286 IIntentSender is = IIntentSender.Stub.asInterface(
1287 data.readStrongBinder());
Dianne Hackborn099bc622014-01-22 13:39:16 -08001288 int sourceUid = data.readInt();
1289 String sourcePkg = data.readString();
1290 noteWakeupAlarm(is, sourceUid, sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001291 reply.writeNoException();
1292 return true;
1293 }
1294
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001295 case KILL_PIDS_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001296 data.enforceInterface(IActivityManager.descriptor);
1297 int[] pids = data.createIntArray();
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07001298 String reason = data.readString();
Dianne Hackborn64825172011-03-02 21:32:58 -08001299 boolean secure = data.readInt() != 0;
1300 boolean res = killPids(pids, reason, secure);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001301 reply.writeNoException();
1302 reply.writeInt(res ? 1 : 0);
1303 return true;
1304 }
1305
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07001306 case KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION: {
1307 data.enforceInterface(IActivityManager.descriptor);
1308 String reason = data.readString();
1309 boolean res = killProcessesBelowForeground(reason);
1310 reply.writeNoException();
1311 reply.writeInt(res ? 1 : 0);
1312 return true;
1313 }
1314
Dan Egnor60d87622009-12-16 16:32:58 -08001315 case HANDLE_APPLICATION_CRASH_TRANSACTION: {
1316 data.enforceInterface(IActivityManager.descriptor);
1317 IBinder app = data.readStrongBinder();
1318 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
1319 handleApplicationCrash(app, ci);
1320 reply.writeNoException();
1321 return true;
1322 }
1323
1324 case HANDLE_APPLICATION_WTF_TRANSACTION: {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001325 data.enforceInterface(IActivityManager.descriptor);
1326 IBinder app = data.readStrongBinder();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001327 String tag = data.readString();
Dan Egnorb7f03672009-12-09 16:22:32 -08001328 ApplicationErrorReport.CrashInfo ci = new ApplicationErrorReport.CrashInfo(data);
Dan Egnor60d87622009-12-16 16:32:58 -08001329 boolean res = handleApplicationWtf(app, tag, ci);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001330 reply.writeNoException();
Dan Egnor60d87622009-12-16 16:32:58 -08001331 reply.writeInt(res ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001332 return true;
1333 }
Dan Egnorb7f03672009-12-09 16:22:32 -08001334
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001335 case HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION: {
1336 data.enforceInterface(IActivityManager.descriptor);
1337 IBinder app = data.readStrongBinder();
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07001338 int violationMask = data.readInt();
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07001339 StrictMode.ViolationInfo info = new StrictMode.ViolationInfo(data);
1340 handleApplicationStrictModeViolation(app, violationMask, info);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07001341 reply.writeNoException();
1342 return true;
1343 }
1344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001345 case SIGNAL_PERSISTENT_PROCESSES_TRANSACTION: {
1346 data.enforceInterface(IActivityManager.descriptor);
1347 int sig = data.readInt();
1348 signalPersistentProcesses(sig);
1349 reply.writeNoException();
1350 return true;
1351 }
1352
Dianne Hackborn03abb812010-01-04 18:43:19 -08001353 case KILL_BACKGROUND_PROCESSES_TRANSACTION: {
1354 data.enforceInterface(IActivityManager.descriptor);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001355 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001356 int userId = data.readInt();
1357 killBackgroundProcesses(packageName, userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08001358 reply.writeNoException();
1359 return true;
1360 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08001361
1362 case KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION: {
1363 data.enforceInterface(IActivityManager.descriptor);
1364 killAllBackgroundProcesses();
1365 reply.writeNoException();
1366 return true;
1367 }
Craig Mautner4cd0c13f2013-04-16 15:55:52 -07001368
Dianne Hackborn03abb812010-01-04 18:43:19 -08001369 case FORCE_STOP_PACKAGE_TRANSACTION: {
1370 data.enforceInterface(IActivityManager.descriptor);
1371 String packageName = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001372 int userId = data.readInt();
1373 forceStopPackage(packageName, userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001374 reply.writeNoException();
1375 return true;
1376 }
Dianne Hackborn27ff9132012-03-06 14:57:58 -08001377
1378 case GET_MY_MEMORY_STATE_TRANSACTION: {
1379 data.enforceInterface(IActivityManager.descriptor);
1380 ActivityManager.RunningAppProcessInfo info =
1381 new ActivityManager.RunningAppProcessInfo();
1382 getMyMemoryState(info);
1383 reply.writeNoException();
1384 info.writeToParcel(reply, 0);
1385 return true;
1386 }
1387
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001388 case GET_DEVICE_CONFIGURATION_TRANSACTION: {
1389 data.enforceInterface(IActivityManager.descriptor);
1390 ConfigurationInfo config = getDeviceConfigurationInfo();
1391 reply.writeNoException();
1392 config.writeToParcel(reply, 0);
1393 return true;
1394 }
1395
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001396 case PROFILE_CONTROL_TRANSACTION: {
1397 data.enforceInterface(IActivityManager.descriptor);
1398 String process = data.readString();
Dianne Hackborn1676c852012-09-10 14:52:30 -07001399 int userId = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001400 boolean start = data.readInt() != 0;
Romain Guy9a8c5ce2011-07-21 18:04:29 -07001401 int profileType = data.readInt();
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001402 String path = data.readString();
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07001403 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001404 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001405 boolean res = profileControl(process, userId, start, path, fd, profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08001406 reply.writeNoException();
1407 reply.writeInt(res ? 1 : 0);
1408 return true;
1409 }
1410
Dianne Hackborn55280a92009-05-07 15:53:46 -07001411 case SHUTDOWN_TRANSACTION: {
1412 data.enforceInterface(IActivityManager.descriptor);
1413 boolean res = shutdown(data.readInt());
1414 reply.writeNoException();
1415 reply.writeInt(res ? 1 : 0);
1416 return true;
1417 }
1418
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07001419 case STOP_APP_SWITCHES_TRANSACTION: {
1420 data.enforceInterface(IActivityManager.descriptor);
1421 stopAppSwitches();
1422 reply.writeNoException();
1423 return true;
1424 }
1425
1426 case RESUME_APP_SWITCHES_TRANSACTION: {
1427 data.enforceInterface(IActivityManager.descriptor);
1428 resumeAppSwitches();
1429 reply.writeNoException();
1430 return true;
1431 }
1432
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001433 case PEEK_SERVICE_TRANSACTION: {
1434 data.enforceInterface(IActivityManager.descriptor);
1435 Intent service = Intent.CREATOR.createFromParcel(data);
1436 String resolvedType = data.readString();
1437 IBinder binder = peekService(service, resolvedType);
1438 reply.writeNoException();
1439 reply.writeStrongBinder(binder);
1440 return true;
1441 }
Christopher Tate181fafa2009-05-14 11:12:14 -07001442
1443 case START_BACKUP_AGENT_TRANSACTION: {
1444 data.enforceInterface(IActivityManager.descriptor);
1445 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1446 int backupRestoreMode = data.readInt();
1447 boolean success = bindBackupAgent(info, backupRestoreMode);
1448 reply.writeNoException();
1449 reply.writeInt(success ? 1 : 0);
1450 return true;
1451 }
1452
1453 case BACKUP_AGENT_CREATED_TRANSACTION: {
1454 data.enforceInterface(IActivityManager.descriptor);
1455 String packageName = data.readString();
1456 IBinder agent = data.readStrongBinder();
1457 backupAgentCreated(packageName, agent);
1458 reply.writeNoException();
1459 return true;
1460 }
1461
1462 case UNBIND_BACKUP_AGENT_TRANSACTION: {
1463 data.enforceInterface(IActivityManager.descriptor);
1464 ApplicationInfo info = ApplicationInfo.CREATOR.createFromParcel(data);
1465 unbindBackupAgent(info);
1466 reply.writeNoException();
1467 return true;
1468 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07001469
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001470 case KILL_APPLICATION_WITH_APPID_TRANSACTION: {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001471 data.enforceInterface(IActivityManager.descriptor);
1472 String pkg = data.readString();
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001473 int appid = data.readInt();
Dianne Hackborn21d9b562013-05-28 17:46:59 -07001474 String reason = data.readString();
1475 killApplicationWithAppId(pkg, appid, reason);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07001476 reply.writeNoException();
1477 return true;
1478 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07001479
1480 case CLOSE_SYSTEM_DIALOGS_TRANSACTION: {
1481 data.enforceInterface(IActivityManager.descriptor);
1482 String reason = data.readString();
1483 closeSystemDialogs(reason);
1484 reply.writeNoException();
1485 return true;
1486 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001487
1488 case GET_PROCESS_MEMORY_INFO_TRANSACTION: {
1489 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001490 int[] pids = data.createIntArray();
1491 Debug.MemoryInfo[] res = getProcessMemoryInfo(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001492 reply.writeNoException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07001493 reply.writeTypedArray(res, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07001494 return true;
1495 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07001496
1497 case KILL_APPLICATION_PROCESS_TRANSACTION: {
1498 data.enforceInterface(IActivityManager.descriptor);
1499 String processName = data.readString();
1500 int uid = data.readInt();
1501 killApplicationProcess(processName, uid);
1502 reply.writeNoException();
1503 return true;
1504 }
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001505
1506 case OVERRIDE_PENDING_TRANSITION_TRANSACTION: {
1507 data.enforceInterface(IActivityManager.descriptor);
1508 IBinder token = data.readStrongBinder();
1509 String packageName = data.readString();
1510 int enterAnim = data.readInt();
1511 int exitAnim = data.readInt();
1512 overridePendingTransition(token, packageName, enterAnim, exitAnim);
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001513 reply.writeNoException();
1514 return true;
1515 }
1516
1517 case IS_USER_A_MONKEY_TRANSACTION: {
1518 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001519 boolean areThey = isUserAMonkey();
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08001520 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001521 reply.writeInt(areThey ? 1 : 0);
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07001522 return true;
1523 }
Dianne Hackborn860755f2010-06-03 18:47:52 -07001524
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07001525 case SET_USER_IS_MONKEY_TRANSACTION: {
1526 data.enforceInterface(IActivityManager.descriptor);
1527 final boolean monkey = (data.readInt() == 1);
1528 setUserIsMonkey(monkey);
1529 reply.writeNoException();
1530 return true;
1531 }
1532
Dianne Hackborn860755f2010-06-03 18:47:52 -07001533 case FINISH_HEAVY_WEIGHT_APP_TRANSACTION: {
1534 data.enforceInterface(IActivityManager.descriptor);
1535 finishHeavyWeightApp();
1536 reply.writeNoException();
1537 return true;
1538 }
Daniel Sandler69a48172010-06-23 16:29:36 -04001539
1540 case IS_IMMERSIVE_TRANSACTION: {
1541 data.enforceInterface(IActivityManager.descriptor);
1542 IBinder token = data.readStrongBinder();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001543 boolean isit = isImmersive(token);
Daniel Sandler69a48172010-06-23 16:29:36 -04001544 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001545 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001546 return true;
1547 }
1548
Craig Mautnerd61dc202014-07-07 11:09:11 -07001549 case IS_TOP_OF_TASK_TRANSACTION: {
1550 data.enforceInterface(IActivityManager.descriptor);
1551 IBinder token = data.readStrongBinder();
1552 final boolean isTopOfTask = isTopOfTask(token);
1553 reply.writeNoException();
1554 reply.writeInt(isTopOfTask ? 1 : 0);
1555 return true;
1556 }
1557
Craig Mautner5eda9b32013-07-02 11:58:16 -07001558 case CONVERT_FROM_TRANSLUCENT_TRANSACTION: {
Craig Mautner4addfc52013-06-25 08:05:45 -07001559 data.enforceInterface(IActivityManager.descriptor);
1560 IBinder token = data.readStrongBinder();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001561 boolean converted = convertFromTranslucent(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001562 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001563 reply.writeInt(converted ? 1 : 0);
Craig Mautner5eda9b32013-07-02 11:58:16 -07001564 return true;
1565 }
1566
1567 case CONVERT_TO_TRANSLUCENT_TRANSACTION: {
1568 data.enforceInterface(IActivityManager.descriptor);
1569 IBinder token = data.readStrongBinder();
Craig Mautner233ceee2014-05-09 17:05:11 -07001570 final Bundle bundle;
1571 if (data.readInt() == 0) {
1572 bundle = null;
1573 } else {
1574 bundle = data.readBundle();
1575 }
1576 final ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
1577 boolean converted = convertToTranslucent(token, options);
Craig Mautner4addfc52013-06-25 08:05:45 -07001578 reply.writeNoException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07001579 reply.writeInt(converted ? 1 : 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07001580 return true;
1581 }
1582
Craig Mautner233ceee2014-05-09 17:05:11 -07001583 case GET_ACTIVITY_OPTIONS_TRANSACTION: {
1584 data.enforceInterface(IActivityManager.descriptor);
1585 IBinder token = data.readStrongBinder();
1586 final ActivityOptions options = getActivityOptions(token);
1587 reply.writeNoException();
1588 reply.writeBundle(options == null ? null : options.toBundle());
1589 return true;
1590 }
1591
Daniel Sandler69a48172010-06-23 16:29:36 -04001592 case SET_IMMERSIVE_TRANSACTION: {
1593 data.enforceInterface(IActivityManager.descriptor);
1594 IBinder token = data.readStrongBinder();
1595 boolean imm = data.readInt() == 1;
1596 setImmersive(token, imm);
1597 reply.writeNoException();
1598 return true;
1599 }
1600
1601 case IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION: {
1602 data.enforceInterface(IActivityManager.descriptor);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001603 boolean isit = isTopActivityImmersive();
Daniel Sandler69a48172010-06-23 16:29:36 -04001604 reply.writeNoException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07001605 reply.writeInt(isit ? 1 : 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04001606 return true;
1607 }
1608
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001609 case CRASH_APPLICATION_TRANSACTION: {
1610 data.enforceInterface(IActivityManager.descriptor);
1611 int uid = data.readInt();
1612 int initialPid = data.readInt();
1613 String packageName = data.readString();
1614 String message = data.readString();
1615 crashApplication(uid, initialPid, packageName, message);
1616 reply.writeNoException();
1617 return true;
1618 }
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001619
1620 case GET_PROVIDER_MIME_TYPE_TRANSACTION: {
1621 data.enforceInterface(IActivityManager.descriptor);
1622 Uri uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001623 int userId = data.readInt();
1624 String type = getProviderMimeType(uri, userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07001625 reply.writeNoException();
1626 reply.writeString(type);
1627 return true;
1628 }
1629
Dianne Hackborn7e269642010-08-25 19:50:20 -07001630 case NEW_URI_PERMISSION_OWNER_TRANSACTION: {
1631 data.enforceInterface(IActivityManager.descriptor);
1632 String name = data.readString();
1633 IBinder perm = newUriPermissionOwner(name);
1634 reply.writeNoException();
1635 reply.writeStrongBinder(perm);
1636 return true;
1637 }
1638
1639 case GRANT_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1640 data.enforceInterface(IActivityManager.descriptor);
1641 IBinder owner = data.readStrongBinder();
1642 int fromUid = data.readInt();
1643 String targetPkg = data.readString();
1644 Uri uri = Uri.CREATOR.createFromParcel(data);
1645 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001646 int userId = data.readInt();
1647 grantUriPermissionFromOwner(owner, fromUid, targetPkg, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001648 reply.writeNoException();
1649 return true;
1650 }
1651
1652 case REVOKE_URI_PERMISSION_FROM_OWNER_TRANSACTION: {
1653 data.enforceInterface(IActivityManager.descriptor);
1654 IBinder owner = data.readStrongBinder();
1655 Uri uri = null;
1656 if (data.readInt() != 0) {
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001657 uri = Uri.CREATOR.createFromParcel(data);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001658 }
1659 int mode = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001660 int userId = data.readInt();
1661 revokeUriPermissionFromOwner(owner, uri, mode, userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07001662 reply.writeNoException();
1663 return true;
1664 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07001665
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001666 case CHECK_GRANT_URI_PERMISSION_TRANSACTION: {
1667 data.enforceInterface(IActivityManager.descriptor);
1668 int callingUid = data.readInt();
1669 String targetPkg = data.readString();
1670 Uri uri = Uri.CREATOR.createFromParcel(data);
1671 int modeFlags = data.readInt();
Nicolas Prevotd85fc722014-04-16 19:52:08 +01001672 int userId = data.readInt();
1673 int res = checkGrantUriPermission(callingUid, targetPkg, uri, modeFlags, userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07001674 reply.writeNoException();
1675 reply.writeInt(res);
1676 return true;
1677 }
1678
Andy McFadden824c5102010-07-09 16:26:57 -07001679 case DUMP_HEAP_TRANSACTION: {
1680 data.enforceInterface(IActivityManager.descriptor);
1681 String process = data.readString();
Dianne Hackbornb12e1352012-09-26 11:39:20 -07001682 int userId = data.readInt();
Andy McFadden824c5102010-07-09 16:26:57 -07001683 boolean managed = data.readInt() != 0;
1684 String path = data.readString();
1685 ParcelFileDescriptor fd = data.readInt() != 0
Amith Yamasanic2be0d62013-09-23 11:16:28 -07001686 ? ParcelFileDescriptor.CREATOR.createFromParcel(data) : null;
Dianne Hackborn1676c852012-09-10 14:52:30 -07001687 boolean res = dumpHeap(process, userId, managed, path, fd);
Andy McFadden824c5102010-07-09 16:26:57 -07001688 reply.writeNoException();
1689 reply.writeInt(res ? 1 : 0);
1690 return true;
1691 }
1692
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001693 case START_ACTIVITIES_TRANSACTION:
1694 {
1695 data.enforceInterface(IActivityManager.descriptor);
1696 IBinder b = data.readStrongBinder();
1697 IApplicationThread app = ApplicationThreadNative.asInterface(b);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001698 String callingPackage = data.readString();
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001699 Intent[] intents = data.createTypedArray(Intent.CREATOR);
1700 String[] resolvedTypes = data.createStringArray();
1701 IBinder resultTo = data.readStrongBinder();
Dianne Hackborna4972e92012-03-14 10:38:05 -07001702 Bundle options = data.readInt() != 0
1703 ? Bundle.CREATOR.createFromParcel(data) : null;
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001704 int userId = data.readInt();
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001705 int result = startActivities(app, callingPackage, intents, resolvedTypes, resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07001706 options, userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08001707 reply.writeNoException();
1708 reply.writeInt(result);
1709 return true;
1710 }
1711
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001712 case GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1713 {
1714 data.enforceInterface(IActivityManager.descriptor);
1715 int mode = getFrontActivityScreenCompatMode();
1716 reply.writeNoException();
1717 reply.writeInt(mode);
1718 return true;
1719 }
1720
1721 case SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION:
1722 {
1723 data.enforceInterface(IActivityManager.descriptor);
1724 int mode = data.readInt();
1725 setFrontActivityScreenCompatMode(mode);
1726 reply.writeNoException();
1727 reply.writeInt(mode);
1728 return true;
1729 }
1730
1731 case GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1732 {
1733 data.enforceInterface(IActivityManager.descriptor);
1734 String pkg = data.readString();
1735 int mode = getPackageScreenCompatMode(pkg);
1736 reply.writeNoException();
1737 reply.writeInt(mode);
1738 return true;
1739 }
1740
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001741 case SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION:
1742 {
1743 data.enforceInterface(IActivityManager.descriptor);
1744 String pkg = data.readString();
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07001745 int mode = data.readInt();
1746 setPackageScreenCompatMode(pkg, mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04001747 reply.writeNoException();
1748 return true;
1749 }
Dianne Hackbornaa9d84c2011-05-09 19:00:59 -07001750
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001751 case SWITCH_USER_TRANSACTION: {
1752 data.enforceInterface(IActivityManager.descriptor);
1753 int userid = data.readInt();
1754 boolean result = switchUser(userid);
1755 reply.writeNoException();
1756 reply.writeInt(result ? 1 : 0);
1757 return true;
1758 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07001759
Kenny Guy08488bf2014-02-21 17:40:37 +00001760 case START_USER_IN_BACKGROUND_TRANSACTION: {
1761 data.enforceInterface(IActivityManager.descriptor);
1762 int userid = data.readInt();
1763 boolean result = startUserInBackground(userid);
1764 reply.writeNoException();
1765 reply.writeInt(result ? 1 : 0);
1766 return true;
1767 }
1768
Dianne Hackborn80a4af22012-08-27 19:18:31 -07001769 case STOP_USER_TRANSACTION: {
1770 data.enforceInterface(IActivityManager.descriptor);
1771 int userid = data.readInt();
1772 IStopUserCallback callback = IStopUserCallback.Stub.asInterface(
1773 data.readStrongBinder());
1774 int result = stopUser(userid, callback);
1775 reply.writeNoException();
1776 reply.writeInt(result);
1777 return true;
1778 }
1779
Amith Yamasani52f1d752012-03-28 18:19:29 -07001780 case GET_CURRENT_USER_TRANSACTION: {
1781 data.enforceInterface(IActivityManager.descriptor);
1782 UserInfo userInfo = getCurrentUser();
1783 reply.writeNoException();
1784 userInfo.writeToParcel(reply, 0);
1785 return true;
1786 }
1787
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001788 case IS_USER_RUNNING_TRANSACTION: {
1789 data.enforceInterface(IActivityManager.descriptor);
1790 int userid = data.readInt();
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07001791 boolean orStopping = data.readInt() != 0;
1792 boolean result = isUserRunning(userid, orStopping);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07001793 reply.writeNoException();
1794 reply.writeInt(result ? 1 : 0);
1795 return true;
1796 }
1797
Dianne Hackbornc72fc672012-09-20 13:12:03 -07001798 case GET_RUNNING_USER_IDS_TRANSACTION: {
1799 data.enforceInterface(IActivityManager.descriptor);
1800 int[] result = getRunningUserIds();
1801 reply.writeNoException();
1802 reply.writeIntArray(result);
1803 return true;
1804 }
1805
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07001806 case REMOVE_TASK_TRANSACTION:
1807 {
1808 data.enforceInterface(IActivityManager.descriptor);
1809 int taskId = data.readInt();
1810 int fl = data.readInt();
1811 boolean result = removeTask(taskId, fl);
1812 reply.writeNoException();
1813 reply.writeInt(result ? 1 : 0);
1814 return true;
1815 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07001816
Jeff Sharkeya4620792011-05-20 15:29:23 -07001817 case REGISTER_PROCESS_OBSERVER_TRANSACTION: {
1818 data.enforceInterface(IActivityManager.descriptor);
1819 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1820 data.readStrongBinder());
1821 registerProcessObserver(observer);
1822 return true;
1823 }
1824
1825 case UNREGISTER_PROCESS_OBSERVER_TRANSACTION: {
1826 data.enforceInterface(IActivityManager.descriptor);
1827 IProcessObserver observer = IProcessObserver.Stub.asInterface(
1828 data.readStrongBinder());
1829 unregisterProcessObserver(observer);
1830 return true;
1831 }
1832
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07001833 case GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1834 {
1835 data.enforceInterface(IActivityManager.descriptor);
1836 String pkg = data.readString();
1837 boolean ask = getPackageAskScreenCompat(pkg);
1838 reply.writeNoException();
1839 reply.writeInt(ask ? 1 : 0);
1840 return true;
1841 }
1842
1843 case SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION:
1844 {
1845 data.enforceInterface(IActivityManager.descriptor);
1846 String pkg = data.readString();
1847 boolean ask = data.readInt() != 0;
1848 setPackageAskScreenCompat(pkg, ask);
1849 reply.writeNoException();
1850 return true;
1851 }
1852
Dianne Hackborn6c418d52011-06-29 14:05:33 -07001853 case IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION: {
1854 data.enforceInterface(IActivityManager.descriptor);
1855 IIntentSender r = IIntentSender.Stub.asInterface(
1856 data.readStrongBinder());
1857 boolean res = isIntentSenderTargetedToPackage(r);
1858 reply.writeNoException();
1859 reply.writeInt(res ? 1 : 0);
1860 return true;
1861 }
1862
Dianne Hackborn1927ae82012-06-22 15:21:36 -07001863 case IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION: {
1864 data.enforceInterface(IActivityManager.descriptor);
1865 IIntentSender r = IIntentSender.Stub.asInterface(
1866 data.readStrongBinder());
1867 boolean res = isIntentSenderAnActivity(r);
1868 reply.writeNoException();
1869 reply.writeInt(res ? 1 : 0);
1870 return true;
1871 }
1872
Dianne Hackborn81038902012-11-26 17:04:09 -08001873 case GET_INTENT_FOR_INTENT_SENDER_TRANSACTION: {
1874 data.enforceInterface(IActivityManager.descriptor);
1875 IIntentSender r = IIntentSender.Stub.asInterface(
1876 data.readStrongBinder());
1877 Intent intent = getIntentForIntentSender(r);
1878 reply.writeNoException();
1879 if (intent != null) {
1880 reply.writeInt(1);
1881 intent.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
1882 } else {
1883 reply.writeInt(0);
1884 }
1885 return true;
1886 }
1887
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08001888 case GET_TAG_FOR_INTENT_SENDER_TRANSACTION: {
1889 data.enforceInterface(IActivityManager.descriptor);
1890 IIntentSender r = IIntentSender.Stub.asInterface(
1891 data.readStrongBinder());
1892 String prefix = data.readString();
1893 String tag = getTagForIntentSender(r, prefix);
1894 reply.writeNoException();
1895 reply.writeString(tag);
1896 return true;
1897 }
1898
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001899 case UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION: {
1900 data.enforceInterface(IActivityManager.descriptor);
1901 Configuration config = Configuration.CREATOR.createFromParcel(data);
1902 updatePersistentConfiguration(config);
1903 reply.writeNoException();
1904 return true;
1905 }
1906
Dianne Hackbornb437e092011-08-05 17:50:29 -07001907 case GET_PROCESS_PSS_TRANSACTION: {
1908 data.enforceInterface(IActivityManager.descriptor);
1909 int[] pids = data.createIntArray();
1910 long[] pss = getProcessPss(pids);
1911 reply.writeNoException();
1912 reply.writeLongArray(pss);
1913 return true;
1914 }
1915
Dianne Hackborn661cd522011-08-22 00:26:20 -07001916 case SHOW_BOOT_MESSAGE_TRANSACTION: {
1917 data.enforceInterface(IActivityManager.descriptor);
1918 CharSequence msg = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(data);
1919 boolean always = data.readInt() != 0;
1920 showBootMessage(msg, always);
1921 reply.writeNoException();
1922 return true;
1923 }
1924
Dianne Hackborn90c52de2011-09-23 12:57:44 -07001925 case DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION: {
1926 data.enforceInterface(IActivityManager.descriptor);
1927 dismissKeyguardOnNextActivity();
1928 reply.writeNoException();
1929 return true;
1930 }
1931
Adam Powelldd8fab22012-03-22 17:47:27 -07001932 case TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION: {
1933 data.enforceInterface(IActivityManager.descriptor);
1934 IBinder token = data.readStrongBinder();
1935 String destAffinity = data.readString();
1936 boolean res = targetTaskAffinityMatchesActivity(token, destAffinity);
1937 reply.writeNoException();
1938 reply.writeInt(res ? 1 : 0);
1939 return true;
1940 }
1941
1942 case NAVIGATE_UP_TO_TRANSACTION: {
1943 data.enforceInterface(IActivityManager.descriptor);
1944 IBinder token = data.readStrongBinder();
1945 Intent target = Intent.CREATOR.createFromParcel(data);
1946 int resultCode = data.readInt();
1947 Intent resultData = null;
1948 if (data.readInt() != 0) {
1949 resultData = Intent.CREATOR.createFromParcel(data);
1950 }
1951 boolean res = navigateUpTo(token, target, resultCode, resultData);
1952 reply.writeNoException();
1953 reply.writeInt(res ? 1 : 0);
1954 return true;
1955 }
1956
Dianne Hackborn5320eb82012-05-18 12:05:04 -07001957 case GET_LAUNCHED_FROM_UID_TRANSACTION: {
1958 data.enforceInterface(IActivityManager.descriptor);
1959 IBinder token = data.readStrongBinder();
1960 int res = getLaunchedFromUid(token);
1961 reply.writeNoException();
1962 reply.writeInt(res);
1963 return true;
1964 }
1965
Dianne Hackbornf265ea92013-01-31 15:00:51 -08001966 case GET_LAUNCHED_FROM_PACKAGE_TRANSACTION: {
1967 data.enforceInterface(IActivityManager.descriptor);
1968 IBinder token = data.readStrongBinder();
1969 String res = getLaunchedFromPackage(token);
1970 reply.writeNoException();
1971 reply.writeString(res);
1972 return true;
1973 }
1974
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001975 case REGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1976 data.enforceInterface(IActivityManager.descriptor);
1977 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1978 data.readStrongBinder());
1979 registerUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001980 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001981 return true;
1982 }
1983
1984 case UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION: {
1985 data.enforceInterface(IActivityManager.descriptor);
1986 IUserSwitchObserver observer = IUserSwitchObserver.Stub.asInterface(
1987 data.readStrongBinder());
1988 unregisterUserSwitchObserver(observer);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001989 reply.writeNoException();
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07001990 return true;
1991 }
1992
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07001993 case REQUEST_BUG_REPORT_TRANSACTION: {
1994 data.enforceInterface(IActivityManager.descriptor);
1995 requestBugReport();
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07001996 reply.writeNoException();
1997 return true;
1998 }
1999
2000 case INPUT_DISPATCHING_TIMED_OUT_TRANSACTION: {
2001 data.enforceInterface(IActivityManager.descriptor);
2002 int pid = data.readInt();
2003 boolean aboveSystem = data.readInt() != 0;
Jeff Brownbd181bb2013-09-10 16:44:24 -07002004 String reason = data.readString();
2005 long res = inputDispatchingTimedOut(pid, aboveSystem, reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07002006 reply.writeNoException();
2007 reply.writeLong(res);
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07002008 return true;
2009 }
2010
Adam Skorydfc7fd72013-08-05 19:23:41 -07002011 case GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002012 data.enforceInterface(IActivityManager.descriptor);
2013 int requestType = data.readInt();
Adam Skorydfc7fd72013-08-05 19:23:41 -07002014 Bundle res = getAssistContextExtras(requestType);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002015 reply.writeNoException();
2016 reply.writeBundle(res);
2017 return true;
2018 }
2019
Adam Skorydfc7fd72013-08-05 19:23:41 -07002020 case REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION: {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002021 data.enforceInterface(IActivityManager.descriptor);
2022 IBinder token = data.readStrongBinder();
2023 Bundle extras = data.readBundle();
Adam Skory7140a252013-09-11 12:04:58 +01002024 reportAssistContextExtras(token, extras);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08002025 reply.writeNoException();
2026 return true;
2027 }
2028
Dianne Hackbornf1b78242013-04-08 22:28:59 -07002029 case KILL_UID_TRANSACTION: {
2030 data.enforceInterface(IActivityManager.descriptor);
2031 int uid = data.readInt();
2032 String reason = data.readString();
2033 killUid(uid, reason);
2034 reply.writeNoException();
2035 return true;
2036 }
2037
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07002038 case HANG_TRANSACTION: {
2039 data.enforceInterface(IActivityManager.descriptor);
2040 IBinder who = data.readStrongBinder();
2041 boolean allowRestart = data.readInt() != 0;
2042 hang(who, allowRestart);
2043 reply.writeNoException();
2044 return true;
2045 }
2046
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07002047 case REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION: {
2048 data.enforceInterface(IActivityManager.descriptor);
2049 IBinder token = data.readStrongBinder();
2050 reportActivityFullyDrawn(token);
2051 reply.writeNoException();
2052 return true;
2053 }
2054
Craig Mautner5eda9b32013-07-02 11:58:16 -07002055 case NOTIFY_ACTIVITY_DRAWN_TRANSACTION: {
2056 data.enforceInterface(IActivityManager.descriptor);
2057 IBinder token = data.readStrongBinder();
2058 notifyActivityDrawn(token);
2059 reply.writeNoException();
2060 return true;
2061 }
Dianne Hackborn57a7f592013-07-22 18:21:32 -07002062
2063 case RESTART_TRANSACTION: {
2064 data.enforceInterface(IActivityManager.descriptor);
2065 restart();
2066 reply.writeNoException();
2067 return true;
2068 }
Jeff Sharkey08da7a12013-08-11 20:53:18 -07002069
Dianne Hackborn35f72be2013-09-16 10:57:39 -07002070 case PERFORM_IDLE_MAINTENANCE_TRANSACTION: {
2071 data.enforceInterface(IActivityManager.descriptor);
2072 performIdleMaintenance();
2073 reply.writeNoException();
2074 return true;
2075 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002076
2077 case CREATE_ACTIVITY_CONTAINER_TRANSACTION: {
2078 data.enforceInterface(IActivityManager.descriptor);
2079 IBinder parentActivityToken = data.readStrongBinder();
2080 IActivityContainerCallback callback =
Craig Mautnere3a00d72014-04-16 08:31:19 -07002081 IActivityContainerCallback.Stub.asInterface(data.readStrongBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08002082 IActivityContainer activityContainer =
2083 createActivityContainer(parentActivityToken, callback);
2084 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002085 if (activityContainer != null) {
2086 reply.writeInt(1);
2087 reply.writeStrongBinder(activityContainer.asBinder());
2088 } else {
2089 reply.writeInt(0);
2090 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08002091 return true;
2092 }
2093
Craig Mautner95da1082014-02-24 17:54:35 -08002094 case DELETE_ACTIVITY_CONTAINER_TRANSACTION: {
2095 data.enforceInterface(IActivityManager.descriptor);
2096 IActivityContainer activityContainer =
2097 IActivityContainer.Stub.asInterface(data.readStrongBinder());
2098 deleteActivityContainer(activityContainer);
2099 reply.writeNoException();
2100 return true;
2101 }
2102
Craig Mautnere0a38842013-12-16 16:14:02 -08002103 case GET_ACTIVITY_CONTAINER_TRANSACTION: {
2104 data.enforceInterface(IActivityManager.descriptor);
2105 IBinder activityToken = data.readStrongBinder();
2106 IActivityContainer activityContainer = getEnclosingActivityContainer(activityToken);
2107 reply.writeNoException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08002108 if (activityContainer != null) {
2109 reply.writeInt(1);
2110 reply.writeStrongBinder(activityContainer.asBinder());
2111 } else {
2112 reply.writeInt(0);
2113 }
Craig Mautnere0a38842013-12-16 16:14:02 -08002114 return true;
2115 }
2116
Craig Mautner4a1cb222013-12-04 16:14:06 -08002117 case GET_HOME_ACTIVITY_TOKEN_TRANSACTION: {
2118 data.enforceInterface(IActivityManager.descriptor);
2119 IBinder homeActivityToken = getHomeActivityToken();
2120 reply.writeNoException();
2121 reply.writeStrongBinder(homeActivityToken);
2122 return true;
2123 }
Craig Mautneraea74a52014-03-08 14:23:10 -08002124
2125 case START_LOCK_TASK_BY_TASK_ID_TRANSACTION: {
2126 data.enforceInterface(IActivityManager.descriptor);
2127 final int taskId = data.readInt();
2128 startLockTaskMode(taskId);
2129 reply.writeNoException();
2130 return true;
2131 }
2132
2133 case START_LOCK_TASK_BY_TOKEN_TRANSACTION: {
2134 data.enforceInterface(IActivityManager.descriptor);
2135 IBinder token = data.readStrongBinder();
2136 startLockTaskMode(token);
2137 reply.writeNoException();
2138 return true;
2139 }
2140
Craig Mautnerd61dc202014-07-07 11:09:11 -07002141 case START_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002142 data.enforceInterface(IActivityManager.descriptor);
2143 startLockTaskModeOnCurrent();
2144 reply.writeNoException();
2145 return true;
2146 }
2147
Craig Mautneraea74a52014-03-08 14:23:10 -08002148 case STOP_LOCK_TASK_MODE_TRANSACTION: {
2149 data.enforceInterface(IActivityManager.descriptor);
2150 stopLockTaskMode();
2151 reply.writeNoException();
2152 return true;
2153 }
2154
Craig Mautnerd61dc202014-07-07 11:09:11 -07002155 case STOP_LOCK_TASK_BY_CURRENT_TRANSACTION: {
Jason Monk62515be2014-05-21 16:06:19 -04002156 data.enforceInterface(IActivityManager.descriptor);
2157 stopLockTaskModeOnCurrent();
2158 reply.writeNoException();
2159 return true;
2160 }
2161
Craig Mautneraea74a52014-03-08 14:23:10 -08002162 case IS_IN_LOCK_TASK_MODE_TRANSACTION: {
2163 data.enforceInterface(IActivityManager.descriptor);
2164 final boolean isInLockTaskMode = isInLockTaskMode();
2165 reply.writeNoException();
2166 reply.writeInt(isInLockTaskMode ? 1 : 0);
2167 return true;
2168 }
Craig Mautner2fbd7542014-03-21 09:34:07 -07002169
Winson Chunga449dc02014-05-16 11:15:04 -07002170 case SET_TASK_DESCRIPTION_TRANSACTION: {
Craig Mautner2fbd7542014-03-21 09:34:07 -07002171 data.enforceInterface(IActivityManager.descriptor);
2172 IBinder token = data.readStrongBinder();
Winson Chunga449dc02014-05-16 11:15:04 -07002173 ActivityManager.TaskDescription values =
2174 ActivityManager.TaskDescription.CREATOR.createFromParcel(data);
2175 setTaskDescription(token, values);
Craig Mautner2fbd7542014-03-21 09:34:07 -07002176 reply.writeNoException();
2177 return true;
2178 }
Craig Mautneree2e45a2014-06-27 12:10:03 -07002179
2180 case SET_MEDIA_PLAYING_TRANSACTION: {
2181 data.enforceInterface(IActivityManager.descriptor);
2182 IBinder token = data.readStrongBinder();
2183 boolean enable = data.readInt() > 0;
2184 boolean success = setMediaPlaying(token, enable);
2185 reply.writeNoException();
2186 reply.writeInt(success ? 1 : 0);
2187 return true;
2188 }
2189
2190 case IS_BG_MEDIA_PLAYING_TRANSACTION: {
2191 data.enforceInterface(IActivityManager.descriptor);
2192 IBinder token = data.readStrongBinder();
2193 final boolean enabled = isBackgroundMediaPlaying(token);
2194 reply.writeNoException();
2195 reply.writeInt(enabled ? 1 : 0);
2196 return true;
2197 }
2198
2199 case MEDIA_RESOURCES_RELEASED: {
2200 data.enforceInterface(IActivityManager.descriptor);
2201 IBinder token = data.readStrongBinder();
2202 mediaResourcesReleased(token);
2203 reply.writeNoException();
2204 return true;
2205 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002206 }
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002207
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002208 return super.onTransact(code, data, reply, flags);
2209 }
2210
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002211 public IBinder asBinder() {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002212 return this;
2213 }
2214
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002215 private static final Singleton<IActivityManager> gDefault = new Singleton<IActivityManager>() {
2216 protected IActivityManager create() {
2217 IBinder b = ServiceManager.getService("activity");
Joe Onorato43a17652011-04-06 19:22:23 -07002218 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002219 Log.v("ActivityManager", "default service binder = " + b);
2220 }
2221 IActivityManager am = asInterface(b);
Joe Onorato43a17652011-04-06 19:22:23 -07002222 if (false) {
Brad Fitzpatrick663f4f32010-11-23 19:15:24 -08002223 Log.v("ActivityManager", "default service = " + am);
2224 }
2225 return am;
2226 }
2227 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002228}
2229
2230class ActivityManagerProxy implements IActivityManager
2231{
2232 public ActivityManagerProxy(IBinder remote)
2233 {
2234 mRemote = remote;
2235 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002237 public IBinder asBinder()
2238 {
2239 return mRemote;
2240 }
Siva Velusamy92a8b222012-03-09 16:24:04 -08002241
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002242 public int startActivity(IApplicationThread caller, String callingPackage, Intent intent,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002243 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2244 int startFlags, String profileFile,
2245 ParcelFileDescriptor profileFd, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002246 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);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002251 intent.writeToParcel(data, 0);
2252 data.writeString(resolvedType);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002253 data.writeStrongBinder(resultTo);
2254 data.writeString(resultWho);
2255 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002256 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002257 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 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002264 if (options != null) {
2265 data.writeInt(1);
2266 options.writeToParcel(data, 0);
2267 } else {
2268 data.writeInt(0);
2269 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002270 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2271 reply.readException();
2272 int result = reply.readInt();
2273 reply.recycle();
2274 data.recycle();
2275 return result;
2276 }
Amith Yamasani82644082012-08-03 13:09:11 -07002277
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002278 public int startActivityAsUser(IApplicationThread caller, String callingPackage, Intent intent,
Amith Yamasani82644082012-08-03 13:09:11 -07002279 String resolvedType, IBinder resultTo, String resultWho, int requestCode,
2280 int startFlags, String profileFile,
2281 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2282 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);
Amith Yamasani82644082012-08-03 13:09:11 -07002287 intent.writeToParcel(data, 0);
2288 data.writeString(resolvedType);
2289 data.writeStrongBinder(resultTo);
2290 data.writeString(resultWho);
2291 data.writeInt(requestCode);
2292 data.writeInt(startFlags);
2293 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 }
2300 if (options != null) {
2301 data.writeInt(1);
2302 options.writeToParcel(data, 0);
2303 } else {
2304 data.writeInt(0);
2305 }
2306 data.writeInt(userId);
2307 mRemote.transact(START_ACTIVITY_AS_USER_TRANSACTION, data, reply, 0);
2308 reply.readException();
2309 int result = reply.readInt();
2310 reply.recycle();
2311 data.recycle();
2312 return result;
2313 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002314 public WaitResult startActivityAndWait(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, String profileFile,
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002317 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002318 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 Hackborn8f7f35e2010-02-25 18:48:12 -08002323 intent.writeToParcel(data, 0);
2324 data.writeString(resolvedType);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002325 data.writeStrongBinder(resultTo);
2326 data.writeString(resultWho);
2327 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002328 data.writeInt(startFlags);
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002329 data.writeString(profileFile);
2330 if (profileFd != null) {
2331 data.writeInt(1);
2332 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2333 } else {
2334 data.writeInt(0);
2335 }
Dianne Hackborna4972e92012-03-14 10:38:05 -07002336 if (options != null) {
2337 data.writeInt(1);
2338 options.writeToParcel(data, 0);
2339 } else {
2340 data.writeInt(0);
2341 }
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07002342 data.writeInt(userId);
Dianne Hackborn8f7f35e2010-02-25 18:48:12 -08002343 mRemote.transact(START_ACTIVITY_AND_WAIT_TRANSACTION, data, reply, 0);
2344 reply.readException();
2345 WaitResult result = WaitResult.CREATOR.createFromParcel(reply);
2346 reply.recycle();
2347 data.recycle();
2348 return result;
2349 }
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002350 public int startActivityWithConfig(IApplicationThread caller, String callingPackage,
2351 Intent intent, String resolvedType, IBinder resultTo, String resultWho,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002352 int requestCode, int startFlags, Configuration config,
Dianne Hackborn41203752012-08-31 14:05:51 -07002353 Bundle options, int userId) throws RemoteException {
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002354 Parcel data = Parcel.obtain();
2355 Parcel reply = Parcel.obtain();
2356 data.writeInterfaceToken(IActivityManager.descriptor);
2357 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08002358 data.writeString(callingPackage);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002359 intent.writeToParcel(data, 0);
2360 data.writeString(resolvedType);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002361 data.writeStrongBinder(resultTo);
2362 data.writeString(resultWho);
2363 data.writeInt(requestCode);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002364 data.writeInt(startFlags);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002365 config.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002366 if (options != null) {
2367 data.writeInt(1);
2368 options.writeToParcel(data, 0);
2369 } else {
2370 data.writeInt(0);
2371 }
Dianne Hackborn41203752012-08-31 14:05:51 -07002372 data.writeInt(userId);
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07002373 mRemote.transact(START_ACTIVITY_TRANSACTION, data, reply, 0);
2374 reply.readException();
2375 int result = reply.readInt();
2376 reply.recycle();
2377 data.recycle();
2378 return result;
2379 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002380 public int startActivityIntentSender(IApplicationThread caller,
2381 IntentSender intent, Intent fillInIntent, String resolvedType,
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002382 IBinder resultTo, String resultWho, int requestCode,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002383 int flagsMask, int flagsValues, Bundle options) throws RemoteException {
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002384 Parcel data = Parcel.obtain();
2385 Parcel reply = Parcel.obtain();
2386 data.writeInterfaceToken(IActivityManager.descriptor);
2387 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2388 intent.writeToParcel(data, 0);
2389 if (fillInIntent != null) {
2390 data.writeInt(1);
2391 fillInIntent.writeToParcel(data, 0);
2392 } else {
2393 data.writeInt(0);
2394 }
2395 data.writeString(resolvedType);
2396 data.writeStrongBinder(resultTo);
2397 data.writeString(resultWho);
2398 data.writeInt(requestCode);
2399 data.writeInt(flagsMask);
2400 data.writeInt(flagsValues);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002401 if (options != null) {
2402 data.writeInt(1);
2403 options.writeToParcel(data, 0);
2404 } else {
2405 data.writeInt(0);
2406 }
Dianne Hackbornfa82f222009-09-17 15:14:12 -07002407 mRemote.transact(START_ACTIVITY_INTENT_SENDER_TRANSACTION, data, reply, 0);
Dianne Hackbornbcbcaa72009-09-10 10:54:46 -07002408 reply.readException();
2409 int result = reply.readInt();
2410 reply.recycle();
2411 data.recycle();
2412 return result;
2413 }
Dianne Hackborn91097de2014-04-04 18:02:06 -07002414 public int startVoiceActivity(String callingPackage, int callingPid, int callingUid,
2415 Intent intent, String resolvedType, IVoiceInteractionSession session,
2416 IVoiceInteractor interactor, int startFlags, String profileFile,
2417 ParcelFileDescriptor profileFd, Bundle options, int userId) throws RemoteException {
2418 Parcel data = Parcel.obtain();
2419 Parcel reply = Parcel.obtain();
2420 data.writeInterfaceToken(IActivityManager.descriptor);
2421 data.writeString(callingPackage);
2422 data.writeInt(callingPid);
2423 data.writeInt(callingUid);
2424 intent.writeToParcel(data, 0);
2425 data.writeString(resolvedType);
2426 data.writeStrongBinder(session.asBinder());
2427 data.writeStrongBinder(interactor.asBinder());
2428 data.writeInt(startFlags);
2429 data.writeString(profileFile);
2430 if (profileFd != null) {
2431 data.writeInt(1);
2432 profileFd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
2433 } else {
2434 data.writeInt(0);
2435 }
2436 if (options != null) {
2437 data.writeInt(1);
2438 options.writeToParcel(data, 0);
2439 } else {
2440 data.writeInt(0);
2441 }
2442 data.writeInt(userId);
2443 mRemote.transact(START_VOICE_ACTIVITY_TRANSACTION, data, reply, 0);
2444 reply.readException();
2445 int result = reply.readInt();
2446 reply.recycle();
2447 data.recycle();
2448 return result;
2449 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002450 public boolean startNextMatchingActivity(IBinder callingActivity,
Dianne Hackborna4972e92012-03-14 10:38:05 -07002451 Intent intent, Bundle options) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002452 Parcel data = Parcel.obtain();
2453 Parcel reply = Parcel.obtain();
2454 data.writeInterfaceToken(IActivityManager.descriptor);
2455 data.writeStrongBinder(callingActivity);
2456 intent.writeToParcel(data, 0);
Dianne Hackborna4972e92012-03-14 10:38:05 -07002457 if (options != null) {
2458 data.writeInt(1);
2459 options.writeToParcel(data, 0);
2460 } else {
2461 data.writeInt(0);
2462 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002463 mRemote.transact(START_NEXT_MATCHING_ACTIVITY_TRANSACTION, data, reply, 0);
2464 reply.readException();
2465 int result = reply.readInt();
2466 reply.recycle();
2467 data.recycle();
2468 return result != 0;
2469 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002470 public boolean finishActivity(IBinder token, int resultCode, Intent resultData, boolean finishTask)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002471 throws RemoteException {
2472 Parcel data = Parcel.obtain();
2473 Parcel reply = Parcel.obtain();
2474 data.writeInterfaceToken(IActivityManager.descriptor);
2475 data.writeStrongBinder(token);
2476 data.writeInt(resultCode);
2477 if (resultData != null) {
2478 data.writeInt(1);
2479 resultData.writeToParcel(data, 0);
2480 } else {
2481 data.writeInt(0);
2482 }
Winson Chung3b3f4642014-04-22 10:08:18 -07002483 data.writeInt(finishTask ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002484 mRemote.transact(FINISH_ACTIVITY_TRANSACTION, data, reply, 0);
2485 reply.readException();
2486 boolean res = reply.readInt() != 0;
2487 data.recycle();
2488 reply.recycle();
2489 return res;
2490 }
2491 public void finishSubActivity(IBinder token, String resultWho, int requestCode) throws RemoteException
2492 {
2493 Parcel data = Parcel.obtain();
2494 Parcel reply = Parcel.obtain();
2495 data.writeInterfaceToken(IActivityManager.descriptor);
2496 data.writeStrongBinder(token);
2497 data.writeString(resultWho);
2498 data.writeInt(requestCode);
2499 mRemote.transact(FINISH_SUB_ACTIVITY_TRANSACTION, data, reply, 0);
2500 reply.readException();
2501 data.recycle();
2502 reply.recycle();
2503 }
Dianne Hackbornecc5a9c2012-04-26 18:56:09 -07002504 public boolean finishActivityAffinity(IBinder token) throws RemoteException {
2505 Parcel data = Parcel.obtain();
2506 Parcel reply = Parcel.obtain();
2507 data.writeInterfaceToken(IActivityManager.descriptor);
2508 data.writeStrongBinder(token);
2509 mRemote.transact(FINISH_ACTIVITY_AFFINITY_TRANSACTION, data, reply, 0);
2510 reply.readException();
2511 boolean res = reply.readInt() != 0;
2512 data.recycle();
2513 reply.recycle();
2514 return res;
2515 }
Dianne Hackborn6ea0d0a2014-07-02 16:23:21 -07002516 public void finishVoiceTask(IVoiceInteractionSession session) throws RemoteException {
2517 Parcel data = Parcel.obtain();
2518 Parcel reply = Parcel.obtain();
2519 data.writeInterfaceToken(IActivityManager.descriptor);
2520 data.writeStrongBinder(session.asBinder());
2521 mRemote.transact(FINISH_VOICE_TASK_TRANSACTION, data, reply, 0);
2522 reply.readException();
2523 data.recycle();
2524 reply.recycle();
2525 }
Dianne Hackborn061d58a2010-03-12 15:07:06 -08002526 public boolean willActivityBeVisible(IBinder token) throws RemoteException {
2527 Parcel data = Parcel.obtain();
2528 Parcel reply = Parcel.obtain();
2529 data.writeInterfaceToken(IActivityManager.descriptor);
2530 data.writeStrongBinder(token);
2531 mRemote.transact(WILL_ACTIVITY_BE_VISIBLE_TRANSACTION, data, reply, 0);
2532 reply.readException();
2533 boolean res = reply.readInt() != 0;
2534 data.recycle();
2535 reply.recycle();
2536 return res;
2537 }
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002538 public Intent registerReceiver(IApplicationThread caller, String packageName,
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002539 IIntentReceiver receiver,
Dianne Hackborn20e80982012-08-31 19:00:44 -07002540 IntentFilter filter, String perm, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002541 {
2542 Parcel data = Parcel.obtain();
2543 Parcel reply = Parcel.obtain();
2544 data.writeInterfaceToken(IActivityManager.descriptor);
2545 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackborn6c418d52011-06-29 14:05:33 -07002546 data.writeString(packageName);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002547 data.writeStrongBinder(receiver != null ? receiver.asBinder() : null);
2548 filter.writeToParcel(data, 0);
2549 data.writeString(perm);
Dianne Hackborn20e80982012-08-31 19:00:44 -07002550 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002551 mRemote.transact(REGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2552 reply.readException();
2553 Intent intent = null;
2554 int haveIntent = reply.readInt();
2555 if (haveIntent != 0) {
2556 intent = Intent.CREATOR.createFromParcel(reply);
2557 }
2558 reply.recycle();
2559 data.recycle();
2560 return intent;
2561 }
2562 public void unregisterReceiver(IIntentReceiver receiver) throws RemoteException
2563 {
2564 Parcel data = Parcel.obtain();
2565 Parcel reply = Parcel.obtain();
2566 data.writeInterfaceToken(IActivityManager.descriptor);
2567 data.writeStrongBinder(receiver.asBinder());
2568 mRemote.transact(UNREGISTER_RECEIVER_TRANSACTION, data, reply, 0);
2569 reply.readException();
2570 data.recycle();
2571 reply.recycle();
2572 }
2573 public int broadcastIntent(IApplicationThread caller,
2574 Intent intent, String resolvedType, IIntentReceiver resultTo,
2575 int resultCode, String resultData, Bundle map,
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002576 String requiredPermission, int appOp, boolean serialized,
Amith Yamasani742a6712011-05-04 14:49:28 -07002577 boolean sticky, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 {
2579 Parcel data = Parcel.obtain();
2580 Parcel reply = Parcel.obtain();
2581 data.writeInterfaceToken(IActivityManager.descriptor);
2582 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2583 intent.writeToParcel(data, 0);
2584 data.writeString(resolvedType);
2585 data.writeStrongBinder(resultTo != null ? resultTo.asBinder() : null);
2586 data.writeInt(resultCode);
2587 data.writeString(resultData);
2588 data.writeBundle(map);
2589 data.writeString(requiredPermission);
Dianne Hackbornf51f6122013-02-04 18:23:34 -08002590 data.writeInt(appOp);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002591 data.writeInt(serialized ? 1 : 0);
2592 data.writeInt(sticky ? 1 : 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002593 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 mRemote.transact(BROADCAST_INTENT_TRANSACTION, data, reply, 0);
2595 reply.readException();
2596 int res = reply.readInt();
2597 reply.recycle();
2598 data.recycle();
2599 return res;
2600 }
Amith Yamasani742a6712011-05-04 14:49:28 -07002601 public void unbroadcastIntent(IApplicationThread caller, Intent intent, int userId)
2602 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002603 {
2604 Parcel data = Parcel.obtain();
2605 Parcel reply = Parcel.obtain();
2606 data.writeInterfaceToken(IActivityManager.descriptor);
2607 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
2608 intent.writeToParcel(data, 0);
Amith Yamasani742a6712011-05-04 14:49:28 -07002609 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002610 mRemote.transact(UNBROADCAST_INTENT_TRANSACTION, data, reply, 0);
2611 reply.readException();
2612 data.recycle();
2613 reply.recycle();
2614 }
2615 public void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map, boolean abortBroadcast) throws RemoteException
2616 {
2617 Parcel data = Parcel.obtain();
2618 Parcel reply = Parcel.obtain();
2619 data.writeInterfaceToken(IActivityManager.descriptor);
2620 data.writeStrongBinder(who);
2621 data.writeInt(resultCode);
2622 data.writeString(resultData);
2623 data.writeBundle(map);
2624 data.writeInt(abortBroadcast ? 1 : 0);
2625 mRemote.transact(FINISH_RECEIVER_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2626 reply.readException();
2627 data.recycle();
2628 reply.recycle();
2629 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002630 public void attachApplication(IApplicationThread app) throws RemoteException
2631 {
2632 Parcel data = Parcel.obtain();
2633 Parcel reply = Parcel.obtain();
2634 data.writeInterfaceToken(IActivityManager.descriptor);
2635 data.writeStrongBinder(app.asBinder());
2636 mRemote.transact(ATTACH_APPLICATION_TRANSACTION, data, reply, 0);
2637 reply.readException();
2638 data.recycle();
2639 reply.recycle();
2640 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002641 public void activityIdle(IBinder token, Configuration config, boolean stopProfiling)
2642 throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 {
2644 Parcel data = Parcel.obtain();
2645 Parcel reply = Parcel.obtain();
2646 data.writeInterfaceToken(IActivityManager.descriptor);
2647 data.writeStrongBinder(token);
Dianne Hackborne88846e2009-09-30 21:34:25 -07002648 if (config != null) {
2649 data.writeInt(1);
2650 config.writeToParcel(data, 0);
2651 } else {
2652 data.writeInt(0);
2653 }
Dianne Hackborn62f20ec2011-08-15 17:40:28 -07002654 data.writeInt(stopProfiling ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 mRemote.transact(ACTIVITY_IDLE_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2656 reply.readException();
2657 data.recycle();
2658 reply.recycle();
2659 }
Dianne Hackbornad9b32112012-09-17 15:35:01 -07002660 public void activityResumed(IBinder token) throws RemoteException
2661 {
2662 Parcel data = Parcel.obtain();
2663 Parcel reply = Parcel.obtain();
2664 data.writeInterfaceToken(IActivityManager.descriptor);
2665 data.writeStrongBinder(token);
2666 mRemote.transact(ACTIVITY_RESUMED_TRANSACTION, data, reply, 0);
2667 reply.readException();
2668 data.recycle();
2669 reply.recycle();
2670 }
Craig Mautnera0026042014-04-23 11:45:37 -07002671 public void activityPaused(IBinder token, PersistableBundle persistentState) throws RemoteException
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002672 {
2673 Parcel data = Parcel.obtain();
2674 Parcel reply = Parcel.obtain();
2675 data.writeInterfaceToken(IActivityManager.descriptor);
2676 data.writeStrongBinder(token);
Craig Mautnera0026042014-04-23 11:45:37 -07002677 data.writePersistableBundle(persistentState);
Dianne Hackborn0aae2d42010-12-07 23:51:29 -08002678 mRemote.transact(ACTIVITY_PAUSED_TRANSACTION, data, reply, 0);
2679 reply.readException();
2680 data.recycle();
2681 reply.recycle();
2682 }
2683 public void activityStopped(IBinder token, Bundle state,
Craig Mautnera0026042014-04-23 11:45:37 -07002684 PersistableBundle persistentState, CharSequence description) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002685 {
2686 Parcel data = Parcel.obtain();
2687 Parcel reply = Parcel.obtain();
2688 data.writeInterfaceToken(IActivityManager.descriptor);
2689 data.writeStrongBinder(token);
2690 data.writeBundle(state);
Craig Mautnera0026042014-04-23 11:45:37 -07002691 data.writePersistableBundle(persistentState);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002692 TextUtils.writeToParcel(description, data, 0);
2693 mRemote.transact(ACTIVITY_STOPPED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2694 reply.readException();
2695 data.recycle();
2696 reply.recycle();
2697 }
Dianne Hackborn4eba96b2011-01-21 13:34:36 -08002698 public void activitySlept(IBinder token) throws RemoteException
2699 {
2700 Parcel data = Parcel.obtain();
2701 Parcel reply = Parcel.obtain();
2702 data.writeInterfaceToken(IActivityManager.descriptor);
2703 data.writeStrongBinder(token);
2704 mRemote.transact(ACTIVITY_SLEPT_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2705 reply.readException();
2706 data.recycle();
2707 reply.recycle();
2708 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002709 public void activityDestroyed(IBinder token) throws RemoteException
2710 {
2711 Parcel data = Parcel.obtain();
2712 Parcel reply = Parcel.obtain();
2713 data.writeInterfaceToken(IActivityManager.descriptor);
2714 data.writeStrongBinder(token);
2715 mRemote.transact(ACTIVITY_DESTROYED_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
2716 reply.readException();
2717 data.recycle();
2718 reply.recycle();
2719 }
2720 public String getCallingPackage(IBinder token) throws RemoteException
2721 {
2722 Parcel data = Parcel.obtain();
2723 Parcel reply = Parcel.obtain();
2724 data.writeInterfaceToken(IActivityManager.descriptor);
2725 data.writeStrongBinder(token);
2726 mRemote.transact(GET_CALLING_PACKAGE_TRANSACTION, data, reply, 0);
2727 reply.readException();
2728 String res = reply.readString();
2729 data.recycle();
2730 reply.recycle();
2731 return res;
2732 }
2733 public ComponentName getCallingActivity(IBinder token)
2734 throws RemoteException {
2735 Parcel data = Parcel.obtain();
2736 Parcel reply = Parcel.obtain();
2737 data.writeInterfaceToken(IActivityManager.descriptor);
2738 data.writeStrongBinder(token);
2739 mRemote.transact(GET_CALLING_ACTIVITY_TRANSACTION, data, reply, 0);
2740 reply.readException();
2741 ComponentName res = ComponentName.readFromParcel(reply);
2742 data.recycle();
2743 reply.recycle();
2744 return res;
2745 }
Winson Chung1147c402014-05-14 11:05:00 -07002746 public List<IAppTask> getAppTasks() throws RemoteException {
2747 Parcel data = Parcel.obtain();
2748 Parcel reply = Parcel.obtain();
2749 data.writeInterfaceToken(IActivityManager.descriptor);
2750 mRemote.transact(GET_APP_TASKS_TRANSACTION, data, reply, 0);
2751 reply.readException();
2752 ArrayList<IAppTask> list = null;
2753 int N = reply.readInt();
2754 if (N >= 0) {
2755 list = new ArrayList<IAppTask>();
2756 while (N > 0) {
2757 IAppTask task = IAppTask.Stub.asInterface(reply.readStrongBinder());
2758 list.add(task);
2759 N--;
2760 }
2761 }
2762 data.recycle();
2763 reply.recycle();
2764 return list;
2765 }
Dianne Hackborn09233282014-04-30 11:33:59 -07002766 public List getTasks(int maxNum, int flags) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002767 Parcel data = Parcel.obtain();
2768 Parcel reply = Parcel.obtain();
2769 data.writeInterfaceToken(IActivityManager.descriptor);
2770 data.writeInt(maxNum);
2771 data.writeInt(flags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002772 mRemote.transact(GET_TASKS_TRANSACTION, data, reply, 0);
2773 reply.readException();
2774 ArrayList list = null;
2775 int N = reply.readInt();
2776 if (N >= 0) {
2777 list = new ArrayList();
2778 while (N > 0) {
2779 ActivityManager.RunningTaskInfo info =
2780 ActivityManager.RunningTaskInfo.CREATOR
Winson Chung1147c402014-05-14 11:05:00 -07002781 .createFromParcel(reply);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002782 list.add(info);
2783 N--;
2784 }
2785 }
2786 data.recycle();
2787 reply.recycle();
2788 return list;
2789 }
2790 public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
Amith Yamasani82644082012-08-03 13:09:11 -07002791 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002792 Parcel data = Parcel.obtain();
2793 Parcel reply = Parcel.obtain();
2794 data.writeInterfaceToken(IActivityManager.descriptor);
2795 data.writeInt(maxNum);
2796 data.writeInt(flags);
Amith Yamasani82644082012-08-03 13:09:11 -07002797 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002798 mRemote.transact(GET_RECENT_TASKS_TRANSACTION, data, reply, 0);
2799 reply.readException();
2800 ArrayList<ActivityManager.RecentTaskInfo> list
2801 = reply.createTypedArrayList(ActivityManager.RecentTaskInfo.CREATOR);
2802 data.recycle();
2803 reply.recycle();
2804 return list;
2805 }
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002806 public ActivityManager.TaskThumbnail getTaskThumbnail(int id) throws RemoteException {
Dianne Hackbornd94df452011-02-16 18:53:31 -08002807 Parcel data = Parcel.obtain();
2808 Parcel reply = Parcel.obtain();
2809 data.writeInterfaceToken(IActivityManager.descriptor);
2810 data.writeInt(id);
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002811 mRemote.transact(GET_TASK_THUMBNAIL_TRANSACTION, data, reply, 0);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002812 reply.readException();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002813 ActivityManager.TaskThumbnail taskThumbnail = null;
Dianne Hackbornd94df452011-02-16 18:53:31 -08002814 if (reply.readInt() != 0) {
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002815 taskThumbnail = ActivityManager.TaskThumbnail.CREATOR.createFromParcel(reply);
Dianne Hackbornd94df452011-02-16 18:53:31 -08002816 }
2817 data.recycle();
2818 reply.recycle();
Craig Mautnerc0ffce52014-07-01 12:38:52 -07002819 return taskThumbnail;
Dianne Hackborn15491c62012-09-19 10:59:14 -07002820 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 public List getServices(int maxNum, int flags) throws RemoteException {
2822 Parcel data = Parcel.obtain();
2823 Parcel reply = Parcel.obtain();
2824 data.writeInterfaceToken(IActivityManager.descriptor);
2825 data.writeInt(maxNum);
2826 data.writeInt(flags);
2827 mRemote.transact(GET_SERVICES_TRANSACTION, data, reply, 0);
2828 reply.readException();
2829 ArrayList list = null;
2830 int N = reply.readInt();
2831 if (N >= 0) {
2832 list = new ArrayList();
2833 while (N > 0) {
2834 ActivityManager.RunningServiceInfo info =
2835 ActivityManager.RunningServiceInfo.CREATOR
2836 .createFromParcel(reply);
2837 list.add(info);
2838 N--;
2839 }
2840 }
2841 data.recycle();
2842 reply.recycle();
2843 return list;
2844 }
2845 public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
2846 throws RemoteException {
2847 Parcel data = Parcel.obtain();
2848 Parcel reply = Parcel.obtain();
2849 data.writeInterfaceToken(IActivityManager.descriptor);
2850 mRemote.transact(GET_PROCESSES_IN_ERROR_STATE_TRANSACTION, data, reply, 0);
2851 reply.readException();
2852 ArrayList<ActivityManager.ProcessErrorStateInfo> list
2853 = reply.createTypedArrayList(ActivityManager.ProcessErrorStateInfo.CREATOR);
2854 data.recycle();
2855 reply.recycle();
2856 return list;
2857 }
2858 public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
2859 throws RemoteException {
2860 Parcel data = Parcel.obtain();
2861 Parcel reply = Parcel.obtain();
2862 data.writeInterfaceToken(IActivityManager.descriptor);
2863 mRemote.transact(GET_RUNNING_APP_PROCESSES_TRANSACTION, data, reply, 0);
2864 reply.readException();
2865 ArrayList<ActivityManager.RunningAppProcessInfo> list
2866 = reply.createTypedArrayList(ActivityManager.RunningAppProcessInfo.CREATOR);
2867 data.recycle();
2868 reply.recycle();
2869 return list;
2870 }
Suchi Amalapurapuf7f5dda2010-03-23 10:34:28 -07002871 public List<ApplicationInfo> getRunningExternalApplications()
2872 throws RemoteException {
2873 Parcel data = Parcel.obtain();
2874 Parcel reply = Parcel.obtain();
2875 data.writeInterfaceToken(IActivityManager.descriptor);
2876 mRemote.transact(GET_RUNNING_EXTERNAL_APPLICATIONS_TRANSACTION, data, reply, 0);
2877 reply.readException();
2878 ArrayList<ApplicationInfo> list
2879 = reply.createTypedArrayList(ApplicationInfo.CREATOR);
2880 data.recycle();
2881 reply.recycle();
2882 return list;
2883 }
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002884 public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002885 {
2886 Parcel data = Parcel.obtain();
2887 Parcel reply = Parcel.obtain();
2888 data.writeInterfaceToken(IActivityManager.descriptor);
2889 data.writeInt(task);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08002890 data.writeInt(flags);
Dianne Hackborn8078d8c2012-03-20 11:11:26 -07002891 if (options != null) {
2892 data.writeInt(1);
2893 options.writeToParcel(data, 0);
2894 } else {
2895 data.writeInt(0);
2896 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002897 mRemote.transact(MOVE_TASK_TO_FRONT_TRANSACTION, data, reply, 0);
2898 reply.readException();
2899 data.recycle();
2900 reply.recycle();
2901 }
2902 public void moveTaskToBack(int task) throws RemoteException
2903 {
2904 Parcel data = Parcel.obtain();
2905 Parcel reply = Parcel.obtain();
2906 data.writeInterfaceToken(IActivityManager.descriptor);
2907 data.writeInt(task);
2908 mRemote.transact(MOVE_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2909 reply.readException();
2910 data.recycle();
2911 reply.recycle();
2912 }
2913 public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot)
2914 throws RemoteException {
2915 Parcel data = Parcel.obtain();
2916 Parcel reply = Parcel.obtain();
2917 data.writeInterfaceToken(IActivityManager.descriptor);
2918 data.writeStrongBinder(token);
2919 data.writeInt(nonRoot ? 1 : 0);
2920 mRemote.transact(MOVE_ACTIVITY_TASK_TO_BACK_TRANSACTION, data, reply, 0);
2921 reply.readException();
2922 boolean res = reply.readInt() != 0;
2923 data.recycle();
2924 reply.recycle();
2925 return res;
2926 }
2927 public void moveTaskBackwards(int task) throws RemoteException
2928 {
2929 Parcel data = Parcel.obtain();
2930 Parcel reply = Parcel.obtain();
2931 data.writeInterfaceToken(IActivityManager.descriptor);
2932 data.writeInt(task);
2933 mRemote.transact(MOVE_TASK_BACKWARDS_TRANSACTION, data, reply, 0);
2934 reply.readException();
2935 data.recycle();
2936 reply.recycle();
2937 }
Craig Mautnerc00204b2013-03-05 15:02:14 -08002938 @Override
Craig Mautnerc00204b2013-03-05 15:02:14 -08002939 public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
2940 {
2941 Parcel data = Parcel.obtain();
2942 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002943 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002944 data.writeInt(taskId);
2945 data.writeInt(stackId);
2946 data.writeInt(toTop ? 1 : 0);
2947 mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
2948 reply.readException();
2949 data.recycle();
2950 reply.recycle();
2951 }
2952 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002953 public void resizeStack(int stackBoxId, Rect r) throws RemoteException
Craig Mautnerc00204b2013-03-05 15:02:14 -08002954 {
2955 Parcel data = Parcel.obtain();
2956 Parcel reply = Parcel.obtain();
Craig Mautner967212c2013-04-13 21:10:58 -07002957 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautner5a449152013-05-24 15:49:29 -07002958 data.writeInt(stackBoxId);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002959 r.writeToParcel(data, 0);
Craig Mautnercf910b02013-04-23 11:23:27 -07002960 mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautnerc00204b2013-03-05 15:02:14 -08002961 reply.readException();
2962 data.recycle();
2963 reply.recycle();
2964 }
Craig Mautner967212c2013-04-13 21:10:58 -07002965 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002966 public List<StackInfo> getAllStackInfos() throws RemoteException
Craig Mautner5ff12102013-05-24 12:50:15 -07002967 {
2968 Parcel data = Parcel.obtain();
2969 Parcel reply = Parcel.obtain();
2970 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002971 mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
Craig Mautner5ff12102013-05-24 12:50:15 -07002972 reply.readException();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002973 ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
Craig Mautner967212c2013-04-13 21:10:58 -07002974 data.recycle();
2975 reply.recycle();
2976 return list;
2977 }
Craig Mautnercf910b02013-04-23 11:23:27 -07002978 @Override
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002979 public StackInfo getStackInfo(int stackId) throws RemoteException
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002980 {
2981 Parcel data = Parcel.obtain();
2982 Parcel reply = Parcel.obtain();
2983 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002984 data.writeInt(stackId);
2985 mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002986 reply.readException();
2987 int res = reply.readInt();
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002988 StackInfo info = null;
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002989 if (res != 0) {
Craig Mautnerbdc748af2013-12-02 14:08:25 -08002990 info = StackInfo.CREATOR.createFromParcel(reply);
Craig Mautnerfd1ce8d2013-06-17 16:15:42 -07002991 }
2992 data.recycle();
2993 reply.recycle();
2994 return info;
2995 }
2996 @Override
Winson Chung303e1ff2014-03-07 15:06:19 -08002997 public boolean isInHomeStack(int taskId) throws RemoteException {
2998 Parcel data = Parcel.obtain();
2999 Parcel reply = Parcel.obtain();
3000 data.writeInterfaceToken(IActivityManager.descriptor);
3001 data.writeInt(taskId);
3002 mRemote.transact(IS_IN_HOME_STACK_TRANSACTION, data, reply, 0);
3003 reply.readException();
3004 boolean isInHomeStack = reply.readInt() > 0;
3005 data.recycle();
3006 reply.recycle();
3007 return isInHomeStack;
3008 }
3009 @Override
Craig Mautnercf910b02013-04-23 11:23:27 -07003010 public void setFocusedStack(int stackId) throws RemoteException
3011 {
3012 Parcel data = Parcel.obtain();
3013 Parcel reply = Parcel.obtain();
3014 data.writeInterfaceToken(IActivityManager.descriptor);
3015 data.writeInt(stackId);
3016 mRemote.transact(SET_FOCUSED_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3017 reply.readException();
3018 data.recycle();
3019 reply.recycle();
3020 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003021 public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
3022 {
3023 Parcel data = Parcel.obtain();
3024 Parcel reply = Parcel.obtain();
3025 data.writeInterfaceToken(IActivityManager.descriptor);
3026 data.writeStrongBinder(token);
3027 data.writeInt(onlyRoot ? 1 : 0);
3028 mRemote.transact(GET_TASK_FOR_ACTIVITY_TRANSACTION, data, reply, 0);
3029 reply.readException();
3030 int res = reply.readInt();
3031 data.recycle();
3032 reply.recycle();
3033 return res;
3034 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003035 public ContentProviderHolder getContentProvider(IApplicationThread caller,
Jeff Sharkey6d515712012-09-20 16:06:08 -07003036 String name, int userId, boolean stable) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003037 Parcel data = Parcel.obtain();
3038 Parcel reply = Parcel.obtain();
3039 data.writeInterfaceToken(IActivityManager.descriptor);
3040 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3041 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003042 data.writeInt(userId);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003043 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003044 mRemote.transact(GET_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3045 reply.readException();
3046 int res = reply.readInt();
3047 ContentProviderHolder cph = null;
3048 if (res != 0) {
3049 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3050 }
3051 data.recycle();
3052 reply.recycle();
3053 return cph;
3054 }
Jeff Sharkey6d515712012-09-20 16:06:08 -07003055 public ContentProviderHolder getContentProviderExternal(String name, int userId, IBinder token)
3056 throws RemoteException {
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003057 Parcel data = Parcel.obtain();
3058 Parcel reply = Parcel.obtain();
3059 data.writeInterfaceToken(IActivityManager.descriptor);
3060 data.writeString(name);
Jeff Sharkey6d515712012-09-20 16:06:08 -07003061 data.writeInt(userId);
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003062 data.writeStrongBinder(token);
3063 mRemote.transact(GET_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3064 reply.readException();
3065 int res = reply.readInt();
3066 ContentProviderHolder cph = null;
3067 if (res != 0) {
3068 cph = ContentProviderHolder.CREATOR.createFromParcel(reply);
3069 }
3070 data.recycle();
3071 reply.recycle();
3072 return cph;
3073 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003074 public void publishContentProviders(IApplicationThread caller,
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003075 List<ContentProviderHolder> providers) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003076 {
3077 Parcel data = Parcel.obtain();
3078 Parcel reply = Parcel.obtain();
3079 data.writeInterfaceToken(IActivityManager.descriptor);
3080 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3081 data.writeTypedList(providers);
3082 mRemote.transact(PUBLISH_CONTENT_PROVIDERS_TRANSACTION, data, reply, 0);
3083 reply.readException();
3084 data.recycle();
3085 reply.recycle();
3086 }
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003087 public boolean refContentProvider(IBinder connection, int stable, int unstable)
3088 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003089 Parcel data = Parcel.obtain();
3090 Parcel reply = Parcel.obtain();
3091 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003092 data.writeStrongBinder(connection);
3093 data.writeInt(stable);
3094 data.writeInt(unstable);
3095 mRemote.transact(REF_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3096 reply.readException();
3097 boolean res = reply.readInt() != 0;
3098 data.recycle();
3099 reply.recycle();
3100 return res;
3101 }
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003102
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003103 public void unstableProviderDied(IBinder connection) throws RemoteException {
3104 Parcel data = Parcel.obtain();
3105 Parcel reply = Parcel.obtain();
3106 data.writeInterfaceToken(IActivityManager.descriptor);
3107 data.writeStrongBinder(connection);
3108 mRemote.transact(UNSTABLE_PROVIDER_DIED_TRANSACTION, data, reply, 0);
3109 reply.readException();
3110 data.recycle();
3111 reply.recycle();
3112 }
3113
Jeff Sharkey7aa76012013-09-30 14:26:27 -07003114 @Override
3115 public void appNotRespondingViaProvider(IBinder connection) throws RemoteException {
3116 Parcel data = Parcel.obtain();
3117 Parcel reply = Parcel.obtain();
3118 data.writeInterfaceToken(IActivityManager.descriptor);
3119 data.writeStrongBinder(connection);
3120 mRemote.transact(APP_NOT_RESPONDING_VIA_PROVIDER_TRANSACTION, data, reply, 0);
3121 reply.readException();
3122 data.recycle();
3123 reply.recycle();
3124 }
3125
Dianne Hackborn6ae8d182012-05-23 13:12:42 -07003126 public void removeContentProvider(IBinder connection, boolean stable) throws RemoteException {
3127 Parcel data = Parcel.obtain();
3128 Parcel reply = Parcel.obtain();
3129 data.writeInterfaceToken(IActivityManager.descriptor);
3130 data.writeStrongBinder(connection);
3131 data.writeInt(stable ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003132 mRemote.transact(REMOVE_CONTENT_PROVIDER_TRANSACTION, data, reply, 0);
3133 reply.readException();
3134 data.recycle();
3135 reply.recycle();
3136 }
Svetoslav Ganov25872aa2012-02-03 19:19:09 -08003137
3138 public void removeContentProviderExternal(String name, IBinder token) throws RemoteException {
3139 Parcel data = Parcel.obtain();
3140 Parcel reply = Parcel.obtain();
3141 data.writeInterfaceToken(IActivityManager.descriptor);
3142 data.writeString(name);
3143 data.writeStrongBinder(token);
3144 mRemote.transact(REMOVE_CONTENT_PROVIDER_EXTERNAL_TRANSACTION, data, reply, 0);
3145 reply.readException();
3146 data.recycle();
3147 reply.recycle();
3148 }
3149
Dianne Hackborndd9b82c2009-09-03 00:18:47 -07003150 public PendingIntent getRunningServiceControlPanel(ComponentName service)
3151 throws RemoteException
3152 {
3153 Parcel data = Parcel.obtain();
3154 Parcel reply = Parcel.obtain();
3155 data.writeInterfaceToken(IActivityManager.descriptor);
3156 service.writeToParcel(data, 0);
3157 mRemote.transact(GET_RUNNING_SERVICE_CONTROL_PANEL_TRANSACTION, data, reply, 0);
3158 reply.readException();
3159 PendingIntent res = PendingIntent.readPendingIntentOrNullFromParcel(reply);
3160 data.recycle();
3161 reply.recycle();
3162 return res;
3163 }
3164
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003165 public ComponentName startService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003166 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003167 {
3168 Parcel data = Parcel.obtain();
3169 Parcel reply = Parcel.obtain();
3170 data.writeInterfaceToken(IActivityManager.descriptor);
3171 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3172 service.writeToParcel(data, 0);
3173 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003174 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003175 mRemote.transact(START_SERVICE_TRANSACTION, data, reply, 0);
3176 reply.readException();
3177 ComponentName res = ComponentName.readFromParcel(reply);
3178 data.recycle();
3179 reply.recycle();
3180 return res;
3181 }
3182 public int stopService(IApplicationThread caller, Intent service,
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003183 String resolvedType, int userId) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003184 {
3185 Parcel data = Parcel.obtain();
3186 Parcel reply = Parcel.obtain();
3187 data.writeInterfaceToken(IActivityManager.descriptor);
3188 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3189 service.writeToParcel(data, 0);
3190 data.writeString(resolvedType);
Dianne Hackborn7767eac2012-08-23 18:25:40 -07003191 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003192 mRemote.transact(STOP_SERVICE_TRANSACTION, data, reply, 0);
3193 reply.readException();
3194 int res = reply.readInt();
3195 reply.recycle();
3196 data.recycle();
3197 return res;
3198 }
3199 public boolean stopServiceToken(ComponentName className, IBinder token,
3200 int startId) throws RemoteException {
3201 Parcel data = Parcel.obtain();
3202 Parcel reply = Parcel.obtain();
3203 data.writeInterfaceToken(IActivityManager.descriptor);
3204 ComponentName.writeToParcel(className, data);
3205 data.writeStrongBinder(token);
3206 data.writeInt(startId);
3207 mRemote.transact(STOP_SERVICE_TOKEN_TRANSACTION, data, reply, 0);
3208 reply.readException();
3209 boolean res = reply.readInt() != 0;
3210 data.recycle();
3211 reply.recycle();
3212 return res;
3213 }
3214 public void setServiceForeground(ComponentName className, IBinder token,
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003215 int id, Notification notification, boolean removeNotification) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003216 Parcel data = Parcel.obtain();
3217 Parcel reply = Parcel.obtain();
3218 data.writeInterfaceToken(IActivityManager.descriptor);
3219 ComponentName.writeToParcel(className, data);
3220 data.writeStrongBinder(token);
Dianne Hackbornd8a43f62009-08-17 23:33:56 -07003221 data.writeInt(id);
3222 if (notification != null) {
3223 data.writeInt(1);
3224 notification.writeToParcel(data, 0);
3225 } else {
3226 data.writeInt(0);
3227 }
3228 data.writeInt(removeNotification ? 1 : 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003229 mRemote.transact(SET_SERVICE_FOREGROUND_TRANSACTION, data, reply, 0);
3230 reply.readException();
3231 data.recycle();
3232 reply.recycle();
3233 }
3234 public int bindService(IApplicationThread caller, IBinder token,
3235 Intent service, String resolvedType, IServiceConnection connection,
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003236 int flags, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003237 Parcel data = Parcel.obtain();
3238 Parcel reply = Parcel.obtain();
3239 data.writeInterfaceToken(IActivityManager.descriptor);
3240 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
3241 data.writeStrongBinder(token);
3242 service.writeToParcel(data, 0);
3243 data.writeString(resolvedType);
3244 data.writeStrongBinder(connection.asBinder());
3245 data.writeInt(flags);
Amith Yamasani37ce3a82012-02-06 12:04:42 -08003246 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003247 mRemote.transact(BIND_SERVICE_TRANSACTION, data, reply, 0);
3248 reply.readException();
3249 int res = reply.readInt();
3250 data.recycle();
3251 reply.recycle();
3252 return res;
3253 }
3254 public boolean unbindService(IServiceConnection connection) throws RemoteException
3255 {
3256 Parcel data = Parcel.obtain();
3257 Parcel reply = Parcel.obtain();
3258 data.writeInterfaceToken(IActivityManager.descriptor);
3259 data.writeStrongBinder(connection.asBinder());
3260 mRemote.transact(UNBIND_SERVICE_TRANSACTION, data, reply, 0);
3261 reply.readException();
3262 boolean res = reply.readInt() != 0;
3263 data.recycle();
3264 reply.recycle();
3265 return res;
3266 }
3267
3268 public void publishService(IBinder token,
3269 Intent intent, IBinder service) throws RemoteException {
3270 Parcel data = Parcel.obtain();
3271 Parcel reply = Parcel.obtain();
3272 data.writeInterfaceToken(IActivityManager.descriptor);
3273 data.writeStrongBinder(token);
3274 intent.writeToParcel(data, 0);
3275 data.writeStrongBinder(service);
3276 mRemote.transact(PUBLISH_SERVICE_TRANSACTION, data, reply, 0);
3277 reply.readException();
3278 data.recycle();
3279 reply.recycle();
3280 }
3281
3282 public void unbindFinished(IBinder token, Intent intent, boolean doRebind)
3283 throws RemoteException {
3284 Parcel data = Parcel.obtain();
3285 Parcel reply = Parcel.obtain();
3286 data.writeInterfaceToken(IActivityManager.descriptor);
3287 data.writeStrongBinder(token);
3288 intent.writeToParcel(data, 0);
3289 data.writeInt(doRebind ? 1 : 0);
3290 mRemote.transact(UNBIND_FINISHED_TRANSACTION, data, reply, 0);
3291 reply.readException();
3292 data.recycle();
3293 reply.recycle();
3294 }
3295
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003296 public void serviceDoneExecuting(IBinder token, int type, int startId,
3297 int res) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003298 Parcel data = Parcel.obtain();
3299 Parcel reply = Parcel.obtain();
3300 data.writeInterfaceToken(IActivityManager.descriptor);
3301 data.writeStrongBinder(token);
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -07003302 data.writeInt(type);
3303 data.writeInt(startId);
3304 data.writeInt(res);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003305 mRemote.transact(SERVICE_DONE_EXECUTING_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
3306 reply.readException();
3307 data.recycle();
3308 reply.recycle();
3309 }
3310
3311 public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
3312 Parcel data = Parcel.obtain();
3313 Parcel reply = Parcel.obtain();
3314 data.writeInterfaceToken(IActivityManager.descriptor);
3315 service.writeToParcel(data, 0);
3316 data.writeString(resolvedType);
3317 mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
3318 reply.readException();
3319 IBinder binder = reply.readStrongBinder();
3320 reply.recycle();
3321 data.recycle();
3322 return binder;
3323 }
3324
Christopher Tate181fafa2009-05-14 11:12:14 -07003325 public boolean bindBackupAgent(ApplicationInfo app, int backupRestoreMode)
3326 throws RemoteException {
3327 Parcel data = Parcel.obtain();
3328 Parcel reply = Parcel.obtain();
3329 data.writeInterfaceToken(IActivityManager.descriptor);
3330 app.writeToParcel(data, 0);
3331 data.writeInt(backupRestoreMode);
3332 mRemote.transact(START_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3333 reply.readException();
3334 boolean success = reply.readInt() != 0;
3335 reply.recycle();
3336 data.recycle();
3337 return success;
3338 }
3339
Christopher Tate346acb12012-10-15 19:20:25 -07003340 public void clearPendingBackup() throws RemoteException {
3341 Parcel data = Parcel.obtain();
3342 Parcel reply = Parcel.obtain();
3343 data.writeInterfaceToken(IActivityManager.descriptor);
3344 mRemote.transact(CLEAR_PENDING_BACKUP_TRANSACTION, data, reply, 0);
3345 reply.recycle();
3346 data.recycle();
3347 }
3348
Christopher Tate181fafa2009-05-14 11:12:14 -07003349 public void backupAgentCreated(String packageName, IBinder agent) throws RemoteException {
3350 Parcel data = Parcel.obtain();
3351 Parcel reply = Parcel.obtain();
3352 data.writeInterfaceToken(IActivityManager.descriptor);
3353 data.writeString(packageName);
3354 data.writeStrongBinder(agent);
3355 mRemote.transact(BACKUP_AGENT_CREATED_TRANSACTION, data, reply, 0);
3356 reply.recycle();
3357 data.recycle();
3358 }
3359
3360 public void unbindBackupAgent(ApplicationInfo app) throws RemoteException {
3361 Parcel data = Parcel.obtain();
3362 Parcel reply = Parcel.obtain();
3363 data.writeInterfaceToken(IActivityManager.descriptor);
3364 app.writeToParcel(data, 0);
3365 mRemote.transact(UNBIND_BACKUP_AGENT_TRANSACTION, data, reply, 0);
3366 reply.readException();
3367 reply.recycle();
3368 data.recycle();
3369 }
3370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003371 public boolean startInstrumentation(ComponentName className, String profileFile,
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003372 int flags, Bundle arguments, IInstrumentationWatcher watcher,
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003373 IUiAutomationConnection connection, int userId, String instructionSet)
3374 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003375 Parcel data = Parcel.obtain();
3376 Parcel reply = Parcel.obtain();
3377 data.writeInterfaceToken(IActivityManager.descriptor);
3378 ComponentName.writeToParcel(className, data);
3379 data.writeString(profileFile);
3380 data.writeInt(flags);
3381 data.writeBundle(arguments);
3382 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Svetoslav Ganov80943d82013-01-02 10:25:37 -08003383 data.writeStrongBinder(connection != null ? connection.asBinder() : null);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07003384 data.writeInt(userId);
Narayan Kamath8dcfefd2014-05-15 18:12:59 +01003385 data.writeString(instructionSet);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003386 mRemote.transact(START_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3387 reply.readException();
3388 boolean res = reply.readInt() != 0;
3389 reply.recycle();
3390 data.recycle();
3391 return res;
3392 }
3393
3394 public void finishInstrumentation(IApplicationThread target,
3395 int resultCode, Bundle results) throws RemoteException {
3396 Parcel data = Parcel.obtain();
3397 Parcel reply = Parcel.obtain();
3398 data.writeInterfaceToken(IActivityManager.descriptor);
3399 data.writeStrongBinder(target != null ? target.asBinder() : null);
3400 data.writeInt(resultCode);
3401 data.writeBundle(results);
3402 mRemote.transact(FINISH_INSTRUMENTATION_TRANSACTION, data, reply, 0);
3403 reply.readException();
3404 data.recycle();
3405 reply.recycle();
3406 }
3407 public Configuration getConfiguration() throws RemoteException
3408 {
3409 Parcel data = Parcel.obtain();
3410 Parcel reply = Parcel.obtain();
3411 data.writeInterfaceToken(IActivityManager.descriptor);
3412 mRemote.transact(GET_CONFIGURATION_TRANSACTION, data, reply, 0);
3413 reply.readException();
3414 Configuration res = Configuration.CREATOR.createFromParcel(reply);
3415 reply.recycle();
3416 data.recycle();
3417 return res;
3418 }
3419 public void updateConfiguration(Configuration values) throws RemoteException
3420 {
3421 Parcel data = Parcel.obtain();
3422 Parcel reply = Parcel.obtain();
3423 data.writeInterfaceToken(IActivityManager.descriptor);
3424 values.writeToParcel(data, 0);
3425 mRemote.transact(UPDATE_CONFIGURATION_TRANSACTION, data, reply, 0);
3426 reply.readException();
3427 data.recycle();
3428 reply.recycle();
3429 }
3430 public void setRequestedOrientation(IBinder token, int requestedOrientation)
3431 throws RemoteException {
3432 Parcel data = Parcel.obtain();
3433 Parcel reply = Parcel.obtain();
3434 data.writeInterfaceToken(IActivityManager.descriptor);
3435 data.writeStrongBinder(token);
3436 data.writeInt(requestedOrientation);
3437 mRemote.transact(SET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3438 reply.readException();
3439 data.recycle();
3440 reply.recycle();
3441 }
3442 public int getRequestedOrientation(IBinder token) throws RemoteException {
3443 Parcel data = Parcel.obtain();
3444 Parcel reply = Parcel.obtain();
3445 data.writeInterfaceToken(IActivityManager.descriptor);
3446 data.writeStrongBinder(token);
3447 mRemote.transact(GET_REQUESTED_ORIENTATION_TRANSACTION, data, reply, 0);
3448 reply.readException();
3449 int res = reply.readInt();
3450 data.recycle();
3451 reply.recycle();
3452 return res;
3453 }
3454 public ComponentName getActivityClassForToken(IBinder token)
3455 throws RemoteException {
3456 Parcel data = Parcel.obtain();
3457 Parcel reply = Parcel.obtain();
3458 data.writeInterfaceToken(IActivityManager.descriptor);
3459 data.writeStrongBinder(token);
3460 mRemote.transact(GET_ACTIVITY_CLASS_FOR_TOKEN_TRANSACTION, data, reply, 0);
3461 reply.readException();
3462 ComponentName res = ComponentName.readFromParcel(reply);
3463 data.recycle();
3464 reply.recycle();
3465 return res;
3466 }
3467 public String getPackageForToken(IBinder token) throws RemoteException
3468 {
3469 Parcel data = Parcel.obtain();
3470 Parcel reply = Parcel.obtain();
3471 data.writeInterfaceToken(IActivityManager.descriptor);
3472 data.writeStrongBinder(token);
3473 mRemote.transact(GET_PACKAGE_FOR_TOKEN_TRANSACTION, data, reply, 0);
3474 reply.readException();
3475 String res = reply.readString();
3476 data.recycle();
3477 reply.recycle();
3478 return res;
3479 }
3480 public IIntentSender getIntentSender(int type,
3481 String packageName, IBinder token, String resultWho,
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003482 int requestCode, Intent[] intents, String[] resolvedTypes, int flags,
Dianne Hackborn41203752012-08-31 14:05:51 -07003483 Bundle options, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003484 Parcel data = Parcel.obtain();
3485 Parcel reply = Parcel.obtain();
3486 data.writeInterfaceToken(IActivityManager.descriptor);
3487 data.writeInt(type);
3488 data.writeString(packageName);
3489 data.writeStrongBinder(token);
3490 data.writeString(resultWho);
3491 data.writeInt(requestCode);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003492 if (intents != null) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003493 data.writeInt(1);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08003494 data.writeTypedArray(intents, 0);
3495 data.writeStringArray(resolvedTypes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003496 } else {
3497 data.writeInt(0);
3498 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003499 data.writeInt(flags);
Dianne Hackborn7a2195c2012-03-19 17:38:00 -07003500 if (options != null) {
3501 data.writeInt(1);
3502 options.writeToParcel(data, 0);
3503 } else {
3504 data.writeInt(0);
3505 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003506 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003507 mRemote.transact(GET_INTENT_SENDER_TRANSACTION, data, reply, 0);
3508 reply.readException();
3509 IIntentSender res = IIntentSender.Stub.asInterface(
3510 reply.readStrongBinder());
3511 data.recycle();
3512 reply.recycle();
3513 return res;
3514 }
3515 public void cancelIntentSender(IIntentSender sender) throws RemoteException {
3516 Parcel data = Parcel.obtain();
3517 Parcel reply = Parcel.obtain();
3518 data.writeInterfaceToken(IActivityManager.descriptor);
3519 data.writeStrongBinder(sender.asBinder());
3520 mRemote.transact(CANCEL_INTENT_SENDER_TRANSACTION, data, reply, 0);
3521 reply.readException();
3522 data.recycle();
3523 reply.recycle();
3524 }
3525 public String getPackageForIntentSender(IIntentSender sender) throws RemoteException {
3526 Parcel data = Parcel.obtain();
3527 Parcel reply = Parcel.obtain();
3528 data.writeInterfaceToken(IActivityManager.descriptor);
3529 data.writeStrongBinder(sender.asBinder());
3530 mRemote.transact(GET_PACKAGE_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3531 reply.readException();
3532 String res = reply.readString();
3533 data.recycle();
3534 reply.recycle();
3535 return res;
3536 }
Christopher Tatec4a07d12012-04-06 14:19:13 -07003537 public int getUidForIntentSender(IIntentSender sender) throws RemoteException {
3538 Parcel data = Parcel.obtain();
3539 Parcel reply = Parcel.obtain();
3540 data.writeInterfaceToken(IActivityManager.descriptor);
3541 data.writeStrongBinder(sender.asBinder());
3542 mRemote.transact(GET_UID_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
3543 reply.readException();
3544 int res = reply.readInt();
3545 data.recycle();
3546 reply.recycle();
3547 return res;
3548 }
Dianne Hackborn41203752012-08-31 14:05:51 -07003549 public int handleIncomingUser(int callingPid, int callingUid, int userId, boolean allowAll,
3550 boolean requireFull, String name, String callerPackage) throws RemoteException {
3551 Parcel data = Parcel.obtain();
3552 Parcel reply = Parcel.obtain();
3553 data.writeInterfaceToken(IActivityManager.descriptor);
3554 data.writeInt(callingPid);
3555 data.writeInt(callingUid);
3556 data.writeInt(userId);
3557 data.writeInt(allowAll ? 1 : 0);
3558 data.writeInt(requireFull ? 1 : 0);
3559 data.writeString(name);
3560 data.writeString(callerPackage);
3561 mRemote.transact(HANDLE_INCOMING_USER_TRANSACTION, data, reply, 0);
3562 reply.readException();
3563 int res = reply.readInt();
3564 data.recycle();
3565 reply.recycle();
3566 return res;
3567 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003568 public void setProcessLimit(int max) throws RemoteException
3569 {
3570 Parcel data = Parcel.obtain();
3571 Parcel reply = Parcel.obtain();
3572 data.writeInterfaceToken(IActivityManager.descriptor);
3573 data.writeInt(max);
3574 mRemote.transact(SET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3575 reply.readException();
3576 data.recycle();
3577 reply.recycle();
3578 }
3579 public int getProcessLimit() throws RemoteException
3580 {
3581 Parcel data = Parcel.obtain();
3582 Parcel reply = Parcel.obtain();
3583 data.writeInterfaceToken(IActivityManager.descriptor);
3584 mRemote.transact(GET_PROCESS_LIMIT_TRANSACTION, data, reply, 0);
3585 reply.readException();
3586 int res = reply.readInt();
3587 data.recycle();
3588 reply.recycle();
3589 return res;
3590 }
3591 public void setProcessForeground(IBinder token, int pid,
3592 boolean isForeground) throws RemoteException {
3593 Parcel data = Parcel.obtain();
3594 Parcel reply = Parcel.obtain();
3595 data.writeInterfaceToken(IActivityManager.descriptor);
3596 data.writeStrongBinder(token);
3597 data.writeInt(pid);
3598 data.writeInt(isForeground ? 1 : 0);
3599 mRemote.transact(SET_PROCESS_FOREGROUND_TRANSACTION, data, reply, 0);
3600 reply.readException();
3601 data.recycle();
3602 reply.recycle();
3603 }
3604 public int checkPermission(String permission, int pid, int uid)
3605 throws RemoteException {
3606 Parcel data = Parcel.obtain();
3607 Parcel reply = Parcel.obtain();
3608 data.writeInterfaceToken(IActivityManager.descriptor);
3609 data.writeString(permission);
3610 data.writeInt(pid);
3611 data.writeInt(uid);
3612 mRemote.transact(CHECK_PERMISSION_TRANSACTION, data, reply, 0);
3613 reply.readException();
3614 int res = reply.readInt();
3615 data.recycle();
3616 reply.recycle();
3617 return res;
3618 }
3619 public boolean clearApplicationUserData(final String packageName,
Amith Yamasani742a6712011-05-04 14:49:28 -07003620 final IPackageDataObserver observer, final int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003621 Parcel data = Parcel.obtain();
3622 Parcel reply = Parcel.obtain();
3623 data.writeInterfaceToken(IActivityManager.descriptor);
3624 data.writeString(packageName);
Christopher Tate31b65f92013-09-09 14:17:27 -07003625 data.writeStrongBinder((observer != null) ? observer.asBinder() : null);
Amith Yamasani742a6712011-05-04 14:49:28 -07003626 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003627 mRemote.transact(CLEAR_APP_DATA_TRANSACTION, data, reply, 0);
3628 reply.readException();
3629 boolean res = reply.readInt() != 0;
3630 data.recycle();
3631 reply.recycle();
3632 return res;
3633 }
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003634 public int checkUriPermission(Uri uri, int pid, int uid, int mode, int userId)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003635 throws RemoteException {
3636 Parcel data = Parcel.obtain();
3637 Parcel reply = Parcel.obtain();
3638 data.writeInterfaceToken(IActivityManager.descriptor);
3639 uri.writeToParcel(data, 0);
3640 data.writeInt(pid);
3641 data.writeInt(uid);
3642 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003643 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003644 mRemote.transact(CHECK_URI_PERMISSION_TRANSACTION, data, reply, 0);
3645 reply.readException();
3646 int res = reply.readInt();
3647 data.recycle();
3648 reply.recycle();
3649 return res;
3650 }
3651 public void grantUriPermission(IApplicationThread caller, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003652 Uri uri, int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003653 Parcel data = Parcel.obtain();
3654 Parcel reply = Parcel.obtain();
3655 data.writeInterfaceToken(IActivityManager.descriptor);
3656 data.writeStrongBinder(caller.asBinder());
3657 data.writeString(targetPkg);
3658 uri.writeToParcel(data, 0);
3659 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003660 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003661 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
3662 reply.readException();
3663 data.recycle();
3664 reply.recycle();
3665 }
3666 public void revokeUriPermission(IApplicationThread caller, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003667 int mode, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003668 Parcel data = Parcel.obtain();
3669 Parcel reply = Parcel.obtain();
3670 data.writeInterfaceToken(IActivityManager.descriptor);
3671 data.writeStrongBinder(caller.asBinder());
3672 uri.writeToParcel(data, 0);
3673 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003674 data.writeInt(userId);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003675 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3676 reply.readException();
3677 data.recycle();
3678 reply.recycle();
3679 }
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003680
3681 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003682 public void takePersistableUriPermission(Uri uri, int mode, int userId)
3683 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003684 Parcel data = Parcel.obtain();
3685 Parcel reply = Parcel.obtain();
3686 data.writeInterfaceToken(IActivityManager.descriptor);
3687 uri.writeToParcel(data, 0);
3688 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003689 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003690 mRemote.transact(TAKE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3691 reply.readException();
3692 data.recycle();
3693 reply.recycle();
3694 }
3695
3696 @Override
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003697 public void releasePersistableUriPermission(Uri uri, int mode, int userId)
3698 throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003699 Parcel data = Parcel.obtain();
3700 Parcel reply = Parcel.obtain();
3701 data.writeInterfaceToken(IActivityManager.descriptor);
3702 uri.writeToParcel(data, 0);
3703 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01003704 data.writeInt(userId);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003705 mRemote.transact(RELEASE_PERSISTABLE_URI_PERMISSION_TRANSACTION, data, reply, 0);
3706 reply.readException();
3707 data.recycle();
3708 reply.recycle();
3709 }
3710
3711 @Override
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003712 public ParceledListSlice<UriPermission> getPersistedUriPermissions(
3713 String packageName, boolean incoming) throws RemoteException {
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003714 Parcel data = Parcel.obtain();
3715 Parcel reply = Parcel.obtain();
3716 data.writeInterfaceToken(IActivityManager.descriptor);
Jeff Sharkeybcaac0a2013-10-09 14:21:08 -07003717 data.writeString(packageName);
3718 data.writeInt(incoming ? 1 : 0);
Jeff Sharkeye66c1772013-09-20 14:30:59 -07003719 mRemote.transact(GET_PERSISTED_URI_PERMISSIONS_TRANSACTION, data, reply, 0);
3720 reply.readException();
3721 final ParceledListSlice<UriPermission> perms = ParceledListSlice.CREATOR.createFromParcel(
3722 reply);
3723 data.recycle();
3724 reply.recycle();
3725 return perms;
3726 }
3727
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003728 public void showWaitingForDebugger(IApplicationThread who, boolean waiting)
3729 throws RemoteException {
3730 Parcel data = Parcel.obtain();
3731 Parcel reply = Parcel.obtain();
3732 data.writeInterfaceToken(IActivityManager.descriptor);
3733 data.writeStrongBinder(who.asBinder());
3734 data.writeInt(waiting ? 1 : 0);
3735 mRemote.transact(SHOW_WAITING_FOR_DEBUGGER_TRANSACTION, data, reply, 0);
3736 reply.readException();
3737 data.recycle();
3738 reply.recycle();
3739 }
3740 public void getMemoryInfo(ActivityManager.MemoryInfo outInfo) throws RemoteException {
3741 Parcel data = Parcel.obtain();
3742 Parcel reply = Parcel.obtain();
3743 data.writeInterfaceToken(IActivityManager.descriptor);
3744 mRemote.transact(GET_MEMORY_INFO_TRANSACTION, data, reply, 0);
3745 reply.readException();
3746 outInfo.readFromParcel(reply);
3747 data.recycle();
3748 reply.recycle();
3749 }
3750 public void unhandledBack() throws RemoteException
3751 {
3752 Parcel data = Parcel.obtain();
3753 Parcel reply = Parcel.obtain();
3754 data.writeInterfaceToken(IActivityManager.descriptor);
3755 mRemote.transact(UNHANDLED_BACK_TRANSACTION, data, reply, 0);
3756 reply.readException();
3757 data.recycle();
3758 reply.recycle();
3759 }
3760 public ParcelFileDescriptor openContentUri(Uri uri) throws RemoteException
3761 {
3762 Parcel data = Parcel.obtain();
3763 Parcel reply = Parcel.obtain();
3764 data.writeInterfaceToken(IActivityManager.descriptor);
3765 mRemote.transact(OPEN_CONTENT_URI_TRANSACTION, data, reply, 0);
3766 reply.readException();
3767 ParcelFileDescriptor pfd = null;
3768 if (reply.readInt() != 0) {
3769 pfd = ParcelFileDescriptor.CREATOR.createFromParcel(reply);
3770 }
3771 data.recycle();
3772 reply.recycle();
3773 return pfd;
3774 }
Dianne Hackbornff5b1582012-04-12 17:24:07 -07003775 public void setLockScreenShown(boolean shown) throws RemoteException
3776 {
3777 Parcel data = Parcel.obtain();
3778 Parcel reply = Parcel.obtain();
3779 data.writeInterfaceToken(IActivityManager.descriptor);
3780 data.writeInt(shown ? 1 : 0);
3781 mRemote.transact(SET_LOCK_SCREEN_SHOWN_TRANSACTION, data, reply, 0);
3782 reply.readException();
3783 data.recycle();
3784 reply.recycle();
3785 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003786 public void setDebugApp(
3787 String packageName, boolean waitForDebugger, boolean persistent)
3788 throws RemoteException
3789 {
3790 Parcel data = Parcel.obtain();
3791 Parcel reply = Parcel.obtain();
3792 data.writeInterfaceToken(IActivityManager.descriptor);
3793 data.writeString(packageName);
3794 data.writeInt(waitForDebugger ? 1 : 0);
3795 data.writeInt(persistent ? 1 : 0);
3796 mRemote.transact(SET_DEBUG_APP_TRANSACTION, data, reply, 0);
3797 reply.readException();
3798 data.recycle();
3799 reply.recycle();
3800 }
3801 public void setAlwaysFinish(boolean enabled) throws RemoteException
3802 {
3803 Parcel data = Parcel.obtain();
3804 Parcel reply = Parcel.obtain();
3805 data.writeInterfaceToken(IActivityManager.descriptor);
3806 data.writeInt(enabled ? 1 : 0);
3807 mRemote.transact(SET_ALWAYS_FINISH_TRANSACTION, data, reply, 0);
3808 reply.readException();
3809 data.recycle();
3810 reply.recycle();
3811 }
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003812 public void setActivityController(IActivityController watcher) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003813 {
3814 Parcel data = Parcel.obtain();
3815 Parcel reply = Parcel.obtain();
3816 data.writeInterfaceToken(IActivityManager.descriptor);
3817 data.writeStrongBinder(watcher != null ? watcher.asBinder() : null);
Dianne Hackbornb06ea702009-07-13 13:07:51 -07003818 mRemote.transact(SET_ACTIVITY_CONTROLLER_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003819 reply.readException();
3820 data.recycle();
3821 reply.recycle();
3822 }
3823 public void enterSafeMode() throws RemoteException {
3824 Parcel data = Parcel.obtain();
3825 data.writeInterfaceToken(IActivityManager.descriptor);
3826 mRemote.transact(ENTER_SAFE_MODE_TRANSACTION, data, null, 0);
3827 data.recycle();
3828 }
Dianne Hackborn099bc622014-01-22 13:39:16 -08003829 public void noteWakeupAlarm(IIntentSender sender, int sourceUid, String sourcePkg)
3830 throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003831 Parcel data = Parcel.obtain();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003832 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn099bc622014-01-22 13:39:16 -08003833 data.writeStrongBinder(sender.asBinder());
3834 data.writeInt(sourceUid);
3835 data.writeString(sourcePkg);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003836 mRemote.transact(NOTE_WAKEUP_ALARM_TRANSACTION, data, null, 0);
3837 data.recycle();
3838 }
Dianne Hackborn64825172011-03-02 21:32:58 -08003839 public boolean killPids(int[] pids, String reason, boolean secure) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003840 Parcel data = Parcel.obtain();
3841 Parcel reply = Parcel.obtain();
3842 data.writeInterfaceToken(IActivityManager.descriptor);
3843 data.writeIntArray(pids);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003844 data.writeString(reason);
Dianne Hackborn64825172011-03-02 21:32:58 -08003845 data.writeInt(secure ? 1 : 0);
Suchi Amalapurapue99bb5f2010-03-19 14:36:49 -07003846 mRemote.transact(KILL_PIDS_TRANSACTION, data, reply, 0);
Dianne Hackbornf1b78242013-04-08 22:28:59 -07003847 reply.readException();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003848 boolean res = reply.readInt() != 0;
3849 data.recycle();
3850 reply.recycle();
3851 return res;
3852 }
Jeff Sharkeyb9a07012012-03-22 17:00:04 -07003853 @Override
3854 public boolean killProcessesBelowForeground(String reason) throws RemoteException {
3855 Parcel data = Parcel.obtain();
3856 Parcel reply = Parcel.obtain();
3857 data.writeInterfaceToken(IActivityManager.descriptor);
3858 data.writeString(reason);
3859 mRemote.transact(KILL_PROCESSES_BELOW_FOREGROUND_TRANSACTION, data, reply, 0);
3860 boolean res = reply.readInt() != 0;
3861 data.recycle();
3862 reply.recycle();
3863 return res;
3864 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003865 public boolean testIsSystemReady()
3866 {
3867 /* this base class version is never called */
3868 return true;
3869 }
Dan Egnor60d87622009-12-16 16:32:58 -08003870 public void handleApplicationCrash(IBinder app,
3871 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
3872 {
3873 Parcel data = Parcel.obtain();
3874 Parcel reply = Parcel.obtain();
3875 data.writeInterfaceToken(IActivityManager.descriptor);
3876 data.writeStrongBinder(app);
3877 crashInfo.writeToParcel(data, 0);
3878 mRemote.transact(HANDLE_APPLICATION_CRASH_TRANSACTION, data, reply, 0);
3879 reply.readException();
3880 reply.recycle();
3881 data.recycle();
3882 }
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003883
Dan Egnor60d87622009-12-16 16:32:58 -08003884 public boolean handleApplicationWtf(IBinder app, String tag,
Dan Egnorb7f03672009-12-09 16:22:32 -08003885 ApplicationErrorReport.CrashInfo crashInfo) throws RemoteException
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003886 {
3887 Parcel data = Parcel.obtain();
3888 Parcel reply = Parcel.obtain();
3889 data.writeInterfaceToken(IActivityManager.descriptor);
3890 data.writeStrongBinder(app);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003891 data.writeString(tag);
Dan Egnorb7f03672009-12-09 16:22:32 -08003892 crashInfo.writeToParcel(data, 0);
Dan Egnor60d87622009-12-16 16:32:58 -08003893 mRemote.transact(HANDLE_APPLICATION_WTF_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003894 reply.readException();
Dan Egnor60d87622009-12-16 16:32:58 -08003895 boolean res = reply.readInt() != 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003896 reply.recycle();
3897 data.recycle();
Dan Egnor60d87622009-12-16 16:32:58 -08003898 return res;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003899 }
Dan Egnorb7f03672009-12-09 16:22:32 -08003900
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003901 public void handleApplicationStrictModeViolation(IBinder app,
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003902 int violationMask,
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003903 StrictMode.ViolationInfo info) throws RemoteException
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003904 {
3905 Parcel data = Parcel.obtain();
3906 Parcel reply = Parcel.obtain();
3907 data.writeInterfaceToken(IActivityManager.descriptor);
3908 data.writeStrongBinder(app);
Brad Fitzpatrick46d42382010-06-11 13:57:58 -07003909 data.writeInt(violationMask);
Brad Fitzpatrickcb9ceb12010-07-29 14:29:02 -07003910 info.writeToParcel(data, 0);
Brad Fitzpatrick438d0592010-06-10 12:19:19 -07003911 mRemote.transact(HANDLE_APPLICATION_STRICT_MODE_VIOLATION_TRANSACTION, data, reply, 0);
3912 reply.readException();
3913 reply.recycle();
3914 data.recycle();
3915 }
3916
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003917 public void signalPersistentProcesses(int sig) throws RemoteException {
3918 Parcel data = Parcel.obtain();
3919 Parcel reply = Parcel.obtain();
3920 data.writeInterfaceToken(IActivityManager.descriptor);
3921 data.writeInt(sig);
3922 mRemote.transact(SIGNAL_PERSISTENT_PROCESSES_TRANSACTION, data, reply, 0);
3923 reply.readException();
3924 data.recycle();
3925 reply.recycle();
3926 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003927
Dianne Hackborn1676c852012-09-10 14:52:30 -07003928 public void killBackgroundProcesses(String packageName, int userId) throws RemoteException {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003929 Parcel data = Parcel.obtain();
3930 Parcel reply = Parcel.obtain();
3931 data.writeInterfaceToken(IActivityManager.descriptor);
3932 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003933 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003934 mRemote.transact(KILL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3935 reply.readException();
3936 data.recycle();
3937 reply.recycle();
3938 }
Dianne Hackborne4d4fbc2011-11-08 11:53:28 -08003939
3940 public void killAllBackgroundProcesses() throws RemoteException {
3941 Parcel data = Parcel.obtain();
3942 Parcel reply = Parcel.obtain();
3943 data.writeInterfaceToken(IActivityManager.descriptor);
3944 mRemote.transact(KILL_ALL_BACKGROUND_PROCESSES_TRANSACTION, data, reply, 0);
3945 reply.readException();
3946 data.recycle();
3947 reply.recycle();
3948 }
3949
Dianne Hackborn1676c852012-09-10 14:52:30 -07003950 public void forceStopPackage(String packageName, int userId) throws RemoteException {
Dianne Hackborn03abb812010-01-04 18:43:19 -08003951 Parcel data = Parcel.obtain();
3952 Parcel reply = Parcel.obtain();
3953 data.writeInterfaceToken(IActivityManager.descriptor);
3954 data.writeString(packageName);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003955 data.writeInt(userId);
Dianne Hackborn03abb812010-01-04 18:43:19 -08003956 mRemote.transact(FORCE_STOP_PACKAGE_TRANSACTION, data, reply, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003957 reply.readException();
3958 data.recycle();
3959 reply.recycle();
3960 }
3961
Dianne Hackborn27ff9132012-03-06 14:57:58 -08003962 public void getMyMemoryState(ActivityManager.RunningAppProcessInfo outInfo)
3963 throws RemoteException
3964 {
3965 Parcel data = Parcel.obtain();
3966 Parcel reply = Parcel.obtain();
3967 data.writeInterfaceToken(IActivityManager.descriptor);
3968 mRemote.transact(GET_MY_MEMORY_STATE_TRANSACTION, data, reply, 0);
3969 reply.readException();
3970 outInfo.readFromParcel(reply);
3971 reply.recycle();
3972 data.recycle();
3973 }
3974
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003975 public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
3976 {
3977 Parcel data = Parcel.obtain();
3978 Parcel reply = Parcel.obtain();
3979 data.writeInterfaceToken(IActivityManager.descriptor);
3980 mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
3981 reply.readException();
3982 ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
3983 reply.recycle();
3984 data.recycle();
3985 return res;
3986 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003987
Dianne Hackborn1676c852012-09-10 14:52:30 -07003988 public boolean profileControl(String process, int userId, boolean start,
Romain Guy7eabe552011-07-21 14:56:34 -07003989 String path, ParcelFileDescriptor fd, int profileType) throws RemoteException
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003990 {
3991 Parcel data = Parcel.obtain();
3992 Parcel reply = Parcel.obtain();
3993 data.writeInterfaceToken(IActivityManager.descriptor);
3994 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07003995 data.writeInt(userId);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003996 data.writeInt(start ? 1 : 0);
Romain Guy9a8c5ce2011-07-21 18:04:29 -07003997 data.writeInt(profileType);
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08003998 data.writeString(path);
Dianne Hackborn9c8dd552009-06-23 19:22:52 -07003999 if (fd != null) {
4000 data.writeInt(1);
4001 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4002 } else {
4003 data.writeInt(0);
4004 }
The Android Open Source Projectf5b4b982009-03-05 20:00:43 -08004005 mRemote.transact(PROFILE_CONTROL_TRANSACTION, data, reply, 0);
4006 reply.readException();
4007 boolean res = reply.readInt() != 0;
4008 reply.recycle();
4009 data.recycle();
4010 return res;
4011 }
4012
Dianne Hackborn55280a92009-05-07 15:53:46 -07004013 public boolean shutdown(int timeout) throws RemoteException
4014 {
4015 Parcel data = Parcel.obtain();
4016 Parcel reply = Parcel.obtain();
4017 data.writeInterfaceToken(IActivityManager.descriptor);
4018 data.writeInt(timeout);
4019 mRemote.transact(SHUTDOWN_TRANSACTION, data, reply, 0);
4020 reply.readException();
4021 boolean res = reply.readInt() != 0;
4022 reply.recycle();
4023 data.recycle();
4024 return res;
4025 }
4026
Dianne Hackborn95fc68f2009-05-19 18:37:45 -07004027 public void stopAppSwitches() throws RemoteException {
4028 Parcel data = Parcel.obtain();
4029 Parcel reply = Parcel.obtain();
4030 data.writeInterfaceToken(IActivityManager.descriptor);
4031 mRemote.transact(STOP_APP_SWITCHES_TRANSACTION, data, reply, 0);
4032 reply.readException();
4033 reply.recycle();
4034 data.recycle();
4035 }
4036
4037 public void resumeAppSwitches() throws RemoteException {
4038 Parcel data = Parcel.obtain();
4039 Parcel reply = Parcel.obtain();
4040 data.writeInterfaceToken(IActivityManager.descriptor);
4041 mRemote.transact(RESUME_APP_SWITCHES_TRANSACTION, data, reply, 0);
4042 reply.readException();
4043 reply.recycle();
4044 data.recycle();
4045 }
4046
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004047 public void killApplicationWithAppId(String pkg, int appid, String reason)
4048 throws RemoteException {
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004049 Parcel data = Parcel.obtain();
4050 Parcel reply = Parcel.obtain();
4051 data.writeInterfaceToken(IActivityManager.descriptor);
4052 data.writeString(pkg);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004053 data.writeInt(appid);
Dianne Hackborn21d9b562013-05-28 17:46:59 -07004054 data.writeString(reason);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004055 mRemote.transact(KILL_APPLICATION_WITH_APPID_TRANSACTION, data, reply, 0);
Suchi Amalapurapu261e66a2009-07-27 15:21:34 -07004056 reply.readException();
4057 data.recycle();
4058 reply.recycle();
4059 }
Dianne Hackborna6ddc8a2009-07-28 17:49:55 -07004060
4061 public void closeSystemDialogs(String reason) throws RemoteException {
4062 Parcel data = Parcel.obtain();
4063 Parcel reply = Parcel.obtain();
4064 data.writeInterfaceToken(IActivityManager.descriptor);
4065 data.writeString(reason);
4066 mRemote.transact(CLOSE_SYSTEM_DIALOGS_TRANSACTION, data, reply, 0);
4067 reply.readException();
4068 data.recycle();
4069 reply.recycle();
4070 }
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004071
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004072 public Debug.MemoryInfo[] getProcessMemoryInfo(int[] pids)
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004073 throws RemoteException {
4074 Parcel data = Parcel.obtain();
4075 Parcel reply = Parcel.obtain();
4076 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004077 data.writeIntArray(pids);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004078 mRemote.transact(GET_PROCESS_MEMORY_INFO_TRANSACTION, data, reply, 0);
4079 reply.readException();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004080 Debug.MemoryInfo[] res = reply.createTypedArray(Debug.MemoryInfo.CREATOR);
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004081 data.recycle();
4082 reply.recycle();
Dianne Hackborn4f21c4c2009-09-17 10:24:05 -07004083 return res;
Dianne Hackborn3025ef32009-08-31 21:31:47 -07004084 }
Christopher Tate5e1ab332009-09-01 20:32:49 -07004085
4086 public void killApplicationProcess(String processName, int uid) throws RemoteException {
4087 Parcel data = Parcel.obtain();
4088 Parcel reply = Parcel.obtain();
4089 data.writeInterfaceToken(IActivityManager.descriptor);
4090 data.writeString(processName);
4091 data.writeInt(uid);
4092 mRemote.transact(KILL_APPLICATION_PROCESS_TRANSACTION, data, reply, 0);
4093 reply.readException();
4094 data.recycle();
4095 reply.recycle();
4096 }
4097
Dianne Hackborn3b3e1452009-09-24 19:22:12 -07004098 public void overridePendingTransition(IBinder token, String packageName,
4099 int enterAnim, int exitAnim) throws RemoteException {
4100 Parcel data = Parcel.obtain();
4101 Parcel reply = Parcel.obtain();
4102 data.writeInterfaceToken(IActivityManager.descriptor);
4103 data.writeStrongBinder(token);
4104 data.writeString(packageName);
4105 data.writeInt(enterAnim);
4106 data.writeInt(exitAnim);
4107 mRemote.transact(OVERRIDE_PENDING_TRANSITION_TRANSACTION, data, reply, 0);
4108 reply.readException();
4109 data.recycle();
4110 reply.recycle();
4111 }
4112
Dianne Hackborn9327f4f2010-01-29 10:38:29 -08004113 public boolean isUserAMonkey() throws RemoteException {
4114 Parcel data = Parcel.obtain();
4115 Parcel reply = Parcel.obtain();
4116 data.writeInterfaceToken(IActivityManager.descriptor);
4117 mRemote.transact(IS_USER_A_MONKEY_TRANSACTION, data, reply, 0);
4118 reply.readException();
4119 boolean res = reply.readInt() != 0;
4120 data.recycle();
4121 reply.recycle();
4122 return res;
4123 }
Adam Momtaz8f6f1f42013-04-10 12:42:58 -07004124
4125 public void setUserIsMonkey(boolean monkey) throws RemoteException {
4126 Parcel data = Parcel.obtain();
4127 Parcel reply = Parcel.obtain();
4128 data.writeInterfaceToken(IActivityManager.descriptor);
4129 data.writeInt(monkey ? 1 : 0);
4130 mRemote.transact(SET_USER_IS_MONKEY_TRANSACTION, data, reply, 0);
4131 reply.readException();
4132 data.recycle();
4133 reply.recycle();
4134 }
4135
Dianne Hackborn860755f2010-06-03 18:47:52 -07004136 public void finishHeavyWeightApp() throws RemoteException {
4137 Parcel data = Parcel.obtain();
4138 Parcel reply = Parcel.obtain();
4139 data.writeInterfaceToken(IActivityManager.descriptor);
4140 mRemote.transact(FINISH_HEAVY_WEIGHT_APP_TRANSACTION, data, reply, 0);
4141 reply.readException();
4142 data.recycle();
4143 reply.recycle();
4144 }
Craig Mautner4addfc52013-06-25 08:05:45 -07004145
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004146 public boolean convertFromTranslucent(IBinder token)
Craig Mautner4addfc52013-06-25 08:05:45 -07004147 throws RemoteException {
4148 Parcel data = Parcel.obtain();
4149 Parcel reply = Parcel.obtain();
4150 data.writeInterfaceToken(IActivityManager.descriptor);
4151 data.writeStrongBinder(token);
Craig Mautner5eda9b32013-07-02 11:58:16 -07004152 mRemote.transact(CONVERT_FROM_TRANSLUCENT_TRANSACTION, data, reply, 0);
4153 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004154 boolean res = reply.readInt() != 0;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004155 data.recycle();
4156 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004157 return res;
Craig Mautner5eda9b32013-07-02 11:58:16 -07004158 }
4159
Craig Mautner233ceee2014-05-09 17:05:11 -07004160 public boolean convertToTranslucent(IBinder token, ActivityOptions options)
Craig Mautner5eda9b32013-07-02 11:58:16 -07004161 throws RemoteException {
4162 Parcel data = Parcel.obtain();
4163 Parcel reply = Parcel.obtain();
4164 data.writeInterfaceToken(IActivityManager.descriptor);
4165 data.writeStrongBinder(token);
Craig Mautner233ceee2014-05-09 17:05:11 -07004166 if (options == null) {
4167 data.writeInt(0);
4168 } else {
4169 data.writeInt(1);
4170 data.writeBundle(options.toBundle());
4171 }
Craig Mautner5eda9b32013-07-02 11:58:16 -07004172 mRemote.transact(CONVERT_TO_TRANSLUCENT_TRANSACTION, data, reply, 0);
Craig Mautner4addfc52013-06-25 08:05:45 -07004173 reply.readException();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004174 boolean res = reply.readInt() != 0;
Craig Mautner4addfc52013-06-25 08:05:45 -07004175 data.recycle();
4176 reply.recycle();
Craig Mautnerbc57cd12013-08-19 15:47:42 -07004177 return res;
Craig Mautner4addfc52013-06-25 08:05:45 -07004178 }
4179
Craig Mautner233ceee2014-05-09 17:05:11 -07004180 public ActivityOptions getActivityOptions(IBinder token) throws RemoteException {
4181 Parcel data = Parcel.obtain();
4182 Parcel reply = Parcel.obtain();
4183 data.writeInterfaceToken(IActivityManager.descriptor);
4184 data.writeStrongBinder(token);
4185 mRemote.transact(GET_ACTIVITY_OPTIONS_TRANSACTION, data, reply, 0);
4186 reply.readException();
4187 Bundle bundle = reply.readBundle();
4188 ActivityOptions options = bundle == null ? null : new ActivityOptions(bundle);
4189 data.recycle();
4190 reply.recycle();
4191 return options;
4192 }
4193
Daniel Sandler69a48172010-06-23 16:29:36 -04004194 public void setImmersive(IBinder token, boolean immersive)
4195 throws RemoteException {
4196 Parcel data = Parcel.obtain();
4197 Parcel reply = Parcel.obtain();
4198 data.writeInterfaceToken(IActivityManager.descriptor);
4199 data.writeStrongBinder(token);
4200 data.writeInt(immersive ? 1 : 0);
4201 mRemote.transact(SET_IMMERSIVE_TRANSACTION, data, reply, 0);
4202 reply.readException();
4203 data.recycle();
4204 reply.recycle();
4205 }
4206
4207 public boolean isImmersive(IBinder token)
4208 throws RemoteException {
4209 Parcel data = Parcel.obtain();
4210 Parcel reply = Parcel.obtain();
4211 data.writeInterfaceToken(IActivityManager.descriptor);
4212 data.writeStrongBinder(token);
4213 mRemote.transact(IS_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004214 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004215 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004216 data.recycle();
4217 reply.recycle();
4218 return res;
4219 }
4220
Craig Mautnerd61dc202014-07-07 11:09:11 -07004221 public boolean isTopOfTask(IBinder token) throws RemoteException {
4222 Parcel data = Parcel.obtain();
4223 Parcel reply = Parcel.obtain();
4224 data.writeInterfaceToken(IActivityManager.descriptor);
4225 data.writeStrongBinder(token);
4226 mRemote.transact(IS_TOP_OF_TASK_TRANSACTION, data, reply, 0);
4227 reply.readException();
4228 boolean res = reply.readInt() == 1;
4229 data.recycle();
4230 reply.recycle();
4231 return res;
4232 }
4233
Daniel Sandler69a48172010-06-23 16:29:36 -04004234 public boolean isTopActivityImmersive()
4235 throws RemoteException {
4236 Parcel data = Parcel.obtain();
4237 Parcel reply = Parcel.obtain();
4238 data.writeInterfaceToken(IActivityManager.descriptor);
4239 mRemote.transact(IS_TOP_ACTIVITY_IMMERSIVE_TRANSACTION, data, reply, 0);
Daniel Sandler69a48172010-06-23 16:29:36 -04004240 reply.readException();
Dianne Hackborn7e269642010-08-25 19:50:20 -07004241 boolean res = reply.readInt() == 1;
Daniel Sandler69a48172010-06-23 16:29:36 -04004242 data.recycle();
4243 reply.recycle();
4244 return res;
4245 }
4246
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004247 public void crashApplication(int uid, int initialPid, String packageName,
4248 String message) throws RemoteException {
4249 Parcel data = Parcel.obtain();
4250 Parcel reply = Parcel.obtain();
4251 data.writeInterfaceToken(IActivityManager.descriptor);
4252 data.writeInt(uid);
4253 data.writeInt(initialPid);
4254 data.writeString(packageName);
4255 data.writeString(message);
4256 mRemote.transact(CRASH_APPLICATION_TRANSACTION, data, reply, 0);
4257 reply.readException();
4258 data.recycle();
4259 reply.recycle();
4260 }
Andy McFadden824c5102010-07-09 16:26:57 -07004261
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004262 public String getProviderMimeType(Uri uri, int userId) throws RemoteException {
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004263 Parcel data = Parcel.obtain();
4264 Parcel reply = Parcel.obtain();
4265 data.writeInterfaceToken(IActivityManager.descriptor);
4266 uri.writeToParcel(data, 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004267 data.writeInt(userId);
Dianne Hackborncca1f0e2010-09-26 18:34:53 -07004268 mRemote.transact(GET_PROVIDER_MIME_TYPE_TRANSACTION, data, reply, 0);
4269 reply.readException();
4270 String res = reply.readString();
4271 data.recycle();
4272 reply.recycle();
4273 return res;
4274 }
4275
Dianne Hackborn7e269642010-08-25 19:50:20 -07004276 public IBinder newUriPermissionOwner(String name)
4277 throws RemoteException {
4278 Parcel data = Parcel.obtain();
4279 Parcel reply = Parcel.obtain();
4280 data.writeInterfaceToken(IActivityManager.descriptor);
4281 data.writeString(name);
4282 mRemote.transact(NEW_URI_PERMISSION_OWNER_TRANSACTION, data, reply, 0);
4283 reply.readException();
4284 IBinder res = reply.readStrongBinder();
4285 data.recycle();
4286 reply.recycle();
4287 return res;
4288 }
4289
4290 public void grantUriPermissionFromOwner(IBinder owner, int fromUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004291 Uri uri, int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004292 Parcel data = Parcel.obtain();
4293 Parcel reply = Parcel.obtain();
4294 data.writeInterfaceToken(IActivityManager.descriptor);
4295 data.writeStrongBinder(owner);
4296 data.writeInt(fromUid);
4297 data.writeString(targetPkg);
4298 uri.writeToParcel(data, 0);
4299 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004300 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004301 mRemote.transact(GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4302 reply.readException();
4303 data.recycle();
4304 reply.recycle();
4305 }
4306
4307 public void revokeUriPermissionFromOwner(IBinder owner, Uri uri,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004308 int mode, int userId) throws RemoteException {
Dianne Hackborn7e269642010-08-25 19:50:20 -07004309 Parcel data = Parcel.obtain();
4310 Parcel reply = Parcel.obtain();
4311 data.writeInterfaceToken(IActivityManager.descriptor);
4312 data.writeStrongBinder(owner);
4313 if (uri != null) {
4314 data.writeInt(1);
4315 uri.writeToParcel(data, 0);
4316 } else {
4317 data.writeInt(0);
4318 }
4319 data.writeInt(mode);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004320 data.writeInt(userId);
Dianne Hackborn7e269642010-08-25 19:50:20 -07004321 mRemote.transact(REVOKE_URI_PERMISSION_TRANSACTION, data, reply, 0);
4322 reply.readException();
4323 data.recycle();
4324 reply.recycle();
4325 }
Dianne Hackbornc8f84972010-08-25 23:14:44 -07004326
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004327 public int checkGrantUriPermission(int callingUid, String targetPkg,
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004328 Uri uri, int modeFlags, int userId) throws RemoteException {
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004329 Parcel data = Parcel.obtain();
4330 Parcel reply = Parcel.obtain();
4331 data.writeInterfaceToken(IActivityManager.descriptor);
4332 data.writeInt(callingUid);
4333 data.writeString(targetPkg);
4334 uri.writeToParcel(data, 0);
4335 data.writeInt(modeFlags);
Nicolas Prevotd85fc722014-04-16 19:52:08 +01004336 data.writeInt(userId);
Dianne Hackborn90f4aaf2010-09-27 14:58:44 -07004337 mRemote.transact(CHECK_GRANT_URI_PERMISSION_TRANSACTION, data, reply, 0);
4338 reply.readException();
4339 int res = reply.readInt();
4340 data.recycle();
4341 reply.recycle();
4342 return res;
4343 }
4344
Dianne Hackborn1676c852012-09-10 14:52:30 -07004345 public boolean dumpHeap(String process, int userId, boolean managed,
Andy McFadden824c5102010-07-09 16:26:57 -07004346 String path, ParcelFileDescriptor fd) throws RemoteException {
4347 Parcel data = Parcel.obtain();
4348 Parcel reply = Parcel.obtain();
4349 data.writeInterfaceToken(IActivityManager.descriptor);
4350 data.writeString(process);
Dianne Hackborn1676c852012-09-10 14:52:30 -07004351 data.writeInt(userId);
Andy McFadden824c5102010-07-09 16:26:57 -07004352 data.writeInt(managed ? 1 : 0);
4353 data.writeString(path);
4354 if (fd != null) {
4355 data.writeInt(1);
4356 fd.writeToParcel(data, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
4357 } else {
4358 data.writeInt(0);
4359 }
4360 mRemote.transact(DUMP_HEAP_TRANSACTION, data, reply, 0);
4361 reply.readException();
4362 boolean res = reply.readInt() != 0;
4363 reply.recycle();
4364 data.recycle();
4365 return res;
4366 }
Dianne Hackborn9d39d0c2010-06-24 15:57:42 -07004367
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004368 public int startActivities(IApplicationThread caller, String callingPackage,
Dianne Hackborna4972e92012-03-14 10:38:05 -07004369 Intent[] intents, String[] resolvedTypes, IBinder resultTo,
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004370 Bundle options, int userId) throws RemoteException {
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004371 Parcel data = Parcel.obtain();
4372 Parcel reply = Parcel.obtain();
4373 data.writeInterfaceToken(IActivityManager.descriptor);
4374 data.writeStrongBinder(caller != null ? caller.asBinder() : null);
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004375 data.writeString(callingPackage);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004376 data.writeTypedArray(intents, 0);
4377 data.writeStringArray(resolvedTypes);
4378 data.writeStrongBinder(resultTo);
Dianne Hackborna4972e92012-03-14 10:38:05 -07004379 if (options != null) {
4380 data.writeInt(1);
4381 options.writeToParcel(data, 0);
4382 } else {
4383 data.writeInt(0);
4384 }
Amith Yamasaniea7e9152012-09-24 16:11:18 -07004385 data.writeInt(userId);
Dianne Hackborn621e17d2010-11-22 15:59:56 -08004386 mRemote.transact(START_ACTIVITIES_TRANSACTION, data, reply, 0);
4387 reply.readException();
4388 int result = reply.readInt();
4389 reply.recycle();
4390 data.recycle();
4391 return result;
4392 }
4393
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004394 public int getFrontActivityScreenCompatMode() throws RemoteException {
4395 Parcel data = Parcel.obtain();
4396 Parcel reply = Parcel.obtain();
4397 data.writeInterfaceToken(IActivityManager.descriptor);
4398 mRemote.transact(GET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4399 reply.readException();
4400 int mode = reply.readInt();
4401 reply.recycle();
4402 data.recycle();
4403 return mode;
4404 }
4405
4406 public void setFrontActivityScreenCompatMode(int mode) throws RemoteException {
4407 Parcel data = Parcel.obtain();
4408 Parcel reply = Parcel.obtain();
4409 data.writeInterfaceToken(IActivityManager.descriptor);
4410 data.writeInt(mode);
4411 mRemote.transact(SET_FRONT_ACTIVITY_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4412 reply.readException();
4413 reply.recycle();
4414 data.recycle();
4415 }
4416
4417 public int getPackageScreenCompatMode(String packageName) throws RemoteException {
4418 Parcel data = Parcel.obtain();
4419 Parcel reply = Parcel.obtain();
4420 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004421 data.writeString(packageName);
4422 mRemote.transact(GET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004423 reply.readException();
4424 int mode = reply.readInt();
4425 reply.recycle();
4426 data.recycle();
4427 return mode;
4428 }
4429
4430 public void setPackageScreenCompatMode(String packageName, int mode)
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004431 throws RemoteException {
4432 Parcel data = Parcel.obtain();
4433 Parcel reply = Parcel.obtain();
4434 data.writeInterfaceToken(IActivityManager.descriptor);
4435 data.writeString(packageName);
Dianne Hackborn0f1de9a2011-05-11 17:34:49 -07004436 data.writeInt(mode);
Dianne Hackborne2515ee2011-04-27 18:52:56 -04004437 mRemote.transact(SET_PACKAGE_SCREEN_COMPAT_MODE_TRANSACTION, data, reply, 0);
4438 reply.readException();
4439 reply.recycle();
4440 data.recycle();
4441 }
4442
Dianne Hackborn36cd41f2011-05-25 21:00:46 -07004443 public boolean getPackageAskScreenCompat(String packageName) throws RemoteException {
4444 Parcel data = Parcel.obtain();
4445 Parcel reply = Parcel.obtain();
4446 data.writeInterfaceToken(IActivityManager.descriptor);
4447 data.writeString(packageName);
4448 mRemote.transact(GET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4449 reply.readException();
4450 boolean ask = reply.readInt() != 0;
4451 reply.recycle();
4452 data.recycle();
4453 return ask;
4454 }
4455
4456 public void setPackageAskScreenCompat(String packageName, boolean ask)
4457 throws RemoteException {
4458 Parcel data = Parcel.obtain();
4459 Parcel reply = Parcel.obtain();
4460 data.writeInterfaceToken(IActivityManager.descriptor);
4461 data.writeString(packageName);
4462 data.writeInt(ask ? 1 : 0);
4463 mRemote.transact(SET_PACKAGE_ASK_SCREEN_COMPAT_TRANSACTION, data, reply, 0);
4464 reply.readException();
4465 reply.recycle();
4466 data.recycle();
4467 }
4468
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004469 public boolean switchUser(int userid) throws RemoteException {
4470 Parcel data = Parcel.obtain();
4471 Parcel reply = Parcel.obtain();
4472 data.writeInterfaceToken(IActivityManager.descriptor);
4473 data.writeInt(userid);
4474 mRemote.transact(SWITCH_USER_TRANSACTION, data, reply, 0);
4475 reply.readException();
4476 boolean result = reply.readInt() != 0;
4477 reply.recycle();
4478 data.recycle();
4479 return result;
4480 }
Amith Yamasani52f1d752012-03-28 18:19:29 -07004481
Kenny Guy08488bf2014-02-21 17:40:37 +00004482 public boolean startUserInBackground(int userid) throws RemoteException {
4483 Parcel data = Parcel.obtain();
4484 Parcel reply = Parcel.obtain();
4485 data.writeInterfaceToken(IActivityManager.descriptor);
4486 data.writeInt(userid);
4487 mRemote.transact(START_USER_IN_BACKGROUND_TRANSACTION, data, reply, 0);
4488 reply.readException();
4489 boolean result = reply.readInt() != 0;
4490 reply.recycle();
4491 data.recycle();
4492 return result;
4493 }
4494
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004495 public int stopUser(int userid, IStopUserCallback callback) throws RemoteException {
4496 Parcel data = Parcel.obtain();
4497 Parcel reply = Parcel.obtain();
4498 data.writeInterfaceToken(IActivityManager.descriptor);
4499 data.writeInt(userid);
4500 data.writeStrongInterface(callback);
4501 mRemote.transact(STOP_USER_TRANSACTION, data, reply, 0);
4502 reply.readException();
4503 int result = reply.readInt();
4504 reply.recycle();
4505 data.recycle();
4506 return result;
4507 }
4508
Amith Yamasani52f1d752012-03-28 18:19:29 -07004509 public UserInfo getCurrentUser() throws RemoteException {
4510 Parcel data = Parcel.obtain();
4511 Parcel reply = Parcel.obtain();
4512 data.writeInterfaceToken(IActivityManager.descriptor);
Dianne Hackborn80a4af22012-08-27 19:18:31 -07004513 mRemote.transact(GET_CURRENT_USER_TRANSACTION, data, reply, 0);
Amith Yamasani52f1d752012-03-28 18:19:29 -07004514 reply.readException();
4515 UserInfo userInfo = UserInfo.CREATOR.createFromParcel(reply);
4516 reply.recycle();
4517 data.recycle();
4518 return userInfo;
4519 }
4520
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004521 public boolean isUserRunning(int userid, boolean orStopping) throws RemoteException {
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004522 Parcel data = Parcel.obtain();
4523 Parcel reply = Parcel.obtain();
4524 data.writeInterfaceToken(IActivityManager.descriptor);
4525 data.writeInt(userid);
Dianne Hackborna8a9bd62012-10-09 15:36:59 -07004526 data.writeInt(orStopping ? 1 : 0);
Dianne Hackborn5e03e2c2012-09-06 14:21:19 -07004527 mRemote.transact(IS_USER_RUNNING_TRANSACTION, data, reply, 0);
4528 reply.readException();
4529 boolean result = reply.readInt() != 0;
4530 reply.recycle();
4531 data.recycle();
4532 return result;
4533 }
4534
Dianne Hackbornc72fc672012-09-20 13:12:03 -07004535 public int[] getRunningUserIds() throws RemoteException {
4536 Parcel data = Parcel.obtain();
4537 Parcel reply = Parcel.obtain();
4538 data.writeInterfaceToken(IActivityManager.descriptor);
4539 mRemote.transact(GET_RUNNING_USER_IDS_TRANSACTION, data, reply, 0);
4540 reply.readException();
4541 int[] result = reply.createIntArray();
4542 reply.recycle();
4543 data.recycle();
4544 return result;
4545 }
4546
Dianne Hackborn0c5001d2011-04-12 18:16:08 -07004547 public boolean removeTask(int taskId, int flags) throws RemoteException {
4548 Parcel data = Parcel.obtain();
4549 Parcel reply = Parcel.obtain();
4550 data.writeInterfaceToken(IActivityManager.descriptor);
4551 data.writeInt(taskId);
4552 data.writeInt(flags);
4553 mRemote.transact(REMOVE_TASK_TRANSACTION, data, reply, 0);
4554 reply.readException();
4555 boolean result = reply.readInt() != 0;
4556 reply.recycle();
4557 data.recycle();
4558 return result;
4559 }
Amith Yamasani4b2e9342011-03-31 12:38:53 -07004560
Jeff Sharkeya4620792011-05-20 15:29:23 -07004561 public void registerProcessObserver(IProcessObserver observer) throws RemoteException {
4562 Parcel data = Parcel.obtain();
4563 Parcel reply = Parcel.obtain();
4564 data.writeInterfaceToken(IActivityManager.descriptor);
4565 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4566 mRemote.transact(REGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4567 reply.readException();
4568 data.recycle();
4569 reply.recycle();
4570 }
4571
4572 public void unregisterProcessObserver(IProcessObserver observer) throws RemoteException {
4573 Parcel data = Parcel.obtain();
4574 Parcel reply = Parcel.obtain();
4575 data.writeInterfaceToken(IActivityManager.descriptor);
4576 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4577 mRemote.transact(UNREGISTER_PROCESS_OBSERVER_TRANSACTION, data, reply, 0);
4578 reply.readException();
4579 data.recycle();
4580 reply.recycle();
4581 }
4582
Dianne Hackborn6c418d52011-06-29 14:05:33 -07004583 public boolean isIntentSenderTargetedToPackage(IIntentSender sender) throws RemoteException {
4584 Parcel data = Parcel.obtain();
4585 Parcel reply = Parcel.obtain();
4586 data.writeInterfaceToken(IActivityManager.descriptor);
4587 data.writeStrongBinder(sender.asBinder());
4588 mRemote.transact(IS_INTENT_SENDER_TARGETED_TO_PACKAGE_TRANSACTION, data, reply, 0);
4589 reply.readException();
4590 boolean res = reply.readInt() != 0;
4591 data.recycle();
4592 reply.recycle();
4593 return res;
4594 }
4595
Dianne Hackborn1927ae82012-06-22 15:21:36 -07004596 public boolean isIntentSenderAnActivity(IIntentSender sender) throws RemoteException {
4597 Parcel data = Parcel.obtain();
4598 Parcel reply = Parcel.obtain();
4599 data.writeInterfaceToken(IActivityManager.descriptor);
4600 data.writeStrongBinder(sender.asBinder());
4601 mRemote.transact(IS_INTENT_SENDER_AN_ACTIVITY_TRANSACTION, data, reply, 0);
4602 reply.readException();
4603 boolean res = reply.readInt() != 0;
4604 data.recycle();
4605 reply.recycle();
4606 return res;
4607 }
4608
Dianne Hackborn81038902012-11-26 17:04:09 -08004609 public Intent getIntentForIntentSender(IIntentSender sender) throws RemoteException {
4610 Parcel data = Parcel.obtain();
4611 Parcel reply = Parcel.obtain();
4612 data.writeInterfaceToken(IActivityManager.descriptor);
4613 data.writeStrongBinder(sender.asBinder());
4614 mRemote.transact(GET_INTENT_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4615 reply.readException();
4616 Intent res = reply.readInt() != 0
4617 ? Intent.CREATOR.createFromParcel(reply) : null;
4618 data.recycle();
4619 reply.recycle();
4620 return res;
4621 }
4622
Dianne Hackborna1f1a3c2014-02-24 18:12:28 -08004623 public String getTagForIntentSender(IIntentSender sender, String prefix)
4624 throws RemoteException {
4625 Parcel data = Parcel.obtain();
4626 Parcel reply = Parcel.obtain();
4627 data.writeInterfaceToken(IActivityManager.descriptor);
4628 data.writeStrongBinder(sender.asBinder());
4629 data.writeString(prefix);
4630 mRemote.transact(GET_TAG_FOR_INTENT_SENDER_TRANSACTION, data, reply, 0);
4631 reply.readException();
4632 String res = reply.readString();
4633 data.recycle();
4634 reply.recycle();
4635 return res;
4636 }
4637
Dianne Hackborn31ca8542011-07-19 14:58:28 -07004638 public void updatePersistentConfiguration(Configuration values) throws RemoteException
4639 {
4640 Parcel data = Parcel.obtain();
4641 Parcel reply = Parcel.obtain();
4642 data.writeInterfaceToken(IActivityManager.descriptor);
4643 values.writeToParcel(data, 0);
4644 mRemote.transact(UPDATE_PERSISTENT_CONFIGURATION_TRANSACTION, data, reply, 0);
4645 reply.readException();
4646 data.recycle();
4647 reply.recycle();
4648 }
4649
Dianne Hackbornb437e092011-08-05 17:50:29 -07004650 public long[] getProcessPss(int[] pids) throws RemoteException {
4651 Parcel data = Parcel.obtain();
4652 Parcel reply = Parcel.obtain();
4653 data.writeInterfaceToken(IActivityManager.descriptor);
4654 data.writeIntArray(pids);
4655 mRemote.transact(GET_PROCESS_PSS_TRANSACTION, data, reply, 0);
4656 reply.readException();
4657 long[] res = reply.createLongArray();
4658 data.recycle();
4659 reply.recycle();
4660 return res;
4661 }
4662
Dianne Hackborn661cd522011-08-22 00:26:20 -07004663 public void showBootMessage(CharSequence msg, boolean always) throws RemoteException {
4664 Parcel data = Parcel.obtain();
4665 Parcel reply = Parcel.obtain();
4666 data.writeInterfaceToken(IActivityManager.descriptor);
4667 TextUtils.writeToParcel(msg, data, 0);
4668 data.writeInt(always ? 1 : 0);
4669 mRemote.transact(SHOW_BOOT_MESSAGE_TRANSACTION, data, reply, 0);
4670 reply.readException();
4671 data.recycle();
4672 reply.recycle();
4673 }
4674
Dianne Hackborn90c52de2011-09-23 12:57:44 -07004675 public void dismissKeyguardOnNextActivity() throws RemoteException {
4676 Parcel data = Parcel.obtain();
4677 Parcel reply = Parcel.obtain();
4678 data.writeInterfaceToken(IActivityManager.descriptor);
4679 mRemote.transact(DISMISS_KEYGUARD_ON_NEXT_ACTIVITY_TRANSACTION, data, reply, 0);
4680 reply.readException();
4681 data.recycle();
4682 reply.recycle();
4683 }
4684
Adam Powelldd8fab22012-03-22 17:47:27 -07004685 public boolean targetTaskAffinityMatchesActivity(IBinder token, String destAffinity)
4686 throws RemoteException {
4687 Parcel data = Parcel.obtain();
4688 Parcel reply = Parcel.obtain();
4689 data.writeInterfaceToken(IActivityManager.descriptor);
4690 data.writeStrongBinder(token);
4691 data.writeString(destAffinity);
4692 mRemote.transact(TARGET_TASK_AFFINITY_MATCHES_ACTIVITY_TRANSACTION, data, reply, 0);
4693 reply.readException();
4694 boolean result = reply.readInt() != 0;
4695 data.recycle();
4696 reply.recycle();
4697 return result;
4698 }
4699
4700 public boolean navigateUpTo(IBinder token, Intent target, int resultCode, Intent resultData)
4701 throws RemoteException {
4702 Parcel data = Parcel.obtain();
4703 Parcel reply = Parcel.obtain();
4704 data.writeInterfaceToken(IActivityManager.descriptor);
4705 data.writeStrongBinder(token);
4706 target.writeToParcel(data, 0);
4707 data.writeInt(resultCode);
4708 if (resultData != null) {
4709 data.writeInt(1);
4710 resultData.writeToParcel(data, 0);
4711 } else {
4712 data.writeInt(0);
4713 }
4714 mRemote.transact(NAVIGATE_UP_TO_TRANSACTION, data, reply, 0);
4715 reply.readException();
4716 boolean result = reply.readInt() != 0;
4717 data.recycle();
4718 reply.recycle();
4719 return result;
4720 }
4721
Dianne Hackborn5320eb82012-05-18 12:05:04 -07004722 public int getLaunchedFromUid(IBinder activityToken) throws RemoteException {
4723 Parcel data = Parcel.obtain();
4724 Parcel reply = Parcel.obtain();
4725 data.writeInterfaceToken(IActivityManager.descriptor);
4726 data.writeStrongBinder(activityToken);
4727 mRemote.transact(GET_LAUNCHED_FROM_UID_TRANSACTION, data, reply, 0);
4728 reply.readException();
4729 int result = reply.readInt();
4730 data.recycle();
4731 reply.recycle();
4732 return result;
4733 }
4734
Dianne Hackbornf265ea92013-01-31 15:00:51 -08004735 public String getLaunchedFromPackage(IBinder activityToken) throws RemoteException {
4736 Parcel data = Parcel.obtain();
4737 Parcel reply = Parcel.obtain();
4738 data.writeInterfaceToken(IActivityManager.descriptor);
4739 data.writeStrongBinder(activityToken);
4740 mRemote.transact(GET_LAUNCHED_FROM_PACKAGE_TRANSACTION, data, reply, 0);
4741 reply.readException();
4742 String result = reply.readString();
4743 data.recycle();
4744 reply.recycle();
4745 return result;
4746 }
4747
Dianne Hackborn5dc5a002012-09-15 19:33:48 -07004748 public void registerUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4749 Parcel data = Parcel.obtain();
4750 Parcel reply = Parcel.obtain();
4751 data.writeInterfaceToken(IActivityManager.descriptor);
4752 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4753 mRemote.transact(REGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4754 reply.readException();
4755 data.recycle();
4756 reply.recycle();
4757 }
4758
4759 public void unregisterUserSwitchObserver(IUserSwitchObserver observer) throws RemoteException {
4760 Parcel data = Parcel.obtain();
4761 Parcel reply = Parcel.obtain();
4762 data.writeInterfaceToken(IActivityManager.descriptor);
4763 data.writeStrongBinder(observer != null ? observer.asBinder() : null);
4764 mRemote.transact(UNREGISTER_USER_SWITCH_OBSERVER_TRANSACTION, data, reply, 0);
4765 reply.readException();
4766 data.recycle();
4767 reply.recycle();
4768 }
4769
Dianne Hackbornd4ac8d72012-09-27 23:20:10 -07004770 public void requestBugReport() throws RemoteException {
4771 Parcel data = Parcel.obtain();
4772 Parcel reply = Parcel.obtain();
4773 data.writeInterfaceToken(IActivityManager.descriptor);
4774 mRemote.transact(REQUEST_BUG_REPORT_TRANSACTION, data, reply, 0);
4775 reply.readException();
4776 data.recycle();
4777 reply.recycle();
4778 }
4779
Jeff Brownbd181bb2013-09-10 16:44:24 -07004780 public long inputDispatchingTimedOut(int pid, boolean aboveSystem, String reason)
4781 throws RemoteException {
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004782 Parcel data = Parcel.obtain();
4783 Parcel reply = Parcel.obtain();
4784 data.writeInterfaceToken(IActivityManager.descriptor);
4785 data.writeInt(pid);
4786 data.writeInt(aboveSystem ? 1 : 0);
Jeff Brownbd181bb2013-09-10 16:44:24 -07004787 data.writeString(reason);
Dianne Hackborn5fe7e2a2012-10-04 11:58:16 -07004788 mRemote.transact(INPUT_DISPATCHING_TIMED_OUT_TRANSACTION, data, reply, 0);
4789 reply.readException();
4790 long res = reply.readInt();
4791 data.recycle();
4792 reply.recycle();
4793 return res;
4794 }
4795
Adam Skorydfc7fd72013-08-05 19:23:41 -07004796 public Bundle getAssistContextExtras(int requestType) throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004797 Parcel data = Parcel.obtain();
4798 Parcel reply = Parcel.obtain();
4799 data.writeInterfaceToken(IActivityManager.descriptor);
4800 data.writeInt(requestType);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004801 mRemote.transact(GET_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004802 reply.readException();
4803 Bundle res = reply.readBundle();
4804 data.recycle();
4805 reply.recycle();
4806 return res;
4807 }
4808
Adam Skory7140a252013-09-11 12:04:58 +01004809 public void reportAssistContextExtras(IBinder token, Bundle extras)
Adam Skorydfc7fd72013-08-05 19:23:41 -07004810 throws RemoteException {
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004811 Parcel data = Parcel.obtain();
4812 Parcel reply = Parcel.obtain();
4813 data.writeInterfaceToken(IActivityManager.descriptor);
4814 data.writeStrongBinder(token);
4815 data.writeBundle(extras);
Adam Skorydfc7fd72013-08-05 19:23:41 -07004816 mRemote.transact(REPORT_ASSIST_CONTEXT_EXTRAS_TRANSACTION, data, reply, 0);
Dianne Hackbornf9c5e0f2013-01-23 14:39:13 -08004817 reply.readException();
4818 data.recycle();
4819 reply.recycle();
4820 }
4821
Dianne Hackbornf1b78242013-04-08 22:28:59 -07004822 public void killUid(int uid, String reason) throws RemoteException {
4823 Parcel data = Parcel.obtain();
4824 Parcel reply = Parcel.obtain();
4825 data.writeInterfaceToken(IActivityManager.descriptor);
4826 data.writeInt(uid);
4827 data.writeString(reason);
4828 mRemote.transact(KILL_UID_TRANSACTION, data, reply, 0);
4829 reply.readException();
4830 data.recycle();
4831 reply.recycle();
4832 }
4833
Dianne Hackborn8bd64df2013-05-06 16:07:26 -07004834 public void hang(IBinder who, boolean allowRestart) throws RemoteException {
4835 Parcel data = Parcel.obtain();
4836 Parcel reply = Parcel.obtain();
4837 data.writeInterfaceToken(IActivityManager.descriptor);
4838 data.writeStrongBinder(who);
4839 data.writeInt(allowRestart ? 1 : 0);
4840 mRemote.transact(HANG_TRANSACTION, data, reply, 0);
4841 reply.readException();
4842 data.recycle();
4843 reply.recycle();
4844 }
4845
Dianne Hackborn2286cdc2013-07-01 19:10:06 -07004846 public void reportActivityFullyDrawn(IBinder token) throws RemoteException {
4847 Parcel data = Parcel.obtain();
4848 Parcel reply = Parcel.obtain();
4849 data.writeInterfaceToken(IActivityManager.descriptor);
4850 data.writeStrongBinder(token);
4851 mRemote.transact(REPORT_ACTIVITY_FULLY_DRAWN_TRANSACTION, data, reply, 0);
4852 reply.readException();
4853 data.recycle();
4854 reply.recycle();
4855 }
4856
Craig Mautner5eda9b32013-07-02 11:58:16 -07004857 public void notifyActivityDrawn(IBinder token) throws RemoteException {
4858 Parcel data = Parcel.obtain();
4859 Parcel reply = Parcel.obtain();
4860 data.writeInterfaceToken(IActivityManager.descriptor);
4861 data.writeStrongBinder(token);
4862 mRemote.transact(NOTIFY_ACTIVITY_DRAWN_TRANSACTION, data, reply, 0);
4863 reply.readException();
4864 data.recycle();
4865 reply.recycle();
4866 }
4867
Dianne Hackborn57a7f592013-07-22 18:21:32 -07004868 public void restart() throws RemoteException {
4869 Parcel data = Parcel.obtain();
4870 Parcel reply = Parcel.obtain();
4871 data.writeInterfaceToken(IActivityManager.descriptor);
4872 mRemote.transact(RESTART_TRANSACTION, data, reply, 0);
4873 reply.readException();
4874 data.recycle();
4875 reply.recycle();
4876 }
4877
Dianne Hackborn35f72be2013-09-16 10:57:39 -07004878 public void performIdleMaintenance() throws RemoteException {
4879 Parcel data = Parcel.obtain();
4880 Parcel reply = Parcel.obtain();
4881 data.writeInterfaceToken(IActivityManager.descriptor);
4882 mRemote.transact(PERFORM_IDLE_MAINTENANCE_TRANSACTION, data, reply, 0);
4883 reply.readException();
4884 data.recycle();
4885 reply.recycle();
4886 }
4887
Craig Mautner4a1cb222013-12-04 16:14:06 -08004888 public IActivityContainer createActivityContainer(IBinder parentActivityToken,
4889 IActivityContainerCallback callback) throws RemoteException {
4890 Parcel data = Parcel.obtain();
4891 Parcel reply = Parcel.obtain();
4892 data.writeInterfaceToken(IActivityManager.descriptor);
4893 data.writeStrongBinder(parentActivityToken);
Craig Mautnere3a00d72014-04-16 08:31:19 -07004894 data.writeStrongBinder(callback == null ? null : callback.asBinder());
Craig Mautner4a1cb222013-12-04 16:14:06 -08004895 mRemote.transact(CREATE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4896 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004897 final int result = reply.readInt();
4898 final IActivityContainer res;
4899 if (result == 1) {
4900 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4901 } else {
4902 res = null;
4903 }
Craig Mautner4a1cb222013-12-04 16:14:06 -08004904 data.recycle();
4905 reply.recycle();
4906 return res;
4907 }
4908
Craig Mautner95da1082014-02-24 17:54:35 -08004909 public void deleteActivityContainer(IActivityContainer activityContainer)
4910 throws RemoteException {
4911 Parcel data = Parcel.obtain();
4912 Parcel reply = Parcel.obtain();
4913 data.writeInterfaceToken(IActivityManager.descriptor);
4914 data.writeStrongBinder(activityContainer.asBinder());
4915 mRemote.transact(DELETE_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4916 reply.readException();
4917 data.recycle();
4918 reply.recycle();
4919 }
4920
Craig Mautnere0a38842013-12-16 16:14:02 -08004921 public IActivityContainer getEnclosingActivityContainer(IBinder activityToken)
4922 throws RemoteException {
4923 Parcel data = Parcel.obtain();
4924 Parcel reply = Parcel.obtain();
4925 data.writeInterfaceToken(IActivityManager.descriptor);
4926 data.writeStrongBinder(activityToken);
4927 mRemote.transact(GET_ACTIVITY_CONTAINER_TRANSACTION, data, reply, 0);
4928 reply.readException();
Craig Mautnerbd503a42014-01-10 10:16:43 -08004929 final int result = reply.readInt();
4930 final IActivityContainer res;
4931 if (result == 1) {
4932 res = IActivityContainer.Stub.asInterface(reply.readStrongBinder());
4933 } else {
4934 res = null;
4935 }
Craig Mautnere0a38842013-12-16 16:14:02 -08004936 data.recycle();
4937 reply.recycle();
4938 return res;
4939 }
4940
Craig Mautner4a1cb222013-12-04 16:14:06 -08004941 public IBinder getHomeActivityToken() throws RemoteException {
4942 Parcel data = Parcel.obtain();
4943 Parcel reply = Parcel.obtain();
4944 data.writeInterfaceToken(IActivityManager.descriptor);
4945 mRemote.transact(GET_HOME_ACTIVITY_TOKEN_TRANSACTION, data, reply, 0);
4946 reply.readException();
4947 IBinder res = reply.readStrongBinder();
4948 data.recycle();
4949 reply.recycle();
4950 return res;
4951 }
4952
Craig Mautneraea74a52014-03-08 14:23:10 -08004953 @Override
4954 public void startLockTaskMode(int taskId) throws RemoteException {
4955 Parcel data = Parcel.obtain();
4956 Parcel reply = Parcel.obtain();
4957 data.writeInterfaceToken(IActivityManager.descriptor);
4958 data.writeInt(taskId);
4959 mRemote.transact(START_LOCK_TASK_BY_TASK_ID_TRANSACTION, data, reply, 0);
4960 reply.readException();
4961 data.recycle();
4962 reply.recycle();
4963 }
4964
4965 @Override
4966 public void startLockTaskMode(IBinder token) throws RemoteException {
4967 Parcel data = Parcel.obtain();
4968 Parcel reply = Parcel.obtain();
4969 data.writeInterfaceToken(IActivityManager.descriptor);
4970 data.writeStrongBinder(token);
4971 mRemote.transact(START_LOCK_TASK_BY_TOKEN_TRANSACTION, data, reply, 0);
4972 reply.readException();
4973 data.recycle();
4974 reply.recycle();
4975 }
4976
4977 @Override
Jason Monk62515be2014-05-21 16:06:19 -04004978 public void startLockTaskModeOnCurrent() throws RemoteException {
4979 Parcel data = Parcel.obtain();
4980 Parcel reply = Parcel.obtain();
4981 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07004982 mRemote.transact(START_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04004983 reply.readException();
4984 data.recycle();
4985 reply.recycle();
4986 }
4987
4988 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08004989 public void stopLockTaskMode() throws RemoteException {
4990 Parcel data = Parcel.obtain();
4991 Parcel reply = Parcel.obtain();
4992 data.writeInterfaceToken(IActivityManager.descriptor);
4993 mRemote.transact(STOP_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
4994 reply.readException();
4995 data.recycle();
4996 reply.recycle();
4997 }
4998
4999 @Override
Jason Monk62515be2014-05-21 16:06:19 -04005000 public void stopLockTaskModeOnCurrent() throws RemoteException {
5001 Parcel data = Parcel.obtain();
5002 Parcel reply = Parcel.obtain();
5003 data.writeInterfaceToken(IActivityManager.descriptor);
Craig Mautnerd61dc202014-07-07 11:09:11 -07005004 mRemote.transact(STOP_LOCK_TASK_BY_CURRENT_TRANSACTION, data, reply, 0);
Jason Monk62515be2014-05-21 16:06:19 -04005005 reply.readException();
5006 data.recycle();
5007 reply.recycle();
5008 }
5009
5010 @Override
Craig Mautneraea74a52014-03-08 14:23:10 -08005011 public boolean isInLockTaskMode() throws RemoteException {
5012 Parcel data = Parcel.obtain();
5013 Parcel reply = Parcel.obtain();
5014 data.writeInterfaceToken(IActivityManager.descriptor);
5015 mRemote.transact(IS_IN_LOCK_TASK_MODE_TRANSACTION, data, reply, 0);
5016 reply.readException();
5017 boolean isInLockTaskMode = reply.readInt() == 1;
5018 data.recycle();
5019 reply.recycle();
5020 return isInLockTaskMode;
5021 }
5022
Craig Mautner688b5102014-03-27 16:55:03 -07005023 @Override
Winson Chunga449dc02014-05-16 11:15:04 -07005024 public void setTaskDescription(IBinder token, ActivityManager.TaskDescription values)
Winson Chung03a9bae2014-05-02 09:56:12 -07005025 throws RemoteException {
Craig Mautner2fbd7542014-03-21 09:34:07 -07005026 Parcel data = Parcel.obtain();
5027 Parcel reply = Parcel.obtain();
5028 data.writeInterfaceToken(IActivityManager.descriptor);
5029 data.writeStrongBinder(token);
Winson Chung03a9bae2014-05-02 09:56:12 -07005030 values.writeToParcel(data, 0);
Winson Chunga449dc02014-05-16 11:15:04 -07005031 mRemote.transact(SET_TASK_DESCRIPTION_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY);
Craig Mautner2fbd7542014-03-21 09:34:07 -07005032 reply.readException();
5033 data.recycle();
5034 reply.recycle();
5035 }
5036
Craig Mautneree2e45a2014-06-27 12:10:03 -07005037 @Override
5038 public boolean setMediaPlaying(IBinder token, boolean playing) throws RemoteException {
5039 Parcel data = Parcel.obtain();
5040 Parcel reply = Parcel.obtain();
5041 data.writeInterfaceToken(IActivityManager.descriptor);
5042 data.writeStrongBinder(token);
5043 data.writeInt(playing ? 1 : 0);
5044 mRemote.transact(SET_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5045 reply.readException();
5046 boolean success = reply.readInt() > 0;
5047 data.recycle();
5048 reply.recycle();
5049 return success;
5050 }
5051
5052 @Override
5053 public boolean isBackgroundMediaPlaying(IBinder token) throws RemoteException {
5054 Parcel data = Parcel.obtain();
5055 Parcel reply = Parcel.obtain();
5056 data.writeInterfaceToken(IActivityManager.descriptor);
5057 data.writeStrongBinder(token);
5058 mRemote.transact(IS_BG_MEDIA_PLAYING_TRANSACTION, data, reply, 0);
5059 reply.readException();
5060 final boolean playing = reply.readInt() > 0;
5061 data.recycle();
5062 reply.recycle();
5063 return playing;
5064 }
5065
5066 @Override
5067 public void mediaResourcesReleased(IBinder token) throws RemoteException {
5068 Parcel data = Parcel.obtain();
5069 Parcel reply = Parcel.obtain();
5070 data.writeInterfaceToken(IActivityManager.descriptor);
5071 data.writeStrongBinder(token);
5072 mRemote.transact(MEDIA_RESOURCES_RELEASED, data, reply, IBinder.FLAG_ONEWAY);
5073 reply.readException();
5074 data.recycle();
5075 reply.recycle();
5076 }
5077
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005078 private IBinder mRemote;
5079}